-
Notifications
You must be signed in to change notification settings - Fork 64
/
test
executable file
·43 lines (37 loc) · 1.26 KB
/
test
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
#!/bin/bash -e
cd "$(dirname "$0")"
TOP_PROJ_DIR="$PWD"
BUILD_SRC_DIR="$PWD/src/build"
# Determine the version of os-maven-plugin so that we pass it when running tests.
if [[ "$(./mvnw initialize)" =~ (Building os-maven-plugin ([-.0-9a-zA-Z]+)) ]]; then
PLUGIN_VER=${BASH_REMATCH[2]}
else
echo 'Failed to determine the version of os-maven-plugin'
exit 1
fi
# Install the project to the local Maven repository
# so that the test projects can refer to it.
./mvnw clean install
for MVN_VER in '3.1.1' '3.2.5' '3.3.9' '3.5.3'; do
echo "Testing os-maven-plugin-$PLUGIN_VER against Maven $MVN_VER"
# Create a test project.
PROJ_DIR="$(mktemp -d)"
pushd "$PROJ_DIR"
mvn -N io.takari:maven:wrapper -Dmaven=$MVN_VER
cp "$BUILD_SRC_DIR/test-pom.xml" pom.xml
# Ensure that the test project is using the correct Maven version.
if [[ "$(./mvnw --version)" =~ (Apache Maven ([.0-9]+)) ]]; then
ACTUAL_MVN_VER=${BASH_REMATCH[2]}
else
echo 'Failed to determine the version of Maven'
exit 1
fi
if [[ "$ACTUAL_MVN_VER" != "$MVN_VER" ]]; then
echo "Mismatching Maven version: $ACTUAL_MVN_VER (expected: $MVN_VER)"
exit 1
fi
# Run the test and clean up.
./mvnw "-Dos-maven-plugin.version=$PLUGIN_VER" test
popd>/dev/null
rm -fr "$PROJ_DIR"
done