if (!isNeedMainModule.toBoolean()) {
    apply plugin: 'com.android.application'
} else {
    apply plugin: 'com.android.library'
}
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: "../gradle_component/baseconfig.gradle"
apply plugin: 'com.google.gms.google-services'

static def releaseTime() {
    return new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("UTC"))
}

android {
    defaultConfig {
        if (!isNeedMainModule.toBoolean()) {
            applicationId "com.sinata.feixin"
        }
//      javaCompileOptions {
//            annotationProcessorOptions {
//                arguments = [moduleName: project.getName()]
//            }
//        }
        kapt {
            arguments {
                arg("AROUTER_MODULE_NAME", project.getName())
            }
        }
    }

    buildTypes {
        release {
            if (!isNeedMainModule.toBoolean()) {
                //修改生成的apk名字
                applicationVariants.all { variant ->
                    // 更新至Android Studio 3.3 gradle 4.10.1
                    variant.outputs.all {
                        outputFileName = "飞信${rootProject.ext.versionName}(${rootProject.ext.versionCode})_${(releaseTime())}.apk"
                    }
//                variant.outputs.each { output ->
//                    def outputFile = output.outputFile
//                    if (outputFile != null && outputFile.name.endsWith('.apk') && variant.buildType.name.equals("release")) {
//                        def fileName = "bc_chat${rootProject.ext.versionName}(${rootProject.ext.versionCode})_${(releaseTime())}.apk"
//                        output.outputFileName = new File(fileName)
//                    }
//                }
                }
            }
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    if (isNeedAccoutModule.toBoolean()) {
        implementation project(':bc_account')
    }
    if (isNeedImModule.toBoolean()) {
        implementation project(':bc_im')
    }
    if (isNeedMineModule.toBoolean()) {
        implementation project(':bc_mine')
    }
    if (isNeedContactModule.toBoolean()) {
        implementation project(':bc_contacts')
    }
    kapt "com.alibaba:arouter-compiler:1.2.2"
    // 靠谱点的圆形视图库
    implementation 'com.makeramen:roundedimageview:2.3.0'
//    api 'com.google.firebase:firebase-core:17.2.0'
//    api 'com.google.firebase:firebase-messaging:20.0.0'
//    api 'com.google.android.gms:play-services:12.0.1'
    implementation("com.google.android.gms:play-services-gcm:12.0.1") {
        force = true
    }
    api 'com.google.firebase:firebase-messaging:17.6.0'

}
