-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.sh
executable file
·169 lines (135 loc) · 4.21 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
# Main script to build OA4MP
# Next couple of directories are to let this script update all my
# local installs of these tools, so I have the latest version after each build
#
# OA4MP_ROOT = root of sources
# OA4MP_CLIENT_DEPLOY = where client artifacts are put
# OA4MP_SERVER_DEPLOY = where server artifacts are put
#
# N.B. QDL is built and deployed in the build-tools script
echo "building OA4MP from sources ..."
if [ -z ${NCSA_DEV_INPUT+x} ]
then
echo "no sources, skipping..."
exit 1
fi
if [ -z ${NCSA_DEV_OUTPUT+x} ]
then
echo "no output directory, skipping..."
exit 1
fi
OA4MP_ROOT=$NCSA_DEV_INPUT/oa4mp
OA4MP_CLIENT_DEPLOY=$NCSA_DEV_OUTPUT/oa4mp
OA4MP_SERVER_DEPLOY=$NCSA_DEV_OUTPUT/oa4mp
if [ ! -d "$OA4MP_ROOT" ]
then
echo "$OA4MP_ROOT does not exist. No sources, exiting.."
exit 1
# else
# echo "$OA4MP_ROOT" exists
fi
#if [ ! -d "$OA4MP_CLIENT_DEPLOY" ]
# then
# mkdir "$OA4MP_CLIENT_DEPLOY"
# else
# echo " client deploy directory exists, cleaning..."
# cd $OA4MP_CLIENT_DEPLOY
# rm -Rf *
#fi
if [ ! -d "$OA4MP_SERVER_DEPLOY" ]
then
mkdir "$OA4MP_SERVER_DEPLOY"
else
echo " deploy directory exists, cleaning..."
cd $OA4MP_SERVER_DEPLOY || exit
rm -Rf *
fi
if [[ $? -ne 0 ]] ; then
echo "could not create clean directories in $OA4MP_SERVER_DEPLOY"
exit 1
fi
# next line is so the profiles for the tools can be found in the source and built.
OA2_TOOLS=$OA4MP_ROOT/server-admin
cd $OA4MP_ROOT || exit
mvn clean install > maven.log
if [[ $? -ne 0 ]] ; then
echo "OA4MP build failed, see $OA4MP_ROOT/maven.log"
exit 1
fi
echo " ... done!"
cp $OA4MP_ROOT/client-oauth2/target/client2.war $OA4MP_CLIENT_DEPLOY
# cp $OA4MP_ROOT/client-oauth2/src/main/resources/*.sql $OA4MP_CLIENT_DEPLOY
cp $OA4MP_ROOT/oa4mp-server-oauth2/target/oauth2.war $OA4MP_SERVER_DEPLOY
QDL_OA2_TOOLS=$OA4MP_ROOT/qdl
echo "building OA4MP tools..."
cd $OA2_TOOLS || exit
mvn -P cli package > cli.log
if [[ $? -ne 0 ]] ; then
echo "could not build cli, see $OA2_TOOLS/cli.log"
exit 1
fi
#mvn -P client package > client.log
#if [[ $? -ne 0 ]] ; then
# echo "could not build client, see client.log"
# exit 1
#fi
mvn -P jwt package > jwt.log
if [[ $? -ne 0 ]] ; then
echo "could not build jwt, see $OA2_TOOLS/jwt.log"
exit 1
fi
mvn -P migrate package > migrate.log
if [[ $? -ne 0 ]] ; then
echo "could not build migrate, see $OA2_TOOLS/migrate.log"
exit 1
fi
cd $OA2_TOOLS/target || exit
echo " deploying OA4MP tools..."
cp cli-jar-with-dependencies.jar $OA4MP_SERVER_DEPLOY/cli.jar
cp jwt-jar-with-dependencies.jar $OA4MP_SERVER_DEPLOY/jwt.jar
cp migrate-jar-with-dependencies.jar $OA4MP_SERVER_DEPLOY/fs-migrate.jar
echo "building OA4MP server installer..."
cd $OA4MP_ROOT/server-installer || exit
mvn -P installer package > server-installer.log
if [[ $? -ne 0 ]] ; then
echo "could not build server-installer. See $OA4MP_ROOT/server-installer/server-installer.log"
exit 1
fi
cp target/server-installer-jar-with-dependencies.jar $OA4MP_SERVER_DEPLOY/server-installer.jar
echo "building OA4MP client installer..."
cd $OA4MP_ROOT/client-installer || exit
mvn -P installer package > client-installer.log
if [[ $? -ne 0 ]] ; then
echo "could not build client-installer. See $OA4MP_ROOT/client-installer/client-installer.log"
exit 1
fi
cp target/client-installer-jar-with-dependencies.jar $OA4MP_SERVER_DEPLOY/client-installer.jar
echo "building QDL OA4MP tools..."
cd $QDL_OA2_TOOLS || exit
mvn -P client package > tools.log
if [[ $? -ne 0 ]] ; then
echo "could not build QDL tools, see $QDL_OA2_TOOLS/tools.log"
exit 1
fi
cd target
cp clc-jar-with-dependencies.jar $OA4MP_SERVER_DEPLOY/clc.jar
cd $OA2_TOOLS/src/main/resources
cp *.sql $OA4MP_SERVER_DEPLOY
cp oa4mp-message.template $OA4MP_SERVER_DEPLOY
cp oa4mp-subject.template $OA4MP_SERVER_DEPLOY
cd $OA2_TOOLS/src/main/scripts
if [ -f oidc-cm-scripts.tar ]
then
rm oidc-cm-scripts.tar
fi
tar cf oidc-cm-scripts.tar oidc-cm-scripts/
if [ -f jwt-scripts.tar ]
then
rm jwt-scripts.tar
fi
tar cf jwt-scripts.tar jwt-scripts/
cp cli $OA4MP_SERVER_DEPLOY
cp clc $OA4MP_SERVER_DEPLOY
cp oidc-cm-scripts.tar $OA4MP_SERVER_DEPLOY
cp jwt-scripts.tar $OA4MP_SERVER_DEPLOY
echo " ... done!"