-
Notifications
You must be signed in to change notification settings - Fork 4
/
calcdeps.sh
executable file
·39 lines (33 loc) · 1.2 KB
/
calcdeps.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
#!/bin/bash
#
# A wrapper script for regenerating ./common/test/js/deps.js.
# TODO(jmleyba): Integrate this with the Rakefile.
#
# Author: [email protected] (Jason Leyba)
readonly ROOT="$(cd `dirname $0` && pwd)"
readonly CLOSURE="${ROOT}/third_party/closure"
readonly CALCDEPS="${CLOSURE}/bin/calcdeps.py"
readonly GOOG_DIR="${CLOSURE}/goog"
readonly JS_RELATIVE_SRC="../../../common/src/js"
readonly JS_RELATIVE_TEST="../../../common/test/js"
readonly OUTPUT_FILE="${ROOT}/common/test/js/deps.js"
main() {
cd "${GOOG_DIR}"
local command=""
command=( "${CALCDEPS}" )
command=( "${command[@]}" "--output_mode=deps" )
command=( "${command[@]}" "--path=${JS_RELATIVE_SRC}" )
command=( "${command[@]}" "--path=${JS_RELATIVE_TEST}" )
echo
count=${#command[@]}
for ((i=0; i < $count; i++)); do
echo "${command[$i]} \\"
done
echo
# Generate the deps. The file paths will be as they appear on the filesystem,
# but for our tests, the WebDriverJS source files are served from /js/src and
# the Closure Library source is under /third_party/closure/goog, so we need
# to modify the generated paths to match that scheme.
"${command[@]}" | sed "s/common\/\(.*\)\/js/js\/\1/" > ${OUTPUT_FILE}
}
main $*