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

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

kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", "audioim")
    }
}
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
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        consumerProguardFiles 'consumer-rules.pro'

        flavorDimensions "versionCode"

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = [AROUTER_MODULE_NAME: "audioim"]
            }
        }
    }

    //前缀的名字
    resourcePrefix "audioim_"

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

            buildConfigField "String", "AGORA_APPID", '"3387e9b251f3491e9221a9877e8f7830"'
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            buildConfigField "String", "AGORA_APPID", '"13b1536698f64905a1e7e5bb978ba821"'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.2.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    //    注意此处的依赖方式：kotlin中使用和java中使用方式有不同
    kapt "com.alibaba:arouter-compiler:$arouter_compiler"

    api "com.alibaba:arouter-api:$arouter_api"
    api ('com.ydl:ydl-av:1.3.4@aar'){
        transitive = true
    }

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