apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
//apply plugin: 'realm-android'//Realm数据库
android {
    compileSdkVersion androidConfigs.compileSdkVersion
    buildToolsVersion androidConfigs.buildToolsVersion
    defaultConfig {
        applicationId "com.sheep.jiuyan.samllsheep"
        minSdkVersion 18
        targetSdkVersion 27
        versionCode VERSION_CODE as int
        versionName VERSION_NAME
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        ndk {
            abiFilters "armeabi-v7a", 'x86'//, 'armeabi-v7a', 'x86_64', 'arm64-v8a'
        }
//        jackOptions {
//            enabled true
//        }
        multiDexEnabled true
    }
//    compileOptions{
//        sourceCompatibility org.gradle.api.JavaVersion.VERSION_1_8
//        targetCompatibility org.gradle.api.JavaVersion.VERSION_1_8
//    }
    signingConfigs {
        config {
            keyAlias 'sheep'
            keyPassword 'zhaoyi2004'
            storeFile file('.././sign.jks')
            storePassword 'zhaoyi2004'
            v1SigningEnabled true
            v2SigningEnabled false
        }

    }

    lintOptions {
        abortOnError false
        disable 'MissingTranslation'
    }

    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "4g"
    }
    packagingOptions {

        exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
        debug {
            signingConfig signingConfigs.config
        }
    }
    productFlavors.all { flavor ->
        flavor.manifestPlaceholders = [DUANDUAN_GRAPH    : "${flavor.name}",
                                       DUANDUAN_DATASHARE: "${flavor.name}",
        ]
    }
    productFlavors {
        developSheeptest {
            applicationId "com.sheep.jiuyan.samllsheep"
            manifestPlaceholders = [DUANDUAN_GRAPH    : "sheeptest",
                                    DUANDUAN_DATASHARE: "sheeptest",
                                    jpush_appkey      : "4fea09bdbf9661a9689ee306",
                                    umeng_app_key     : "5ab0a1da8f4a9d742900035f"
            ]
            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptest"'
            buildConfigField "String", "DUANDUAN_GRAPH", '"sheeptest"'
            buildConfigField "String", "app_name", '"小绵羊测试"'
            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
            buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
            signingConfig signingConfigs.config
        }
        sheeptestjiguang {
            applicationId "com.sheep.jiuyan.samllsheep.test"
            manifestPlaceholders = [DUANDUAN_GRAPH    : "sheeptestjiguang",
                                    DUANDUAN_DATASHARE: "sheeptestjiguang",
                                    jpush_appkey      : "4fea09bdbf9661a9689ee306",
                                    umeng_app_key     : "5ab0a1da8f4a9d742900035f"
            ]
            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptestjiguang"'
            buildConfigField "String", "DUANDUAN_GRAPH", '"sheeptestjiguang"'
            buildConfigField "String", "app_name", '"小绵羊测试"'
            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
            buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
            signingConfig signingConfigs.config
        }
        sheep {
            applicationId "com.sheep.jiuyan.samllsheep"
            manifestPlaceholders = [DUANDUAN_GRAPH    : "sheep",
                                    DUANDUAN_DATASHARE: "sheep",
                                    jpush_appkey      : "28b74d520261c6f78e3e0921",
                                    umeng_app_key     : "5ab0a1da8f4a9d742900035f"
            ]
            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheep"'
            buildConfigField "String", "DUANDUAN_GRAPH", '"sheep"'
            buildConfigField "String", "app_name", '"小绵羊"'
            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
            buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
            signingConfig signingConfigs.config

        }
    }
    sourceSets {
        main() {
            jniLibs.srcDirs = ['src/main/libs']
            jni.srcDirs = [] //屏蔽掉默认的jni编译生成过程
        }
    }

}

repositories {
    flatDir {
        dirs 'libs'
    }
    google()
}

dependencies {
    compile "com.android.support:design:$supportLibVersion"
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.google.code.gson:gson:2.8.2'
    compile('com.jcodecraeer:xrecyclerview:1.5.2') {
        //    compile 'com.shark:screencapture:1.0.0'
        exclude group: 'com.android.support', module: 'design'
    }
    compile 'com.squareup.okhttp3:okhttp:3.10.0'
    compile 'org.greenrobot:eventbus:3.1.1'
    compile 'com.zhy:base-adapter:3.0.3'

    //    compile 'com.liulishuo.filedownloader:library:1.6.9'
    compile 'com.tencent.bugly:crashreport_upgrade:1.3.4'

    //其中latest.release指代最新版本号，也可以指定明确的版本号，例如1.2.0
    compile 'com.tencent.bugly:nativecrashreport:3.3.1'

    //其中latest.release指代最

    //    compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+'
    debugCompile('com.readystatesoftware.chuck:library:1.1.0') {
        exclude group: 'com.android.support', module: 'design'
    }

    //    compile 'de.hdodenhof:circleimageview:2.2.0'
    releaseCompile('com.readystatesoftware.chuck:library-no-op:1.1.0') {
        exclude group: 'com.android.support', module: 'design'
    }
    compile 'org.xutils:xutils:3.5.0'
    compile 'com.mylhyl:acp:1.1.7'

    compile 'cn.yipianfengye.android:zxing-library:2.2'
    compile 'com.github.huburt-Hu:NewbieGuide:v1.2.0'
    debugCompile 'com.android.support:multidex:1.0.1'

    //不要修改这里，相信我
    releaseCompile 'com.android.support:multidex:1.0.3'
    compile(name: 'com.kfzs.safe', ext: 'aar')

    //butterknife
    compile 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    //dagger2

    //    compile 'com.google.dagger:dagger:+'

    //    compile 'com.google.dagger:dagger-compiler:+'
    provided 'org.glassfish:javax.annotation:10.0-b28'
    compile 'com.google.dagger:dagger:2.12'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.12'

    //retrofit
    compile 'com.squareup.retrofit2:retrofit:2.4.0'
    compile 'com.squareup.retrofit2:converter-gson:2.4.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.10.0'

    //    compile 'com.squareup.retrofit2:adapter-rxjava2:+'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'

    //rxjava
    compile 'io.reactivex.rxjava2:rxandroid:2.0.2'
    compile 'io.reactivex.rxjava2:rxjava:2.1.12'

    //获取动态权限三方库
    compile 'pub.devrel:easypermissions:1.2.0'
    compile 'net.danlew:android.joda:2.9.3'
    compile 'com.orhanobut:logger:1.15'

    //友盟
    compile 'com.umeng.sdk:common:1.5.3'

    //compile 'com.umeng.sdk:analytics:latest.integration'

    //fast json
    compile 'com.alibaba:fastjson:1.2.47'

    //添加半袋米相关
    compile(name: 'appstoreutils', ext: 'aar')
    compile project(':view')

    //    compile(name: 'view-release', ext: 'aar')
    compile 'com.flipboard:bottomsheet-core:1.5.3'
    compile 'com.flipboard:bottomsheet-commons:1.5.3'
    compile 'com.google.protobuf:protobuf-java:3.2.0'

    compile files('libs/open_sdk_r5923_lite.jar')
    compile files('libs/wechat-sdk-android-with-mta-1.1.6.jar')
    compile files('libs/umeng_social_tool.jar')
    compile files('libs/umeng_social_shareboard.jar')
    compile files('libs/umeng_social_net.jar')
    compile files('libs/umeng_social_api.jar')
    compile files('libs/umeng_shareboard_widget.jar')
    compile files('libs/SocialSDK_WeiXin_Full.jar')
    compile files('libs/SocialSDK_QQ_Full.jar')
    compile 'com.zhy:okhttputils:2.6.2'

    //    compile 'com.kf.framework:kf-utils:latest.integration@aar'
    compile 'com.kf.framework:kf-utils:1.4.5@aar'

    //    compile 'com.kf.framework:volleyplus:latest.integration@aar'
    compile 'com.kf.framework:volleyplus:1.4.5@aar'
    compile "com.android.support:support-annotations:$supportLibVersion"
    compile "com.android.support:recyclerview-v7:$supportLibVersion"
    compile project(':datashare')
    compile files('libs/jackson-core-2.2.1.jar')
    compile files('libs/jackson-dataformat-xml-2.1.2.jar')
    compile 'io.reactivex:rxandroid:1.2.1'
    compile 'com.github.ithedan:TextViewDrawable:v1.0'
//    compile 'com.github.zhangkexpz:LayoutScroll:v1.0'
//    compile 'me.iwf.photopicker:PhotoPicker:0.9.12@aar'
    compile(name: 'PhotoPicker-release', ext: 'aar')
    compile 'com.github.bumptech.glide:glide:4.1.1'

    //    compile 'com.github.yalantis:ucrop:2.2.1-native'

    //    compile 'com.google.zxing:core:3.3.0'
    compile project(':ucrop')
    compile('com.arialyy.aria:aria-core:3.3.16') {
        exclude group: 'com.android.support'
    }
//    compile project(':Aria')

    annotationProcessor 'com.arialyy.aria:aria-compiler:3.3.16'
    compile 'com.sunfusheng:marqueeview:1.3.3'
    compile files('libs/alipaySdk-20170922.jar')
    //极光
    compile files('libs/jcore-android-1.2.0.jar')
    compile files('libs/jpush-android-3.1.2.jar')

    //定位
    compile files('libs/BaiduLBS_Android.jar')

    //幂动科技
    compile files('libs/mdsdk.jar')
    //轮播图
    compile 'com.youth.banner:banner:1.4.10'  //最新版本
    //loading
    compile 'com.github.ybq:Android-SpinKit:1.1.0'
//    compile 'com.github.nanchen2251:CompressHelper:1.0.5'
//    compile(name: 'compresshelper-release', ext: 'aar')
    compile files('libs/compresshelper-release.jar')
}

static def releaseTime() {
    return new Date().format("MMddHHmm", TimeZone.getDefault())
}
//在apk文件后边生成版本号信息
android.applicationVariants.all {
    variant ->
        variant.outputs.each {
            output ->
                if (buildType.name == "release") {
                    output.outputFile = new File(output.outputFile.parent, productFlavors[0].name + "_" + buildType.name + "_v" + android.defaultConfig.versionName + "_" + android.defaultConfig.versionCode + "-${releaseTime()}.apk")
                }

        }
}