forked from dhacker29/gitweb_manifest
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcompile
executable file
·150 lines (133 loc) · 3.6 KB
/
compile
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
# Initialize helper functions
. helper_functions
VENDOR=$ROOT/vendor/aokp
for i in $@; do :; done
DEVICE=$i
APK="${@:(-2):1}"
function sync {
local threads=$1
if [ -z "$threads" ]; then
threads=4
fi
repo sync -j${threads}
}
function curl_local {
curl -L -o .repo/local_manifests/local_manifest.xml -O -L https://raw.github.com/BMc08GT/local_manifest/master/default.xml
}
function apk {
. build/envsetup.sh
lunch aokp_${DEVICE}-userdebug
mmm $APK
}
function build {
remove
time brunch $DEVICE
if [ ! -d "../www/$DEVICE" ]; then
mkdir -p ../www/$DEVICE
fi
find . -name aokp_${DEVICE}_\*.zip -exec cp {} ../www/$DEVICE/ \; -exec echo "Successfully copied to Androtransfer..." \;
}
function build-all {
cat $VENDOR/vendorsetup.sh | cut -f2 -d ' ' > .build_list
while read line ;do
DEVNAME=$(echo $line | cut -f2 -d ' ' | cut -f2 -d '_' | cut -f1 -d '-')
brunch $DEVNAME
if [ ! -d "../www/$DEVICE" ]; then
mkdir -p ../www/$DEVICE
fi
find . -name aokp_${DEVNAME}_\*.zip -exec cp {} ../www/$DEVNAME/ \; -exec echo "Successfully copied to Androtransfer..." \;
done < .build_list
rm .build_list
}
function pick {
./picks.sh
}
function help {
echo -e "usage: $0 [OPTIONS] APK DEVICE \n"
echo "Options:
-h, --help Show this help message and exit
-l, --clean Runs make clean based on the device
-c, --clobber Performs a make clobber on the source
-i, --installclean Runs a make installclean based on the device
-s, --sync Runs a repo sync
-b, --build Builds the current source. Requires DEVICE be provided
-a, --all Builds all devices listed in $VENDOR/vendorsetup.sh
-m, --mmm Compiles the specified apk individually. Requires APK be provided
-p, --pick Run picks script
-u, --curl_local Curl local manifest"
}
function clean {
lunch aokp_$DEVICE-userdebug
make clean
}
function clobber {
rm -rf out
}
function installclean {
lunch aokp_$DEVICE-userdebug
make installclean
}
function remove {
find . -name aokp_\*.zip -exec rm -rf {} \; -exec echo "Removing previous builds" \;
}
if [ "$1" == "" ]
then
help
exit
else
. build/envsetup.sh
fi
for arg
do
delim=""
case "$arg" in
--help) args="${args} -h ";;
--clean) args="${args} -l ";;
--clobber) args="${args} -c ";;
--installclean) args="${args} -i";;
--sync) args="${args} -s ";;
--build) args="${args} -b ";;
--all) args="${args} -a ";;
--mmm) args="${args} -m ";;
--pick) args="${args} -p ";;
--curl_local) args="${args} -u ";;
*) [[ "${arg:0:1}" == "-" ]] || delim="\""
args="${args}${delim}${arg}${delim} ";;
esac
done
eval set -- $args
while getopts ":huspcliam:b:?" option 2>/dev/null
do
case $option in
h) help
exit
;;
u) curl_local
;;
s) sync $2
;;
c) clobber
;;
l) clean
;;
i) installclean
;;
b) build
;;
a) time build-all
;;
m) apk
;;
p) pick
;;
:) echo "Option -$OPTARG requires an argument."
help
exit
;;
*) echo $OPTARG is an unrecognized option;
help
exit
;;
esac
done