Merge pull request #3994 from vector-im/feature/bma/sdk_version

Feature/bma/sdk version
This commit is contained in:
Benoit Marty 2021-09-10 15:59:22 +02:00 committed by GitHub
commit 397f576e68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 27 additions and 37 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

@ -18,13 +18,11 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
android { android {
compileSdkVersion 30 compileSdk 30
defaultConfig { defaultConfig {
minSdkVersion 21 minSdk 21
targetSdkVersion 30 targetSdk 30
versionCode 1
versionName "1.0"
} }
buildTypes { buildTypes {

1
changelog.d/3994.misc Normal file
View File

@ -0,0 +1 @@
Better support for Sdk2 version. Also slight change in the default user agent: `MatrixAndroidSDK_X` is replaced by `MatrixAndroidSdk2`

View File

@ -20,14 +20,11 @@ plugins {
} }
android { android {
compileSdkVersion 30 compileSdk 30
buildToolsVersion "30.0.3"
defaultConfig { defaultConfig {
minSdkVersion 21 minSdk 21
targetSdkVersion 30 targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro" consumerProguardFiles "consumer-rules.pro"

View File

@ -3,13 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
android { android {
compileSdkVersion 30 compileSdk 30
defaultConfig { defaultConfig {
minSdkVersion 21 minSdk 21
targetSdkVersion 30 targetSdk 30
versionCode 1
versionName "1.0"
// Multidex is useful for tests // Multidex is useful for tests
multiDexEnabled true multiDexEnabled true

View File

@ -14,14 +14,13 @@ buildscript {
} }
android { android {
compileSdkVersion 30 compileSdk 30
testOptions.unitTests.includeAndroidResources = true testOptions.unitTests.includeAndroidResources = true
defaultConfig { defaultConfig {
minSdkVersion 21 minSdk 21
targetSdkVersion 30 targetSdk 30
versionCode 1
versionName "0.0.1"
// Multidex is useful for tests // Multidex is useful for tests
multiDexEnabled true multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -31,9 +30,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

@ -36,7 +36,7 @@ internal class UserAgentHolder @Inject constructor(private val context: Context,
/** /**
* Create an user agent with the application version. * Create an user agent with the application version.
* Ex: Element/1.0.0 (Linux; U; Android 6.0.1; SM-A510F Build/MMB29; Flavour GPlay; MatrixAndroidSDK_X 1.0) * Ex: Element/1.0.0 (Linux; U; Android 6.0.1; SM-A510F Build/MMB29; Flavour GPlay; MatrixAndroidSdk2 1.0)
* *
* @param flavorDescription the flavor description * @param flavorDescription the flavor description
*/ */
@ -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 + ")") + "; MatrixAndroidSdk2 " + 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 + ")" "; MatrixAndroidSdk2 " + BuildConfig.SDK_VERSION + ")"
} }
} }
} }

View File

@ -19,13 +19,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize' apply plugin: 'kotlin-parcelize'
android { android {
compileSdkVersion 30 compileSdk 30
defaultConfig { defaultConfig {
minSdkVersion 19 minSdk 19
targetSdkVersion 30 targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro' consumerProguardFiles 'consumer-rules.pro'

View File

@ -102,7 +102,7 @@ ext.abiVersionCodes = ["armeabi-v7a": 1, "arm64-v8a": 2, "x86": 3, "x86_64": 4].
def buildNumber = System.env.BUILDKITE_BUILD_NUMBER as Integer ?: 0 def buildNumber = System.env.BUILDKITE_BUILD_NUMBER as Integer ?: 0
android { android {
compileSdkVersion 30 compileSdk 30
// Due to a bug introduced in Android gradle plugin 3.6.0, we have to specify the ndk version to use // Due to a bug introduced in Android gradle plugin 3.6.0, we have to specify the ndk version to use
// Ref: https://issuetracker.google.com/issues/144111441 // Ref: https://issuetracker.google.com/issues/144111441
@ -111,8 +111,8 @@ android {
defaultConfig { defaultConfig {
applicationId "im.vector.app" applicationId "im.vector.app"
// Set to API 21: see #405 // Set to API 21: see #405
minSdkVersion 21 minSdk 21
targetSdkVersion 30 targetSdk 30
multiDexEnabled true multiDexEnabled true
renderscriptTargetApi 24 renderscriptTargetApi 24