From fa28aada0bc1064db8f2729e9c7ee98f62e916c3 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 24 Nov 2023 16:56:04 +0400 Subject: [PATCH] Fix: Java 21 for Piped, auto set JDK path --- README.md | 4 +++- build.sh | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8eecd1b..c54fb74 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ Patches may outdate, so open an issue if you get an error while script applies them. ## How to build -1. Install dependencies: `doas apk add git openjdk17 7zip` +1. Install dependencies: `doas apk add git openjdk17 openjdk21 7zip` +(Note that both OpenJDK 17 and 21 are installed, +for building reqwest4j and Piped respectively) 2. Install Rust: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` (Note that you don't need doas or sudo here) 3. Enter to RustUp environment: `source ~/.cargo/env` diff --git a/build.sh b/build.sh index addd112..12d2733 100755 --- a/build.sh +++ b/build.sh @@ -68,8 +68,13 @@ cd_and_exec reqwest4j/reqwest-jni \ cargo build --release --target x86_64-unknown-linux-musl title 'Building reqwest4j without Rust library...' +OLD_PATH="$PATH" +export JAVA_HOME="/usr/lib/jvm/java-17-openjdk" +export PATH="$JAVA_HOME/bin:$PATH" cd_and_exec reqwest4j ./gradlew shadowJar cd_and_exec reqwest4j ./gradlew --stop +export PATH="$OLD_PATH" +unset JAVA_HOME # --- @@ -120,8 +125,13 @@ title 'Creating VERSION file...' cd_and_exec backend set_piped_version title 'Building Piped...' +OLD_PATH="$PATH" +export JAVA_HOME="/usr/lib/jvm/java-21-openjdk" +export PATH="$JAVA_HOME/bin:$PATH" cd_and_exec backend ./gradlew shadowJar cd_and_exec backend ./gradlew --stop +export PATH="$OLD_PATH" +unset JAVA_HOME # ---