1 Star 0 Fork 41

ljk761626336_05a073/AndroidUtilCode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
buildApp.gradle 3.50 KB
一键复制 编辑 原始数据 按行查看 历史
caimengjie 提交于 2021-12-06 00:00 . opt: Config
apply plugin: "com.android.application"
apply {
from "${rootDir.path}/buildCommon.gradle"
from "${rootDir.path}/config/flavor.gradle"
if (Config.plugins.plugin_api.isApply) {
plugin Config.plugins.plugin_api.id
}
if (Config.plugins.plugin_bus.isApply) {
plugin Config.plugins.plugin_bus.id
}
}
configSigning()
configApkName()
//if (PluginConfig.plugin_bus.isApply) {
// bus {
// onlyScanLibRegex = '^([:]|(com\\.blankj)).+$'
// }
//}
//
//if (PluginConfig.plugin_api.isApply) {
// api {
// onlyScanLibRegex = '^([:]|(com\\.blankj)).+$'
// }
//}
android {
defaultConfig {
applicationId Config.applicationId + suffix
targetSdkVersion Config.targetSdkVersion
multiDexEnabled true
}
buildTypes {
debug {}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/*'
}
dexOptions {
preDexLibraries true
javaMaxHeapSize "8g"
maxProcessCount 8
dexInProcess = true
}
productFlavors {
dev {
applicationIdSuffix ".dev"
versionNameSuffix "-dev"
resValue "string", "app_name", Config.appName + suffix + "-dev"
}
production {
resValue "string", "app_name", Config.appName + suffix
}
}
}
dependencies {
// LeakCanary
debugImplementation Config.libs.leakcanary.path
debugImplementation Config.modules.lib_utildebug.dep
releaseImplementation Config.modules.lib_utildebug_no_op.dep
// 根据 Config.pkgConfig 来依赖所有 pkg
for (def entrySet : ConfigUtils.getApplyPkgs().entrySet()) {
api entrySet.value.dep
}
if (Config.modules.feature_mock.isApply) {
api ModuleConfig.modules.feature_mock.dep
}
}
def getSuffix() {
if (project.name == "feature_launcher_app") return ""
return "." + project.
name.
substring("feature_".length(), project.name.length() - "_app".length())
}
def configSigning() {
File signPropertiesFile = file("${rootDir.path}/sign/keystore.properties")
if (!signPropertiesFile.exists()) return
GLog.d("${project.toString()} sign start...")
project.android {
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
}
GLog.d("${project.toString()} sign end...")
}
def configApkName() {
project.android.applicationVariants.all { variant ->
if (variant.buildType.name != "debug") {
def artifact = variant.getPackageApplicationProvider().get()
artifact.outputDirectory = new File("${rootDir.path}/apk")
variant.outputs.each {
it.outputFileName = "util" + suffix +
(variant.flavorName == "" ? "" : ("_" + variant.flavorName)) +
"_" +
variant.versionName.replace(".", "_") +
"_" +
variant.buildType.name +
".apk"
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/ljk_761626336/AndroidUtilCode.git
git@gitee.com:ljk_761626336/AndroidUtilCode.git
ljk_761626336
AndroidUtilCode
AndroidUtilCode
master

搜索帮助