Revision control

Copy as Markdown

pluginManagement {
repositories {
// Without these, plugin resolution reaches past the local Nexus in CI to
// the real repositories, and whatever it fetches is missing from the
// android-gradle-dependencies artifact.
def googleRepo = providers.gradleProperty("googleRepo")
if (googleRepo.present) {
maven {
name = "Google"
url = googleRepo.get()
allowInsecureProtocol = true // Local Nexus in CI uses HTTP
}
} else {
google()
}
def centralRepo = providers.gradleProperty("centralRepo")
if (centralRepo.present) {
maven {
name = "MavenCentral"
url = centralRepo.get()
allowInsecureProtocol = true // Local Nexus in CI uses HTTP
}
} else {
mavenCentral()
}
// Spotless publishes its plugin marker only to the plugin portal.
def pluginRepo = providers.gradleProperty("pluginRepo")
if (pluginRepo.present) {
maven {
name = "GradlePlugins"
url = pluginRepo.get()
allowInsecureProtocol = true // Local Nexus in CI uses HTTP
}
} else {
gradlePluginPortal()
}
}
}
include ':app'
def log(message) {
logger.lifecycle("[settings] ${message}")
}
def runCmd(cmd, workingDir, successMessage) {
def exec = providers.exec {
commandLine(cmd)
setWorkingDir(file(workingDir))
ignoreExitValue = true
}
print exec.standardOutput.asText.get()
System.err.print exec.standardError.asText.get()
int exitValue = exec.result.get().exitValue
if (exitValue != 0) {
throw new GradleException("Process '${cmd}' finished with non-zero exit value ${exitValue}")
}
log(successMessage)
}
//////////////////////////////////////////////////////////////////////////
// Local Development overrides
//////////////////////////////////////////////////////////////////////////
Properties localProperties = null
String settingAppServicesPath = "autoPublish.application-services.dir"
String settingAndroidComponentsPath = "autoPublish.android-components.dir"
if (file('local.properties').canRead()) {
localProperties = new Properties()
localProperties.load(file('local.properties').newDataInputStream())
log('Loaded local.properties')
} else {
}
if (localProperties != null) {
localProperties.each { prop ->
gradle.ext.set("localProperties.${prop.key}", prop.value)
}
String appServicesLocalPath = localProperties.getProperty(settingAppServicesPath)
if (appServicesLocalPath != null) {
log("Enabling automatic publication of application-services from: $appServicesLocalPath")
def publishAppServicesCmd = ["./automation/publish_to_maven_local_if_modified.py"]
runCmd(publishAppServicesCmd, appServicesLocalPath, "Published application-services for local development.")
} else {
log("Disabled auto-publication of application-services. Enable it by settings '$settingAppServicesPath' in local.properties")
}
String androidComponentsLocalPath = localProperties.getProperty(settingAndroidComponentsPath)
if (androidComponentsLocalPath != null) {
log("Enabling automatic publication of android-components from: $androidComponentsLocalPath")
def publishAcCmd = ["./automation/publish_to_maven_local_if_modified.py"]
runCmd(publishAcCmd, androidComponentsLocalPath, "Published android-components for local development.")
} else {
log("Disabled auto-publication of android-components. Enable it by settings '$settingAndroidComponentsPath' in local.properties")
}
}