blob: 9ade49d69cbe20493f2a0f65f6f7cfd423246c91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/bin/bash
# Require : Cargo (Rust)
# Start timing
start_time=$(date +%s.%N)
# Change to the directory where the script is located
cd "$(dirname "$0")/../../" || exit 1
# Check if core library exists
coreLibPath="../VersionControl/"
if [ ! -d "$coreLibPath" ]; then
echo "Core library not found at $coreLibPath. Aborting build."
exit 1
fi
# Test core library
echo "Testing Core Library \"../VersionControl/Cargo.toml\""
cargo test --manifest-path ../VersionControl/Cargo.toml --workspace --quiet > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Core library tests failed. Aborting build."
exit 1
fi
# Test workspace
echo "Testing Command Line \"./Cargo.toml\""
cargo test --workspace --quiet > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Workspace tests failed. Aborting build."
exit 1
fi
# Check if main git worktree is clean
git_status=$(git status --porcelain)
if [ -n "$git_status" ]; then
echo "Git worktree is not clean. Commit or stash changes before building."
exit 1
fi
# Check if core library git worktree is clean
pushd "$coreLibPath" > /dev/null
core_git_status=$(git status --porcelain)
popd > /dev/null
if [ -n "$core_git_status" ]; then
echo "Core library git worktree is not clean. Commit or stash changes before building."
exit 1
fi
# Build
echo "Building Command Line \"./Cargo.toml\""
if FORCE_BUILD=$(date +%s) cargo build --workspace --release --quiet > /dev/null 2>&1; then
# Build succeeded
# Export
echo "Deploying Command Line \"./.cargo/config.toml\""
if cargo run --manifest-path tools/build_helper/Cargo.toml --quiet --bin exporter release > /dev/null 2>&1; then
# Copy compile_info.rs.template to compile_info.rs after successful export
cp -f templates/compile_info.rs.template src/data/compile_info.rs
# Run jvn if available
if command -v jvn &> /dev/null; then
jvn -v --no-banner -c
fi
fi
fi
# Calculate and display elapsed time
end_time=$(date +%s.%N)
elapsed_time=$(echo "$end_time - $start_time" | bc)
printf "Success (Finished in %.2fs)\n" $elapsed_time
|