Skip to content

Commit

Permalink
build: try again to fix misk OSS publishing.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: b7a47b7f8bc640f7dd5829d0acf8a5374f6ec1f3
  • Loading branch information
autonomousapps authored and svc-squareup-copybara committed Jan 7, 2025
1 parent 344378b commit b964324
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
11 changes: 6 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
Expand Down Expand Up @@ -40,7 +41,7 @@ buildscript {
plugins {
alias(libs.plugins.dependencyAnalysis)
alias(libs.plugins.binaryCompatibilityValidator)
alias(libs.plugins.mavenPublishBase)
alias(libs.plugins.mavenPublishBase) apply false
}

dependencyAnalysis {
Expand Down Expand Up @@ -319,11 +320,11 @@ subprojects {
}
}

allprojects {
subprojects {
plugins.withId("com.vanniktech.maven.publish.base") {
val publishUrl = System.getProperty("publish_url")
if (!publishUrl.isNullOrBlank()) {
publishing {
configure<PublishingExtension> {
repositories {
maven {
url = uri(publishUrl)
Expand All @@ -335,12 +336,12 @@ allprojects {
}
}
} else {
mavenPublishing {
configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.S01, automaticRelease = true)
signAllPublications()
}
}
mavenPublishing {
configure<MavenPublishBaseExtension> {
pom {
description.set("Open source application container in Kotlin")
name.set(project.name)
Expand Down
19 changes: 12 additions & 7 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,21 @@ dependencyResolutionManagement {
}

gradle.lifecycle.beforeProject {
group = when {
// The root "misk" project must not have the same group as the misk/misk project, since that
// gives each identical group-artifact (GA) identifiers, which confuses Gradle when we use
// `includeBuild("misk")`. The root must still have some group, though, because of the
// requirements of the vanniktech maven.publish plugin. We use this group so that the plugin
// matches the `com.squareup.misk` staging profile.
path == ":" -> "com.squareup.misk.root"
val g = when {
// The root "misk" project isn't a code-containing project (it's not a module). It doesn't need
// a group, and in fact giving it a group confuses gradle when we `includeBuild("misk")`
// elsewhere, because doing that makes `misk/` and `misk/misk/` _identical_ in GA
// (group-artifact) terms.
path == ":" -> null
path.startsWith(":wisp") -> "app.cash.wisp"
else -> "com.squareup.misk"
}

// In the case of the root project, we let it be the default value
if (g != null) {
group = g
}

version = findProperty("VERSION_NAME") as? String ?: "0.0-SNAPSHOT"
}

Expand Down

0 comments on commit b964324

Please sign in to comment.