apply plugin: 'com.android.application'

android {
    String appId = "com.xxfc.rv"
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        flavorDimensions "default"
        versionCode 143
        versionName "1.4.3"
        multiDexEnabled true

        ndk {
            abiFilters "armeabi", "armeabi-v7a", "x86", "mips", 'arm64-v8a'
        }
        //新版Gradle 是 implementation 为了兼容compile,写上这句话
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = true
            }
        }


        manifestPlaceholders = [
                JPUSH_PKGNAME : appId,
                JPUSH_APPKEY : "530b223034b92715e0295047", //JPush 上注册的包名对应的 Appkey.
                JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
        ]

//        javaCompileOptions {
//
//            annotationProcessorOptions {
//
//                arguments = [moduleName: project.getName()]
//
//            }
//        }

        compileOptions {

            sourceCompatibility JavaVersion.VERSION_1_8

            targetCompatibility JavaVersion.VERSION_1_8

        }
    }
    signingConfigs {
        debug {
            keyAlias 'xinxin'
            keyPassword '123456'
            storeFile file('../keystore/xinxin.jks')
            storePassword '123456'
        }
        release {
            keyAlias 'xinxin'
            keyPassword '123456'
            storeFile file('../keystore/xinxin.jks')
            storePassword '123456'
        }

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.debug
        }
        debug {
            debuggable true
            signingConfig signingConfigs.release
        }

        android.applicationVariants.all { variant ->
            variant.outputs.all {

                if (variant.buildType.name == 'release') {
                    def productVersion = "Rv" + releaseTime() + "V" + defaultConfig.versionName + "_Release_" + productFlavors[0].name + ".apk";
                    outputFileName = productVersion
                }
            }
        }

    }

    productFlavors {
        //开发环境
        dev {
//            applicationId = appId + ".dev"

            applicationId = appId
        }

        sit {
//            applicationId = appId + ".sit"
            applicationId = appId
        }

        pro {
            applicationId = appId
        }
    }
}

//打包的时间
static def releaseTime() {
    return new Date().format("yyyyMMddHHss", TimeZone.getTimeZone("GMT+8"))
}


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    api 'com.jakewharton:butterknife:9.0.0-rc1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    debugApi 'com.squareup.leakcanary:leakcanary-android:1.6.1'
    releaseApi 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1'

    api 'cn.jiguang.sdk:jpush:3.3.4'  // 此处以JPush 3.3.4 版本为例。
    api 'cn.jiguang.sdk:jcore:2.1.2'  // 此处以JCore 2.1.2 版本为例。

    //    api project(path: ':RvTravel')
    api project(':component_resource')
    api project(path: ':module_home')
    api project(path: ':module_mine')
    api project(path: ':module_camp')
    api project(path: ':module_tourism')
    api project(path: ':module_discovery')
}
