diff --git a/.github/workflows/build-and-publish.yaml b/.github/workflows/build-and-publish.yaml index 73e9453..f8f2c79 100644 --- a/.github/workflows/build-and-publish.yaml +++ b/.github/workflows/build-and-publish.yaml @@ -8,7 +8,7 @@ on: jobs: build-and-publish: name: Java Gradle - uses: bakdata/ci-templates/.github/workflows/java-gradle-plugin.yaml@1.41.0 + uses: bakdata/ci-templates/.github/workflows/java-gradle-plugin.yaml@1.42.0 secrets: sonar-token: ${{ secrets.SONARCLOUD_TOKEN }} sonar-organization: ${{ secrets.SONARCLOUD_ORGANIZATION }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 57b7dcd..7772893 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,7 +16,7 @@ on: jobs: java-gradle-release: name: Java Gradle - uses: bakdata/ci-templates/.github/workflows/java-gradle-release.yaml@1.41.0 + uses: bakdata/ci-templates/.github/workflows/java-gradle-release.yaml@1.42.0 with: release-type: "${{ inputs.release-type }}" secrets: diff --git a/README.md b/README.md index 3a542fd..72e9948 100644 --- a/README.md +++ b/README.md @@ -49,3 +49,23 @@ By just using the gradle-avro-plugin, you would not be able to compile the schem because the schema for `com.bakdata.kafka.DeadLetter` is not present in the project. It is located in the `com.bakdata.kafka:error-handling` dependency and our plugin adds it to the classpath of the Avro compiler. + +## Development + +Snapshot versions of these plugins are published to Sonatype. +You can use them in your project by adding the following snippet to your `build.gradle.kts` + +``` +buildscript { + repositories { + maven { + url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") + } + } + dependencies { + classpath("com.bakdata.gradle:avro:0.0.1-SNAPSHOT") + } +} + +apply(plugin = "com.bakdata.avro") +``` diff --git a/build.gradle.kts b/build.gradle.kts index 74451fe..272cd4b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ plugins { // release id("net.researchgate.release") version "3.0.2" id("com.bakdata.sonar") version "1.1.17" - id("com.bakdata.sonatype") version "1.2.1" + id("com.bakdata.sonatype") version "1.2.2" id("org.hildan.github.changelog") version "1.13.1" id("org.gradle.kotlin.kotlin-dsl") version "2.1.6" apply false id("com.gradle.plugin-publish") version "1.2.1" apply false @@ -43,41 +43,38 @@ subprojects { targetCompatibility = JavaVersion.VERSION_11 } - dependencies { - "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.7.2") - "testImplementation"("org.junit.jupiter:junit-jupiter-api:5.7.2") - "testImplementation"("org.assertj", "assertj-core", "3.20.2") + apply(plugin = "java-gradle-plugin") + + // config for gradle plugin portal doesn't support snapshot, so we add config only if release version + if (!version.toString().endsWith("-SNAPSHOT")) { + apply(plugin = "com.gradle.plugin-publish") } -} -// config for gradle plugin portal -// doesn't support snapshot, so we add config only if release version -if (!version.toString().endsWith("-SNAPSHOT")) { - subprojects.forEach { project -> - with(project) { - // com.gradle.plugin-publish depends on java-gradle-plugin, but it screws a bit this project - apply(plugin = "java-gradle-plugin") - apply(plugin = "com.gradle.plugin-publish") - project.afterEvaluate { - // java-gradle-plugin requires this block, but we already added the definitions in META-INF for unit testing... - configure { - plugins { - create("${project.name.capitalize()}Plugin") { - id = "com.bakdata.${project.name}" - implementationClass = "com.bakdata.gradle.${project.name.capitalize()}Plugin" - description = project.description - displayName = "Bakdata $name plugin" - } - } - } - // actual block of plugin portal config, need to be done on each subproject as the plugin does not support multi-module projects yet... - configure { - website = "https://github.com/bakdata/gradle-avro-dependency-plugin" - vcsUrl = "https://github.com/bakdata/gradle-avro-dependency-plugin" - tags = listOf("bakdata", name) + // description is only ready after evaluation + afterEvaluate { + configure { + plugins { + create("${project.name.capitalize()}Plugin") { + id = "com.bakdata.${project.name}" + implementationClass = "com.bakdata.gradle.${project.name.capitalize()}Plugin" + description = project.description + displayName = "Bakdata $name plugin" } } } + + extensions.findByType(com.gradle.publish.PluginBundleExtension::class)?.apply { + // actual block of plugin portal config, need to be done on each subproject as the plugin does not support multi-module projects yet... + website = "https://github.com/bakdata/gradle-avro-dependency-plugin" + vcsUrl = "https://github.com/bakdata/gradle-avro-dependency-plugin" + tags = listOf("bakdata", name) + } + } + + dependencies { + "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.7.2") + "testImplementation"("org.junit.jupiter:junit-jupiter-api:5.7.2") + "testImplementation"("org.assertj", "assertj-core", "3.20.2") } }