mobile/android/gradle/app/build.gradle
author Bobby Holley <bobbyholley@gmail.com>
Tue, 17 Mar 2015 14:02:33 -0700
changeset 235699 5d9b7601850c58630a65cb091f09afa938f70a53
parent 226424 ab07026021b8993bb7c3c7e53850a548f8a63edb
child 246252 7110db7a47a5a554fe93fcff31985a9a8feb7410
permissions -rw-r--r--
Bug 1142336 - Create one unified thread pool for media code and run the MDSM task queues on it. r=mattwoodrow This allows for parallel MDSM execution. \o/

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        targetSdkVersion 21
        minSdkVersion 9
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    dexOptions {
        incremental true
        preDexLibraries true
    }

    lintOptions {
        abortOnError false
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFile "${topsrcdir}/mobile/android/config/proguard/proguard.cfg"
        }
    }

    defaultConfig {
        testApplicationId 'org.mozilla.roboexample.test'
        testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
    }

    sourceSets {
        androidTest {
            java {
                srcDir "${topobjdir}/mobile/android/gradle/app/src/robocop_harness"
                srcDir "${topobjdir}/mobile/android/gradle/app/src/robocop"
                srcDir "${topobjdir}/mobile/android/gradle/app/src/background"
                srcDir "${topobjdir}/mobile/android/gradle/app/src/browser"
            }
        }
    }
}

dependencies {
    compile project(':base')
    compile project(':omnijar')
    androidTestCompile fileTree(dir: 'libs', include: ['*.jar'])
}

/**
 * We want to expose the JSM files and chrome content to IDEs; the omnijar
 * project does this.  In addition, the :omnijar:buildOmnijar task builds a new
 * omni.ja (directly into the object directory).
 *
 * The task dependency is: :generateDebugAssets -> :omnijar:buildOmnijar.
 *
 * One might expect that we could do this all in the omnijar project, but there
 * appears to be a bug (which I have not fully isolated) where-by debug-only
 * assets in a library (.aar file) are ignored in favor of release assets.  This
 * means we would have to insert the omni.ja into the omnijar project's release
 * assets, which is altogether confusing.
 */
android.applicationVariants.all { variant ->
    // We only insert omni.ja and the .so libraries into debug builds.
    def name = variant.buildType.name
    if (!name.contains(com.android.builder.core.BuilderConstants.DEBUG)) {
        return
    }

    def buildOmnijarTask = project(':omnijar').tasks.getByName('buildOmnijar')
    def generateAssetsTask = tasks.findByName("generate${name.capitalize()}Assets")
    generateAssetsTask.dependsOn buildOmnijarTask
}