No more need in manually adding native library, Gradle does it correctly
This commit is contained in:
parent
4829cdfc6a
commit
be04f698fe
1 changed files with 2 additions and 24 deletions
26
build.sh
26
build.sh
|
@ -54,43 +54,21 @@ cd_and_exec reqwest4j git apply ../reqwest4j.patch
|
|||
# ---
|
||||
export RUSTFLAGS="-C target-feature=-crt-static"
|
||||
|
||||
title 'Building reqwest-jni...'
|
||||
cd_and_exec reqwest4j/reqwest-jni cargo build --release
|
||||
|
||||
title 'Building reqwest4j...'
|
||||
cd_and_exec reqwest4j ./gradlew shadowJar
|
||||
cd_and_exec reqwest4j ./gradlew --stop
|
||||
|
||||
|
||||
# ---
|
||||
title 'Adding built reqwest-jni into reqwest4j...'
|
||||
title 'Copying reqwest4j JAR...'
|
||||
|
||||
# Copy JAR into workdir
|
||||
REQ4J_NAME="reqwest4j.jar"
|
||||
REQ4J="$WORKDIR/$REQ4J_NAME"
|
||||
|
||||
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_jni.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...'
|
||||
|
|
Loading…
Reference in a new issue