Skip to content

Commit

Permalink
build: fix issue caused by interaction between 'publish-maven-central…
Browse files Browse the repository at this point in the history
…' and 'publish-artifactregistry' (#54)

Signed-off-by: Jendrik Johannes <[email protected]>
  • Loading branch information
jjohannes authored Dec 20, 2024
1 parent a73bec3 commit 60f0b38
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Hiero Gradle Conventions - Changelog

## Version 0.1.3

* fix issue caused by interaction between 'publish-maven-central' and 'publish-artifactregistry' (#54)

## Version 0.1.2

* make license header configurable via 'license-header.txt' (#48)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
plugins { id("maven-publish") }

if (gradle.startParameter.taskNames.any { it.startsWith("release") }) {
if (
gradle.startParameter.taskNames.any { it.startsWith("release") && !it.contains("MavenCentral") }
) {
// We apply the 'artifactregistry' plugin conditionally, as it does not support configuration
// cache.
// https://github.com/GoogleCloudPlatform/artifact-registry-maven-tools/issues/85
Expand Down
19 changes: 19 additions & 0 deletions src/test/kotlin/org/hiero/gradle/test/MavenCentralPublishTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ import org.junit.jupiter.api.Test

class MavenCentralPublishTest {

@Test
fun `does not break with when using publish-artifactregistry plugin`() {
val p = GradleProject().withMinimalStructure()
p.withEnv(mapOf("NEXUS_USERNAME" to "foo", "NEXUS_PASSWORD" to "bar"))
p.moduleBuildFile(
"""plugins {
id("org.hiero.gradle.module.library")
id("org.hiero.gradle.feature.publish-artifactregistry")
}
"""
.trimMargin()
)

// We should not get: 'No staging repository with name sonatype created'
p.run(
"releaseMavenCentral -PpublishingPackageGroup=org.foo --dry-run --no-configuration-cache"
)
}

@Test
fun `attempts staging for non-snapshot releases`() {
val p = GradleProject().withMinimalStructure()
Expand Down

0 comments on commit 60f0b38

Please sign in to comment.