forked from Splendit/simonykees
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildMavenPlugin.sh
More file actions
executable file
·120 lines (95 loc) · 2.81 KB
/
buildMavenPlugin.sh
File metadata and controls
executable file
·120 lines (95 loc) · 2.81 KB
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
#!/bin/bash
## bash script for building the jsparrow-maven-plugins
function usage() {
cat <<EOF
Usage: $0 [-t] [-o] [-p]
where:
-t run tests while building (will not apply if -o is selected as well)
-o enable proguard obfuscated build
-p use productive values for netlicensing
EOF
exit 0
}
TEST=false
OBFUSCATION=false
PRODUCTION=false
# parse arguments
while getopts ":top" option
do
case "${option}" in
t) TEST=true;;
o) OBFUSCATION=true;;
p) PRODUCTION=true;;
?) usage;;
esac
done
JSPARROW_TARGET_PATH="releng/eu.jsparrow.product/target/repository/plugins"
PLUGIN_RESOURCES_PATH="jsparrow-maven-plugin/src/main/resources"
MANIFEST_FILE_NAME="manifest.standalone"
echo "Building jSparrow"
PARAMETERS=
if [ $TEST = false ]; then
PARAMETERS="$PARAMETERS -DskipTests"
fi
if [ $OBFUSCATION = true ]; then
PARAMETERS="$PARAMETERS -Dproguard"
fi
if [ $PRODUCTION = true ]; then
PARAMETERS="$PARAMETERS -Dproduction"
fi
# build jsparrow
mvn clean verify $PARAMETERS
# check maven result and exit if necessary
if [ $? -ne 0 ]; then
echo "maven on jsparrow failed!"
exit 1
fi
# create jsparrow maven plugin resource directory if it doesn't exist
if [ ! -d $PLUGIN_RESOURCES_PATH ]; then
mkdir -p $PLUGIN_RESOURCES_PATH
if [ $? -ne 0 ]; then
echo "mkdir failed for $PLUGIN_RESOURCES_PATH!"
exit 2
fi
else
rm -rf $PLUGIN_RESOURCES_PATH/*
if [ $? -ne 0 ]; then
echo "error removing files from $PLUGIN_RESOURCES_PATH"
exit 6
fi
fi
echo "Copying Resource Files"
# copy all dependencies form jsparrow into the maven plugin's resources
cp $JSPARROW_TARGET_PATH/* $PLUGIN_RESOURCES_PATH
if [ $? -ne 0 ]; then
echo "copying files from $JSPARROW_TARGET_PATH to $PLUGIN_RESOURCES_PATH failed!"
exit 3
fi
echo "Creating $MANIFEST_FILE_NAME"
# list the contents of the build jsparrow plugins and redirect it to the necessary manifest.standalone in the maven plugins
ls $JSPARROW_TARGET_PATH > $PLUGIN_RESOURCES_PATH/$MANIFEST_FILE_NAME
# build and install the jsparrow-maven-plugin
cd jsparrow-maven-plugin
echo "Building jSparrow Maven Plugin"
mvn clean install $PARAMETERS
if [ $? -ne 0 ]; then
echo "maven on jSparrow maven plugin failed!"
exit 5
fi
echo
echo "Plugin dependency to copy:"
# get the artifact version of the jsparrow-maven-plugin
MVN_VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
cat <<EOF
<plugin>
<groupId>eu.jsparrow</groupId>
<artifactId>jsparrow-maven-plugin</artifactId>
<version>${MVN_VERSION}</version>
</plugin>
EOF
echo
echo "Execution example:"
echo "mvn jsparrow:refactor -DdefaultConfiguration"
echo
echo "Example without adding dependencies:"
echo "mvn eu.jsparrow:jsparrow-maven-plugin:${MVN_VERSION}:refactor -DdefaultConfiguration"