Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions NativeScript/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ if(TARGET_PLATFORM_MACOS)

set(METADATA_FILE "metadata.macos.nsmd")
elseif(TARGET_PLATFORM_IOS)
# Convert the Info.plist from binary format to XML format.
# This seemed to unblock a build error when using in React Native.
add_custom_command(TARGET ${NAME} POST_BUILD
COMMAND plutil -convert xml1 $<TARGET_FILE_DIR:${NAME}>/Info.plist
)

if(TARGET_PLATFORM_SIM)
set(METADATA_FILE "metadata.ios-sim.nsmd")
else()
Expand Down
29 changes: 27 additions & 2 deletions build_all_ios.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
#!/bin/bash
set -e

TARGET_ENGINE=${TARGET_ENGINE:=v8} # default to v8 for compat

# See build_nativescript.sh for all supported flags. This parent script is only
# interested in --no-engine.
for arg in $@; do
case $arg in
--v8) TARGET_ENGINE=v8 ;;
--quickjs) TARGET_ENGINE=quickjs ;;
--jsc) TARGET_ENGINE=jsc ;;
--hermes) TARGET_ENGINE=hermes ;;
--no-engine) TARGET_ENGINE=none ;;
*) ;;
esac
done

rm -rf ./dist
# don't run if NO_UPDATE_VERSION is set
# if [ -z "$NO_UPDATE_VERSION" ]; then
# TODO: integrate version into runtime
# ./update_version.sh
# fi
./build_metadata_generator.sh
./build_nativescript.sh --no-vision $1
./build_nativescript.sh --no-vision $1 $2
./build_tklivesync.sh --no-vision
./prepare_dSYMs.sh
./build_npm_ios.sh

if [[ "$TARGET_ENGINE" == "none" ]]; then
# If you're building *with* --no-engine, you're trying to make an npm release
# of a workspace under ./packages/*, like @nativescript/ios-node-api.
echo "Skipping build_npm_ios.sh due to --no-engine flag."
echo "build_all_ios.sh finished!"
else
# If you're building *without* --no-engine, you're trying to make an npm
# release of the root-level workspace, @nativescript/ios.
./build_npm_ios.sh
fi
29 changes: 27 additions & 2 deletions build_all_vision.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
#!/bin/bash
set -e

TARGET_ENGINE=${TARGET_ENGINE:=v8} # default to v8 for compat

# See build_nativescript.sh for all supported flags. This parent script is only
# interested in --no-engine.
for arg in $@; do
case $arg in
--v8) TARGET_ENGINE=v8 ;;
--quickjs) TARGET_ENGINE=quickjs ;;
--jsc) TARGET_ENGINE=jsc ;;
--hermes) TARGET_ENGINE=hermes ;;
--no-engine) TARGET_ENGINE=none ;;
*) ;;
esac
done

rm -rf ./dist
./update_version.sh
./build_metadata_generator.sh
./build_nativescript.sh --no-catalyst --no-iphone --no-sim
./build_nativescript.sh --no-catalyst --no-iphone --no-sim $1
./build_tklivesync.sh --no-catalyst --no-iphone --no-sim
./prepare_dSYMs.sh
./build_npm_vision.sh

if [[ "$TARGET_ENGINE" == "none" ]]; then
# If you're building *with* --no-engine, you're trying to make an npm release
# of a workspace under ./packages/*, like @nativescript/ios-node-api.
echo "Skipping build_npm_vision.sh due to --no-engine flag."
echo "build_all_vision.sh finished!"
else
# If you're building *without* --no-engine, you're trying to make an npm
# release of the root-level workspace, @nativescript/ios.
./build_npm_vision.sh
fi
20 changes: 16 additions & 4 deletions build_nativescript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,22 @@ fi

if [[ -n "${XCFRAMEWORKS[@]}" ]]; then

checkpoint "Creating NativeScript.xcframework"
OUTPUT_DIR="$DIST/NativeScript.xcframework"
rm -rf $OUTPUT_DIR
xcodebuild -create-xcframework ${XCFRAMEWORKS[@]} -output "$OUTPUT_DIR"

if [[ "$TARGET_ENGINE" == "none" ]]; then
checkpoint "Creating the XCFramework (NativeScript.apple.node)"

# We adhere to the prebuilds standard as described here:
# https://github.com/callstackincubator/react-native-node-api/blob/9b231c14459b62d7df33360f930a00343d8c46e6/docs/PREBUILDS.md
OUTPUT_DIR="packages/ios/build/Release/NativeScript.apple.node"
rm -rf $OUTPUT_DIR
deno run -A ./scripts/build_xcframework.mts --output "$OUTPUT_DIR" ${XCFRAMEWORKS[@]}
else
checkpoint "Creating NativeScript.xcframework"

OUTPUT_DIR="$DIST/NativeScript.xcframework"
rm -rf $OUTPUT_DIR
xcodebuild -create-xcframework ${XCFRAMEWORKS[@]} -output "$OUTPUT_DIR"
fi

fi

Expand Down
1 change: 1 addition & 0 deletions packages/ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!build
14 changes: 0 additions & 14 deletions packages/ios/NativeScript.podspec

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@
<key>BinaryPath</key>
<string>NativeScript.framework/NativeScript</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>NativeScript.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>NativeScript.framework/NativeScript</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>NativeScript.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#ifndef NATIVESCRIPT_H
#define NATIVESCRIPT_H

#ifdef __cplusplus

extern "C"

#endif // __cplusplus

void
nativescript_init(void* env, const char* metadata_path, const void* metadata_ptr);

#ifdef __OBJC__

#import <Foundation/Foundation.h>

__attribute__((visibility("default")))
@interface Config : NSObject

@property(nonatomic, retain) NSString* BaseDir;
@property(nonatomic, retain) NSString* ApplicationPath;
@property(nonatomic) void* MetadataPtr;
@property BOOL IsDebug;
@property BOOL LogToSystemConsole;
@property int ArgumentsCount;
@property(nonatomic) char** Arguments;

@end

__attribute__((visibility("default")))
@interface NativeScript : NSObject

- (instancetype)initWithConfig:(Config*)config;
- (void)runScriptString:(NSString*)script runLoop:(BOOL)runLoop;
- (void)restartWithConfig:(Config*)config;
- (void)shutdownRuntime;

/**
WARNING: this method does not return in most applications. (UIApplicationMain)
*/
- (void)runMainApplication;
- (bool)liveSync;

@end

#endif // __OBJC__

#endif /* NATIVESCRIPT_H */
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>23G93</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>NativeScript</string>
<key>CFBundleIdentifier</key>
<string>org.nativescript.runtime</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>22C146</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>18.2</string>
<key>DTSDKBuild</key>
<string>22C146</string>
<key>DTSDKName</key>
<string>iphoneos18.2</string>
<key>DTXcode</key>
<string>1620</string>
<key>DTXcodeBuild</key>
<string>16C5032a</string>
<key>MinimumOSVersion</key>
<string>13.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#ifndef NATIVESCRIPT_H
#define NATIVESCRIPT_H

#ifdef __cplusplus

extern "C"

#endif // __cplusplus

void
nativescript_init(void* env, const char* metadata_path, const void* metadata_ptr);

#ifdef __OBJC__

#import <Foundation/Foundation.h>

__attribute__((visibility("default")))
@interface Config : NSObject

@property(nonatomic, retain) NSString* BaseDir;
@property(nonatomic, retain) NSString* ApplicationPath;
@property(nonatomic) void* MetadataPtr;
@property BOOL IsDebug;
@property BOOL LogToSystemConsole;
@property int ArgumentsCount;
@property(nonatomic) char** Arguments;

@end

__attribute__((visibility("default")))
@interface NativeScript : NSObject

- (instancetype)initWithConfig:(Config*)config;
- (void)runScriptString:(NSString*)script runLoop:(BOOL)runLoop;
- (void)restartWithConfig:(Config*)config;
- (void)shutdownRuntime;

/**
WARNING: this method does not return in most applications. (UIApplicationMain)
*/
- (void)runMainApplication;
- (bool)liveSync;

@end

#endif // __OBJC__

#endif /* NATIVESCRIPT_H */
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>23G93</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>NativeScript</string>
<key>CFBundleIdentifier</key>
<string>org.nativescript.runtime</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneSimulator</string>
</array>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>22C146</string>
<key>DTPlatformName</key>
<string>iphonesimulator</string>
<key>DTPlatformVersion</key>
<string>18.2</string>
<key>DTSDKBuild</key>
<string>22C146</string>
<key>DTSDKName</key>
<string>iphonesimulator18.2</string>
<key>DTXcode</key>
<string>1620</string>
<key>DTXcodeBuild</key>
<string>16C5032a</string>
<key>MinimumOSVersion</key>
<string>13.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
</dict>
</plist>
Binary file not shown.
Loading
Loading