Skip to content

Commit

Permalink
Ensure that scripts don't swallow errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrahams committed Nov 13, 2023
1 parent 42dbf54 commit 84ef5af
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions scripts/carthage.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash
#!/usr/bin/env bash -e -o pipefail
#
# Needed to circumvent an issue with Carthage version < 0.37.0: https://github.com/Carthage/Carthage/issues/3019
#
# carthage.sh
# Usage example: ./carthage.sh build --platform iOS

VERSION="$(carthage version)"
"$(dirname "$0")/versions.sh" "$VERSION" "0.37.0"
comparison=$("$(dirname "$0")/versions.sh" "$VERSION" "0.37.0"; echo $?)

if [ $? -ge 0 ]; then
if [ $comparison -ge 0 ]; then
# Carthage version is greater than or equal to 0.37.0 meaning we can use the --use-xcframeworks flag
carthage "$@" --use-xcframeworks
else
Expand Down
2 changes: 1 addition & 1 deletion scripts/findproject.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash -e -o pipefail
#
# xcframework.sh
# Usage example: ./findproject.sh --project-name <project_name>
Expand Down
2 changes: 1 addition & 1 deletion scripts/printformat.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash -e -o pipefail
#
# https://gist.github.com/SomeRandomiOSDev/798406a4a15f6b5d78b010599865c04f
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/resolvepath.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash -e -o pipefail
#
# resolvepath.sh
# Usage example: ./resolvepath.sh "./some/random/path/../../"
Expand Down
2 changes: 1 addition & 1 deletion scripts/versions.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash -e -o pipefail
#
# versions.sh
# Usage example: ./versions.sh "1.4.15" "1.7.0"
Expand Down
10 changes: 5 additions & 5 deletions scripts/workflowtests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash -e -o pipefail
#
# workflowtests.sh
# Usage example: ./workflowtests.sh --no-clean
Expand Down Expand Up @@ -261,9 +261,9 @@ if which carthage >/dev/null; then
CARTHAGE_VERSION="$(carthage version)"
echo "Carthage: $CARTHAGE_VERSION"

"$SCRIPTS_DIR/versions.sh" "$CARTHAGE_VERSION" "0.37.0"
comparison=$("$SCRIPTS_DIR/versions.sh" "$CARTHAGE_VERSION" "0.37.0"; echo $?)

if [ $? -lt 0 ]; then
if [ $comparison -lt 0 ]; then
"$SCRIPTS_DIR/printformat.sh" "foreground:yellow" "Carthage version of at least 0.37.0 is recommended for running these unit tests"
fi
else
Expand All @@ -274,9 +274,9 @@ fi

if which pod >/dev/null; then
PODS_VERSION="$(pod --version)"
"$SCRIPTS_DIR/versions.sh" "$PODS_VERSION" "1.7.3"
comparison=$("$SCRIPTS_DIR/versions.sh" "$PODS_VERSION" "1.7.3"; echo $?)

if [ $? -ge 0 ]; then
if [ $comparison -ge 0 ]; then
echo "CocoaPods: $PODS_VERSION"
else
checkresult -1 "These unit tests require version 1.7.3 or later of CocoaPods: $("$SCRIPTS_DIR/printformat.sh" "foreground:blue;underline" "https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods")"
Expand Down
2 changes: 1 addition & 1 deletion scripts/xcframework.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash -e -o pipefail
#
# xcframework.sh
# Usage example: ./xcframework.sh --output <some_path>/<name>.xcframework
Expand Down

0 comments on commit 84ef5af

Please sign in to comment.