@@ -146,53 +146,66 @@ cmake_build macos-cli
146
146
147
147
fi
148
148
149
+ # Due to inconvenient design choices on both sides, we have to choose between
150
+ # either long flags or short flags based on whether we're calling
151
+ # `xcodebuild -create-xcframework` or `scripts/build_xcframework.mts`.
152
+ if [[ " $TARGET_ENGINE " == " none" ]]; then
153
+ # Node.js parseArgs() supports short flags, but only if they're single-letter.
154
+ FRAMEWORK_FLAG=" --framework"
155
+ DSYM_FLAG=" --debug-symbols"
156
+ else
157
+ # xcodebuild doesn't implement any single-letter short flags like -f and -d.
158
+ FRAMEWORK_FLAG=" -framework"
159
+ DSYM_FLAG=" -debug-symbols"
160
+ fi
161
+
149
162
XCFRAMEWORKS=()
150
163
if $BUILD_CATALYST ; then
151
- XCFRAMEWORKS+=( --framework " $DIST /intermediates/catalyst/$CONFIG_BUILD -maccatalyst/NativeScript.framework"
152
- --debug-symbols " $DIST /intermediates/catalyst/ $CONFIG_BUILD -maccatalyst/NativeScript.framework .dSYM" )
164
+ FRAMEWORK= " $DIST /intermediates/catalyst/$CONFIG_BUILD -maccatalyst/NativeScript.framework"
165
+ XCFRAMEWORKS+=( " $FRAMEWORK_FLAG " " $FRAMEWORK " " $DSYM_FLAG " " $FRAMEWORK .dSYM" )
153
166
fi
154
167
155
168
if $BUILD_SIMULATOR ; then
156
- XCFRAMEWORKS+=( --framework " $DIST /intermediates/ios-sim/$CONFIG_BUILD -iphonesimulator/NativeScript.framework"
157
- --debug-symbols " $DIST /intermediates/ios-sim/ $CONFIG_BUILD -iphonesimulator/NativeScript.framework .dSYM" )
169
+ FRAMEWORK= " $DIST /intermediates/ios-sim/$CONFIG_BUILD -iphonesimulator/NativeScript.framework"
170
+ XCFRAMEWORKS+=( " $FRAMEWORK_FLAG " " $FRAMEWORK " " $DSYM_FLAG " " $FRAMEWORK .dSYM" )
158
171
fi
159
172
160
173
if $BUILD_IPHONE ; then
161
- XCFRAMEWORKS+=( --framework " $DIST /intermediates/ios/$CONFIG_BUILD -iphoneos/NativeScript.framework"
162
- --debug-symbols " $DIST /intermediates/ios/ $CONFIG_BUILD -iphoneos/NativeScript.framework .dSYM" )
174
+ FRAMEWORK= " $DIST /intermediates/ios/$CONFIG_BUILD -iphoneos/NativeScript.framework"
175
+ XCFRAMEWORKS+=( " $FRAMEWORK_FLAG " " $FRAMEWORK " " $DSYM_FLAG " " $FRAMEWORK .dSYM" )
163
176
fi
164
177
165
178
if $BUILD_MACOS ; then
166
- XCFRAMEWORKS+=( --framework " $DIST /intermediates/macos/$CONFIG_BUILD /NativeScript.framework"
167
- --debug-symbols " $DIST /intermediates/macos/ $CONFIG_BUILD /NativeScript.framework .dSYM" )
179
+ FRAMEWORK= " $DIST /intermediates/macos/$CONFIG_BUILD /NativeScript.framework"
180
+ XCFRAMEWORKS+=( " $FRAMEWORK_FLAG " " $FRAMEWORK " " $DSYM_FLAG " " $FRAMEWORK .dSYM" )
168
181
fi
169
182
170
183
if $BUILD_VISION ; then
171
- XCFRAMEWORKS+=( --framework " $DIST /intermediates/visionos/$CONFIG_BUILD -xros/NativeScript.framework"
172
- --debug-symbols " $DIST /intermediates/visionos/ $CONFIG_BUILD -xros/NativeScript.framework .dSYM" )
184
+ FRAMEWORK= " $DIST /intermediates/visionos/$CONFIG_BUILD -xros/NativeScript.framework"
185
+ XCFRAMEWORKS+=( " $FRAMEWORK_FLAG " " $FRAMEWORK " " $DSYM_FLAG " " $FRAMEWORK .dSYM" )
173
186
174
- XCFRAMEWORKS+=( --framework " $DIST /intermediates/visionos-sim/$CONFIG_BUILD -xros/NativeScript.framework"
175
- --debug-symbols " $DIST /intermediates/visionos-sim/ $CONFIG_BUILD -xros/NativeScript.framework .dSYM" )
187
+ FRAMEWORK= " $DIST /intermediates/visionos-sim/$CONFIG_BUILD -xros/NativeScript.framework"
188
+ XCFRAMEWORKS+=( " $FRAMEWORK_FLAG " " $FRAMEWORK " " $DSYM_FLAG " " $FRAMEWORK .dSYM" )
176
189
fi
177
190
178
191
if [[ -n " ${XCFRAMEWORKS[@]} " ]]; then
179
192
180
- checkpoint " Creating the XCFramework (NativeScript.apple.node) "
181
-
182
- # This script used to output to "$DIST/ NativeScript.xcframework".
183
- #
184
- # We now follow the react-native-node-api prebuilds standard, emitting an
185
- # XCFramework named "NativeScript.apple. node" into our
186
- # @nativescript /ios-node-api npm package. The reason we do not use .xcframework
187
- # as the file extension is that .node works better for other tooling like
188
- # Node.js. It turns out that Apple apps can link XCFrameworks just fine even if
189
- # the file extension is not .xcframework!
190
- #
191
- # The prebuilds standard is described here:
192
- # https://github.com/callstackincubator/react-native-node-api/blob/9b231c14459b62d7df33360f930a00343d8c46e6/docs/PREBUILDS.md
193
- OUTPUT_DIR= " packages/ios/build/Release/NativeScript.apple.node "
194
- rm -rf $ OUTPUT_DIR
195
- deno run -A ./scripts/build_xcframework.mts --output " $OUTPUT_DIR " ${XCFRAMEWORKS[@]}
193
+
194
+ if [[ " $TARGET_ENGINE " == " none " ]] ; then
195
+ checkpoint " Creating the XCFramework ( NativeScript.apple.node) "
196
+
197
+ # We adhere to the prebuilds standard as described here:
198
+ # https://github.com/callstackincubator/react-native- node-api/blob/9b231c14459b62d7df33360f930a00343d8c46e6/docs/PREBUILDS.md
199
+ OUTPUT_DIR= " packages /ios/build/Release/NativeScript.apple.node "
200
+ rm -rf $OUTPUT_DIR
201
+ deno run -A ./scripts/build_xcframework.mts --output " $OUTPUT_DIR " ${XCFRAMEWORKS[@]}
202
+ else
203
+ checkpoint " Creating NativeScript.xcframework "
204
+
205
+ OUTPUT_DIR= " $DIST /NativeScript.xcframework "
206
+ rm -rf $ OUTPUT_DIR
207
+ xcodebuild -create-xcframework ${XCFRAMEWORKS[@]} -output " $ OUTPUT_DIR"
208
+ fi
196
209
197
210
fi
198
211
0 commit comments