forked from DraqueT/PolyGlot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
full_build.sh
executable file
·186 lines (163 loc) · 6.84 KB
/
full_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
#!/bin/bash
# Builds all 3 versions of PolyGlot / uploads them to their hosting points on my google share
# This won't work on your machine unless you set it up specifically. It's set up to work with the particulars of my VMs.
START=$(date +%s)
OSX_BUILD_TIME=0
WIN_BUILD_TIME=0
LIN_BUILD_TIME=0
BUILD_STEP=""
CONST_RELEASE="-release"
CONST_WIN="win"
CONST_WIN_VIRTUAL="WinDev2001Eval"
CONST_LINUX="lin"
CONST_LINUX_VIRTUAL="PolyGlotBuildUbuntu"
CONST_OSX="osx"
# ensure java home properly defined
source ~/.bash_profile
# if a build step is specified, capture it here (can only specify build step per platform)
if [ "$2" != "" ]; then
BUILD_STEP="$2"
echo "Platform: $1, Step: $2"
fi
# release tag means pass release to all builds
if [ "$1" == "$CONST_RELEASE" ]; then
BUILD_STEP="$1"
fi
# Windows Build/upload
if [ "$#" -eq 0 ] || [ "$1" == "$CONST_WIN" ] || [ "$1" == "$CONST_RELEASE" ]; then
WIN_START_TIME=$(date +%s)
echo "Starting Windows build process..."
###### For whatever reason, jpackage will simply not function correctly unless the PC is booted up in advance
# VBoxManage startvm "$CONST_WIN_VIRTUAL" --type gui
# echo "Waiting 25 seconds for target machine to start up..."
# sleep 5
# echo "Waiting 20 seconds for target machine to start up..."
# sleep 5
# echo "Waiting 15 seconds for target machine to start up..."
# sleep 5
# echo "Waiting 10 seconds for target machine to start up..."
# sleep 5
# echo "Waiting 05 seconds for target machine to start up..."
# sleep 5
if [ $(vboxmanage showvminfo "$CONST_WIN_VIRTUAL" | grep -c "running .since") == 0 ] ; then
echo "Windows must be running to be built due to limitations in jpackage for Windows."
sleep 5
exit
else
if [ "$BUILD_STEP" == "" ] ; then
VBoxManage guestcontrol "$CONST_WIN_VIRTUAL" \
run --exe "C:\Users\polyglot\Documents\NetBeansProjects\auto_polyglot_build.bat" \
--username polyglot \
--passwordfile /Users/draque/NetBeansProjects/polyglotvmpass
else
VBoxManage guestcontrol "$CONST_WIN_VIRTUAL" \
run --exe "C:\Users\polyglot\Documents\NetBeansProjects\auto_polyglot_build.bat" \
--username polyglot \
--passwordfile /Users/draque/NetBeansProjects/polyglotvmpass \
-- auto_polyglot_build.bat/arg0 "$BUILD_STEP"
fi
VBoxManage guestcontrol "$CONST_WIN_VIRTUAL" \
run --exe "C:\Users\polyglot\Documents\NetBeansProjects\auto_polyglot_build_shutdown.bat" \
--username polyglot \
--passwordfile /Users/draque/NetBeansProjects/polyglotvmpass
echo "Waiting for Windows machine to power down..."
until $(VBoxManage showvminfo --machinereadable "$CONST_WIN_VIRTUAL" | grep -q ^VMState=.poweroff.)
do
sleep 2
done
echo "Windows build process complete."
WIN_END_TIME=$(date +%s)
WIN_BUILD_TIME=$(echo "$WIN_END_TIME - $WIN_START_TIME" | bc)
fi
fi
# Linux Build/upload
if [ "$#" -eq 0 ] || [ "$1" == "$CONST_LINUX" ] || [ "$1" == "$CONST_RELEASE" ]; then
LIN_START_TIME=$(date +%s)
echo "Starting Ubuntu build process..."
VBoxManage startvm "$CONST_LINUX_VIRTUAL" --type headless
echo "Waiting 25 seconds for target machine to start up..."
sleep 5
echo "Waiting 20 seconds for target machine to start up..."
sleep 5
echo "Waiting 15 seconds for target machine to start up..."
sleep 5
echo "Waiting 10 seconds for target machine to start up..."
sleep 5
echo "Waiting 05 seconds for target machine to start up..."
sleep 5
if [ "$BUILD_STEP" == "" ] ; then
VBoxManage guestcontrol "$CONST_LINUX_VIRTUAL" \
run --exe "/home/polyglot/NetBeansProjects/auto_polyglot_build.sh" \
--username polyglot \
--passwordfile /Users/draque/NetBeansProjects/polyglotvmpass
else
VBoxManage guestcontrol "$CONST_LINUX_VIRTUAL" \
run --exe "/home/polyglot/NetBeansProjects/auto_polyglot_build.sh" \
--username polyglot \
--passwordfile /Users/draque/NetBeansProjects/polyglotvmpass \
-- auto_polyglot_build.bat/arg0 "$BUILD_STEP"
fi
echo "Waiting for Ubuntu machine to power down..."
until $(VBoxManage showvminfo --machinereadable PolyGlotBuildUbuntu | grep -q ^VMState=.poweroff.)
do
sleep 2
done
echo "Linux build process complete."
LIN_END_TIME=$(date +%s)
LIN_BUILD_TIME=$(echo "$LIN_END_TIME - $LIN_START_TIME" | bc)
fi
# OSX Build/upload
if [ "$#" -eq 0 ] || [ "$1" == "$CONST_OSX" ] || [ "$1" == "$CONST_RELEASE" ]; then
OSX_START_TIME=$(date +%s)
echo "Starting OSX build process..."
git pull
# Apple signature must be provided. Must have xcode installed and pull in from keychain.
if [ "$BUILD_STEP" == "" ] ; then
python build_image.py \
-copyDestination "/Users/draque/Google Drive/Permanent_Share/PolyGlotBetas" \
-mac-sign-identity "Apple Development: [email protected] (A3YEXQ2CB4)"
else
python build_image.py \
"$BUILD_STEP" -copyDestination "/Users/draque/Google Drive/Permanent_Share/PolyGlotBetas" \
-mac-sign-identity "Apple Development: [email protected] (A3YEXQ2CB4)"
fi
echo "OSX build process complete."
OSX_END_TIME=$(date +%s)
OSX_BUILD_TIME=$(echo "$OSX_END_TIME - $OSX_START_TIME" | bc)
fi
END=$(date +%s)
if [ $WIN_BUILD_TIME != 0 ]; then
echo "Windows build time: "$WIN_BUILD_TIME" seconds."
fi
if [ $LIN_BUILD_TIME != 0 ]; then
echo "Linux build time: "$LIN_BUILD_TIME" seconds (25 seconds allowed for start)"
fi
if [ $OSX_BUILD_TIME != 0 ]; then
echo "OSX build time: "$OSX_BUILD_TIME" seconds"
fi
DIFF=$(echo "$END - $START" | bc)
echo "Total time spent: "$DIFF" seconds"
LINECOUNT=$(git ls-files | grep ".java" | xargs wc -l | grep -o '[0-9]\+ total')
echo "Java lines built: $LINECOUNT"
if [ "$1" == "$CONST_RELEASE" ]; then
echo -e "\x1B[34m---- RELEASE BUILD ----\x1B[0m"
else
echo -e "\x1B[96m---- BETA BUILD ----\x1B[0m"
fi
# Announce any build failures...
if [ -f "/Users/draque/Google Drive/Permanent_Share/PolyGlotBetas/Windows_BUILD_FAILED" ] && [ $WIN_BUILD_TIME != 0 ]; then
echo -e "\x1B[41mWindows build failed.\x1B[0m"
else
echo -e "\x1B[32mWindows build success.\x1B[0m"
fi
if [ -f "/Users/draque/Google Drive/Permanent_Share/PolyGlotBetas/Linux_BUILD_FAILED" ] && [ $LIN_BUILD_TIME != 0 ]; then
echo -e "\x1B[41mLinux build failed.\x1B[0m"
else
echo -e "\x1B[32mLinux build success.\x1B[0m"
fi
if [ -f "/Users/draque/Google Drive/Permanent_Share/PolyGlotBetas/Darwin_BUILD_FAILED" ] && [ $OSX_BUILD_TIME != 0 ]; then
echo -e "\x1B[41mOSX build failed.\x1B[0m"
else
echo -e "\x1B[32mOSX build success.\x1B[0m"
fi
echo "Full build process complete!"