-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy path.global
103 lines (78 loc) · 1.64 KB
/
.global
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
base_dir="$(dirname "$(readlink -f "$0")")/$base_suffix"
base_dir="${base_dir%/}"
default_java_version="1.6"
### Filesets
fs_framework_jars=( ext.jar services.jar )
fs_priv_apps=( Settings.apk )
fs_non_priv_apps=()
### Paths
tools_dir="$base_dir/tools"
dex2jar_dir=( "$tools_dir/dex2jar"/* )
dx_dir=( "$tools_dir/dx"/* )
dexpatcher_dir="$tools_dir/dexpatcher"
dexpatcher_jar=( "$dexpatcher_dir"/dexpatcher-[0-9]*.jar )
dexpatcher_annotation_jar=( "$dexpatcher_dir"/dexpatcher-annotation-*.jar )
### Tools
run_adb_quiet() {
adb "${adb_options[@]}" "$@"
}
run_adb() {
echo ">>>" adb "${adb_options[@]}" "$@"
run_adb_quiet "$@"
}
run_java() {
java "$@"
}
run_javac() {
#echo ">>>" javac "$@"
javac "$@"
}
run_d2j_dex2jar() {
#echo ">>>" d2j-dex2jar "$@"
sh "$dex2jar_dir/d2j-dex2jar.sh" "$@"
}
run_dx() {
#echo ">>>" dx "$@"
bash "$dx_dir/dx" "$@"
}
run_dexpatcher() {
echo ">>>" dexpatcher "$@"
run_java -jar "$dexpatcher_jar" "$@"
}
### Helpers
error() {
>&2 echo "error: $*"
exit 1
}
usage() {
>&2 echo "usage: $*"
exit 1
}
check_adb() {
run_adb_quiet shell exit
}
check_dir() {
local dir="${1%/}"
local message="${2:-"directory not found"}"
if [ ! -d "$dir" ]; then
error "$message"
fi
}
check_file() {
local file="$1"
local message="${2:-"file not found"}"
if [ ! -f "$file" ]; then
error "$message"
fi
}
check_fileset() {
local fileset_dir="${1%/}"
local message="${2:-"fileset not found"}"
check_file "$fileset_dir/framework.jar" "$message"
}
join_with_char() {
local IFS="$1"
shift
echo "$*"
}