-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathclean
More file actions
executable file
·39 lines (33 loc) · 1.73 KB
/
clean
File metadata and controls
executable file
·39 lines (33 loc) · 1.73 KB
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
#!/usr/bin/env bash
# vim: ft=sh
# —————————————————————————————————————————————————————————————————————————————————————
# NOTE: These setup scripts rely on an open source BASH framework BASHMATIC_HOME.
# https://github.com/kigster/bashmatic
#
# The framework is pretty light-weight, and is installed in your $HOME/.bashmatic folder.
# You can safely remove that folder after the setup if you wish, although re-running the
# setup will re-install it.
# —————————————————————————————————————————————————————————————————————————————————————
[[ -z ${BASHMATIC_HOME} ]] && export BASHMATIC_HOME="${HOME}/.bashmatic"
[[ -d ${BASHMATIC_HOME} ]] || bash -c "$(curl -fsSL https://bashmatic.re1.re); bashmatic-install -q"
# shellcheck disable=SC1090
source "${BASHMATIC_HOME}/init.sh" 1>/dev/null 2>&1
export BAZEL_OPTS="--max_idle_secs=10800 --noshutdown_on_low_sys_mem --connect_timeout_secs=30"
main() {
h1 "Cleaning Bazel directories... Please wait."
# shellcheck disable=SC2207
local -a du_before=($(du -hs .))
run "bazel clean --expunge"
# shellcheck disable=SC2207
local -a examples=($(ls -1 examples))
for dir in "${examples[@]}"; do
run "cd examples/${dir}"
run "bazel clean --expunge"
run "cd -"
done
# shellcheck disable=SC2207
local -a du_after=($(du -hs .))
h2 "Space before cleaning: ${bldylw}${du_before[0]}" \
"Space after cleaning: ${bldgrn}${du_after[0]}"
}
main "$@"