diff --git a/.github/workflows/linux_build.yml b/.github/workflows/linux_build.yml index 1555d24cf..61c774fe6 100644 --- a/.github/workflows/linux_build.yml +++ b/.github/workflows/linux_build.yml @@ -15,6 +15,12 @@ jobs: - name: Fetch submodules run: git submodule update --init --recursive --remote --force + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos_build.yml index c421ce206..bef471f6a 100644 --- a/.github/workflows/macos_build.yml +++ b/.github/workflows/macos_build.yml @@ -16,6 +16,12 @@ jobs: - name: Fetch submodules run: git submodule update --init --recursive --remote --force + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 @@ -96,6 +102,12 @@ jobs: name: rsdroid-instrumented path: rsdroid-instrumented/build/outputs/apk + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 diff --git a/.github/workflows/publish_library.yml b/.github/workflows/publish_library.yml index 4c3e595b1..5e0a4c48d 100644 --- a/.github/workflows/publish_library.yml +++ b/.github/workflows/publish_library.yml @@ -10,6 +10,12 @@ jobs: - name: Fetch submodules run: git submodule update --init --recursive --remote --force + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 diff --git a/.github/workflows/publish_testing.yml b/.github/workflows/publish_testing.yml index 6cb1d95b9..2949fc61d 100644 --- a/.github/workflows/publish_testing.yml +++ b/.github/workflows/publish_testing.yml @@ -11,6 +11,12 @@ jobs: - name: Fetch submodules run: git submodule update --init --recursive --remote --force + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 diff --git a/.github/workflows/robolectric_build.yml b/.github/workflows/robolectric_build.yml index 2562eb219..0dcecd80b 100644 --- a/.github/workflows/robolectric_build.yml +++ b/.github/workflows/robolectric_build.yml @@ -25,6 +25,12 @@ jobs: - name: Fetch submodules run: git submodule update --init --recursive --remote --force + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 @@ -136,6 +142,12 @@ jobs: exit 1 fi + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 diff --git a/.github/workflows/update_gradle_wrapper.yml b/.github/workflows/update_gradle_wrapper.yml index 4e48205db..9db852435 100644 --- a/.github/workflows/update_gradle_wrapper.yml +++ b/.github/workflows/update_gradle_wrapper.yml @@ -14,6 +14,12 @@ jobs: with: submodules: 'recursive' + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index 31e6deb1c..457299423 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -13,6 +13,12 @@ jobs: - uses: actions/checkout@v2 + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 diff --git a/.github/workflows/windows_pure_build.yml b/.github/workflows/windows_pure_build.yml index 30ec62481..9d45708ee 100644 --- a/.github/workflows/windows_pure_build.yml +++ b/.github/workflows/windows_pure_build.yml @@ -13,6 +13,12 @@ jobs: - name: Fetch submodules run: git submodule update --init --recursive --remote --force + - name: Configure JDK 1.11 + uses: actions/setup-java@v3 + with: + distribution: "adopt" + java-version: "11" # minimum for Android API31 + - uses: nttld/setup-ndk@v1 with: ndk-version: r22 diff --git a/build.gradle b/build.gradle index 8c82285ee..6512826f2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import org.gradle.internal.jvm.Jvm + // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { @@ -39,4 +41,20 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir +} + + +ext { + jvmVersion = Jvm.current().javaVersion.majorVersion + if (jvmVersion != "11" && jvmVersion != "14" && jvmVersion != "16") { + println "\n\n\n" + println "**************************************************************************************************************" + println "\n\n\n" + println "ERROR: Anki-Android-Backend builds with JVM version 11, 14, or 16." + println " Incompatible major version detected: '" + jvmVersion + "'" + println "\n\n\n" + println "**************************************************************************************************************" + println "\n\n\n" + System.exit(1) + } } \ No newline at end of file