diff --git a/build-scripts/component-common.gradle b/build-scripts/component-common.gradle index 2d7cb26e47..9656d04606 100644 --- a/build-scripts/component-common.gradle +++ b/build-scripts/component-common.gradle @@ -115,6 +115,15 @@ dependencies { androidTestImplementation libs.androidx.test.runner } +// Pick the publish group id by build context. In m-c, `config` belongs to +// android-components (`config.componentsGroupId` is `org.mozilla.components`), +// so we hardcode `org.mozilla.appservices`. Standalone app-services uses +// `config.componentsGroupId`, which is the only place that appends the +// `.nightly` suffix nightly builds publish under. +ext.appServicesGroupId = gradle.root.hasProperty("mozconfig") + ? "org.mozilla.appservices" + : rootProject.config.componentsGroupId + // Shared logic for projects that depend on libmegazord // // This ensures that libmegazord will be in the library path so that it can be loaded. It also adds diff --git a/components/ads-client/android/build.gradle b/components/ads-client/android/build.gradle index 2d2db93313..b6e9faf57f 100644 --- a/components/ads-client/android/build.gradle +++ b/components/ads-client/android/build.gradle @@ -45,4 +45,4 @@ dependencies { ext.configureUniFFIBindgen("ads_client") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/autofill/android/build.gradle b/components/autofill/android/build.gradle index 64d1878da3..5fcaf37929 100644 --- a/components/autofill/android/build.gradle +++ b/components/autofill/android/build.gradle @@ -16,4 +16,4 @@ dependencies { ext.configureUniFFIBindgen("autofill") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/crashtest/android/build.gradle b/components/crashtest/android/build.gradle index 66b10120ae..7684e8fc1f 100644 --- a/components/crashtest/android/build.gradle +++ b/components/crashtest/android/build.gradle @@ -7,4 +7,4 @@ android { ext.configureUniFFIBindgen("crashtest") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/fxa-client/android/build.gradle b/components/fxa-client/android/build.gradle index d387acf7fe..8346dadc4e 100644 --- a/components/fxa-client/android/build.gradle +++ b/components/fxa-client/android/build.gradle @@ -47,4 +47,4 @@ dependencies { ext.configureUniFFIBindgen("fxa_client") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/init_rust_components/android/build.gradle b/components/init_rust_components/android/build.gradle index 2eedc53629..2bfd72a612 100644 --- a/components/init_rust_components/android/build.gradle +++ b/components/init_rust_components/android/build.gradle @@ -15,4 +15,4 @@ dependencies { ext.configureUniFFIBindgen("init_rust_components") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/logins/android/build.gradle b/components/logins/android/build.gradle index 038b1371d3..4834fb15f1 100644 --- a/components/logins/android/build.gradle +++ b/components/logins/android/build.gradle @@ -58,4 +58,4 @@ dependencies { ext.configureUniFFIBindgen("logins") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/merino/android/build.gradle b/components/merino/android/build.gradle index 03f7f70fc3..8fb32011b7 100644 --- a/components/merino/android/build.gradle +++ b/components/merino/android/build.gradle @@ -7,4 +7,4 @@ android { ext.configureUniFFIBindgen("merino") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/nimbus/android/build.gradle b/components/nimbus/android/build.gradle index 5b9f61cb0a..da36daa680 100644 --- a/components/nimbus/android/build.gradle +++ b/components/nimbus/android/build.gradle @@ -54,4 +54,4 @@ dependencies { ext.configureUniFFIBindgen("nimbus") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/places/android/build.gradle b/components/places/android/build.gradle index fdb42062a6..04e7bf2a0d 100644 --- a/components/places/android/build.gradle +++ b/components/places/android/build.gradle @@ -52,4 +52,4 @@ dependencies { ext.configureUniFFIBindgen("places") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/push/android/build.gradle b/components/push/android/build.gradle index 78aa011163..afe0c82408 100644 --- a/components/push/android/build.gradle +++ b/components/push/android/build.gradle @@ -7,4 +7,4 @@ android { ext.configureUniFFIBindgen("push") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/relay/android/build.gradle b/components/relay/android/build.gradle index cafd3510c5..e836136dc3 100644 --- a/components/relay/android/build.gradle +++ b/components/relay/android/build.gradle @@ -11,4 +11,4 @@ dependencies { ext.configureUniFFIBindgen("relay") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/remote_settings/android/build.gradle b/components/remote_settings/android/build.gradle index c7c458a596..9d92eff8cb 100644 --- a/components/remote_settings/android/build.gradle +++ b/components/remote_settings/android/build.gradle @@ -45,7 +45,7 @@ dependencies { ext.configureUniFFIBindgen("remote_settings") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) dependencies { if (gradle.hasProperty("mozconfig")) { diff --git a/components/search/android/build.gradle b/components/search/android/build.gradle index a54d4ae317..ababb55798 100644 --- a/components/search/android/build.gradle +++ b/components/search/android/build.gradle @@ -11,4 +11,4 @@ dependencies { ext.configureUniFFIBindgen("search") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) \ No newline at end of file +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) \ No newline at end of file diff --git a/components/suggest/android/build.gradle b/components/suggest/android/build.gradle index e8fb54d9f6..3eb7c8a35a 100644 --- a/components/suggest/android/build.gradle +++ b/components/suggest/android/build.gradle @@ -11,4 +11,4 @@ dependencies { ext.configureUniFFIBindgen("suggest") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/support/error/android/build.gradle b/components/support/error/android/build.gradle index 711b9fc908..bc0f8270b3 100644 --- a/components/support/error/android/build.gradle +++ b/components/support/error/android/build.gradle @@ -54,4 +54,4 @@ android { ext.configureUniFFIBindgen("error_support") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/support/rust-log-forwarder/android/build.gradle b/components/support/rust-log-forwarder/android/build.gradle index f72401b60c..5ff095334f 100644 --- a/components/support/rust-log-forwarder/android/build.gradle +++ b/components/support/rust-log-forwarder/android/build.gradle @@ -11,4 +11,4 @@ dependencies { ext.configureUniFFIBindgen("rust_log_forwarder") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/support/tracing/android/build.gradle b/components/support/tracing/android/build.gradle index 1eadd69e0c..9444ebd2be 100644 --- a/components/support/tracing/android/build.gradle +++ b/components/support/tracing/android/build.gradle @@ -7,4 +7,4 @@ android { ext.configureUniFFIBindgen("tracing_support") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/sync15/android/build.gradle b/components/sync15/android/build.gradle index fa742ae294..f77962ea79 100644 --- a/components/sync15/android/build.gradle +++ b/components/sync15/android/build.gradle @@ -7,4 +7,4 @@ android { ext.configureUniFFIBindgen("sync15") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/sync_manager/android/build.gradle b/components/sync_manager/android/build.gradle index 190f72f241..e37353f4da 100644 --- a/components/sync_manager/android/build.gradle +++ b/components/sync_manager/android/build.gradle @@ -55,4 +55,4 @@ dependencies { ext.configureUniFFIBindgen("sync_manager") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/tabs/android/build.gradle b/components/tabs/android/build.gradle index 825cfd6eeb..93960ba84b 100644 --- a/components/tabs/android/build.gradle +++ b/components/tabs/android/build.gradle @@ -14,4 +14,4 @@ dependencies { ext.configureUniFFIBindgen("tabs") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/components/viaduct/android/build.gradle b/components/viaduct/android/build.gradle index b5c6b8a072..3dcc73f089 100644 --- a/components/viaduct/android/build.gradle +++ b/components/viaduct/android/build.gradle @@ -16,4 +16,4 @@ dependencies { ext.configureUniFFIBindgen("viaduct") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) diff --git a/megazords/full/android/build.gradle b/megazords/full/android/build.gradle index dcb8e83816..dc3273db0a 100644 --- a/megazords/full/android/build.gradle +++ b/megazords/full/android/build.gradle @@ -228,8 +228,18 @@ if (!gradle.hasProperty("mozconfig")) { } } +// Duplicated from component-common.gradle, which the megazord doesn't apply. +// Pick the publish group id by build context. In m-c, `config` belongs to +// android-components (`config.componentsGroupId` is `org.mozilla.components`), +// so we hardcode `org.mozilla.appservices`. Standalone app-services uses +// `config.componentsGroupId`, which is the only place that appends the +// `.nightly` suffix nightly builds publish under. +ext.appServicesGroupId = gradle.root.hasProperty("mozconfig") + ? "org.mozilla.appservices" + : rootProject.config.componentsGroupId + apply from: "$publishDir/publish.gradle" -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description) afterEvaluate { def libUrl="https://github.com/mozilla/application-services" @@ -252,7 +262,7 @@ afterEvaluate { } pom { - groupId = "org.mozilla.appservices" + groupId = project.ext.appServicesGroupId artifactId = "${project.ext.artifactId}-libsForTests" description = project.ext.description // For mavenLocal publishing workflow, increment the version number every publish. diff --git a/publish.gradle b/publish.gradle index a106e01db9..abd7156cac 100644 --- a/publish.gradle +++ b/publish.gradle @@ -11,10 +11,12 @@ def libProjectName = properties.libProjectName def libUrl = properties.libUrl def libVcsUrl = properties.libVcsUrl -ext.configurePublish = { groupId = null, artifactId = null, description = null -> - def theGroupId = groupId ?: rootProject.config.componentsGroupId - def theArtifactId = artifactId ?: project.ext.artifactId - def theDescription = description ?: project.ext.description +// The `Arg` suffixes matter. Naming these `groupId`, `artifactId` or `description` shadows the +// assignments to the publication down in `pom`, which then silently do nothing. +ext.configurePublish = { groupIdArg = null, artifactIdArg = null, descriptionArg = null -> + def theGroupId = groupIdArg ?: rootProject.config.componentsGroupId + def theArtifactId = artifactIdArg ?: project.ext.artifactId + def theDescription = descriptionArg ?: project.ext.description // This is a little cludgey, but it seems unlikely to cause a problem, and // we are already doing it inside taskcluster. diff --git a/tools/start-bindings/templates/build.gradle b/tools/start-bindings/templates/build.gradle index 6dd2146c0e..bdcb8586a1 100644 --- a/tools/start-bindings/templates/build.gradle +++ b/tools/start-bindings/templates/build.gradle @@ -7,4 +7,4 @@ android { ext.configureUniFFIBindgen("{{ crate_name }}") ext.dependsOnTheMegazord() -ext.configurePublish("org.mozilla.appservices", project.name, project.ext.description) +ext.configurePublish(appServicesGroupId, project.name, project.ext.description)