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

apply plugin: 'com.android.library'

android {
    compileSdkVersion project.ext.compileSdkVersion
    buildToolsVersion project.ext.buildToolsVersion

    defaultConfig {
        defaultPublishConfig 'release'
        publishNonDefault true

        targetSdkVersion project.ext.targetSdkVersion
        minSdkVersion project.ext.minSdkVersion
        manifestPlaceholders = project.ext.manifestPlaceholders
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    lintOptions {
        abortOnError false
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java {
                srcDir '.'

                if (!mozconfig.substs.MOZ_INSTALL_TRACKING) {
                    exclude 'com/adjust/**'
                }

                if (!mozconfig.substs.MOZ_ANDROID_MMA) {
                    exclude 'com/leanplum/**'
                }

                // Exclude LeakCanary: It will be added again via a gradle dependency. This version
                // here is only the no-op library for mach-based builds.
                exclude 'com/squareup/leakcanary/**'
            }
        }
    }
}

dependencies {
    compile "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
    if (mozconfig.substs.MOZ_ANDROID_MMA) {
        compile "com.android.support:appcompat-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
        compile "com.android.support:support-annotations:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
        compile "com.google.android.gms:play-services-gcm:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
    }
}

apply plugin: 'idea'

idea {
    module {
        // This is cosmetic.  See the excludes in the root project.
        if (!mozconfig.substs.MOZ_INSTALL_TRACKING) {
            excludeDirs += file('com/adjust/sdk')
        }
        if (!mozconfig.substs.MOZ_ANDROID_MMA) {
            excludeDirs += file('com/leanplum')
        }
    }
}

// Bug 1353055 - Strip 'vars' debugging information to agree with moz.build.
apply from: "${topsrcdir}/mobile/android/gradle/debug_level.gradle"
android.libraryVariants.all configureVariantDebugLevel
