no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / mobile / android / android-components / settings.gradle
blob50c58ed003e0bdffab8cdf487b30d8db3ac926a9
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/. */
5 pluginManagement {
6     apply from: file('../gradle/mozconfig.gradle')
8     repositories {
9         gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
10             maven {
11                 url repository
12                 if (gradle.mozconfig.substs.ALLOW_INSECURE_GRADLE_REPOSITORIES) {
13                     allowInsecureProtocol = true
14                 }
15             }
16         }
17     }
19     includeBuild("plugins/dependencies")
20     includeBuild("plugins/publicsuffixlist")
23 plugins {
24     id 'mozac.DependenciesPlugin'
27 ext.topsrcdir = rootProject.projectDir.absolutePath.minus("mobile/android/android-components")
29 apply from: file('../shared-settings.gradle')
31 buildCache {
32     local {
33         directory = new File(rootDir, '.build-cache')
34         removeUnusedEntriesAfterDays = 30
35     }
38 def runCmd(cmd, workingDir, successMessage) {
39     def proc = cmd.execute(null, new File(workingDir))
40     proc.consumeProcessOutput(System.out, System.err)
41     proc.waitFor()
42     if (proc.exitValue() != 0) {
43         throw new GradleException("Process '${cmd}' finished with non-zero exit value ${proc.exitValue()}")
44     } else {
45         logger.lifecycle(successMessage)
46     }
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')
61 } else {
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)
68     }
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";
79         }
80         publishAppServicesCmd << "./automation/publish_to_maven_local_if_modified.py";
81         runCmd(publishAppServicesCmd, appServicesLocalPath, "Published application-services for local development.")
82     } else {
83         logger.lifecycle("Disabled auto-publication of application-services. Enable it by settings '$settingAppServicesPath' in local.properties")
84     }
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";
95         }
96         publishGleanCmd << "./build-scripts/publish_to_maven_local_if_modified.py";
97         runCmd(publishGleanCmd, gleanLocalPath, "Published Glean for local development.")
98     } else {
99         logger.lifecycle("Disabled auto-publication of Glean. Enable it by settings '$settingGleanPath' in local.properties")
100     }