diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..e4446d1 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,7 @@ +repositories { + gradlePluginPortal() +} + +plugins { + `kotlin-dsl` +} diff --git a/buildSrc/src/main/kotlin/develocity/adapters/SourceSetExtensions.kt b/buildSrc/src/main/kotlin/develocity/adapters/SourceSetExtensions.kt new file mode 100644 index 0000000..911ba6a --- /dev/null +++ b/buildSrc/src/main/kotlin/develocity/adapters/SourceSetExtensions.kt @@ -0,0 +1,8 @@ +package develocity.adapters + +import org.gradle.api.Project +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.api.tasks.SourceSetOutput +import org.gradle.kotlin.dsl.the + +fun Project.sourceSetOutput(name: String): SourceSetOutput = the().getByName(name).output diff --git a/buildSrc/src/main/kotlin/develocity/adapters/develocity.adapters-library.gradle.kts b/buildSrc/src/main/kotlin/develocity/adapters/develocity.adapters-library.gradle.kts new file mode 100644 index 0000000..833850a --- /dev/null +++ b/buildSrc/src/main/kotlin/develocity/adapters/develocity.adapters-library.gradle.kts @@ -0,0 +1,27 @@ +import develocity.adapters.sourceSetOutput + +plugins { + java +} + +repositories { + mavenCentral() +} + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(8)) + } +} + +sourceSets { + create("compatibilityApi") + create("enterpriseCompatibility") + create("develocityCompatibility") +} + +tasks.jar { + from(sourceSetOutput("compatibilityApi")) + from(sourceSetOutput("enterpriseCompatibility")) + from(sourceSetOutput("develocityCompatibility")) +} diff --git a/develocity-gradle-plugin-adapters/build.gradle.kts b/develocity-gradle-plugin-adapters/build.gradle.kts index cc3177b..9ef94ba 100644 --- a/develocity-gradle-plugin-adapters/build.gradle.kts +++ b/develocity-gradle-plugin-adapters/build.gradle.kts @@ -1,5 +1,7 @@ +import develocity.adapters.sourceSetOutput + plugins { - java + id("develocity.adapters-library") } repositories { @@ -12,35 +14,14 @@ repositories { } } -sourceSets { - create("compatibilityApi") - create("enterpriseCompatibility") - create("develocityCompatibility") -} - -fun sourceSet(name: String): SourceSetOutput = sourceSets[name].output - dependencies { "compatibilityApiCompileOnly"(gradleApi()) "enterpriseCompatibilityCompileOnly"(gradleApi()) "enterpriseCompatibilityCompileOnly"(libs.gradle.enterprise.plugin) - "enterpriseCompatibilityImplementation"(sourceSet("compatibilityApi")) + "enterpriseCompatibilityImplementation"(sourceSetOutput("compatibilityApi")) "develocityCompatibilityCompileOnly"(gradleApi()) "develocityCompatibilityCompileOnly"(libs.develocity.plugin) - "develocityCompatibilityImplementation"(sourceSet("compatibilityApi")) -} - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(8)) - } + "develocityCompatibilityImplementation"(sourceSetOutput("compatibilityApi")) } - -tasks.jar { - from(sourceSet("compatibilityApi")) - from(sourceSet("enterpriseCompatibility")) - from(sourceSet("develocityCompatibility")) -} - diff --git a/develocity-maven-plugin-adapters/build.gradle.kts b/develocity-maven-plugin-adapters/build.gradle.kts index 1ebd207..690acff 100644 --- a/develocity-maven-plugin-adapters/build.gradle.kts +++ b/develocity-maven-plugin-adapters/build.gradle.kts @@ -1,9 +1,10 @@ +import develocity.adapters.sourceSetOutput + plugins { - java + id("develocity.adapters-library") } repositories { - mavenCentral() maven { url = uri("https://repo.grdev.net/artifactory/public") content { @@ -12,28 +13,14 @@ repositories { } } -sourceSets { - create("compatibilityApi") - create("enterpriseCompatibility") - create("develocityCompatibility") -} - -fun sourceSet(name: String): SourceSetOutput = sourceSets[name].output - dependencies { "compatibilityApiCompileOnly"(libs.maven.core) "enterpriseCompatibilityCompileOnly"(libs.maven.core) "enterpriseCompatibilityCompileOnly"(libs.gradle.enterprise.extension) - "enterpriseCompatibilityImplementation"(sourceSet("compatibilityApi")) + "enterpriseCompatibilityImplementation"(sourceSetOutput("compatibilityApi")) "develocityCompatibilityCompileOnly"(libs.maven.core) "develocityCompatibilityCompileOnly"(libs.develocity.extension) - "develocityCompatibilityImplementation"(sourceSet("compatibilityApi")) -} - -tasks.jar { - from(sourceSet("compatibilityApi")) - from(sourceSet("enterpriseCompatibility")) - from(sourceSet("develocityCompatibility")) + "develocityCompatibilityImplementation"(sourceSetOutput("compatibilityApi")) }