From a2f3e8124aae7137b5273633748077ded01d0c51 Mon Sep 17 00:00:00 2001 From: Dima Spivak Date: Mon, 27 Jun 2016 15:18:04 -0700 Subject: [PATCH] HBASE-16129 check_compatibility.sh is broken when using Java API Compliance Checker v1.7 * This commit also fixes some stray tabs that got into the script at some point. --- dev-support/check_compatibility.sh | 40 ++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/dev-support/check_compatibility.sh b/dev-support/check_compatibility.sh index 1745172..8190a50 100755 --- a/dev-support/check_compatibility.sh +++ b/dev-support/check_compatibility.sh @@ -70,12 +70,15 @@ Options: -f, --force-download Download dependencies (i.e. Java ACC), even if they are already present. -h, --help Show this screen. + -j, --java-acc Specify which version of Java ACC to use to run the analysis. This + can be a tag, branch, or commit hash. Defaults to 1.6 (see + HBASE-16129). -n, --no-checkout Run the tool without first using Git to checkout the two HBase versions. If this option is selected, - dev-support/target/compatibility/1 and - dev-support/target compatibility/2 must each be Git repositories. - Also note that the references must still be specified as these are - used when naming the compatibility report. + dev-support/target/compatibility/1 and + dev-support/target compatibility/2 must each be Git repositories. + Also note that the references must still be specified as these are + used when naming the compatibility report. -o , --options= A comma-separated list of options to pass directly to Java ACC. -q, --quick Runs Java ACC in quick analysis mode, which disables a number of checks for things that may break compatibility. @@ -97,6 +100,10 @@ if ! ARG_LIST=$(${GETOPT} -q -o abfhno:qr:s \ fi eval set -- "${ARG_LIST[@]}" +# Set defaults for options in case they're not specified on the command line. +JAVA_ACC_COMMIT="1.6" +REPO_URL="https://github.com/apache/hbase.git" + while ((${#})); do case "${1}" in -a | --all ) @@ -111,6 +118,9 @@ while ((${#})); do -h | --help ) usage exit 0 ;; + -j | --java-acc ) + JAVA_ACC_COMMIT="${2}" + shift 2 ;; -n | --no-checkout ) NO_CHECKOUT=true shift 1 ;; @@ -133,12 +143,12 @@ while ((${#})); do shift 1 # If there is one positional argument, only was specified. if [ ${#} -eq 1 ]; then - COMMIT[1]="${1}" - COMMIT[2]=master - shift 1 + COMMIT[1]="${1}" + COMMIT[2]=master + shift 1 # If there are two positional arguments, and were both specified. elif [ ${#} -eq 2 ]; then - COMMIT[1]="${1}" + COMMIT[1]="${1}" COMMIT[2]="${2}" shift 2 # If there are no positional arguments or too many, someone needs to reread the usage @@ -151,9 +161,6 @@ while ((${#})); do esac done -# Set defaults for options if they're not specified on the command line. -REPO_URL=${REPO_URL:-https://github.com/apache/hbase.git} - # Do identical operations for both HBase versions in a for loop to save some lines of code. for ref in 1 2; do if ! [ "${NO_CHECKOUT}" ]; then @@ -165,8 +172,8 @@ for ref in 1 2; do if [ "${ref}" = "1" ]; then echo "Cloning ${REPO_URL} into ${SCRIPT_DIRECTORY}/target/compatibility/${ref}..." if ! git clone ${REPO_URL} ${SCRIPT_DIRECTORY}/target/compatibility/${ref}; then - echo "Error while cloning ${REPO_URL}. Exiting..." >&2 - exit 2 + echo "Error while cloning ${REPO_URL}. Exiting..." >&2 + exit 2 fi elif [ "${ref}" = "2" ]; then # Avoid cloning from Git twice by copying first repo into different folder. @@ -215,7 +222,7 @@ for ref in 1 2; do JARS=$(find ${SCRIPT_DIRECTORY}/target/compatibility/${ref} "${JAR_FIND_EXPRESSION[@]}") if [ ${#JARS[@]} -eq 0 ]; then - echo "Unable to find any JARs matching the find expression. Exiting..." >&2 + echo "Unable to find any JARs matching the find expression. Exiting..." >&2 exit 2 fi @@ -234,8 +241,7 @@ for ref in 1 2; do JARS[${ref}]=$(paste -s -d , <(echo "${JARS}")) done -# Download the Java API Compliance Checker (Java ACC) v. 1.7 (see HBASE-16073) into -# /dev-support/target/compatibility. +# Download the Java API Compliance Checker (Java ACC) into /dev-support/target/compatibility. # Note: Java API Compliance Checker (Java ACC) is licensed under the GNU GPL or LGPL. For more # information, visit http://ispras.linuxbase.org/index.php/Java_API_Compliance_Checker . @@ -243,7 +249,7 @@ done if [ ! -d ${SCRIPT_DIRECTORY}/target/compatibility/javaACC ] || [ -n "${FORCE_DOWNLOAD}" ]; then echo "Downloading Java API Compliance Checker..." rm -rf ${SCRIPT_DIRECTORY}/target/compatibility/javaACC - if ! git clone https://github.com/lvc/japi-compliance-checker.git -b 1.7 \ + if ! git clone https://github.com/lvc/japi-compliance-checker.git -b "${JAVA_ACC_COMMIT}" \ ${SCRIPT_DIRECTORY}/target/compatibility/javaACC; then echo "Failed to download Java API Compliance Checker. Exiting..." >&2 exit 2 -- 2.5.4 (Apple Git-61)