-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathclean-all.sh
executable file
·85 lines (66 loc) · 1.98 KB
/
clean-all.sh
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script removes the temporary files and output files produced by building
# of the libraries and Apps of this project. Optionally, if the "-f" flag is
# specified, it clears the SDKs stored under //env/ as well.
#
# Note: the env/activate file must be source'd into the shell before this script
# execution.
set -eu
BUILT_APP_PACKAGES_DIR="built_app_packages"
CONFIGS="Release Debug"
TOOLCHAINS="emscripten asan_testing coverage"
log_message() {
local message=${1}
echo -e "\033[33;32m${message}\033[0m"
}
clean_dir_with_toolchain_and_config() {
local toolchain=${1}
local config=${2}
log_message "Cleaning \"${toolchain}\" \"${config}\"..."
TOOLCHAIN=${toolchain} CONFIG=${config} make clean -j10 || true
}
clean_built_app_packages() {
log_message "Cleaning built App packages..."
rm -rf ${BUILT_APP_PACKAGES_DIR}
}
clean_env() {
log_message "Cleaning env..."
env/clean.sh || true
}
SCRIPTPATH=$(dirname $(realpath ${0}))
cd ${SCRIPTPATH}
force_env_clean=0
while getopts ":f" opt; do
case $opt in
f)
force_env_clean=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
for toolchain in ${TOOLCHAINS}; do
for config in ${CONFIGS}; do
clean_dir_with_toolchain_and_config ${toolchain} ${config}
done
done
clean_built_app_packages
if [ "${force_env_clean}" -eq "1" ]; then
clean_env
fi
log_message "Cleaning finished."