Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the used JDK in the project to v21 #3582

Merged
merged 10 commits into from
Oct 3, 2024
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
# Ensure we are building the branch and not the branch after being merged on develop
# https://github.com/actions/checkout/issues/881
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_enterprise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
- name: Clone submodules
run: git submodule update --init --recursive
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/generate_github_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
steps:
- name: ⏬ Checkout with LFS
uses: nschloe/[email protected]
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-wrapper-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
name: Use JDK 17
name: Use JDK 21
if: (github.event_name == 'pull_request' && github.event.pull_request.fork == null) || github.event_name == 'workflow_dispatch'
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Update Gradle Wrapper
uses: gradle-update/update-gradle-wrapper-action@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maestro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
# https://github.com/actions/checkout/issues/881
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
- uses: actions/setup-java@v4
name: Use JDK 17
name: Use JDK 21
if: (github.event_name == 'pull_request' && github.event.pull_request.fork == null) || github.event_name == 'workflow_dispatch'
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
if: ${{ github.repository == 'element-hq/element-x-android' }}
steps:
- uses: actions/checkout@v4
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Build and upload Nightly application
run: |
./gradlew assembleGplayNightly appDistributionUploadGplayNightly $CI_GRADLE_ARG_PROPERTIES
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nightlyReports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
- name: ⏬ Checkout with LFS
uses: nschloe/[email protected]

- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'

- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
Expand Down Expand Up @@ -61,11 +61,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly_enterprise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
- name: Clone submodules
run: git submodule update --init --recursive
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Build and upload Nightly application
run: |
./gradlew assembleGplayNightly appDistributionUploadGplayNightly $CI_GRADLE_ARG_PROPERTIES
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down Expand Up @@ -84,11 +84,11 @@ jobs:
- name: Clone submodules
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
run: git submodule update --init --recursive
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down Expand Up @@ -124,11 +124,11 @@ jobs:
- name: Clone submodules
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
run: git submodule update --init --recursive
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down Expand Up @@ -168,11 +168,11 @@ jobs:
- name: Clone submodules
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
run: git submodule update --init --recursive
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down Expand Up @@ -208,11 +208,11 @@ jobs:
- name: Clone submodules
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
run: git submodule update --init --recursive
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down Expand Up @@ -248,11 +248,11 @@ jobs:
- name: Clone submodules
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
run: git submodule update --init --recursive
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/recordScreenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ jobs:
uses: nschloe/[email protected]
with:
persist-credentials: false
- name: ☕️ Use JDK 17
- name: ☕️ Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
# Add gradle cache, this should speed up the process
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
- name: Create app bundle
Expand Down Expand Up @@ -55,11 +55,11 @@ jobs:
ssh-private-key: ${{ secrets.ELEMENT_ENTERPRISE_DEPLOY_KEY }}
- name: Clone submodules
run: git submodule update --init --recursive
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
- name: Create Enterprise app bundle
Expand All @@ -83,11 +83,11 @@ jobs:
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
- name: Create APKs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
# Ensure we are building the branch and not the branch after being merged on develop
# https://github.com/actions/checkout/issues/881
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sync-localazy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
steps:
- uses: actions/checkout@v4
- name: Use JDK 17
- name: Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ jobs:
- name: Clone submodules
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'element-hq/element-x-android' }}
run: git submodule update --init --recursive
- name: ☕️ Use JDK 17
- name: ☕️ Use JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
java-version: '21'
- name: Configure gradle
uses: gradle/actions/setup-gradle@v4
with:
Expand Down
3 changes: 0 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ android {
}
}
}
kotlinOptions {
jvmTarget = "17"
}

buildFeatures {
buildConfig = true
Expand Down
8 changes: 6 additions & 2 deletions libraries/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = Versions.javaCompileVersion
targetCompatibility = Versions.javaCompileVersion
}

kotlin {
jvmToolchain(Versions.javaLanguageVersion.asInt())
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

package io.element.android.libraries.core.uri

import java.net.URL
import java.net.URI

fun String.isValidUrl(): Boolean {
return try {
URL(this)
URI(this).toURL()
true
} catch (t: Throwable) {
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@ class DefaultLastMessageTimestampFormatterTest {
val now = "1980-04-06T18:35:24.00Z"
val dat = "1980-04-06T18:35:24.00Z"
val formatter = createFormatter(now)
assertThat(formatter.format(Instant.parse(dat).toEpochMilliseconds())).isEqualTo("6:35 PM")
assertThat(formatter.format(Instant.parse(dat).toEpochMilliseconds())).isEqualTo("6:35PM")
}

@Test
fun `test one second before`() {
val now = "1980-04-06T18:35:24.00Z"
val dat = "1980-04-06T18:35:23.00Z"
val formatter = createFormatter(now)
assertThat(formatter.format(Instant.parse(dat).toEpochMilliseconds())).isEqualTo("6:35 PM")
assertThat(formatter.format(Instant.parse(dat).toEpochMilliseconds())).isEqualTo("6:35PM")
}

@Test
fun `test one minute before`() {
val now = "1980-04-06T18:35:24.00Z"
val dat = "1980-04-06T18:34:24.00Z"
val formatter = createFormatter(now)
assertThat(formatter.format(Instant.parse(dat).toEpochMilliseconds())).isEqualTo("6:34 PM")
assertThat(formatter.format(Instant.parse(dat).toEpochMilliseconds())).isEqualTo("6:34PM")
}

@Test
fun `test one hour before`() {
val now = "1980-04-06T18:35:24.00Z"
val dat = "1980-04-06T17:35:24.00Z"
val formatter = createFormatter(now)
assertThat(formatter.format(Instant.parse(dat).toEpochMilliseconds())).isEqualTo("5:35 PM")
assertThat(formatter.format(Instant.parse(dat).toEpochMilliseconds())).isEqualTo("5:35PM")
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions plugins/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ object Versions {
const val targetSdk = 34
// 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
val javaCompileVersion = JavaVersion.VERSION_17
val javaLanguageVersion: JavaLanguageVersion = JavaLanguageVersion.of(11)
val javaCompileVersion = JavaVersion.VERSION_21
val javaLanguageVersion: JavaLanguageVersion = JavaLanguageVersion.of(21)
}
Loading
Loading