Skip to content

Commit

Permalink
chore: update build script to improve ci time and fix output messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vivianjeng authored and oskarth committed Nov 9, 2023
1 parent aa64467 commit 450f9c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
13 changes: 6 additions & 7 deletions scripts/build_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ elif [[ "$1" == "device" ]]; then
DEVICE_TYPE="device"
ARCHITECTURE="aarch64-apple-ios"
else
echo -e "${RED}Error: Please specify either 'simulator' or 'device' as the first argument.${DEFAULT}"
echo -e "${RED}Error: Please specify either 'x86_64', 'simulator' or 'device' as the first argument.${DEFAULT}"
exit 1
fi

Expand All @@ -35,12 +35,11 @@ fi

# build circom circuits in mopro-core
cd ${PROJECT_DIR}/mopro-core
cargo build --release

# build ffi in mopro-ffi
cd ${PROJECT_DIR}/mopro-ffi
make
cargo build --release
if [[ "$BUILD_MODE" == "debug" ]]; then
cargo build
elif [[ "$BUILD_MODE" == "release" ]]; then
cargo build --release
fi

# build MoproKit pods
cd ${PROJECT_DIR}/mopro-ios/MoproKit/Example
Expand Down
19 changes: 12 additions & 7 deletions scripts/update_bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ elif [[ "$1" == "device" ]]; then
DEVICE_TYPE="device"
ARCHITECTURE="aarch64-apple-ios"
else
echo -e "${RED}Error: Please specify either 'simulator' or 'device' as the first argument.${DEFAULT}"
echo -e "${RED}Error: Please specify either 'x86_64', 'simulator' or 'device' as the first argument.${DEFAULT}"
exit 1
fi

Expand All @@ -73,7 +73,7 @@ else
exit 1
fi

print_action "Updating mopro-ffi bindings and library (${BUILD_MODE} ${DEVICE_TYPE})..."
print_action "Updating mopro-ffi bindings and library ($BUILD_MODE $DEVICE_TYPE)..."

PROJECT_DIR=$(pwd)
TARGET_DIR=${PROJECT_DIR}/target
Expand All @@ -82,18 +82,23 @@ MOPROKIT_DIR=${PROJECT_DIR}/mopro-ios/MoproKit
print_action "Generating Swift bindings..."
uniffi-bindgen generate ${PROJECT_DIR}/mopro-ffi/src/mopro.udl --language swift --out-dir ${TARGET_DIR}/SwiftBindings

print_action "Building mopro-ffi static library (${BUILD_MODE})..."
(cd ${PROJECT_DIR}/mopro-ffi && make ${BUILD_MODE})
print_action "Building mopro-ffi static library ($BUILD_MODE)..."
cd ${PROJECT_DIR}/mopro-ffi
if [[ "$BUILD_MODE" == "debug" ]]; then
cargo build --target ${ARCHITECTURE}
elif [[ "$BUILD_MODE" == "release" ]]; then
cargo build --release --target ${ARCHITECTURE}
fi

# Print appropriate message based on device type
if [[ "$DEVICE_TYPE" == "x86_64" ]]; then
print_action "Using ${ARCHITECTURE} libmopro_ffi.a (${LIB_DIR}) static library..."
print_action "Using $ARCHITECTURE libmopro_ffi.a ($LIB_DIR) static library..."
print_warning "This only works on iOS simulator (x86_64)"
elif [[ "$DEVICE_TYPE" == "simulator" ]]; then
print_action "Using ${ARCHITECTURE} libmopro_ffi.a (${LIB_DIR}) static library..."
print_action "Using $ARCHITECTURE libmopro_ffi.a ($LIB_DIR) static library..."
print_warning "This only works on iOS simulator (ARM64)"
elif [[ "$DEVICE_TYPE" == "device" ]]; then
print_action "Using ${ARCHITECTURE} libmopro_ffi.a (${LIB_DIR}) static library..."
print_action "Using $ARCHITECTURE libmopro_ffi.a ($LIB_DIR) static library..."
print_warning "This only works on iOS devices (ARM64)"
fi

Expand Down

0 comments on commit 450f9c3

Please sign in to comment.