diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 970c27c..03e119a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,7 +8,7 @@ on:
jobs:
build_ios:
- name: 'Build iOS'
+ name: "Build iOS"
runs-on: macos-latest
steps:
@@ -26,8 +26,13 @@ jobs:
path: hello/target/HelloFFI.xcframework
retention-days: 7
+ - name: "Run ios tests"
+ run: |
+ cd hello/platforms/apple
+ xcodebuild -project HelloAppleDemoApp.xcodeproj -scheme HelloAppleDemoApp -destination 'platform=iOS Simulator,name=iPhone 14' test
+
build_android:
- name: 'Build Android'
+ name: "Build Android"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@@ -35,9 +40,9 @@ jobs:
lfs: true
- uses: actions/setup-java@v3
with:
- distribution: 'temurin'
- java-version: '17'
- cache: 'gradle'
+ distribution: "temurin"
+ java-version: "17"
+ cache: "gradle"
# Reference: https://github.com/mozilla/rust-android-gradle/blob/master/.github/workflows/check.yml
- uses: actions-rs/toolchain@v1
# Reference: https://github.com/rust-windowing/android-ndk-rs/blob/master/.github/workflows/rust.yml
@@ -45,9 +50,16 @@ jobs:
toolchain: stable
override: true
target: aarch64-linux-android
+ - uses: nttld/setup-ndk@v1
+ id: setup-ndk
+ with:
+ ndk-version: r21e
+ add-to-path: false
- name: "More dependencies"
run: |
make prepare-android
+ env:
+ ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: "Build Android library"
run: make android
working-directory: hello
diff --git a/Cargo.lock b/Cargo.lock
index 9877d6c..c10094d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,15 @@
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "aho-corasick"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "anstream"
version = "0.3.2"
@@ -89,6 +98,119 @@ version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
+[[package]]
+name = "async-channel"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35"
+dependencies = [
+ "concurrent-queue",
+ "event-listener",
+ "futures-core",
+]
+
+[[package]]
+name = "async-executor"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb"
+dependencies = [
+ "async-lock",
+ "async-task",
+ "concurrent-queue",
+ "fastrand",
+ "futures-lite",
+ "slab",
+]
+
+[[package]]
+name = "async-global-executor"
+version = "2.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776"
+dependencies = [
+ "async-channel",
+ "async-executor",
+ "async-io",
+ "async-lock",
+ "blocking",
+ "futures-lite",
+ "once_cell",
+]
+
+[[package]]
+name = "async-io"
+version = "1.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
+dependencies = [
+ "async-lock",
+ "autocfg",
+ "cfg-if",
+ "concurrent-queue",
+ "futures-lite",
+ "log",
+ "parking",
+ "polling",
+ "rustix 0.37.23",
+ "slab",
+ "socket2",
+ "waker-fn",
+]
+
+[[package]]
+name = "async-lock"
+version = "2.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b"
+dependencies = [
+ "event-listener",
+]
+
+[[package]]
+name = "async-std"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d"
+dependencies = [
+ "async-channel",
+ "async-global-executor",
+ "async-io",
+ "async-lock",
+ "crossbeam-utils",
+ "futures-channel",
+ "futures-core",
+ "futures-io",
+ "futures-lite",
+ "gloo-timers",
+ "kv-log-macro",
+ "log",
+ "memchr",
+ "once_cell",
+ "pin-project-lite",
+ "pin-utils",
+ "slab",
+ "wasm-bindgen-futures",
+]
+
+[[package]]
+name = "async-task"
+version = "4.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae"
+
+[[package]]
+name = "atomic-waker"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3"
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
[[package]]
name = "basic-toml"
version = "0.1.4"
@@ -107,12 +229,39 @@ dependencies = [
"serde",
]
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
[[package]]
name = "bitflags"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
+[[package]]
+name = "blocking"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65"
+dependencies = [
+ "async-channel",
+ "async-lock",
+ "async-task",
+ "atomic-waker",
+ "fastrand",
+ "futures-lite",
+ "log",
+]
+
+[[package]]
+name = "bumpalo"
+version = "3.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
+
[[package]]
name = "bytes"
version = "1.4.0"
@@ -160,6 +309,12 @@ dependencies = [
"libc",
]
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
[[package]]
name = "clap"
version = "4.3.23"
@@ -208,6 +363,24 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
+[[package]]
+name = "concurrent-queue"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c"
+dependencies = [
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-utils"
+version = "0.8.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
+dependencies = [
+ "cfg-if",
+]
+
[[package]]
name = "errno"
version = "0.3.2"
@@ -229,18 +402,94 @@ dependencies = [
"libc",
]
+[[package]]
+name = "event-listener"
+version = "2.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
+
+[[package]]
+name = "fastrand"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
+dependencies = [
+ "instant",
+]
+
[[package]]
name = "fs-err"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541"
+[[package]]
+name = "futures-channel"
+version = "0.3.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
+
+[[package]]
+name = "futures-io"
+version = "0.3.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
+
+[[package]]
+name = "futures-lite"
+version = "1.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
+dependencies = [
+ "fastrand",
+ "futures-core",
+ "futures-io",
+ "memchr",
+ "parking",
+ "pin-project-lite",
+ "waker-fn",
+]
+
+[[package]]
+name = "generator"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e"
+dependencies = [
+ "cc",
+ "libc",
+ "log",
+ "rustversion",
+ "windows",
+]
+
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+[[package]]
+name = "gloo-timers"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "js-sys",
+ "wasm-bindgen",
+]
+
[[package]]
name = "goblin"
version = "0.6.1"
@@ -262,6 +511,8 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
name = "hello"
version = "0.1.0"
dependencies = [
+ "async-std",
+ "once_cell",
"uniffi",
]
@@ -271,6 +522,26 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
+[[package]]
+name = "instant"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "io-lifetimes"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
+dependencies = [
+ "hermit-abi",
+ "libc",
+ "windows-sys",
+]
+
[[package]]
name = "is-terminal"
version = "0.4.9"
@@ -278,7 +549,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
"hermit-abi",
- "rustix",
+ "rustix 0.38.8",
"windows-sys",
]
@@ -288,12 +559,42 @@ version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
+[[package]]
+name = "js-sys"
+version = "0.3.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
+dependencies = [
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "kv-log-macro"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
+dependencies = [
+ "log",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
[[package]]
name = "libc"
version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
+[[package]]
+name = "linux-raw-sys"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
+
[[package]]
name = "linux-raw-sys"
version = "0.4.5"
@@ -305,6 +606,32 @@ name = "log"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+dependencies = [
+ "value-bag",
+]
+
+[[package]]
+name = "loom"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5"
+dependencies = [
+ "cfg-if",
+ "generator",
+ "pin-utils",
+ "scoped-tls",
+ "tracing",
+ "tracing-subscriber",
+]
+
+[[package]]
+name = "matchers"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
+dependencies = [
+ "regex-automata 0.1.10",
+]
[[package]]
name = "memchr"
@@ -344,24 +671,83 @@ dependencies = [
"minimal-lexical",
]
+[[package]]
+name = "nu-ansi-term"
+version = "0.46.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+dependencies = [
+ "overload",
+ "winapi",
+]
+
[[package]]
name = "once_cell"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
+[[package]]
+name = "oneshot"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f6640c6bda7731b1fdbab747981a0f896dd1fedaf9f4a53fa237a04a84431f4"
+dependencies = [
+ "loom",
+]
+
+[[package]]
+name = "overload"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
+
+[[package]]
+name = "parking"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e"
+
[[package]]
name = "paste"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
+[[package]]
+name = "pin-project-lite"
+version = "0.2.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
+
+[[package]]
+name = "pin-utils"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+
[[package]]
name = "plain"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
+[[package]]
+name = "polling"
+version = "2.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
+dependencies = [
+ "autocfg",
+ "bitflags 1.3.2",
+ "cfg-if",
+ "concurrent-queue",
+ "libc",
+ "log",
+ "pin-project-lite",
+ "windows-sys",
+]
+
[[package]]
name = "proc-macro2"
version = "1.0.66"
@@ -380,25 +766,95 @@ dependencies = [
"proc-macro2",
]
+[[package]]
+name = "regex"
+version = "1.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata 0.3.7",
+ "regex-syntax 0.7.5",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
+dependencies = [
+ "regex-syntax 0.6.29",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax 0.7.5",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.6.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
+
+[[package]]
+name = "regex-syntax"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
+
+[[package]]
+name = "rustix"
+version = "0.37.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06"
+dependencies = [
+ "bitflags 1.3.2",
+ "errno",
+ "io-lifetimes",
+ "libc",
+ "linux-raw-sys 0.3.8",
+ "windows-sys",
+]
+
[[package]]
name = "rustix"
version = "0.38.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f"
dependencies = [
- "bitflags",
+ "bitflags 2.4.0",
"errno",
"libc",
- "linux-raw-sys",
+ "linux-raw-sys 0.4.5",
"windows-sys",
]
+[[package]]
+name = "rustversion"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
+
[[package]]
name = "ryu"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
+[[package]]
+name = "scoped-tls"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
+
[[package]]
name = "scroll"
version = "0.11.0"
@@ -459,12 +915,46 @@ dependencies = [
"serde",
]
+[[package]]
+name = "sharded-slab"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
+dependencies = [
+ "lazy_static",
+]
+
[[package]]
name = "siphasher"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
+[[package]]
+name = "slab"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "smallvec"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
+
+[[package]]
+name = "socket2"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
+dependencies = [
+ "libc",
+ "winapi",
+]
+
[[package]]
name = "static_assertions"
version = "1.1.0"
@@ -508,6 +998,16 @@ dependencies = [
"syn",
]
+[[package]]
+name = "thread_local"
+version = "1.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+]
+
[[package]]
name = "toml"
version = "0.5.11"
@@ -517,6 +1017,68 @@ dependencies = [
"serde",
]
+[[package]]
+name = "tracing"
+version = "0.1.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
+dependencies = [
+ "cfg-if",
+ "pin-project-lite",
+ "tracing-attributes",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-attributes"
+version = "0.1.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
+dependencies = [
+ "once_cell",
+ "valuable",
+]
+
+[[package]]
+name = "tracing-log"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
+dependencies = [
+ "lazy_static",
+ "log",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77"
+dependencies = [
+ "matchers",
+ "nu-ansi-term",
+ "once_cell",
+ "regex",
+ "sharded-slab",
+ "smallvec",
+ "thread_local",
+ "tracing",
+ "tracing-core",
+ "tracing-log",
+]
+
[[package]]
name = "unicase"
version = "2.6.0"
@@ -535,8 +1097,7 @@ checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
[[package]]
name = "uniffi"
version = "0.24.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e835154c561cd75f253008093a908c06fb1f14327afb0ffea88eac72e534cc0"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
dependencies = [
"anyhow",
"camino",
@@ -557,8 +1118,7 @@ dependencies = [
[[package]]
name = "uniffi_bindgen"
version = "0.24.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c2f91fdcd44de3aab35847bf80485f412879dcdd92b5140ee67f948e5eed750e"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
dependencies = [
"anyhow",
"askama",
@@ -572,18 +1132,16 @@ dependencies = [
"once_cell",
"paste",
"serde",
- "serde_json",
"toml",
"uniffi_meta",
"uniffi_testing",
- "weedle2",
+ "uniffi_udl",
]
[[package]]
name = "uniffi_build"
version = "0.24.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b20f693fb51c21a21b9816bed5522f0231cc769d8ba38821a05ab7d39dad51d"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
dependencies = [
"anyhow",
"camino",
@@ -593,8 +1151,7 @@ dependencies = [
[[package]]
name = "uniffi_checksum_derive"
version = "0.24.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d1b354a9bd654cc6547d461ccd60a10eb6c7473178f12d8ff91cf4340ae947e8"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
dependencies = [
"quote",
"syn",
@@ -603,15 +1160,13 @@ dependencies = [
[[package]]
name = "uniffi_core"
version = "0.24.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32793120650ceda4f4e0d8eacd784c1a736834b2cca7b12e2550d3a190553af4"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
dependencies = [
"anyhow",
"bytes",
"camino",
- "cargo_metadata",
"log",
- "once_cell",
+ "oneshot",
"paste",
"static_assertions",
]
@@ -619,8 +1174,7 @@ dependencies = [
[[package]]
name = "uniffi_macros"
version = "0.24.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c65987b46a026ab1dfff218963d34c45375355dd6f1995618262e1e038507ba3"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
dependencies = [
"bincode",
"camino",
@@ -638,12 +1192,10 @@ dependencies = [
[[package]]
name = "uniffi_meta"
version = "0.24.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f815bba89a6585954c089c53a775d166c0334c907be0e462bf0f0ac0494656e7"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
dependencies = [
"anyhow",
"bytes",
- "serde",
"siphasher",
"uniffi_checksum_derive",
]
@@ -651,16 +1203,24 @@ dependencies = [
[[package]]
name = "uniffi_testing"
version = "0.24.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1048d7c54816dc27ed4041fe952d42c7cb88e711cf3299e36ee70df7692c4a39"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
dependencies = [
"anyhow",
"camino",
"cargo_metadata",
"fs-err",
"once_cell",
- "serde",
- "serde_json",
+]
+
+[[package]]
+name = "uniffi_udl"
+version = "0.24.3"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
+dependencies = [
+ "anyhow",
+ "uniffi_meta",
+ "uniffi_testing",
+ "weedle2",
]
[[package]]
@@ -669,21 +1229,145 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
+[[package]]
+name = "valuable"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
+
+[[package]]
+name = "value-bag"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3"
+
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
+[[package]]
+name = "waker-fn"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.87"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
+dependencies = [
+ "cfg-if",
+ "wasm-bindgen-macro",
+]
+
+[[package]]
+name = "wasm-bindgen-backend"
+version = "0.2.87"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
+dependencies = [
+ "bumpalo",
+ "log",
+ "once_cell",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-futures"
+version = "0.4.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "wasm-bindgen",
+ "web-sys",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.87"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.87"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+ "wasm-bindgen-backend",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.87"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
+
+[[package]]
+name = "web-sys"
+version = "0.3.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
[[package]]
name = "weedle2"
version = "4.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e79c5206e1f43a2306fd64bdb95025ee4228960f2e6c5a8b173f3caaf807741"
+source = "git+https://github.com/mozilla/uniffi-rs#b0ad7415916481d1380eb0a92a84f03e6031d896"
dependencies = [
"nom",
]
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
+dependencies = [
+ "windows-targets",
+]
+
[[package]]
name = "windows-sys"
version = "0.48.0"
diff --git a/Cargo.toml b/Cargo.toml
index db8c673..35cdeaf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,9 +13,8 @@ opt-level = 3 # All optimizations # https://doc.rust-lang.org/cargo/referenc
debug = true # Enable debug symbols. For example, we can use `dwarfdump` to check crash traces.
[workspace.dependencies]
-# https://github.com/bitwarden/sdk/blame/master/Cargo.toml
-uniffi = { version = "0.24.3" }
-uniffi_build = { version = "0.24.3" }
-uniffi_bindgen = { version = "0.24.3" }
-uniffi_core = { version = "0.24.3" }
-uniffi_macros = { version = "0.24.3" }
+# uniffi = { version = "0.24" }
+# uniffi_bindgen = { version = "0.24" }
+# Note uniffi 0.24 has bugs so some interfaces are not created.
+uniffi = { git = "https://github.com/mozilla/uniffi-rs" }
+uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs" }
diff --git a/d.diff b/d.diff
deleted file mode 100644
index 75ec282..0000000
--- a/d.diff
+++ /dev/null
@@ -1,280 +0,0 @@
-diff --git a/Cargo.lock b/Cargo.lock
-index a8527d7..9877d6c 100644
---- a/Cargo.lock
-+++ b/Cargo.lock
-@@ -534,8 +534,9 @@ checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
-
- [[package]]
- name = "uniffi"
--version = "0.24.1"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
-+version = "0.24.3"
-+source = "registry+https://github.com/rust-lang/crates.io-index"
-+checksum = "7e835154c561cd75f253008093a908c06fb1f14327afb0ffea88eac72e534cc0"
- dependencies = [
- "anyhow",
- "camino",
-@@ -555,8 +556,9 @@ dependencies = [
-
- [[package]]
- name = "uniffi_bindgen"
--version = "0.24.1"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
-+version = "0.24.3"
-+source = "registry+https://github.com/rust-lang/crates.io-index"
-+checksum = "c2f91fdcd44de3aab35847bf80485f412879dcdd92b5140ee67f948e5eed750e"
- dependencies = [
- "anyhow",
- "askama",
-@@ -574,13 +576,14 @@ dependencies = [
- "toml",
- "uniffi_meta",
- "uniffi_testing",
-- "uniffi_udl",
-+ "weedle2",
- ]
-
- [[package]]
- name = "uniffi_build"
--version = "0.24.1"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
-+version = "0.24.3"
-+source = "registry+https://github.com/rust-lang/crates.io-index"
-+checksum = "4b20f693fb51c21a21b9816bed5522f0231cc769d8ba38821a05ab7d39dad51d"
- dependencies = [
- "anyhow",
- "camino",
-@@ -589,8 +592,9 @@ dependencies = [
-
- [[package]]
- name = "uniffi_checksum_derive"
--version = "0.24.1"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
-+version = "0.24.3"
-+source = "registry+https://github.com/rust-lang/crates.io-index"
-+checksum = "d1b354a9bd654cc6547d461ccd60a10eb6c7473178f12d8ff91cf4340ae947e8"
- dependencies = [
- "quote",
- "syn",
-@@ -598,8 +602,9 @@ dependencies = [
-
- [[package]]
- name = "uniffi_core"
--version = "0.24.1"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
-+version = "0.24.3"
-+source = "registry+https://github.com/rust-lang/crates.io-index"
-+checksum = "32793120650ceda4f4e0d8eacd784c1a736834b2cca7b12e2550d3a190553af4"
- dependencies = [
- "anyhow",
- "bytes",
-@@ -613,8 +618,9 @@ dependencies = [
-
- [[package]]
- name = "uniffi_macros"
--version = "0.24.1"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
-+version = "0.24.3"
-+source = "registry+https://github.com/rust-lang/crates.io-index"
-+checksum = "c65987b46a026ab1dfff218963d34c45375355dd6f1995618262e1e038507ba3"
- dependencies = [
- "bincode",
- "camino",
-@@ -631,8 +637,9 @@ dependencies = [
-
- [[package]]
- name = "uniffi_meta"
--version = "0.24.1"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
-+version = "0.24.3"
-+source = "registry+https://github.com/rust-lang/crates.io-index"
-+checksum = "f815bba89a6585954c089c53a775d166c0334c907be0e462bf0f0ac0494656e7"
- dependencies = [
- "anyhow",
- "bytes",
-@@ -643,8 +650,9 @@ dependencies = [
-
- [[package]]
- name = "uniffi_testing"
--version = "0.24.1"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
-+version = "0.24.3"
-+source = "registry+https://github.com/rust-lang/crates.io-index"
-+checksum = "1048d7c54816dc27ed4041fe952d42c7cb88e711cf3299e36ee70df7692c4a39"
- dependencies = [
- "anyhow",
- "camino",
-@@ -655,17 +663,6 @@ dependencies = [
- "serde_json",
- ]
-
--[[package]]
--name = "uniffi_udl"
--version = "0.24.1"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
--dependencies = [
-- "anyhow",
-- "uniffi_meta",
-- "uniffi_testing",
-- "weedle2",
--]
--
- [[package]]
- name = "utf8parse"
- version = "0.2.1"
-@@ -681,7 +678,8 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
- [[package]]
- name = "weedle2"
- version = "4.0.0"
--source = "git+https://github.com/mozilla/uniffi-rs?rev=e20b9c2b72144ef51a381c6b321ac810a4fbfdbe#e20b9c2b72144ef51a381c6b321ac810a4fbfdbe"
-+source = "registry+https://github.com/rust-lang/crates.io-index"
-+checksum = "2e79c5206e1f43a2306fd64bdb95025ee4228960f2e6c5a8b173f3caaf807741"
- dependencies = [
- "nom",
- ]
-diff --git a/Cargo.toml b/Cargo.toml
-index 9e70ffb..db8c673 100644
---- a/Cargo.toml
-+++ b/Cargo.toml
-@@ -14,8 +14,8 @@ debug = true # Enable debug symbols. For example, we can use `dwarfdump` to chec
-
- [workspace.dependencies]
- # https://github.com/bitwarden/sdk/blame/master/Cargo.toml
--uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "e20b9c2b72144ef51a381c6b321ac810a4fbfdbe" }
--uniffi_build = { git = "https://github.com/mozilla/uniffi-rs", rev = "e20b9c2b72144ef51a381c6b321ac810a4fbfdbe" }
--uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "e20b9c2b72144ef51a381c6b321ac810a4fbfdbe" }
--uniffi_core = { git = "https://github.com/mozilla/uniffi-rs", rev = "e20b9c2b72144ef51a381c6b321ac810a4fbfdbe" }
--uniffi_macros = { git = "https://github.com/mozilla/uniffi-rs", rev = "e20b9c2b72144ef51a381c6b321ac810a4fbfdbe" }
-\ No newline at end of file
-+uniffi = { version = "0.24.3" }
-+uniffi_build = { version = "0.24.3" }
-+uniffi_bindgen = { version = "0.24.3" }
-+uniffi_core = { version = "0.24.3" }
-+uniffi_macros = { version = "0.24.3" }
-diff --git a/hello/Cargo.toml b/hello/Cargo.toml
-index 27d81c1..4ec9781 100644
---- a/hello/Cargo.toml
-+++ b/hello/Cargo.toml
-@@ -5,21 +5,25 @@ name = "hello"
- version = "0.1.0"
-
- [lib]
--crate-type = ["staticlib", "rlib"]
-+crate-type = [
-+ "staticlib", # must for iOS
-+ "rlib",
-+ "cdylib", # must for Android
-+]
- # staticlib would be good enough.
- # adding "rlib" here just in case that we need to call these public interfaces directly from another Rust crate
- name = "hello"
-
-
- [dependencies]
--uniffi = {workspace = true}
-+uniffi = { workspace = true }
-
- [build-dependencies]
--uniffi = { workspace = true, features = [ "build" ] }
-+uniffi = { workspace = true, features = ["build"] }
-
- [profile.release]
- codegen-units = 1 # Reduce number of codegen units to increase optimizations.
--lto = true # Enable Link Time Optimization
--opt-level = 'z' # Optimize for size.
-+lto = true # Enable Link Time Optimization
-+opt-level = 'z' # Optimize for size.
- # panic = 'abort' # Abort on panic
- debug = true # Enable debug symbols. For example, we can use `dwarfdump` to check crash traces.
-diff --git a/hello/platforms/android/UniffiRustExample/app/build.gradle b/hello/platforms/android/UniffiRustExample/app/build.gradle
-index 613b3d5..219dd17 100644
---- a/hello/platforms/android/UniffiRustExample/app/build.gradle
-+++ b/hello/platforms/android/UniffiRustExample/app/build.gradle
-@@ -7,15 +7,19 @@ plugins {
- apply plugin: 'org.mozilla.rust-android-gradle.rust-android'
-
- cargo {
-- module = "../../../.." // Or whatever directory contains your Cargo.toml
-+ prebuiltToolchains = true
-+ targetDirectory = "$projectDir/../../../../../target" // because of workspace
-+ module = "$projectDir/../../../.." // Or whatever directory contains your Cargo.toml
- libname = "hello" // Or whatever matches Cargo.toml's [package] name.
-- targets = ["arm", "x86", "x86_64", "arm64"]
-+ pythonCommand = 'python3'
-+ profile = 'debug'
-+ targets = ["x86_64", "arm64"]
- extraCargoBuildArguments = ["--lib"]
-+ verbose = true
- }
-
- android {
-- compileSdk 31
-- ndkVersion "25.2.9519653"
-+ compileSdk 33
-
- defaultConfig {
- applicationId "com.demo.mobile.uniffirustexample"
-@@ -70,7 +74,5 @@ afterEvaluate {
- }
- def buildType = "${variant.buildType.name.capitalize()}"
- tasks["generate${productFlavor}${buildType}Assets"].dependsOn(tasks["cargoBuild"])
--
--
- }
- }
-diff --git a/hello/platforms/android/UniffiRustExample/app/src/androidTest/java/com/microsoft/tscodegen/demo/uniffirustexample/ExampleInstrumentedTest.kt b/hello/platforms/android/UniffiRustExample/app/src/androidTest/java/com/microsoft/tscodegen/demo/uniffirustexample/ExampleInstrumentedTest.kt
-deleted file mode 100644
-index f6d0e68..0000000
---- a/hello/platforms/android/UniffiRustExample/app/src/androidTest/java/com/microsoft/tscodegen/demo/uniffirustexample/ExampleInstrumentedTest.kt
-+++ /dev/null
-@@ -1,24 +0,0 @@
--package com.example.mobile.demo.uniffirustexample
--
--import androidx.test.platform.app.InstrumentationRegistry
--import androidx.test.ext.junit.runners.AndroidJUnit4
--
--import org.junit.Test
--import org.junit.runner.RunWith
--
--import org.junit.Assert.*
--
--/**
-- * Instrumented test, which will execute on an Android device.
-- *
-- * See [testing documentation](http://d.android.com/tools/testing).
-- */
--@RunWith(AndroidJUnit4::class)
--class ExampleInstrumentedTest {
-- @Test
-- fun useAppContext() {
-- // Context of the app under test.
-- val appContext = InstrumentationRegistry.getInstrumentation().targetContext
-- assertEquals("com.example.mobile.demo.uniffirustexample", appContext.packageName)
-- }
--}
-\ No newline at end of file
-diff --git a/hello/platforms/android/UniffiRustExample/build.gradle b/hello/platforms/android/UniffiRustExample/build.gradle
-index 6ab6cc2..7c338ee 100644
---- a/hello/platforms/android/UniffiRustExample/build.gradle
-+++ b/hello/platforms/android/UniffiRustExample/build.gradle
-@@ -11,7 +11,7 @@ plugins {
- id 'com.android.application' version '8.0.2' apply false
- id 'com.android.library' version '8.0.2' apply false
- id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
-- id "org.mozilla.rust-android-gradle.rust-android" version "0.9.2"
-+ id "org.mozilla.rust-android-gradle.rust-android" version "0.9.3"
-
- }
-
-diff --git a/hello/src/lib.rs b/hello/src/lib.rs
-index 485d349..c0fe217 100644
---- a/hello/src/lib.rs
-+++ b/hello/src/lib.rs
-@@ -1,4 +1,5 @@
--uniffi::setup_scaffolding!();
-+// uniffi::setup_scaffolding!();
-+uniffi::include_scaffolding!("hello");
- // This must be put at the top
-
-
-
diff --git a/hello/Cargo.toml b/hello/Cargo.toml
index 4ec9781..ad2c8dd 100644
--- a/hello/Cargo.toml
+++ b/hello/Cargo.toml
@@ -16,7 +16,12 @@ name = "hello"
[dependencies]
+async-std = "1.12.0"
+once_cell = "1.18.0"
uniffi = { workspace = true }
+# uniffi_bindgen = { workspace = true }
+# uniffi_macros = { workspace = true }
+
[build-dependencies]
uniffi = { workspace = true, features = ["build"] }
diff --git a/hello/Makefile b/hello/Makefile
index b2e820f..44800a0 100644
--- a/hello/Makefile
+++ b/hello/Makefile
@@ -9,14 +9,15 @@ apple:
@make cp-xcframeowrk-source
build-targets:
- cargo build --lib --release --target x86_64-apple-ios
- cargo build --lib --release --target aarch64-apple-ios-sim
- cargo +nightly build -Z build-std --lib --release --target aarch64-apple-ios-macabi
- cargo +nightly build -Z build-std --lib --release --target x86_64-apple-ios-macabi
- cargo build --lib --release --target aarch64-apple-ios
+ cargo build --lib --target x86_64-apple-ios
+ cargo build --lib --target aarch64-apple-ios-sim
+ cargo +nightly build -Z build-std --lib --target aarch64-apple-ios-macabi
+ cargo +nightly build -Z build-std --lib --target x86_64-apple-ios-macabi
+ cargo build --lib --target aarch64-apple-ios
bindgen-swift:
- cargo run -p uniffi-bindgen generate src/hello.udl --language swift
+ cargo build
+ cargo run -p uniffi-bindgen generate --language swift --lib-file $(TARGET_DIR)/debug/libhello.dylib src/hello.udl
sed -i '' 's/module\ HelloFFI/framework\ module\ HelloFFI/' src/HelloFFI.modulemap
bindgen-kotlin:
@@ -25,17 +26,17 @@ bindgen-kotlin:
assemble-frameworks:
cd $(TARGET_DIR) && find . -type d -name HelloFFI.framework -exec rm -rf {} \; || echo "rm failed"
- cd $(TARGET_DIR)/x86_64-apple-ios/release && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && pwd && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
- cd $(TARGET_DIR)/aarch64-apple-ios-sim/release && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
- cd $(TARGET_DIR)/aarch64-apple-ios/release && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
- cd $(TARGET_DIR)/aarch64-apple-ios-macabi/release && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
- cd $(TARGET_DIR)/x86_64-apple-ios-macabi/release && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
+ cd $(TARGET_DIR)/x86_64-apple-ios/debug && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && pwd && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
+ cd $(TARGET_DIR)/aarch64-apple-ios-sim/debug && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
+ cd $(TARGET_DIR)/aarch64-apple-ios/debug && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
+ cd $(TARGET_DIR)/aarch64-apple-ios-macabi/debug && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
+ cd $(TARGET_DIR)/x86_64-apple-ios-macabi/debug && mkdir -p HelloFFI.framework && cd HelloFFI.framework && mkdir Headers Modules Resources && cp ../../../../hello/src/HelloFFI.modulemap ./Modules/module.modulemap && cp ../../../../hello/src/HelloFFI.h ./Headers/HelloFFI.h && cp ../$(STATIC_LIB_NAME) ./HelloFFI && cp ../../../../hello/misc/apple/Info.plist ./Resources
xcframeowrk:
- lipo -create $(TARGET_DIR)/x86_64-apple-ios/release/HelloFFI.framework/HelloFFI $(TARGET_DIR)/aarch64-apple-ios-sim/release/HelloFFI.framework/HelloFFI -output $(TARGET_DIR)/aarch64-apple-ios-sim/release/HelloFFI.framework/HelloFFI
- lipo -create $(TARGET_DIR)/x86_64-apple-ios-macabi/release/HelloFFI.framework/HelloFFI $(TARGET_DIR)/aarch64-apple-ios-macabi/release/HelloFFI.framework/HelloFFI -output $(TARGET_DIR)/aarch64-apple-ios-macabi/release/HelloFFI.framework/HelloFFI
+ lipo -create $(TARGET_DIR)/x86_64-apple-ios/debug/HelloFFI.framework/HelloFFI $(TARGET_DIR)/aarch64-apple-ios-sim/debug/HelloFFI.framework/HelloFFI -output $(TARGET_DIR)/aarch64-apple-ios-sim/debug/HelloFFI.framework/HelloFFI
+ lipo -create $(TARGET_DIR)/x86_64-apple-ios-macabi/debug/HelloFFI.framework/HelloFFI $(TARGET_DIR)/aarch64-apple-ios-macabi/debug/HelloFFI.framework/HelloFFI -output $(TARGET_DIR)/aarch64-apple-ios-macabi/debug/HelloFFI.framework/HelloFFI
rm -rf $(TARGET_DIR)/HelloFFI.xcframework || echo "skip removing"
- xcodebuild -create-xcframework -framework $(TARGET_DIR)/aarch64-apple-ios/release/HelloFFI.framework -framework $(TARGET_DIR)/aarch64-apple-ios-sim/release/HelloFFI.framework -framework $(TARGET_DIR)/aarch64-apple-ios-macabi/release/HelloFFI.framework -output $(TARGET_DIR)/HelloFFI.xcframework
+ xcodebuild -create-xcframework -framework $(TARGET_DIR)/aarch64-apple-ios/debug/HelloFFI.framework -framework $(TARGET_DIR)/aarch64-apple-ios-sim/debug/HelloFFI.framework -framework $(TARGET_DIR)/aarch64-apple-ios-macabi/debug/HelloFFI.framework -output $(TARGET_DIR)/HelloFFI.xcframework
cp-xcframeowrk-source:
cp -r $(TARGET_DIR)/HelloFFI.xcframework platforms/apple/Hello/Sources
diff --git a/hello/platforms/android/UniffiRustExample/app/build.gradle b/hello/platforms/android/UniffiRustExample/app/build.gradle
index a4129fd..f951479 100644
--- a/hello/platforms/android/UniffiRustExample/app/build.gradle
+++ b/hello/platforms/android/UniffiRustExample/app/build.gradle
@@ -20,7 +20,8 @@ cargo {
android {
compileSdk 31
- ndkVersion System.getenv("ANDROID_NDK_VERSION")
+ // https://developer.android.com/studio/projects/configure-agp-ndk
+ ndkPath System.getenv("ANDROID_NDK_HOME")
defaultConfig {
applicationId "com.demo.mobile.uniffirustexample"
diff --git a/hello/platforms/apple/Hello/Package.swift b/hello/platforms/apple/Hello/Package.swift
index 9f26701..da9c3fe 100644
--- a/hello/platforms/apple/Hello/Package.swift
+++ b/hello/platforms/apple/Hello/Package.swift
@@ -5,6 +5,9 @@ import PackageDescription
let package = Package(
name: "Hello",
+ platforms: [
+ .iOS(.v13),
+ ],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
diff --git a/hello/platforms/apple/HelloAppleDemoApp.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/hello/platforms/apple/HelloAppleDemoApp.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000..0c67376
--- /dev/null
+++ b/hello/platforms/apple/HelloAppleDemoApp.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/hello/platforms/apple/HelloAppleDemoApp/AppDelegate.swift b/hello/platforms/apple/HelloAppleDemoApp/AppDelegate.swift
index addb80d..b2fb584 100644
--- a/hello/platforms/apple/HelloAppleDemoApp/AppDelegate.swift
+++ b/hello/platforms/apple/HelloAppleDemoApp/AppDelegate.swift
@@ -1,6 +1,7 @@
//
import UIKit
+import Hello
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -9,6 +10,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
+ setLoggingDelegate(delegate: self)
return true
}
@@ -29,3 +31,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
+extension AppDelegate: GreetingDelegate {
+ func greetingCalled(to: String) {
+ print("[swift] greeting called to \(to)")
+ }
+}
diff --git a/hello/platforms/apple/HelloAppleDemoApp/ViewController.swift b/hello/platforms/apple/HelloAppleDemoApp/ViewController.swift
index 0058709..7e842bd 100644
--- a/hello/platforms/apple/HelloAppleDemoApp/ViewController.swift
+++ b/hello/platforms/apple/HelloAppleDemoApp/ViewController.swift
@@ -7,8 +7,14 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
- // Do any additional setup after loading the view.
- print(rustGreeting(name: "Bob"))
+// Do any additional setup after loading the view.
+ print(rustGreeting(to: "Bob"))
+ print(Hello.add(a: 1, b: 2))
+
+ Task {
+ let str = await Hello.sayAfter(ms: 1500, who: "Async")
+ print(str)
+ }
}
}
diff --git a/hello/src/hello.udl b/hello/src/hello.udl
index e4aa852..c2a7030 100644
--- a/hello/src/hello.udl
+++ b/hello/src/hello.udl
@@ -1,4 +1,3 @@
namespace Hello {
- string rust_greeting(string name);
};
diff --git a/hello/src/lib.rs b/hello/src/lib.rs
index c0fe217..da7a742 100644
--- a/hello/src/lib.rs
+++ b/hello/src/lib.rs
@@ -1,12 +1,59 @@
-// uniffi::setup_scaffolding!();
uniffi::include_scaffolding!("hello");
-// This must be put at the top
+// This is interesting. Because we're supposed to use setup_scaffolding!() at the top.
+// Please refer to
+// I found this sample at: https://github.com/MathieuTricoire/convex-rs-ffi/tree/90fb36ea3dec16b05a8e4f47aa032987b2727122
+// uniffi::setup_scaffolding!();
+use async_std::future::{pending, timeout};
+#[uniffi::export(callback_interface)]
+pub trait GreetingDelegate: Send + Sync {
+ fn greeting_called(&self, to: String);
+}
+pub struct GreetingLogger {
+ delegate: Box,
+}
+
+impl GreetingLogger {
+ pub fn new(delegate: Box) -> Self {
+ Self { delegate }
+ }
+
+ pub fn greeting_called(&self, to: String) {
+ self.delegate.greeting_called(to)
+ }
+}
+
+static LOGGER_INSTANCE: once_cell::sync::OnceCell =
+ once_cell::sync::OnceCell::new();
+
+#[uniffi::export]
+pub fn set_logging_delegate(delegate: Box) {
+ let logger = GreetingLogger::new(delegate);
+ let result = LOGGER_INSTANCE.set(logger);
+ if result.is_err() {
+ panic!("Logger already set");
+ }
+}
+
+#[uniffi::export]
pub fn rust_greeting(to: String) -> String {
+ if let Some(logger) = LOGGER_INSTANCE.get() {
+ logger.greeting_called(to.clone());
+ }
return format!("Hello, {}!", to);
}
-// uniffi::include_scaffolding!("hello");
-// We don't need this because of uniffi::setup_scaffolding()
-// Please refer to
+#[uniffi::export]
+pub fn add(a: i32, b: i32) -> i32 {
+ a + b
+}
+
+#[uniffi::export]
+pub async fn say_after(ms: u64, who: String) -> String {
+ let never = pending::<()>();
+ timeout(std::time::Duration::from_millis(ms), never)
+ .await
+ .unwrap_err();
+ format!("Hello, {who}!")
+}