53 lines
1.8 KiB
Groovy
53 lines
1.8 KiB
Groovy
apply plugin: 'com.android.application'
|
||
apply from: '../.winboll/winboll_app_build.gradle'
|
||
apply from: '../.winboll/winboll_lint_build.gradle'
|
||
|
||
def genVersionName(def versionName){
|
||
// 检查编译标志位配置
|
||
assert (winbollBuildProps['stageCount'] != null)
|
||
assert (winbollBuildProps['baseVersion'] != null)
|
||
// 保存基础版本号
|
||
winbollBuildProps.setProperty("baseVersion", "${versionName}");
|
||
//保存编译标志配置
|
||
FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile)
|
||
winbollBuildProps.store(fos, "${winbollBuildPropsDesc}");
|
||
fos.close();
|
||
|
||
// 返回编译版本号
|
||
return "${versionName}." + winbollBuildProps['stageCount']
|
||
}
|
||
|
||
android {
|
||
|
||
// 1. compileSdkVersion:必须 ≥ targetSdkVersion,建议直接等于 targetSdkVersion(30)
|
||
compileSdkVersion 30
|
||
|
||
// 2. buildToolsVersion:需匹配 compileSdkVersion,建议使用 30.x.x 最新稳定版(无需高于 compileSdkVersion)
|
||
buildToolsVersion "30.0.3" // 这是 30 对应的最新稳定版,避免使用 beta 版
|
||
|
||
defaultConfig {
|
||
applicationId "cc.winboll.studio.appbase"
|
||
minSdkVersion 23
|
||
targetSdkVersion 30
|
||
versionCode 1
|
||
// versionName 更新后需要手动设置
|
||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||
versionName "15.12"
|
||
if(true) {
|
||
versionName = genVersionName("${versionName}")
|
||
}
|
||
}
|
||
|
||
// 确保 Java 7 兼容性(已适配项目技术栈)
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_1_7
|
||
targetCompatibility JavaVersion.VERSION_1_7
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
api project(':libappbase')
|
||
api fileTree(dir: 'libs', include: ['*.jar'])
|
||
}
|