cleanup and fix android build
This commit is contained in:
parent
b225527f47
commit
e7d999d64f
|
@ -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",
|
||||
]
|
||||
|
|
10
Cargo.toml
10
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" }
|
||||
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" }
|
||||
|
|
|
@ -0,0 +1,280 @@
|
|||
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
|
||||
|
||||
|
||||
|
|
@ -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.
|
||||
|
|
|
@ -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"])
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
|
@ -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"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -8,4 +8,6 @@ xcuserdata/
|
|||
HelloFFI.xcframework
|
||||
Hello.swift
|
||||
|
||||
HelloAppleDemoApp.xcodeproj/project.xcworkspace/xcuserdata/wildcat.xcuserdatad/UserInterfaceState.xcuserstate
|
||||
HelloAppleDemoApp.xcodeproj/project.xcworkspace/xcuserdata/wildcat.xcuserdatad/UserInterfaceState.xcuserstate
|
||||
|
||||
DerivedData/
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
uniffi::setup_scaffolding!();
|
||||
// uniffi::setup_scaffolding!();
|
||||
uniffi::include_scaffolding!("hello");
|
||||
// This must be put at the top
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue