-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·124 lines (96 loc) · 3.14 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
# #!/bin/bash
# # TODO: Add in the application you will write below. That will be a folder under this current working directory
# APPS=""
# # First ensure dependencies loaded since .m2 may be empty
# mvn dependency:tree -Ddetail=true
# mvn help:evaluate -Dexpression=project.version
# # Clean repo from builds
# ./clean.sh
# #
# # Config
# #
# APP_VERSION_FILE=./app.version
# THEUSER=$(/usr/bin/whoami)
# NOW=$(date "+%Y%m%d%H%M%S")
# APP_MAVEN_VERSION=$(mvn help:evaluate -Dexpression=project.version | grep -e '^[^\[]')
# APP_GIT_VERSION=$(git rev-parse --abbrev-ref HEAD)
# APP_VERSION=${APP_MAVEN_VERSION}-${APP_GIT_VERSION}_${NOW}_${THEUSER}
# echo ${APP_VERSION} > ${APP_VERSION_FILE}
# echo "LOCALLY building runtime to local folder: ./build ..."
# echo "Version = ${APP_VERSION}"
# if [ ! -f "${APP_VERSION_FILE}" ]; then
# echo "APP Version file DOES NOT exist. CANNOT proceed with build."
# exit 1
# fi
# #
# # Config
# #
# APP_VERSION=$(cat ${APP_VERSION_FILE})
# #mvn test
# mvn install -Dmaven.test.skip=true
# mvn package -N -P classpath-deps -Dmaven.test.skip=true
# # Package runtimes with compiled and built libraries
# for APP in $APPS
# do
# echo "Building $APP ..."
# cd ./$APP
# ./build_app.sh
# echo "Built $APP"
# cd ..
# done
# #echo "Copying job scripts for at scheduling to build/app/ ..."
# #cp ./cicd/deploy.sh ./build/app/
# #cp ./app/opt/start_app.sh ./build/app/
# #echo "Done."
# echo "Done building APP."
#!/bin/bash
# TODO: Add in the application you will write below. That will be a folder under this current working directory
APPS="server"
# First ensure dependencies loaded since .m2 may be empty
mvn dependency:tree -Ddetail=true
mvn help:evaluate -Dexpression=project.version
# Clean repo from builds
./clean.sh
#
# Config
#
THEUSER=$(/usr/bin/whoami)
NOW=$(date "+%Y%m%d%H%M%S")
APP_MAVEN_VERSION=$(mvn help:evaluate -Dexpression=project.version | grep -e '^[^\[]')
APP_GIT_VERSION=$(git rev-parse --abbrev-ref HEAD)
RESOURCES_DIR=./server/src/main/resources
APP_PROP_FILE=${RESOURCES_DIR}/application.properties
APP_TEMPLATE_PROP_FILE=${RESOURCES_DIR}/application.properties-template
APP_VERSION_FILE=./app.version
APP_VERSION=${APP_MAVEN_VERSION}-${APP_GIT_VERSION}_${NOW}_${THEUSER}
echo ${APP_VERSION} > ${APP_VERSION_FILE}
[ -e ${APP_PROP_FILE} ] && rm ${APP_PROP_FILE}
cat ${APP_TEMPLATE_PROP_FILE} | sed -e "s/FULLAPPBUILDNUM/${APP_VERSION}/g" \
| sed -e "s/MVNVERSION/${APP_MAVEN_VERSION}/g" > ${APP_PROP_FILE}
echo "LOCALLY building runtime to local folder: ./build ..."
echo "Version = ${APP_VERSION}"
if [ ! -f "${APP_VERSION_FILE}" ]; then
echo "APP Version file DOES NOT exist. CANNOT proceed with build."
exit 1
fi
#
# Config
#
APP_VERSION=$(cat ${APP_VERSION_FILE})
#mvn test
mvn install -Dmaven.test.skip=true
mvn package -N -P classpath-deps -Dmaven.test.skip=true
# Package runtimes with compiled and built libraries
#for APP in $APPS
#do
# echo "Building $APP ..."
# cd ./$APP
# ./build_app.sh
# echo "Built $APP"
# cd ..
#done
#echo "Copying job scripts for at scheduling to build/app/ ..."
#cp ./cicd/deploy.sh ./build/app/
#cp ./app/opt/start_app.sh ./build/app/
#echo "Done."
echo "Done building APP."