ext.alwaysLib = true //虽然apply了cc-settings-2.gradle，但一直作为library编译，否则别的组件依赖此module时会报错
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.jakewharton.butterknife'

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

    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode rootProject.ext.android["versionCode"]
        versionName rootProject.ext.android["versionName"]
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles 'consumer-rules.pro'
        multiDexEnabled true
        //配置注解处理器
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath true
            }
        }
    }

    buildTypes {
//        Test {
//            buildConfigField "boolean", "LOG_DEBUG", "false"
//            buildConfigField "boolean", "USE_CANARY", "false"
//            minifyEnabled false
//            shrinkResources false
//            zipAlignEnabled false
//            proguardFiles 'proguard.cfg'
//        }

        debug {
            buildConfigField "boolean", "LOG_DEBUG", "true"
            buildConfigField "boolean", "USE_CANARY", "true"
            minifyEnabled false
            proguardFiles 'proguard.cfg'
        }
        release {
            buildConfigField "boolean", "LOG_DEBUG", "false"
            buildConfigField "boolean", "USE_CANARY", "false"
            minifyEnabled true
//            shrinkResources true
            zipAlignEnabled true
            proguardFiles 'proguard.cfg'
        }
    }
}


buildscript {
    repositories {
        jcenter()
    }
}


dependencies {
    if (project.ext.runAsApp) {
        annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
        debugImplementation rootProject.ext.dependencies["canary-debug"]
        releaseImplementation rootProject.ext.dependencies["canary-release"]
        testImplementation rootProject.ext.dependencies["canary-release"]
    } else {
        compileOnly rootProject.ext.dependencies["dagger2-compiler"]
        compileOnly rootProject.ext.dependencies["canary-debug"]
        compileOnly rootProject.ext.dependencies["canary-release"]
        compileOnly rootProject.ext.dependencies["canary-release"]
    }
    api rootProject.ext.dependencies["butterknife"]
    kapt rootProject.ext.dependencies["butterknife-compiler"]
    implementation 'com.lxj:xpopup:2.2.10'
}
