-
Notifications
You must be signed in to change notification settings - Fork 1
/
transform.sh
executable file
·30 lines (25 loc) · 1.06 KB
/
transform.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
#!/bin/bash
# finds the absolute path from relative path
# called realpath bc thats the utility on linux
# https://stackoverflow.com/questions/3572030/bash-script-absolute-path-with-os-x
realpathMACHACK() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
transformType=$2
projDir=$1
guardedMode="true"
bundlerMode="no"
if [ "$#" -ge 3 ]; then
guardedMode=$3
fi
if [ "$#" -ge 4 ]; then
bundlerMode=$4
fi
if [[ "$transformType" == "dynamic" ]]; then
node stubbifyRunner.js --transform $projDir --uncovered `realpathMACHACK $projDir/coverage/coverage-final.json` --dependencies $projDir/dep_list.txt --guarded_exec_mode $guardedMode --bundler_mode $bundlerMode
elif [[ "$transformType" == "static" ]]; then
node stubbifyRunner.js --transform $projDir --callgraph `realpathMACHACK $projDir/static_callgraph.csv` --dependencies $projDir/dep_list.txt --guarded_exec_mode $guardedMode --bundler_mode $bundlerMode
else
echo "Error: transform_type must be either \"dynamic\" or \"static\""
echo "Usage: ./transform.sh proj_dir ( \"dynamic\" | \"static\" )"
fi