--- lib-src/build-jtreg 2017/04/15 01:58:32 1.4 +++ lib-src/build-jtreg 2018/12/14 03:55:15 1.11 @@ -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,19 +36,18 @@ 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() { [[ "$PWD" =~ /lib-src$ ]] || { echo Always run as ./build-jtreg; exit 1; } - TESTNG_VERSION="6.9.8" + TESTNG_VERSION="6.9.9" 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,11 @@ 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.72" + + # TODO: Upgrade to jtharness 5.x 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,23 +111,26 @@ main() { def_make_file JAVATEST_JAR "$(find $EXTRACT/ -name javatest.jar)" def_make_file JAVAHELP_JAR "$(find $EXTRACT/ -name jh.jar)" + hg_clone_codetools() { + local -r repo="$1" rev="$2" + rm -rf "$repo" + hg clone -r "$rev" "http://hg.openjdk.java.net/code-tools/${repo}" + rm -rf "${repo}/.hg" + tar cJf "${repo}.tar.xz" "$repo" + } + # 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) + hg_clone_codetools asmtools 7.0-b02 + rm -rf "asmtools-"*"-build" + (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 "b07" + def_make_var BUILD_NUMBER "b13" 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" - tar xzf "$JTREG_REV.tar.gz" - mv "jtreg-$JTREG_REV" "jtreg" + # Emergency release; 4.2-b13 needed for jdk13, but stock 4.2-b13 is + # broken and 4.2-b14 is not out yet. + JTREG_REV="36c592d2f544" + hg_clone_codetools jtreg "$JTREG_REV" def_make_dir JDK17HOME "$HOME/jdk/jdk7" def_make_dir JDK18HOME "$HOME/jdk/jdk8" @@ -133,10 +142,14 @@ main() { cp jtreg/build/images/jtreg/lib/*.jar ../jsr166/lib/. - # Clean up intermediate artifacts + # As a side effect, save a general purpose jtreg "distribution". + rsync -a jtreg/build/images/jtreg/ "${JTREG_REV#jtreg}/" + + # Clean up intermediate artifacts. # asmtools creates a bogus index.html rm -rf asmtools asmtools-*-build index.html \ - jtreg extract "${TMP_FILES[@]}" "$JTHARNESS_HOME" "$TESTNG_HOME" + jtreg extract "${DOWNLOADED_MAVEN_JARS[@]}" \ + "$JTHARNESS_HOME" "$TESTNG_HOME" exit 0 }