-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·83 lines (74 loc) · 1.77 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
#!/bin/bash
if [ ! -e node_modules ]
then
mkdir node_modules
fi
case `uname -s` in
MINGW*)
USER_UID=1000
GROUP_UID=1000
;;
*)
if [ -z ${USER_UID:+x} ]
then
USER_UID=`id -u`
GROUP_GID=`id -g`
fi
esac
clean () {
docker-compose run --rm -u "$USER_UID:$GROUP_GID" gradle gradle clean
}
#buildNode () {
# case `uname -s` in
# MINGW*)
# docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "npm install --no-bin-links && node_modules/gulp/bin/gulp.js build"
# ;;
# *)
# docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "npm install && node_modules/gulp/bin/gulp.js build"
# esac
#}
buildGradle () {
docker-compose run --rm -u "$USER_UID:$GROUP_GID" gradle gradle shadowJar install publishToMavenLocal
}
testGradle() {
docker-compose run --rm -u "$USER_UID:$GROUP_GID" gradle gradle test --no-build-cache --rerun-tasks
}
publish () {
if [ -e "?/.gradle" ] && [ ! -e "?/.gradle/gradle.properties" ]
then
echo "odeUsername=$NEXUS_ODE_USERNAME" > "?/.gradle/gradle.properties"
echo "odePassword=$NEXUS_ODE_PASSWORD" >> "?/.gradle/gradle.properties"
echo "sonatypeUsername=$NEXUS_SONATYPE_USERNAME" >> "?/.gradle/gradle.properties"
echo "sonatypePassword=$NEXUS_SONATYPE_PASSWORD" >> "?/.gradle/gradle.properties"
fi
docker-compose run --rm -u "$USER_UID:$GROUP_GID" gradle gradle publish
}
for param in "$@"
do
case $param in
clean)
clean
;;
# buildNode)
# buildNode
# ;;
buildGradle)
buildGradle
;;
install)
# buildNode && buildGradle
buildGradle
;;
publish)
publish
;;
testGradle)
testGradle
;;
*)
echo "Invalid argument : $param"
esac
if [ ! $? -eq 0 ]; then
exit 1
fi
done