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