Commit e7c17fee authored by MozLando's avatar MozLando
Browse files

Merge #6218



6218: Closes #6217: Add support for appservices "autoPublish" local development flow r=grigoryk a=rfk





Co-authored-by: default avatarRyan Kelly <rfkelly@mozilla.com>
parents ac90cb7f e4bd6eac
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -52,6 +52,12 @@ subprojects {
        }
    }

    // Allow local appservices substitution in each subproject.
    if (gradle.hasProperty('localProperties.autoPublish.application-services.dir')) {
        ext.appServicesSrcDir = gradle."localProperties.autoPublish.application-services.dir"
        apply from: "${rootProject.projectDir}/${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle"
    }

    afterEvaluate {
        if (it.hasProperty('android')) {
            jacoco {
+17 −5
Original line number Diff line number Diff line
@@ -51,12 +51,24 @@ gradle.projectsLoaded { ->
    gradle.rootProject.ext.config = new Config(version)
    gradle.rootProject.ext.buildConfig = buildconfig
}

def runCmd(cmd, workingDir, successMessage) {
    def proc = cmd.execute(null, new File(workingDir))
    proc.consumeProcessOutput(System.out, System.err)
    proc.waitFor()
    if (proc.exitValue() != 0) {
        throw new GradleException("Process '${cmd}' finished with non-zero exit value ${proc.exitValue()}")
    } else {
        logger.lifecycle(successMessage)
    }
}

//////////////////////////////////////////////////////////////////////////
// Local Development overrides
//////////////////////////////////////////////////////////////////////////

Properties localProperties = null;
String settingAppServicesPath = "substitutions.application-services.dir";
String settingAppServicesPath = "autoPublish.application-services.dir"
String settingGleanPath = "substitutions.glean.dir";

if (file('local.properties').canRead()) {
@@ -75,11 +87,11 @@ if (localProperties != null) {
    String appServicesLocalPath = localProperties.getProperty(settingAppServicesPath);

    if (appServicesLocalPath != null) {
        logger.lifecycle("Local configuration: substituting application-services modules from path: $appServicesLocalPath")

        includeBuild(appServicesLocalPath)
        logger.lifecycle("Enabling automatic publication of application-services from: $appServicesLocalPath")
        def publishAppServicesCmd = ["./gradlew", "autoPublishForLocalDevelopment"]
        runCmd(publishAppServicesCmd, appServicesLocalPath, "Published application-services for local development.")
    } else {
        logger.lifecycle("Local configuration: application-services substitution path missing. You may specify it via '$settingAppServicesPath' setting.")
        logger.lifecycle("Disabled auto-publication of application-services. Enable it by settings '$settingAppServicesPath' in local.properties")
    }

    String gleanLocalPath = localProperties.getProperty(settingGleanPath);