-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
285 lines (264 loc) · 10.1 KB
/
build.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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#!/bin/bash
# Define this
RELEASE="$1"
OFFICIAL="$2"
ydate=$(date -d '1 day ago' +"%m/%d/%Y")
sdate="$3"
cdate=`date +"%m_%d_%Y"`
DATE=`date +"%Y%m%d"`
rdir=`pwd`
# Start timinig
res1=$(date +%s.%N)
# Set output directory
if [ "$RELEASE" == "official" ]
then
outdir=~/official
else
if ["$RELEASE" == "alpha" ]
then
outdir=~/alpha
else
outdir=~/nightlies
fi
fi
mkdir -p $outdir
# Colorize and add text parameters
red=$(tput setaf 1) # red
grn=$(tput setaf 2) # green
cya=$(tput setaf 6) # cyan
txtbld=$(tput bold) # Bold
bldred=${txtbld}$(tput setaf 1) # red
bldgrn=${txtbld}$(tput setaf 2) # green
bldylw=${txtbld}$(tput setaf 3) # yellow
bldblu=${txtbld}$(tput setaf 4) # blue
bldppl=${txtbld}$(tput setaf 5) # purple
bldcya=${txtbld}$(tput setaf 6) # cyan
txtrst=$(tput sgr0) # Reset
# we don't allow scrollback buffer
echo -e '\0033\0143'
clear
echo -e " ______ "$bldcya" ______"$bldppl" __ __ "$bldblu" ______ "$bldgrn"__ "$bldylw"______ "$txtrst" "
echo -e " /\ == \ "$bldcya" /\ ___\ "$bldppl" /\ \ / /"$bldblu" /\ __ \ "$bldgrn"/\ \ "$bldylw"/\__ _\ "$txtrst" "
echo -e " \ \ __< "$bldcya" \ \ __\ "$bldppl" \ \ \'/ "$bldblu" \ \ \/\ \ "$bldgrn"\ \ \____"$bldylw"\/_/\ \/ "$txtrst" "
echo -e " \ \_\ \_\ "$bldcya"\ \_____\ "$bldppl"\ \__| "$bldblu" \ \_____\ "$bldgrn"\ \_____\ "$bldylw"\ \_\ "$txtrst" "
echo -e " \/_/ /_/"$bldcya" \/_____/"$bldppl" \/_/ "$bldblu" \/_____/ "$bldgrn"\/_____/ "$bldylw"\/_/ "$txtrst" "
echo -e $txtrst" "
# Set version
if [ "$RELEASE" == "official" ]
then
ver="$OFFICIAL"-stable
export RV_BUILD="$OFFICIAL"
else
if [ "$RELEASE" == "alpha" ]
then
ver=ALPHA-"$DATE"
export RV_ALPHA=1
else
ver=nightly-"$DATE"
export RV_NIGHTLY="$DATE"
fi
fi
# Remove previous build info
echo "Removing previous build.prop"
rm out/target/product/mako/system/build.prop;
rm out/target/product/grouper/system/build.prop;
rm out/target/product/maguro/system/build.prop;
rm out/target/product/manta/system/build.prop;
rm out/target/product/find5/system/build.prop;
rm out/target/product/i9100/system/build.prop;
rm out/target/product/i9100g/system/build.prop;
rm out/target/product/i9300/system/build.prop;
rm out/target/product/yuga/system/build.prop;
rm out/target/product/odin/system/build.prop;
rm out/target/product/n7000/system/build.prop;
rm out/target/product/n7100/system/build.prop;
rm out/target/product/m7ul/system/build.prop;
rm out/target/product/m7att/system/build.prop;
rm out/target/product/m7tmo/system/build.prop;
rm out/target/product/m7spr/system/build.prop;
rm out/target/product/jfltecan/system/build.prop;
rm out/target/product/jfltetmo/system/build.prop;
rm out/target/product/jfltespr/system/build.prop;
rm out/target/product/jflteusc/system/build.prop;
rm out/target/product/jfltevzw/system/build.prop;
rm out/target/product/jflteatt/system/build.prop;
rm out/target/product/n8000/system/build.prop;
rm out/target/product/n8013/system/build.prop;
rm out/target/product/jfltexx/system/build.prop;
# Generate Changelog
echo "Generating Changelog"
# Check the date start range is set
if [ -z "$sdate" ]; then
sdate=${ydate}
fi
# Find the directories to log
find $rdir -name .git | sed 's/\/.git//g' | sed 'N;$!P;$!D;$d' | while read line
do
cd $line
# Test to see if the repo needs to have a changelog written.
log=$(git log --pretty="%an - %s" --no-merges --since=$sdate --date-order)
project=$(git remote -v | head -n1 | awk '{print $2}' | sed 's/.*\///' | sed 's/\.git//')
if [ -z "$log" ]; then
echo "Nothing updated on $project, skipping"
else
# Prepend group project ownership to each project.
origin=`grep "$project" $rdir/.repo/manifest.xml | awk {'print $4'} | cut -f2 -d '"'`
if [ "$origin" = "aokp" ]; then
proj_credit=AOKP
elif [ "$origin" = "aosp" ]; then
proj_credit=AOSP
elif [ "$origin" = "cm" ]; then
proj_credit=CyanogenMod
elif [ "$origin" = "faux" ]; then
proj_credit=Faux123
elif [ "$origin" = "revolt" ]; then
proj_credit=ReVolt
elif [ "$origin" = "muppets" ]; then
proj_credit=TheMuppets
else
proj_credit=""
fi
# Write the changelog
echo "$proj_credit Project name: $project" >> "$rdir"/changelog.txt
echo "$log" | while read line
do
echo " -$line" >> "$rdir"/changelog.txt
done
echo "" >> "$rdir"/changelog.txt
fi
done
# Create Version Changelog
if [ "$RELEASE" == "official" ]
then
echo "Generating and Uploading Changelog for Official Release"
cp changelog.txt changelog_"$RV_BUILD".txt
ncftpput -f login.cfg /changelogs changelog_"$RV_BUILD".txt
else
if [ "$RELEASE" == "alpha" ]
then
echo "Generating and Uploading Changelog for Alpha"
cp changelog.txt changelog_alpha_"$DATE".txt
ncftpput -f login.cfg /changelogs/alpha changelog_alpha_"$DATE".txt
else
echo "Generating and Uploading Changelog for Nightly"
cp changelog.txt changelog_"$DATE".txt
ncftpput -f login.cfg /changelogs/nightlies changelog_"$DATE".txt
fi
fi
# Remove local copy of Changelog
if [ "$RELEASE" == "official" ]
then
echo "Removing Official Release Changelog"
rm -rf changelog.txt
rm -rf changelog_"$RV_BUILD".txt
else
if [ "$RELEASE" == "alpha" ]
then
echo "Removing Alpha Release Changelog"
rm -rf changelog.txt
rm -rf changelog_alpha_"$DATE".txt
else
echo "Removing Nightly Release Changelog"
rm -rf changelog.txt
rm -rf changelog_"$DATE".txt
fi
fi
# Switch to the build tree, clean and sync
cd ~/revolt
rm -rf out
repo sync
# Build and upload some devices
if [ "$RELEASE" == "official" ]
then
for sec in mako grouper maguro flo i9100 i9300 n7000 n7100 manta find5 i9100g yuga odin m7ul m7att m7tmo m7spr jfltecan jfltetmo jfltespr jflteusc jfltevzw jflteatt n8000 n8013 jfltexx; do
export RV_PRODUCT=$sec
cd ~/revolt
android-build -C -v $ver -o $outdir revolt_$sec-userdebug
echo -e "ReVolt Compilation Finished for $sec"
if [ $? -eq 0 ]; then
echo "Stable Build Successfully done for $sec">>log.txt
cd ;
echo -e "${bldblu}Sanitizing area for ReVolt Additions ${txtrst}"
cd $outdir && mkdir tmp;
mv revolt_$sec-$ver.zip $outdir/tmp/ReVolt-JB-"$OFFICIAL"-"$sec".zip;
cd $outdir/tmp/ ;
cp $outdir/tmp/ReVolt-JB-"$OFFICIAL"-"$sec".zip $outdir/
cd $outdir && rm -f -r tmp;
cd $outdir;
cd ~/revolt
ncftpput -f login.cfg /$sec/ $outdir/ReVolt-JB-"$OFFICIAL"-"$sec".zip
scp $outdir/ReVolt-JB-"$OFFICIAL"-$sec.zip [email protected]:~/public_html/ReVolt_JB_$sec/
rm -rf $outdir/ReVolt-JB-"$OFFICIAL"-$sec.zip
rm -rf $outdir
mkdir -p $outdir
else
echo "Stable Build FAILED for $sec">>log.txt
fi
done
else
if [ "$RELEASE" == "alpha" ]
then
for dev in mako grouper maguro i9100 i9100g i9300 n7000 n7100 manta find5 yuga odin m7ul m7att m7tmo m7spr jfltecan jfltetmo jfltespr jflteusc jfltevzw jflteatt n8000 n8013 jfltexx ; do
export RV_PRODUCT=$dev
cd ~/revolt
android-build -C -v $ver -o $outdir revolt_$dev-userdebug
echo -e "ReVolt Compilation Finished for $dev"
if [ $? -eq 0 ]; then
echo "ALPHA Build Successfully done for $dev">>log.txt
ncftpput -f login.cfg /$dev/ALPHA/ $outdir/revolt_$dev-$ver.zip
scp $outdir/revolt_$dev-$ver.zip [email protected]:~/public_html/ReVolt_JB_$dev/ALPHA/
rm -rf $outdir/revolt_$dev-$ver.zip
else
echo "ALPHA Build FAILED for $dev">>/raid/johnhany97/log.txt
fi
done
for dev2 in i9500 ; do
export RV_PRODUCT=$dev2
cd ~/revolt
rm -rf device/samsung/manta
android-build -C -v $ver -o $outdir revolt_$dev2-userdebug
echo -e "ReVolt Compilation Finished for $dev2"
if [ $? -eq 0 ]; then
echo "ALPHA Build Successfully done for $dev2">>log.txt
ncftpput -f login.cfg /$dev2/ALPHA/ $outdir/revolt_$dev2-$ver.zip
scp $outdir/revolt_$dev2-$ver.zip [email protected]:~/public_html/ReVolt_JB_$dev2/ALPHA/
rm -rf $outdir/revolt_$dev2-$ver.zip
else
echo "ALPHA Build FAILED for $dev2">>/raid/johnhany97/log.txt
fi
done
else
for dev in mako grouper maguro i9100 i9100g i9300 n7000 n7100 manta find5 yuga odin m7ul m7att m7tmo m7spr jfltecan jfltetmo jfltespr jflteusc jfltevzw jflteatt n8000 n8013 jfltexx ; do
export RV_PRODUCT=$dev
cd ~/revolt
android-build -C -v $ver -o $outdir revolt_$dev-userdebug
echo -e "ReVolt Compilation Finished for $dev"
if [ $? -eq 0 ]; then
echo "Nightly Build Successfully done for $dev">>log.txt
ncftpput -f login.cfg /$dev/Nightlies/ $outdir/revolt_$dev-$ver.zip
scp $outdir/revolt_$dev-$ver.zip [email protected]:~/public_html/ReVolt_JB_$dev/Nightlies/
rm -rf $outdir/revolt_$dev-$ver.zip
else
echo "Nightly Build FAILED for $dev">>/raid/johnhany97/log.txt
fi
done
for dev2 in i9500 ; do
export RV_PRODUCT=$dev2
cd ~/revolt
rm -rf device/samsung/manta
android-build -C -v $ver -o $outdir revolt_$dev2-userdebug
echo -e "ReVolt Compilation Finished for $dev2"
if [ $? -eq 0 ]; then
echo "Nightly Build Successfully done for $dev2">>log.txt
ncftpput -f login.cfg /$dev2/Nightlies/ $outdir/revolt_$dev2-$ver.zip
scp $outdir/revolt_$dev2-$ver.zip [email protected]:~/public_html/ReVolt_JB_$dev2/Nightlies/
rm -rf $outdir/revolt_$dev2-$ver.zip
else
echo "Nightly Build FAILED for $dev2">>/raid/johnhany97/log.txt
fi
done
fi
fi
# Time elapsed for a full set of builds
res2=$(date +%s.%N)
echo "${bldgrn}Total time elapsed: ${txtrst}${grn}$(echo "($res2 - $res1) / 60"|bc ) minutes ($(echo "$res2 - $res1"|bc ) seconds) ${txtrst}"