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

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

13 14 15 16 17
kapt {
    arguments {
        arg("AROUTER_MODULE_NAME", "consultant")
    }
}
konghaorui committed
18
android {
19 20
    compileSdkVersion rootProject.ext.android["compileSdkVersion"]
    buildToolsVersion rootProject.ext.android["buildToolsVersion"]
konghaorui committed
21 22

    defaultConfig {
23 24
        minSdkVersion rootProject.ext.android["minSdkVersion"]
        targetSdkVersion rootProject.ext.android["targetSdkVersion"]
konghaorui committed
25 26 27 28 29 30 31
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        javaCompileOptions {
            annotationProcessorOptions {
32
                arguments = [AROUTER_MODULE_NAME: "consultant"]
konghaorui committed
33 34 35 36 37 38 39 40 41 42 43 44 45
            }
        }

        flavorDimensions "versionCode"
    }

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

46 47 48 49
    //前缀的名字
    resourcePrefix "consultant_"

    //Flavor 信息
konghaorui committed
50 51 52 53 54 55 56 57
    publishNonDefault true
    productFlavors {
        ydl {}
        xlzx {}
    }

    sourceSets {
        main {
58
            manifest.srcFile 'src/main/AndroidManifest.xml'
konghaorui committed
59 60 61 62 63 64 65 66 67 68 69
        }
    }

}

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

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