diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /build.gradle | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | uxp-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz |
Add m-esr52 at 52.6.0
Diffstat (limited to 'build.gradle')
-rw-r--r-- | build.gradle | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000..d31d07cdcd --- /dev/null +++ b/build.gradle @@ -0,0 +1,129 @@ +import java.util.regex.Pattern + +allprojects { + // Expose the per-object-directory configuration to all projects. + ext { + mozconfig = gradle.mozconfig + topsrcdir = gradle.mozconfig.topsrcdir + topobjdir = gradle.mozconfig.topobjdir + } + + repositories { + if (gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY) { + maven { + url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY + } + } + } +} + +buildDir "${topobjdir}/gradle/build" + +buildscript { + repositories { + if (gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY) { + maven { + url gradle.mozconfig.substs.GRADLE_MAVEN_REPOSITORY + } + } + // For android-sdk-manager SNAPSHOT releases. + maven { + url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo" + } + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.1.3' + classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.4') { + // Without these, we get errors linting. + exclude module: 'guava' + } + // Provided in tree. + classpath 'com.jakewharton.sdkmanager:gradle-plugin:1.5.0-SNAPSHOT' + } +} + +task generateCodeAndResources(type:Exec) { + workingDir "${topobjdir}" + + commandLine mozconfig.substs.GMAKE + args '-C' + args "${topobjdir}/mobile/android/base" + args 'gradle-targets' + + // Only show the output if something went wrong. + ignoreExitValue = true + standardOutput = new ByteArrayOutputStream() + errorOutput = standardOutput + doLast { + if (execResult.exitValue != 0) { + throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}") + } + } +} + +// Skip unit test for all build variants, unless if it was specifically requested by user. +// The enabled property for the unit test tasks is reset based on the command line task names just before the task execution. +// I bet there is a easier/cleaner way to do this, but this gets the job done for now. +Pattern pattern = Pattern.compile('.*test(.+UnitTest)?.*') +boolean startTasksIncludeTest = gradle.startParameter.taskNames.any { + taskName -> + taskName.matches(pattern) +} +gradle.taskGraph.beforeTask { + Task task -> + if (task.name.matches(pattern)) { + task.enabled = startTasksIncludeTest + } +} + +afterEvaluate { + subprojects { + if (!hasProperty('android')) { + return + } + android.applicationVariants.all { + preBuild.dependsOn rootProject.generateCodeAndResources + } + android.libraryVariants.all { + preBuild.dependsOn rootProject.generateCodeAndResources + } + } +} + +apply plugin: 'idea' + +idea { + project { + languageLevel = '1.7' + } + + module { + // Object directories take a huge amount of time for IntelliJ to index. + // Exclude them. Convention is that object directories start with obj. + // IntelliJ is clever and will not exclude the parts of the object + // directory that are referenced, if there are any. In practice, + // indexing the entirety of the tree is taking too long, so exclude all + // but mobile/. + def topsrcdirURI = file(topsrcdir).toURI() + excludeDirs += files(file(topsrcdir) + .listFiles({it.isDirectory()} as FileFilter) + .collect({topsrcdirURI.relativize(it.toURI()).toString()}) // Relative paths. + .findAll({!it.equals('mobile/')})) + + // If topobjdir is below topsrcdir, hide only some portions of that tree. + def topobjdirURI = file(topobjdir).toURI() + if (!topsrcdirURI.relativize(topobjdirURI).isAbsolute()) { + excludeDirs -= file(topobjdir) + excludeDirs += files(file(topobjdir).listFiles()) + excludeDirs -= file("${topobjdir}/gradle") + } + + if (!mozconfig.substs.MOZ_INSTALL_TRACKING) { + excludeDirs += file("${topsrcdir}/mobile/android/thirdparty/com/adjust") + } + } +} + +task wrapper(type: Wrapper) { +} |