apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]
    useLibrary 'org.apache.http.legacy'

    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        multiDexEnabled true
        applicationId "me.hegj.wandroid"
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]
        testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
        ndk {
            // 设置支持的SO库架构
            abiFilters 'armeabi-v7a'
        }
    }

    signingConfigs {
        def alias = "wandroid"
        def password = "password"
        def filePath = "wandroid.jks"

        debug {
            keyAlias alias
            keyPassword password
            storeFile file(filePath)
            storePassword(password)
        }
        release {
            keyAlias alias
            keyPassword password
            storeFile file(filePath)
            storePassword(password)
        }
    }

    buildTypes {
        debug {
            buildConfigField "boolean", "LOG_DEBUG", "true"
            buildConfigField "boolean", "USE_CANARY", "false"
            minifyEnabled false
            shrinkResources false
            zipAlignEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        release {
            buildConfigField "boolean", "LOG_DEBUG", "false"
            buildConfigField "boolean", "USE_CANARY", "false"
            minifyEnabled true//开启混淆
            shrinkResources true
            zipAlignEnabled true//去除无用资源
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        disable 'InvalidPackage'
        disable "ResourceType"
        abortOnError false
    }
    dexOptions {
        javaMaxHeapSize "4g"
        jumboMode = true
        preDexLibraries = false
        additionalParameters = [
                '--multi-dex',//多分包
                '--set-max-idx-number=60000'//每个包内方法数上限
        ]
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //androidX基础库
    implementation "androidx.appcompat:appcompat:1.1.0-rc01"
    implementation 'com.google.android.material:material:1.1.0-alpha09'
    implementation "androidx.constraintlayout:constraintlayout:1.1.3"
    implementation "androidx.preference:preference:1.1.0-rc01"
    implementation "androidx.cardview:cardview:1.0.0"
    //dagger
    annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
    kapt rootProject.ext.dependencies["dagger2-compiler"]

    //黄油刀
    implementation "com.jakewharton:butterknife:10.0.0"
    kapt "com.jakewharton:butterknife-compiler:10.0.0"
    //test
    testImplementation rootProject.ext.dependencies["junit"]
    debugImplementation rootProject.ext.dependencies["canary-debug"]
    releaseImplementation rootProject.ext.dependencies["canary-release"]
    testImplementation rootProject.ext.dependencies["canary-release"]
    //kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0"
    //项目用到的库大部分封装在里面 具体在 config.gradle
    implementation rootProject.ext.customLibs
}
repositories {
    mavenCentral()
}
