Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(visionos): support for xros platform #235

Merged
merged 70 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
24e5509
feat: visionos goodies
NathanWalker Jun 24, 2023
89c750a
feat: visionos goodies
NathanWalker Jun 25, 2023
3bb5d67
feat(vision): binaries for v8
NathanWalker Jun 26, 2023
d8e021f
chore: 8.6.0-vision.1
NathanWalker Jun 26, 2023
2739092
feat: visionos destinations
NathanWalker Jun 27, 2023
71a3b2a
feat: updated project settings
NathanWalker Jun 27, 2023
5003c27
chore: 8.6.0-vision.2
NathanWalker Jun 27, 2023
470338e
feat(visionos): don't compare systemVersion vs introducedIn for meta
NathanWalker Jun 27, 2023
07ae283
chore: 8.6.0-vision.3
NathanWalker Jun 27, 2023
67ab1af
chore: fix project template sandboxing
NathanWalker Jun 27, 2023
c9f988a
chore: 8.6.0-vision.4
NathanWalker Jun 27, 2023
3f74d10
chore: project template setup for embed boot setup versatility
NathanWalker Jul 19, 2023
f89e8b6
chore: 8.6.0-vision.6
NathanWalker Jul 19, 2023
11e450f
Merge remote-tracking branch 'origin/main' into feat/visionos-goodies
NathanWalker Sep 9, 2023
e689697
chore: shell script adjustments to cleanup build with vision
NathanWalker Sep 10, 2023
5814fce
fix: try -ld_classic to allow linking simulator slices for visionos
rigor789 Sep 10, 2023
55fa543
feat: adding USE_LEGACY_BOOT macro to control different boot types in…
NathanWalker Sep 11, 2023
c36fde2
chore: 8.6.0-vision.7
NathanWalker Sep 11, 2023
961241d
release(visionos): 8.6.0-alpha.0
NathanWalker Sep 29, 2023
714fcd9
Merge remote-tracking branch 'origin/main' into feat/visionos
NathanWalker Oct 9, 2023
7a8efe9
Merge remote-tracking branch 'origin/main' into feat/visionos
NathanWalker Jan 19, 2024
463d14c
chore: include more files in runtime template and prepare NS_DISABLE_…
NathanWalker Jan 20, 2024
5c5ee01
chore: prepare version target (not published yet)
NathanWalker Jan 20, 2024
fbba8e7
feat: split out project-template-ios and project-template-vision for …
NathanWalker Jan 20, 2024
1111636
feat: URL & URLSearchParams
triniwiz Jan 18, 2024
3b31ead
chore: rename classes, implement createObjectURL, revokeObjectURL & u…
triniwiz Jan 19, 2024
74e2ebc
chore: update classname
triniwiz Jan 19, 2024
7e24367
chore: 8.7.0-alpha.0
NathanWalker Jan 19, 2024
aaa96ed
chore: use c++17
triniwiz Jan 20, 2024
5d6f02b
chore: format tests
triniwiz Jan 20, 2024
a721865
chore: add include license
triniwiz Jan 20, 2024
69a659a
chore: format js code
triniwiz Jan 20, 2024
1ce3509
chore: use node way of binding modules
triniwiz Jan 20, 2024
4c11dab
feat: bump ios min to 13
NathanWalker Jan 24, 2024
c5ca82a
Merge remote-tracking branch 'origin/feat/ada-url-y-search-params' in…
NathanWalker Jan 31, 2024
a02f3d4
feat: arm64-xros device libs
NathanWalker Jan 31, 2024
8242a85
feat: improved isolated build setup for ios vs visionos
NathanWalker Jan 31, 2024
4a81578
chore: bump minimum targets for projects to ios 13 for ios and 17 for…
NathanWalker Jan 31, 2024
87b5530
release(ios): 9.0.0-dev.0
NathanWalker Jan 31, 2024
368a5d1
chore: ignore vision when doing ios build
NathanWalker Jan 31, 2024
288aa44
chore: remove ignored files
NathanWalker Feb 1, 2024
092043b
fix: isAvailable metadata check
NathanWalker Feb 1, 2024
73c9f62
chore: wip targeting getSystemVersion handling for metadata
NathanWalker Feb 1, 2024
0e0d1ad
fix: replace @rpath dylib with system lib
rigor789 Feb 1, 2024
0f6f1c0
chore: cleanup
rigor789 Feb 1, 2024
6cbcf7d
fix: build for visionos and cleanup
rigor789 Feb 5, 2024
e7a62de
release: visionos 9.0.0-alpha.3
NathanWalker Feb 6, 2024
c13d61d
release: ios 9.0.0-dev.3
NathanWalker Feb 6, 2024
48714b5
release: ios 9.0.0-dev.4
rigor789 Feb 6, 2024
c219c56
fix: xros device support when building metadata
NathanWalker Feb 7, 2024
e34129d
fix: don't override xcconfig on ios template
edusperoni Feb 14, 2024
7340724
fix: don't override CLANG_ENABLE_MODULES either
edusperoni Feb 14, 2024
20d9045
Merge remote-tracking branch 'origin/main' into feat/visionos
NathanWalker Mar 26, 2024
c45861a
release(ios): 8.7.0-alpha.1
NathanWalker Mar 26, 2024
426b5d1
Merge remote-tracking branch 'origin/main' into feat/visionos
NathanWalker Mar 28, 2024
b492b2c
release(ios): 8.7.0-alpha.2
NathanWalker Mar 28, 2024
dc7dda9
feat: provide ability to set NS_SWIFTUI_BOOT macro if desired
NathanWalker Apr 1, 2024
c8b3df3
release(ios): 8.7.0-alpha.3
NathanWalker Apr 1, 2024
0de9370
feat: allow NS_SWIFTUI_BOOT user defined setting
NathanWalker Apr 2, 2024
c48a980
chore: allow CI to run just ios build
NathanWalker Apr 2, 2024
17c3bcc
release(ios): 8.7.0-rc.0
NathanWalker Apr 2, 2024
93bbbf3
release(visionos): 8.7.0-rc.0
NathanWalker Apr 2, 2024
3eeb267
release(visionos): 8.7.0-rc.1
NathanWalker Apr 2, 2024
f4a3fe8
fix: GCC_PREPROCESSOR_DEFINITIONS on release builds
NathanWalker Apr 3, 2024
c775139
fix: package name
NathanWalker Apr 3, 2024
610a2fc
feat: metadata macros for ios and vision
NathanWalker Apr 3, 2024
40d9405
release(ios): 8.7.0-rc.1
NathanWalker Apr 3, 2024
89f1574
fix: tests with proper pbxproj setup
NathanWalker Apr 3, 2024
e432572
chore: cleanup note
NathanWalker Apr 5, 2024
e714839
chore: cleanup
NathanWalker Apr 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/npm_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_OUTPUT
echo NPM_TAG=$NPM_TAG >> $GITHUB_OUTPUT
- name: Build
run: npm run build
run: npm run build-ios
- name: Upload npm package artifact
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
echo NPM_VERSION=$NPM_VERSION >> $GITHUB_ENV
npm version $NPM_VERSION --no-git-tag-version
- name: Build
run: npm run build
run: npm run build-ios
- name: Upload npm package artifact
uses: actions/upload-artifact@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ v8_build
# v8 build files...
.gclient*
.cipd/

# project template
/project-template-ios/.build_env_vars.sh
/project-template-ios/__PROJECT_NAME__.xcodeproj/project.xcworkspace/xcshareddata/
/project-template-vision/.build_env_vars.sh
/project-template-vision/__PROJECT_NAME__.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
2 changes: 1 addition & 1 deletion NativeScript/NativeScript-Prefix.pch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef NativeScript_Prefix_pch
#define NativeScript_Prefix_pch

#define NATIVESCRIPT_VERSION "8.6.1"
#define NATIVESCRIPT_VERSION "8.7.0-rc.1"

#ifdef DEBUG
#define SIZEOF_OFF_T 8
Expand Down
1 change: 1 addition & 0 deletions NativeScript/inspector/utils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
}

NSString* fileExtension = [fullPath pathExtension];
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
CFStringRef uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExtension, nil);
if (uti == nil) {
return std::string();
Expand Down
Binary file added NativeScript/lib/arm64-xros/libcppgc_base.a
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libcrdtp.a
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libcrdtp_platform.a
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libffi.a
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libinspector.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libv8_bigint.a
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libv8_compiler.a
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libv8_heap_base.a
Binary file not shown.
1 change: 1 addition & 0 deletions NativeScript/lib/arm64-xros/libv8_heap_base_headers.a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!<arch>
Binary file added NativeScript/lib/arm64-xros/libv8_libbase.a
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libv8_libplatform.a
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libv8_snapshot.a
Binary file not shown.
Binary file added NativeScript/lib/arm64-xros/libzip.a
Binary file not shown.
Binary file not shown.
Binary file added NativeScript/lib/arm64-xrsimulator/libcrdtp.a
Binary file not shown.
Binary file not shown.
Binary file added NativeScript/lib/arm64-xrsimulator/libffi.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added NativeScript/lib/arm64-xrsimulator/libv8_bigint.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!<arch>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added NativeScript/lib/arm64-xrsimulator/libzip.a
Binary file not shown.
31 changes: 19 additions & 12 deletions NativeScript/runtime/Metadata.mm
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,25 @@ void LogMetadataUnavailable(const char* identifierString, uint8_t majorVersion,
);
}

#if !TARGET_OS_VISION
/**
* \brief Gets the system version of the current device.
*/
static UInt8 getSystemVersion() {
static UInt8 iosVersion;
if (iosVersion != 0) {
return iosVersion;
}
static UInt8 iosVersion;
if (iosVersion != 0) {
return iosVersion;
}

NSString* version = [[UIDevice currentDevice] systemVersion];
NSArray* versionTokens = [version componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"."]];
UInt8 majorVersion = (UInt8)[versionTokens[0] intValue];
UInt8 minorVersion = (UInt8)[versionTokens[1] intValue];
NSString* version = [[UIDevice currentDevice] systemVersion];
NSArray* versionTokens = [version componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"."]];
UInt8 majorVersion = (UInt8)[versionTokens[0] intValue];
UInt8 minorVersion = (UInt8)[versionTokens[1] intValue];

return iosVersion = encodeVersion(majorVersion, minorVersion);
return iosVersion = encodeVersion(majorVersion, minorVersion);
}
#endif

robin_hood::unordered_map<std::string, MembersCollection> getMetasByJSNames(MembersCollection members) {
robin_hood::unordered_map<std::string, MembersCollection> result;
for (auto member : members) {
Expand All @@ -43,9 +46,13 @@ static UInt8 getSystemVersion() {

// Meta
bool Meta::isAvailable() const {
UInt8 introducedIn = this->introducedIn();
UInt8 systemVersion = getSystemVersion();
return introducedIn == 0 || introducedIn <= systemVersion;
#if TARGET_OS_VISION
return true;
#else
UInt8 introducedIn = this->introducedIn();
UInt8 systemVersion = getSystemVersion();
return introducedIn == 0 || introducedIn <= systemVersion;
#endif
}

// MethodMeta class
Expand Down
1 change: 1 addition & 0 deletions NativeScript/runtime/MetadataInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <objc/runtime.h>
#include "StringHasher.h"
#include <cassert>

namespace tns {

Expand Down
2 changes: 2 additions & 0 deletions NativeScript/runtime/robin_hood.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ static Counts& counts() {
# define ROBIN_HOOD_PRIVATE_DEFINITION_NODISCARD()
#endif

#pragma GCC diagnostic ignored "-Wdeprecated-builtins"

namespace robin_hood {

#if ROBIN_HOOD(CXX) >= ROBIN_HOOD(CXX14)
Expand Down
6 changes: 3 additions & 3 deletions build_all.sh → build_all_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
rm -rf ./dist
./update_version.sh
./build_metadata_generator.sh
./build_nativescript.sh
./build_tklivesync.sh
./build_nativescript.sh --no-vision
./build_tklivesync.sh --no-vision
./prepare_dSYMs.sh
./build_npm.sh
./build_npm_ios.sh
10 changes: 10 additions & 0 deletions build_all_vision.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

rm -rf ./dist
./update_version.sh
./build_metadata_generator.sh
./build_nativescript.sh --no-catalyst --no-iphone --no-sim
./build_tklivesync.sh --no-catalyst --no-iphone --no-sim
./prepare_dSYMs.sh
./build_npm_vision.sh
5 changes: 5 additions & 0 deletions build_metadata_generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ rm -rf dist
mkdir dist
checkpoint "Building metadata generator for x86_64 ..."
build "x86_64"
# make sure the binary is linked against the system libc++ instead of an @rpath one (which happens when compiling on arm64)
# todo: perhaps there is a better way to do this with cmake?
install_name_tool -change @rpath/libc++.1.dylib /usr/lib/libc++.1.dylib dist/x86_64/bin/objc-metadata-generator
otool -L dist/x86_64/bin/objc-metadata-generator

checkpoint "Building metadata generator for arm64 ..."
build "arm64"
otool -L dist/arm64/bin/objc-metadata-generator
rm -rf build
popd
98 changes: 50 additions & 48 deletions build_nativescript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function to_bool() {
BUILD_CATALYST=$(to_bool ${BUILD_CATALYST:=true})
BUILD_IPHONE=$(to_bool ${BUILD_IPHONE:=true})
BUILD_SIMULATOR=$(to_bool ${BUILD_SIMULATOR:=true})
BUILD_VISION=$(to_bool ${BUILD_VISION:=true})
VERBOSE=$(to_bool ${VERBOSE:=false})

for arg in $@; do
Expand All @@ -36,6 +37,8 @@ for arg in $@; do
--no-sim|--no-simulator) BUILD_SIMULATOR=false ;;
--iphone|--device) BUILD_IPHONE=true ;;
--no-iphone|--no-device) BUILD_IPHONE=false ;;
--xr|--vision) BUILD_VISION=true ;;
--no-xr|--no-vision) BUILD_VISION=false ;;
--verbose|-v) VERBOSE=true ;;
*) ;;
esac
Expand All @@ -58,52 +61,17 @@ xcodebuild -project v8ios.xcodeproj \
-configuration Release clean \
$QUIET


if $BUILD_CATALYST; then
checkpoint "Building NativeScript for Mac Catalyst"
xcodebuild archive -project v8ios.xcodeproj \
-scheme "NativeScript" \
-configuration Release \
-destination "platform=macOS,variant=Mac Catalyst" \
$QUIET \
EXCLUDED_ARCHS="x86_64" \
SKIP_INSTALL=NO \
-archivePath $DIST/intermediates/NativeScript.maccatalyst.xcarchive
fi

if $BUILD_SIMULATOR; then
# checkpoint "Building for x86_64 iphone simulator"
# xcodebuild archive -project v8ios.xcodeproj \
# -scheme "NativeScript" \
# -configuration Release \
# -arch x86_64 \
# -sdk iphonesimulator \
# $QUIET \
# DEVELOPMENT_TEAM=$DEV_TEAM \
# SKIP_INSTALL=NO \
# -archivePath $DIST/NativeScript.x86_64-iphonesimulator.xcarchive

# checkpoint "Building for ARM64 iphone simulator"
# xcodebuild archive -project v8ios.xcodeproj \
# -scheme "NativeScript" \
# -configuration Release \
# -arch arm64 \
# -sdk iphonesimulator \
# $QUIET \
# DEVELOPMENT_TEAM=$DEV_TEAM \
# SKIP_INSTALL=NO \
# -archivePath $DIST/NativeScript.arm64-iphonesimulator.xcarchive

checkpoint "Building NativeScript for iphone simulators (multi-arch)"
xcodebuild archive -project v8ios.xcodeproj \
-scheme "NativeScript" \
-configuration Release \
-destination "generic/platform=iOS Simulator" \
-sdk iphonesimulator \
$QUIET \
EXCLUDED_ARCHS="i386" \
DEVELOPMENT_TEAM=$DEV_TEAM \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
-archivePath $DIST/intermediates/NativeScript.iphonesimulator.xcarchive
fi

Expand All @@ -113,27 +81,54 @@ xcodebuild archive -project v8ios.xcodeproj \
-scheme "NativeScript" \
-configuration Release \
-destination "generic/platform=iOS" \
-sdk iphoneos \
$QUIET \
EXCLUDED_ARCHS="armv7" \
DEVELOPMENT_TEAM=$DEV_TEAM \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
-archivePath $DIST/intermediates/NativeScript.iphoneos.xcarchive
fi

#Create fat library for simulator
# rm -rf "$DIST/NativeScript.iphonesimulator.xcarchive"
if $BUILD_CATALYST; then
checkpoint "Building NativeScript for Mac Catalyst"
xcodebuild archive -project v8ios.xcodeproj \
-scheme "NativeScript" \
-configuration Release \
-destination "generic/platform=macOS,variant=Mac Catalyst" \
$QUIET \
EXCLUDED_ARCHS="x86_64" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
-archivePath $DIST/intermediates/NativeScript.maccatalyst.xcarchive
fi

# cp -R \
# "$DIST/NativeScript.x86_64-iphonesimulator.xcarchive" \
# "$DIST/NativeScript.iphonesimulator.xcarchive"
if $BUILD_VISION; then

# rm "$DIST/NativeScript.iphonesimulator.xcarchive/Products/Library/Frameworks/NativeScript.framework/NativeScript"
checkpoint "Building NativeScript for visionOS Device"
xcodebuild archive -project v8ios.xcodeproj \
-scheme "NativeScript" \
-configuration Release \
-destination "generic/platform=visionOS" \
$QUIET \
EXCLUDED_ARCHS="i386 x86_64" \
VALID_ARCHS=arm64 \
DEVELOPMENT_TEAM=$DEV_TEAM \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
-archivePath $DIST/intermediates/NativeScript.xros.xcarchive

# lipo -create \
# "$DIST/NativeScript.x86_64-iphonesimulator.xcarchive/Products/Library/Frameworks/NativeScript.framework/NativeScript" \
# "$DIST/NativeScript.arm64-iphonesimulator.xcarchive/Products/Library/Frameworks/NativeScript.framework/NativeScript" \
# -output \
# "$DIST/NativeScript.iphonesimulator.xcarchive/Products/Library/Frameworks/NativeScript.framework/NativeScript"
checkpoint "Building NativeScript for visionOS Simulators"
xcodebuild archive -project v8ios.xcodeproj \
-scheme "NativeScript" \
-configuration Release \
-destination "generic/platform=visionOS Simulator" \
$QUIET \
EXCLUDED_ARCHS="i386 x86_64" \
VALID_ARCHS=arm64 \
DEVELOPMENT_TEAM=$DEV_TEAM \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
-archivePath $DIST/intermediates/NativeScript.xrsimulator.xcarchive
fi

XCFRAMEWORKS=()
Expand All @@ -152,6 +147,13 @@ if $BUILD_IPHONE; then
-debug-symbols "$DIST/intermediates/NativeScript.iphoneos.xcarchive/dSYMs/NativeScript.framework.dSYM" )
fi

if $BUILD_VISION; then
XCFRAMEWORKS+=( -framework "$DIST/intermediates/NativeScript.xros.xcarchive/Products/Library/Frameworks/NativeScript.framework" \
-debug-symbols "$DIST/intermediates/NativeScript.xros.xcarchive/dSYMs/NativeScript.framework.dSYM" )
XCFRAMEWORKS+=( -framework "$DIST/intermediates/NativeScript.xrsimulator.xcarchive/Products/Library/Frameworks/NativeScript.framework" \
-debug-symbols "$DIST/intermediates/NativeScript.xrsimulator.xcarchive/dSYMs/NativeScript.framework.dSYM" )
fi

checkpoint "Creating NativeScript.xcframework"
OUTPUT_DIR="$DIST/NativeScript.xcframework"
rm -rf $OUTPUT_DIR
Expand Down
9 changes: 7 additions & 2 deletions build_npm.sh → build_npm_ios.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/bin/bash
set -e
source "$(dirname "$0")/build_utils.sh"

checkpoint "Preparing npm package for iOS..."
OUTPUT_DIR="dist/npm"
rm -rf "$OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR/framework"
cp ./package.json "$OUTPUT_DIR"
cp -r "./project-template/" "$OUTPUT_DIR/framework"

cp -r "./project-template-ios/" "$OUTPUT_DIR/framework"

cp -r "dist/NativeScript.xcframework" "$OUTPUT_DIR/framework/internal"
cp -r "dist/TKLiveSync.xcframework" "$OUTPUT_DIR/framework/internal"
Expand All @@ -28,4 +31,6 @@ cp -r "metadata-generator/dist/arm64/." "$OUTPUT_DIR/framework/internal/metadata
pushd "$OUTPUT_DIR"
npm pack
mv *.tgz ../
popd
popd

checkpoint "npm package created."
36 changes: 36 additions & 0 deletions build_npm_vision.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
set -e
source "$(dirname "$0")/build_utils.sh"

checkpoint "Preparing npm package for visionOS..."
OUTPUT_DIR="dist/npm"
rm -rf "$OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR"
mkdir -p "$OUTPUT_DIR/framework"
cp ./package.json "$OUTPUT_DIR"

cp -r "./project-template-vision/" "$OUTPUT_DIR/framework"

cp -r "dist/NativeScript.xcframework" "$OUTPUT_DIR/framework/internal"
cp -r "dist/TKLiveSync.xcframework" "$OUTPUT_DIR/framework/internal"

mkdir -p "$OUTPUT_DIR/framework/internal/metadata-generator-x86_64"
cp -r "metadata-generator/dist/x86_64/." "$OUTPUT_DIR/framework/internal/metadata-generator-x86_64"

mkdir -p "$OUTPUT_DIR/framework/internal/metadata-generator-arm64"
cp -r "metadata-generator/dist/arm64/." "$OUTPUT_DIR/framework/internal/metadata-generator-arm64"

# Add xcframeworks to .zip (NPM modules do not support symlinks, unzipping is done by {N} CLI)
(
set -e
cd $OUTPUT_DIR/framework/internal
zip -qr --symlinks XCFrameworks.zip *.xcframework
rm -rf *.xcframework
)

pushd "$OUTPUT_DIR"
npm pack
mv *.tgz ../
popd

checkpoint "npm package created."
Loading
Loading