diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c400d3b7e..425540b97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,13 +54,12 @@ jobs: git push git push --tags - # TODO requires the GRADLE_PUBLISH_KEY + GRADLE_PUBLISH_SECRET secrets - via https://plugins.gradle.org/user/login (IIRC) - #- name: gradle release ${{steps.metadata.outputs.current-version}} - # uses: gradle/gradle-build-action@v2 - # with: - # build-root-directory: ./tools/gradle-plugin - # cache-read-only: true - # arguments: publishPlugins -Pgradle.publish.key=${{secrets.GRADLE_PUBLISH_KEY}} -Pgradle.publish.secret=${{secrets.GRADLE_PUBLISH_SECRET}} + - name: Gradle plugin release ${{steps.metadata.outputs.current-version}} + uses: gradle/gradle-build-action@v2 + with: + build-root-directory: ./tools/gradle-plugin + cache-read-only: true + arguments: publishPlugins -Pgradle.publish.key=${{secrets.GRADLE_PUBLISH_KEY}} -Pgradle.publish.secret=${{secrets.GRADLE_PUBLISH_SECRET}} - uses: actions/upload-artifact@v3 name: tck-report diff --git a/tools/gradle-plugin/build.gradle b/tools/gradle-plugin/build.gradle new file mode 100644 index 000000000..1962abfcf --- /dev/null +++ b/tools/gradle-plugin/build.gradle @@ -0,0 +1,73 @@ +plugins { + id 'java-gradle-plugin' + id("com.gradle.plugin-publish") version "1.1.0" + id("com.github.vlsi.jandex") version "1.87" +} + +group = "io.smallrye" + +if (JavaVersion.current().isJava9Compatible()) { + compileJava.options.compilerArgs.addAll(['--release', '8']) +} + +compileJava { + options.encoding = 'UTF-8' + sourceCompatibility = '1.8' + targetCompatibility = '1.8' +} + +compileTestJava { + options.encoding = 'UTF-8' +} + +repositories { + mavenLocal() + mavenCentral() + maven { + url = uri("file:./target/dependencies") + } +} + +dependencies { + implementation("io.smallrye:smallrye-open-api-core:${version}") + implementation("io.smallrye:smallrye-open-api-jaxrs:${version}") + implementation("io.smallrye:smallrye-open-api-spring:${version}") + implementation("io.smallrye:smallrye-open-api-vertx:${version}") + implementation("io.smallrye.config:smallrye-config:${versionConfig}") + + testImplementation("org.junit.jupiter:junit-jupiter:${versionJunit5}") + testImplementation(gradleTestKit()) + testImplementation("org.assertj:assertj-core:3.24.2") + testImplementation("com.fasterxml.jackson.core:jackson-databind:${versionJackson}") +} + +test { + testLogging { + events "passed", "skipped", "failed" + } + useJUnitPlatform() + // multiple Gradle invocations executed from the same testing JVM cause problems, so fork + // for each test, and make sure we only run one Gradle execution in each test + forkEvery 1 +} + +gradlePlugin { + website = 'https://github.com/smallrye/smallrye-open-api/' + vcsUrl = 'https://github.com/smallrye/smallrye-open-api/' + plugins { + smallryeOpenAPIPlugin { + id = 'io.smallrye.openapi' + implementationClass = 'io.smallrye.openapi.gradleplugin.SmallryeOpenApiPlugin' + description = 'SmallRye: MicroProfile OpenAPI Gradle Plugin' + displayName = 'SmallRye: MicroProfile OpenAPI Gradle Plugin' + description = 'SmallRye: MicroProfile GraphQL Gradle Plugin' + tags.set([ 'smallrye', 'openapi', 'microprofile' ]) + } + } +} + +wrapper { + distributionType = Wrapper.DistributionType.ALL +} + +tasks.pluginUnderTestMetadata.dependsOn(processJandexIndex) diff --git a/tools/gradle-plugin/build.gradle.kts b/tools/gradle-plugin/build.gradle.kts deleted file mode 100644 index 04d5eab3a..000000000 --- a/tools/gradle-plugin/build.gradle.kts +++ /dev/null @@ -1,58 +0,0 @@ -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} - -plugins { - `java-gradle-plugin` - id("com.gradle.plugin-publish") version "1.1.0" - id("com.github.vlsi.jandex") version "1.87" -} - -repositories { - mavenCentral() - maven { - url = uri("file:./target/dependencies") - } -} - -dependencies { - val configVersion: String by project - val versionJackson: String by project - val versionJunit5: String by project - - implementation("io.smallrye:smallrye-open-api-core:$version") - implementation("io.smallrye:smallrye-open-api-jaxrs:$version") - implementation("io.smallrye:smallrye-open-api-spring:$version") - implementation("io.smallrye:smallrye-open-api-vertx:$version") - implementation("io.smallrye.config:smallrye-config:$configVersion") - - testImplementation("org.junit.jupiter:junit-jupiter:${versionJunit5}") - testImplementation(gradleTestKit()) - testImplementation("org.assertj:assertj-core:3.24.2") - testImplementation("com.fasterxml.jackson.core:jackson-databind:${versionJackson}") -} - -gradlePlugin { - val smallryePlugin by plugins.creating { - id = "io.smallrye.openapi" - implementationClass = "io.smallrye.openapi.gradleplugin.SmallryeOpenApiPlugin" - description = "Official Smallrye Open API Gradle plugin" - } -} - -pluginBundle { - website = "https://github.com/smallrye/smallrye-open-api/" - vcsUrl = "https://github.com/smallrye/smallrye-open-api/" - tags = listOf("openapi", "smallrye") -} - -tasks.named("test") { - useJUnitPlatform() -} - -tasks.named("pluginUnderTestMetadata") { - dependsOn("processJandexIndex") -} - -group = "io.smallrye" diff --git a/tools/gradle-plugin/settings.gradle.kts b/tools/gradle-plugin/settings.gradle similarity index 100% rename from tools/gradle-plugin/settings.gradle.kts rename to tools/gradle-plugin/settings.gradle diff --git a/tools/gradle-plugin/src/maven-build/gradle.properties b/tools/gradle-plugin/src/maven-build/gradle.properties index ce47e479d..0cfe26c71 100644 --- a/tools/gradle-plugin/src/maven-build/gradle.properties +++ b/tools/gradle-plugin/src/maven-build/gradle.properties @@ -2,6 +2,6 @@ # DO ONLY MODIFY THE FILE IN src/maven-build ! # version=${project.version} -configVersion=${version.io.smallrye.smallrye-config} +versionConfig=${version.io.smallrye.smallrye-config} versionJackson=${jackson-bom.version} versionJunit5=${version.junit5}