build.gradle 3.04 KB
Newer Older
konghaorui committed
1 2 3 4 5
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

konghaorui committed
6
apply plugin: 'resTools' // 资源重命名插件
konghaorui committed
7

8 9 10 11 12
// 配置资源重命名插件
resConfig {
    new_prefix = 'tests_'  // 资源前缀
    old_prefix = ''         // 老前缀,可为''空字符串
}
konghaorui committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

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
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        flavorDimensions "versionCode"

    }

    lintOptions {
        abortOnError false
    }

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

    //前缀的名字
48
    resourcePrefix "tests_"
konghaorui committed
49

konghaorui committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
    //Flavor 信息
    publishNonDefault true
    productFlavors {
        ydl {}
        xlzx {}
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    implementation 'com.google.code.gson:gson:2.8.2'

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

    api rootProject.ext.dependencies["ydl-user-router"]
    if (rootProject.ext.dev_mode){
        //开发时使用
        api project(':ydl-webview')
        api project(':ydl-platform')
78
        implementation project(':ydl-flutter-base')
konghaorui committed
79
        implementation modularPublication('com.ydl:m-test-api')
80
        implementation modularPublication('com.ydl:m-user-api')
konghaorui committed
81 82
        implementation modularPublication('com.ydl:m-dynamic-api')
        implementation modularPublication('com.ydl:m-im-api')
konghaorui committed
83 84
    }else {
        //发布时使用
konghaorui committed
85
        compileOnly rootProject.ext.dependencies["ydl-m-tests-api"]
86
        compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
konghaorui committed
87 88
        compileOnly rootProject.ext.dependencies["ydl-m-dynamic-api"]
        compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
徐健 committed
89

konghaorui committed
90 91 92 93
        api rootProject.ext.dependencies["ydl-webview"]
        api(rootProject.ext.dependencies["ydl-platform"]) {
            transitive = true
        }
徐健 committed
94 95

        implementation rootProject.ext.dependencies["ydl-flutter-base"]
konghaorui committed
96 97
    }
}