Skip to content

Commit

Permalink
build(deps): use JDK11 everywhere, validate it in build
Browse files Browse the repository at this point in the history
API31 can't be attempted until JDK11 is in place
  • Loading branch information
mikehardy committed Apr 21, 2022
1 parent 54b16a2 commit f175214
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@ 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

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

# COULD_BE_BETTER: Consider turning this into a GitHub action - help the wider community
# COULD_BE_BETTER: Consider turning this into a GitHub action - help the wider community
# NDK install (unzipping) is really noisy - silence the log spam with grep, while keeping errors
- name: Install NDK (silent)
run: .github/scripts/install_ndk.sh 22.0.7026061
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/macos_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

Expand All @@ -46,7 +52,6 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install & Test Protobuf Compiler
shell: bash -l {0}
run: |
pip3 install protobuf
python3 .github/scripts/protoc_gen_deps.py
Expand All @@ -64,11 +69,9 @@ jobs:
${{ runner.os }}-rust-v1
- name: Build
shell: bash -l {0}
run: ./gradlew clean assembleDebug -DtestBuildType=debug -Dorg.gradle.daemon=false -Dorg.gradle.console=plain

- name: Build Instrumented Test APKs
shell: bash -l {0}
run: ./gradlew rsdroid-instrumented:assembleDebug rsdroid-instrumented:assembleAndroidTest -DtestBuildType=debug -Dorg.gradle.daemon=false -Dorg.gradle.console=plain

- name: Upload APKs as Artifact
Expand Down Expand Up @@ -102,6 +105,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

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/publish_library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ 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

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

- name: Install NDK
run: .github/scripts/install_ndk.sh 22.0.7026061

- name: Install linker
run: .github/scripts/linux_install_x86_64-unknown-linux-gnu-gcc.sh

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/publish_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/robolectric_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

Expand Down Expand Up @@ -142,6 +148,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

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

Expand All @@ -167,7 +179,6 @@ jobs:

- name: Install & Test Protobuf Compiler
if: matrix.os != 'windows-latest'
shell: bash -l {0}
run: |
pip3 install protobuf
python3 .github/scripts/protoc_gen_deps.py
Expand All @@ -181,7 +192,6 @@ jobs:
- name: Run Tests
if: matrix.os != 'windows-latest'
shell: bash -l {0}
run: ./gradlew rsdroid:test -x jar -x cargoBuildArm -x cargoBuildX86 -x cargoBuildArm64 -x cargoBuildX86_64

- name: Run Tests (win)
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/update_gradle_wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ jobs:
with:
submodules: 'recursive'

- name: Configure JDK 1.11
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "11" # minimum for Android API31

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

# COULD_BE_BETTER: Consider turning this into a GitHub action - help the wider community
# NDK install (unzipping) is really noisy - silence the log spam with grep, while keeping errors
- name: Install NDK (silent)
run: .github/scripts/install_ndk.sh 22.0.7026061

- name: Update Gradle Wrapper
uses: gradle-update/update-gradle-wrapper-action@v1
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/windows_pure_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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

- name: Install Android Command Line Tools
uses: mikehardy/setup-android@main

Expand Down
18 changes: 18 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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)
}
}

0 comments on commit f175214

Please sign in to comment.