Skip to content

Commit 55a7149

Browse files
committed
Fix and refine build-native.sh
1 parent 543929d commit 55a7149

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

build-native.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ else
2323
exit 1
2424
fi
2525

26+
libpath="target/$profile/$libname.$libsuffix"
27+
2628
checksum() {
2729
# Determine whether to use md5sum or md5
2830
if command -v md5sum >/dev/null 2>&1; then
@@ -36,20 +38,22 @@ checksum() {
3638

3739
echo "$features_arg" | $hash_cmd | awk '{print $1}'
3840

39-
find Cargo.toml Cargo.lock native-engine target/$profile/$libname."$libsuffix" | \
41+
find Cargo.toml Cargo.lock native-engine "$libpath" | \
4042
xargs $hash_cmd 2>&1 | \
4143
sort -k1 | \
4244
$hash_cmd
4345
}
4446

4547
checksum_cache_file="./.build-checksum_$profile-"$libsuffix".cache"
46-
old_checksum="$(cat "$checksum_cache_file" 2>&1 || true)"
47-
new_checksum="$(checksum)"
48+
if [ -f "$libpath" ]; then
49+
old_checksum="$(cat "$checksum_cache_file" 2>&1 || true)"
50+
new_checksum="$(checksum)"
4851

49-
echo -e "old build-checksum: \n$old_checksum\n========"
50-
echo -e "new build-checksum: \n$new_checksum\n========"
52+
echo -e "old build-checksum: \n$old_checksum\n========"
53+
echo -e "new build-checksum: \n$new_checksum\n========"
54+
fi
5155

52-
if [ "$new_checksum" != "$old_checksum" ]; then
56+
if [ ! -f "$libpath" ] || [ "$new_checksum" != "$old_checksum" ]; then
5357
export RUSTFLAGS=${RUSTFLAGS:-"-C target-cpu=native"}
5458
echo "Running cargo fix..."
5559
cargo fix --all --allow-dirty --allow-staged --allow-no-vcs
@@ -65,7 +69,7 @@ fi
6569

6670
mkdir -p native-engine/_build/$profile
6771
rm -rf native-engine/_build/$profile/*
68-
cp target/$profile/$libname."$libsuffix" native-engine/_build/$profile
72+
cp "$libpath" native-engine/_build/$profile
6973

7074
new_checksum="$(checksum)"
7175
echo "build-checksum updated: $new_checksum"

native-engine/blaze/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ resolver = "1"
88
crate-type = ["cdylib"]
99

1010
[features]
11-
default = ["tokio/rt-multi-thread", "jemalloc"]
11+
default = ["tokio/rt-multi-thread", "jemalloc", "poem", "serde"]
1212
jemalloc = ["dep:tikv-jemallocator"]
1313
jemalloc-pprof = ["dep:tikv-jemalloc-ctl", "dep:tikv-jemalloc-sys", "dep:jemalloc_pprof", "dep:pprof", "http-service"]
1414
http-service = []

0 commit comments

Comments
 (0)