5 |
|
|
6 |
|
set -eux |
7 |
|
|
8 |
< |
declare -a MAKE_FLAGS=() TMP_FILES=() |
8 |
> |
declare -a MAKE_FLAGS=() DOWNLOADED_MAVEN_JARS=() |
9 |
> |
|
10 |
> |
die() { printf "%s: $1\n" "$0" "${@:2}" >&2; exit 2; } |
11 |
|
|
12 |
|
def_make_var() { |
13 |
|
typeset -n varref="$1" |
16 |
|
} |
17 |
|
|
18 |
|
def_make_file() { |
19 |
< |
[[ -f "$2" ]] |
19 |
> |
[[ -f "$2" ]] || die "%s: no such file" "$2" |
20 |
|
def_make_var "$@" |
21 |
|
} |
22 |
|
|
23 |
|
def_make_dir() { |
24 |
< |
[[ -d "$2" ]] |
24 |
> |
[[ -d "$2" ]] || die "%s: no such directory" "$2" |
25 |
|
def_make_var "$@" |
26 |
|
} |
27 |
|
|
28 |
|
download_ubuntu() { |
29 |
< |
local -r pkg="$1" |
30 |
< |
wget -q "http://us.archive.ubuntu.com/ubuntu/pool/universe/${pkg:0:1}/${pkg}" |
29 |
> |
local -r pkg="$1" |
30 |
> |
wget -q "http://us.archive.ubuntu.com/ubuntu/pool/universe/${pkg:0:1}/${pkg}" |
31 |
|
} |
32 |
|
|
33 |
|
download_maven_jar() { |
36 |
|
wget -qO"/tmp/$jarfile" \ |
37 |
|
"http://search.maven.org/remotecontent?filepath=${groupId}/${artifactId}/${version}/${jarfile}" |
38 |
|
def_make_file "${artifactId^^}_JAR" "/tmp/$jarfile" |
39 |
< |
TMP_FILES+=("/tmp/$jarfile") |
39 |
> |
DOWNLOADED_MAVEN_JARS+=("/tmp/$jarfile") |
40 |
|
} |
41 |
|
|
42 |
|
main() { |
43 |
|
[[ "$PWD" =~ /lib-src$ ]] || { echo Always run as ./build-jtreg; exit 1; } |
44 |
< |
TESTNG_VERSION="6.9.8" |
44 |
> |
TESTNG_VERSION="6.9.9" |
45 |
|
rm -rf "/tmp/testng-$TESTNG_VERSION"*; mkdir "/tmp/testng-$TESTNG_VERSION" |
46 |
|
def_make_dir TESTNG_HOME "/tmp/testng-$TESTNG_VERSION" |
47 |
|
|
48 |
< |
download_maven_jar "junit" "junit" "4.10" |
49 |
< |
download_maven_jar "org/testng" "testng" "$TESTNG_VERSION" |
50 |
< |
download_maven_jar "com/beust" "jcommander" "1.48" |
49 |
< |
|
48 |
> |
# Download a mostly unused testng distribution, because jtreg's |
49 |
> |
# makefiles want both TESTNG_JAR and TESTNG_HOME. |
50 |
> |
# https://github.com/cbeust/testng/releases |
51 |
|
rm -rf "/tmp/${TESTNG_VERSION}.tar.gz" "/tmp/${TESTNG_VERSION}" |
52 |
|
wget -qO"/tmp/testng-${TESTNG_VERSION}.tar.gz" \ |
53 |
|
"https://github.com/cbeust/testng/archive/${TESTNG_VERSION}.tar.gz" |
57 |
|
rm -f "/tmp/testng-${TESTNG_VERSION}.tar.gz" |
58 |
|
) |
59 |
|
|
60 |
+ |
download_maven_jar "junit" "junit" "4.10" |
61 |
+ |
download_maven_jar "org/testng" "testng" "$TESTNG_VERSION" |
62 |
+ |
download_maven_jar "com/beust" "jcommander" "1.48" |
63 |
+ |
|
64 |
|
rm -rf jtharness-4.6; rm -f ./*jtharness*4.6* |
65 |
|
download_ubuntu "jtharness/jtharness_4.6-1.debian.tar.xz" |
66 |
|
download_ubuntu "jtharness/jtharness_4.6-1.dsc" |
110 |
|
def_make_file JAVATEST_JAR "$(find $EXTRACT/ -name javatest.jar)" |
111 |
|
def_make_file JAVAHELP_JAR "$(find $EXTRACT/ -name jh.jar)" |
112 |
|
|
113 |
+ |
# asmtools is optional, but let's build it for completeness. |
114 |
+ |
# asmtools project doesn't seem to have releases; we'll grab tip. |
115 |
+ |
# hg clone http://hg.openjdk.java.net/code-tools/asmtools |
116 |
+ |
rm -rf "asmtools" "asmtools-"*"-build" |
117 |
+ |
wget -qO- "http://hg.openjdk.java.net/code-tools/asmtools/archive/tip.tar.gz" > "asmtools.tar.gz" |
118 |
+ |
tar xzf "asmtools.tar.gz" |
119 |
+ |
mv "asmtools-"*[0-9a-f][0-9a-f][0-9a-f] "asmtools" |
120 |
+ |
(cd asmtools/build && ant build) |
121 |
+ |
def_make_dir ASMTOOLS_HOME "$PWD/asmtools-"*"-build/release" |
122 |
+ |
|
123 |
|
# hg clone http://hg.openjdk.java.net/code-tools/jtreg |
124 |
< |
def_make_var BUILD_NUMBER "b05" |
124 |
> |
def_make_var BUILD_NUMBER "b08" |
125 |
|
JTREG_REV="jtreg4.2-${BUILD_NUMBER}" |
126 |
|
rm -rf "jtreg" "$JTREG_REV" "$JTREG_REV.tar.gz" |
127 |
|
wget -q "http://hg.openjdk.java.net/code-tools/jtreg/archive/$JTREG_REV.tar.gz" |
128 |
|
tar xzf "$JTREG_REV.tar.gz" |
129 |
+ |
rm "$JTREG_REV.tar.gz" |
130 |
|
mv "jtreg-$JTREG_REV" "jtreg" |
131 |
|
|
132 |
|
def_make_dir JDK17HOME "$HOME/jdk/jdk7" |
139 |
|
|
140 |
|
cp jtreg/build/images/jtreg/lib/*.jar ../jsr166/lib/. |
141 |
|
|
142 |
< |
# Clean up intermediate artifacts |
143 |
< |
rm -rf jtreg extract "${TMP_FILES[@]}" "$JTHARNESS_HOME" "$TESTNG_HOME" |
142 |
> |
# As a side effect, save a general purpose jtreg "distribution". |
143 |
> |
rsync -a jtreg/build/images/jtreg/ "${JTREG_REV#jtreg}/" |
144 |
> |
|
145 |
> |
# Clean up intermediate artifacts. |
146 |
> |
# asmtools creates a bogus index.html |
147 |
> |
rm -rf asmtools asmtools-*-build index.html \ |
148 |
> |
jtreg extract "${DOWNLOADED_MAVEN_JARS[@]}" \ |
149 |
> |
"$JTHARNESS_HOME" "$TESTNG_HOME" |
150 |
|
|
151 |
|
exit 0 |
152 |
|
} |