-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.sh
223 lines (176 loc) · 8.01 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
if [ -d product-sns ]
then
echo "Invoked in phoebus-sns"
cd ../phoebus
else
echo "Fetching sources"
git clone https://github.com/ControlSystemStudio/phoebus.git
git clone https://github.com/kasemir/phoebus-sns.git
cd phoebus
fi
if [ "x$WORKSPACE" = "x" ]
then
echo "Plain Linux setup"
B=`git rev-parse --abbrev-ref HEAD`
else
echo "Running under Jenkins"
B=`echo $GIT_BRANCH | sed 's/.*\///'`
M2_HOME=/opt/apache-maven
ANT_HOME=/opt/apache-ant
JAVA_HOME=/opt/jdk-17
export ORACLE_JDBC_JAR=/opt/Oracle/ojdbc8-12.2.0.1.jar
fi
echo "M2_HOME=$M2_HOME"
echo "ANT_HOME=$ANT_HOME"
echo "JAVA_HOME=$JAVA_HOME"
echo "ORACLE_JDBC_JAR=$ORACLE_JDBC_JAR"
export PATH="$M2_HOME/bin:$ANT_HOME/bin:$JAVA_HOME/bin:$PATH"
D=`date +'%Y-%m-%d %H:%M'`
VERSION="$B $D"
echo "============================================="
echo "VERSION: $VERSION"
echo "============================================="
if [ -r "$ORACLE_JDBC_JAR" ]
then
mkdir -p dependencies/install-jars/lib/ojdbc
cp $ORACLE_JDBC_JAR dependencies/install-jars/lib/ojdbc
else
echo "MISSING ORACLE_JDBC_JAR"
fi
java -version
mvn -version
rm -f *.zip
# Create Javadoc
( cd app/display/editor; ant -f javadoc.xml clean all )
# Create documentation
( cd docs; make clean html )
# The following 'ant clean' steps will remove the javadoc,
# but we now have it copied into the documentation, so no problem.
# Create Update info
URL='https://controlssoftware.sns.ornl.gov/css_phoebus/nightly/phoebus-$(arch).zip'
sh app/update/mk_update_settings.sh $URL > phoebus-product/settings.ini
echo "## Setting 'version'"
git checkout -- core/ui/src/main/resources/org/phoebus/ui/application/messages.properties
sed -i "s/\${version}/$VERSION/" core/ui/src/main/resources/org/phoebus/ui/application/messages.properties
git diff core/ui/src/main/resources/org/phoebus/ui/application/messages.properties
# Example for removing a build target
#sed -i 's/<ant target="service-alarm-logger" dir="services\/alarm-logger"\/>//' build.xml
#sed -i 's/<ant target="dist" dir="services\/alarm-logger"\/>//' build.xml
cd ../phoebus-sns
# Cleanup
rm -f *.zip
echo "## Setting Update URL"
URL='https://controlssoftware.sns.ornl.gov/css_phoebus/nightly/product-sns-$(arch).zip'
git checkout -- product-sns/settings.ini
sh ../phoebus/app/update/mk_update_settings.sh $URL >> product-sns/settings.ini
git diff product-sns/settings.ini
echo "============================================="
echo " Windows ------------------------------------"
echo "============================================="
# Get deps for windows
( cd ../phoebus/dependencies; mvn -Djavafx.platform=win clean install )
rm -f ../phoebus/dependencies/phoebus-target/target/lib/*log4j*
# Zip phoebus-target
rm -f phoebus-target-win.zip
zip -qr phoebus-target-win.zip ../phoebus/dependencies/phoebus-target/target/lib/
# Build Windows products
ant clean dist
mv ../phoebus/phoebus-product/target/phoebus-*-win.zip .
mv product-sns/target/product-sns-*-win.zip .
# Remove the linux starter, since windows user tend to not see file extensions
# and phoebus.sh looks just like phoebus.bat
PROD=`echo product-sns-*-win.zip | sed 's/-win.zip//'`
zip -d $PROD-win.zip $PROD/phoebus.sh
# Bundle JRE?
if [ -d /opt/jdks/windows ]
then
WS=`pwd`
( cd /opt/jdks/windows; zip -q -r $WS/product-sns-*-win.zip jdk )
fi
echo "============================================="
echo " Mac (Intel) -------------------------------"
echo "============================================="
( cd ../phoebus/dependencies; mvn -Djavafx.platform=mac clean install )
rm -f ../phoebus/dependencies/phoebus-target/target/lib/*log4j*
# Zip phoebus-target
rm -f phoebus-target-mac.zip
zip -qr phoebus-target-mac.zip ../phoebus/dependencies/phoebus-target/target/lib/
# Build Mac products
ant clean dist
# Bundle as Mac app (plain as well as SNS product)
( export JAVA_HOME=/opt/jdks/mac/jdk/Contents/Home;
sh make_app.sh ../phoebus/phoebus-product/target/phoebus-*-mac.zip )
( export JAVA_HOME=/opt/jdks/mac/jdk/Contents/Home;
sh make_app.sh product-sns/target/product-sns-*-mac.zip )
echo "============================================="
echo " Mac-aarch64 (Apple M2) ---------------------"
echo "============================================="
( cd ../phoebus/dependencies; mvn -Djavafx.platform=mac-aarch64 clean install )
rm -f ../phoebus/dependencies/phoebus-target/target/lib/*log4j*
# Zip phoebus-target
rm -f phoebus-target-mac-aarch64.zip
zip -qr phoebus-target-mac-aarch64.zip ../phoebus/dependencies/phoebus-target/target/lib/
# Build Mac products
ant clean dist
# Bundle as Mac app (plain as well as SNS product)
( export JAVA_HOME=/opt/jdks/mac-aarch64/jdk/Contents/Home;
sh make_app.sh ../phoebus/phoebus-product/target/phoebus-*-mac-aarch64.zip )
( export JAVA_HOME=/opt/jdks/mac-aarch64/jdk/Contents/Home;
sh make_app.sh product-sns/target/product-sns-*-mac-aarch64.zip )
echo "============================================="
echo " Linux -------------------------------------"
echo "============================================="
# Build the SNS product with maven to test one complete maven build
mvn -DskipTests -Djavafx.platform=linux clean install
rm -f ../phoebus/dependencies/phoebus-target/target/lib/*log4j*
# Zip phoebus-target
rm -f phoebus-target-linux.zip
zip -qr phoebus-target-linux.zip ../phoebus/dependencies/phoebus-target/target/lib/
# Show command-line options, basic test that it 'runs'
java -jar product-sns/target/product-sns-*-SNAPSHOT.jar -help
# Build with ant (online help, dist)
ant clean dist
java -jar product-sns/target/product-sns-*.jar -help
# Create 'all widgets' file
(cd ../phoebus/app/display/model; ant all_widgets)
mv /tmp/all_widgets.bob .
mv ../phoebus/phoebus-product/target/phoebus-*-linux.zip .
mv product-sns/target/product-sns-*-linux.zip .
# Bundle JRE?
if [ -d /opt/jdks/linux ]
then
WS=`pwd`
( cd /opt/jdks/linux; zip -q -r $WS/product-sns-*-linux.zip jdk )
fi
# Delete stuff we don't need
zip -d phoebus-[0-9].[0-9].[0-9]*-linux.zip '*app-trends-rich-adapters*'
zip -d phoebus-[0-9].[0-9].[0-9]*-win.zip '*app-trends-rich-adapters*'
zip -d phoebus-[0-9].[0-9].[0-9]*-mac.zip '*app-trends-rich-adapters*'
zip -d phoebus-[0-9].[0-9].[0-9]*-mac-aarch64.zip '*app-trends-rich-adapters*'
zip -d product-sns-[0-9].[0-9].[0-9]*-linux.zip '*app-trends-rich-adapters*'
zip -d product-sns-[0-9].[0-9].[0-9]*-win.zip '*app-trends-rich-adapters*'
zip -d product-sns-[0-9].[0-9].[0-9]*-mac.zip '*app-trends-rich-adapters*'
zip -d product-sns-[0-9].[0-9].[0-9]*-mac-aarch64.zip '*app-trends-rich-adapters*'
echo Show command line options
( cd ../phoebus/phoebus-product; ./phoebus.sh -help )
( cd ../phoebus/services/alarm-server; ./alarm-server.sh -help )
( cd ../phoebus/services/alarm-logger; ./alarm-logger.sh -help )
( cd ../phoebus/services/scan-server; ./scan-server.sh -help )
( cd ../phoebus/services/archive-engine; sh archive-engine.sh -help )
# Rename
mv phoebus-[0-9].[0-9].[0-9]*-linux.zip phoebus-linux.zip
mv phoebus-[0-9].[0-9].[0-9]*-win.zip phoebus-win.zip
mv phoebus-[0-9].[0-9].[0-9]*-mac.zip phoebus-mac.zip
mv phoebus-[0-9].[0-9].[0-9]*-mac-aarch64.zip phoebus-mac-aarch64.zip
mv product-sns-[0-9].[0-9].[0-9]*-linux.zip product-sns-linux.zip
mv product-sns-[0-9].[0-9].[0-9]*-win.zip product-sns-win.zip
mv product-sns-[0-9].[0-9].[0-9]*-mac.zip product-sns-mac.zip
mv product-sns-[0-9].[0-9].[0-9]*-mac-aarch64.zip product-sns-mac-aarch64.zip
mv ../phoebus/services/scan-server/target/scan-server-*.zip scan-server.zip
mv ../phoebus/services/alarm-server/target/alarm-server-*.zip alarm-server.zip
mv ../phoebus/services/alarm-logger/target/alarm-logger-*.zip alarm-logger.zip
mv ../phoebus/services/archive-engine/target/archive-engine-*.zip archive-engine.zip
echo "============================================="
echo " Build Results ------------------------------"
echo "============================================="
ls *.zip