feat(scripts/maintenance): add Rust cache cleanup support
Add Rust build cache cleanup to maintenance script: - Add cleanup_rust_cache() function with cargo clean integration - Check for cargo availability before attempting cleanup - Show cache size before/after for visibility - Add 'rust' subcommand for targeted Rust cache cleanup - Include Rust cache in 'benchmarks' and 'all' cleanup operations - Add aggressive cleanup support for Rust - Update help text and disk usage display
This commit is contained in:
parent
b5ca575c6f
commit
f87db5d062
1 changed files with 32 additions and 0 deletions
|
|
@ -161,6 +161,25 @@ cleanup_go_cache() {
|
|||
fi
|
||||
}
|
||||
|
||||
cleanup_rust_cache() {
|
||||
print_status "Cleaning Rust build cache..."
|
||||
|
||||
if command -v cargo >/dev/null 2>&1; then
|
||||
if [ -d "$PROJECT_ROOT/native_rust/target" ]; then
|
||||
local cache_size_before=$(du -sh "$PROJECT_ROOT/native_rust/target" 2>/dev/null | cut -f1 || echo "0B")
|
||||
cd "$PROJECT_ROOT/native_rust" && cargo clean 2>/dev/null || true
|
||||
local cache_size_after=$(du -sh "$PROJECT_ROOT/native_rust/target" 2>/dev/null | cut -f1 || echo "0B")
|
||||
if [ "$cache_size_before" != "$cache_size_after" ]; then
|
||||
print_success "Cleaned Rust cache: $cache_size_before → $cache_size_after"
|
||||
fi
|
||||
else
|
||||
print_warning "No Rust target directory found"
|
||||
fi
|
||||
else
|
||||
print_warning "Cargo not found, skipping Rust cache cleanup"
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup_docker() {
|
||||
print_status "Cleaning Docker artifacts..."
|
||||
|
||||
|
|
@ -242,6 +261,12 @@ show_disk_usage() {
|
|||
echo " Go cache: $cache_size"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Rust cache
|
||||
if [ -d "$PROJECT_ROOT/native_rust/target" ]; then
|
||||
local rust_size=$(du -sh "$PROJECT_ROOT/native_rust/target" 2>/dev/null | cut -f1 || echo "0B")
|
||||
echo " Rust cache: $rust_size"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main execution
|
||||
|
|
@ -259,6 +284,9 @@ main() {
|
|||
"go")
|
||||
cleanup_go_cache "${2:-}"
|
||||
;;
|
||||
"rust")
|
||||
cleanup_rust_cache
|
||||
;;
|
||||
"docker")
|
||||
cleanup_docker "${2:-}"
|
||||
;;
|
||||
|
|
@ -270,12 +298,14 @@ main() {
|
|||
cleanup_benchmark_artifacts "keep-10"
|
||||
cleanup_temp_files
|
||||
cleanup_go_cache
|
||||
cleanup_rust_cache
|
||||
;;
|
||||
"all")
|
||||
print_status "Running comprehensive cleanup..."
|
||||
cleanup_benchmark_artifacts "keep-5"
|
||||
cleanup_temp_files
|
||||
cleanup_go_cache
|
||||
cleanup_rust_cache
|
||||
cleanup_docker
|
||||
cleanup_logs
|
||||
;;
|
||||
|
|
@ -287,6 +317,7 @@ main() {
|
|||
cleanup_benchmark_artifacts "keep-5"
|
||||
cleanup_temp_files
|
||||
cleanup_go_cache "aggressive"
|
||||
cleanup_rust_cache
|
||||
cleanup_docker "aggressive"
|
||||
cleanup_logs
|
||||
else
|
||||
|
|
@ -306,6 +337,7 @@ main() {
|
|||
echo " artifacts [all|keep-5|keep-10] Clean benchmark artifacts"
|
||||
echo " temp Clean temporary files"
|
||||
echo " go [aggressive] Clean Go build cache"
|
||||
echo " rust Clean Rust build cache"
|
||||
echo " docker [aggressive] Clean Docker artifacts"
|
||||
echo " logs Clean old log files"
|
||||
echo " benchmarks Standard benchmark cleanup"
|
||||
|
|
|
|||
Loading…
Reference in a new issue