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:
Osei Fortune
2024-01-08 01:55:57 -04:00
parent b226066814
commit 4bb347ca69
489 changed files with 101417 additions and 179 deletions

View 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

View 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

View 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
View 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