From 994d432d140ce3108a2d93b8442b3c24aea07def Mon Sep 17 00:00:00 2001 From: Andrew Meyer Date: Tue, 6 Feb 2024 13:18:02 +0000 Subject: [PATCH] Lint the shell script --- .../realm/scripts/download-or-build-ios.sh | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/realm/scripts/download-or-build-ios.sh b/packages/realm/scripts/download-or-build-ios.sh index 4e8166d5aab..8f5cf6a82da 100755 --- a/packages/realm/scripts/download-or-build-ios.sh +++ b/packages/realm/scripts/download-or-build-ios.sh @@ -6,19 +6,18 @@ set -o pipefail # Start in the root directory of the project. cd "$(dirname "$0")/.." -REALM_BUILD_CORE="false" -PROJECT_ROOT=$PODS_TARGET_SRCROOT -BINDGEN_PATH=$PROJECT_ROOT/bindgen -BINDING_PATH=$PROJECT_ROOT/binding +REALM_BUILD_CORE=false +PROJECT_ROOT="$PODS_TARGET_SRCROOT" +BINDGEN_PATH="$PROJECT_ROOT/bindgen" -pushd $PROJECT_ROOT/react-native/ios +pushd "$PROJECT_ROOT/react-native/ios" # Should we wipe this directory first? mkdir -p build pushd build # Get core version -CORE_VERSION=v$(grep "^VERSION=" $BINDGEN_PATH/vendor/realm-core/dependencies.list | cut -d '=' -f2) +CORE_VERSION=v$(grep "^VERSION=" "$BINDGEN_PATH/vendor/realm-core/dependencies.list" | cut -d '=' -f2) TAR_FILE_NAME=realm-Release-$CORE_VERSION-$PLATFORM_NAME-devel.tar.gz # There are only Release builds available on the CDN @@ -27,7 +26,7 @@ CDN_URL="https://static.realm.io/downloads/core/$CORE_VERSION/$PLATFORM_NAME/Rel # Check if URL is valid and reachable if ! curl --output /dev/null --silent --head --fail "$CDN_URL"; then echo "URL $CDN_URL is not valid or reachable." - REALM_BUILD_CORE = "true" + REALM_BUILD_CORE=true fi if [ "$REALM_BUILD_CORE" == "true" ]; then @@ -39,12 +38,12 @@ if [ "$REALM_BUILD_CORE" == "true" ]; then pushd "$PROJECT_ROOT/bindgen/vendor/realm-core" # The `env` call here ensures the environment variables are correctly derived. Without this, the c/c++ compilers will not be found by cmake, when invoked from xcode - env -i PATH=$PATH DEVELOPER_DIR=$DEVELOPER_DIR ./tools/build-apple-device.sh -p $PLATFORM_NAME -c $CONFIGURATION -v $CORE_VERSION -f -DREALM_BUILD_LIB_ONLY=1 - cp -R _CPack_Packages/$PLATFORM_NAME/TGZ/realm-$CONFIGURATION-$CORE_VERSION-$PLATFORM_NAME/devel/* $PROJECT_ROOT/react-native/ios/build + env -i PATH="$PATH" DEVELOPER_DIR="$DEVELOPER_DIR" ./tools/build-apple-device.sh -p "$PLATFORM_NAME" -c "$CONFIGURATION" -v "$CORE_VERSION" -f -DREALM_BUILD_LIB_ONLY=1 + cp -R "_CPack_Packages/$PLATFORM_NAME/TGZ/realm-$CONFIGURATION-$CORE_VERSION-$PLATFORM_NAME/devel/*" "$PROJECT_ROOT/react-native/ios/build" popd else # Download core prebuild and extract - curl -o $TAR_FILE_NAME $CDN_URL + curl -o "$TAR_FILE_NAME" "$CDN_URL" # Check if the download was successful if [ -f "$TAR_FILE_NAME" ]; then # Extract the contents @@ -67,6 +66,6 @@ find . -type f -name "*-dbg*" | while read -r file; do done # Overwite the linked vendored libraries -cp *.a ../../lib +cp ./*.a ../../lib popd