Revision control

Copy as Markdown

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if (gradle.root.hasProperty("mozconfig")) {
apply from: file('../../../../mobile/android/shared-settings.gradle')
}
import org.yaml.snakeyaml.Yaml
buildscript {
dependencies {
classpath 'org.yaml:snakeyaml:2.2'
}
if (!gradle.root.hasProperty("mozconfig")) {
// in app-services
repositories {
mavenCentral()
}
} else {
// big copy/paste from mobile/android/shared-settings.gradle.
gradle.ext.mozconfig = gradle.root.mozconfig
repositories {
gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORIES.each { repository ->
maven {
url = repository
if (gradle.mozconfig.substs.ALLOW_INSECURE_GRADLE_REPOSITORIES) {
allowInsecureProtocol = true
}
}
}
}
}
}
def yaml
def buildconfig
def calcVersion
if (!gradle.root.hasProperty("mozconfig")) {
// This config stuff is only used in app-services.
yaml = new Yaml()
buildconfig = yaml.load(new File(rootDir, '../../.buildconfig-android.yml').newInputStream())
calcVersion = { ->
def local = gradle.rootProject.findProperty("local")
def version = new File(rootDir, '../../version.txt').getText().trim()
if (gradle.rootProject.hasProperty("nightlyVersion")) {
return gradle.rootProject.nightlyVersion
} else if(local) {
return '0.0.1-SNAPSHOT'
} else {
return version
}
}
gradle.projectsLoaded { ->
// Wait until root project is "loaded" before we set "config"
// XXX - there's no "config" here. This should be upgraded to use the same mechanism as the other components?
// Note that since this is set on "rootProject.ext", it will be "in scope" during the evaluation of all projects'
// gradle files. This means that they can just access "config.<value>", and it'll function properly
gradle.rootProject.ext.library = [
// You can use -Plocal=true to help with mavenLocal publishing workflow.
// It makes a fake version number that's smaller than any published version,
// which can be depended on specifically by the ./build-scripts/substitute-local-appservices.gradle
// but which is unlikely to be depended on by accident otherwise.
version: calcVersion(),
groupId: buildconfig.groupId,
]
gradle.rootProject.ext.description = buildconfig.projects["tooling-nimbus-gradle"].description
}
}