Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions build-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ else
exit 1
fi

libpath="target/$profile/$libname.$libsuffix"

checksum() {
# Determine whether to use md5sum or md5
if command -v md5sum >/dev/null 2>&1; then
Expand All @@ -36,20 +38,22 @@ checksum() {

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

find Cargo.toml Cargo.lock native-engine target/$profile/$libname."$libsuffix" | \
find Cargo.toml Cargo.lock native-engine "$libpath" | \
xargs $hash_cmd 2>&1 | \
sort -k1 | \
$hash_cmd
}

checksum_cache_file="./.build-checksum_$profile-"$libsuffix".cache"
old_checksum="$(cat "$checksum_cache_file" 2>&1 || true)"
new_checksum="$(checksum)"
if [ -f "$libpath" ]; then
old_checksum="$(cat "$checksum_cache_file" 2>&1 || true)"
new_checksum="$(checksum)"

echo -e "old build-checksum: \n$old_checksum\n========"
echo -e "new build-checksum: \n$new_checksum\n========"
echo -e "old build-checksum: \n$old_checksum\n========"
echo -e "new build-checksum: \n$new_checksum\n========"
fi

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

mkdir -p native-engine/_build/$profile
rm -rf native-engine/_build/$profile/*
cp target/$profile/$libname."$libsuffix" native-engine/_build/$profile
cp "$libpath" native-engine/_build/$profile

new_checksum="$(checksum)"
echo "build-checksum updated: $new_checksum"
Expand Down
2 changes: 1 addition & 1 deletion native-engine/blaze/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib"]
[features]
default = ["tokio/rt-multi-thread", "jemalloc"]
jemalloc = ["dep:tikv-jemallocator"]
jemalloc-pprof = ["dep:tikv-jemalloc-ctl", "dep:tikv-jemalloc-sys", "dep:jemalloc_pprof", "dep:pprof", "http-service"]
jemalloc-pprof = ["dep:tikv-jemalloc-ctl", "dep:tikv-jemalloc-sys", "dep:jemalloc_pprof", "dep:pprof", "dep:poem", "dep:serde", "http-service"]
http-service = []

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion native-engine/blaze/src/http/memory_profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use std::io::{Error, ErrorKind};

use log::error;
use poem::{IntoResponse, Request, RouteMethod, http::StatusCode};
use poem::{Request, RouteMethod, http::StatusCode};

use super::Handler;

Expand Down
Loading