import java.text.SimpleDateFormat

apply plugin: 'com.android.application'

//获取时间的方法
static def getNowTime() {
    return new SimpleDateFormat("yyyy-MM-dd HH_mm", Locale.CHINA).format(new Date());
}

android {
    compileSdkVersion rootProject.compileSdkVersion
    defaultConfig {
        applicationId "com.aries.library.fast.demo"
        minSdkVersion rootProject.minSdkVersion
        targetSdkVersion rootProject.targetSdkVersion
        versionCode rootProject.versionCode
        versionName rootProject.versionName
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        buildConfigField "Boolean", "LOG_ENABALE", "true"
        buildConfigField "String", "BASE_URL", "\"https://api.douban.com/\""
        buildConfigField "String", "BASE_ARTICLE_URL", "\"https://api.readhub.me/\""
        buildConfigField "String", "BASE_UPDATE_URL", "\"https://raw.githubusercontent.com/AriesHoo/FastLib/master/apk/\""
        manifestPlaceholders = [
                app_channel: "FastLib",
                bugly_id   : "a66ee7eb32",
                PGYER_ID   : "b88a08387635b27ea95dcf2d6b887a33"
        ]
    }

    dexOptions {
        javaMaxHeapSize "Xg"
        preDexLibraries = false
    }
    dataBinding {
        enabled = true
    }
    signingConfigs {
        release {
            storeFile file('../fast.jks')
            storePassword 'fast123#@!'
            keyAlias 'fast'
            keyPassword 'fast123#@!'
        }
    }
//    忽略打包资源错误
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    buildTypes {
        debug {
            //是否debug模式用于控制是否打印log等
            debuggable true
            zipAlignEnabled false //是否支持Zip Align
            shrinkResources false //是否清理无用资源
            minifyEnabled false //是否启动混淆
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        release {
            debuggable false
            zipAlignEnabled true //是否支持Zip Align
            shrinkResources true //是否清理无用资源
            minifyEnabled true //是否启动混淆
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.all {
            if (variant.name != "release") {
                return
            }
            outputFileName = "sample.apk"
//            def fileName = "FastLib_v${defaultConfig.versionName}_code_${defaultConfig.versionCode}_time_${getNowTime()}.apk"
//            outputFileName = fileName
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:deprecation" << '-Xlint:-unchecked'
        }
    }
    //强制版本
    configurations.all {
        resolutionStrategy {
            force 'com.squareup.okhttp3:logging-interceptor:3.12.2'
            force 'io.reactivex.rxjava2:rxjava:2.2.19'
            force 'androidx.appcompat:appcompat:'.concat(supportVersion)
            force 'com.google.android.material:material:'.concat(supportVersion)
            force 'androidx.appcompat:appcompat:'.concat(supportVersion)
            force 'androidx.recyclerview:recyclerview:'.concat(supportVersion)
        }
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':library')
    //implementation 'com.github.AriesHoo:FastLib:2.4.0'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
    testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'

    //以下库FastLib里使用compileOnly只是编译,使用时需根据项目选择相应版本
    implementation 'com.google.android.material:material:'.concat(supportVersion)
    implementation 'androidx.appcompat:appcompat:'.concat(supportVersion)
    implementation 'androidx.recyclerview:recyclerview:'.concat(supportVersion)
    //快速Tab库-继承FastMainActivity使用
    implementation "com.github.AriesHoo.UIWidget:tab-layout:".concat(widgetVersion)
    //滑动返回Activity-鉴于现在全面屏比较多不推荐使用该库
    implementation 'cn.bingoogolapple:bga-swipebacklayout:2.0.1@aar'
    //页面事件交互-androideventbus-停止维护-按需导入
//    implementation 'org.simple:androideventbus:1.0.5.1'
    //页面事件交互-eventbus-按需导入
//    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'org.greenrobot:eventbus:3.2.0'
    //万能适配器--一般都需要吧
    implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:'.concat(BRVAHVersion)
    //webView库 继承FastWebActivity需要,不需要内置WebView可以不implementation
    implementation 'com.just.agentweb:agentweb:'.concat(agentwebVersion)
    //webView提供下载功能
    implementation 'com.download.library:Downloader:'.concat(agentwebVersion)
    //下拉刷新库注意刷新头SmartRefreshHeader版本最好对应尤其头版本不要低于SmartRefreshLayout版本
    implementation 'com.scwang.smart:refresh-layout-kernel:'.concat(smartRefreshLayoutVersion)
    implementation 'com.scwang.smart:refresh-header-material:'.concat(smartRefreshLayoutVersion)
    implementation 'com.scwang.smart:refresh-header-classics:'.concat(smartRefreshLayoutVersion)
    //Glide图片加载
    implementation 'com.github.bumptech.glide:glide:'.concat(glideVersion)
    annotationProcessor 'com.github.bumptech.glide:compiler:'.concat(glideVersion)
    annotationProcessor 'com.jakewharton:butterknife-compiler:'.concat(butterknifeVersion)
    //以上库FastLib里使用compileOnly只是编译,使用时需根据项目选择相应版本
    implementation 'cn.bingoogolapple:bga-banner:2.1.7@aar'
    implementation 'com.github.lygttpod:SuperTextView:2.1.8'
    implementation 'com.flyco.labelview:FlycoLabelView_Lib:1.0.2@aar'
    //文件选择器
    implementation 'com.github.LuckSiege.PictureSelector:picture_library:v2.6.1'
    //友盟统计
    implementation 'com.umeng.analytics:analytics:latest.integration'
    //Bugly
    implementation 'com.tencent.bugly:crashreport:2.8.6.0'
    //哆啦A梦
//    implementation 'com.didichuxing.doraemonkit:doraemonkit:1.2.1'
    debugImplementation 'com.didichuxing.doraemonkit:doraemonkit:3.1.6'
    releaseImplementation 'com.didichuxing.doraemonkit:doraemonkit-no-op:3.1.6'
//    debugImplementation 'com.didichuxing.doraemonkit:doraemonkit:1.2.1'
//    releaseImplementation 'com.didichuxing.doraemonkit:doraemonkit-no-op:1.2.1'
    //Multidex 5.0以下
    implementation 'androidx.multidex:multidex:2.0.0'
    //蒲公英
    implementation 'com.pgyersdk:sdk:3.0.10'
    //保活组件
//    implementation 'com.fanjun:keeplive:1.1.18'
    //滑动返回Activity-类全面屏手势效果
    implementation 'com.github.ParfoisMeng:SlideBack:1.0.7'

    //Google 广告服务测试
    implementation 'com.google.android.gms:play-services-ads:19.1.0'
}
