forked from jacoco/jacoco
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.sh
executable file
·94 lines (83 loc) · 2.34 KB
/
.travis.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
#!/bin/bash
set -euo pipefail
# Prevent accidental execution outside of Travis:
if [ -z "${TRAVIS+false}" ]
then
echo "TRAVIS environment variable is not set"
exit 1
fi
# Switch to desired JDK, download if required:
function install_jdk {
JDK_URL=$1
FILENAME="${JDK_URL##*/}"
rm -rf /tmp/jdk/$JDK
mkdir -p /tmp/jdk/$JDK
if [ ! -f "/tmp/jdk/$FILENAME" ]
then
curl -L $JDK_URL -o /tmp/jdk/$FILENAME
fi
tar -xzf /tmp/jdk/$FILENAME -C /tmp/jdk/$JDK --strip-components 1
if [ -z "${2+false}" ]
then
export JAVA_HOME="/tmp/jdk/$JDK"
export JDK_HOME="${JAVA_HOME}"
export JAVAC="${JAVA_HOME}/bin/javac"
export PATH="${JAVA_HOME}/bin:${PATH}"
fi
}
source $HOME/.jdk_switcher_rc
case "$JDK" in
5)
install_jdk $JDK5_URL false
;;
6)
jdk_switcher use openjdk6
;;
7|8)
jdk_switcher use oraclejdk${JDK}
;;
8-ea)
install_jdk $JDK8_EA_URL
;;
9-ea)
install_jdk $JDK9_EA_URL
;;
esac
# Do not use "~/.mavenrc" set by Travis (https://github.com/travis-ci/travis-ci/issues/3893),
# because it prevents execution of JaCoCo during integration tests for jacoco-maven-plugin,
# and "-XMaxPermSize" not supported by JDK 9
export MAVEN_SKIP_RC=true
# Build:
# TODO(Godin): see https://github.com/jacoco/jacoco/issues/300 about "bytecode.version"
case "$JDK" in
5)
if [[ ${TRAVIS_PULL_REQUEST} == 'false' && ${TRAVIS_BRANCH} == 'master' ]]
then
# goal "deploy:deploy" used directly instead of "deploy" phase to avoid pollution of Maven repository by "install" phase
mvn -V -B -e -f org.jacoco.build verify deploy:deploy -DdeployAtEnd -Djdk.version=1.5 --toolchains=./.travis/toolchains.xml --settings=./.travis/settings.xml
python ./.travis/trigger-site-deployment.py
else
mvn -V -B -e verify -Djdk.version=1.5 --toolchains=./.travis/toolchains.xml
fi
;;
6)
mvn -V -B -e verify -Dbytecode.version=1.6
;;
7)
mvn -V -B -e verify -Dbytecode.version=1.7
;;
8 | 8-ea)
mvn -V -B -e verify -Dbytecode.version=1.8
;;
9-ea)
# see https://bugs.openjdk.java.net/browse/JDK-8131041 about "java.locale.providers"
# TODO(Godin): maven-javadoc-plugin doesn't work well due to modularization of JDK 9 - skip it and hence distribution
mvn -V -B -e verify -Dbytecode.version=1.9 \
-Dmaven.javadoc.skip -pl !jacoco \
-DargLine=-Djava.locale.providers=JRE,SPI
;;
*)
echo "Incorrect JDK [$JDK]"
exit 1;
;;
esac