This repository has been archived on 2025-10-15. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
minify-html/java/build.sh

43 lines
820 B
Bash
Raw Normal View History

2020-01-18 17:55:13 +11:00
#!/usr/bin/env bash
set -e
2020-07-12 01:29:34 +10:00
# Build JAR with native module for current platform.
2020-01-18 17:55:13 +11:00
pushd "$(dirname "$0")"
if [ "$1" = "release" ]; then
rust_build_arg="--release"
rust_build_dir="release"
else
rust_build_arg=""
rust_build_dir="debug"
fi
if [[ "$OSTYPE" == "linux-gnu" ]]; then
os_name="linux"
ext="so"
elif [[ "$OSTYPE" == "darwin"* ]]; then
os_name="macos"
ext="dylib"
elif [[ "$OSTYPE" == "cygwin" ]]; then
os_name="windows"
ext="dll"
elif [[ "$OSTYPE" == "msys" ]]; then
os_name="windows"
ext="dll"
elif [[ "$OSTYPE" == "win32" ]]; then
os_name="windows"
ext="dll"
else
echo "Unknown OS"
exit 1
fi
cargo build $rust_build_arg
mkdir -p src/main/resources/
2020-07-12 01:29:34 +10:00
cp target/rust/$rust_build_dir/libminify_html_java.$ext src/main/resources/$os_name-x86_64.nativelib
2020-01-18 17:55:13 +11:00
mvn clean package
popd