From 6a1409ba5987e04e7e68f0b4f0519c71a5a6e169 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 9 Sep 2021 09:54:51 +0200 Subject: [PATCH 1/4] Better management of SDK version --- .github/ISSUE_TEMPLATE/release.yml | 1 + matrix-sdk-android/build.gradle | 4 +--- .../src/androidTest/java/org/matrix/android/sdk/api/Matrix.kt | 2 +- .../src/main/java/org/matrix/android/sdk/api/Matrix.kt | 2 +- .../matrix/android/sdk/internal/network/UserAgentHolder.kt | 4 ++-- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/release.yml b/.github/ISSUE_TEMPLATE/release.yml index 51fe7a7bd1..febb15dbf0 100644 --- a/.github/ISSUE_TEMPLATE/release.yml +++ b/.github/ISSUE_TEMPLATE/release.yml @@ -36,6 +36,7 @@ body: - [ ] Push `main` and the new tag `v1.1.10` to origin - [ ] Checkout `develop` - [ ] Increase version in `./vector/build.gradle` + - [ ] Change the value of SDK_VERSION in the file `./matrix-sdk-android/build.gradle` - [ ] Commit and push `develop` - [ ] 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. diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index cbae6a05b3..c948115d3f 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -31,9 +31,7 @@ android { // that the app's state is completely cleared between tests. testInstrumentationRunnerArguments clearPackageData: 'true' - // Seems that the build tools 4.1.0 does not generate BuildConfig.VERSION_NAME anymore. - // Add it manually here. We may remove this trick in the future - buildConfigField "String", "VERSION_NAME", "\"0.0.1\"" + buildConfigField "String", "SDK_VERSION", "\"1.2.2\"" buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\"" resValue "string", "git_sdk_revision", "\"${gitRevision()}\"" diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/api/Matrix.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/api/Matrix.kt index c439da8407..8b9b6efa11 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/api/Matrix.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/api/Matrix.kt @@ -117,7 +117,7 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo } fun getSdkVersion(): String { - return BuildConfig.VERSION_NAME + " (" + BuildConfig.GIT_SDK_REVISION + ")" + return BuildConfig.SDK_VERSION + " (" + BuildConfig.GIT_SDK_REVISION + ")" } } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/Matrix.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/Matrix.kt index 9980259266..8a4526a5e1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/Matrix.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/Matrix.kt @@ -111,7 +111,7 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo } fun getSdkVersion(): String { - return BuildConfig.VERSION_NAME + " (" + BuildConfig.GIT_SDK_REVISION + ")" + return BuildConfig.SDK_VERSION + " (" + BuildConfig.GIT_SDK_REVISION + ")" } } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt index 1a88404128..c0fb1d02f0 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt @@ -74,13 +74,13 @@ internal class UserAgentHolder @Inject constructor(private val context: Context, // if there is no user agent or cannot parse it if (null == systemUserAgent || systemUserAgent.lastIndexOf(")") == -1 || !systemUserAgent.contains("(")) { userAgent = (appName + "/" + appVersion + " ( Flavour " + flavorDescription - + "; MatrixAndroidSDK_X " + BuildConfig.VERSION_NAME + ")") + + "; MatrixAndroidSDK_X " + BuildConfig.SDK_VERSION + ")") } else { // update userAgent = appName + "/" + appVersion + " " + systemUserAgent.substring(systemUserAgent.indexOf("("), systemUserAgent.lastIndexOf(")") - 1) + "; Flavour " + flavorDescription + - "; MatrixAndroidSDK_X " + BuildConfig.VERSION_NAME + ")" + "; MatrixAndroidSDK_X " + BuildConfig.SDK_VERSION + ")" } } } From 529a7aedcb88f57f77e96663f8b36cb33f528521 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 8 Sep 2021 23:04:17 +0200 Subject: [PATCH 2/4] Cleanup useless values --- attachment-viewer/build.gradle | 2 -- library/ui-styles/build.gradle | 2 -- matrix-sdk-android-rx/build.gradle | 2 -- matrix-sdk-android/build.gradle | 3 +-- multipicker/build.gradle | 2 -- 5 files changed, 1 insertion(+), 10 deletions(-) diff --git a/attachment-viewer/build.gradle b/attachment-viewer/build.gradle index d62062ae14..fe71b41247 100644 --- a/attachment-viewer/build.gradle +++ b/attachment-viewer/build.gradle @@ -23,8 +23,6 @@ android { defaultConfig { minSdkVersion 21 targetSdkVersion 30 - versionCode 1 - versionName "1.0" } buildTypes { diff --git a/library/ui-styles/build.gradle b/library/ui-styles/build.gradle index 365e4b902c..0806a07721 100644 --- a/library/ui-styles/build.gradle +++ b/library/ui-styles/build.gradle @@ -26,8 +26,6 @@ android { defaultConfig { minSdkVersion 21 targetSdkVersion 30 - versionCode 1 - versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" diff --git a/matrix-sdk-android-rx/build.gradle b/matrix-sdk-android-rx/build.gradle index d18e3b1d72..ab72bcf427 100644 --- a/matrix-sdk-android-rx/build.gradle +++ b/matrix-sdk-android-rx/build.gradle @@ -8,8 +8,6 @@ android { defaultConfig { minSdkVersion 21 targetSdkVersion 30 - versionCode 1 - versionName "1.0" // Multidex is useful for tests multiDexEnabled true diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index c948115d3f..4bfaca5084 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -20,8 +20,7 @@ android { defaultConfig { minSdkVersion 21 targetSdkVersion 30 - versionCode 1 - versionName "0.0.1" + // Multidex is useful for tests multiDexEnabled true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/multipicker/build.gradle b/multipicker/build.gradle index b2a5148b4a..73b4b124dd 100644 --- a/multipicker/build.gradle +++ b/multipicker/build.gradle @@ -24,8 +24,6 @@ android { defaultConfig { minSdkVersion 19 targetSdkVersion 30 - versionCode 1 - versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' From 5a5d4fda2dbf7112e2397a14c7b82f29450ada90 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 8 Sep 2021 23:10:45 +0200 Subject: [PATCH 3/4] DSL value has shorter alias now --- attachment-viewer/build.gradle | 6 +++--- library/ui-styles/build.gradle | 7 +++---- matrix-sdk-android-rx/build.gradle | 6 +++--- matrix-sdk-android/build.gradle | 6 +++--- multipicker/build.gradle | 6 +++--- vector/build.gradle | 6 +++--- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/attachment-viewer/build.gradle b/attachment-viewer/build.gradle index fe71b41247..82e208d47e 100644 --- a/attachment-viewer/build.gradle +++ b/attachment-viewer/build.gradle @@ -18,11 +18,11 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 30 + compileSdk 30 defaultConfig { - minSdkVersion 21 - targetSdkVersion 30 + minSdk 21 + targetSdk 30 } buildTypes { diff --git a/library/ui-styles/build.gradle b/library/ui-styles/build.gradle index 0806a07721..069becba0d 100644 --- a/library/ui-styles/build.gradle +++ b/library/ui-styles/build.gradle @@ -20,12 +20,11 @@ plugins { } android { - compileSdkVersion 30 - buildToolsVersion "30.0.3" + compileSdk 30 defaultConfig { - minSdkVersion 21 - targetSdkVersion 30 + minSdk 21 + targetSdk 30 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" diff --git a/matrix-sdk-android-rx/build.gradle b/matrix-sdk-android-rx/build.gradle index ab72bcf427..0d2ddee2e0 100644 --- a/matrix-sdk-android-rx/build.gradle +++ b/matrix-sdk-android-rx/build.gradle @@ -3,11 +3,11 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 30 + compileSdk 30 defaultConfig { - minSdkVersion 21 - targetSdkVersion 30 + minSdk 21 + targetSdk 30 // Multidex is useful for tests multiDexEnabled true diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle index 4bfaca5084..956ac24c79 100644 --- a/matrix-sdk-android/build.gradle +++ b/matrix-sdk-android/build.gradle @@ -14,12 +14,12 @@ buildscript { } android { - compileSdkVersion 30 + compileSdk 30 testOptions.unitTests.includeAndroidResources = true defaultConfig { - minSdkVersion 21 - targetSdkVersion 30 + minSdk 21 + targetSdk 30 // Multidex is useful for tests multiDexEnabled true diff --git a/multipicker/build.gradle b/multipicker/build.gradle index 73b4b124dd..64460f6721 100644 --- a/multipicker/build.gradle +++ b/multipicker/build.gradle @@ -19,11 +19,11 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-parcelize' android { - compileSdkVersion 30 + compileSdk 30 defaultConfig { - minSdkVersion 19 - targetSdkVersion 30 + minSdk 19 + targetSdk 30 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' diff --git a/vector/build.gradle b/vector/build.gradle index 9576ba86c0..7a9016f3b4 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -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 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 // Ref: https://issuetracker.google.com/issues/144111441 @@ -111,8 +111,8 @@ android { defaultConfig { applicationId "im.vector.app" // Set to API 21: see #405 - minSdkVersion 21 - targetSdkVersion 30 + minSdk 21 + targetSdk 30 multiDexEnabled true renderscriptTargetApi 24 From 3fcfe7000f52387ca613e06327988606594e9722 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 9 Sep 2021 09:59:06 +0200 Subject: [PATCH 4/4] Update user agent: `MatrixAndroidSDK_X` is replaced by `MatrixAndroidSdk2` --- changelog.d/3994.misc | 1 + .../matrix/android/sdk/internal/network/UserAgentHolder.kt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog.d/3994.misc diff --git a/changelog.d/3994.misc b/changelog.d/3994.misc new file mode 100644 index 0000000000..63fbe55387 --- /dev/null +++ b/changelog.d/3994.misc @@ -0,0 +1 @@ +Better support for Sdk2 version. Also slight change in the default user agent: `MatrixAndroidSDK_X` is replaced by `MatrixAndroidSdk2` \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt index c0fb1d02f0..57eab6a8dd 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/network/UserAgentHolder.kt @@ -36,7 +36,7 @@ internal class UserAgentHolder @Inject constructor(private val context: Context, /** * 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 */ @@ -74,13 +74,13 @@ internal class UserAgentHolder @Inject constructor(private val context: Context, // if there is no user agent or cannot parse it if (null == systemUserAgent || systemUserAgent.lastIndexOf(")") == -1 || !systemUserAgent.contains("(")) { userAgent = (appName + "/" + appVersion + " ( Flavour " + flavorDescription - + "; MatrixAndroidSDK_X " + BuildConfig.SDK_VERSION + ")") + + "; MatrixAndroidSdk2 " + BuildConfig.SDK_VERSION + ")") } else { // update userAgent = appName + "/" + appVersion + " " + systemUserAgent.substring(systemUserAgent.indexOf("("), systemUserAgent.lastIndexOf(")") - 1) + "; Flavour " + flavorDescription + - "; MatrixAndroidSDK_X " + BuildConfig.SDK_VERSION + ")" + "; MatrixAndroidSdk2 " + BuildConfig.SDK_VERSION + ")" } } }