1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 apply from: file('../gradle/mozconfig.gradle')
9 gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
12 if (gradle.mozconfig.substs.ALLOW_INSECURE_GRADLE_REPOSITORIES) {
13 allowInsecureProtocol = true
19 includeBuild("plugins/dependencies")
20 includeBuild("plugins/publicsuffixlist")
24 id 'mozac.DependenciesPlugin'
27 ext.topsrcdir = rootProject.projectDir.absolutePath.minus("mobile/android/android-components")
29 apply from: file('../shared-settings.gradle')
33 directory = new File(rootDir, '.build-cache')
34 removeUnusedEntriesAfterDays = 30
38 def runCmd(cmd, workingDir, successMessage) {
39 def proc = cmd.execute(null, new File(workingDir))
40 proc.consumeProcessOutput(System.out, System.err)
42 if (proc.exitValue() != 0) {
43 throw new GradleException("Process '${cmd}' finished with non-zero exit value ${proc.exitValue()}")
45 logger.lifecycle(successMessage)
49 //////////////////////////////////////////////////////////////////////////
50 // Local Development overrides
51 //////////////////////////////////////////////////////////////////////////
53 Properties localProperties = null;
54 String settingAppServicesPath = "autoPublish.application-services.dir"
55 String settingGleanPath = "autoPublish.glean.dir";
57 if (file('local.properties').canRead()) {
58 localProperties = new Properties()
59 localProperties.load(file('local.properties').newDataInputStream())
60 logger.lifecycle('Local configuration: loaded local.properties')
62 logger.lifecycle('Local configuration: absent local.properties; proceeding as normal.')
65 if (localProperties != null) {
66 localProperties.each { prop ->
67 gradle.ext.set("localProperties.${prop.key}", prop.value)
70 String appServicesLocalPath = localProperties.getProperty(settingAppServicesPath);
72 if (appServicesLocalPath != null) {
73 logger.lifecycle("Enabling automatic publication of application-services from: $appServicesLocalPath")
74 // Windows can't execute .py files directly, so we assume a "manually installed" python,
75 // which comes with a "py" launcher and respects the shebang line to specify the version.
76 def publishAppServicesCmd = [];
77 if (System.properties['os.name'].toLowerCase().contains('windows')) {
78 publishAppServicesCmd << "py";
80 publishAppServicesCmd << "./automation/publish_to_maven_local_if_modified.py";
81 runCmd(publishAppServicesCmd, appServicesLocalPath, "Published application-services for local development.")
83 logger.lifecycle("Disabled auto-publication of application-services. Enable it by settings '$settingAppServicesPath' in local.properties")
86 String gleanLocalPath = localProperties.getProperty(settingGleanPath);
88 if (gleanLocalPath != null) {
89 logger.lifecycle("Enabling automatic publication of Glean from: $gleanLocalPath")
90 // Windows can't execute .py files directly, so we assume a "manually installed" python,
91 // which comes with a "py" launcher and respects the shebang line to specify the version.
92 def publishGleanCmd = [];
93 if (System.properties['os.name'].toLowerCase().contains('windows')) {
94 publishGleanCmd << "py";
96 publishGleanCmd << "./build-scripts/publish_to_maven_local_if_modified.py";
97 runCmd(publishGleanCmd, gleanLocalPath, "Published Glean for local development.")
99 logger.lifecycle("Disabled auto-publication of Glean. Enable it by settings '$settingGleanPath' in local.properties")