From 7bbee763a6822f8f13b1cb13efdecbf16fbb2873 Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Thu, 21 Apr 2022 12:26:27 +0200 Subject: [PATCH] Auto-publish & substitute local Glean package Careful with this: If anything inside Glean Core changes this will still require a local substitute for the Gecko build. --- app/build.gradle | 5 +++++ settings.gradle | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 3bdb10eaa..163362052 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -804,6 +804,11 @@ if (gradle.hasProperty('localProperties.autoPublish.application-services.dir')) apply from: "../${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle" } +if (gradle.hasProperty('localProperties.autoPublish.glean.dir')) { + ext.gleanSrcDir = gradle."localProperties.autoPublish.glean.dir" + apply from: "../${gleanSrcDir}/build-scripts/substitute-local-glean.gradle" +} + // Define a reusable task for updating the versions of our built-in web extensions. We automate this // to make sure we never forget to update the version, either in local development or for releases. // In both cases, we want to make sure the latest version of all extensions (including their latest diff --git a/settings.gradle b/settings.gradle index fc721a35c..40877ea2b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -27,6 +27,7 @@ def runCmd(cmd, workingDir, successMessage, captureStdout=true) { Properties localProperties = null String settingAppServicesPath = "autoPublish.application-services.dir" String settingAndroidComponentsPath = "autoPublish.android-components.dir" +String settingGleanPath = "autoPublish.glean.dir" if (file('local.properties').canRead()) { localProperties = new Properties() @@ -71,4 +72,19 @@ if (localProperties != null) { } else { log("Disabled auto-publication of android-components. Enable it by settings '$settingAndroidComponentsPath' in local.properties") } + + String gleanLocalPath = localProperties.getProperty(settingGleanPath) + + if (gleanLocalPath != null) { + log("Enabling automatic publication of Glean from: $gleanLocalPath") + // As above, hacks to execute .py files on Windows. + def publishGleanCmd = []; + if (System.properties['os.name'].toLowerCase().contains('windows')) { + publishGleanCmd << "py"; + } + publishGleanCmd << "./build-scripts/publish_to_maven_local_if_modified.py"; + runCmd(publishGleanCmd, gleanLocalPath, "Published Glean for local development.", false) + } else { + log("Disabled auto-publication of Glean. Enable it by settings '$settingGleanPath' in local.properties") + } }