From ae7a09efe91c729faf97c0cff2aa993148c6f52b Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Wed, 16 Feb 2022 09:34:44 +0100 Subject: [PATCH 1/3] Support incremental maven builds in PTL `mvn install` is typically faster than `mvn clean install`, but it leaves previous launcher jar in the target/. Let bin/ptl pick it up nicely. This also prevents the script from picking up a way-too-old launcher jar, i.e. after project version change. --- .../trino-product-tests-launcher/bin/run-launcher | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/testing/trino-product-tests-launcher/bin/run-launcher b/testing/trino-product-tests-launcher/bin/run-launcher index 0966606826ee..78dec8e85106 100755 --- a/testing/trino-product-tests-launcher/bin/run-launcher +++ b/testing/trino-product-tests-launcher/bin/run-launcher @@ -1,17 +1,12 @@ #!/usr/bin/env bash target="${BASH_SOURCE%/*/*}/target" -launcher_jar=( "${target}"/trino-product-tests-launcher-*-executable.jar ) -if test "${#launcher_jar[@]}" -ne 1; then - echo "Found ${#launcher_jar[@]} launcher jars in ${target}: ${launcher_jar[*]}" >&2 - echo "Run \`./mvnw clean install -pl :trino-product-tests-launcher\`" >&2 - exit 3 -fi +trino_version=$(./mvnw -B help:evaluate -Dexpression=pom.version -q -DforceStdout) +launcher_jar="${target}/trino-product-tests-launcher-${trino_version}-executable.jar" -if ! test -x "${launcher_jar[0]}"; then - # Most likely `*` glob was not expanded, file does not exist - echo "Could not find launcher jar in ${target}." >&2 +if ! test -x "${launcher_jar}"; then + echo "Could not find launcher jar ${launcher_jar}." >&2 echo "Run \`./mvnw clean install -pl :trino-product-tests-launcher\`" >&2 exit 3 fi From 6926f03735f0c85df9316818ba372a96d824b543 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Fri, 18 Feb 2022 14:53:39 +0100 Subject: [PATCH 2/3] Support mvnd in PTL --- .../trino-product-tests-launcher/bin/run-launcher | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/testing/trino-product-tests-launcher/bin/run-launcher b/testing/trino-product-tests-launcher/bin/run-launcher index 78dec8e85106..1935d2b62097 100755 --- a/testing/trino-product-tests-launcher/bin/run-launcher +++ b/testing/trino-product-tests-launcher/bin/run-launcher @@ -2,12 +2,20 @@ target="${BASH_SOURCE%/*/*}/target" -trino_version=$(./mvnw -B help:evaluate -Dexpression=pom.version -q -DforceStdout) +if command -v mvnd >/dev/null; then + # Using mvnd here can save more than 2 seconds compared to ./mvnw startup cost. This is especially important + # when invoking inspection commands like --help, env list, etc. + trino_version=$(mvnd -B help:evaluate -Dexpression=pom.version -q -DforceStdout --raw-streams) + mvn="mvnd" +else + trino_version=$(./mvnw -B help:evaluate -Dexpression=pom.version -q -DforceStdout) + mvn="./mvnw" +fi launcher_jar="${target}/trino-product-tests-launcher-${trino_version}-executable.jar" if ! test -x "${launcher_jar}"; then echo "Could not find launcher jar ${launcher_jar}." >&2 - echo "Run \`./mvnw clean install -pl :trino-product-tests-launcher\`" >&2 + echo "Run \`${mvn} clean install -pl :trino-product-tests-launcher\`" >&2 exit 3 fi From 8ee584306ef829906e8818530ff5494d984a5016 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Fri, 18 Feb 2022 14:53:59 +0100 Subject: [PATCH 3/3] Suggest skipping tests when building launcher jar --- testing/trino-product-tests-launcher/bin/run-launcher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/trino-product-tests-launcher/bin/run-launcher b/testing/trino-product-tests-launcher/bin/run-launcher index 1935d2b62097..81e84cb898de 100755 --- a/testing/trino-product-tests-launcher/bin/run-launcher +++ b/testing/trino-product-tests-launcher/bin/run-launcher @@ -15,7 +15,7 @@ launcher_jar="${target}/trino-product-tests-launcher-${trino_version}-executable if ! test -x "${launcher_jar}"; then echo "Could not find launcher jar ${launcher_jar}." >&2 - echo "Run \`${mvn} clean install -pl :trino-product-tests-launcher\`" >&2 + echo "Run \`${mvn} clean install -pl :trino-product-tests-launcher -DskipTests\`" >&2 exit 3 fi