【发布时间】:2021-03-08 22:30:15
【问题描述】:
我想使用存储我的版本和内部版本号的 android 项目中的 Gradle 文件更改 TeamCity Cloud 2020.2.2 中的内部版本号格式。
想要实现build号
VERSION_MAJOR+VERSION_MINOR+VERSION_PATCH+Teamcity_Buildcounter =
1.1.3.48
我想要 TeamCity 中的 Gradle 值,一旦 Teamcity Buildcounter 增加,更新 Gradle 文件中的值并提交?直到现在我都没有找到办法。任何想法我如何才能实现所有答案都非常古老,并非特定于 android
build.gradle
def VERSION_MAJOR=1
def VERSION_MINOR=1
def VERSION_PATCH=3
//Create a variable called keystorePropertiesFile, and initialize it to your
//keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")
// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()
// Load your keystore.properties file into the keystoreProperties object.
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
defaultConfig {
applicationId "xxx"
minSdkVersion 23
targetSdkVersion 30
versionCode VERSION_BUILD
versionName VERSION_MAJOR + "." + VERSION_MINOR + "." + VERSION_PATCH
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
archivesBaseName = "Appname-v$versionName"
// Rest code continues
【问题讨论】:
-
不完全是您正在寻找的东西,但这个library 可能会有所帮助。
-
@YASAN 该库只是生成已经完成的版本号。我认为这与我的问题无关