修复构建脚本中 version delta 相关判断问题

- 现在如果 use_delta 为 false 则输出 BuildConfig.VERSION_DELTA 为 null
This commit is contained in:
A.C.Sukazyo Eyre 2022-11-08 22:37:46 +08:00
parent f362d08f34
commit d8eb372063
Signed by: Eyre_S
GPG Key ID: C17CE40291207874

View File

@ -40,7 +40,7 @@ final String proj_application_main = "${proj_package}.ServerMain"
final String proj_version_base = VERSION final String proj_version_base = VERSION
final String proj_version_delta = VERSION_DELTA final String proj_version_delta = VERSION_DELTA
final String proj_version_use_delta = Boolean.parseBoolean(VERSION_DELTA) final boolean proj_version_use_delta = Boolean.parseBoolean(USE_DELTA)
String proj_version = proj_version_base String proj_version = proj_version_base
if (proj_version_use_delta) proj_version += "-δ${proj_version_delta}" if (proj_version_use_delta) proj_version += "-δ${proj_version_delta}"
if (proj_git) proj_version += "+git.${proj_commit.substring(0, 8)}" + (proj_clean?"":".δ") if (proj_git) proj_version += "+git.${proj_commit.substring(0, 8)}" + (proj_clean?"":".δ")
@ -120,7 +120,7 @@ buildConfig {
packageName(proj_package) packageName(proj_package)
buildConfigField('String', 'VERSION', "\"${proj_version}\"") buildConfigField('String', 'VERSION', "\"${proj_version}\"")
buildConfigField('String', 'VERSION_DELTA', "\"${proj_version_delta}\"") buildConfigField('String', 'VERSION_DELTA', proj_version_use_delta ? "\"${proj_version_delta}\"" : "null")
buildConfigField('String', 'CODENAME', "\"${proj_version_codename}\"") buildConfigField('String', 'CODENAME', "\"${proj_version_codename}\"")
buildConfigField('long', 'CODE_TIMESTAMP', "${proj_code_time}L") buildConfigField('long', 'CODE_TIMESTAMP', "${proj_code_time}L")
buildConfigField('String', 'COMMIT', proj_git ? "\"${proj_commit}\"" : "null") buildConfigField('String', 'COMMIT', proj_git ? "\"${proj_commit}\"" : "null")