settings.gradle
author Gregory Szorc <gps@mozilla.com>
Thu, 24 Mar 2016 09:12:19 -0700
changeset 290265 559a80645f20706e1eaaeed863e90c2d35ff7644
parent 284699 c35cd215da100d65ce15824ff5ef189025165cd2
child 316865 5d8f137ee52eb37c06d4ffd8b272f5543b6de834
permissions -rw-r--r--
Bug 1186060 - Build with Visual Studio 2015 Update 1; r=ted, ehsan This commit switches Windows builds from Visual Studio 2013 to Visual Studio 2015 Update 1. Previously, Visual Studio was installed on the builders as part of the base system image. Starting with this commit, we obtain Visual Studio from a pre-generated, self-contained archive containing the executables, Windows SDK, and other support files. This means that new Windows toolchains can be installed without having to modify configuration of machines in automation! The mozconfigs for Visual Studio 2015 are a bit different from existing mozconfigs. Because it appears to be completely redundant and not necessary, the LIBPATH variable has been dropped. The order of paths in PATH, LIB, and INCLUDE has changed. The new order more accurately reflects what would be defined by vcvarsall.bat. As part of switching to Visual Studio 2015, the Universal CRT is now required. So, the 2015 mozconfigs export WIN_UCRT_REDIST_DIR to define the location to those files. The switch to Visual Studio 2015 also involves the switch from the Windows 8.1 SDK to the Windows 10 SDK. However, we still target an old version of Windows, so this hopefully shouldn't have any significant fallout. It's worth noting that switching to Visual Studio 2015 makes builds - especially PGO builds - significantly faster. Our PGO build times in automation are ~1 hour faster. Our regular builds appear to be a few minutes faster. MozReview-Commit-ID: Pa5GW8V87Q

// You might think topsrcdir is '.', but that's not true when the Gradle build
// is launched from within IntelliJ.
def topsrcdir = rootProject.projectDir.absolutePath

def commandLine = ["${topsrcdir}/mach", "environment", "--format", "json", "--verbose"]
def proc = commandLine.execute(null, new File(topsrcdir))
def standardOutput = new ByteArrayOutputStream()
proc.consumeProcessOutput(standardOutput, standardOutput)
proc.waitFor()

// Only show the output if something went wrong.
if (proc.exitValue() != 0) {
    throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${proc.exitValue()}:\n\n${standardOutput.toString()}")
}

import groovy.json.JsonSlurper
def slurper = new JsonSlurper()
def json = slurper.parseText(standardOutput.toString())

if (json.substs.MOZ_BUILD_APP != 'mobile/android') {
    throw new GradleException("Building with Gradle is only supported for Fennec, i.e., MOZ_BUILD_APP == 'mobile/android'.")
}

// Set the Android SDK location.  This is the *least specific* mechanism, which
// is unfortunate: we'd prefer to use the *most specific* mechanism.  That is,
// local.properties (first 'sdk.dir', then 'android.dir') and then the
// environment variable ANDROID_HOME will override this.  That's unfortunate,
// but it's hard to automatically arrange better.
System.setProperty('android.home', json.substs.ANDROID_SDK_ROOT)

include ':app'
include ':omnijar'
include ':thirdparty'

project(':app').projectDir = new File("${json.topsrcdir}/mobile/android/app")
project(':omnijar').projectDir = new File("${json.topsrcdir}/mobile/android/app/omnijar")
project(':thirdparty').projectDir = new File("${json.topsrcdir}/mobile/android/thirdparty")

if (json.substs.MOZ_ANDROID_PACKAGE_INSTALL_BOUNCER) {
    include ':bouncer'
    project(':bouncer').projectDir = new File("${json.topsrcdir}/mobile/android/bouncer")
}

// The Gradle instance is shared between settings.gradle and all the
// other build.gradle files (see
// http://forums.gradle.org/gradle/topics/define_extension_properties_from_settings_xml).
// We use this ext property to pass the per-object-directory mozconfig
// between scripts.  This lets us execute set-up code before we gradle
// tries to configure the project even once, and as a side benefit
// saves invoking |mach environment| multiple times.
gradle.ext.mozconfig = json