build.gradle 5.49 KB
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: "config.gradle"

static void imput(String type, Project project, Object dependencyNotation) {
    if (project != dependencyNotation) project.dependencies.add(type, dependencyNotation)

}

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "com.alibaba:arouter-register:1.0.2"
        classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

////配置全局变量
//ext {
//    def versionMajor = 1
//    def versionMinor = 5
//    def versionPatch = 6
//    def versionBuild = 0
//    // module依赖库公共版本号
//    versionCode = versionMajor * 1000 + versionMinor * 100 + versionPatch * 10 + versionBuild
//    versionName = "${versionMajor}.${versionMinor}.${versionPatch}.${versionBuild}"
//
//    compileSdkVersion = 29
//    buildToolsVersion = "29.0.2"
//    minSdkVersion = 19
//    targetSdkVersion = 29
//}
allprojects {
    afterEvaluate {
        if (project.parent == null || project.parent == rootProject) return

        android {
            compileSdkVersion 29
            buildToolsVersion "29.0.0"
            // defaultConfig 闭包:默认配置、应用程序包名、最小sdk版本、目标sdk版本、版本号、版本名称;
            defaultConfig {
                if (minSdkVersion == null) minSdkVersion 21
                if (targetSdkVersion == null) targetSdkVersion 29
                if (versionCode == null) versionCode 1
                if (versionName == null) versionName "1.2"

                testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

                javaCompileOptions {
                    annotationProcessorOptions {
                        arguments = [
                                AROUTER_MODULE_NAME: project.getName()
//                                ,
//                                AROUTER_GENERATE_DOC: "enable"
                        ]
                    }
                }

                ndk {
                    abiFilters(
                            "armeabi-v7a"
//                            , "x86"
                    )
                }
            }

            compileOptions {
                sourceCompatibility JavaVersion.VERSION_1_8
                targetCompatibility JavaVersion.VERSION_1_8
            }

            dataBinding {
                enabled true
            }

            // multiDex的一些相关配置,这样配置可以让你的编译速度更快
            dexOptions {
                // 让它不要对Lib做preDexing
                preDexLibraries = false
                // 开启incremental dexing,优化编译效率,这个功能android studio默认是关闭的。
//                incremental true
                javaMaxHeapSize "4g" // 增加java堆内存大小
            }
            //signingConfigs 闭包:签名信息配置;
            signingConfigs {
                debugConfig {
                    storeFile file("www.cnlive.com.key")
                    storePassword "www.cnlive.comPassw0rd"
                    keyAlias "strike-debug"
                    keyPassword "www.cnlive.com"
                }
                releaseConfig {
//                    if (store_file != null) storeFile file(store_file)
//                    if (store_password != null) storePassword store_password
//                    if (key_alias != null) keyAlias key_alias
//                    if (key_password != null) keyPassword key_password
                    storeFile file("www.cnlive.com.key")
                    storePassword "www.cnlive.comPassw0rd"
                    keyAlias "strike"
                    keyPassword "www.cnlive.com"
                }
            }
        }
        //核心库
        imput("implementation", project, moudle.core_base)

        //Tripartite Base
        for (String moudle : base_librarys) imput('implementation', project, moudle)
//        for (String moudle : base_librarys) imput('api', project, moudle)
        for (String moudle : base_compilers) imput('annotationProcessor', project, moudle)

    }

    repositories {
        google()
        jcenter()
        maven {
            url maven.mixedUrl
            credentials { username = nexusId; password = nexusPw }
        }
        //------------------ 资源库配置 END------------------
        maven {
            url 'https://dl.bintray.com/granzon/cnlive'
        }
        maven {
            url 'https://dl.bintray.com/granzon/cnliveLibs'
        }
        maven {
            url "https://jitpack.io"
        }
        maven {
            url 'http://developer.huawei.com/repo'
        }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

//配置全局变量
ext {
    compileSdkVersion = 29
    libMediaPicker = '1.6.0'
    //    loading动画
    avi = "2.1.3"
    //蓝牙
    BleLib = "2.3.4"
    //动画大全
    viewAnimationsEasing = '2.0@aar'
    viewAnimationsAndroid = '2.3@aar'
    libEmoj = '2.1.0'
    libLargeImage = '1.0.1'
    //SmartRefresh
    SmartRefreshLayout = '1.1.0-alpha-1'
    SmartRefreshHeader = '1.1.0-alpha-1'
    TimePickerDialog = '1.0.1'
//    libVideoQiniu = '1.0.6'
    //七牛
    qiniuAndroidSdk = '7.3.11'
    libUpload = '2.0.6'
}