Skip to content

Commit 5894657

Browse files
authored
feat(websockets): visionOS and catalyst support (#18)
* feat(websockets): visionOS support * ci: select xcode 15.4 * chore: add pre-built versions * fix: visionos device and catalyst target
1 parent b8734fb commit 5894657

File tree

38 files changed

+1493
-7
lines changed

38 files changed

+1493
-7
lines changed

.github/workflows/lint-and-build.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ env:
66

77
on:
88
push:
9-
branches: [ "master" ]
9+
branches: ['master']
1010
pull_request:
11-
branches: [ "master" ]
11+
branches: ['master']
1212

1313
jobs:
1414
lint:
@@ -47,6 +47,16 @@ jobs:
4747
- uses: nrwl/nx-set-shas@v2
4848
with:
4949
main-branch-name: 'master'
50+
- name: Xcode Select Version
51+
# see available xcode versions in https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#xcode
52+
uses: mobiledevops/xcode-select-version-action@v1
53+
with:
54+
xcode-select-version: 15.4
55+
- name: Install visionOS platform
56+
run: |
57+
defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES
58+
defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES
59+
xcodebuild -downloadPlatform visionOS
5060
- name: yarn install
5161
run: yarn --immutable
5262
- name: Build.all affected

packages/nativescript-websockets/native-src/ios/NativeScriptWebSockets.xcodeproj/project.pbxproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,12 @@
366366
MARKETING_VERSION = 1.0;
367367
PRODUCT_BUNDLE_IDENTIFIER = "com.valor-software.NativeScriptWebSockets";
368368
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
369+
SDKROOT = "";
369370
SKIP_INSTALL = YES;
371+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
372+
SUPPORTS_MACCATALYST = YES;
370373
SWIFT_EMIT_LOC_STRINGS = YES;
371-
TARGETED_DEVICE_FAMILY = "1,2";
374+
TARGETED_DEVICE_FAMILY = "1,2,7";
372375
};
373376
name = Debug;
374377
};
@@ -392,9 +395,12 @@
392395
MARKETING_VERSION = 1.0;
393396
PRODUCT_BUNDLE_IDENTIFIER = "com.valor-software.NativeScriptWebSockets";
394397
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
398+
SDKROOT = "";
395399
SKIP_INSTALL = YES;
400+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
401+
SUPPORTS_MACCATALYST = YES;
396402
SWIFT_EMIT_LOC_STRINGS = YES;
397-
TARGETED_DEVICE_FAMILY = "1,2";
403+
TARGETED_DEVICE_FAMILY = "1,2,7";
398404
};
399405
name = Release;
400406
};

packages/nativescript-websockets/native-src/ios/build.sh

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,62 @@ xcodebuild \
3535
SKIP_INSTALL=NO \
3636
-quiet
3737

38+
echo "Build for Mac Catalyst"
39+
xcodebuild \
40+
-project $PACKAGENAME.xcodeproj \
41+
-scheme $PACKAGENAME \
42+
-configuration Release \
43+
-destination "platform=macOS,variant=Mac Catalyst" \
44+
clean build \
45+
BUILD_DIR=$OUTPUTPATH \
46+
CODE_SIGN_IDENTITY="" \
47+
CODE_SIGNING_REQUIRED=NO \
48+
SKIP_INSTALL=NO \
49+
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
50+
-quiet
51+
52+
echo "Build for visionos device"
53+
xcodebuild \
54+
-project $PACKAGENAME.xcodeproj \
55+
-scheme $PACKAGENAME \
56+
-configuration Release \
57+
-destination "generic/platform=visionOS" \
58+
clean build \
59+
BUILD_DIR=$OUTPUTPATH \
60+
SKIP_INSTALL=NO \
61+
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
62+
-quiet
63+
64+
echo "Build for visionos simulator"
65+
xcodebuild \
66+
-project $PACKAGENAME.xcodeproj \
67+
-scheme $PACKAGENAME \
68+
-sdk xrsimulator \
69+
-configuration Release \
70+
clean build \
71+
BUILD_DIR=$OUTPUTPATH \
72+
-destination "generic/platform=xrsimulator" \
73+
EXCLUDED_ARCHS="i386 x86_64" \
74+
CODE_SIGN_IDENTITY="" \
75+
CODE_SIGNING_REQUIRED=NO \
76+
SKIP_INSTALL=NO \
77+
-quiet
78+
3879
echo "Creating XCFramework"
3980
xcodebuild \
4081
-create-xcframework \
4182
-framework $OUTPUTPATH/Release-iphoneos/$PACKAGENAME.framework \
4283
-debug-symbols $OUTPUTPATH/Release-iphoneos/$PACKAGENAME.framework.dSYM \
4384
-framework $OUTPUTPATH/Release-iphonesimulator/$PACKAGENAME.framework \
4485
-debug-symbols $OUTPUTPATH/Release-iphonesimulator/$PACKAGENAME.framework.dSYM \
86+
-framework $OUTPUTPATH/Release-maccatalyst/$PACKAGENAME.framework \
87+
-debug-symbols $OUTPUTPATH/Release-maccatalyst/$PACKAGENAME.framework.dSYM \
88+
-framework $OUTPUTPATH/Release-xros/$PACKAGENAME.framework \
89+
-debug-symbols $OUTPUTPATH/Release-xros/$PACKAGENAME.framework.dSYM \
90+
-framework $OUTPUTPATH/Release-xrsimulator/$PACKAGENAME.framework \
91+
-debug-symbols $OUTPUTPATH/Release-xrsimulator/$PACKAGENAME.framework.dSYM \
4592
-output $OUTPUTPATH/$PACKAGENAME.xcframework
4693

47-
4894
mkdir -p $COPYPATH
49-
rm -rf $COPYPATH/$PACKAGENAME.xcframework
50-
cp -R $OUTPUTPATH/$PACKAGENAME.xcframework $COPYPATH/
95+
rm -rf $COPYPATH/$PACKAGENAME.xcframework
96+
cp -R $OUTPUTPATH/$PACKAGENAME.xcframework $COPYPATH/

packages/nativescript-websockets/platforms/ios/NativeScriptWebSockets.xcframework/Info.plist

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@
2020
<key>SupportedPlatform</key>
2121
<string>ios</string>
2222
</dict>
23+
<dict>
24+
<key>BinaryPath</key>
25+
<string>NativeScriptWebSockets.framework/Versions/A/NativeScriptWebSockets</string>
26+
<key>DebugSymbolsPath</key>
27+
<string>dSYMs</string>
28+
<key>LibraryIdentifier</key>
29+
<string>ios-arm64-maccatalyst</string>
30+
<key>LibraryPath</key>
31+
<string>NativeScriptWebSockets.framework</string>
32+
<key>SupportedArchitectures</key>
33+
<array>
34+
<string>arm64</string>
35+
</array>
36+
<key>SupportedPlatform</key>
37+
<string>ios</string>
38+
<key>SupportedPlatformVariant</key>
39+
<string>maccatalyst</string>
40+
</dict>
2341
<dict>
2442
<key>BinaryPath</key>
2543
<string>NativeScriptWebSockets.framework/NativeScriptWebSockets</string>
@@ -39,6 +57,40 @@
3957
<key>SupportedPlatformVariant</key>
4058
<string>simulator</string>
4159
</dict>
60+
<dict>
61+
<key>BinaryPath</key>
62+
<string>NativeScriptWebSockets.framework/NativeScriptWebSockets</string>
63+
<key>DebugSymbolsPath</key>
64+
<string>dSYMs</string>
65+
<key>LibraryIdentifier</key>
66+
<string>xros-arm64</string>
67+
<key>LibraryPath</key>
68+
<string>NativeScriptWebSockets.framework</string>
69+
<key>SupportedArchitectures</key>
70+
<array>
71+
<string>arm64</string>
72+
</array>
73+
<key>SupportedPlatform</key>
74+
<string>xros</string>
75+
</dict>
76+
<dict>
77+
<key>BinaryPath</key>
78+
<string>NativeScriptWebSockets.framework/NativeScriptWebSockets</string>
79+
<key>DebugSymbolsPath</key>
80+
<string>dSYMs</string>
81+
<key>LibraryIdentifier</key>
82+
<string>xros-arm64-simulator</string>
83+
<key>LibraryPath</key>
84+
<string>NativeScriptWebSockets.framework</string>
85+
<key>SupportedArchitectures</key>
86+
<array>
87+
<string>arm64</string>
88+
</array>
89+
<key>SupportedPlatform</key>
90+
<string>xros</string>
91+
<key>SupportedPlatformVariant</key>
92+
<string>simulator</string>
93+
</dict>
4294
</array>
4395
<key>CFBundlePackageType</key>
4496
<string>XFWK</string>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Headers
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Modules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/NativeScriptWebSockets
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/PrivateHeaders
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Resources
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// NativeScriptWebSockets.h
3+
// NativeScriptWebSockets
4+
//
5+
// Created by Eduardo Speroni on 2/25/22.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
//! Project version number for NativeScriptWebSockets.
11+
FOUNDATION_EXPORT double NativeScriptWebSocketsVersionNumber;
12+
13+
//! Project version string for NativeScriptWebSockets.
14+
FOUNDATION_EXPORT const unsigned char NativeScriptWebSocketsVersionString[];
15+
16+
// In this header, you should import all the public headers of your framework using statements like #import <NativeScriptWebSockets/PublicHeader.h>
17+
18+
#import "RCTSRWebSocket.h"

0 commit comments

Comments
 (0)