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