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

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

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

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

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

        multiDexEnabled true
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        flavorDimensions "versionCode"
        vectorDrawables.useSupportLibrary = true
    }

    lintOptions {
        abortOnError false
    }

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

    //Flavor 信息
    publishNonDefault true
    productFlavors {
        ydl {}
        xlzx {}
    }

    sourceSets {
        main {
            res.srcDirs = ['src/main/res']
        }
    }
}

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

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.fragment:fragment-ktx:1.2.4'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    api "com.airbnb.android:lottie:3.4.0"

    implementation "com.alibaba:arouter-api:$arouter_api"
    kapt "com.alibaba:arouter-compiler:$arouter_compiler"

    implementation rootProject.ext.dependencies["ydl-user-router"]

    if (rootProject.ext.dev_mode){
        //开发时使用
        implementation project(":api:consultant")
        implementation project(":api:user")
        implementation project(":api:tests")
        implementation modularPublication('com.ydl:m-home-api')
        implementation project(":api:im")
        implementation project(':api:confide')
        implementation project(':ydl-webview')
        implementation project(':ydl-media')
        implementation project(":ydl-platform")
    } else {
        //发布时使用

        compileOnly rootProject.ext.dependencies["ydl-m-consultant-api"]
        compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
        compileOnly rootProject.ext.dependencies["ydl-m-home-api"]
        compileOnly rootProject.ext.dependencies['ydl-m-tests-api']
        compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
        compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
        api (rootProject.ext.dependencies["ydl-platform"]) {
            transitive = true
        }
        api rootProject.ext.dependencies["ydl-webview"]
        api rootProject.ext.dependencies["ydl-media"]
        api rootProject.ext.dependencies["ydl-media"]
    }
}
