Merge pull request #4960 from element-hq/feature/bma/minApiLevel

Update min api level to 33 for Element enterprise
This commit is contained in:
Benoit Marty
2025-07-01 09:07:16 +02:00
committed by GitHub
14 changed files with 93 additions and 67 deletions

View File

@@ -270,7 +270,6 @@ jobs:
- name: Run shellcheck
uses: ludeeus/action-shellcheck@2.0.0
with:
scandir: ./tools
severity: warning
upload_reports:

View File

@@ -12,8 +12,8 @@ mkdir -p /data/local/tmp/recordings;
FILENAME=/data/local/tmp/recordings/testRecording$COUNT.mp4
while true
do
((COUNT++))
COUNT=$((COUNT+1))
FILENAME=/data/local/tmp/recordings/testRecording$COUNT.mp4
echo "\nRecording video file #$COUNT"
printf "\nRecording video file #%d\n" $COUNT
screenrecord --bugreport --bit-rate=16m --size 720x1280 $FILENAME
done

View File

@@ -24,6 +24,7 @@ Learn more about why we are building Element X in our blog post: [https://elemen
* [Translations](#translations)
* [Rust SDK](#rust-sdk)
* [Status](#status)
* [Minimum SDK version](#minimum-sdk-version)
* [Contributing](#contributing)
* [Build instructions](#build-instructions)
* [Support](#support)
@@ -73,6 +74,12 @@ We're doing this as a way to share code between platforms and while we've seen p
This project is in an early rollout and migration phase.
## Minimum SDK version
Element X Android requires a minimum SDK version of 24 (Android 7.0, Nougat). We aim to support devices running Android 7.0 and above, which covers a wide range of devices still in use today.
Element Android Enterprise requires a minimum SDK version of 33 (Android 13, Tiramisu). For Element Enterprise, we support only devices that still receive security updates, which means devices running Android 13 and above. Android does not have a documented support policy, but some information can be found at [https://endoflife.date/android](https://endoflife.date/android).
## Contributing
Want to get actively involved in the project? You're more than welcome! A good way to start is to check the issues that are labelled with the [good first issue](https://github.com/element-hq/element-x-android/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label. Let us know by commenting the issue that you're starting working on it.

View File

@@ -35,12 +35,14 @@ import org.junit.Rule
import org.junit.Test
import org.junit.rules.TestRule
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
@RunWith(AndroidJUnit4::class)
class RoomListViewTest {
@get:Rule
val rule = createAndroidComposeRule<ComponentActivity>()
@Config(qualifiers = "h1024dp")
@Test
fun `displaying the view automatically sends a couple of UpdateVisibleRangeEvents`() {
val eventsRecorder = EventsRecorder<RoomListEvents>()
@@ -54,7 +56,7 @@ class RoomListViewTest {
eventsRecorder.assertList(
listOf(
RoomListEvents.UpdateVisibleRange(IntRange.EMPTY),
RoomListEvents.UpdateVisibleRange(0..2),
RoomListEvents.UpdateVisibleRange(0..5),
)
)
}

View File

@@ -145,7 +145,7 @@ class AdvancedSettingsViewTest {
}
@Test
@Config(qualifiers = "h640dp")
@Config(qualifiers = "h1024dp")
fun `clicking on timeline media preview emits the expected event`() {
val eventsRecorder = EventsRecorder<AdvancedSettingsEvents>()
rule.setAdvancedSettingsView(

View File

@@ -93,7 +93,7 @@ class SecurityAndPrivacyViewTest {
}
@Test
@Config(qualifiers = "h640dp")
@Config(qualifiers = "h1024dp")
fun `click on room visibility item emits the expected event`() {
val recorder = EventsRecorder<SecurityAndPrivacyEvents>()
val state = aSecurityAndPrivacyState(

View File

@@ -7,6 +7,7 @@
package io.element.android.libraries.dateformatter.impl
import android.os.Build
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.dateformatter.api.DateFormatterMode
@@ -16,7 +17,7 @@ import org.junit.runner.RunWith
import org.robolectric.annotation.Config
@RunWith(AndroidJUnit4::class)
@Config(qualifiers = "fr")
@Config(qualifiers = "fr", sdk = [Build.VERSION_CODES.TIRAMISU])
class DefaultDateFormatterFrTest {
@Test
fun `test null`() {
@@ -34,7 +35,7 @@ class DefaultDateFormatterFrTest {
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("1 janvier 1970 à 00:00")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("Janvier 1970")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("1 janvier 1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("01.01.1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("01/01/1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("00:00")
}
@@ -46,7 +47,7 @@ class DefaultDateFormatterFrTest {
assertThat(formatter.format(ts, DateFormatterMode.Full, true)).isEqualTo("1 janvier 1970 à 00:00")
assertThat(formatter.format(ts, DateFormatterMode.Month, true)).isEqualTo("Janvier 1970")
assertThat(formatter.format(ts, DateFormatterMode.Day, true)).isEqualTo("1 janvier 1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("01.01.1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("01/01/1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly, true)).isEqualTo("00:00")
}
@@ -241,7 +242,7 @@ class DefaultDateFormatterFrTest {
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("6 avril 1979 à 18:35")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("Avril 1979")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("6 avril 1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("06.04.1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("06/04/1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("18:35")
}
@@ -254,7 +255,7 @@ class DefaultDateFormatterFrTest {
assertThat(formatter.format(ts, DateFormatterMode.Full, true)).isEqualTo("6 avril 1979 à 18:35")
assertThat(formatter.format(ts, DateFormatterMode.Month, true)).isEqualTo("Avril 1979")
assertThat(formatter.format(ts, DateFormatterMode.Day, true)).isEqualTo("6 avril 1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("06.04.1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("06/04/1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly, true)).isEqualTo("18:35")
}
}

View File

@@ -7,6 +7,7 @@
package io.element.android.libraries.dateformatter.impl
import android.os.Build
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.dateformatter.api.DateFormatterMode
@@ -16,7 +17,7 @@ import org.junit.runner.RunWith
import org.robolectric.annotation.Config
@RunWith(AndroidJUnit4::class)
@Config(qualifiers = "en")
@Config(qualifiers = "en", sdk = [Build.VERSION_CODES.TIRAMISU])
class DefaultDateFormatterTest {
@Test
fun `test null`() {
@@ -34,7 +35,7 @@ class DefaultDateFormatterTest {
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("January 1, 1970 at 12:00AM")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("January 1970")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("January 1, 1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("01.01.1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("01/01/1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("12:00AM")
}
@@ -46,7 +47,7 @@ class DefaultDateFormatterTest {
assertThat(formatter.format(ts, DateFormatterMode.Full, true)).isEqualTo("January 1, 1970 at 12:00AM")
assertThat(formatter.format(ts, DateFormatterMode.Month, true)).isEqualTo("January 1970")
assertThat(formatter.format(ts, DateFormatterMode.Day, true)).isEqualTo("January 1, 1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("01.01.1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("01/01/1970")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly, true)).isEqualTo("12:00AM")
}
@@ -58,7 +59,7 @@ class DefaultDateFormatterTest {
val formatter = createFormatter(now)
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("April 6, 1980 at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("April 1980")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Sunday 6 April")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Sunday, April 6")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("6:35PM")
}
@@ -84,7 +85,7 @@ class DefaultDateFormatterTest {
val formatter = createFormatter(now)
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("April 6, 1980 at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("April 1980")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Sunday 6 April")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Sunday, April 6")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("6:35PM")
}
@@ -110,7 +111,7 @@ class DefaultDateFormatterTest {
val formatter = createFormatter(now)
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("April 6, 1980 at 6:34PM")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("April 1980")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Sunday 6 April")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Sunday, April 6")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("6:34PM")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("6:34PM")
}
@@ -136,7 +137,7 @@ class DefaultDateFormatterTest {
val formatter = createFormatter(now)
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("April 6, 1980 at 5:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("April 1980")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Sunday 6 April")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Sunday, April 6")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("5:35PM")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("5:35PM")
}
@@ -162,8 +163,8 @@ class DefaultDateFormatterTest {
val formatter = createFormatter(now)
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("April 5, 1980 at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("April 1980")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Saturday 5 April")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("5 Apr")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Saturday, April 5")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("Apr 5")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("6:35PM")
}
@@ -188,8 +189,8 @@ class DefaultDateFormatterTest {
val formatter = createFormatter(now)
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("April 4, 1980 at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("April 1980")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Friday 4 April")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("4 Apr")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Friday, April 4")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("Apr 4")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("6:35PM")
}
@@ -202,7 +203,7 @@ class DefaultDateFormatterTest {
assertThat(formatter.format(ts, DateFormatterMode.Full, true)).isEqualTo("Friday at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month, true)).isEqualTo("This month")
assertThat(formatter.format(ts, DateFormatterMode.Day, true)).isEqualTo("Friday")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("4 Apr")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("Apr 4")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly, true)).isEqualTo("6:35PM")
}
@@ -214,8 +215,8 @@ class DefaultDateFormatterTest {
val formatter = createFormatter(now)
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("March 6, 1980 at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("March 1980")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Thursday 6 March")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("6 Mar")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("Thursday, March 6")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("Mar 6")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("6:35PM")
}
@@ -225,10 +226,10 @@ class DefaultDateFormatterTest {
val dat = "1980-03-06T18:35:24.00Z"
val ts = Instant.parse(dat).toEpochMilliseconds()
val formatter = createFormatter(now)
assertThat(formatter.format(ts, DateFormatterMode.Full, true)).isEqualTo("Thursday 6 March at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Full, true)).isEqualTo("Thursday, March 6 at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month, true)).isEqualTo("March 1980")
assertThat(formatter.format(ts, DateFormatterMode.Day, true)).isEqualTo("Thursday 6 March")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("6 Mar")
assertThat(formatter.format(ts, DateFormatterMode.Day, true)).isEqualTo("Thursday, March 6")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("Mar 6")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly, true)).isEqualTo("6:35PM")
}
@@ -241,7 +242,7 @@ class DefaultDateFormatterTest {
assertThat(formatter.format(ts, DateFormatterMode.Full)).isEqualTo("April 6, 1979 at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month)).isEqualTo("April 1979")
assertThat(formatter.format(ts, DateFormatterMode.Day)).isEqualTo("April 6, 1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("06.04.1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate)).isEqualTo("04/06/1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly)).isEqualTo("6:35PM")
}
@@ -254,7 +255,7 @@ class DefaultDateFormatterTest {
assertThat(formatter.format(ts, DateFormatterMode.Full, true)).isEqualTo("April 6, 1979 at 6:35PM")
assertThat(formatter.format(ts, DateFormatterMode.Month, true)).isEqualTo("April 1979")
assertThat(formatter.format(ts, DateFormatterMode.Day, true)).isEqualTo("April 6, 1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("06.04.1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOrDate, true)).isEqualTo("04/06/1979")
assertThat(formatter.format(ts, DateFormatterMode.TimeOnly, true)).isEqualTo("6:35PM")
}
}

View File

@@ -66,6 +66,7 @@ class AndroidMediaPreProcessorTest {
}
@Test
@Ignore("Ignore now that min API for enterprise is 33")
fun `test processing png`() = runTest {
val mediaUploadInfo = process(
asset = assetImagePng,
@@ -109,6 +110,7 @@ class AndroidMediaPreProcessorTest {
}
@Test
@Ignore("Ignore now that min API for enterprise is 33")
fun `test processing png no compression`() = runTest {
val mediaUploadInfo = process(
asset = assetImagePng,
@@ -130,6 +132,7 @@ class AndroidMediaPreProcessorTest {
}
@Test
@Ignore("Ignore now that min API for enterprise is 33")
fun `test processing png and delete`() = runTest {
val mediaUploadInfo = process(
asset = assetImagePng,
@@ -154,6 +157,7 @@ class AndroidMediaPreProcessorTest {
}
@Test
@Ignore("Ignore now that min API for enterprise is 33")
fun `test processing jpeg`() = runTest {
val mediaUploadInfo = process(
asset = assetImageJpeg,
@@ -197,6 +201,7 @@ class AndroidMediaPreProcessorTest {
}
@Test
@Ignore("Ignore now that min API for enterprise is 33")
fun `test processing jpeg no compression`() = runTest {
val mediaUploadInfo = process(
asset = assetImageJpeg,
@@ -218,6 +223,7 @@ class AndroidMediaPreProcessorTest {
}
@Test
@Ignore("Ignore now that min API for enterprise is 33")
fun `test processing jpeg and delete`() = runTest {
val mediaUploadInfo = process(
asset = assetImageJpeg,
@@ -242,6 +248,7 @@ class AndroidMediaPreProcessorTest {
}
@Test
@Ignore("Ignore now that min API for enterprise is 33")
fun `test processing gif`() = runTest {
val mediaUploadInfo = process(
asset = assetAnimatedGif,

View File

@@ -31,6 +31,7 @@ class MediaDetailsBottomSheetTest {
val rule = createAndroidComposeRule<ComponentActivity>()
@Test
@Config(qualifiers = "h1024dp")
fun `clicking on View in timeline invokes expected callback`() {
val state = aMediaDetailsBottomSheetState()
ensureCalledOnceWithParam(state.eventId) { callback ->
@@ -43,6 +44,7 @@ class MediaDetailsBottomSheetTest {
}
@Test
@Config(qualifiers = "h1024dp")
fun `clicking on Share invokes expected callback`() {
val state = aMediaDetailsBottomSheetState()
ensureCalledOnceWithParam(state.eventId) { callback ->
@@ -55,6 +57,7 @@ class MediaDetailsBottomSheetTest {
}
@Test
@Config(qualifiers = "h1024dp")
fun `clicking on Save invokes expected callback`() {
val state = aMediaDetailsBottomSheetState()
ensureCalledOnceWithParam(state.eventId) { callback ->

View File

@@ -32,6 +32,7 @@ import org.junit.Rule
import org.junit.Test
import org.junit.rules.TestRule
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
@RunWith(AndroidJUnit4::class)
class MediaViewerViewTest {
@@ -108,6 +109,7 @@ class MediaViewerViewTest {
}
@Test
@Config(qualifiers = "h1024dp")
fun `clicking on save emit expected Event`() {
val data = aMediaViewerPageData()
testBottomSheetAction(
@@ -118,6 +120,7 @@ class MediaViewerViewTest {
}
@Test
@Config(qualifiers = "h1024dp")
fun `clicking on share emit expected Event`() {
val data = aMediaViewerPageData()
testBottomSheetAction(

View File

@@ -23,7 +23,7 @@ import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
class NotificationChannelsTest {
@Test
@Config(sdk = [Build.VERSION_CODES.O])
@Config(sdk = [Build.VERSION_CODES.TIRAMISU])
fun `init - creates notification channels and migrates old ones`() {
val notificationManager = mockk<NotificationManagerCompat>(relaxed = true) {
every { notificationChannels } returns emptyList()

View File

@@ -42,7 +42,9 @@ object Versions {
const val TARGET_SDK = 35
// When updating the `minSdk`, make sure to update the value of `minSdkVersion` in the file `tools/release/release.sh`
val minSdk = if (isEnterpriseBuild) 26 else 24
private const val MIN_SDK_FOSS = 24
private const val MIN_SDK_ENTERPRISE = 33
val minSdk = if (isEnterpriseBuild) MIN_SDK_ENTERPRISE else MIN_SDK_FOSS
private const val JAVA_VERSION = 21
val javaVersion: JavaVersion = JavaVersion.toVersion(JAVA_VERSION)

View File

@@ -62,12 +62,13 @@ if [ ${envError} == 1 ]; then
exit 1
fi
minSdkVersion=24
# Read minSdkVersion from file plugins/src/main/kotlin/Versions.kt
minSdkVersion=$(grep "MIN_SDK_FOSS =" ./plugins/src/main/kotlin/Versions.kt |cut -d '=' -f 2 |xargs)
buildToolsVersion="35.0.0"
buildToolsPath="${androidHome}/build-tools/${buildToolsVersion}"
if [[ ! -d ${buildToolsPath} ]]; then
printf "Fatal: ${buildToolsPath} folder not found, ensure that you have installed the SDK version ${buildToolsVersion}.\n"
printf "Fatal: %s folder not found, ensure that you have installed the SDK version %s.\n" "${buildToolsPath}" "${buildToolsVersion}"
exit 1
fi
@@ -99,7 +100,7 @@ versionYearCandidate=$(date +%y)
currentVersionMonth=$(grep "val versionMonth" ${versionsFile} | cut -d " " -f6)
# Get current month on 2 digits
versionMonthCandidate=$(date +%m)
versionMonthCandidateNoLeadingZero=$(echo ${versionMonthCandidate} | sed 's/^0//')
versionMonthCandidateNoLeadingZero=${versionMonthCandidate/#0/}
currentVersionReleaseNumber=$(grep "val versionReleaseNumber" ${versionsFile} | cut -d " " -f6)
# if the current month is the same as the current version, we increment the release number, else we reset it to 0
if [[ ${currentVersionMonth} -eq ${versionMonthCandidateNoLeadingZero} ]]; then
@@ -109,17 +110,17 @@ else
fi
versionCandidate="${versionYearCandidate}.${versionMonthCandidate}.${versionReleaseNumberCandidate}"
read -p "Please enter the release version (example: ${versionCandidate}). Format must be 'YY.MM.x' or 'YY.MM.xy'. Just press enter if ${versionCandidate} is correct. " version
read -r -p "Please enter the release version (example: ${versionCandidate}). Format must be 'YY.MM.x' or 'YY.MM.xy'. Just press enter if ${versionCandidate} is correct. " version
version=${version:-${versionCandidate}}
# extract year, month and release number for future use
versionYear=$(echo "${version}" | cut -d "." -f1)
versionMonth=$(echo "${version}" | cut -d "." -f2)
versionMonthNoLeadingZero=$(echo ${versionMonth} | sed 's/^0//')
versionMonthNoLeadingZero=${versionMonth/#0/}
versionReleaseNumber=$(echo "${version}" | cut -d "." -f3)
printf "\n================================================================================\n"
printf "Starting the release ${version}\n"
printf "Starting the release %s\n" "${version}"
git flow release start "${version}"
# Note: in case the release is already started and the script is started again, checkout the release branch again.
@@ -146,7 +147,7 @@ fastlaneFile="20${versionYear}${versionMonth}${versionReleaseNumber2Digits}0.txt
fastlanePathFile="./fastlane/metadata/android/en-US/changelogs/${fastlaneFile}"
printf "Main changes in this version: TODO.\nFull changelog: https://github.com/element-hq/element-x-android/releases" > "${fastlanePathFile}"
read -p "I have created the file ${fastlanePathFile}, please edit it and press enter to continue. "
read -r -p "I have created the file ${fastlanePathFile}, please edit it and press enter to continue. "
git add "${fastlanePathFile}"
git commit -a -m "Adding fastlane file for version ${version}"
@@ -155,11 +156,11 @@ printf "OK, finishing the release...\n"
git flow release finish "${version}"
printf "\n================================================================================\n"
read -p "Done, push the branch 'main' and the new tag (yes/no) default to yes? " doPush
read -r -p "Done, push the branch 'main' and the new tag (yes/no) default to yes? " doPush
doPush=${doPush:-yes}
if [ "${doPush}" == "yes" ]; then
printf "Pushing branch 'main' and tag 'v${version}'...\n"
printf "Pushing branch 'main' and tag 'v%s'...\n" "${version}"
git push origin main
git push origin "v${version}"
else
@@ -172,7 +173,7 @@ git checkout develop
printf "\n================================================================================\n"
printf "The GitHub action https://github.com/element-hq/element-x-android/actions/workflows/release.yml?query=branch%%3Amain should have start a new run.\n"
read -p "Please enter the url of the run, no need to wait for it to complete (example: https://github.com/element-hq/element-x-android/actions/runs/9065756777): " runUrl
read -r -p "Please enter the url of the run, no need to wait for it to complete (example: https://github.com/element-hq/element-x-android/actions/runs/9065756777): " runUrl
targetPath="./tmp/Element/${version}"
@@ -189,7 +190,7 @@ while [[ $ret -ne 0 ]]; do
ret=$?
if [[ $ret -ne 0 ]]; then
read -p "Error while downloading the artifacts. You may want to fix the issue and retry. Retry (yes/no) default to yes? " doRetry
read -r -p "Error while downloading the artifacts. You may want to fix the issue and retry. Retry (yes/no) default to yes? " doRetry
doRetry=${doRetry:-yes}
if [ "${doRetry}" == "no" ]; then
exit 1
@@ -224,7 +225,7 @@ cp "${fdroidTargetPath}"/app-fdroid-arm64-v8a-release.apk \
--ks-pass pass:"${keyStorePassword}" \
--ks-key-alias elementx \
--key-pass pass:"${keyPassword}" \
--min-sdk-version ${minSdkVersion} \
--min-sdk-version "${minSdkVersion}" \
"${fdroidTargetPath}"/app-fdroid-arm64-v8a-release-signed.apk
cp "${fdroidTargetPath}"/app-fdroid-armeabi-v7a-release.apk \
@@ -236,7 +237,7 @@ cp "${fdroidTargetPath}"/app-fdroid-armeabi-v7a-release.apk \
--ks-pass pass:"${keyStorePassword}" \
--ks-key-alias elementx \
--key-pass pass:"${keyPassword}" \
--min-sdk-version ${minSdkVersion} \
--min-sdk-version "${minSdkVersion}" \
"${fdroidTargetPath}"/app-fdroid-armeabi-v7a-release-signed.apk
cp "${fdroidTargetPath}"/app-fdroid-x86-release.apk \
@@ -248,7 +249,7 @@ cp "${fdroidTargetPath}"/app-fdroid-x86-release.apk \
--ks-pass pass:"${keyStorePassword}" \
--ks-key-alias elementx \
--key-pass pass:"${keyPassword}" \
--min-sdk-version ${minSdkVersion} \
--min-sdk-version "${minSdkVersion}" \
"${fdroidTargetPath}"/app-fdroid-x86-release-signed.apk
cp "${fdroidTargetPath}"/app-fdroid-x86_64-release.apk \
@@ -260,7 +261,7 @@ cp "${fdroidTargetPath}"/app-fdroid-x86_64-release.apk \
--ks-pass pass:"${keyStorePassword}" \
--ks-key-alias elementx \
--key-pass pass:"${keyPassword}" \
--min-sdk-version ${minSdkVersion} \
--min-sdk-version "${minSdkVersion}" \
"${fdroidTargetPath}"/app-fdroid-x86_64-release-signed.apk
printf "\n================================================================================\n"
@@ -276,10 +277,10 @@ printf "File app-fdroid-x86_64-release-signed.apk:\n"
"${buildToolsPath}"/aapt dump badging "${fdroidTargetPath}"/app-fdroid-x86_64-release-signed.apk | grep package
printf "\n"
read -p "Does it look correct? Press enter when it's done. "
read -r -p "Does it look correct? Press enter when it's done. "
printf "\n================================================================================\n"
printf "The APKs in ${fdroidTargetPath} have been signed!\n"
printf "The APKs in %s have been signed!\n" "${fdroidTargetPath}"
printf "\n================================================================================\n"
printf "Unzipping the Gplay artifact...\n"
@@ -291,7 +292,7 @@ unsignedBundlePath="${gplayTargetPath}/app-gplay-release.aab"
signedBundlePath="${gplayTargetPath}/app-gplay-release-signed.aab"
printf "\n================================================================================\n"
printf "Signing file ${unsignedBundlePath} with build-tools version ${buildToolsVersion} for min SDK version ${minSdkVersion}...\n"
printf "Signing file %s with build-tools version %s for min SDK version %s...\n" "${unsignedBundlePath}" "${buildToolsVersion}" "${minSdkVersion}"
cp "${unsignedBundlePath}" "${signedBundlePath}"
@@ -301,7 +302,7 @@ cp "${unsignedBundlePath}" "${signedBundlePath}"
--ks-pass pass:"${keyStorePassword}" \
--ks-key-alias elementx \
--key-pass pass:"${keyPassword}" \
--min-sdk-version ${minSdkVersion} \
--min-sdk-version "${minSdkVersion}" \
"${signedBundlePath}"
printf "\n================================================================================\n"
@@ -313,13 +314,13 @@ printf "Version name: "
bundletool dump manifest --bundle="${signedBundlePath}" --xpath=/manifest/@android:versionName
printf "\n"
read -p "Does it look correct? Press enter to continue. "
read -r -p "Does it look correct? Press enter to continue. "
printf "\n================================================================================\n"
printf "The file ${signedBundlePath} has been signed and can be uploaded to the PlayStore!\n"
printf "The file %s has been signed and can be uploaded to the PlayStore!\n" "${signedBundlePath}"
printf "\n================================================================================\n"
read -p "Do you want to build the APKs from the app bundle? You need to do this step if you want to install the application to your device. (yes/no) default to no " doBuildApks
read -r -p "Do you want to build the APKs from the app bundle? You need to do this step if you want to install the application to your device. (yes/no) default to no " doBuildApks
doBuildApks=${doBuildApks:-no}
if [ "${doBuildApks}" == "yes" ]; then
@@ -328,12 +329,12 @@ if [ "${doBuildApks}" == "yes" ]; then
--ks=./app/signature/debug.keystore --ks-pass=pass:android --ks-key-alias=androiddebugkey --key-pass=pass:android \
--overwrite
read -p "Do you want to install the application to your device? Make sure there is one (and only one!) connected device first. (yes/no) default to yes " doDeploy
read -r -p "Do you want to install the application to your device? Make sure there is one (and only one!) connected device first. (yes/no) default to yes " doDeploy
doDeploy=${doDeploy:-yes}
if [ "${doDeploy}" == "yes" ]; then
printf "Installing apk for your device...\n"
bundletool install-apks --apks="${gplayTargetPath}"/elementx.apks
read -p "Please run the application on your phone to check that the upgrade went well. Press enter to continue. "
read -r -p "Please run the application on your phone to check that the upgrade went well. Press enter to continue. "
else
printf "APK will not be deployed!\n"
fi
@@ -345,14 +346,14 @@ printf "\n======================================================================
printf "Create the open testing release on GooglePlay.\n"
printf "On GooglePlay console, go the the open testing section and click on \"Create new release\" button, then:\n"
printf " - upload the file ${signedBundlePath}.\n"
printf " - upload the file %s.\n" "${signedBundlePath}"
printf " - copy the release note from the fastlane file.\n"
printf " - download the universal APK, to be able to provide it to the GitHub release: click on the right arrow next to the \"App bundle\", then click on the \"Download\" tab, and download the \"Signed, universal APK\".\n"
printf " - submit the release.\n"
read -p "Press enter to continue. "
read -r -p "Press enter to continue. "
printf "You can then go to \"Publishing overview\" and send the new release for a review by Google.\n"
read -p "Press enter to continue. "
read -r -p "Press enter to continue. "
printf "\n================================================================================\n"
githubCreateReleaseLink="https://github.com/element-hq/element-x-android/releases/new?tag=v${version}&title=Element%20X%20Android%20v${version}"
@@ -361,22 +362,22 @@ printf -- "Open this link: %s\n" "${githubCreateReleaseLink}"
printf "Then\n"
printf " - Click on the 'Generate releases notes' button.\n"
printf " - Optionally reorder items and fix typos.\n"
printf " - Add the file ${signedBundlePath} to the GitHub release.\n"
printf " - Add the file %s to the GitHub release.\n" "${signedBundlePath}"
printf " - Add the universal APK, downloaded from the GooglePlay console to the GitHub release.\n"
printf " - Add the 4 signed APKs for F-Droid, located at ${fdroidTargetPath} to the GitHub release.\n"
read -p ". Press enter to continue. "
printf " - Add the 4 signed APKs for F-Droid, located at %s to the GitHub release.\n" "${fdroidTargetPath}"
read -r -p ". Press enter to continue. "
printf "\n================================================================================\n"
printf "Update the project release notes:\n\n"
read -p "Copy the content of the release note generated by GitHub to the file CHANGES.md and press enter to commit the change. "
read -r -p "Copy the content of the release note generated by GitHub to the file CHANGES.md and press enter to commit the change. "
printf "\n================================================================================\n"
printf "Committing...\n"
git commit -a -m "Changelog for version ${version}"
printf "\n================================================================================\n"
read -p "Done, push the branch 'develop' (yes/no) default to yes? (A rebase may be necessary in case develop got new commits) " doPush
read -r -p "Done, push the branch 'develop' (yes/no) default to yes? (A rebase may be necessary in case develop got new commits) " doPush
doPush=${doPush:-yes}
if [ "${doPush}" == "yes" ]; then
@@ -389,12 +390,12 @@ fi
printf "\n================================================================================\n"
printf "Message for the Android internal room:\n\n"
message="@room Element X Android ${version} is ready to be tested. You can get it from https://github.com/element-hq/element-x-android/releases/tag/v${version}. You can install the universal APK. If you want to install the application from the app bundle, you can follow instructions [here](https://github.com/element-hq/element-x-android/blob/develop/docs/install_from_github_release.md). Please report any feedback. Thanks!"
printf "${message}\n\n"
printf "%s\n\n" "${message}"
if [[ -z "${elementBotToken}" ]]; then
read -p "ELEMENT_BOT_MATRIX_TOKEN is not defined in the environment. Cannot send the message for you. Please send it manually, and press enter to continue. "
read -r -p "ELEMENT_BOT_MATRIX_TOKEN is not defined in the environment. Cannot send the message for you. Please send it manually, and press enter to continue. "
else
read -p "Send this message to the room (yes/no) default to yes? " doSend
read -r -p "Send this message to the room (yes/no) default to yes? " doSend
doSend=${doSend:-yes}
if [ "${doSend}" == "yes" ]; then
printf "Sending message...\n"