Merge pull request #10770 from ethereum/doc-pragma-check-special-case-for-current-dev-version

Special case for development version in doc pragma checker
This commit is contained in:
chriseth 2021-01-14 18:35:47 +01:00 committed by GitHub
commit 96ce3cf7cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 12 deletions

View File

@ -24,10 +24,12 @@ then
export TERM="${TERM:-xterm}" export TERM="${TERM:-xterm}"
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput setaf 7)"; } function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput setaf 7)"; }
function printError() { >&2 echo "$(tput setaf 1)$1$(tput setaf 7)"; } function printError() { >&2 echo "$(tput setaf 1)$1$(tput setaf 7)"; }
function printWarning() { >&2 echo "$(tput setaf 11)$1$(tput setaf 7)"; }
function printLog() { echo "$(tput setaf 3)$1$(tput setaf 7)"; } function printLog() { echo "$(tput setaf 3)$1$(tput setaf 7)"; }
else else
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput sgr0)"; } function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput sgr0)"; }
function printError() { >&2 echo "$(tput setaf 1)$1$(tput sgr0)"; } function printError() { >&2 echo "$(tput setaf 1)$1$(tput sgr0)"; }
function printWarning() { >&2 echo "$(tput setaf 11)$1$(tput sgr0)"; }
function printLog() { echo "$(tput setaf 3)$1$(tput sgr0)"; } function printLog() { echo "$(tput setaf 3)$1$(tput sgr0)"; }
fi fi

View File

@ -32,6 +32,8 @@ SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build}
source "${REPO_ROOT}/scripts/common.sh" source "${REPO_ROOT}/scripts/common.sh"
source "${REPO_ROOT}/scripts/common_cmdline.sh" source "${REPO_ROOT}/scripts/common_cmdline.sh"
developmentVersion=$("$REPO_ROOT/scripts/get_version.sh")
function versionGreater() function versionGreater()
{ {
v1=$1 v1=$1
@ -54,7 +56,7 @@ function versionGreater()
function versionEqual() function versionEqual()
{ {
if [ "$1" == "$2" ] if [[ "$1" == "$2" ]]
then then
return 0 return 0
fi fi
@ -104,28 +106,23 @@ function findMinimalVersion()
fi fi
version="" version=""
for ver in "${allVersions[@]}" for ver in "${allVersions[@]}" "$developmentVersion"
do do
if versionGreater "$ver" "$pragmaVersion" if versionGreater "$ver" "$pragmaVersion"
then then
version="$ver" version="$ver"
break break
elif ([ $greater == false ]) && versionEqual "$ver" "$pragmaVersion" elif [[ "$greater" == false ]] && versionEqual "$ver" "$pragmaVersion"
then then
version="$ver" version="$ver"
break break
fi fi
done done
if [ -z "$version" ] if [[ "$version" == "" ]]
then then
if [[ "$greater" = true && "$pragmaVersion" =~ 99 ]] printError "No release ${sign}${pragmaVersion} was listed in available releases!"
then exit 1
printError "Skipping version check for pragma: $pragmaVersion"
else
printError "No release $sign$pragmaVersion was listed in available releases!"
exit 1
fi
fi fi
} }
@ -161,10 +158,15 @@ SOLTMPDIR=$(mktemp -d)
opts="$opts -o" opts="$opts -o"
findMinimalVersion $f findMinimalVersion $f
if [ -z "$version" ] if [[ "$version" == "" ]]
then then
continue continue
fi fi
if [[ "$version" == "$developmentVersion" ]]
then
printWarning "Skipping unreleased development version $developmentVersion"
continue
fi
opts="$opts -v $version" opts="$opts -v $version"