mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 11:45:37 +00:00
323d4a4185
Backed out changeset 82b765c5a02f (bug 1433968) Backed out changeset 73ec9bb3e17e (bug 1433968) Backed out changeset 0812ac0376da (bug 1433968) --HG-- extra : amend_source : 2748b297418eea9b7d3c2be11a8e7e300f8d709c extra : histedit_source : 6428453bbe80ad044661d01e5127d924fffed1a3%2Cd2e712ac6c597784343ff08f75199851c07be4e7
508 lines
22 KiB
Groovy
508 lines
22 KiB
Groovy
buildDir "${topobjdir}/gradle/build/mobile/android/app"
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'checkstyle'
|
|
apply plugin: 'com.getkeepsafe.dexcount'
|
|
apply plugin: 'findbugs'
|
|
|
|
apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
|
|
|
|
dexcount {
|
|
format = "tree"
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion project.ext.compileSdkVersion
|
|
|
|
defaultConfig {
|
|
targetSdkVersion project.ext.targetSdkVersion
|
|
minSdkVersion project.ext.minSdkVersion
|
|
manifestPlaceholders = project.ext.manifestPlaceholders
|
|
|
|
applicationId mozconfig.substs.ANDROID_PACKAGE_NAME
|
|
testApplicationId 'org.mozilla.roboexample.test'
|
|
testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
|
|
// Used by Robolectric based tests; see TestRunner.
|
|
buildConfigField 'String', 'BUILD_DIR', "\"${project.buildDir}\""
|
|
|
|
vectorDrawables.useSupportLibrary = true
|
|
}
|
|
|
|
aaptOptions {
|
|
// The omnijar is already a compressed file itself and Gecko expects it to be
|
|
// STORED within the APK rather than DEFLATED.
|
|
noCompress 'ja'
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_7
|
|
targetCompatibility JavaVersion.VERSION_1_7
|
|
}
|
|
|
|
dexOptions {
|
|
javaMaxHeapSize "2g"
|
|
jumboMode = true
|
|
}
|
|
|
|
lintOptions {
|
|
abortOnError true
|
|
}
|
|
|
|
buildTypes {
|
|
// We have the following difficult situation. Minification (Proguard) is only available per
|
|
// Android-Gradle `buildType`. Instrumentation (Robocop) is only available for exactly one
|
|
// `buildType` (see Android-Gradle `testBuildType`, which defaults to "debug"). Local
|
|
// developers expect to build and run tests against the "debug" build type. Automation
|
|
// needs to produce an instrumentation (Robocop) APK against a Fennec APK that will ship.
|
|
// (This is very unusual; usually, instrumentation tests do _not_ run against a shipping
|
|
// APK.)
|
|
//
|
|
// Given these constraints, we should not change `testBuildType` to avoid confusing local
|
|
// developers. Also, we should not Proguard any "debug" builds, because we don't want local
|
|
// developers to incur the cost of Proguard. However, we still need to find a way to
|
|
// Proguard a shipping APK and produce an instrumentation (Robocop APK) against it. To
|
|
// achieve this, we make "debug" builds Proguard in automation alone. This does have the
|
|
// unfortunate side effect of Proguarding the instrumentation (Robocop) APK, but nothing
|
|
// uses runtime inspection or class-loading with that APK, so it shouldn't be a problem.
|
|
def configureMinifyClosure = {
|
|
// Bug 1229269: we can't yet shrinkResources effectively. Be sure
|
|
// to use -stripped.ap_ after enabling this.
|
|
// shrinkResources true
|
|
minifyEnabled true
|
|
proguardFile "${topsrcdir}/mobile/android/config/proguard/proguard.cfg"
|
|
}
|
|
release configureMinifyClosure
|
|
if (mozconfig.substs.MOZILLA_OFFICIAL) {
|
|
debug configureMinifyClosure
|
|
}
|
|
|
|
def isDebuggable = (!mozconfig.substs.MOZILLA_OFFICIAL) || (mozconfig.substs.NIGHTLY_BUILD && mozconfig.substs.MOZ_DEBUG)
|
|
debug {
|
|
debuggable isDebuggable
|
|
}
|
|
release {
|
|
debuggable isDebuggable
|
|
}
|
|
}
|
|
|
|
// The "audience" flavour dimension distinguishes between _local_ builds (intended for
|
|
// development) and _official_ builds (intended for testing in automation and to ship in one of
|
|
// the Fennec distribution channels).
|
|
//
|
|
// The "skin" flavor dimension distinguishes between different user interfaces. We sometimes
|
|
// want to develop significant new user interface pieces in-tree that don't ship (even in the
|
|
// Nightly channel) while under development. A new "skin" flavour allows us to develop such
|
|
// pieces in Gradle without changing the mainline configuration.
|
|
|
|
project.configureProductFlavors.delegate = it
|
|
project.configureProductFlavors()
|
|
|
|
flavorDimensions "audience", "geckoBinaries", "minApi", "skin"
|
|
|
|
productFlavors {
|
|
// Since Firefox 57, the mobile user interface has followed the Photon design.
|
|
// Before Firefox 57, the user interface followed the Australis design.
|
|
photon {
|
|
dimension "skin"
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
aidl {
|
|
srcDir "${topsrcdir}/mobile/android/base/aidl"
|
|
}
|
|
|
|
java {
|
|
srcDir "${topsrcdir}/mobile/android/base/java"
|
|
srcDir "${topsrcdir}/mobile/android/services/src/main/java"
|
|
|
|
if (mozconfig.substs.MOZ_ANDROID_MLS_STUMBLER) {
|
|
srcDir "${topsrcdir}/mobile/android/stumbler/java"
|
|
}
|
|
|
|
if (!mozconfig.substs.MOZ_CRASHREPORTER) {
|
|
exclude 'org/mozilla/gecko/CrashReporter.java'
|
|
}
|
|
|
|
if (!mozconfig.substs.MOZ_NATIVE_DEVICES) {
|
|
exclude 'org/mozilla/gecko/ChromeCastDisplay.java'
|
|
exclude 'org/mozilla/gecko/ChromeCastPlayer.java'
|
|
exclude 'org/mozilla/gecko/GeckoMediaPlayer.java'
|
|
exclude 'org/mozilla/gecko/GeckoPresentationDisplay.java'
|
|
exclude 'org/mozilla/gecko/MediaPlayerManager.java'
|
|
exclude 'org/mozilla/gecko/RemotePresentationService.java'
|
|
}
|
|
|
|
if (mozconfig.substs.MOZ_INSTALL_TRACKING) {
|
|
exclude 'org/mozilla/gecko/adjust/StubAdjustHelper.java'
|
|
} else {
|
|
exclude 'org/mozilla/gecko/adjust/AdjustHelper.java'
|
|
}
|
|
|
|
if (mozconfig.substs.MOZ_ANDROID_MMA) {
|
|
exclude 'org/mozilla/gecko/mma/MmaStubImp.java'
|
|
} else {
|
|
exclude 'org/mozilla/gecko/mma/MmaLeanplumImp.java'
|
|
}
|
|
|
|
if (!mozconfig.substs.MOZ_ANDROID_GCM) {
|
|
exclude 'org/mozilla/gecko/gcm/**/*.java'
|
|
exclude 'org/mozilla/gecko/push/**/*.java'
|
|
}
|
|
}
|
|
|
|
res {
|
|
srcDir "${topsrcdir}/${mozconfig.substs.MOZ_BRANDING_DIRECTORY}/res"
|
|
srcDir "${topsrcdir}/mobile/android/services/src/main/res"
|
|
if (mozconfig.substs.MOZ_CRASHREPORTER) {
|
|
srcDir "${topsrcdir}/mobile/android/base/crashreporter/res"
|
|
}
|
|
}
|
|
|
|
assets {
|
|
if (mozconfig.substs.MOZ_ANDROID_DISTRIBUTION_DIRECTORY) {
|
|
srcDir "${mozconfig.substs.MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets"
|
|
}
|
|
}
|
|
}
|
|
|
|
test {
|
|
java {
|
|
// Bug 1229149 tracks pushing this into a :services Gradle project.
|
|
srcDir "${topsrcdir}/mobile/android/services/src/test/java"
|
|
|
|
if (!mozconfig.substs.MOZ_ANDROID_GCM) {
|
|
exclude 'org/mozilla/gecko/gcm/**/*.java'
|
|
exclude 'org/mozilla/gecko/push/**/*.java'
|
|
}
|
|
}
|
|
resources {
|
|
// Bug 1229149 tracks pushing this into a :services Gradle project.
|
|
srcDir "${topsrcdir}/mobile/android/services/src/test/resources"
|
|
}
|
|
}
|
|
|
|
androidTest {
|
|
java {
|
|
srcDir "${topsrcdir}/mobile/android/tests/browser/robocop/src"
|
|
// Bug 1229149 tracks pushing this into a :services Gradle project.
|
|
srcDir "${topsrcdir}/mobile/android/services/src/androidTest/java"
|
|
srcDir "${topsrcdir}/mobile/android/tests/browser/junit3/src"
|
|
}
|
|
res {
|
|
srcDir "${topsrcdir}/mobile/android/tests/browser/robocop/res"
|
|
}
|
|
assets {
|
|
srcDir "${topsrcdir}/mobile/android/tests/browser/robocop/assets"
|
|
}
|
|
}
|
|
}
|
|
|
|
testOptions {
|
|
// For Robolectric: see https://github.com/robolectric/robolectric/issues/3333#issuecomment-324300418.
|
|
unitTests.includeAndroidResources true
|
|
|
|
unitTests.all {
|
|
// We'd like to use (Runtime.runtime.availableProcessors()/2), but
|
|
// we have tests that start test servers and the bound ports
|
|
// collide. We'll fix this soon to have much faster test cycles.
|
|
maxParallelForks 1
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation "com.android.support:support-v4:$support_library_version"
|
|
implementation "com.android.support:appcompat-v7:$support_library_version"
|
|
implementation "com.android.support:cardview-v7:$support_library_version"
|
|
implementation "com.android.support:recyclerview-v7:$support_library_version"
|
|
implementation "com.android.support:design:$support_library_version"
|
|
implementation "com.android.support:customtabs:$support_library_version"
|
|
implementation "com.android.support:palette-v7:$support_library_version"
|
|
|
|
if (mozconfig.substs.MOZ_NATIVE_DEVICES) {
|
|
implementation "com.android.support:mediarouter-v7:$support_library_version"
|
|
implementation "com.google.android.gms:play-services-basement:$google_play_services_version"
|
|
implementation "com.google.android.gms:play-services-base:$google_play_services_version"
|
|
implementation "com.google.android.gms:play-services-cast:$google_play_services_version"
|
|
}
|
|
|
|
if (mozconfig.substs.MOZ_INSTALL_TRACKING) {
|
|
implementation "com.google.android.gms:play-services-analytics:$google_play_services_version"
|
|
implementation "com.google.android.gms:play-services-basement:$google_play_services_version"
|
|
}
|
|
|
|
if (mozconfig.substs.MOZ_ANDROID_GCM) {
|
|
implementation "com.google.android.gms:play-services-basement:$google_play_services_version"
|
|
implementation "com.google.android.gms:play-services-base:$google_play_services_version"
|
|
implementation "com.google.android.gms:play-services-gcm:$google_play_services_version"
|
|
implementation "com.google.android.gms:play-services-measurement:$google_play_services_version"
|
|
}
|
|
|
|
// Include LeakCanary in local builds, but not in official builds. Mach
|
|
// builds target the official audience, so LeakCanary will not be included
|
|
// in any Mach build.
|
|
localImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
|
|
officialImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
|
|
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
|
|
|
|
implementation project(path: ':geckoview')
|
|
implementation project(path: ':thirdparty')
|
|
|
|
testImplementation 'junit:junit:4.12'
|
|
testImplementation 'org.robolectric:robolectric:3.8'
|
|
testImplementation 'org.simpleframework:simple-http:6.0.1'
|
|
testImplementation 'org.mockito:mockito-core:1.10.19'
|
|
|
|
// Including the Robotium JAR directly can cause issues with dexing.
|
|
androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.5.4'
|
|
}
|
|
|
|
// TODO: (bug 1261486): This impl is not robust -
|
|
// we just wanted to land something.
|
|
task checkstyle(type: Checkstyle) {
|
|
configFile file("checkstyle.xml")
|
|
// TODO: should use sourceSets from project instead of hard-coded str.
|
|
source = ['../base/java/','../geckoview/src/main/java/']
|
|
// TODO: This ignores our pre-processed resources.
|
|
include '**/*.java'
|
|
// TODO: classpath should probably be something.
|
|
classpath = files()
|
|
}
|
|
|
|
// The localization system uses the moz.build preprocessor to interpolate a .dtd
|
|
// file of XML entity definitions into an XML file of elements referencing those
|
|
// entities. (Each locale produces its own .dtd file, backstopped by the en-US
|
|
// .dtd file in tree.) Android Studio (and IntelliJ) don't handle these inline
|
|
// entities smoothly. This filter merely expands the entities in place, making
|
|
// them appear properly throughout the IDE. Be aware that this assumes that the
|
|
// JVM's file.encoding is utf-8. See comments in
|
|
// mobile/android/mach_commands.py.
|
|
class ExpandXMLEntitiesFilter extends FilterReader {
|
|
ExpandXMLEntitiesFilter(Reader input) {
|
|
// Extremely inefficient, but whatever.
|
|
super(new StringReader(groovy.xml.XmlUtil.serialize(new XmlParser(false, false, true).parse(input))))
|
|
}
|
|
}
|
|
|
|
apply from: "${topsrcdir}/mobile/android/gradle/with_gecko_binaries.gradle"
|
|
|
|
android.applicationVariants.all { variant ->
|
|
def syncPreprocessedJava = task("syncPreprocessedJavaFor${variant.name.capitalize()}", type: Sync) {
|
|
into("${project.buildDir}/moz.build/src/${variant.name}/java")
|
|
from("${topobjdir}/mobile/android/base/generated/preprocessed")
|
|
exclude('**/*.mkdir.done')
|
|
}
|
|
// This is an Android-Gradle plugin 3+-ism. Culted from reading the source,
|
|
// searching for "registerJavaGeneratingTask", and finding
|
|
// https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin/commit/2f2b91476fb1c6647791e2c6fe531a47615a1e85.
|
|
// The added directory doesn't appear in the paths listed by the
|
|
// `sourceSets` task, for reasons unknown.
|
|
variant.registerJavaGeneratingTask(syncPreprocessedJava, syncPreprocessedJava.destinationDir)
|
|
|
|
def syncPreprocessedRes = task("syncPreprocessedResFor${variant.name.capitalize()}", type: Sync) {
|
|
into("${project.buildDir}/moz.build/src/${variant.name}/res")
|
|
from("${topobjdir}/mobile/android/base/res")
|
|
filesMatching('**/strings.xml') {
|
|
filter(ExpandXMLEntitiesFilter)
|
|
}
|
|
exclude('**/*.mkdir.done')
|
|
}
|
|
// This is an Android-Gradle plugin 3+-ism. Determined by reading the
|
|
// source. The added directory doesn't appear in the paths listed by the
|
|
// `sourceSets` task, for reasons unknown.
|
|
variant.registerGeneratedResFolders(project.files(syncPreprocessedRes.destinationDir).builtBy(syncPreprocessedRes))
|
|
|
|
// It's not easy -- see the backout in Bug 1242213 -- to change the
|
|
// <manifest> package for Fennec. Gradle has grown a mechanism to achieve
|
|
// what we want for Fennec, however, with applicationId. To use the same
|
|
// manifest as moz.build, we replace the package with org.mozilla.gecko (the
|
|
// eventual package) here.
|
|
def rewriteManifestPackage = task("rewriteManifestPackageFor${variant.name.capitalize()}", type: Copy, dependsOn: rootProject.generateCodeAndResources) {
|
|
into("${project.buildDir}/moz.build/src/${variant.name}")
|
|
from("${topobjdir}/mobile/android/base/AndroidManifest.xml")
|
|
filter { it.replaceFirst(/package=".*?"/, 'package="org.mozilla.gecko"') }
|
|
exclude('**/*.mkdir.done')
|
|
}
|
|
|
|
// Every configuration needs the stub manifest at
|
|
// src/main/AndroidManifest.xml and the generated manifest. We can't use
|
|
// the main sourceSet without losing the stub, so we cover all the
|
|
// configurations here.
|
|
android.sourceSets."${variant.name}".manifest.srcFile "${rewriteManifestPackage.destinationDir}/AndroidManifest.xml"
|
|
variant.preBuild.dependsOn rewriteManifestPackage
|
|
|
|
|
|
// Local (read, not 'official') builds want to reflect developer changes to
|
|
// AndroidManifest.xml.in, strings.xml, and preprocessed Java code. To do
|
|
// this, the Gradle build calls out to the moz.build system, which can be
|
|
// re-entrant. Official builds are driven by the moz.build system and
|
|
// should never be re-entrant in this way.
|
|
if (!((variant.productFlavors*.name).contains('official'))) {
|
|
syncPreprocessedJava.dependsOn rootProject.generateCodeAndResources
|
|
syncPreprocessedRes.dependsOn rootProject.generateCodeAndResources
|
|
rewriteManifestPackage.dependsOn rootProject.generateCodeAndResources
|
|
}
|
|
|
|
// When driven from moz.build via |mach build|, Gradle does not require or
|
|
// use Gecko binaries. It's only |mach package| that packs the Gecko
|
|
// binaries into the resulting APK. The "withoutGeckoBinaries" variants
|
|
// handle this. When driven from Android Studio or Gradle, the
|
|
// "withGeckoBinaries" variants handle packing the Gecko binaries into the
|
|
// resulting APK (for on-device deployment). They also update the Omnijars
|
|
// as necessary, smoothing out the edit-compile-test development cycle.
|
|
// They do what they say on the tin!
|
|
if ((variant.productFlavors*.name).contains('withGeckoBinaries')) {
|
|
configureVariantWithGeckoBinaries(variant)
|
|
}
|
|
}
|
|
|
|
android.applicationVariants.all { variant ->
|
|
configureApplicationVariantWithJNIWrappers(variant, "Fennec")
|
|
}
|
|
|
|
if (gradle.startParameter.taskNames.any { it.endsWith('UnitTest') }) {
|
|
// Approach cribbed from https://github.com/rwinch/jce-checker.
|
|
int maxKeyLen = javax.crypto.Cipher.getMaxAllowedKeyLength("AES")
|
|
if (maxKeyLen <= 128) {
|
|
throw new GradleException(
|
|
"Android unit tests require " +
|
|
"Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy, see " +
|
|
"http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html")
|
|
}
|
|
}
|
|
|
|
// Bug 1320035: Gradle configuration for running findbugs. Findbugs only allows
|
|
// to generate one report per invocation: https://stackoverflow.com/a/42720235.
|
|
// Run two tasks, accepting the cost of duplicate work.
|
|
android.applicationVariants.all { variant ->
|
|
task("findbugsHtml${variant.name.capitalize()}", type: FindBugs) {
|
|
// TODO: figure out how to share the shared configuration.
|
|
description "Analyze ${variant.name} code with findbugs (HTML report)"
|
|
group "Verification"
|
|
|
|
ignoreFailures = false // We want builds to fail when running this task and issues are found
|
|
effort = "max" // Using more memory and time to find issues is acceptable in automation
|
|
reportLevel = "high" // For now we only care about high priority bugs. After we have fixed
|
|
// the issues with medium/low priority we can lower the report level here.
|
|
|
|
classes = files("$project.buildDir/intermediates/classes")
|
|
source = variant.javaCompile.source
|
|
classpath = variant.javaCompile.classpath
|
|
|
|
excludeFilter = file("findbugs-exclude.xml")
|
|
dependsOn "assemble${variant.name.capitalize()}"
|
|
|
|
reports {
|
|
html.enabled = true // HTML reports for humans.
|
|
html.destination = file("$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.html")
|
|
xml.enabled = false
|
|
}
|
|
}
|
|
|
|
task("findbugsXml${variant.name.capitalize()}", type: FindBugs) {
|
|
// TODO: figure out how to share the shared configuration.
|
|
description "Analyze ${variant.name} code with findbugs (XML report)"
|
|
group "Verification"
|
|
|
|
ignoreFailures = false // We want builds to fail when running this task and issues are found
|
|
effort = "max" // Using more memory and time to find issues is acceptable in automation
|
|
reportLevel = "high" // For now we only care about high priority bugs. After we have fixed
|
|
// the issues with medium/low priority we can lower the report level here.
|
|
|
|
classes = files("$project.buildDir/intermediates/classes")
|
|
source = variant.javaCompile.source
|
|
classpath = variant.javaCompile.classpath
|
|
|
|
excludeFilter = file("findbugs-exclude.xml")
|
|
dependsOn "assemble${variant.name.capitalize()}"
|
|
|
|
reports {
|
|
xml.enabled = true // XML reports for machines.
|
|
xml.destination = file("$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.xml")
|
|
html.enabled = false
|
|
}
|
|
}
|
|
}
|
|
|
|
// Bug 1353055 - Strip 'vars' debugging information to agree with moz.build.
|
|
apply from: "${topsrcdir}/mobile/android/gradle/debug_level.gradle"
|
|
android.applicationVariants.all configureVariantDebugLevel
|
|
|
|
|
|
// Bug 1320310 - Hack up the manifest produced by Gradle to match that produced
|
|
// by moz.build. Per https://bugzilla.mozilla.org/show_bug.cgi?id=1320310#c14,
|
|
// this breaks launching in Android Studio; therefore, we only do this for
|
|
// official automation builds and not for local developer builds.
|
|
import groovy.xml.XmlUtil
|
|
|
|
android.applicationVariants.all { variant ->
|
|
// Like 'local', 'localOld', or 'official'.
|
|
def audienceDimension = variant.productFlavors[0].name
|
|
if (!audienceDimension.equals('official')) {
|
|
return
|
|
}
|
|
|
|
variant.outputs.each { output ->
|
|
output.processManifest.doLast {
|
|
[file("${manifestOutputDirectory}/AndroidManifest.xml"),
|
|
].each({ File manifestOutFile ->
|
|
if (manifestOutFile.exists()) {
|
|
def contents = manifestOutFile.getText('UTF-8')
|
|
|
|
// A non-validating, non-namespace aware XML processor.
|
|
def xml = new XmlSlurper(false, false).parseText(contents)
|
|
|
|
// First, reinstate our <activity-alias android:name=".App">.
|
|
xml.depthFirst()
|
|
.findAll { it.name() == 'activity-alias' && it.'@android:name' == 'org.mozilla.gecko.App' }
|
|
.each { it.'@android:name' = '.App' }
|
|
|
|
// Second, cull all manifest entries provided by com.google.android.gms.measurement.
|
|
xml.depthFirst()
|
|
.findAll { it.'@android:name'.text().contains('AppMeasurement') }
|
|
.each { it.replaceNode {} }
|
|
|
|
manifestOutFile.write(XmlUtil.serialize(xml), 'UTF-8')
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
android.applicationVariants.all { variant ->
|
|
def processResourcesTask = tasks["process${variant.name.capitalize()}Resources"]
|
|
def assembleTask = tasks["assemble${variant.name.capitalize()}"]
|
|
|
|
def dumpTask = task("dump${variant.name.capitalize()}RTxt", type: Copy) {
|
|
from "${project.buildDir}/intermediates/symbols"
|
|
into "${project.buildDir}/R/symbols-${System.env.AB_CD}"
|
|
include "**/R.txt"
|
|
|
|
includeEmptyDirs = false
|
|
|
|
// Force task to run.
|
|
outputs.upToDateWhen { false }
|
|
|
|
rename { filename ->
|
|
filename.replace 'R.txt', "R-${new Date().format('yyyyMMddHHmmssSSS')}.txt"
|
|
}
|
|
|
|
dependsOn processResourcesTask
|
|
}
|
|
|
|
assembleTask.dependsOn dumpTask
|
|
}
|
|
|
|
// Bug 1415298: make Robolectric find assets. Fix adapted from
|
|
// https://github.com/robolectric/robolectric/issues/2647.
|
|
android.applicationVariants.all { variant ->
|
|
def productFlavor = ""
|
|
variant.productFlavors.each {
|
|
productFlavor += "${it.name.capitalize()}"
|
|
}
|
|
def buildType = "${variant.buildType.name.capitalize()}"
|
|
tasks["compile${productFlavor}${buildType}UnitTestSources"].dependsOn(tasks["merge${productFlavor}${buildType}Assets"])
|
|
}
|