diff --git a/Cargo.lock b/Cargo.lock index 83c043a2db..be5dacd71f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1069,7 +1069,7 @@ dependencies = [ "clap", "glob", "serde", - "toml", + "toml 0.5.9", "uniffi_bindgen", "uniffi_pipeline", ] @@ -2188,6 +2188,7 @@ checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.3", + "serde", ] [[package]] @@ -3059,7 +3060,7 @@ dependencies = [ "serde", "serde_derive", "thiserror 2.0.3", - "toml", + "toml 0.5.9", ] [[package]] @@ -3961,18 +3962,28 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.205" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.205" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -4001,6 +4012,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" +dependencies = [ + "serde_core", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -4095,9 +4115,9 @@ checksum = "2e24979f63a11545f5f2c60141afe249d4f19f84581ea2138065e400941d83d3" [[package]] name = "siphasher" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "slab" @@ -4191,7 +4211,7 @@ dependencies = [ "cargo_metadata 0.15.2", "clap", "serde_yaml 0.8.24", - "toml", + "toml 0.5.9", "toml_edit", ] @@ -4617,12 +4637,36 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae2a4cf385da23d1d53bc15cdfa5c2109e93d8d362393c801e87da2f72f0e201" +dependencies = [ + "indexmap 2.5.0", + "serde_core", + "serde_spanned", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 0.7.12", +] + [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + [[package]] name = "toml_edit" version = "0.22.22" @@ -4630,10 +4674,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap 2.5.0", - "toml_datetime", + "toml_datetime 0.6.8", "winnow 0.6.19", ] +[[package]] +name = "toml_parser" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10" +dependencies = [ + "winnow 0.7.12", +] + +[[package]] +name = "toml_writer" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" + [[package]] name = "tower" version = "0.4.13" @@ -4775,7 +4834,7 @@ dependencies = [ "serde_derive", "serde_json", "termcolor", - "toml", + "toml 0.5.9", ] [[package]] @@ -4829,9 +4888,8 @@ checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "uniffi" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3291800a6b06569f7d3e15bdb6dc235e0f0c8bd3eb07177f430057feb076415f" +version = "0.30.0" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "anyhow", "camino", @@ -4858,9 +4916,8 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a04b99fa7796eaaa7b87976a0dbdd1178dc1ee702ea00aca2642003aef9b669e" +version = "0.30.0" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "anyhow", "askama", @@ -4875,7 +4932,7 @@ dependencies = [ "serde", "tempfile", "textwrap", - "toml", + "toml 0.9.6", "uniffi_internal_macros", "uniffi_meta", "uniffi_pipeline", @@ -4884,9 +4941,8 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025a05cba02ee22b6624ac3d257e59c7395319ea8fe1aae33a7cdb4e2a3016cc" +version = "0.30.0" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "anyhow", "camino", @@ -4895,9 +4951,8 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38a9a27529ccff732f8efddb831b65b1e07f7dea3fd4cacd4a35a8c4b253b98" +version = "0.30.0" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "anyhow", "bytes", @@ -4907,9 +4962,8 @@ dependencies = [ [[package]] name = "uniffi_internal_macros" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09acd2ce09c777dd65ee97c251d33c8a972afc04873f1e3b21eb3492ade16933" +version = "0.30.0" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "anyhow", "indexmap 2.5.0", @@ -4920,9 +4974,8 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5596f178c4f7aafa1a501c4e0b96236a96bc2ef92bdb453d83e609dad0040152" +version = "0.30.0" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "camino", "fs-err", @@ -4931,15 +4984,14 @@ dependencies = [ "quote", "serde", "syn 2.0.106", - "toml", + "toml 0.9.6", "uniffi_meta", ] [[package]] name = "uniffi_meta" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beadc1f460eb2e209263c49c4f5b19e9a02e00a3b2b393f78ad10d766346ecff" +version = "0.30.0" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "anyhow", "siphasher", @@ -4949,9 +5001,8 @@ dependencies = [ [[package]] name = "uniffi_pipeline" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd76b3ac8a2d964ca9fce7df21c755afb4c77b054a85ad7a029ad179cc5abb8a" +version = "0.30.0" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "anyhow", "heck", @@ -4962,9 +5013,8 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319cf905911d70d5b97ce0f46f101619a22e9a189c8c46d797a9955e9233716" +version = "0.30.0" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "anyhow", "textwrap", @@ -5327,8 +5377,7 @@ dependencies = [ [[package]] name = "weedle2" version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e" +source = "git+https://github.com/mozilla/uniffi-rs?rev=5897c6f07068182dc09869fc1810264d17516f16#5897c6f07068182dc09869fc1810264d17516f16" dependencies = [ "nom", ] diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index a2fee0e6e3..e6f44379b4 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -564,9 +564,11 @@ The following text applies to code linked from these dependencies: [security-framework](https://github.com/kornelski/rust-security-framework), [semver](https://github.com/dtolnay/semver), [serde](https://github.com/serde-rs/serde), +[serde_core](https://github.com/serde-rs/serde), [serde_derive](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), [serde_path_to_error](https://github.com/dtolnay/path-to-error), +[serde_spanned](https://github.com/toml-rs/toml), [serde_urlencoded](https://github.com/nox/serde_urlencoded), [sha2](https://github.com/RustCrypto/hashes), [shlex](https://github.com/comex/rust-shlex), @@ -582,6 +584,10 @@ The following text applies to code linked from these dependencies: [thiserror](https://github.com/dtolnay/thiserror), [thread_local](https://github.com/Amanieu/thread_local-rs), [toml](https://github.com/alexcrichton/toml-rs), +[toml](https://github.com/toml-rs/toml), +[toml_datetime](https://github.com/toml-rs/toml), +[toml_parser](https://github.com/toml-rs/toml), +[toml_writer](https://github.com/toml-rs/toml), [typenum](https://github.com/paholg/typenum), [url](https://github.com/servo/rust-url), [utf8_iter](https://github.com/hsivonen/utf8_iter), diff --git a/build-scripts/component-common.gradle b/build-scripts/component-common.gradle index 2750f3be55..b705c183b2 100644 --- a/build-scripts/component-common.gradle +++ b/build-scripts/component-common.gradle @@ -121,7 +121,7 @@ ext.configureUniFFIBindgen = { crateName -> workingDir project.rootDir commandLine bindgen - args 'generate', '--library', libraryPath, "--crate", crateName, '--language', 'kotlin', '--out-dir', uniffiOutDir.get(), '--no-format' + args 'generate', '--library', "--crate", crateName, '--language', 'kotlin', '--out-dir', uniffiOutDir.get(), '--no-format', libraryPath outputs.dir uniffiOutDir // Re-generate when the native megazord library is rebuilt @@ -143,7 +143,7 @@ ext.configureUniFFIBindgen = { crateName -> } exec { workingDir project.rootDir - commandLine '/usr/bin/env', 'cargo', 'uniffi-bindgen', 'generate', '--library', libraryPath, "--crate", crateName, '--language', 'kotlin', '--out-dir', uniffiOutDir.get(), '--no-format' + commandLine '/usr/bin/env', 'cargo', 'uniffi-bindgen', 'generate', "--crate", crateName, '--language', 'kotlin', '--out-dir', uniffiOutDir.get(), '--no-format', libraryPath } } diff --git a/components/ads-client/Cargo.toml b/components/ads-client/Cargo.toml index fe424f227f..d55d73bce5 100644 --- a/components/ads-client/Cargo.toml +++ b/components/ads-client/Cargo.toml @@ -23,7 +23,7 @@ serde = "1" serde_json = "1" thiserror = "2" once_cell = "1.5" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } url = { version = "2", features = ["serde"] } uuid = { version = "1.3", features = ["v4"] } viaduct = { path = "../viaduct" } @@ -35,4 +35,4 @@ mockito = { version = "0.31", default-features = false } viaduct-dev = { path = "../support/viaduct-dev" } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } diff --git a/components/as-ohttp-client/Cargo.toml b/components/as-ohttp-client/Cargo.toml index 9e89506f5e..732219760e 100644 --- a/components/as-ohttp-client/Cargo.toml +++ b/components/as-ohttp-client/Cargo.toml @@ -10,7 +10,7 @@ exclude = ["/ios"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } thiserror = "2" parking_lot = "0.12" rusqlite = { version = "0.37.0", features = ["bundled"] } @@ -18,4 +18,4 @@ bhttp = "0.7.1" ohttp = { version = "0.7.1", default-features = false, features = ["client", "server", "app-svc", "external-sqlite"] } [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/components/autofill/Cargo.toml b/components/autofill/Cargo.toml index cfe68af682..1777c7f991 100644 --- a/components/autofill/Cargo.toml +++ b/components/autofill/Cargo.toml @@ -23,7 +23,7 @@ sync-guid = { path = "../support/guid", features = ["rusqlite_support", "random" sync15 = { path = "../sync15", features = ["sync-engine"] } thiserror = "2" types = { path = "../support/types" } -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } url = { version = "2.2", features = ["serde"] } [dev-dependencies] @@ -32,4 +32,4 @@ nss = { path = "../support/rc_crypto/nss" } error-support = { path = "../support/error", features=["testing"] } [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/components/context_id/Cargo.toml b/components/context_id/Cargo.toml index 02741f5fa4..f791f135f5 100644 --- a/components/context_id/Cargo.toml +++ b/components/context_id/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "MPL-2.0" [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} [dependencies] chrono = "0.4" @@ -15,7 +15,7 @@ parking_lot = "0.12" serde = "1" serde_json = "1" thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } url = "2" uuid = { version = "1.3", features = ["v4"]} viaduct = { path = "../viaduct" } diff --git a/components/crashtest/Cargo.toml b/components/crashtest/Cargo.toml index a7620e4f0d..0da3ea51f2 100644 --- a/components/crashtest/Cargo.toml +++ b/components/crashtest/Cargo.toml @@ -9,7 +9,7 @@ exclude = ["/android", "/ios"] [dependencies] log = "0.4" thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/components/example/Cargo.toml b/components/example/Cargo.toml index 5b496cb5a2..4878a5842a 100644 --- a/components/example/Cargo.toml +++ b/components/example/Cargo.toml @@ -12,7 +12,7 @@ license = "MPL-2.0" [dependencies] # UniFFI is a dependency for any shared Rust component, make the version match what the other # components are using. -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } # app-services support crates that you probably want to use. error-support = { path = "../support/error" } interrupt-support = { path = "../support/interrupt" } diff --git a/components/filter_adult/Cargo.toml b/components/filter_adult/Cargo.toml index f28de7dc81..040d06590f 100644 --- a/components/filter_adult/Cargo.toml +++ b/components/filter_adult/Cargo.toml @@ -11,7 +11,7 @@ error-support = { path = "../support/error" } md-5 = "0.10" regex = "1" thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } [[bin]] name = "import-site-list" diff --git a/components/fxa-client/Cargo.toml b/components/fxa-client/Cargo.toml index b975ea452c..47a4b50706 100644 --- a/components/fxa-client/Cargo.toml +++ b/components/fxa-client/Cargo.toml @@ -25,12 +25,12 @@ error-support = { path = "../support/error", features = ["tracing-logging"] } thiserror = "2" anyhow = "1.0" sync-guid = { path = "../support/guid", features = ["random"] } -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } payload-support = { path = "../support/payload" } nss = { path = "../support/rc_crypto/nss" } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } [dev-dependencies] viaduct-dev = { path = "../support/viaduct-dev"} diff --git a/components/init_rust_components/Cargo.toml b/components/init_rust_components/Cargo.toml index cfc4fec717..59c7348512 100644 --- a/components/init_rust_components/Cargo.toml +++ b/components/init_rust_components/Cargo.toml @@ -12,6 +12,6 @@ keydb = ["nss/keydb"] ohttp = ["dep:viaduct", "viaduct/ohttp"] [dependencies] -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } nss = { path = "../support/rc_crypto/nss" } viaduct = { path = "../viaduct", optional = true } diff --git a/components/logins/Cargo.toml b/components/logins/Cargo.toml index 56f87886bf..777d83064e 100644 --- a/components/logins/Cargo.toml +++ b/components/logins/Cargo.toml @@ -29,12 +29,12 @@ rusqlite = { version = "0.37.0", features = ["limits", "unlock_notify"] } sync-guid = { path = "../support/guid", features = ["rusqlite_support", "random"] } thiserror = "2" anyhow = "1.0" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } async-trait = { version = "0.1", optional = true } futures = { version = "0.3", optional = true, features = ["executor"] } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } diff --git a/components/logins/src/encryption.rs b/components/logins/src/encryption.rs index f460cda3bc..d5426ba607 100644 --- a/components/logins/src/encryption.rs +++ b/components/logins/src/encryption.rs @@ -72,6 +72,7 @@ use nss::pk11::sym_key::{ /// Note that EncryptorDecryptor must not call any LoginStore methods. The login store can call out /// to the EncryptorDecryptor when it's internal mutex is held so calling back in to the LoginStore /// may deadlock. +#[uniffi::trait_interface] pub trait EncryptorDecryptor: Send + Sync { fn encrypt(&self, cleartext: Vec) -> ApiResult>; fn decrypt(&self, ciphertext: Vec) -> ApiResult>; @@ -152,6 +153,7 @@ impl EncryptorDecryptor for ManagedEncryptorDecryptor { /// Consumers can implement the KeyManager in combination with the ManagedEncryptorDecryptor to hand /// over the encryption key whenever encryption or decryption happens. +#[uniffi::trait_interface] pub trait KeyManager: Send + Sync { fn get_key(&self) -> ApiResult>; } diff --git a/components/merino/Cargo.toml b/components/merino/Cargo.toml index d47ad4c3e5..7654d5fc0e 100644 --- a/components/merino/Cargo.toml +++ b/components/merino/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } serde = { version = "1", features = ["derive"] } serde_json = "1" url = "2" @@ -13,4 +13,4 @@ error-support = { path = "../support/error" } thiserror = "2" [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } diff --git a/components/nimbus/Cargo.toml b/components/nimbus/Cargo.toml index 0fc5c50550..1433e13bb0 100644 --- a/components/nimbus/Cargo.toml +++ b/components/nimbus/Cargo.toml @@ -32,7 +32,7 @@ uuid = { version = "1.3", features = ["serde", "v4"]} sha2 = "^0.10" hex = "0.4" once_cell = "1" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } chrono = { version = "0.4", features = ["serde"]} icu_segmenter = "2" error-support = { path = "../support/error" } @@ -42,7 +42,7 @@ regex = { version = "1.9", optional = true } firefox-versioning = { path = "../support/firefox-versioning", optional = true } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } diff --git a/components/nimbus/src/stateful/targeting.rs b/components/nimbus/src/stateful/targeting.rs index 897ae0bd3f..97aff1e98c 100644 --- a/components/nimbus/src/stateful/targeting.rs +++ b/components/nimbus/src/stateful/targeting.rs @@ -39,6 +39,7 @@ impl NimbusTargetingHelper { } } +#[uniffi::trait_interface] pub trait RecordedContext: Send + Sync { /// Returns a JSON representation of the context object /// diff --git a/components/places/Cargo.toml b/components/places/Cargo.toml index c3df5fa3e7..423c630ee8 100644 --- a/components/places/Cargo.toml +++ b/components/places/Cargo.toml @@ -33,7 +33,7 @@ error-support = { path = "../support/error" } sync-guid = { path = "../support/guid", features = ["rusqlite_support", "random"]} thiserror = "2" anyhow = "1.0" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } @@ -41,4 +41,4 @@ tempfile = "3.1" sql-support = { path = "../support/sql" } [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/components/push/Cargo.toml b/components/push/Cargo.toml index fac57bf9ef..d9cd263475 100644 --- a/components/push/Cargo.toml +++ b/components/push/Cargo.toml @@ -19,11 +19,11 @@ error-support = { path = "../support/error" } sql-support = { path = "../support/sql" } rc_crypto = { path = "../support/rc_crypto", features = ["ece"] } thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } types = { path = "../support/types" } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } diff --git a/components/relay/Cargo.toml b/components/relay/Cargo.toml index e5e4b9031f..b1edce8621 100644 --- a/components/relay/Cargo.toml +++ b/components/relay/Cargo.toml @@ -12,7 +12,7 @@ serde_json = "1" thiserror = "2" url = "2" viaduct = { path = "../viaduct" } -uniffi = "0.29.0" +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } [dev-dependencies] expect-test = "1.4" @@ -20,4 +20,4 @@ mockito = { version = "0.31", default-features = false} viaduct-dev = { path = "../support/viaduct-dev"} [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/components/relevancy/Cargo.toml b/components/relevancy/Cargo.toml index b62d2b4094..a4489848f1 100644 --- a/components/relevancy/Cargo.toml +++ b/components/relevancy/Cargo.toml @@ -21,13 +21,13 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" serde_path_to_error = "0.1" thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } url = "2.5" remote_settings = { path = "../remote_settings"} base64 = "0.21.2" [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } [lib] diff --git a/components/remote_settings/Cargo.toml b/components/remote_settings/Cargo.toml index 9bb1a0d2e9..a8e19d2ad2 100644 --- a/components/remote_settings/Cargo.toml +++ b/components/remote_settings/Cargo.toml @@ -15,7 +15,7 @@ signatures = ["dep:canonical_json", "dep:rc_crypto"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } thiserror = "2" serde = { version = "1", features=["derive"] } serde_json = "1" @@ -35,7 +35,7 @@ canonical_json = { version = "0.5", optional = true } rc_crypto = { path = "../support/rc_crypto", optional = true } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } [dev-dependencies] expect-test = "1.4" diff --git a/components/search/Cargo.toml b/components/search/Cargo.toml index ca8d5abf9f..9e3561c6c5 100644 --- a/components/search/Cargo.toml +++ b/components/search/Cargo.toml @@ -14,11 +14,11 @@ remote_settings = { path = "../remote_settings" } serde = { version = "1", features = ["derive"] } serde_json = "1" thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } firefox-versioning = { path = "../support/firefox-versioning" } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } diff --git a/components/suggest/Cargo.toml b/components/suggest/Cargo.toml index c5fcf5cf45..33d3198b02 100644 --- a/components/suggest/Cargo.toml +++ b/components/suggest/Cargo.toml @@ -28,7 +28,7 @@ sql-support = { path = "../support/sql" } viaduct = { path = "../viaduct" } tempfile = { version = "3.2.0", optional = true } thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } url = { version = "2.1", features = ["serde"] } [dev-dependencies] @@ -39,7 +39,7 @@ itertools = "0.14" rc_crypto = { path = "../support/rc_crypto" } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } [features] # Required for the benchmarks to work, wasted bytes otherwise. diff --git a/components/support/error/Cargo.toml b/components/support/error/Cargo.toml index 5d614a7e30..d8f46a662a 100644 --- a/components/support/error/Cargo.toml +++ b/components/support/error/Cargo.toml @@ -16,10 +16,10 @@ log = { version = "0.4" } parking_lot = { version = ">=0.11,<=0.12" } tracing = { version = "0.1", optional = true } tracing-support = { path = "../tracing", optional = true } -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} [features] backtrace = ["dep:backtrace"] diff --git a/components/support/interrupt/Cargo.toml b/components/support/interrupt/Cargo.toml index 1e8ff6d937..5eb7526942 100644 --- a/components/support/interrupt/Cargo.toml +++ b/components/support/interrupt/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" lazy_static = "1.4" parking_lot = ">=0.11,<=0.12" rusqlite = { version = "0.37.0", features = ["functions", "limits", "bundled", "unlock_notify"] } -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } diff --git a/components/support/nimbus-fml/Cargo.toml b/components/support/nimbus-fml/Cargo.toml index 0066f6a348..c7bb1ebccb 100644 --- a/components/support/nimbus-fml/Cargo.toml +++ b/components/support/nimbus-fml/Cargo.toml @@ -23,7 +23,7 @@ name = "nimbus_fml" name = "nimbus-fml" [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"], optional = true } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"], optional = true } [dev-dependencies] tempfile = "3" @@ -44,7 +44,7 @@ heck = "0.5" icu_segmenter = "2" url = { version = "2", features = ["serde"] } glob = "0.3.0" -uniffi = { version = "0.29.0", optional = true } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", optional = true } cfg-if = "1.0.0" lazy_static = "1.4" sha2 = "^0.10" diff --git a/components/support/rust-log-forwarder/Cargo.toml b/components/support/rust-log-forwarder/Cargo.toml index dc45fb6b61..02300fde65 100644 --- a/components/support/rust-log-forwarder/Cargo.toml +++ b/components/support/rust-log-forwarder/Cargo.toml @@ -7,7 +7,7 @@ license = "MPL-2.0" exclude = ["/android", "/ios"] [dependencies] -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } error-support = { path = "../error", default-features = false, features = ["tracing-logging"] } tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "std"] } tracing-support = { path = "../tracing" } @@ -16,4 +16,4 @@ tracing-support = { path = "../tracing" } tracing = "0.1" [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/components/support/tracing/Cargo.toml b/components/support/tracing/Cargo.toml index 7acfb5ab39..c8f75caac2 100644 --- a/components/support/tracing/Cargo.toml +++ b/components/support/tracing/Cargo.toml @@ -9,10 +9,10 @@ parking_lot = "0.12" serde_json = "1" tracing = "0.1" tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "std"] } -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } [dev-dependencies] tracing-subscriber = { version = "0.3", default-features = false } [build-dependencies] -uniffi = { version = "0.29.0", features = ["build"] } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["build"] } diff --git a/components/support/viaduct-hyper/Cargo.toml b/components/support/viaduct-hyper/Cargo.toml index 948449e227..ad8752fbc3 100644 --- a/components/support/viaduct-hyper/Cargo.toml +++ b/components/support/viaduct-hyper/Cargo.toml @@ -15,5 +15,5 @@ viaduct = { path = "../../viaduct" } hyper = { version = "0.14", features = ["client", "http1", "http2", "tcp"] } hyper-tls = { version = "0.5", features = ["vendored"] } tokio = { version = "1", features = ["rt-multi-thread"] } -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } url = "2" diff --git a/components/sync15/Cargo.toml b/components/sync15/Cargo.toml index 9e53ad75d2..7ce1790fa1 100644 --- a/components/sync15/Cargo.toml +++ b/components/sync15/Cargo.toml @@ -59,7 +59,7 @@ serde_json = "1" serde_path_to_error = "0.1" sync-guid = { path = "../support/guid", features = ["random"] } thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } url = { version = "2", optional = true } viaduct = { path = "../viaduct", optional = true } @@ -68,4 +68,4 @@ error-support = { path = "../support/error", features = ["testing"] } nss = { path = "../support/rc_crypto/nss" } [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/components/sync_manager/Cargo.toml b/components/sync_manager/Cargo.toml index ecdac82acc..441de5a0a4 100644 --- a/components/sync_manager/Cargo.toml +++ b/components/sync_manager/Cargo.toml @@ -23,7 +23,7 @@ serde_derive = "1" serde_json = "1" parking_lot = ">=0.11,<=0.12" interrupt-support = { path = "../support/interrupt" } -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/components/tabs/Cargo.toml b/components/tabs/Cargo.toml index cc3238da57..c90ac3af67 100644 --- a/components/tabs/Cargo.toml +++ b/components/tabs/Cargo.toml @@ -20,7 +20,7 @@ sql-support = { path = "../support/sql" } sync-guid = { path = "../support/guid", features = ["random"] } sync15 = { path = "../sync15", features = ["sync-engine"] } thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } url = "2" types = { path = "../support/types" } @@ -29,4 +29,4 @@ error-support = { path = "../support/error", features=["testing"] } tempfile = "3.1" [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/components/viaduct/Cargo.toml b/components/viaduct/Cargo.toml index df6059ebba..b277342a86 100644 --- a/components/viaduct/Cargo.toml +++ b/components/viaduct/Cargo.toml @@ -21,7 +21,7 @@ pollster = "0.3.0" prost = "0.13" ffi-support = "0.4" thiserror = "2" -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } bhttp = { version = "0.7.1", optional = true } ohttp = { version = "0.7.1", features = ["client", "server", "app-svc", "external-sqlite"], default-features = false, optional = true } diff --git a/components/webext-storage/Cargo.toml b/components/webext-storage/Cargo.toml index 72caa6993e..29fb23351a 100644 --- a/components/webext-storage/Cargo.toml +++ b/components/webext-storage/Cargo.toml @@ -24,7 +24,7 @@ serde_derive = "1" sql-support = { path = "../support/sql" } sync15 = {path = "../../components/sync15", features=["sync-engine"]} sync-guid = { path = "../support/guid", features = ["rusqlite_support", "random"] } -uniffi = { version = "0.29.0" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } url = { version = "2.1", features = ["serde"] } [dev-dependencies] @@ -36,4 +36,4 @@ sql-support = { path = "../support/sql" } serde_json = { version = "1", features = ["preserve_order"] } [build-dependencies] -uniffi = { version = "0.29.0", features=["build"]} +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features=["build"]} diff --git a/megazords/full/DEPENDENCIES.md b/megazords/full/DEPENDENCIES.md index de1a9de3c5..96749ee659 100644 --- a/megazords/full/DEPENDENCIES.md +++ b/megazords/full/DEPENDENCIES.md @@ -522,9 +522,11 @@ The following text applies to code linked from these dependencies: [scopeguard](https://github.com/bluss/scopeguard), [semver](https://github.com/dtolnay/semver), [serde](https://github.com/serde-rs/serde), +[serde_core](https://github.com/serde-rs/serde), [serde_derive](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), [serde_path_to_error](https://github.com/dtolnay/path-to-error), +[serde_spanned](https://github.com/toml-rs/toml), [sha2](https://github.com/RustCrypto/hashes), [shlex](https://github.com/comex/rust-shlex), [siphasher](https://github.com/jedisct1/rust-siphash), @@ -538,6 +540,10 @@ The following text applies to code linked from these dependencies: [thiserror](https://github.com/dtolnay/thiserror), [thread_local](https://github.com/Amanieu/thread_local-rs), [toml](https://github.com/alexcrichton/toml-rs), +[toml](https://github.com/toml-rs/toml), +[toml_datetime](https://github.com/toml-rs/toml), +[toml_parser](https://github.com/toml-rs/toml), +[toml_writer](https://github.com/toml-rs/toml), [typenum](https://github.com/paholg/typenum), [url](https://github.com/servo/rust-url), [utf8_iter](https://github.com/hsivonen/utf8_iter), diff --git a/megazords/full/android/dependency-licenses.xml b/megazords/full/android/dependency-licenses.xml index a12dd1a1c9..73edc7c71f 100644 --- a/megazords/full/android/dependency-licenses.xml +++ b/megazords/full/android/dependency-licenses.xml @@ -412,6 +412,10 @@ the details of which are reproduced below. Apache License 2.0: serde https://github.com/serde-rs/serde/blob/master/LICENSE-APACHE + + Apache License 2.0: serde_core + https://github.com/serde-rs/serde/blob/master/LICENSE-APACHE + Apache License 2.0: serde_derive https://github.com/serde-rs/serde/blob/master/LICENSE-APACHE @@ -424,6 +428,10 @@ the details of which are reproduced below. Apache License 2.0: serde_path_to_error https://github.com/dtolnay/path-to-error/blob/master/LICENSE-APACHE + + Apache License 2.0: serde_spanned + https://github.com/toml-rs/toml/blob/main/LICENSE-APACHE + Apache License 2.0: sha2 https://github.com/RustCrypto/hashes/blob/master/sha2/LICENSE-APACHE @@ -476,6 +484,22 @@ the details of which are reproduced below. Apache License 2.0: toml https://github.com/alexcrichton/toml-rs/blob/master/LICENSE-APACHE + + Apache License 2.0: toml + https://github.com/toml-rs/toml/blob/main/LICENSE-APACHE + + + Apache License 2.0: toml_datetime + https://github.com/toml-rs/toml/blob/main/LICENSE-APACHE + + + Apache License 2.0: toml_parser + https://github.com/toml-rs/toml/blob/main/LICENSE-APACHE + + + Apache License 2.0: toml_writer + https://github.com/toml-rs/toml/blob/main/LICENSE-APACHE + Apache License 2.0: typenum https://github.com/paholg/typenum/blob/main/LICENSE-APACHE diff --git a/megazords/ios-rust/DEPENDENCIES.md b/megazords/ios-rust/DEPENDENCIES.md index 06a089b0d6..0cebaa5a08 100644 --- a/megazords/ios-rust/DEPENDENCIES.md +++ b/megazords/ios-rust/DEPENDENCIES.md @@ -549,9 +549,11 @@ The following text applies to code linked from these dependencies: [security-framework](https://github.com/kornelski/rust-security-framework), [semver](https://github.com/dtolnay/semver), [serde](https://github.com/serde-rs/serde), +[serde_core](https://github.com/serde-rs/serde), [serde_derive](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), [serde_path_to_error](https://github.com/dtolnay/path-to-error), +[serde_spanned](https://github.com/toml-rs/toml), [serde_urlencoded](https://github.com/nox/serde_urlencoded), [sha2](https://github.com/RustCrypto/hashes), [shlex](https://github.com/comex/rust-shlex), @@ -567,6 +569,10 @@ The following text applies to code linked from these dependencies: [thiserror](https://github.com/dtolnay/thiserror), [thread_local](https://github.com/Amanieu/thread_local-rs), [toml](https://github.com/alexcrichton/toml-rs), +[toml](https://github.com/toml-rs/toml), +[toml_datetime](https://github.com/toml-rs/toml), +[toml_parser](https://github.com/toml-rs/toml), +[toml_writer](https://github.com/toml-rs/toml), [typenum](https://github.com/paholg/typenum), [url](https://github.com/servo/rust-url), [utf8_iter](https://github.com/hsivonen/utf8_iter), diff --git a/megazords/ios-rust/focus/DEPENDENCIES.md b/megazords/ios-rust/focus/DEPENDENCIES.md index 8d02825b35..e086aa0b64 100644 --- a/megazords/ios-rust/focus/DEPENDENCIES.md +++ b/megazords/ios-rust/focus/DEPENDENCIES.md @@ -531,8 +531,10 @@ The following text applies to code linked from these dependencies: [security-framework](https://github.com/kornelski/rust-security-framework), [semver](https://github.com/dtolnay/semver), [serde](https://github.com/serde-rs/serde), +[serde_core](https://github.com/serde-rs/serde), [serde_derive](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), +[serde_spanned](https://github.com/toml-rs/toml), [serde_urlencoded](https://github.com/nox/serde_urlencoded), [sha2](https://github.com/RustCrypto/hashes), [shlex](https://github.com/comex/rust-shlex), @@ -546,7 +548,10 @@ The following text applies to code linked from these dependencies: [thiserror-impl](https://github.com/dtolnay/thiserror), [thiserror](https://github.com/dtolnay/thiserror), [thread_local](https://github.com/Amanieu/thread_local-rs), -[toml](https://github.com/alexcrichton/toml-rs), +[toml](https://github.com/toml-rs/toml), +[toml_datetime](https://github.com/toml-rs/toml), +[toml_parser](https://github.com/toml-rs/toml), +[toml_writer](https://github.com/toml-rs/toml), [typenum](https://github.com/paholg/typenum), [url](https://github.com/servo/rust-url), [utf8_iter](https://github.com/hsivonen/utf8_iter), diff --git a/tools/embedded-uniffi-bindgen/Cargo.toml b/tools/embedded-uniffi-bindgen/Cargo.toml index 7c803b3301..63b43f023f 100644 --- a/tools/embedded-uniffi-bindgen/Cargo.toml +++ b/tools/embedded-uniffi-bindgen/Cargo.toml @@ -15,5 +15,5 @@ glob = "0.3" toml = "0.5" clap = {version = "4.2", default-features = false, features = ["std", "derive"]} serde = { version = "1", features = ["derive"] } -uniffi_bindgen = { version = "0.29.3" } -uniffi_pipeline = { version = "0.29.3" } +uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } +uniffi_pipeline = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } diff --git a/tools/embedded-uniffi-bindgen/src/config_supplier.rs b/tools/embedded-uniffi-bindgen/src/config_supplier.rs index 1405c26f06..1c24a62667 100644 --- a/tools/embedded-uniffi-bindgen/src/config_supplier.rs +++ b/tools/embedded-uniffi-bindgen/src/config_supplier.rs @@ -19,33 +19,15 @@ use std::{ use anyhow::{anyhow, Context, Result}; use camino::{Utf8Path, Utf8PathBuf}; use serde::Deserialize; -use uniffi_bindgen::BindgenCrateConfigSupplier; +use uniffi_bindgen::BindgenPathsLayer; pub struct NoCargoConfigSupplier; -impl BindgenCrateConfigSupplier for NoCargoConfigSupplier { - fn get_toml(&self, crate_name: &str) -> Result> { - match self.get_toml_path(crate_name) { - None => Ok(None), - Some(path) => Ok(Some(toml::from_str(&fs::read_to_string(path)?)?)), - } - } - - fn get_toml_path(&self, crate_name: &str) -> Option { +impl BindgenPathsLayer for NoCargoConfigSupplier { + fn get_udl_path(&self, crate_name: &str, udl_name: &str) -> Option { let crate_map = CRATE_MAP.as_ref().expect("Error parsing Cargo.toml files"); let crate_root = crate_map.get(crate_name)?; - let toml_path = crate_root.join("uniffi.toml"); - toml_path.exists().then_some(toml_path) - } - - /// Obtains the contents of the named UDL file which was referenced by the type metadata. - fn get_udl(&self, crate_name: &str, udl_name: &str) -> Result { - let crate_map = CRATE_MAP.as_ref().expect("Error parsing Cargo.toml files"); - let crate_root = crate_map - .get(crate_name) - .ok_or_else(|| anyhow!("Unknown crate: {crate_name}"))?; - let udl_path = crate_root.join(format!("src/{udl_name}.udl")); - fs::read_to_string(&udl_path).context(format!("Error reading {udl_path}")) + Some(crate_root.join(format!("src/{udl_name}.udl"))) } } diff --git a/tools/embedded-uniffi-bindgen/src/uniffi_bindgen.rs b/tools/embedded-uniffi-bindgen/src/uniffi_bindgen.rs index 12afd5f3d7..aa09e895e2 100644 --- a/tools/embedded-uniffi-bindgen/src/uniffi_bindgen.rs +++ b/tools/embedded-uniffi-bindgen/src/uniffi_bindgen.rs @@ -2,27 +2,26 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -// Copied from uniffi-rs/uniffi/src/cli/uniffi_bindgen.rs (v0.29.3) and lightly modified. +// Copied from uniffi-rs/uniffi/src/cli/uniffi_bindgen.rs (v0.31) and lightly modified. -use anyhow::{bail, Result}; use camino::Utf8PathBuf; use clap::{Args, Parser, Subcommand, ValueEnum}; use std::fmt; +// TODO: remove blanket import use uniffi_bindgen::bindings::*; use uniffi_bindgen::pipeline::initial; use uniffi_pipeline::PrintOptions; -/// Enumeration of all foreign language targets currently supported by our CLI. -/// -#[derive(Copy, Clone, Eq, PartialEq, Hash, ValueEnum)] -enum TargetLanguage { +/// TargetLanguage uniffi_bindgen, with a `clap::ValueEnum` derive. +#[derive(Copy, Clone, ValueEnum)] +enum TargetLanguageArg { Kotlin, Swift, Python, Ruby, } -impl fmt::Display for TargetLanguage { +impl fmt::Display for TargetLanguageArg { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Kotlin => write!(f, "kotlin"), @@ -33,36 +32,17 @@ impl fmt::Display for TargetLanguage { } } -impl TryFrom<&str> for TargetLanguage { - type Error = anyhow::Error; - fn try_from(value: &str) -> Result { - Ok(match value.to_ascii_lowercase().as_str() { - "kotlin" | "kt" | "kts" => TargetLanguage::Kotlin, - "swift" => TargetLanguage::Swift, - "python" | "py" => TargetLanguage::Python, - "ruby" | "rb" => TargetLanguage::Ruby, - _ => bail!("Unknown or unsupported target language: \"{value}\""), - }) - } -} - -impl TryFrom<&std::ffi::OsStr> for TargetLanguage { - type Error = anyhow::Error; - fn try_from(value: &std::ffi::OsStr) -> Result { - match value.to_str() { - None => bail!("Unreadable target language"), - Some(s) => s.try_into(), +impl From for TargetLanguage { + fn from(l: TargetLanguageArg) -> Self { + match l { + TargetLanguageArg::Kotlin => Self::Kotlin, + TargetLanguageArg::Swift => Self::Swift, + TargetLanguageArg::Python => Self::Python, + TargetLanguageArg::Ruby => Self::Ruby, } } } -impl TryFrom for TargetLanguage { - type Error = anyhow::Error; - fn try_from(value: String) -> Result { - TryFrom::try_from(value.as_str()) - } -} - // Structs to help our cmdline parsing. Note that docstrings below form part // of the "help" output. @@ -80,7 +60,7 @@ enum Commands { Generate { /// Foreign language(s) for which to build bindings. #[clap(long, short, value_enum)] - language: Vec, + language: Vec, /// Directory in which to write generated files. Default is same folder as .udl file. #[clap(long, short)] @@ -94,14 +74,6 @@ enum Commands { #[clap(long, short)] config: Option, - /// Extract proc-macro metadata from a native lib (cdylib or staticlib) for this crate. - #[clap(long)] - lib_file: Option, - - /// Pass in a cdylib path rather than a UDL file - #[clap(long = "library")] - library_mode: bool, - /// When `--library` is passed, only generate bindings for one crate. /// When `--library` is not passed, use this as the crate name instead of attempting to /// locate and parse Cargo.toml. @@ -145,8 +117,16 @@ struct PipelineArgs { #[clap(long = "crate")] crate_name: Option, + /// Whether we should exclude dependencies when running "cargo metadata". + /// This will mean external types may not be resolved if they are implemented in crates + /// outside of this workspace. + /// This can be used in environments when all types are in the namespace and fetching + /// all sub-dependencies causes obscure platform specific problems. + #[clap(long)] + metadata_no_deps: bool, + /// Bindings Language - language: TargetLanguage, + language: TargetLanguageArg, /// Only show passes that match /// @@ -167,167 +147,39 @@ struct PipelineArgs { filter_name: Option, } -fn gen_library_mode( - library_path: &camino::Utf8Path, - crate_name: Option, - languages: Vec, - cfo: Option<&camino::Utf8Path>, - out_dir: &camino::Utf8Path, - fmt: bool, -) -> anyhow::Result<()> { - use uniffi_bindgen::library_mode::generate_bindings; - - let config_supplier = crate::config_supplier::NoCargoConfigSupplier; - - for language in languages { - // to help avoid mistakes we check the library is actually a cdylib, except - // for swift where static libs are often used to extract the metadata. - if !matches!(language, TargetLanguage::Swift) && !uniffi_bindgen::is_cdylib(library_path) { - anyhow::bail!( - "Generate bindings for {language} requires a cdylib, but {library_path} was given" - ); - } - - // Type-bounds on trait implementations makes selecting between languages a bit tedious. - match language { - TargetLanguage::Kotlin => generate_bindings( - library_path, - crate_name.clone(), - &KotlinBindingGenerator, - &config_supplier, - cfo, - out_dir, - fmt, - )? - .len(), - TargetLanguage::Python => generate_bindings( - library_path, - crate_name.clone(), - &PythonBindingGenerator, - &config_supplier, - cfo, - out_dir, - fmt, - )? - .len(), - TargetLanguage::Ruby => generate_bindings( - library_path, - crate_name.clone(), - &RubyBindingGenerator, - &config_supplier, - cfo, - out_dir, - fmt, - )? - .len(), - TargetLanguage::Swift => generate_bindings( - library_path, - crate_name.clone(), - &SwiftBindingGenerator, - &config_supplier, - cfo, - out_dir, - fmt, - )? - .len(), - }; - } - Ok(()) -} - -fn gen_bindings( - udl_file: &camino::Utf8Path, - cfo: Option<&camino::Utf8Path>, - languages: Vec, - odo: Option<&camino::Utf8Path>, - library_file: Option<&camino::Utf8Path>, - crate_name: Option<&str>, - fmt: bool, -) -> anyhow::Result<()> { - use uniffi_bindgen::generate_bindings; - for language in languages { - match language { - TargetLanguage::Kotlin => generate_bindings( - udl_file, - cfo, - KotlinBindingGenerator, - odo, - library_file, - crate_name, - fmt, - )?, - TargetLanguage::Python => generate_bindings( - udl_file, - cfo, - PythonBindingGenerator, - odo, - library_file, - crate_name, - fmt, - )?, - TargetLanguage::Ruby => generate_bindings( - udl_file, - cfo, - RubyBindingGenerator, - odo, - library_file, - crate_name, - fmt, - )?, - TargetLanguage::Swift => generate_bindings( - udl_file, - cfo, - SwiftBindingGenerator, - odo, - library_file, - crate_name, - fmt, - )?, - }; - } - Ok(()) -} - pub fn run_main() -> anyhow::Result<()> { let cli = Cli::parse(); + let metadata_no_deps = false; match cli.command { Commands::Generate { language, out_dir, no_format, config, - lib_file, source, crate_name, - library_mode, + .. } => { - if library_mode { - if lib_file.is_some() { - panic!("--lib-file is not compatible with --library.") - } - let out_dir = out_dir.expect("--out-dir is required when using --library"); - if language.is_empty() { - panic!("please specify at least one language with --language") - } - gen_library_mode( - &source, - crate_name, - language, - config.as_deref(), - &out_dir, - !no_format, - )?; - } else { - gen_bindings( - &source, - config.as_deref(), - language, - out_dir.as_deref(), - lib_file.as_deref(), - crate_name.as_deref(), - !no_format, - )?; + if language.is_empty() { + panic!("please specify at least one language with --language") } + + let mut paths = uniffi_bindgen::BindgenPaths::default(); + paths.add_layer(crate::config_supplier::NoCargoConfigSupplier); + + generate_with_bindgen_paths( + GenerateOptions { + languages: language.into_iter().map(TargetLanguage::from).collect(), + out_dir: out_dir + .expect("--out-dir is required when generating {language} bindings"), + source, + config_override: config, + crate_filter: crate_name, + metadata_no_deps, + format: !no_format, + }, + paths, + )?; } Commands::Scaffolding { out_dir, @@ -341,11 +193,13 @@ pub fn run_main() -> anyhow::Result<()> { )?; } Commands::Pipeline(args) => { - let config_supplier = crate::config_supplier::NoCargoConfigSupplier; + let mut paths = uniffi_bindgen::BindgenPaths::default(); + paths.add_layer(crate::config_supplier::NoCargoConfigSupplier); + let initial_root = if args.library_mode { - initial::Root::from_library(config_supplier, &args.source, args.crate_name)? + initial::Root::from_library(paths, &args.source, args.crate_name)? } else { - initial::Root::from_udl(config_supplier, &args.source, args.crate_name)? + initial::Root::from_udl(paths, &args.source, args.crate_name)? }; let opts = PrintOptions { @@ -355,7 +209,7 @@ pub fn run_main() -> anyhow::Result<()> { filter_name: args.filter_name, }; match args.language { - TargetLanguage::Python => python::pipeline().print_passes(initial_root, opts)?, + TargetLanguageArg::Python => python::pipeline().print_passes(initial_root, opts)?, language => unimplemented!("{language} does not use the bindings IR pipeline yet"), }; } diff --git a/tools/uniffi-bindgen-library-mode/Cargo.toml b/tools/uniffi-bindgen-library-mode/Cargo.toml index 6c0dcdc710..b5ddfb50c2 100644 --- a/tools/uniffi-bindgen-library-mode/Cargo.toml +++ b/tools/uniffi-bindgen-library-mode/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" license = "MPL-2.0" [dependencies] -uniffi = { version = "0.29.3", features = ["cli"] } -uniffi_bindgen = { version = "0.29.3" } +uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16", features = ["cli"] } +uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs", rev = "5897c6f07068182dc09869fc1810264d17516f16" } clap = {version = "4.2", default-features = false, features = ["std", "derive"]} cargo_metadata = "0.19" camino = "1" diff --git a/tools/uniffi-bindgen-library-mode/src/main.rs b/tools/uniffi-bindgen-library-mode/src/main.rs index 96fe68f200..706a275ece 100644 --- a/tools/uniffi-bindgen-library-mode/src/main.rs +++ b/tools/uniffi-bindgen-library-mode/src/main.rs @@ -2,6 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +// NOTE: This tool is only used for Swift and Python as it pre-dates better support for our needs in uniffi itself. +// We should do what we can to drop this and use uniffi directly. use std::{ env::consts::{DLL_PREFIX, DLL_SUFFIX}, fmt, process, @@ -10,7 +12,9 @@ use std::{ use anyhow::{bail, Result}; use camino::{Utf8Path, Utf8PathBuf}; use clap::{Args, Parser, Subcommand}; -use uniffi_bindgen::bindings::{generate_swift_bindings, SwiftBindingsOptions}; +use uniffi_bindgen::bindings::{ + generate, generate_swift_bindings, GenerateOptions, SwiftBindingsOptions, +}; #[derive(Parser)] #[command(version, about, long_about = None)] @@ -86,20 +90,7 @@ fn run_uniffi_bindgen(cli: Cli) -> Result<()> { cli.command.language(), &metadata.workspace_root, )?; - let config_supplier = uniffi::CargoMetadataConfigSupplier::from(metadata); - match cli.command { - Command::Kotlin { out_dir } => { - uniffi::generate_bindings_library_mode( - &megazord.library_path, - None, - &uniffi::KotlinBindingGenerator, - &config_supplier, - None, - &out_dir, - false, - )?; - } Command::Swift { out_dir, mut swift_sources, @@ -118,11 +109,11 @@ fn run_uniffi_bindgen(cli: Cli) -> Result<()> { } generate_swift_bindings(SwiftBindingsOptions { - out_dir, generate_swift_sources: swift_sources, generate_headers: headers, generate_modulemap: modulemap, - library_path: megazord.library_path, + source: megazord.library_path, + out_dir, xcframework, module_name: Some(module_name), modulemap_filename, @@ -131,15 +122,18 @@ fn run_uniffi_bindgen(cli: Cli) -> Result<()> { })?; } Command::Python { out_dir } => { - uniffi::generate_bindings_library_mode( - &megazord.library_path, - None, - &uniffi::PythonBindingGenerator, - &config_supplier, - None, - &out_dir, - false, - )?; + generate(GenerateOptions { + languages: vec![uniffi_bindgen::bindings::TargetLanguage::Python], + source: megazord.library_path, + out_dir, + config_override: None, + format: false, + crate_filter: None, + metadata_no_deps: false, + })?; + } + _ => { + unreachable!("app-services only uses this tool for Swift.") } }; Ok(())