10cargo-cached-artifacts
1 #!/bin/bash 2 require git cargo 3 is_cargo_project || return 0 4 5 # don't repopulate on prepare-commit-msg 6 git_hook_matches prepare-commit-msg && return 0 7 8 ## In a rust/cargo project, when a $LAST_TEST_DIR is present then hardlink the /target 9 ## build artifacts to the current test dir this can speed up builds. 10 ## Also sets CARGO_NET_OFFLINE to true 11 if [[ "${LAST_TEST_DIR:-}" ]]; then 12 debug "populating from $LAST_TEST_DIR/target" 13 [[ -d "$LAST_TEST_DIR/target" ]] && cp -rluf "$LAST_TEST_DIR/target" "./" 14 export CARGO_NET_OFFLINE="true" 15 fi 16