Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle: Update build to include pom.properties in gradle plugin jar #5285

Merged
merged 1 commit into from Jun 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 23 additions & 5 deletions gradle-plugins/biz.aQute.bnd.gradle/build.gradle.kts
Expand Up @@ -58,7 +58,7 @@ configurations {
val dslImplementation by existing {
extendsFrom(implementation.get())
}
val dslRuntimeOnly by existing {
val dslRuntimeOnly by existing {
extendsFrom(runtimeOnly.get())
}
}
Expand Down Expand Up @@ -169,6 +169,15 @@ publishing {
}
}
}
val publication = this
tasks.register<WriteProperties>("generatePomPropertiesFor${publication.name.capitalize()}Publication") {
description = "Generates the Maven pom.properties file for publication '${publication.name}'."
group = PublishingPlugin.PUBLISH_TASK_GROUP
setOutputFile(layout.buildDirectory.file("publications/${publication.name}/pom-default.properties"))
property("groupId", provider { publication.groupId })
property("artifactId", provider { publication.artifactId })
property("version", provider { publication.version })
}
}
}
}
Expand Down Expand Up @@ -201,17 +210,26 @@ tasks.withType<Javadoc> {
}

tasks.pluginUnderTestMetadata {
// Include dsl SourceSet
// Include dsl SourceSet
pluginClasspath.from(sourceSets["dsl"].output)
}

tasks.jar {
// Include dsl SourceSet
from(sourceSets["dsl"].output)
// Include generated pom file
into(archiveBaseName.map { "META-INF/maven/${project.group}/${it}" }) {
// META-INF/maven folder
val metaInfMaven = publishing.publications.named<MavenPublication>("pluginMaven").map {
"META-INF/maven/${it.groupId}/${it.artifactId}"
}
// Include generated pom.xml file
into(metaInfMaven) {
from(tasks.named("generatePomFileForPluginMavenPublication"))
rename(".*", "pom.xml")
rename { "pom.xml" }
}
// Include generated pom.properties file
into(metaInfMaven) {
from(tasks.named("generatePomPropertiesForPluginMavenPublication"))
rename { "pom.properties" }
}
}

Expand Down