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 "android.support.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'])

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

    api 'com.github.princekin-f:EasyFloat:1.1.2'
    api rootProject.ext.dependencies["ydl-user-router"]
    api rootProject.ext.dependencies["butterknife"]
    if (rootProject.ext.dev_mode){
        //开发时使用
        implementation modularPublication('com.ydl:m-user-api')
        api project(":ydl-webview")
        api project(":ydl-platform")
        api project(":ydl-media")
        api project(":ydl-pay")
        api project(":ydl-flutter-base")
    } else {
        //发布时使用
        compileOnly rootProject.ext.dependencies["ydl-m-user-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-flutter-base"]){
            transitive = true
        }
        api(rootProject.ext.dependencies["ydl-platform"]) {
            transitive = true
        }
    }
}
