Skip to content

Commit 7a836a0

Browse files
Optimize iOS build process and fix xcodebuild execution.
- Increased ByteCodeTranslator heap size to 2048MB in IPhoneBuilder. - Made `pod install` conditional in IPhoneBuilder to avoid redundant execution. - Added `ios.pods.skipInstall` support. - Refactored `scripts/build-ios-app.sh` and `scripts/run-ios-ui-tests.sh` to remove `eval` and correctly handle arguments with spaces (like "iPhone 16"). - Updated scripts to support building from `.xcodeproj` when `.xcworkspace` is absent.
1 parent 00a171f commit 7a836a0

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

scripts/build-ios-app.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ done
123123

124124
if [ -n "$WORKSPACE" ]; then
125125
bia_log "Found xcworkspace: $WORKSPACE"
126-
PROJECT_ARG="-workspace \"$WORKSPACE\""
126+
BUILD_TYPE_FLAG="-workspace"
127127
OUTPUT_PATH="$WORKSPACE"
128128
else
129129
bia_log "No xcworkspace found; looking for xcodeproj"
@@ -140,7 +140,7 @@ else
140140
exit 1
141141
fi
142142
bia_log "Found xcodeproj: $PROJECT"
143-
PROJECT_ARG="-project \"$PROJECT\""
143+
BUILD_TYPE_FLAG="-project"
144144
OUTPUT_PATH="$PROJECT"
145145
fi
146146

@@ -158,6 +158,6 @@ bia_log "Emitted outputs -> workspace=$OUTPUT_PATH, scheme=HelloCodenameOne"
158158
# (Optional) dump xcodebuild -list for debugging
159159
ARTIFACTS_DIR="${ARTIFACTS_DIR:-$REPO_ROOT/artifacts}"
160160
mkdir -p "$ARTIFACTS_DIR"
161-
eval xcodebuild $PROJECT_ARG -list > "$ARTIFACTS_DIR/xcodebuild-list.txt" 2>&1 || true
161+
xcodebuild "$BUILD_TYPE_FLAG" "$OUTPUT_PATH" -list > "$ARTIFACTS_DIR/xcodebuild-list.txt" 2>&1 || true
162162

163163
exit 0

scripts/run-ios-ui-tests.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ export CN1SS_PREVIEW_DIR="$SCREENSHOT_PREVIEW_DIR"
9999

100100
# Determine build argument (workspace vs project)
101101
if [[ "$WORKSPACE_PATH" == *.xcodeproj ]]; then
102-
BUILD_ARG="-project \"$WORKSPACE_PATH\""
102+
BUILD_TYPE_FLAG="-project"
103103
# For project files, shared schemes are inside the .xcodeproj directory
104104
SCHEME_FILE="$WORKSPACE_PATH/xcshareddata/xcschemes/$SCHEME.xcscheme"
105105
else
106-
BUILD_ARG="-workspace \"$WORKSPACE_PATH\""
106+
BUILD_TYPE_FLAG="-workspace"
107107
SCHEME_FILE="$WORKSPACE_PATH/xcshareddata/xcschemes/$SCHEME.xcscheme"
108108
fi
109109

@@ -172,7 +172,7 @@ normalize_destination() {
172172
auto_select_destination() {
173173
local show_dest rc=0 best_line="" best_key="" line payload platform id name os priority key part value
174174
set +e
175-
show_dest="$(eval xcodebuild $BUILD_ARG -scheme "$SCHEME" -sdk iphonesimulator -showdestinations 2>/dev/null)"
175+
show_dest="$(xcodebuild "$BUILD_TYPE_FLAG" "$WORKSPACE_PATH" -scheme "$SCHEME" -sdk iphonesimulator -showdestinations 2>/dev/null)"
176176
rc=$?
177177
set -e
178178

@@ -356,8 +356,8 @@ BUILD_LOG="$ARTIFACTS_DIR/xcodebuild-build.log"
356356

357357
ri_log "Building simulator app with xcodebuild"
358358
COMPILE_START=$(date +%s)
359-
if ! eval xcodebuild \
360-
$BUILD_ARG \
359+
if ! xcodebuild \
360+
"$BUILD_TYPE_FLAG" "$WORKSPACE_PATH" \
361361
-scheme "$SCHEME" \
362362
-sdk iphonesimulator \
363363
-configuration Debug \
@@ -372,7 +372,7 @@ COMPILE_END=$(date +%s)
372372
COMPILATION_TIME=$((COMPILE_END - COMPILE_START))
373373
ri_log "Compilation time: ${COMPILATION_TIME}s"
374374

375-
BUILD_SETTINGS="$(eval xcodebuild $BUILD_ARG -scheme "$SCHEME" -sdk iphonesimulator -configuration Debug -showBuildSettings 2>/dev/null || true)"
375+
BUILD_SETTINGS="$(xcodebuild "$BUILD_TYPE_FLAG" "$WORKSPACE_PATH" -scheme "$SCHEME" -sdk iphonesimulator -configuration Debug -showBuildSettings 2>/dev/null || true)"
376376
TARGET_BUILD_DIR="$(printf '%s\n' "$BUILD_SETTINGS" | awk -F' = ' '/ TARGET_BUILD_DIR /{print $2; exit}')"
377377
WRAPPER_NAME="$(printf '%s\n' "$BUILD_SETTINGS" | awk -F' = ' '/ WRAPPER_NAME /{print $2; exit}')"
378378
if [ -z "$WRAPPER_NAME" ]; then

0 commit comments

Comments
 (0)