mobile/android/geckoview_example/build.gradle
author Nick Alexander <nalexander@mozilla.com>
Thu, 26 Oct 2017 11:00:36 -0700
changeset 399326 f918500d9cf5112b70bc8e0a120df435b02252b7
parent 399195 64f82460345884dd0f5935645765acccf771d7c4
child 399329 01836fd98c6351667c70cfd187cf1e3c437e1f94
permissions -rw-r--r--
Bug 1411654 - Part 1: Upgrade to Android-Gradle 3.0+ and build-tools;26.0.2. r=maliu New Android-Gradle plugins pin the build-tools version, and we want to be consistent between Gradle and moz.build. MozReview-Commit-ID: ApWS4rHzPuH

buildDir "${topobjdir}/gradle/build/mobile/android/geckoview_example"

apply plugin: 'com.android.application'

android {
    compileSdkVersion project.ext.compileSdkVersion

    defaultConfig {
        targetSdkVersion project.ext.targetSdkVersion
        minSdkVersion project.ext.minSdkVersion
        manifestPlaceholders = project.ext.manifestPlaceholders

        applicationId "org.mozilla.geckoview_example"
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    // This is extremely frustrating, but the only way to do it automation for
    // now.  Without this, we only get a "debugAndroidTest" configuration; we
    // have no "withoutGeckoBinariesAndroidTest" configuration.
    testBuildType "withoutGeckoBinaries"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        withGeckoBinaries { // For consistency with :geckoview project in Task Cluster invocations.
            initWith debug
        }
        withoutGeckoBinaries { // Logical negation of withGeckoBinaries.
            initWith debug
        }
    }
}

dependencies {
    testImplementation 'junit:junit:4.12'

    implementation 'com.android.support:support-annotations:23.4.0'

    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestImplementation 'com.android.support.test:runner:0.5'
    // Not defining this library again results in test-app assuming 23.1.1, and the following errors:
    // "Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.4.0) and test app (23.1.1) differ."
    androidTestImplementation 'com.android.support:support-annotations:23.4.0'

    implementation project(path: ':geckoview')
}

apply from: "${topsrcdir}/mobile/android/gradle/with_gecko_binaries.gradle"

android.applicationVariants.all { variant ->
    // Like 'debug', 'release', or 'withoutGeckoBinaries'.
    def buildType = variant.buildType.name

    // It would be most natural for :geckoview to always include the Gecko
    // binaries, but that's difficult; see the notes in
    // mobile/android/gradle/with_gecko_binaries.gradle.  Instead we handle our
    // own Gecko binary inclusion.
    if (!buildType.equals('withoutGeckoBinaries')) {
        configureVariantWithGeckoBinaries(variant)
    }
}