build.gradle 2.53 KB
Newer Older
徐健 committed
1 2 3 4
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
konghaorui committed
5
apply plugin: 'resTools' // 资源重命名插件
6 7 8 9 10 11

// 配置资源重命名插件
resConfig {
    new_prefix = 'fm_'  // 资源前缀
    old_prefix = ''         // 老前缀,可为''空字符串
}
徐健 committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

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

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"

        multiDexEnabled true
YKai committed
30
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
徐健 committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
        flavorDimensions "versionCode"

    }

    lintOptions {
        abortOnError false
    }

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

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

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

}

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

YKai committed
63 64 65 66
    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'
徐健 committed
67 68 69 70 71

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

72
    api rootProject.ext.dependencies["ydl-user-router"]
徐健 committed
73 74 75 76 77
    if (rootProject.ext.dev_mode){
        //开发时使用
        api project(":ydl-platform")
        api project(':m-user')
        implementation modularPublication('com.ydl:m-user-api')
konghaorui committed
78
        implementation modularPublication('com.ydl:m-dynamic-api')
徐健 committed
79
        implementation project(':ydl-media')
徐健 committed
80 81
    } else {
        //发布时使用
徐健 committed
82
        implementation rootProject.ext.dependencies["ydl-media"]
徐健 committed
83
        implementation rootProject.ext.dependencies["ydl-m-user-api"]
konghaorui committed
84
        compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
徐健 committed
85 86 87
        implementation (rootProject.ext.dependencies["ydl-platform"]) {
            transitive = true
        }
徐健 committed
88 89 90
    }

}