Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Commit

Permalink
changed usage-check in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
devjgm committed Aug 2, 2019
1 parent 6ca0d62 commit a50c95c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bazel/compiler_id.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# identification string for the compiler according to the CMake-defined IDs:
# https://cmake.org/cmake/help/v3.5/variable/CMAKE_LANG_COMPILER_ID.html

if [[ ! -e "${1}" ]]; then
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <path-to-compiler>"
exit 1
fi
Expand Down
12 changes: 10 additions & 2 deletions bazel/compiler_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@
# the compiler's version by looking for the first string that looks like
# X.Y with more optional numbers, '.', '-', and '+'.

if [[ ! -e "${1}" ]]; then
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <path-to-compiler>"
exit 1
fi

"${1}" --version 2> /dev/null | grep -Eo "[0-9]+\.[0-9.+-]+" | head -1
version="$("${1}" --version 2> /dev/null \
| grep -Eo "[0-9]+\.[0-9.+-]+" \
| head -1)"

if [[ -n "${version}" ]]; then
echo "${version}"
else
echo unknown
fi

0 comments on commit a50c95c

Please sign in to comment.