From 07e7e01c76be20640ddc3770d7b16e87eedf20de Mon Sep 17 00:00:00 2001 From: George Barnett Date: Thu, 4 Jul 2019 18:47:21 +0100 Subject: [PATCH] Check jq is available before checking API breakages (#1058) * Check jq is available before checking API breakages Motivation: If jq wasn't installed the API breakage script would erronesouly say that there were no breaking API changes. That's pretty bad. Modifications: Check jq is available before running the check. Updated the usage message to specify that a Swift 5.1+ toolchain is required. Result: More correctness. --- scripts/check_no_api_breakages.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/check_no_api_breakages.sh b/scripts/check_no_api_breakages.sh index 222b96a89..8586bd147 100755 --- a/scripts/check_no_api_breakages.sh +++ b/scripts/check_no_api_breakages.sh @@ -47,8 +47,15 @@ function build_and_do() { function usage() { echo >&2 "Usage: $0 REPO-GITHUB-URL NEW-VERSION OLD-VERSIONS..." echo >&2 - echo >&2 "Example: " + echo >&2 "This script requires a Swift 5.1+ toolchain." + echo >&2 + echo >&2 "Examples:" + echo >&2 + echo >&2 "Check between master and tag 2.1.1 of swift-nio:" echo >&2 " $0 https://github.com/apple/swift-nio master 2.1.1" + echo >&2 + echo >&2 "Check between HEAD and commit 64cf63d7 using the provided toolchain:" + echo >&2 " xcrun --toolchain org.swift.5120190702a $0 ../some-local-repo HEAD 64cf63d7" } if [[ $# -lt 3 ]]; then @@ -56,6 +63,7 @@ if [[ $# -lt 3 ]]; then exit 1 fi +hash jq 2> /dev/null || { echo >&2 "ERROR: jq must be installed"; exit 1; } tmpdir=$(mktemp -d /tmp/.check-api_XXXXXX) repo_url=$1 new_tag=$2