Skip to content

Commit

Permalink
Lint the shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Feb 6, 2024
1 parent 78b3ae7 commit 994d432
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/realm/scripts/download-or-build-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit 994d432

Please sign in to comment.