Revert be04f698fe: manually injecting libreqwest.so now

This commit is contained in:
DarkCat09 2023-07-04 13:23:53 +04:00
parent 87a53efb9d
commit 85dc5aa2ea
2 changed files with 40 additions and 3 deletions

View file

@ -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" ./

View file

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