mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat: initial wintercg modules
Adding initial support for the following URL, TextEncoder, TextDecoder, atob, btoa. This also setups up a cargo workspace (rust) for future developments. iOS adds a local pod dep until we move to using a pod for the runtime dep.
This commit is contained in:
32
tools/scripts/build-rust-android.sh
Executable file
32
tools/scripts/build-rust-android.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
TARGET="$1"
|
||||
|
||||
if [ "$TARGET" = "" ]; then
|
||||
echo "missing argument TARGET"
|
||||
echo "Usage: $0 TARGET"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NDK_TARGET=$TARGET
|
||||
|
||||
# if [ "$TARGET" = "arm-linux-androideabi" ]; then
|
||||
# NDK_TARGET="armv7a-linux-androideabi"
|
||||
# fi
|
||||
|
||||
API_VERSION="21"
|
||||
NDK_VERSION="23.1.7779620"
|
||||
NDK_HOST="darwin-x86_64"
|
||||
|
||||
# needed so we can overwrite it in the CI
|
||||
if [ -z "$NDK" ]; then
|
||||
NDK="$ANDROID_HOME/ndk/$NDK_VERSION"
|
||||
fi
|
||||
|
||||
TOOLS="$NDK/toolchains/llvm/prebuilt/$NDK_HOST"
|
||||
|
||||
AR=$TOOLS/bin/llvm-ar \
|
||||
CXX=$TOOLS/bin/${NDK_TARGET}${API_VERSION}-clang++ \
|
||||
RANLIB=$TOOLS/bin/llvm-ranlib \
|
||||
CXXFLAGS="--target=$NDK_TARGET" \
|
||||
cargo +nightly build -Z build-std='std,panic_abort' -Z build-std-features=panic_immediate_abort --target $TARGET --release $EXTRA_ARGS -p nativescript-core
|
||||
5
tools/scripts/build-rust-headers.sh
Executable file
5
tools/scripts/build-rust-headers.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cbindgen --config crates/libs/nativescript-core/cbindgen.toml crates/libs/nativescript-core/src/lib.rs -l c > crates/libs/nativescript-core/include/nativescript_core.h
|
||||
cbindgen --config crates/libs/nativescript-core/cbindgen.toml crates/libs/nativescript-core/src/lib.rs -l c > packages/core/platforms/ios/src/cpp/include/nativescript_core.h
|
||||
cbindgen --config crates/libs/nativescript-core/cbindgen.toml crates/libs/nativescript-core/src/lib.rs -l c > packages/ui-mobile-base/android/widgets/src/main/cpp/include/nativescript_core.h
|
||||
22
tools/scripts/copy-rust-android.sh
Executable file
22
tools/scripts/copy-rust-android.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#! /bin/bash
|
||||
COPY_DIR="packages/ui-mobile-base/android/widgets/src/main/jniLibs"
|
||||
NAME="nativescriptcore"
|
||||
LIB_NAME="lib$NAME"
|
||||
|
||||
rm -rf $COPY_DIR
|
||||
|
||||
mkdir -p $COPY_DIR
|
||||
mkdir -p $COPY_DIR/x86
|
||||
mkdir -p $COPY_DIR/x86_64
|
||||
mkdir -p $COPY_DIR/arm64-v8a
|
||||
mkdir -p $COPY_DIR/armeabi-v7a
|
||||
|
||||
cp ./target/i686-linux-android/release/$LIB_NAME.so $COPY_DIR/x86/$LIB_NAME.so
|
||||
cp ./target/x86_64-linux-android/release/$LIB_NAME.so $COPY_DIR/x86_64/$LIB_NAME.so
|
||||
cp ./target/aarch64-linux-android/release/$LIB_NAME.so $COPY_DIR/arm64-v8a/$LIB_NAME.so
|
||||
cp ./target/armv7-linux-androideabi/release/$LIB_NAME.so $COPY_DIR/armeabi-v7a/$LIB_NAME.so
|
||||
|
||||
mkdir -p packages/ui-mobile-base/android/widgets/src/main/cpp/$NAME
|
||||
cp -r ./crates/libs/nativescript-core/include packages/ui-mobile-base/android/widgets/src/main/cpp/$NAME
|
||||
|
||||
echo "Dynamic libraries copied!"
|
||||
8
tools/scripts/copy-rust-ios.sh
Executable file
8
tools/scripts/copy-rust-ios.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#! /bin/bash
|
||||
LIB_NAME="nativescriptcore"
|
||||
FRAMEWORK="NativeScriptCore"
|
||||
|
||||
cp -r ./crates/libs/nativescript-core/include packages/core/platforms/ios/src/cpp
|
||||
cp -r target/$FRAMEWORK.xcframework packages/core/platforms/ios
|
||||
rm -rf target/$FRAMEWORK.xcframework
|
||||
rm target/simulator_fat/lib$LIB_NAME.dylib
|
||||
Reference in New Issue
Block a user