2019-05-29 22:19:17 +08:00
|
|
|
apply {
|
|
|
|
|
plugin "com.android.application"
|
|
|
|
|
plugin "kotlin-android"
|
|
|
|
|
plugin "kotlin-android-extensions"
|
2019-07-13 20:51:18 +08:00
|
|
|
if (Config.depConfig.plugin.bus.isApply) {
|
2019-05-29 22:19:17 +08:00
|
|
|
plugin "com.blankj.bus"
|
|
|
|
|
}
|
2019-07-13 20:51:18 +08:00
|
|
|
if (Config.depConfig.plugin.api.isApply) {
|
2019-07-10 19:46:10 +08:00
|
|
|
plugin "com.blankj.api"
|
|
|
|
|
}
|
2019-05-29 22:19:17 +08:00
|
|
|
}
|
|
|
|
|
|
2019-07-10 19:46:10 +08:00
|
|
|
configSigning()
|
|
|
|
|
configApkName()
|
2019-05-29 22:19:17 +08:00
|
|
|
|
|
|
|
|
android {
|
2019-07-10 19:46:10 +08:00
|
|
|
compileSdkVersion Config.compileSdkVersion
|
2019-05-29 22:19:17 +08:00
|
|
|
defaultConfig {
|
2019-09-27 11:36:27 +08:00
|
|
|
minSdkVersion Config.minSdkVersion
|
2019-07-10 19:46:10 +08:00
|
|
|
versionCode Config.versionCode
|
|
|
|
|
versionName Config.versionName
|
|
|
|
|
applicationId Config.applicationId + suffix
|
|
|
|
|
targetSdkVersion Config.targetSdkVersion
|
2019-05-29 22:19:17 +08:00
|
|
|
multiDexEnabled true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
|
debug {
|
|
|
|
|
minifyEnabled false
|
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
2019-08-08 04:19:33 +08:00
|
|
|
applicationIdSuffix ".debug"
|
2019-08-09 01:15:51 +08:00
|
|
|
resValue "string", "app_name", Config.appName + suffix + ".debug"
|
2019-05-29 22:19:17 +08:00
|
|
|
}
|
2019-08-09 01:15:51 +08:00
|
|
|
|
2019-05-29 22:19:17 +08:00
|
|
|
release {
|
|
|
|
|
minifyEnabled true
|
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
2019-08-09 01:15:51 +08:00
|
|
|
resValue "string", "app_name", Config.appName + suffix
|
2019-05-29 22:19:17 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
packagingOptions {
|
|
|
|
|
exclude 'META-INF/*'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dexOptions {
|
2019-06-03 21:13:11 +08:00
|
|
|
preDexLibraries true
|
2019-05-29 22:19:17 +08:00
|
|
|
javaMaxHeapSize "8g"
|
|
|
|
|
maxProcessCount 8
|
2019-06-03 21:13:11 +08:00
|
|
|
dexInProcess = true
|
2019-05-29 22:19:17 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
// LeakCanary
|
2019-07-13 20:51:18 +08:00
|
|
|
debugImplementation Config.depConfig.leakcanary.android.dep
|
|
|
|
|
debugImplementation Config.depConfig.leakcanary.support_fragment.dep
|
|
|
|
|
releaseImplementation Config.depConfig.leakcanary.android_no_op.dep
|
2019-07-10 19:46:10 +08:00
|
|
|
|
2019-07-26 16:58:16 +08:00
|
|
|
debugImplementation 'com.didichuxing.doraemonkit:doraemonkit:1.1.8'
|
|
|
|
|
releaseImplementation 'com.didichuxing.doraemonkit:doraemonkit-no-op:1.1.8'
|
|
|
|
|
|
2019-07-13 20:51:18 +08:00
|
|
|
// 根据 Config.pkgConfig 来依赖所有 pkg
|
|
|
|
|
for (def entrySet : ConfigUtils.getApplyPkgs().entrySet()) {
|
|
|
|
|
api entrySet.value.dep
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-09 01:15:51 +08:00
|
|
|
if (Config.depConfig.feature.mock.isApply) {
|
2019-07-13 20:51:18 +08:00
|
|
|
api Config.depConfig.feature.mock.dep
|
2019-07-10 19:46:10 +08:00
|
|
|
}
|
2019-05-29 22:19:17 +08:00
|
|
|
}
|
|
|
|
|
|
2019-07-10 19:46:10 +08:00
|
|
|
def getSuffix() {
|
2019-07-15 23:55:24 +08:00
|
|
|
if (project.path == ":feature:launcher:app") return ""
|
|
|
|
|
return project.path.replace(":", "_").substring(":feature".length(), project.path.length() - ":app".length())
|
2019-05-29 22:19:17 +08:00
|
|
|
}
|
|
|
|
|
|
2019-07-10 19:46:10 +08:00
|
|
|
def configSigning() {
|
2019-05-29 22:19:17 +08:00
|
|
|
|
|
|
|
|
File signPropertiesFile = file("${rootDir.path}/sign/keystore.properties")
|
|
|
|
|
if (!signPropertiesFile.exists()) return
|
|
|
|
|
|
2019-07-14 18:25:56 +08:00
|
|
|
GLog.d("${project.toString()} sign start...")
|
2019-07-10 19:46:10 +08:00
|
|
|
project.android {
|
2019-05-29 22:19:17 +08:00
|
|
|
Properties properties = new Properties()
|
|
|
|
|
properties.load(new FileInputStream(signPropertiesFile))
|
|
|
|
|
signingConfigs {
|
|
|
|
|
release {
|
|
|
|
|
storeFile new File(signPropertiesFile.getParent(), properties['keystore'])
|
|
|
|
|
storePassword properties['storePassword']
|
|
|
|
|
keyAlias properties['keyAlias']
|
|
|
|
|
keyPassword properties['keyPassword']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
buildTypes.release.signingConfig signingConfigs.release
|
|
|
|
|
}
|
2019-07-14 18:25:56 +08:00
|
|
|
GLog.d("${project.toString()} sign end...")
|
2019-05-29 22:19:17 +08:00
|
|
|
}
|
|
|
|
|
|
2019-07-10 19:46:10 +08:00
|
|
|
def configApkName() {
|
|
|
|
|
project.android.applicationVariants.all { variant ->
|
2019-05-29 22:19:17 +08:00
|
|
|
if (variant.buildType.name != "debug") {
|
2019-06-28 13:20:00 +08:00
|
|
|
def artifact = variant.getPackageApplicationProvider().get()
|
|
|
|
|
artifact.outputDirectory = new File("${rootDir.path}/apk")
|
|
|
|
|
artifact.outputScope.apkDatas.forEach { apkData ->
|
2019-05-29 22:19:17 +08:00
|
|
|
apkData.outputFileName = "util" + suffix +
|
2019-06-28 13:20:00 +08:00
|
|
|
(variant.flavorName == "" ? "" : ("_" + variant.flavorName)) +
|
2019-05-29 22:19:17 +08:00
|
|
|
"_" + variant.versionName.replace(".", "_") +
|
2019-06-28 13:20:00 +08:00
|
|
|
"_" + variant.buildType.name +
|
2019-05-29 22:19:17 +08:00
|
|
|
".apk"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|