Skip to content

Commit

Permalink
refactor(buildSrc): Configure publication of plugins via conventions
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sschuberth committed Sep 14, 2023
1 parent dd16768 commit a929da7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
27 changes: 1 addition & 26 deletions buildSrc/src/main/kotlin/ort-plugins-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ plugins {

// Apply precompiled plugins.
id("ort-base-conventions")
id("ort-publication-conventions")
}

javaPlatform {
Expand All @@ -41,29 +42,3 @@ dependencies {
api(it)
}
}

configure<PublishingExtension> {
publications {
create<MavenPublication>(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:[email protected]:oss-review-toolkit/ort.git"
tag = version.toString()
url = "https://github.com/oss-review-toolkit/ort"
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ configure<PublishingExtension> {

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
Expand Down

0 comments on commit a929da7

Please sign in to comment.