From 85dc5aa2eaf9b3a7e718f8fbc1e2efcba1e9c561 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Tue, 4 Jul 2023 13:23:53 +0400 Subject: [PATCH] Revert `be04f698fe`: manually injecting libreqwest.so now --- build.sh | 30 +++++++++++++++++++++++++++--- reqwest4j.patch | 13 +++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 8711703..52ab5df 100755 --- a/build.sh +++ b/build.sh @@ -56,14 +56,18 @@ fi # --- export RUSTFLAGS="-C target-feature=-crt-static" -title 'Building reqwest4j...' +title 'Building reqwest-jni' +cd_and_exec reqwest4j/reqwest-jni cargo build --release + +title 'Building reqwest4j without Rust library...' cd_and_exec reqwest4j ./gradlew shadowJar cd_and_exec reqwest4j ./gradlew --stop # --- -title 'Copying reqwest4j JAR...' +title 'Adding built libreqwest_jni into reqwest4j JAR...' +# Copy JAR into workdir REQ4J_NAME="reqwest4j.jar" REQ4J="$WORKDIR/$REQ4J_NAME" @@ -71,9 +75,29 @@ cd_and_exec reqwest4j/build/libs \ find . -maxdepth 1 -name 'reqwest4j-*-all.jar' -exec \ cp {} "$REQ4J" \; +# Copy built reqwest-jni into workdir +REQJNI_NAME="libreqwest.so" +REQJNI="$WORKDIR/$REQJNI_NAME" +cd_and_exec reqwest4j/reqwest-jni/target/release \ + cp libreqwest_jni.so "$REQJNI" + +# Create JAR native libraries tree +NATIVES="META-INF/natives/linux/x86_64" +mkdir -p "$NATIVES" + +# Move reqwest-jni to native libraries directory +mv "$REQJNI" "$NATIVES/$REQJNI_NAME" + +# Add native libraries into JAR +7z u "$REQ4J" META-INF + +# Clean up +rm -rf META-INF +rm -f "$REQJNI" + # --- -title 'Adding reqwest4j JAR into Piped...' +title 'Adding reqwest4j JAR into Piped sources...' cd_and_exec backend mkdir -p libs cd_and_exec backend/libs mv "$REQ4J" ./ diff --git a/reqwest4j.patch b/reqwest4j.patch index f5267cd..ae12dbf 100644 --- a/reqwest4j.patch +++ b/reqwest4j.patch @@ -1,3 +1,16 @@ +diff --git a/build.gradle b/build.gradle +index 952abb5..582be0d 100644 +--- a/build.gradle ++++ b/build.gradle +@@ -11,7 +11,7 @@ repositories { + } + + dependencies { +- rust(project(":reqwest-jni")) ++ //rust(project(":reqwest-jni")) + } + + // javac -h diff --git a/reqwest-jni/build.gradle.kts b/reqwest-jni/build.gradle.kts index 189a81d..8c5895e 100644 --- a/reqwest-jni/build.gradle.kts