From a929da765b58d0fabc8588442f0b5f9792e25ae9 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 14 Sep 2023 17:06:05 +0200 Subject: [PATCH] refactor(buildSrc): Configure publication of plugins via conventions This nicely deduplicates the publishing code for plugin platforms in favor of the more complete configuration in the publication conventions. Signed-off-by: Sebastian Schuberth --- .../kotlin/ort-plugins-conventions.gradle.kts | 27 +------------------ .../ort-publication-conventions.gradle.kts | 5 ++-- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/buildSrc/src/main/kotlin/ort-plugins-conventions.gradle.kts b/buildSrc/src/main/kotlin/ort-plugins-conventions.gradle.kts index 0d2004cfbda99..b5b2015bc9cdb 100644 --- a/buildSrc/src/main/kotlin/ort-plugins-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/ort-plugins-conventions.gradle.kts @@ -24,6 +24,7 @@ plugins { // Apply precompiled plugins. id("ort-base-conventions") + id("ort-publication-conventions") } javaPlatform { @@ -41,29 +42,3 @@ dependencies { api(it) } } - -configure { - publications { - create(name) { - groupId = "org.ossreviewtoolkit.plugins" - - from(components["javaPlatform"]) - - pom { - licenses { - license { - name = "Apache-2.0" - url = "https://www.apache.org/licenses/LICENSE-2.0" - } - } - - scm { - connection = "scm:git:https://github.com/oss-review-toolkit/ort.git" - developerConnection = "scm:git:git@github.com:oss-review-toolkit/ort.git" - tag = version.toString() - url = "https://github.com/oss-review-toolkit/ort" - } - } - } - } -} diff --git a/buildSrc/src/main/kotlin/ort-publication-conventions.gradle.kts b/buildSrc/src/main/kotlin/ort-publication-conventions.gradle.kts index 425739dd7a00d..9bcbf03a5558b 100644 --- a/buildSrc/src/main/kotlin/ort-publication-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/ort-publication-conventions.gradle.kts @@ -35,9 +35,8 @@ configure { groupId = "org${getGroupId(parent)}" - from(components["java"]) - artifact(tasks["sourcesJar"]) - artifact(tasks["docsJavadocJar"]) + listOf("java", "javaPlatform").mapNotNull { components.findByName(it) }.forEach(::from) + listOf("sourcesJar", "docsJavadocJar").mapNotNull { tasks.findByName(it) }.forEach(::artifact) pom { name = project.name