--- lib-src/build-jtreg 2017/04/15 01:58:32 1.4 +++ 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" @@ -136,7 +141,8 @@ main() { # 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 }