Fix: Java 21 for Piped, auto set JDK path

This commit is contained in:
DarkCat09 2023-11-24 16:56:04 +04:00
parent abcd780bd1
commit fa28aada0b
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3
2 changed files with 13 additions and 1 deletions

View file

@ -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`

View file

@ -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
# ---