Better management of SDK version

This commit is contained in:
Benoit Marty 2021-09-09 09:54:51 +02:00 committed by Benoit Marty
parent 9914fb2d0f
commit 6a1409ba59
5 changed files with 6 additions and 7 deletions

View File

@ -36,6 +36,7 @@ body:
- [ ] Push `main` and the new tag `v1.1.10` to origin - [ ] Push `main` and the new tag `v1.1.10` to origin
- [ ] Checkout `develop` - [ ] Checkout `develop`
- [ ] Increase version in `./vector/build.gradle` - [ ] Increase version in `./vector/build.gradle`
- [ ] Change the value of SDK_VERSION in the file `./matrix-sdk-android/build.gradle`
- [ ] Commit and push `develop` - [ ] Commit and push `develop`
- [ ] Wait for [Buildkite](https://buildkite.com/matrix-dot-org/element-android/builds?branch=main) to build the `main` branch. - [ ] Wait for [Buildkite](https://buildkite.com/matrix-dot-org/element-android/builds?branch=main) to build the `main` branch.
- [ ] Run the script `~/scripts/releaseElement.sh`. It will download the APKs from Buildkite check them and sign them. - [ ] Run the script `~/scripts/releaseElement.sh`. It will download the APKs from Buildkite check them and sign them.

View File

@ -31,9 +31,7 @@ android {
// that the app's state is completely cleared between tests. // that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true' testInstrumentationRunnerArguments clearPackageData: 'true'
// Seems that the build tools 4.1.0 does not generate BuildConfig.VERSION_NAME anymore. buildConfigField "String", "SDK_VERSION", "\"1.2.2\""
// Add it manually here. We may remove this trick in the future
buildConfigField "String", "VERSION_NAME", "\"0.0.1\""
buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\"" buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\""
resValue "string", "git_sdk_revision", "\"${gitRevision()}\"" resValue "string", "git_sdk_revision", "\"${gitRevision()}\""

View File

@ -117,7 +117,7 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo
} }
fun getSdkVersion(): String { fun getSdkVersion(): String {
return BuildConfig.VERSION_NAME + " (" + BuildConfig.GIT_SDK_REVISION + ")" return BuildConfig.SDK_VERSION + " (" + BuildConfig.GIT_SDK_REVISION + ")"
} }
} }
} }

View File

@ -111,7 +111,7 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo
} }
fun getSdkVersion(): String { fun getSdkVersion(): String {
return BuildConfig.VERSION_NAME + " (" + BuildConfig.GIT_SDK_REVISION + ")" return BuildConfig.SDK_VERSION + " (" + BuildConfig.GIT_SDK_REVISION + ")"
} }
} }
} }

View File

@ -74,13 +74,13 @@ internal class UserAgentHolder @Inject constructor(private val context: Context,
// if there is no user agent or cannot parse it // if there is no user agent or cannot parse it
if (null == systemUserAgent || systemUserAgent.lastIndexOf(")") == -1 || !systemUserAgent.contains("(")) { if (null == systemUserAgent || systemUserAgent.lastIndexOf(")") == -1 || !systemUserAgent.contains("(")) {
userAgent = (appName + "/" + appVersion + " ( Flavour " + flavorDescription userAgent = (appName + "/" + appVersion + " ( Flavour " + flavorDescription
+ "; MatrixAndroidSDK_X " + BuildConfig.VERSION_NAME + ")") + "; MatrixAndroidSDK_X " + BuildConfig.SDK_VERSION + ")")
} else { } else {
// update // update
userAgent = appName + "/" + appVersion + " " + userAgent = appName + "/" + appVersion + " " +
systemUserAgent.substring(systemUserAgent.indexOf("("), systemUserAgent.lastIndexOf(")") - 1) + systemUserAgent.substring(systemUserAgent.indexOf("("), systemUserAgent.lastIndexOf(")") - 1) +
"; Flavour " + flavorDescription + "; Flavour " + flavorDescription +
"; MatrixAndroidSDK_X " + BuildConfig.VERSION_NAME + ")" "; MatrixAndroidSDK_X " + BuildConfig.SDK_VERSION + ")"
} }
} }
} }