Skip to content

Commit

Permalink
fix(scripts): Move toml out of prelude to avoid catch-22
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarth committed Feb 1, 2024
1 parent 7053eac commit 2876d4c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 20 deletions.
11 changes: 0 additions & 11 deletions scripts/_prelude.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,4 @@ print_action() {

print_warning() {
printf "\n${YELLOW}$1${DEFAULT}\n"
}

# Check if toml-cli is installed
if ! command -v toml &> /dev/null; then
echo -e "${RED}toml (toml-cli) is not installed. Please install it to continue.${DEFAULT}"
exit 1
fi

# Function to read value from TOML file and remove quotes
read_toml() {
toml get "$1" "$2" | tr -d '"'
}
11 changes: 11 additions & 0 deletions scripts/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
# Source the script prelude
source "scripts/_prelude.sh"

# Check if toml-cli is installed
if ! command -v toml &> /dev/null; then
echo -e "${RED}toml (toml-cli) is not installed. Please install it to continue.${DEFAULT}"
exit 1
fi

# Function to read value from TOML file and remove quotes
read_toml() {
toml get "$1" "$2" | tr -d '"'
}

# Check if a configuration file was passed as an argument
if [ "$#" -ne 1 ]; then
echo -e "\n${RED}Usage: $0 path/to/config.toml${DEFAULT}"
Expand Down
11 changes: 11 additions & 0 deletions scripts/build_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
# Source the script prelude
source "scripts/_prelude.sh"

# Check if toml-cli is installed
if ! command -v toml &> /dev/null; then
echo -e "${RED}toml (toml-cli) is not installed. Please install it to continue.${DEFAULT}"
exit 1
fi

# Function to read value from TOML file and remove quotes
read_toml() {
toml get "$1" "$2" | tr -d '"'
}

# Check if a configuration file was passed as an argument
if [ "$#" -ne 1 ]; then
echo -e "\n${RED}Usage: $0 path/to/config.toml${DEFAULT}"
Expand Down
9 changes: 0 additions & 9 deletions scripts/prepare_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,4 @@ else
echo "uniffi-bindgen already installed, skipping."
fi

# Install toml-cli binary
print_action "[config] Installing toml-cli..."
if ! command -v toml &> /dev/null
then
cargo install toml-cli
else
echo "toml already installed, skipping."
fi

print_action "Done! Please run ./scripts/buld_ios.sh to build for iOS."
11 changes: 11 additions & 0 deletions scripts/update_bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
# Source the script prelude
source "scripts/_prelude.sh"

# Check if toml-cli is installed
if ! command -v toml &> /dev/null; then
echo -e "${RED}toml (toml-cli) is not installed. Please install it to continue.${DEFAULT}"
exit 1
fi

# Function to read value from TOML file and remove quotes
read_toml() {
toml get "$1" "$2" | tr -d '"'
}

# NOTE: This is quite noisy so turning off by default
# Coloring the -x output (commands)
DEBUG_COLOR="${DEFAULT}"
Expand Down

0 comments on commit 2876d4c

Please sign in to comment.