From ee1928c836729dfa58e2823221db6c0c92f55bf3 Mon Sep 17 00:00:00 2001 From: Alex Plate <aleksei.plate@jetbrains.com> Date: Fri, 28 Feb 2025 19:39:48 +0200 Subject: [PATCH] Upgrade java version to 21 --- .github/workflows/checkNewPlugins.yml | 4 ++-- .github/workflows/closeYoutrackOnCommit.yml | 4 ++-- .github/workflows/integrationsTest.yml | 4 ++-- .github/workflows/kover.yml | 4 ++-- .github/workflows/mergePr.yml | 4 ++-- .github/workflows/runUiOctopusTests.yml | 2 +- .github/workflows/runUiPyTests.yml | 2 +- .github/workflows/runUiTests.yml | 2 +- .github/workflows/updateAuthors.yml | 4 ++-- .github/workflows/updateChangelog.yml | 4 ++-- .github/workflows/updateFormatting.yml | 4 ++-- .gitignore | 1 + .idea/gradle.xml | 26 +++++++++++++++++++++ .idea/misc.xml | 2 +- build.gradle.kts | 13 +++++++++++ gradle.properties | 2 +- 16 files changed, 61 insertions(+), 21 deletions(-) create mode 100644 .idea/gradle.xml diff --git a/.github/workflows/checkNewPlugins.yml b/.github/workflows/checkNewPlugins.yml index 5111573ad..d095c327e 100644 --- a/.github/workflows/checkNewPlugins.yml +++ b/.github/workflows/checkNewPlugins.yml @@ -20,10 +20,10 @@ jobs: - name: Fetch origin repo uses: actions/checkout@v3 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: - java-version: '17' + java-version: '21' distribution: 'adopt' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/closeYoutrackOnCommit.yml b/.github/workflows/closeYoutrackOnCommit.yml index fc42fded4..ceba77229 100644 --- a/.github/workflows/closeYoutrackOnCommit.yml +++ b/.github/workflows/closeYoutrackOnCommit.yml @@ -23,10 +23,10 @@ jobs: fetch-depth: 300 - name: Get tags run: git fetch --tags origin - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: - java-version: '17' + java-version: '21' distribution: 'adopt' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/integrationsTest.yml b/.github/workflows/integrationsTest.yml index 9c704faed..8c7370162 100644 --- a/.github/workflows/integrationsTest.yml +++ b/.github/workflows/integrationsTest.yml @@ -18,10 +18,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 300 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: - java-version: '17' + java-version: '21' distribution: 'adopt' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/kover.yml b/.github/workflows/kover.yml index 664d603a9..751898c7f 100644 --- a/.github/workflows/kover.yml +++ b/.github/workflows/kover.yml @@ -18,10 +18,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 300 - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: - java-version: '17' + java-version: '21' distribution: 'adopt' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/mergePr.yml b/.github/workflows/mergePr.yml index a38ba2b63..b09d6b2e4 100644 --- a/.github/workflows/mergePr.yml +++ b/.github/workflows/mergePr.yml @@ -20,10 +20,10 @@ jobs: fetch-depth: 50 # See end of file updateChangeslog.yml for explanation of this secret ssh-key: ${{ secrets.PUSH_TO_PROTECTED_BRANCH_SECRET }} - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: - java-version: '17' + java-version: '21' distribution: 'adopt' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/runUiOctopusTests.yml b/.github/workflows/runUiOctopusTests.yml index 6ca9b03b1..dba6b15ac 100644 --- a/.github/workflows/runUiOctopusTests.yml +++ b/.github/workflows/runUiOctopusTests.yml @@ -13,7 +13,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: zulu - java-version: 17 + java-version: 21 - name: Setup FFmpeg run: brew install ffmpeg # - name: Setup Gradle diff --git a/.github/workflows/runUiPyTests.yml b/.github/workflows/runUiPyTests.yml index 3e9a824f3..d6a885490 100644 --- a/.github/workflows/runUiPyTests.yml +++ b/.github/workflows/runUiPyTests.yml @@ -13,7 +13,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: zulu - java-version: 17 + java-version: 21 - uses: actions/setup-python@v5 with: python-version: '3.10' diff --git a/.github/workflows/runUiTests.yml b/.github/workflows/runUiTests.yml index 2d602f6ff..e3dc4e7a3 100644 --- a/.github/workflows/runUiTests.yml +++ b/.github/workflows/runUiTests.yml @@ -13,7 +13,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: zulu - java-version: 17 + java-version: 21 - name: Setup FFmpeg run: brew install ffmpeg # - name: Setup Gradle diff --git a/.github/workflows/updateAuthors.yml b/.github/workflows/updateAuthors.yml index 4d8ff1047..518bd0a41 100644 --- a/.github/workflows/updateAuthors.yml +++ b/.github/workflows/updateAuthors.yml @@ -25,10 +25,10 @@ jobs: ssh-key: ${{ secrets.PUSH_TO_PROTECTED_BRANCH_SECRET }} - name: Get tags run: git fetch --tags origin - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: - java-version: '17' + java-version: '21' distribution: 'adopt' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 67365dca6..e00743e94 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -22,10 +22,10 @@ jobs: ssh-key: ${{ secrets.PUSH_TO_PROTECTED_BRANCH_SECRET }} - name: Get tags run: git fetch --tags origin - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: - java-version: '17' + java-version: '21' distribution: 'adopt' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/updateFormatting.yml b/.github/workflows/updateFormatting.yml index dbeb6f52b..d18fe7a6d 100644 --- a/.github/workflows/updateFormatting.yml +++ b/.github/workflows/updateFormatting.yml @@ -20,10 +20,10 @@ jobs: fetch-depth: 50 # See end of file updateChangeslog.yml for explanation of this secret ssh-key: ${{ secrets.PUSH_TO_PROTECTED_BRANCH_SECRET }} - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v2 with: - java-version: '17' + java-version: '21' distribution: 'adopt' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.gitignore b/.gitignore index 9ade12664..e5dec1cf9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ !/.idea/vcs.xml !/.idea/misc.xml !/.idea/.name +!/.idea/gradle.xml **/build/ **/out/ diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 000000000..d775e4b3b --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="GradleMigrationSettings" migrationVersion="1" /> + <component name="GradleSettings"> + <option name="linkedExternalProjectsSettings"> + <GradleProjectSettings> + <option name="externalProjectPath" value="$PROJECT_DIR$" /> + <option name="modules"> + <set> + <option value="$PROJECT_DIR$" /> + <option value="$PROJECT_DIR$/annotation-processors" /> + <option value="$PROJECT_DIR$/scripts" /> + <option value="$PROJECT_DIR$/tests" /> + <option value="$PROJECT_DIR$/tests/java-tests" /> + <option value="$PROJECT_DIR$/tests/long-running-tests" /> + <option value="$PROJECT_DIR$/tests/property-tests" /> + <option value="$PROJECT_DIR$/tests/ui-fixtures" /> + <option value="$PROJECT_DIR$/tests/ui-ij-tests" /> + <option value="$PROJECT_DIR$/tests/ui-py-tests" /> + <option value="$PROJECT_DIR$/vim-engine" /> + </set> + </option> + </GradleProjectSettings> + </option> + </component> +</project> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index ab99fc687..85481e68a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -18,5 +18,5 @@ </list> </option> </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK" /> + <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="corretto-21" project-jdk-type="JavaSDK" /> </project> \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 7b48591e1..ff690fcfe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -170,6 +170,19 @@ configurations { } } +val currentJavaVersion = javaToolchains.launcherFor {}.get().metadata.languageVersion.toString() +if (currentJavaVersion != javaVersion) { + // NOTE: I made this exception because the default Gradle error message is horrible, noone can understand it. + throw RuntimeException( + """ + Incorrect java version used for building. + IdeaVim uses java version $javaVersion, but the current java version is $currentJavaVersion. + If IntelliJ IDEA is used, change the setting in "Settings | Build, Execution, Deployment | Build Tools | Gradle" + If build is run from the terminal, set JAVA_HOME environment variable to the correct java version. + """.trimIndent() + ) +} + tasks { test { useJUnitPlatform() diff --git a/gradle.properties b/gradle.properties index 0cb089d6e..94e5f1f7c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ ideaVersion=2024.3.3 ideaType=IC instrumentPluginCode=true version=SNAPSHOT -javaVersion=17 +javaVersion=21 remoteRobotVersion=0.11.23 antlrVersion=4.10.1