Improve README and project structure (#4)

* Update root README

* Move apple example of hello

* Fix

* Update build scripts

* cd hello

* Fix android build script
This commit is contained in:
Daohan Chong 2022-03-22 22:28:44 +08:00 committed by GitHub
parent ee00d39c79
commit 1c304d4dc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 32 additions and 24 deletions

View File

@ -7,7 +7,8 @@ on:
branches: [main]
jobs:
build_xcframework:
build_ios:
name: 'Build iOS'
runs-on: macos-latest
steps:
@ -16,7 +17,7 @@ jobs:
run: |
make prepare-apple
cd hello
make all
make apple
- name: "Upload xcframework"
uses: actions/upload-artifact@v2
@ -26,6 +27,7 @@ jobs:
retention-days: 7
build_android:
name: 'Build Android'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -55,5 +57,5 @@ jobs:
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
cd hello/platforms/android/UniffiRustExample
./gradlew cargoBuild --info
cd hello
make android

View File

@ -6,6 +6,15 @@ Working in progress
## Prerequisites
### Rust
Please read <https://www.rust-lang.org/tools/install>.
### Android
1. JDK 11.x, Android SDK and NDK, Android Studio is optional. For more details, please visit [.github/workflows/build.yml](.github/workflows/build.yml).
2. Install Rust toolchains for Android: `make prepare-android`
### iOS
1. Latest Xcode (13.x)
@ -19,6 +28,12 @@ Working in progress
Please note that `aarch64-apple-ios-sim` requries the nightly toolchain (<https://doc.rust-lang.org/nightly/rustc/platform-support/aarch64-apple-ios-sim.html>).
1. Install `uniffi-bindgen`: `cargo install uniffi_bindgen`, details: <https://mozilla.github.io/uniffi-rs/tutorial/Prerequisites.html>
## Get Started
### Hello
Please read [hello/README.md](hello/README.md).
## License
MIT

View File

@ -1,6 +1,6 @@
STATIC_LIB_NAME := libhello.a
all:
apple:
@make build-targets
@make bindgen-swift
@make assemble-frameworks
@ -37,5 +37,8 @@ xcframeowrk:
xcodebuild -create-xcframework -framework target/aarch64-apple-ios/release/HelloFFI.framework -framework target/aarch64-apple-ios-sim/release/HelloFFI.framework -framework target/aarch64-apple-ios-macabi/release/HelloFFI.framework -output target/HelloFFI.xcframework
cp-xcframeowrk-source:
cp -r target/HelloFFI.xcframework platforms/HelloAppleDemoApp/Hello/Sources
cp src/Hello.swift platforms/HelloAppleDemoApp/Hello/Sources/Hello
cp -r target/HelloFFI.xcframework platforms/apple/Hello/Sources
cp src/Hello.swift platforms/apple/Hello/Sources/Hello
android:
cd platforms/android/UniffiRustExample && ./gradlew cargoBuild --info

View File

@ -10,7 +10,7 @@ Please refer to the root [README.md](../README.md).
### iOS
- Generate binaries, xcframework and Swift binding: `make all`
- Generate binaries, xcframework and Swift binding: `make apple`
#### With Rust binary: 503K

View File

@ -1,14 +0,0 @@
<?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>SchemeUserState</key>
<dict>
<key>HelloAppleDemoApp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>

View File

@ -474,9 +474,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = HelloAppleDemoApp/HelloAppleDemoApp.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DH5UQL44AR;
DEVELOPMENT_TEAM = "";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = HelloAppleDemoApp/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
@ -505,9 +506,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = HelloAppleDemoApp/HelloAppleDemoApp.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DH5UQL44AR;
DEVELOPMENT_TEAM = "";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = HelloAppleDemoApp/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;