apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'plugin.resTools'  // 资源重命名插件

// 配置资源重命名插件
resConfig {
    new_prefix = 'confide_'  // 资源前缀
    old_prefix = ''         // 老前缀，可为''空字符串
}

kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", project.getName())
    }
}

android {
//    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
//    buildToolsVersion rootProject.ext.android["buildToolsVersion"]
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion


    defaultConfig {
//        minSdkVersion rootProject.ext.android["minSdkVersion"]
//        targetSdkVersion rootProject.ext.android["targetSdkVersion"]

        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        consumerProguardFiles 'consumer-rules.pro'

        flavorDimensions "versionCode"
    }

    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            buildConfigField "String", "AGORA_APPID", '"13b1536698f64905a1e7e5bb978ba821"'
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            buildConfigField "String", "AGORA_APPID", '"3387e9b251f3491e9221a9877e8f7830"'
        }
    }

    publishNonDefault true
    productFlavors {
        ydl {}
        xlzx {}
    }

    //设置JDK1.8
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.daimajia.androidanimations:library:2.3@aar'
    api 'fr.tvbarthel.blurdialogfragment:lib:2.1.5'
    api "com.alibaba:arouter-api:$arouter_api"
//    注意此处的依赖方式：kotlin中使用和java中使用方式有不同
    kapt "com.alibaba:arouter-compiler:$arouter_compiler"
    implementation 'com.alibaba:fastjson:1.2.38'

    api rootProject.ext.dependencies["ydl-user-router"]
    if (rootProject.ext.dev_mode){
        //开发时使用
        api project(':ydl-media')
        api project(':ydl-platform')
        api project(':m-audioim')
    }else {
        //发布时使用
        api rootProject.ext.dependencies["ydl-media"]
        api(rootProject.ext.dependencies["m-audioim"]){
             transitive = true
        }
        api(rootProject.ext.dependencies["ydl-platform"]) {
            transitive = true
        }
    }
}
