Skip to content

Commit a79a4bc

Browse files
committed
move to_bool() into build_utils.sh
1 parent 7331a3e commit a79a4bc

File tree

3 files changed

+21
-42
lines changed

3 files changed

+21
-42
lines changed

build_nativescript.sh

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,6 @@
22
set -e
33
source "$(dirname "$0")/build_utils.sh"
44

5-
function to_bool() {
6-
local arg="$1"
7-
case "$(echo "$arg" | tr '[:upper:]' '[:lower:]')" in
8-
[0-9]+)
9-
if [ $arg -eq 0 ]; then
10-
echo false
11-
else
12-
echo true
13-
fi
14-
;;
15-
n|no|f|false) echo false ;;
16-
y|yes|t|true) echo true ;;
17-
* )
18-
if [ -n "$arg" ]; then
19-
echo "warning: invalid boolean argument ('$arg'). Expected true or false" >&2
20-
fi
21-
echo false
22-
;;
23-
esac;
24-
}
25-
265
BUILD_CATALYST=$(to_bool ${BUILD_CATALYST:=false}) # disable by default for now
276
BUILD_IPHONE=$(to_bool ${BUILD_IPHONE:=true})
287
BUILD_SIMULATOR=$(to_bool ${BUILD_SIMULATOR:=true})

build_tklivesync.sh

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,6 @@
22
set -e
33
source "$(dirname "$0")/build_utils.sh"
44

5-
function to_bool() {
6-
local arg="$1"
7-
case "$(echo "$arg" | tr '[:upper:]' '[:lower:]')" in
8-
[0-9]+)
9-
if [ $arg -eq 0 ]; then
10-
echo false
11-
else
12-
echo true
13-
fi
14-
;;
15-
n|no|f|false) echo false ;;
16-
y|yes|t|true) echo true ;;
17-
* )
18-
if [ -n "$arg" ]; then
19-
echo "warning: invalid boolean argument ('$arg'). Expected true or false" >&2
20-
fi
21-
echo false
22-
;;
23-
esac;
24-
}
25-
265
BUILD_CATALYST=$(to_bool ${BUILD_CATALYST:=true})
276
BUILD_IPHONE=$(to_bool ${BUILD_IPHONE:=true})
287
BUILD_SIMULATOR=$(to_bool ${BUILD_SIMULATOR:=true})

build_utils.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,27 @@ set -e
66
# source "$(dirname "$0")/build_utils.sh"
77
#
88

9+
function to_bool() {
10+
local arg="$1"
11+
case "$(echo "$arg" | tr '[:upper:]' '[:lower:]')" in
12+
[0-9]+)
13+
if [ $arg -eq 0 ]; then
14+
echo false
15+
else
16+
echo true
17+
fi
18+
;;
19+
n|no|f|false) echo false ;;
20+
y|yes|t|true) echo true ;;
21+
* )
22+
if [ -n "$arg" ]; then
23+
echo "warning: invalid boolean argument ('$arg'). Expected true or false" >&2
24+
fi
25+
echo false
26+
;;
27+
esac;
28+
}
29+
930
# Prints a timestamp + title for a step/section
1031
function checkpoint {
1132
local delimiter="--------------------------------------------------------------------------------"

0 commit comments

Comments
 (0)