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

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


    defaultConfig {
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'


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

        flavorDimensions "versionCode"
    }

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

    publishNonDefault true
    productFlavors {
        ydl {}
        xlzx {}
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    sourceSets {
        main {
            manifest.srcFile 'src/main/AndroidManifest.xml'
            res.srcDirs = [
                    'src/main/res'
            ]
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])

    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'
    kapt 'com.alibaba:arouter-compiler:1.2.2'

    api 'com.github.princekin-f:EasyFloat:1.3.2'
    api rootProject.ext.dependencies["ydl-user-router"]
    api rootProject.ext.dependencies["butterknife"]

    if (rootProject.ext.dev_mode){
        //开发时使用
        implementation modularPublication('com.ydl:m-consultant-api')
        implementation modularPublication('com.ydl:m-user-api')
        implementation modularPublication('com.ydl:m-dynamic-api')
        api project(":ydl-webview")
        api project(":ydl-platform")
        api project(":ydl-media")
        api project(":ydl-pay")
        implementation project(':ydl-flutter-base')

    } else {
        //发布时使用
        compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
        compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
        compileOnly rootProject.ext.dependencies['ydl-m-consultant-api']
//        compileOnlyrootProject.ext.dependencies['com.ydl:m-consultant-api']
        api rootProject.ext.dependencies["ydl-webview"]
        api (rootProject.ext.dependencies["ydl-media"]){
            transitive = true
        }
        api rootProject.ext.dependencies["ydl-pay"]

        api(rootProject.ext.dependencies["ydl-platform"]) {
            transitive = true
        }

        implementation rootProject.ext.dependencies["ydl-flutter-base"]
    }
}
