2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-02 03:40:16 +00:00
iceraven-browser/settings.gradle
Grisha Kruglov aaec95cbae [fenix] Speed-up autoPublication workflows
This change switches to using python scripts directly in a-c and a-s repositories, which achieves two things:
- we avoid overhead of running through a-c and a-s gradle's build phases, which is quite significant
- all of the logic for checking if projects are up-to-date or need to be republished now lives in those projects

End result is that local fenix builds now incur zero costs if there are no changes in a-c or a-s,
and if there are _any_ changes at all, the corresponding project is reliably recompiled and republished.
2020-04-22 14:32:16 -07:00

64 lines
2.7 KiB
Groovy

include ':app'
include ':mozilla-detekt-rules'
include ':mozilla-lint-rules'
def log(message) {
logger.lifecycle("[settings] ${message}")
}
def runCmd(cmd, workingDir, successMessage, captureStdout=true) {
def proc = cmd.execute(null, new File(workingDir))
def standardOutput = captureStdout ? new ByteArrayOutputStream() : System.out
proc.consumeProcessOutput(standardOutput, System.err)
proc.waitFor()
if (proc.exitValue() != 0) {
throw new GradleException("Process '${cmd}' finished with non-zero exit value ${proc.exitValue()}");
} else {
log(successMessage)
}
return captureStdout ? standardOutput : null
}
//////////////////////////////////////////////////////////////////////////
// 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 {
log('Missing local.properties; see https://github.com/mozilla-mobile/fenix/blob/master/README.md#local-properties-helpers for instructions.')
}
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.", false)
} 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.", false)
} else {
log("Disabled auto-publication of android-components. Enable it by settings '$settingAndroidComponentsPath' in local.properties")
}
}