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.
This commit is contained in:
Grisha Kruglov 2020-04-21 15:21:41 -07:00 committed by Grisha Kruglov
parent dce16964c0
commit 447e71781b
2 changed files with 11 additions and 26 deletions

View File

@ -156,17 +156,17 @@ git push <remote> --no-verify
There are multiple helper flags available via `local.properties` that will help speed up local development workflow
when working across multiple layers of the dependency stack - specifically, with android-components, geckoview or application-services.
### android-components auto-publication workflow
Specify a relative path to your local `android-components` checkout via `autoPublish.android-components.dir`.
### Auto-publication workflow for android-components and application-services
If you're making changes to these projects and want to test them in Fenix, auto-publication workflow is the fastest, most reliable
way to do that.
If enabled, during a Fenix build android-components will be compiled and locally published if it has been modified,
and published versions of android-components modules will be automatically used instead of whatever is declared in Dependencies.kt.
In `local.properties`, specify a relative path to your local `android-components` and/or `application-services` checkouts. E.g.:
- `autoPublish.android-components.dir=../android-components`
- `autoPublish.application-services.dir=../application-services`
### application-services auto-publication workflow
Specify a relative path to your local `application-services` checkout via `autoPublish.application-services.dir`.
Once these flags are set, your Fenix builds will include any local modifications present in these projects.
If enabled, during a Fenix build application-services will be compiled and locally published,
and published versions of application-services modules will be automatically used instead of whatever is declared in Dependencies.kt.
See a [demo of auto-publication workflow in action](https://www.youtube.com/watch?v=qZKlBzVvQGc).
### GeckoView
Specify a relative path to your local `mozilla-central` checkout via `dependencySubstitutions.geckoviewTopsrcdir`,

View File

@ -20,10 +20,6 @@ def runCmd(cmd, workingDir, successMessage, captureStdout=true) {
return captureStdout ? standardOutput : null
}
def gradlew = './gradlew'
if (System.properties['os.name'].toLowerCase().contains('windows')) {
gradlew += ".bat"
}
//////////////////////////////////////////////////////////////////////////
// Local Development overrides
//////////////////////////////////////////////////////////////////////////
@ -49,7 +45,7 @@ if (localProperties != null) {
if (appServicesLocalPath != null) {
log("Enabling automatic publication of application-services from: $appServicesLocalPath")
def publishAppServicesCmd = ["./gradlew", "autoPublishForLocalDevelopment"]
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")
@ -59,19 +55,8 @@ if (localProperties != null) {
if (androidComponentsLocalPath != null) {
log("Enabling automatic publication of android-components from: $androidComponentsLocalPath")
log("Determining if android-components are up-to-date...")
def compileAcCmd = [gradlew, "compileReleaseKotlin"]
def compileOutput = runCmd(compileAcCmd, androidComponentsLocalPath, "Compiled android-components.")
// This is somewhat brittle: parse last line of gradle output, to fish out how many tasks were executed.
// One executed task means gradle didn't do any work other than executing the top-level 'compile' task.
def compileTasksExecuted = compileOutput.toString().split('\n').last().split(':')[1].split(' ')[1]
if (compileTasksExecuted.equals("1")) {
log("android-components are up-to-date, skipping publication.")
} else {
log("android-components changed, publishing locally...")
def publishAcCmd = ["${androidComponentsLocalPath}/${gradlew}", "publishToMavenLocal", "-Plocal=true"]
runCmd(publishAcCmd, androidComponentsLocalPath, "Published android-components.", false)
}
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")
}