Skip to content

Commit 4eb43b3

Browse files
committed
more
1 parent 271d1f9 commit 4eb43b3

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

scripts/setup_quickstart_spm.sh

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,21 @@ setup_quickstart_repo() {
7979
# QUICKSTART_REPO is not set, so clone it.
8080
quickstart_dir="quickstart-ios"
8181
if [[ -d "${quickstart_dir}" ]]; then
82-
echo "Quickstart repository already exists at ${quickstart_dir}"
82+
echo "Quickstart repository already exists at ${quickstart_dir}" >&2
8383
else
84-
echo "Cloning quickstart repository into '${quickstart_dir}' directory..."
84+
echo "Cloning quickstart repository into '${quickstart_dir}' directory..." >&2
8585
# Do a partial, sparse clone to speed up CI. See
8686
# https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
8787
git clone --filter=blob:none --sparse https://github.com/firebase/quickstart-ios.git "${quickstart_dir}"
8888
fi
8989
(
9090
cd "${quickstart_dir}"
91-
echo "Ensuring sparse checkout is set for ${sample_name}..."
91+
echo "Ensuring sparse checkout is set for ${sample_name}..." >&2
9292
# Checkout the sample and config directories.
9393
git sparse-checkout set "${sample_name}" config
9494
)
9595
fi
96+
# Return the absolute path to the quickstart directory.
9697
(cd "$quickstart_dir" && pwd)
9798
}
9899

@@ -149,13 +150,18 @@ main() {
149150
local sample="$1"
150151
local release_testing="${2-}"
151152

152-
if [[ -n "${release_testing}" && \
153-
"${release_testing}" != "${NIGHTLY_RELEASE_TESTING}" && \
154-
"${release_testing}" != "${PRERELEASE_TESTING}" ]]; then
155-
echo "Error: Invalid testing_mode: '${release_testing}'" >&2
156-
print_usage
157-
exit 1
158-
fi
153+
# Validate release_testing argument.
154+
case "$release_testing" in
155+
"" | "${NIGHTLY_RELEASE_TESTING}" | "${PRERELEASE_TESTING}")
156+
# This is a valid value (or empty), so do nothing.
157+
;;
158+
*)
159+
# This is an invalid value.
160+
echo "Error: Invalid testing_mode: '${release_testing}'" >&2
161+
print_usage
162+
exit 1
163+
;;
164+
esac
159165

160166
# --- Environment Setup and Validation ---
161167
# Enable trace mode if DEBUG is set to 'true'
@@ -200,15 +206,11 @@ main() {
200206
fi
201207
local project_file="${project_files[0]}"
202208

203-
# The update script needs an absolute path to the project file.
204-
local absolute_project_file
205-
absolute_project_file="$(cd "$(dirname "$project_file")" && pwd)/$(basename "$project_file")"
206-
207209
# NOTE: Uncomment below and replace `{BRANCH_NAME}` for testing a branch of
208210
# the quickstart repo.
209211
# (cd "$quickstart_dir"; git checkout {BRANCH_NAME})
210212

211-
update_spm_dependency "$release_testing" "$absolute_project_file"
213+
update_spm_dependency "$release_testing" "$project_file"
212214
}
213215

214216
# Run the main function with all provided arguments.

0 commit comments

Comments
 (0)