--- lib-src/build-jtreg 2017/01/20 20:29:13 1.2 +++ lib-src/build-jtreg 2017/08/20 16:03:05 1.5 @@ -5,7 +5,9 @@ set -eux -declare -a MAKE_FLAGS=() TMP_FILES=() +declare -a MAKE_FLAGS=() DOWNLOADED_MAVEN_JARS=() + +die() { printf "%s: $1\n" "$0" "${@:2}" >&2; exit 2; } def_make_var() { typeset -n varref="$1" @@ -14,18 +16,18 @@ def_make_var() { } def_make_file() { - [[ -f "$2" ]] + [[ -f "$2" ]] || die "%s: no such file" "$2" def_make_var "$@" } def_make_dir() { - [[ -d "$2" ]] + [[ -d "$2" ]] || die "%s: no such directory" "$2" def_make_var "$@" } download_ubuntu() { - local -r pkg="$1" - wget -q "http://us.archive.ubuntu.com/ubuntu/pool/universe/${pkg:0:1}/${pkg}" + local -r pkg="$1" + wget -q "http://us.archive.ubuntu.com/ubuntu/pool/universe/${pkg:0:1}/${pkg}" } download_maven_jar() { @@ -34,7 +36,7 @@ download_maven_jar() { wget -qO"/tmp/$jarfile" \ "http://search.maven.org/remotecontent?filepath=${groupId}/${artifactId}/${version}/${jarfile}" def_make_file "${artifactId^^}_JAR" "/tmp/$jarfile" - TMP_FILES+=("/tmp/$jarfile") + DOWNLOADED_MAVEN_JARS+=("/tmp/$jarfile") } main() { @@ -43,10 +45,9 @@ main() { rm -rf "/tmp/testng-$TESTNG_VERSION"*; mkdir "/tmp/testng-$TESTNG_VERSION" def_make_dir TESTNG_HOME "/tmp/testng-$TESTNG_VERSION" - download_maven_jar "junit" "junit" "4.10" - download_maven_jar "org/testng" "testng" "$TESTNG_VERSION" - download_maven_jar "com/beust" "jcommander" "1.48" - + # Download a mostly unused testng distribution, because jtreg's + # makefiles want both TESTNG_JAR and TESTNG_HOME. + # https://github.com/cbeust/testng/releases rm -rf "/tmp/${TESTNG_VERSION}.tar.gz" "/tmp/${TESTNG_VERSION}" wget -qO"/tmp/testng-${TESTNG_VERSION}.tar.gz" \ "https://github.com/cbeust/testng/archive/${TESTNG_VERSION}.tar.gz" @@ -56,6 +57,10 @@ main() { rm -f "/tmp/testng-${TESTNG_VERSION}.tar.gz" ) + download_maven_jar "junit" "junit" "4.10" + download_maven_jar "org/testng" "testng" "$TESTNG_VERSION" + download_maven_jar "com/beust" "jcommander" "1.48" + rm -rf jtharness-4.6; rm -f ./*jtharness*4.6* download_ubuntu "jtharness/jtharness_4.6-1.debian.tar.xz" download_ubuntu "jtharness/jtharness_4.6-1.dsc" @@ -105,8 +110,18 @@ main() { def_make_file JAVATEST_JAR "$(find $EXTRACT/ -name javatest.jar)" def_make_file JAVAHELP_JAR "$(find $EXTRACT/ -name jh.jar)" + # asmtools is optional, but let's build it for completeness. + # asmtools project doesn't seem to have releases; we'll grab tip. + # hg clone http://hg.openjdk.java.net/code-tools/asmtools + rm -rf "asmtools" "asmtools-"*"-build" + wget -qO- "http://hg.openjdk.java.net/code-tools/asmtools/archive/tip.tar.gz" > "asmtools.tar.gz" + tar xzf "asmtools.tar.gz" + mv "asmtools-"*[0-9a-f][0-9a-f][0-9a-f] "asmtools" + (cd asmtools/build && ant build) + def_make_dir ASMTOOLS_HOME "$PWD/asmtools-"*"-build/release" + # hg clone http://hg.openjdk.java.net/code-tools/jtreg - def_make_var BUILD_NUMBER "b05" + def_make_var BUILD_NUMBER "b07" JTREG_REV="jtreg4.2-${BUILD_NUMBER}" rm -rf "jtreg" "$JTREG_REV" "$JTREG_REV.tar.gz" wget -q "http://hg.openjdk.java.net/code-tools/jtreg/archive/$JTREG_REV.tar.gz" @@ -124,7 +139,10 @@ main() { cp jtreg/build/images/jtreg/lib/*.jar ../jsr166/lib/. # Clean up intermediate artifacts - rm -rf jtreg extract "${TMP_FILES[@]}" "$JTHARNESS_HOME" "$TESTNG_HOME" + # asmtools creates a bogus index.html + rm -rf asmtools asmtools-*-build index.html \ + jtreg extract "${DOWNLOADED_MAVEN_JARS[@]}" \ + "$JTHARNESS_HOME" "$TESTNG_HOME" exit 0 }