Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,19 @@ tasks.named("check") {
}
}

tasks.register("showPublications") {
gradle.includedBuilds.forEach {
if (it.name != "docs" && !it.projectDir.path.contains("build-logic")) {
dependsOn(it.task(":showPublications"))
}
}
}

listOf(
"publishTo" to "MavenLocal",
"publishAllPublicationsTo" to "CommonRepository",
"publishAllPublicationsTo" to "SnapshotsRepository",
"publishAllPublicationsTo" to "NexusRepository",
"publishTo" to "MavenLocal",
"publishAllPublicationsTo" to "CommonRepository",
"publishAllPublicationsTo" to "SnapshotsRepository",
"publishAllPublicationsTo" to "NexusRepository",
).forEach { entry ->
val (taskPrefix, repo) = entry
tasks.register("$taskPrefix$repo") {
Expand Down Expand Up @@ -123,8 +131,8 @@ tasks.register<Zip>("releaseZip") {
val updateSamples by tasks.registering

mapOf(
"updateSamplesDir" to "samples",
"updateMavenReprosDir" to "native-maven-plugin/reproducers"
"updateSamplesDir" to "samples",
"updateMavenReprosDir" to "native-maven-plugin/reproducers"
).forEach { (taskName, dir) ->
val t = tasks.register<org.graalvm.build.samples.SamplesUpdateTask>(taskName) {
inputDirectory.set(layout.projectDirectory.dir(dir))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,33 @@ plugins.withId("java-test-fixtures") {
}
}

val publicationCoordinatesCollector = gradle.sharedServices.registerIfAbsent("publicationCoordinatesCollector", PublicationCoordinatesCollector::class.java) {
}

val showPublications by tasks.registering {
usesService(publicationCoordinatesCollector)
doLast {
publishing.publications.all {
val pub = this as MavenPublication
publicationCoordinatesCollector.get().addPublication(pub)
}
}
}

// Get a handle on the software component factory
interface Services {
@Inject
fun getSoftwareComponentFactory(): SoftwareComponentFactory
}

abstract class PublicationCoordinatesCollector: BuildService<BuildServiceParameters.None>, AutoCloseable {
val publications = mutableSetOf<String>()

fun addPublication(publication: MavenPublication) {
publications.add("${publication.groupId}:${publication.artifactId}:${publication.version}")
}

override fun close() {
publications.sorted().forEach { println(it) }
}
}