1 |
jsr166 |
1.1 |
#!/bin/bash |
2 |
|
|
# Builds jar files to run jtreg for jsr166 CVS. |
3 |
|
|
# |
4 |
|
|
# Leverages the hard work done by Ubuntu and Maven packagers |
5 |
|
|
|
6 |
|
|
set -eux |
7 |
|
|
|
8 |
|
|
declare -a MAKE_FLAGS=() TMP_FILES=() |
9 |
|
|
|
10 |
|
|
def_make_var() { |
11 |
|
|
typeset -n varref="$1" |
12 |
|
|
varref="$2" |
13 |
|
|
MAKE_FLAGS+=("$1=$2") |
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
def_make_file() { |
17 |
|
|
[[ -f "$2" ]] |
18 |
|
|
def_make_var "$@" |
19 |
|
|
} |
20 |
|
|
|
21 |
|
|
def_make_dir() { |
22 |
|
|
[[ -d "$2" ]] |
23 |
|
|
def_make_var "$@" |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
download_ubuntu() { |
27 |
|
|
local -r pkg="$1" |
28 |
|
|
wget -q "http://us.archive.ubuntu.com/ubuntu/pool/universe/${pkg:0:1}/${pkg}" |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
download_maven_jar() { |
32 |
|
|
local -r groupId="$1" artifactId="$2" version="$3" |
33 |
|
|
local -r jarfile="${artifactId}-${version}.jar" |
34 |
|
|
wget -qO"/tmp/$jarfile" \ |
35 |
|
|
"http://search.maven.org/remotecontent?filepath=${groupId}/${artifactId}/${version}/${jarfile}" |
36 |
|
|
def_make_file "${artifactId^^}_JAR" "/tmp/$jarfile" |
37 |
|
|
TMP_FILES+=("/tmp/$jarfile") |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
main() { |
41 |
|
|
[[ "$PWD" =~ /lib-src$ ]] || { echo Always run as ./build-jtreg; exit 1; } |
42 |
|
|
TESTNG_VERSION="6.9.8" |
43 |
|
|
rm -rf "/tmp/testng-$TESTNG_VERSION"*; mkdir "/tmp/testng-$TESTNG_VERSION" |
44 |
|
|
def_make_dir TESTNG_HOME "/tmp/testng-$TESTNG_VERSION" |
45 |
|
|
|
46 |
|
|
download_maven_jar "junit" "junit" "4.10" |
47 |
|
|
download_maven_jar "org/testng" "testng" "$TESTNG_VERSION" |
48 |
|
|
download_maven_jar "com/beust" "jcommander" "1.48" |
49 |
|
|
|
50 |
|
|
rm -rf "/tmp/${TESTNG_VERSION}.tar.gz" "/tmp/${TESTNG_VERSION}" |
51 |
|
|
wget -qO"/tmp/testng-${TESTNG_VERSION}.tar.gz" \ |
52 |
|
|
"https://github.com/cbeust/testng/archive/${TESTNG_VERSION}.tar.gz" |
53 |
|
|
( |
54 |
|
|
cd /tmp |
55 |
|
|
tar xzf "/tmp/testng-${TESTNG_VERSION}.tar.gz" |
56 |
|
|
rm -f "/tmp/testng-${TESTNG_VERSION}.tar.gz" |
57 |
|
|
) |
58 |
|
|
|
59 |
|
|
rm -rf jtharness-4.6; rm -f ./*jtharness*4.6* |
60 |
|
|
download_ubuntu "jtharness/jtharness_4.6-1.debian.tar.xz" |
61 |
|
|
download_ubuntu "jtharness/jtharness_4.6-1.dsc" |
62 |
|
|
download_ubuntu "jtharness/jtharness_4.6.orig.tar.xz" |
63 |
|
|
download_ubuntu "jtharness/libjtharness-java_4.6-1_all.deb" |
64 |
|
|
tar xJf "jtharness_4.6.orig.tar.xz" |
65 |
|
|
def_make_dir JTHARNESS_HOME "$PWD/jtharness-4.6" |
66 |
|
|
|
67 |
|
|
rm -f ./javahelp2*2.0.05* |
68 |
|
|
download_ubuntu "javahelp2/javahelp2_2.0.05.ds1-9.debian.tar.xz" |
69 |
|
|
download_ubuntu "javahelp2/javahelp2_2.0.05.ds1-9.dsc" |
70 |
|
|
download_ubuntu "javahelp2/javahelp2_2.0.05.ds1-9_all.deb" |
71 |
|
|
download_ubuntu "javahelp2/javahelp2_2.0.05.ds1.orig.tar.gz" |
72 |
|
|
|
73 |
|
|
|
74 |
|
|
## Currently we build jtreg from source, but get its dependencies |
75 |
|
|
## from Ubuntu or Maven Central. Below are past approaches. |
76 |
|
|
|
77 |
|
|
# rm -f ./jtreg_4.2-b03* |
78 |
|
|
# download_ubuntu "jtreg/jtreg_4.2-b03-1~16.04.debian.tar.xz" |
79 |
|
|
# download_ubuntu "jtreg/jtreg_4.2-b03-1~16.04_all.deb" |
80 |
|
|
# download_ubuntu "jtreg/jtreg_4.2-b03-1~16.04.dsc" |
81 |
|
|
# download_ubuntu "jtreg/jtreg_4.2-b03.orig.tar.gz" |
82 |
|
|
|
83 |
|
|
# rm -f ./testng*6.9* |
84 |
|
|
# download_ubuntu "testng/testng_6.9.5-1.debian.tar.xz" |
85 |
|
|
# download_ubuntu "testng/testng_6.9.5-1.dsc" |
86 |
|
|
# download_ubuntu "testng/testng_6.9.5-1_all.deb" |
87 |
|
|
# download_ubuntu "testng/testng_6.9.5.orig.tar.gz" |
88 |
|
|
|
89 |
|
|
# rm -f ./*jcommander*1.48* |
90 |
|
|
# download_ubuntu "jcommander/jcommander_1.48-1.debian.tar.xz" |
91 |
|
|
# download_ubuntu "jcommander/jcommander_1.48-1.dsc" |
92 |
|
|
# download_ubuntu "jcommander/jcommander_1.48.orig.tar.gz" |
93 |
|
|
# download_ubuntu "jcommander/libjcommander-java_1.48-1_all.deb" |
94 |
|
|
|
95 |
|
|
# rm -f ./*junit4* |
96 |
|
|
# download_ubuntu "junit4/junit4_4.12-4ubuntu1.debian.tar.xz" |
97 |
|
|
# download_ubuntu "junit4/junit4_4.12-4ubuntu1.dsc" |
98 |
|
|
# download_ubuntu "junit4/junit4_4.12-4ubuntu1_all.deb" |
99 |
|
|
# download_ubuntu "junit4/junit4_4.12.orig.tar.xz" |
100 |
|
|
|
101 |
|
|
rm -rf ./extract |
102 |
|
|
mkdir extract |
103 |
|
|
for deb in *.deb; do dpkg -x $deb extract; done |
104 |
|
|
EXTRACT="$PWD/extract" |
105 |
|
|
def_make_file JAVATEST_JAR "$(find $EXTRACT/ -name javatest.jar)" |
106 |
|
|
def_make_file JAVAHELP_JAR "$(find $EXTRACT/ -name jh.jar)" |
107 |
|
|
|
108 |
jsr166 |
1.3 |
# asmtools is optional, but let's build it for completeness. |
109 |
|
|
# asmtools project doesn't seem to have releases; we'll grab tip. |
110 |
|
|
# hg clone http://hg.openjdk.java.net/code-tools/asmtools |
111 |
|
|
rm -rf "asmtools" "asmtools-"*"-build" |
112 |
|
|
wget -qO- "http://hg.openjdk.java.net/code-tools/asmtools/archive/tip.tar.gz" > "asmtools.tar.gz" |
113 |
|
|
tar xzf "asmtools.tar.gz" |
114 |
|
|
mv "asmtools-"*[0-9a-f][0-9a-f][0-9a-f] "asmtools" |
115 |
|
|
(cd asmtools/build && ant build) |
116 |
|
|
def_make_dir ASMTOOLS_HOME "$PWD/asmtools-"*"-build/release" |
117 |
|
|
|
118 |
jsr166 |
1.1 |
# hg clone http://hg.openjdk.java.net/code-tools/jtreg |
119 |
jsr166 |
1.4 |
def_make_var BUILD_NUMBER "b07" |
120 |
jsr166 |
1.1 |
JTREG_REV="jtreg4.2-${BUILD_NUMBER}" |
121 |
|
|
rm -rf "jtreg" "$JTREG_REV" "$JTREG_REV.tar.gz" |
122 |
|
|
wget -q "http://hg.openjdk.java.net/code-tools/jtreg/archive/$JTREG_REV.tar.gz" |
123 |
|
|
tar xzf "$JTREG_REV.tar.gz" |
124 |
|
|
mv "jtreg-$JTREG_REV" "jtreg" |
125 |
|
|
|
126 |
|
|
def_make_dir JDK17HOME "$HOME/jdk/jdk7" |
127 |
|
|
def_make_dir JDK18HOME "$HOME/jdk/jdk8" |
128 |
|
|
def_make_dir JDK19HOME "$HOME/jdk/jdk9" |
129 |
|
|
|
130 |
|
|
def_make_dir ANTHOME "/usr/share/ant" |
131 |
|
|
|
132 |
|
|
make "${MAKE_FLAGS[@]}" -C "jtreg/make" clean images |
133 |
|
|
|
134 |
|
|
cp jtreg/build/images/jtreg/lib/*.jar ../jsr166/lib/. |
135 |
|
|
|
136 |
|
|
# Clean up intermediate artifacts |
137 |
jsr166 |
1.3 |
# asmtools creates a bogus index.html |
138 |
|
|
rm -rf asmtools asmtools-*-build index.html \ |
139 |
|
|
jtreg extract "${TMP_FILES[@]}" "$JTHARNESS_HOME" "$TESTNG_HOME" |
140 |
jsr166 |
1.1 |
|
141 |
|
|
exit 0 |
142 |
|
|
} |
143 |
|
|
|
144 |
|
|
main "$@" |