From 3956f1bf61f29d56fb1e830e6f22b2e2553027c0 Mon Sep 17 00:00:00 2001 From: Ben Dean-Kawamura Date: Mon, 8 Jun 2026 18:03:55 -0400 Subject: [PATCH] Upgrade to Uniffi 0.32 --- Cargo.lock | 288 +++++--- Cargo.toml | 4 - DEPENDENCIES.md | 659 ++++++++++++++++- components/ads-client/Cargo.toml | 4 +- components/as-ohttp-client/Cargo.toml | 4 +- components/autofill/Cargo.toml | 4 +- components/breach-alerts/Cargo.toml | 2 +- components/context_id/Cargo.toml | 4 +- components/crashtest/Cargo.toml | 4 +- components/example/Cargo.toml | 2 +- components/filter_adult/Cargo.toml | 2 +- components/fxa-client/Cargo.toml | 4 +- components/init_rust_components/Cargo.toml | 2 +- components/logins/Cargo.toml | 4 +- components/merino/Cargo.toml | 4 +- components/nimbus/Cargo.toml | 4 +- components/nimbus/src/lib.rs | 48 ++ .../nimbus/src/stateful/nimbus_client.rs | 39 - components/places/Cargo.toml | 8 +- components/places/src/ffi.rs | 33 - components/places/src/lib.rs | 36 + components/push/Cargo.toml | 4 +- components/relay/Cargo.toml | 4 +- components/relevancy/Cargo.toml | 4 +- components/remote_settings/Cargo.toml | 4 +- components/search/Cargo.toml | 4 +- components/suggest/Cargo.toml | 4 +- components/support/error/Cargo.toml | 4 +- components/support/interrupt/Cargo.toml | 4 +- components/support/nimbus-fml/Cargo.toml | 6 +- .../backends/kotlin/gen_structs/filters.rs | 121 ++-- .../kotlin/templates/FeatureTemplate.kt | 6 +- .../kotlin/templates/ObjectTemplate.kt | 4 +- .../src/backends/kotlin/templates/macros.kt | 2 +- .../src/backends/swift/gen_structs/filters.rs | 205 +++--- .../swift/templates/FeatureTemplate.swift | 4 +- .../swift/templates/ObjectTemplate.swift | 2 +- .../src/backends/swift/templates/macros.swift | 2 +- .../support/nimbus-fml/src/client/mod.rs | 26 +- components/support/nimbus-fml/src/lib.rs | 28 + .../support/rust-log-forwarder/Cargo.toml | 4 +- components/support/tracing/Cargo.toml | 4 +- components/support/viaduct-hyper/Cargo.toml | 2 +- components/sync15/Cargo.toml | 2 +- components/sync_manager/Cargo.toml | 4 +- components/tabs/Cargo.toml | 4 +- components/viaduct/Cargo.toml | 2 +- components/webext-storage/Cargo.toml | 4 +- megazords/full/DEPENDENCIES.md | 659 ++++++++++++++++- .../full/android/dependency-licenses.xml | 6 +- megazords/ios-rust/Cargo.toml | 4 + megazords/ios-rust/DEPENDENCIES.md | 666 +++++++++++++++++- megazords/ios-rust/focus/DEPENDENCIES.md | 665 ++++++++++++++++- megazords/ios-rust/src/lib.rs | 2 + tools/dependency_summary.py | 8 + tools/embedded-uniffi-bindgen/Cargo.toml | 4 +- .../src/uniffi_bindgen.rs | 5 +- tools/start-bindings/Cargo.toml | 2 +- tools/uniffi-bindgen-library-mode/Cargo.toml | 6 +- 59 files changed, 3153 insertions(+), 497 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 625905a7e70..79f3c6d86ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,7 +32,7 @@ dependencies = [ "serde", "serde_json", "sql-support", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "url-macro", @@ -130,7 +130,7 @@ dependencies = [ "ohttp", "parking_lot", "rusqlite", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", ] @@ -140,7 +140,20 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4" dependencies = [ - "askama_derive", + "askama_derive 0.14.0", + "itoa", + "percent-encoding", + "serde", + "serde_json", +] + +[[package]] +name = "askama" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf825125edd887a019d0a3a837dcc5499a68b0d034cc3eb594070c3e18addc" +dependencies = [ + "askama_macros", "itoa", "percent-encoding", "serde", @@ -153,8 +166,26 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f" dependencies = [ - "askama_parser", + "askama_parser 0.14.0", + "basic-toml", + "memchr", + "proc-macro2", + "quote", + "rustc-hash", + "serde", + "serde_derive", + "syn 2.0.106", +] + +[[package]] +name = "askama_derive" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1c7065972a130eafa84215f21352ae15b4a7393da48c1f5e103904490736738" +dependencies = [ + "askama_parser 0.16.0", "basic-toml", + "glob", "memchr", "proc-macro2", "quote", @@ -164,6 +195,15 @@ dependencies = [ "syn 2.0.106", ] +[[package]] +name = "askama_macros" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e23b1d2c4bd39a41971f6124cef4cc6fd0540913ecb90919b69ab3bbe44ae1a" +dependencies = [ + "askama_derive 0.16.0", +] + [[package]] name = "askama_parser" version = "0.14.0" @@ -176,6 +216,19 @@ dependencies = [ "winnow 0.7.12", ] +[[package]] +name = "askama_parser" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7db09fde9143e7ac4513358fb32ee32847125b63b18ea715afd487956da715da" +dependencies = [ + "rustc-hash", + "serde", + "serde_derive", + "unicode-ident", + "winnow 1.0.4", +] + [[package]] name = "assert-json-diff" version = "2.0.2" @@ -222,7 +275,7 @@ dependencies = [ "sql-support", "sync-guid", "sync15", - "thiserror 2.0.3", + "thiserror 2.0.20", "types", "uniffi", "url", @@ -325,7 +378,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d305a54bcb99974213b4c78a486c34091e83c5d6d6572f7f4331c904ea9d127" dependencies = [ - "thiserror 2.0.3", + "thiserror 2.0.20", ] [[package]] @@ -395,7 +448,7 @@ dependencies = [ "rusqlite", "sql-support", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", ] @@ -439,11 +492,11 @@ dependencies = [ [[package]] name = "camino" -version = "1.0.9" +version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412" +checksum = "bb1307f12aa967b5a58416e87b3653360e0fd614a016b6e970db08fecbb1b80d" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -461,39 +514,26 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +checksum = "87a0c0e6148f11f01f32650a2ea02d532b2ad4e81d8bd41e6e565b5adc5e6082" dependencies = [ "serde", + "serde_core", ] [[package]] name = "cargo_metadata" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror 1.0.69", -] - -[[package]] -name = "cargo_metadata" -version = "0.19.2" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +checksum = "ef987d17b0a113becdd19d3d0022d04d7ef41f9efe4f3fb63ac44ba61df3ade9" dependencies = [ "camino", "cargo-platform", "semver", "serde", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.20", ] [[package]] @@ -704,7 +744,7 @@ dependencies = [ "parking_lot", "serde", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "uuid", @@ -765,7 +805,7 @@ name = "crashtest" version = "0.1.0" dependencies = [ "log", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", ] @@ -1184,7 +1224,7 @@ name = "error-support-tests" version = "0.1.0" dependencies = [ "error-support", - "thiserror 2.0.3", + "thiserror 2.0.20", "trybuild", ] @@ -1221,7 +1261,7 @@ dependencies = [ "serde", "serde_json", "sql-support", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "viaduct", @@ -1416,7 +1456,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "thiserror 2.0.3", + "thiserror 2.0.20", "url", "viaduct", "viaduct-hyper", @@ -1513,7 +1553,7 @@ dependencies = [ "error-support", "md-5", "regex", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", ] @@ -1537,7 +1577,7 @@ name = "firefox-versioning" version = "0.1.0" dependencies = [ "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.20", ] [[package]] @@ -1594,9 +1634,12 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "fs-err" -version = "2.7.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd79fa345a495d3ae89fb7165fec01c0e72f41821d642dda363a1e97975652e" +checksum = "b91aa448ca50d7e79433bdf3ee8d99215430d2ec02ade5aefab2a073a1822e8a" +dependencies = [ + "autocfg", +] [[package]] name = "futures" @@ -1710,7 +1753,7 @@ dependencies = [ "serde_json", "sync-guid", "sync15", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "viaduct", @@ -1781,16 +1824,17 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glean-build" -version = "20.0.0" -source = "git+https://github.com/mozilla/glean?tag=v68.0.0#3b00f26c4814a47044c6736563ee7589dfa3b399" +version = "20.1.0" +source = "git+https://github.com/mozilla/glean?tag=v70.0.0#915e1a5842103b90ac20cac25b3c97f7d424dd0c" dependencies = [ "xshell-venv", ] [[package]] name = "glean-sym" -version = "0.1.0" -source = "git+https://github.com/mozilla/glean?tag=v68.0.0#3b00f26c4814a47044c6736563ee7589dfa3b399" +version = "70.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70cc5427a3840e10244e1af55ffe90b11258c99ae0371d64986855bd64ffae98" dependencies = [ "libloading", "once_cell", @@ -1800,9 +1844,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.1" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" [[package]] name = "goblin" @@ -2380,7 +2424,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.20", ] [[package]] @@ -2548,7 +2592,7 @@ dependencies = [ "sync-guid", "sync15", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", ] @@ -2652,6 +2696,7 @@ dependencies = [ "crashtest", "error-support", "fxa-client", + "glean-sym", "init_rust_components", "logins", "merino", @@ -2702,7 +2747,7 @@ dependencies = [ "error-support", "serde", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "viaduct", @@ -2886,7 +2931,7 @@ dependencies = [ "serde_yaml 0.9.21", "tempfile", "termcolor", - "thiserror 2.0.3", + "thiserror 2.0.20", "tokio", "tower", "tower-http", @@ -2911,7 +2956,7 @@ name = "nimbus-fml" version = "0.1.0" dependencies = [ "anyhow", - "askama", + "askama 0.16.0", "cfg-if", "clap", "glob", @@ -2928,7 +2973,7 @@ dependencies = [ "tempfile", "termcolor", "textwrap", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "viaduct", @@ -2957,7 +3002,7 @@ dependencies = [ "serde_json", "sha2", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "uuid", @@ -2995,7 +3040,7 @@ dependencies = [ "once_cell", "serde", "serde_derive", - "thiserror 2.0.3", + "thiserror 2.0.20", ] [[package]] @@ -3101,7 +3146,7 @@ dependencies = [ "mozbuild", "serde", "serde_derive", - "thiserror 2.0.3", + "thiserror 2.0.20", "toml 0.9.6", ] @@ -3303,7 +3348,7 @@ dependencies = [ "sync-guid", "sync15", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.20", "types", "uniffi", "url", @@ -3462,7 +3507,7 @@ dependencies = [ "serde_json", "sql-support", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.20", "types", "uniffi", "url", @@ -3566,7 +3611,7 @@ dependencies = [ "hawk", "hex", "nss-as", - "thiserror 2.0.3", + "thiserror 2.0.20", ] [[package]] @@ -3653,7 +3698,7 @@ dependencies = [ "remote_settings", "serde", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "viaduct", @@ -3678,7 +3723,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "sql-support", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", ] @@ -3706,7 +3751,7 @@ dependencies = [ "sha2", "sql-support", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "viaduct", @@ -3719,7 +3764,7 @@ version = "0.1.0" dependencies = [ "error-support", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.20", "url", "viaduct", ] @@ -3739,7 +3784,7 @@ dependencies = [ "ordered-float", "serde", "serde_derive", - "thiserror 2.0.3", + "thiserror 2.0.20", "url", "uuid", ] @@ -3891,7 +3936,7 @@ dependencies = [ "remote_settings", "serde", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "viaduct-dev", ] @@ -3921,11 +3966,12 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.12" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" dependencies = [ "serde", + "serde_core", ] [[package]] @@ -4160,7 +4206,7 @@ dependencies = [ "rusqlite", "tempfile", "text-table", - "thiserror 2.0.3", + "thiserror 2.0.20", ] [[package]] @@ -4174,9 +4220,9 @@ name = "start-bindings" version = "0.1.0" dependencies = [ "anyhow", - "askama", + "askama 0.14.0", "camino", - "cargo_metadata 0.15.2", + "cargo_metadata", "clap", "serde_yaml 0.8.24", "toml 0.5.9", @@ -4225,7 +4271,7 @@ dependencies = [ "serde_json", "sql-support", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "viaduct", @@ -4270,6 +4316,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "sync-guid" version = "0.1.0" @@ -4329,7 +4386,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "sync-guid", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", "viaduct", @@ -4353,7 +4410,7 @@ dependencies = [ "sql-support", "sync15", "tabs", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", ] @@ -4392,7 +4449,7 @@ dependencies = [ "sync-guid", "sync15", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.20", "types", "uniffi", "url", @@ -4465,11 +4522,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.3" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" dependencies = [ - "thiserror-impl 2.0.3", + "thiserror-impl 2.0.20", ] [[package]] @@ -4485,13 +4542,13 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.3" +version = "2.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 3.0.3", ] [[package]] @@ -4856,12 +4913,13 @@ checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "uniffi" -version = "0.31.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a782a48d72cfd7a2d65cfc7c691dbf5375c43104b3c195f7eccc716dcc3540c8" dependencies = [ "anyhow", "camino", - "cargo_metadata 0.19.2", + "cargo_metadata", "clap", "uniffi_bindgen", "uniffi_build", @@ -4876,7 +4934,7 @@ version = "0.1.0" dependencies = [ "anyhow", "camino", - "cargo_metadata 0.19.2", + "cargo_metadata", "clap", "uniffi", "uniffi_bindgen", @@ -4884,13 +4942,14 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.31.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533b0312c73e3b54eb78a4b257ceae390962dd4767995778309a74644643f9ac" dependencies = [ "anyhow", - "askama", + "askama 0.16.0", "camino", - "cargo_metadata 0.19.2", + "cargo_metadata", "fs-err", "glob", "goblin", @@ -4909,8 +4968,9 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.31.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763a19ad720fce8c9a98576e04c0ccc5d2d155aa6b953c864587073292c7ccfc" dependencies = [ "anyhow", "camino", @@ -4919,8 +4979,9 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.31.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e32e261c5b0dfaba6488f536e71957dddd6b1a498ac7eb791bee56b60a086be" dependencies = [ "anyhow", "bytes", @@ -4930,8 +4991,9 @@ dependencies = [ [[package]] name = "uniffi_internal_macros" -version = "0.31.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84ae78069a5e6772ef694fd5bdb628532c88d2c2f0e7142bf6a384636eadb1af" dependencies = [ "anyhow", "indexmap 2.5.0", @@ -4942,8 +5004,9 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.31.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330be6770532e86320df31f54c70bb0be67588594e8e77fa56e9083a3fed5d0d" dependencies = [ "camino", "fs-err", @@ -4958,8 +5021,9 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.31.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78de021f5547e56ab16c665a49d67d4fd3d31e77422f7739a2e9359d328cd9e7" dependencies = [ "anyhow", "siphasher", @@ -4969,8 +5033,9 @@ dependencies = [ [[package]] name = "uniffi_pipeline" -version = "0.31.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f8201bb1907ed8a42d80e11cbc25c8a033e7a31c3cff1d911f56eedb81d4948" dependencies = [ "anyhow", "heck", @@ -4981,8 +5046,9 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.31.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e57996bc58009cc29bf04845d627ae313c2547b87171c1c349d6c51a1656c0" dependencies = [ "anyhow", "textwrap", @@ -5082,7 +5148,7 @@ dependencies = [ "rusqlite", "serde", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", ] @@ -5323,7 +5389,7 @@ dependencies = [ "sync-guid", "sync15", "tempfile", - "thiserror 2.0.3", + "thiserror 2.0.20", "uniffi", "url", ] @@ -5342,7 +5408,8 @@ dependencies = [ [[package]] name = "weedle2" version = "5.0.0" -source = "git+https://github.com/mozilla/uniffi-rs.git?rev=59b035078322fbc0a605cc3c784cc38214113450#59b035078322fbc0a605cc3c784cc38214113450" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e" dependencies = [ "nom", ] @@ -5652,6 +5719,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + [[package]] name = "wit-bindgen-rt" version = "0.33.0" @@ -5730,9 +5806,9 @@ checksum = "32ac00cd3f8ec9c1d33fb3e7958a82df6989c42d747bd326c822b1d625283547" [[package]] name = "xshell-venv" -version = "1.4.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce3f9ddca75ddede32d5cc5a154fa237f4209ad71e6e2fc3db3ed18667d606b" +checksum = "b02ebe4a3558b86c64aeab700c924b08613020fca9c94d5f2cd412691b6c00bd" dependencies = [ "xshell", ] @@ -5875,7 +5951,7 @@ dependencies = [ "memchr", "pbkdf2", "sha1", - "thiserror 2.0.3", + "thiserror 2.0.20", "time", "xz2", "zeroize", diff --git a/Cargo.toml b/Cargo.toml index c8379d4d827..e3e27dca1bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -161,10 +161,6 @@ debug = true lto = "thin" [patch.crates-io] -# uniffi is using an experimental ffi based on 0.31. -uniffi = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "59b035078322fbc0a605cc3c784cc38214113450" } -uniffi_bindgen = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "59b035078322fbc0a605cc3c784cc38214113450" } -uniffi_pipeline = { git = "https://github.com/mozilla/uniffi-rs.git", rev = "59b035078322fbc0a605cc3c784cc38214113450" } # dummy crates for m-c integration hacks. mozilla-central-workspace-hack = { path = "monorepo-hacks/workspace-hack" } mozbuild = { path = "monorepo-hacks/mozbuild" } diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index f534e067ee1..6820bb012ae 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -456,6 +456,7 @@ The following text applies to code linked from these dependencies: [anyhow](https://github.com/dtolnay/anyhow), [askama](https://github.com/askama-rs/askama), [askama_derive](https://github.com/askama-rs/askama), +[askama_macros](https://github.com/askama-rs/askama), [askama_parser](https://github.com/askama-rs/askama), [async-trait](https://github.com/dtolnay/async-trait), [autocfg](https://github.com/cuviper/autocfg), @@ -2026,32 +2027,650 @@ The following text applies to code linked from these dependencies: [arrayref](https://github.com/droundy/arrayref) ``` -Copyright (c) 2015 David Roundy -All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +BSD 2-Clause “Simplified” License | Choose a License + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
    +
  1. + + Home / Licenses + +
  2. +
+ + + + +
+ + +

BSD 2-Clause “Simplified” License

+ + + + + + + + + + +
+ +
+ + + +

+ A permissive license that comes in two variants, the BSD 2-Clause and BSD 3-Clause. Both have very minute differences to the MIT license. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
PermissionsConditionsLimitations
+
    + + + + + +
  • + + Commercial use +
  • + + + + + +
  • + + Distribution +
  • + + + + + +
  • + + Modification +
  • + + + + + + + + +
  • + + Private use +
  • + + +
+
+
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
    + + + + + +
  • + + Liability +
  • + + + + + + + + + + + +
  • + + Warranty +
  • + + +
+
+ + +
+ +
BSD 2-Clause License
+
+Copyright (c) [year], [fullname]
 
 Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
+modification, are permitted provided that the following conditions are met:
 
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
 
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the
-   distribution.
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ +
+ + + + +
+ + + +
+ + + + + + + + + + ``` ------------- diff --git a/components/ads-client/Cargo.toml b/components/ads-client/Cargo.toml index 15eac5443ae..98c1faa1b52 100644 --- a/components/ads-client/Cargo.toml +++ b/components/ads-client/Cargo.toml @@ -24,7 +24,7 @@ serde = "1" serde_json = "1" thiserror = "2" once_cell = "1.5" -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } url = { version = "2", features = ["serde"] } url-macro = { path = "../support/url-macro" } uuid = { version = "1.3", features = ["v4"] } @@ -37,4 +37,4 @@ mockito = { version = "0.31", default-features = false } viaduct-dev = { path = "../support/viaduct-dev" } [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } diff --git a/components/as-ohttp-client/Cargo.toml b/components/as-ohttp-client/Cargo.toml index e78ede45164..5e002941ce2 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.31" } +uniffi = { version = "0.32" } thiserror = "2" parking_lot = "0.12" rusqlite = { version = "0.37.0", features = ["bundled"] } @@ -18,4 +18,4 @@ bhttp = "0.7.2" ohttp = { version = "0.7.2", default-features = false, features = ["client", "server", "app-svc", "external-sqlite"] } [build-dependencies] -uniffi = { version = "0.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} diff --git a/components/autofill/Cargo.toml b/components/autofill/Cargo.toml index ed0f3199966..3fecb317b3b 100644 --- a/components/autofill/Cargo.toml +++ b/components/autofill/Cargo.toml @@ -24,7 +24,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.31" } +uniffi = { version = "0.32" } url = { version = "2.2", features = ["serde"] } [dev-dependencies] @@ -33,4 +33,4 @@ nss-as = { path = "../support/rc_crypto/nss" } error-support = { path = "../support/error", features=["testing"] } [build-dependencies] -uniffi = { version = "0.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} diff --git a/components/breach-alerts/Cargo.toml b/components/breach-alerts/Cargo.toml index 5b98b45d0b7..ed86fdcaee9 100644 --- a/components/breach-alerts/Cargo.toml +++ b/components/breach-alerts/Cargo.toml @@ -6,7 +6,7 @@ authors = ["sync-team@mozilla.com"] license = "MPL-2.0" [dependencies] -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } error-support = { path = "../support/error" } interrupt-support = { path = "../support/interrupt" } parking_lot = ">=0.11,<=0.12" diff --git a/components/context_id/Cargo.toml b/components/context_id/Cargo.toml index fe1e093df78..1849213c63c 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.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} [dependencies] chrono = "0.4" @@ -15,7 +15,7 @@ parking_lot = "0.12" serde = "1" serde_json = "1" thiserror = "2" -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } url = "2" uuid = { version = "1.3", features = ["v4"]} viaduct = { path = "../viaduct" } diff --git a/components/crashtest/Cargo.toml b/components/crashtest/Cargo.toml index 0e334cf0dfd..4ef21d5107e 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.31" } +uniffi = { version = "0.32" } [build-dependencies] -uniffi = { version = "0.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} diff --git a/components/example/Cargo.toml b/components/example/Cargo.toml index 6cf6ed1caa9..4bd240220cb 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.31" } +uniffi = { version = "0.32" } # 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 a651e995faf..7917ddbe04a 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.31" } +uniffi = { version = "0.32" } [[bin]] name = "import-site-list" diff --git a/components/fxa-client/Cargo.toml b/components/fxa-client/Cargo.toml index 7409764fa4e..c601fc2e3d9 100644 --- a/components/fxa-client/Cargo.toml +++ b/components/fxa-client/Cargo.toml @@ -25,12 +25,12 @@ error-support = { path = "../support/error" } thiserror = "2" anyhow = "1.0" sync-guid = { path = "../support/guid", features = ["random"] } -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } payload-support = { path = "../support/payload" } nss-as = { path = "../support/rc_crypto/nss" } [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", 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 2e64a474853..f5a962d9f3c 100644 --- a/components/init_rust_components/Cargo.toml +++ b/components/init_rust_components/Cargo.toml @@ -12,6 +12,6 @@ keydb = ["nss-as/keydb"] ohttp = ["dep:viaduct", "viaduct/ohttp"] [dependencies] -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } nss-as = { path = "../support/rc_crypto/nss" } viaduct = { path = "../viaduct", optional = true } diff --git a/components/logins/Cargo.toml b/components/logins/Cargo.toml index 2f126f9eba2..63989e5ec6d 100644 --- a/components/logins/Cargo.toml +++ b/components/logins/Cargo.toml @@ -50,12 +50,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.31" } +uniffi = { version = "0.32" } async-trait = { version = "0.1", optional = true } futures = { version = "0.3", optional = true, features = ["executor"] } [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } diff --git a/components/merino/Cargo.toml b/components/merino/Cargo.toml index e647aea6366..bc38d132058 100644 --- a/components/merino/Cargo.toml +++ b/components/merino/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" exclude = ["/android"] [dependencies] -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } serde = { version = "1", features = ["derive"] } serde_json = "1" url = "2" @@ -14,4 +14,4 @@ error-support = { path = "../support/error" } thiserror = "2" [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } diff --git a/components/nimbus/Cargo.toml b/components/nimbus/Cargo.toml index 22fe683b84b..a3c98f11a34 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.31" } +uniffi = { version = "0.32" } 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.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } diff --git a/components/nimbus/src/lib.rs b/components/nimbus/src/lib.rs index 8c86e0cafae..f405de1e0a4 100644 --- a/components/nimbus/src/lib.rs +++ b/components/nimbus/src/lib.rs @@ -43,5 +43,53 @@ pub use evaluator::TargetingAttributes; pub(crate) const SLUG_REPLACEMENT_PATTERN: &str = "{experiment}"; +// Custom type definitions need to live in the root module while using UDL +// https://github.com/mozilla/uniffi-rs/issues/2968 + +#[cfg(feature = "stateful-uniffi-bindings")] +use json::JsonObject; + +#[cfg(feature = "stateful-uniffi-bindings")] +uniffi::custom_type!(JsonObject, String, { + remote, + try_lift: |val| { + let json: serde_json::Value = serde_json::from_str(&val)?; + + match json.as_object() { + Some(obj) => Ok(obj.clone()), + _ => Err(uniffi::deps::anyhow::anyhow!( + "Unexpected JSON-non-object in the bagging area" + )), + } + }, + lower: |obj| serde_json::Value::Object(obj).to_string(), +}); + +#[cfg(feature = "stateful-uniffi-bindings")] +use json::PrefValue; + +#[cfg(feature = "stateful-uniffi-bindings")] +uniffi::custom_type!(PrefValue, String, { + remote, + try_lift: |val| { + // Raw strings that are not valid JSON (e.g. pref values read directly from Gecko) + // should be treated as JSON string values. + let json: serde_json::Value = match serde_json::from_str(&val) { + Ok(json) => json, + Err(_) => serde_json::Value::String(val), + }; + let is_valid_pref_type = json.is_string() || json.is_boolean() + || (json.is_number() && !json.is_f64()) || json.is_null(); + if is_valid_pref_type { + Ok(json) + } else { + Err(anyhow::anyhow!(format!("Value {} is not a string, boolean, number, or null, or is a float", json))) + } + }, + lower: |val| { + val.to_string() + } +}); + #[cfg(test)] mod tests; diff --git a/components/nimbus/src/stateful/nimbus_client.rs b/components/nimbus/src/stateful/nimbus_client.rs index f8df9442dff..c166cf60fb3 100644 --- a/components/nimbus/src/stateful/nimbus_client.rs +++ b/components/nimbus/src/stateful/nimbus_client.rs @@ -1086,44 +1086,5 @@ impl NimbusStringHelper { } } -#[cfg(feature = "stateful-uniffi-bindings")] -uniffi::custom_type!(JsonObject, String, { - remote, - try_lift: |val| { - let json: Value = serde_json::from_str(&val)?; - - match json.as_object() { - Some(obj) => Ok(obj.clone()), - _ => Err(uniffi::deps::anyhow::anyhow!( - "Unexpected JSON-non-object in the bagging area" - )), - } - }, - lower: |obj| serde_json::Value::Object(obj).to_string(), -}); - -#[cfg(feature = "stateful-uniffi-bindings")] -uniffi::custom_type!(PrefValue, String, { - remote, - try_lift: |val| { - // Raw strings that are not valid JSON (e.g. pref values read directly from Gecko) - // should be treated as JSON string values. - let json: Value = match serde_json::from_str(&val) { - Ok(json) => json, - Err(_) => Value::String(val), - }; - let is_valid_pref_type = json.is_string() || json.is_boolean() - || (json.is_number() && !json.is_f64()) || json.is_null(); - if is_valid_pref_type { - Ok(json) - } else { - Err(anyhow::anyhow!(format!("Value {} is not a string, boolean, number, or null, or is a float", json))) - } - }, - lower: |val| { - val.to_string() - } -}); - #[cfg(feature = "stateful-uniffi-bindings")] uniffi::include_scaffolding!("nimbus"); diff --git a/components/places/Cargo.toml b/components/places/Cargo.toml index 76341ae2da1..9093c73dcdf 100644 --- a/components/places/Cargo.toml +++ b/components/places/Cargo.toml @@ -33,11 +33,11 @@ error-support = { path = "../support/error" } sync-guid = { path = "../support/guid", features = ["rusqlite_support", "random"]} thiserror = "2" anyhow = "1.0" -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } # glean-sym is only used on Android and iOS. [target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies] -glean-sym = { git = "https://github.com/mozilla/glean", tag = "v68.0.0", optional = true } +glean-sym = { version = "70.0.0", optional = true } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } @@ -45,5 +45,5 @@ tempfile = "3.1" sql-support = { path = "../support/sql" } [build-dependencies] -uniffi = { version = "0.31", features=["build"]} -glean-build = { git = "https://github.com/mozilla/glean", tag = "v68.0.0" } +uniffi = { version = "0.32", features=["build"]} +glean-build = { git = "https://github.com/mozilla/glean", tag = "v70.0.0" } diff --git a/components/places/src/ffi.rs b/components/places/src/ffi.rs index 6ae96e54119..d2158869404 100644 --- a/components/places/src/ffi.rs +++ b/components/places/src/ffi.rs @@ -54,39 +54,6 @@ pub type BookmarkFolder = crate::storage::bookmarks::fetch::Folder; pub type BookmarkSeparator = crate::storage::bookmarks::fetch::Separator; pub use crate::storage::bookmarks::fetch::BookmarkData; -uniffi::custom_type!(Url, String, { - remote, - try_lift: |val| { - match Url::parse(val.as_str()) { - Ok(url) => Ok(url), - Err(e) => Err(PlacesApiError::UrlParseFailed { - reason: e.to_string(), - } - .into()), - } - }, - lower: |obj| obj.into(), -}); - -uniffi::custom_type!(PlacesTimestamp, i64, { - remote, - try_lift: |val| Ok(PlacesTimestamp(val as u64)), - lower: |obj| obj.as_millis() as i64, -}); - -uniffi::custom_type!(VisitTransitionSet, i32, { - try_lift: |val| { - Ok(VisitTransitionSet::from_u16(val as u16).expect("Bug: Invalid VisitTransitionSet")) - }, - lower: |obj| VisitTransitionSet::into_u16(obj) as i32, -}); - -uniffi::custom_type!(Guid, String, { - remote, - try_lift: |val| Ok(Guid::new(val.as_str())), - lower: |obj| obj.into(), -}); - // Check for multiple write connections open at the same time // // One potential cause of #5040 is that Fenix is somehow opening multiiple write connections to diff --git a/components/places/src/lib.rs b/components/places/src/lib.rs index 2dc04234337..a75531fb83c 100644 --- a/components/places/src/lib.rs +++ b/components/places/src/lib.rs @@ -44,4 +44,40 @@ pub mod glean_metrics { include!(concat!(env!("OUT_DIR"), "/glean_metrics.rs")); } +// Custom type definitions need to live in the root module while using UDL +// https://github.com/mozilla/uniffi-rs/issues/2968 +// +uniffi::custom_type!(Url, String, { + remote, + try_lift: |val| { + match Url::parse(val.as_str()) { + Ok(url) => Ok(url), + Err(e) => Err(PlacesApiError::UrlParseFailed { + reason: e.to_string(), + } + .into()), + } + }, + lower: |obj| obj.into(), +}); + +uniffi::custom_type!(PlacesTimestamp, i64, { + remote, + try_lift: |val| Ok(PlacesTimestamp(val as u64)), + lower: |obj| obj.as_millis() as i64, +}); + +uniffi::custom_type!(VisitTransitionSet, i32, { + try_lift: |val| { + Ok(VisitTransitionSet::from_u16(val as u16).expect("Bug: Invalid VisitTransitionSet")) + }, + lower: |obj| VisitTransitionSet::into_u16(obj) as i32, +}); + +uniffi::custom_type!(Guid, String, { + remote, + try_lift: |val| Ok(Guid::new(val.as_str())), + lower: |obj| obj.into(), +}); + uniffi::include_scaffolding!("places"); diff --git a/components/push/Cargo.toml b/components/push/Cargo.toml index 14dc1b84253..bae46e2a670 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.31" } +uniffi = { version = "0.32" } types = { path = "../support/types" } [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } diff --git a/components/relay/Cargo.toml b/components/relay/Cargo.toml index 7551bf1f7d8..f9bdbc2beac 100644 --- a/components/relay/Cargo.toml +++ b/components/relay/Cargo.toml @@ -13,7 +13,7 @@ serde_json = "1" thiserror = "2" url = "2" viaduct = { path = "../viaduct" } -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } [dev-dependencies] expect-test = "1.4" @@ -21,4 +21,4 @@ mockito = { version = "0.31", default-features = false} viaduct-dev = { path = "../support/viaduct-dev"} [build-dependencies] -uniffi = { version = "0.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} diff --git a/components/relevancy/Cargo.toml b/components/relevancy/Cargo.toml index a680a904df9..5ef9c6ad44c 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.31" } +uniffi = { version = "0.32" } url = "2.5" remote_settings = { path = "../remote_settings"} base64 = "0.21.2" [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } [lib] diff --git a/components/remote_settings/Cargo.toml b/components/remote_settings/Cargo.toml index dd40e9f5819..12cb09646b6 100644 --- a/components/remote_settings/Cargo.toml +++ b/components/remote_settings/Cargo.toml @@ -17,7 +17,7 @@ telemetry-submission = [] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } thiserror = "2" serde = { version = "1", features=["derive"] } serde_json = "1" @@ -37,7 +37,7 @@ canonical_json = { version = "0.5", optional = true } rc_crypto = { path = "../support/rc_crypto", optional = true } [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } [dev-dependencies] expect-test = "1.4" diff --git a/components/search/Cargo.toml b/components/search/Cargo.toml index cf10d76a347..16e4fb600a3 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.31" } +uniffi = { version = "0.32" } firefox-versioning = { path = "../support/firefox-versioning" } [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } [dev-dependencies] error-support = { path = "../support/error", features = ["testing"] } diff --git a/components/suggest/Cargo.toml b/components/suggest/Cargo.toml index 1d984f493d1..49c5d11f51f 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.31" } +uniffi = { version = "0.32" } 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.31", features = ["build"] } +uniffi = { version = "0.32", 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 91095d5c91d..18aad4e3c11 100644 --- a/components/support/error/Cargo.toml +++ b/components/support/error/Cargo.toml @@ -15,10 +15,10 @@ lazy_static = { version = "1.4" } log = { version = "0.4" } parking_lot = { version = ">=0.11,<=0.12" } tracing-support = { path = "../tracing" } -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } [build-dependencies] -uniffi = { version = "0.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} [features] backtrace = ["dep:backtrace"] diff --git a/components/support/interrupt/Cargo.toml b/components/support/interrupt/Cargo.toml index 814489a7f16..ebf01d73f3d 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.31" } +uniffi = { version = "0.32" } [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } diff --git a/components/support/nimbus-fml/Cargo.toml b/components/support/nimbus-fml/Cargo.toml index 706fa14fc42..fd55b3562e8 100644 --- a/components/support/nimbus-fml/Cargo.toml +++ b/components/support/nimbus-fml/Cargo.toml @@ -24,7 +24,7 @@ name = "nimbus_fml" name = "nimbus-fml" [build-dependencies] -uniffi = { version = "0.31", features = ["build"], optional = true } +uniffi = { version = "0.32", features = ["build"], optional = true } [dev-dependencies] tempfile = "3" @@ -39,13 +39,13 @@ serde_json = { version = "1", features = ["preserve_order"] } serde_yaml = "0.9" serde = { version = "1.0", features = ["derive"] } thiserror = "2" -askama = "0.14" +askama = "0.16" textwrap = { version = "0.16", default-features = false } heck = "0.5" icu_segmenter = "2" url = { version = "2", features = ["serde"] } glob = "0.3.0" -uniffi = { version = "0.31", optional = true } +uniffi = { version = "0.32", optional = true } cfg-if = "1.0.0" lazy_static = "1.4" sha2 = "^0.10" diff --git a/components/support/nimbus-fml/src/backends/kotlin/gen_structs/filters.rs b/components/support/nimbus-fml/src/backends/kotlin/gen_structs/filters.rs index 122c4b3b75a..890c6cdf456 100644 --- a/components/support/nimbus-fml/src/backends/kotlin/gen_structs/filters.rs +++ b/components/support/nimbus-fml/src/backends/kotlin/gen_structs/filters.rs @@ -8,53 +8,75 @@ use std::fmt::{self, Display}; use crate::backends::{CodeOracle, LiteralRenderer, TypeIdentifier}; use crate::intermediate_representation::{Literal, PrefBranch}; -pub fn type_label( - type_: impl Borrow, - _: &dyn askama::Values, -) -> Result { +#[askama::filter_fn] +pub fn type_label(type_: T, _: &dyn askama::Values) -> Result +where + T: Borrow, +{ let oracle = ConcreteCodeOracle; Ok(oracle.find(type_.borrow()).type_label(&oracle)) } -pub fn defaults_type_label( - type_: impl Borrow, - _: &dyn askama::Values, -) -> Result { +#[askama::filter_fn] +pub fn defaults_type_label(type_: T, _: &dyn askama::Values) -> Result +where + T: Borrow, +{ let oracle = ConcreteCodeOracle; Ok(oracle.find(type_.borrow()).defaults_type(&oracle)) } -pub fn literal( - type_: impl Borrow, +#[askama::filter_fn] +pub fn literal( + type_: T, _: &dyn askama::Values, - renderer: impl LiteralRenderer, - literal: impl Borrow, - ctx: impl Display, -) -> Result { + renderer: R, + literal: L, + ctx: C, +) -> Result +where + T: Borrow, + R: LiteralRenderer, + L: Borrow, + C: Display, +{ let oracle = ConcreteCodeOracle; Ok(oracle .find(type_.borrow()) .literal(&oracle, &ctx, &renderer, literal.borrow())) } -pub fn property( - type_: impl Borrow, +#[askama::filter_fn] +pub fn property( + type_: T, _: &dyn askama::Values, - prop: impl fmt::Display, - vars: impl fmt::Display, - default: impl fmt::Display, -) -> Result { + prop: P, + vars: V, + default: D, +) -> Result +where + T: Borrow, + P: Display, + V: Display, + D: Display, +{ let oracle = &ConcreteCodeOracle; let ct = oracle.find(type_.borrow()); Ok(ct.property_getter(oracle, &vars, &prop, &default)) } -pub fn preference_getter( - type_: impl Borrow, +#[askama::filter_fn] +pub fn preference_getter( + type_: T, _: &dyn askama::Values, - prefs: impl fmt::Display, - pref_key: impl fmt::Display, -) -> Result { + prefs: P, + pref_key: K, +) -> Result +where + T: Borrow, + P: fmt::Display, + K: fmt::Display, +{ let oracle = &ConcreteCodeOracle; let ct = oracle.find(type_.borrow()); if let Some(getter) = ct.preference_getter(oracle, &prefs, &pref_key) { @@ -64,39 +86,49 @@ pub fn preference_getter( } } -pub fn to_json( - prop: impl fmt::Display, - _: &dyn askama::Values, - type_: impl Borrow, -) -> Result { +#[askama::filter_fn] +pub fn to_json(prop: P, _: &dyn askama::Values, type_: T) -> Result +where + P: fmt::Display, + T: Borrow, +{ let oracle = &ConcreteCodeOracle; let ct = oracle.find(type_.borrow()); Ok(ct.as_json(oracle, &prop)) } /// Get the idiomatic Kotlin rendering of a class name (for enums, records, errors, etc). -pub fn class_name(nm: impl fmt::Display, _: &dyn askama::Values) -> Result { +#[askama::filter_fn] +pub fn class_name(nm: N, _: &dyn askama::Values) -> Result +where + N: fmt::Display, +{ Ok(common::class_name(&nm)) } /// Get the idiomatic Kotlin rendering of a variable name. -pub fn var_name(nm: impl fmt::Display, _: &dyn askama::Values) -> Result { +#[askama::filter_fn] +pub fn var_name(nm: N, _: &dyn askama::Values) -> Result +where + N: fmt::Display, +{ Ok(common::var_name(&nm)) } /// Get the idiomatic Kotlin rendering of an individual enum variant. -pub fn enum_variant_name( - nm: impl fmt::Display, - _: &dyn askama::Values, -) -> Result { +#[askama::filter_fn] +pub fn enum_variant_name(nm: F, _: &dyn askama::Values) -> Result +where + F: fmt::Display, +{ Ok(common::enum_variant_name(&nm)) } -pub fn comment( - txt: impl fmt::Display, - _: &dyn askama::Values, - spaces: &str, -) -> Result { +#[askama::filter_fn] +pub fn comment(txt: T, _: &dyn askama::Values, spaces: &str) -> Result +where + T: fmt::Display, +{ use textwrap::{fill, Options}; let indent_start = "/** ".to_string(); @@ -116,10 +148,15 @@ pub fn comment( )) } -pub fn quoted(txt: impl fmt::Display, _: &dyn askama::Values) -> Result { +#[askama::filter_fn] +pub fn quoted(txt: T, _: &dyn askama::Values) -> Result +where + T: fmt::Display, +{ Ok(common::quoted(&txt)) } +#[askama::filter_fn] pub fn pref_branch_string( pref_branch: PrefBranch, _: &dyn askama::Values, diff --git a/components/support/nimbus-fml/src/backends/kotlin/templates/FeatureTemplate.kt b/components/support/nimbus-fml/src/backends/kotlin/templates/FeatureTemplate.kt index 4a76d7f72ef..f53b005b520 100644 --- a/components/support/nimbus-fml/src/backends/kotlin/templates/FeatureTemplate.kt +++ b/components/support/nimbus-fml/src/backends/kotlin/templates/FeatureTemplate.kt @@ -2,12 +2,12 @@ {%- let inner = self.inner() %} {{ inner.doc()|comment("") }} -public class {{ inner.name()|class_name }} {% call kt::render_constructor() %} : FMLFeatureInterface { - {% call kt::render_class_body(inner) %} +public class {{ inner.name()|class_name }} {{ kt::render_constructor() }} : FMLFeatureInterface { + {{ kt::render_class_body(inner) }} {%- if inner.has_prefs() %} override fun isModified(): Boolean = - {% call kt::prefs() %}?.let { prefs -> + {{ kt::prefs() }}?.let { prefs -> listOf( {%- for p in inner.props() %} {%- if p.has_prefs() %} diff --git a/components/support/nimbus-fml/src/backends/kotlin/templates/ObjectTemplate.kt b/components/support/nimbus-fml/src/backends/kotlin/templates/ObjectTemplate.kt index 7e5963ba2f9..089fe8cff91 100644 --- a/components/support/nimbus-fml/src/backends/kotlin/templates/ObjectTemplate.kt +++ b/components/support/nimbus-fml/src/backends/kotlin/templates/ObjectTemplate.kt @@ -3,8 +3,8 @@ {%- let class_name = inner.name()|class_name %} {{ inner.doc()|comment("") }} -public class {{ class_name }} {% call kt::render_constructor() %} : FMLObjectInterface { - {% call kt::render_class_body(inner) %} +public class {{ class_name }} {{ kt::render_constructor() }} : FMLObjectInterface { + {{ kt::render_class_body(inner) }} internal fun _mergeWith(defaults: {{class_name}}?): {{class_name}} = defaults?.let { {{class_name}}(_variables = this._variables, _defaults = it._defaults) } ?: this diff --git a/components/support/nimbus-fml/src/backends/kotlin/templates/macros.kt b/components/support/nimbus-fml/src/backends/kotlin/templates/macros.kt index a85ae1f9941..5fae7870ce7 100644 --- a/components/support/nimbus-fml/src/backends/kotlin/templates/macros.kt +++ b/components/support/nimbus-fml/src/backends/kotlin/templates/macros.kt @@ -56,7 +56,7 @@ private constructor( get() = {%- let prefs = "it" %} {%- let key = p.pref_key().unwrap() %} - {% call prefs() %}?.let { + {{ prefs() }}?.let { if ({{ prefs }}.contains({{ key|quoted }})) { try { {{ p.typ()|preference_getter(prefs, key) }} diff --git a/components/support/nimbus-fml/src/backends/swift/gen_structs/filters.rs b/components/support/nimbus-fml/src/backends/swift/gen_structs/filters.rs index e4274a431e7..28b054858f5 100644 --- a/components/support/nimbus-fml/src/backends/swift/gen_structs/filters.rs +++ b/components/support/nimbus-fml/src/backends/swift/gen_structs/filters.rs @@ -8,80 +8,106 @@ use std::fmt::{self, Display}; use crate::backends::{CodeOracle, LiteralRenderer, TypeIdentifier}; use crate::intermediate_representation::Literal; -pub fn type_label( - type_: impl Borrow, - _: &dyn askama::Values, -) -> Result { +#[askama::filter_fn] +pub fn type_label(type_: T, _: &dyn askama::Values) -> Result +where + T: Borrow, +{ let oracle = ConcreteCodeOracle; Ok(oracle.find(type_.borrow()).type_label(&oracle)) } -pub fn defaults_type_label( - type_: impl Borrow, - _: &dyn askama::Values, -) -> Result { +#[askama::filter_fn] +pub fn defaults_type_label(type_: T, _: &dyn askama::Values) -> Result +where + T: Borrow, +{ let oracle = ConcreteCodeOracle; Ok(oracle.find(type_.borrow()).defaults_type(&oracle)) } -pub fn literal( - type_: impl Borrow, +#[askama::filter_fn] +pub fn literal( + type_: T, _: &dyn askama::Values, - renderer: impl LiteralRenderer, - literal: impl Borrow, - ctx: impl Display, -) -> Result { + renderer: R, + literal: L, + ctx: C, +) -> Result +where + T: Borrow, + R: LiteralRenderer, + L: Borrow, + C: Display, +{ let oracle = ConcreteCodeOracle; Ok(oracle .find(type_.borrow()) .literal(&oracle, &ctx, &renderer, literal.borrow())) } -pub fn property( - type_: impl Borrow, +#[askama::filter_fn] +pub fn property( + type_: T, _: &dyn askama::Values, - prop: impl fmt::Display, - vars: impl fmt::Display, - default: impl fmt::Display, -) -> Result { + prop: P, + vars: V, + default: D, +) -> Result +where + T: Borrow, + P: fmt::Display, + V: fmt::Display, + D: fmt::Display, +{ let oracle = &ConcreteCodeOracle; let ct = oracle.find(type_.borrow()); Ok(ct.property_getter(oracle, &vars, &prop, &default)) } -pub fn to_json( - prop: impl fmt::Display, - _: &dyn askama::Values, - type_: impl Borrow, -) -> Result { +#[askama::filter_fn] +pub fn to_json(prop: P, _: &dyn askama::Values, type_: T) -> Result +where + P: fmt::Display, + T: Borrow, +{ let oracle = &ConcreteCodeOracle; let ct = oracle.find(type_.borrow()); Ok(ct.as_json(oracle, &prop)) } /// Get the idiomatic Swift rendering of a class name (for enums, records, errors, etc). -pub fn class_name(nm: impl fmt::Display, _: &dyn askama::Values) -> Result { +#[askama::filter_fn] +pub fn class_name(nm: N, _: &dyn askama::Values) -> Result +where + N: fmt::Display, +{ Ok(common::class_name(&nm)) } /// Get the idiomatic Swift rendering of a variable name. -pub fn var_name(nm: impl fmt::Display, _: &dyn askama::Values) -> Result { +#[askama::filter_fn] +pub fn var_name(nm: N, _: &dyn askama::Values) -> Result +where + N: fmt::Display, +{ Ok(common::var_name(&nm)) } /// Get the idiomatic Swift rendering of an individual enum variant. -pub fn enum_variant_name( - nm: impl fmt::Display, - _: &dyn askama::Values, -) -> Result { +#[askama::filter_fn] +pub fn enum_variant_name(nm: N, _: &dyn askama::Values) -> Result +where + N: fmt::Display, +{ Ok(common::enum_variant_name(&nm)) } -pub fn comment( - txt: impl fmt::Display, - _: &dyn askama::Values, - spaces: &str, -) -> Result { +#[askama::filter_fn] +pub fn comment(txt: T, _: &dyn askama::Values, spaces: &str) -> Result +where + T: fmt::Display, +{ use textwrap::{fill, Options}; let indent1 = "/// ".to_string(); @@ -95,30 +121,52 @@ pub fn comment( Ok(lines) } -pub fn quoted(txt: impl fmt::Display, _: &dyn askama::Values) -> Result { +#[askama::filter_fn] +pub fn quoted(txt: T, _: &dyn askama::Values) -> Result +where + T: fmt::Display, +{ Ok(common::quoted(&txt)) } #[cfg(test)] mod json_tests { use crate::intermediate_representation::TypeRef; + use askama::Template; use super::*; + use crate::backends::swift::gen_structs::filters; use askama::Error; + fn run_to_json(prop: impl Display, ty: TypeIdentifier) -> String { + #[derive(Template)] + #[template(source = "{{ prop|to_json(ty) }}", ext = "txt")] + struct ToJsonTemplate { + prop: String, + ty: TypeIdentifier, + } + + ToJsonTemplate { + prop: prop.to_string(), + ty, + } + .render() + .expect("Error rendering ToJsonTemplate") + } + #[test] fn scalar_types() -> Result<(), Error> { let p = "prop"; - assert_eq!(to_json(p, &(), TypeRef::Boolean)?, format!("{p}")); - assert_eq!(to_json(p, &(), TypeRef::Int)?, format!("{p}")); - assert_eq!(to_json(p, &(), TypeRef::String)?, format!("{p}")); + assert_eq!(run_to_json(p, TypeRef::Boolean), format!("{p}")); + assert_eq!(run_to_json(p, TypeRef::Int), format!("{p}")); + assert_eq!(run_to_json(p, TypeRef::String), format!("{p}")); assert_eq!( - to_json(p, &(), TypeRef::StringAlias("Name".to_string()))?, + run_to_json(p, TypeRef::StringAlias("Name".to_string())), format!("{p}") ); assert_eq!( - to_json(p, &(), TypeRef::Enum("Name".to_string()))?, + run_to_json(p, TypeRef::Enum("Name".to_string())), format!("{p}.rawValue") ); Ok(()) @@ -127,9 +175,9 @@ mod json_tests { #[test] fn bundled_types() -> Result<(), Error> { let p = "prop"; - assert_eq!(to_json(p, &(), TypeRef::BundleText)?, format!("{p}")); + assert_eq!(run_to_json(p, TypeRef::BundleText), format!("{p}")); assert_eq!( - to_json(p, &(), TypeRef::BundleImage)?, + run_to_json(p, TypeRef::BundleImage), format!("{p}.encodableImageName") ); @@ -140,19 +188,18 @@ mod json_tests { fn optional_types() -> Result<(), Error> { let p = "prop"; assert_eq!( - to_json(p, &(), TypeRef::Option(Box::new(TypeRef::String)))?, + run_to_json(p, TypeRef::Option(Box::new(TypeRef::String))), format!("{p}") ); assert_eq!( - to_json(p, &(), TypeRef::Option(Box::new(TypeRef::BundleImage)))?, + run_to_json(p, TypeRef::Option(Box::new(TypeRef::BundleImage))), format!("{p}?.encodableImageName") ); assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::Option(Box::new(TypeRef::Enum("Name".to_string()))) - )?, + ), format!("{p}?.rawValue") ); Ok(()) @@ -162,19 +209,18 @@ mod json_tests { fn list_types() -> Result<(), Error> { let p = "prop"; assert_eq!( - to_json(p, &(), TypeRef::List(Box::new(TypeRef::String)))?, + run_to_json(p, TypeRef::List(Box::new(TypeRef::String))), format!("{p}") ); assert_eq!( - to_json(p, &(), TypeRef::List(Box::new(TypeRef::BundleImage)))?, + run_to_json(p, TypeRef::List(Box::new(TypeRef::BundleImage))), format!("{p}.map {{ $0.encodableImageName }}") ); assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::List(Box::new(TypeRef::Enum("Name".to_string()))) - )?, + ), format!("{p}.map {{ $0.rawValue }}") ); Ok(()) @@ -184,46 +230,42 @@ mod json_tests { fn string_map_types() -> Result<(), Error> { let p = "prop"; assert_eq!( - to_json(p, &(), TypeRef::StringMap(Box::new(TypeRef::String)))?, + run_to_json(p, TypeRef::StringMap(Box::new(TypeRef::String))), format!("{p}") ); assert_eq!( - to_json(p, &(), TypeRef::StringMap(Box::new(TypeRef::BundleImage)))?, + run_to_json(p, TypeRef::StringMap(Box::new(TypeRef::BundleImage))), format!("{p}.mapValuesNotNull {{ $0.encodableImageName }}") ); assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::StringMap(Box::new(TypeRef::Enum("Name".to_string()))) - )?, + ), format!("{p}.mapValuesNotNull {{ $0.rawValue }}") ); assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::StringMap(Box::new(TypeRef::Option(Box::new(TypeRef::String)))) - )?, + ), format!("{p}") ); assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::StringMap(Box::new(TypeRef::Option(Box::new(TypeRef::BundleImage)))) - )?, + ), format!("{p}.mapValuesNotNull {{ $0?.encodableImageName }}") ); assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::StringMap(Box::new(TypeRef::Option(Box::new(TypeRef::Enum( "Name".to_string() ))))) - )?, + ), format!("{p}.mapValuesNotNull {{ $0?.rawValue }}") ); Ok(()) @@ -233,36 +275,33 @@ mod json_tests { fn enum_map_types_keys() -> Result<(), Error> { let p = "prop"; assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::EnumMap(Box::new(TypeRef::String), Box::new(TypeRef::String)) - )?, + ), format!("{p}") ); assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::EnumMap( Box::new(TypeRef::StringAlias("Name".to_string())), Box::new(TypeRef::String) ) - )?, + ), format!("{p}") ); // Mapping keys for enums. We do this because Swift encodes Dictionary as // an array: [k0, v0, k1, v1]. Bizarre! assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::EnumMap( Box::new(TypeRef::Enum("Name".to_string())), Box::new(TypeRef::String) ) - )?, + ), format!("{p}.mapKeysNotNull {{ $0.rawValue }}") ); Ok(()) @@ -276,33 +315,31 @@ mod json_tests { // an array: [k0, v0, k1, v1]. Bizarre! // Map assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::EnumMap( Box::new(TypeRef::Enum("Name".to_string())), Box::new(TypeRef::BundleImage) ) - )?, + ), format!("prop.mapEntriesNotNull({{ $0.rawValue }}, {{ $0.encodableImageName }})") ); // Map>; we don't need to map the values, because they encode cleanly. assert_eq!( - to_json( + run_to_json( p, - &(), TypeRef::EnumMap( Box::new(TypeRef::Enum("Name".to_string())), Box::new(TypeRef::List(Box::new(TypeRef::String))) ) - )?, + ), format!("prop.mapKeysNotNull {{ $0.rawValue }}") ); // Map> assert_eq!( - to_json(p, &(), TypeRef::EnumMap(Box::new(TypeRef::Enum("Name".to_string())), Box::new(TypeRef::List(Box::new(TypeRef::BundleImage)))))?, + run_to_json(p, TypeRef::EnumMap(Box::new(TypeRef::Enum("Name".to_string())), Box::new(TypeRef::List(Box::new(TypeRef::BundleImage))))), format!("prop.mapEntriesNotNull({{ $0.rawValue }}, {{ $0.map {{ $0.encodableImageName }} }})") ); Ok(()) diff --git a/components/support/nimbus-fml/src/backends/swift/templates/FeatureTemplate.swift b/components/support/nimbus-fml/src/backends/swift/templates/FeatureTemplate.swift index 42873bcefcf..5d89f852de2 100644 --- a/components/support/nimbus-fml/src/backends/swift/templates/FeatureTemplate.swift +++ b/components/support/nimbus-fml/src/backends/swift/templates/FeatureTemplate.swift @@ -1,13 +1,13 @@ {%- import "macros.swift" as swift %} {%- let inner = self.inner() %} {%- let class_name = inner.name()|class_name -%} -{% call swift::render_class(inner) %} +{{ swift::render_class(inner) }} {%- if inner.has_prefs() %} extension {{ class_name }}: FMLFeatureInterface { public func isModified() -> Bool { - guard let prefs = {% call swift::prefs() %} else { + guard let prefs = {{ swift::prefs() }} else { return false } let keys = [ diff --git a/components/support/nimbus-fml/src/backends/swift/templates/ObjectTemplate.swift b/components/support/nimbus-fml/src/backends/swift/templates/ObjectTemplate.swift index ced91997e2a..adfa2d3b4d2 100644 --- a/components/support/nimbus-fml/src/backends/swift/templates/ObjectTemplate.swift +++ b/components/support/nimbus-fml/src/backends/swift/templates/ObjectTemplate.swift @@ -1,6 +1,6 @@ {%- import "macros.swift" as swift %} {%- let inner = self.inner() %} -{% call swift::render_class(inner) -%} +{{ swift::render_class(inner) -}} {%- let class_name = inner.name()|class_name %} public extension {{class_name}} { diff --git a/components/support/nimbus-fml/src/backends/swift/templates/macros.swift b/components/support/nimbus-fml/src/backends/swift/templates/macros.swift index 1377d45e1c1..c58b100e064 100644 --- a/components/support/nimbus-fml/src/backends/swift/templates/macros.swift +++ b/components/support/nimbus-fml/src/backends/swift/templates/macros.swift @@ -87,7 +87,7 @@ public class {{class_name}}: FMLObjectInterface { `has_prefs()` checks if the type can be got from UserDefaults. #} - if let {{ prefs }} = {% call prefs() %}, + if let {{ prefs }} = {{ prefs() }}, let {{ prop_swift }} = {{ prefs }}.object(forKey: {{ key|quoted }}) as? {{ type_swift }} { return {{ prop_swift }} } diff --git a/components/support/nimbus-fml/src/client/mod.rs b/components/support/nimbus-fml/src/client/mod.rs index a292156da53..dbccffac76b 100644 --- a/components/support/nimbus-fml/src/client/mod.rs +++ b/components/support/nimbus-fml/src/client/mod.rs @@ -13,7 +13,6 @@ cfg_if::cfg_if! { if #[cfg(feature = "uniffi-bindings")] { use crate::{editing::{CorrectionCandidate, CursorPosition, CursorSpan}, frontend::DocumentationLink}; use url::Url; - use std::str::FromStr; use descriptor::FmlFeatureDescriptor; use inspector::{FmlEditorError, FmlFeatureExample, FmlFeatureInspector}; } @@ -145,30 +144,7 @@ impl FmlClient { } } -pub(crate) type JsonObject = serde_json::Map; - -#[cfg(feature = "uniffi-bindings")] -uniffi::custom_type!(JsonObject, String, { - remote, - try_lift: |val| { - let json: serde_json::Value = serde_json::from_str(&val)?; - - match json.as_object() { - Some(obj) => Ok(obj.to_owned()), - _ => Err(uniffi::deps::anyhow::anyhow!( - "Unexpected JSON-non-object in the bagging area" - )), - } - }, - lower: |obj| serde_json::Value::Object(obj).to_string(), -}); - -#[cfg(feature = "uniffi-bindings")] -uniffi::custom_type!(Url, String, { - remote, - try_lift: |val| Ok(Self::from_str(&val)?), - lower: |obj| obj.as_str().to_string(), -}); +pub type JsonObject = serde_json::Map; #[cfg(feature = "uniffi-bindings")] uniffi::include_scaffolding!("fml"); diff --git a/components/support/nimbus-fml/src/lib.rs b/components/support/nimbus-fml/src/lib.rs index 309ee8f9565..fc81f56fefe 100644 --- a/components/support/nimbus-fml/src/lib.rs +++ b/components/support/nimbus-fml/src/lib.rs @@ -12,10 +12,12 @@ pub mod intermediate_representation; pub mod parser; pub(crate) mod schema; pub mod util; +pub use url::Url; cfg_if::cfg_if! { if #[cfg(feature = "client-lib")] { pub mod client; + pub use client::JsonObject; pub use crate::client::*; } } @@ -23,4 +25,30 @@ cfg_if::cfg_if! { #[cfg(test)] pub mod fixtures; +// Custom type definitions need to live in the root module while using UDL +// https://github.com/mozilla/uniffi-rs/issues/2968 + +#[cfg(all(feature = "uniffi-bindings", feature = "client-lib"))] +uniffi::custom_type!(JsonObject, String, { + remote, + try_lift: |val| { + let json: serde_json::Value = serde_json::from_str(&val)?; + + match json.as_object() { + Some(obj) => Ok(obj.to_owned()), + _ => Err(uniffi::deps::anyhow::anyhow!( + "Unexpected JSON-non-object in the bagging area" + )), + } + }, + lower: |obj| serde_json::Value::Object(obj).to_string(), +}); + +#[cfg(all(feature = "uniffi-bindings", feature = "client-lib"))] +uniffi::custom_type!(Url, String, { + remote, + try_lift: |val| Ok(val.parse()?), + lower: |obj| obj.as_str().to_string(), +}); + const SUPPORT_URL_LOADING: bool = true; diff --git a/components/support/rust-log-forwarder/Cargo.toml b/components/support/rust-log-forwarder/Cargo.toml index 95bfd6d0f02..94059d7b9cb 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.31" } +uniffi = { version = "0.32" } error-support = { path = "../error", default-features = false } 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.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} diff --git a/components/support/tracing/Cargo.toml b/components/support/tracing/Cargo.toml index 007914315d1..3080823dce8 100644 --- a/components/support/tracing/Cargo.toml +++ b/components/support/tracing/Cargo.toml @@ -10,10 +10,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.31" } +uniffi = { version = "0.32" } [dev-dependencies] tracing-subscriber = { version = "0.3", default-features = false } [build-dependencies] -uniffi = { version = "0.31", features = ["build"] } +uniffi = { version = "0.32", features = ["build"] } diff --git a/components/support/viaduct-hyper/Cargo.toml b/components/support/viaduct-hyper/Cargo.toml index a1b5f832feb..f79a815048a 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.31" } +uniffi = { version = "0.32" } url = "2" diff --git a/components/sync15/Cargo.toml b/components/sync15/Cargo.toml index 2bd9b6033a2..159e3860e48 100644 --- a/components/sync15/Cargo.toml +++ b/components/sync15/Cargo.toml @@ -42,7 +42,7 @@ serde_json = "1" serde_path_to_error = "0.1" sync-guid = { path = "../support/guid", features = ["random"] } thiserror = "2" -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } url = { version = "2", optional = true } viaduct = { path = "../viaduct", optional = true } diff --git a/components/sync_manager/Cargo.toml b/components/sync_manager/Cargo.toml index e4c0aba5c66..88680941193 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.31" } +uniffi = { version = "0.32" } [build-dependencies] -uniffi = { version = "0.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} diff --git a/components/tabs/Cargo.toml b/components/tabs/Cargo.toml index ab0e747a3a8..2bc6d899d1b 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.31" } +uniffi = { version = "0.32" } 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.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} diff --git a/components/viaduct/Cargo.toml b/components/viaduct/Cargo.toml index 51862db403d..944deb20f38 100644 --- a/components/viaduct/Cargo.toml +++ b/components/viaduct/Cargo.toml @@ -20,7 +20,7 @@ parking_lot = { version = ">=0.11,<=0.12" } pollster = "0.3.0" ffi-support = "0.4" thiserror = "2" -uniffi = { version = "0.31" } +uniffi = { version = "0.32" } bhttp = { version = "0.7.2", optional = true } ohttp = { version = "0.7.2", 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 86ab35b089d..3eb747bc3de 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.31" } +uniffi = { version = "0.32" } 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.31", features=["build"]} +uniffi = { version = "0.32", features=["build"]} diff --git a/megazords/full/DEPENDENCIES.md b/megazords/full/DEPENDENCIES.md index 1054bc1de91..cdc3079fedc 100644 --- a/megazords/full/DEPENDENCIES.md +++ b/megazords/full/DEPENDENCIES.md @@ -443,6 +443,7 @@ The following text applies to code linked from these dependencies: [anyhow](https://github.com/dtolnay/anyhow), [askama](https://github.com/askama-rs/askama), [askama_derive](https://github.com/askama-rs/askama), +[askama_macros](https://github.com/askama-rs/askama), [askama_parser](https://github.com/askama-rs/askama), [async-trait](https://github.com/dtolnay/async-trait), [autocfg](https://github.com/cuviper/autocfg), @@ -1618,32 +1619,650 @@ The following text applies to code linked from these dependencies: [arrayref](https://github.com/droundy/arrayref) ``` -Copyright (c) 2015 David Roundy -All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +BSD 2-Clause “Simplified” License | Choose a License + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
    +
  1. + + Home / Licenses + +
  2. +
+ + + + +
+ + +

BSD 2-Clause “Simplified” License

+ + + + + + + + + + +
+ +
+ + + +

+ A permissive license that comes in two variants, the BSD 2-Clause and BSD 3-Clause. Both have very minute differences to the MIT license. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
PermissionsConditionsLimitations
+
    + + + + + +
  • + + Commercial use +
  • + + + + + +
  • + + Distribution +
  • + + + + + +
  • + + Modification +
  • + + + + + + + + +
  • + + Private use +
  • + + +
+
+
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
    + + + + + +
  • + + Liability +
  • + + + + + + + + + + + +
  • + + Warranty +
  • + + +
+
+ + +
+ +
BSD 2-Clause License
+
+Copyright (c) [year], [fullname]
 
 Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
+modification, are permitted provided that the following conditions are met:
 
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
 
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the
-   distribution.
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ +
+ + + + +
+ + + +
+ + + + + + + + + + ``` ------------- diff --git a/megazords/full/android/dependency-licenses.xml b/megazords/full/android/dependency-licenses.xml index afb007df119..86903dee71f 100644 --- a/megazords/full/android/dependency-licenses.xml +++ b/megazords/full/android/dependency-licenses.xml @@ -92,6 +92,10 @@ the details of which are reproduced below. Apache License 2.0: askama_derive https://github.com/askama-rs/askama/blob/main/LICENSE-APACHE + + Apache License 2.0: askama_macros + https://github.com/askama-rs/askama/blob/main/LICENSE-APACHE + Apache License 2.0: askama_parser https://github.com/askama-rs/askama/blob/main/LICENSE-APACHE @@ -674,7 +678,7 @@ the details of which are reproduced below. BSD-2-Clause License: arrayref - https://github.com/droundy/arrayref/blob/master/LICENSE + https://choosealicense.com/licenses/bsd-2-clause/ BSD-3-Clause License: bindgen diff --git a/megazords/ios-rust/Cargo.toml b/megazords/ios-rust/Cargo.toml index a44e55f4fc4..6c3384af7ea 100644 --- a/megazords/ios-rust/Cargo.toml +++ b/megazords/ios-rust/Cargo.toml @@ -33,3 +33,7 @@ merino = { path = "../../components/merino" } context_id = { path = "../../components/context_id" } relay = { path = "../../components/relay" } ads-client = { path = "../../components/ads-client" } + +# This seems to work for now, but it's a bit messy. +# Let's clean it up in https://github.com/mozilla/application-services/pull/7468 +glean-sym = { version = "70.0.0", features = ["active"] } diff --git a/megazords/ios-rust/DEPENDENCIES.md b/megazords/ios-rust/DEPENDENCIES.md index f115d320a79..2926457c4e7 100644 --- a/megazords/ios-rust/DEPENDENCIES.md +++ b/megazords/ios-rust/DEPENDENCIES.md @@ -53,7 +53,6 @@ The following text applies to code linked from these dependencies: [NSS](https://hg.mozilla.org/projects/nss), [ece](https://github.com/mozilla/rust-ece), [glean-build](https://github.com/mozilla/glean), -[glean-sym](https://github.com/mozilla/glean), [hawk](https://github.com/taskcluster/rust-hawk), [jexl-eval](https://github.com/mozilla/jexl-rs), [jexl-parser](https://github.com/mozilla/jexl-rs), @@ -450,6 +449,7 @@ The following text applies to code linked from these dependencies: [anyhow](https://github.com/dtolnay/anyhow), [askama](https://github.com/askama-rs/askama), [askama_derive](https://github.com/askama-rs/askama), +[askama_macros](https://github.com/askama-rs/askama), [askama_parser](https://github.com/askama-rs/askama), [async-trait](https://github.com/dtolnay/async-trait), [autocfg](https://github.com/cuviper/autocfg), @@ -1955,32 +1955,650 @@ The following text applies to code linked from these dependencies: [arrayref](https://github.com/droundy/arrayref) ``` -Copyright (c) 2015 David Roundy -All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +BSD 2-Clause “Simplified” License | Choose a License + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
    +
  1. + + Home / Licenses + +
  2. +
+ + + + +
+ + +

BSD 2-Clause “Simplified” License

+ + + + + + + + + + +
+ +
+ + + +

+ A permissive license that comes in two variants, the BSD 2-Clause and BSD 3-Clause. Both have very minute differences to the MIT license. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
PermissionsConditionsLimitations
+
    + + + + + +
  • + + Commercial use +
  • + + + + + +
  • + + Distribution +
  • + + + + + +
  • + + Modification +
  • + + + + + + + + +
  • + + Private use +
  • + + +
+
+
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
    + + + + + +
  • + + Liability +
  • + + + + + + + + + + + +
  • + + Warranty +
  • + + +
+
+ + +
+ +
BSD 2-Clause License
+
+Copyright (c) [year], [fullname]
 
 Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the
-   distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ +
+ + + + +
+ + + +
+ + + + + + + + + + ``` ------------- diff --git a/megazords/ios-rust/focus/DEPENDENCIES.md b/megazords/ios-rust/focus/DEPENDENCIES.md index e298dd8cb5e..a4cda3c8929 100644 --- a/megazords/ios-rust/focus/DEPENDENCIES.md +++ b/megazords/ios-rust/focus/DEPENDENCIES.md @@ -440,6 +440,7 @@ The following text applies to code linked from these dependencies: [anyhow](https://github.com/dtolnay/anyhow), [askama](https://github.com/askama-rs/askama), [askama_derive](https://github.com/askama-rs/askama), +[askama_macros](https://github.com/askama-rs/askama), [askama_parser](https://github.com/askama-rs/askama), [async-trait](https://github.com/dtolnay/async-trait), [autocfg](https://github.com/cuviper/autocfg), @@ -1643,32 +1644,650 @@ The following text applies to code linked from these dependencies: [arrayref](https://github.com/droundy/arrayref) ``` -Copyright (c) 2015 David Roundy -All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +BSD 2-Clause “Simplified” License | Choose a License + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
    +
  1. + + Home / Licenses + +
  2. +
+ + + + +
+ + +

BSD 2-Clause “Simplified” License

+ + + + + + + + + + +
+ +
+ + + +

+ A permissive license that comes in two variants, the BSD 2-Clause and BSD 3-Clause. Both have very minute differences to the MIT license. +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
PermissionsConditionsLimitations
+
    + + + + + +
  • + + Commercial use +
  • + + + + + +
  • + + Distribution +
  • + + + + + +
  • + + Modification +
  • + + + + + + + + +
  • + + Private use +
  • + + +
+
+
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
    + + + + + +
  • + + Liability +
  • + + + + + + + + + + + +
  • + + Warranty +
  • + + +
+
+ + +
+ +
BSD 2-Clause License
+
+Copyright (c) [year], [fullname]
 
 Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the
-   distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ +
+ + + + +
+ + + +
+ + + + + + + + + + ``` ------------- diff --git a/megazords/ios-rust/src/lib.rs b/megazords/ios-rust/src/lib.rs index 0580781e784..46015a53d55 100644 --- a/megazords/ios-rust/src/lib.rs +++ b/megazords/ios-rust/src/lib.rs @@ -12,6 +12,8 @@ pub use context_id; pub use crashtest; pub use error_support; pub use fxa_client; +#[cfg(any(target_os = "android", target_os = "ios"))] +pub use glean_sym; pub use init_rust_components; pub use logins; pub use merino; diff --git a/tools/dependency_summary.py b/tools/dependency_summary.py index 039499065c7..df740bce9fc 100755 --- a/tools/dependency_summary.py +++ b/tools/dependency_summary.py @@ -203,6 +203,14 @@ "fixup": "https://raw.githubusercontent.com/remram44/adler32-rs/master/LICENSE", } }, + # Upstream github repo is no longer, but crates.io lists this as BSD-2-Clause and links to this + # URL + "arrayref": { + "license_file": { + "check": None, + "fixup": "https://choosealicense.com/licenses/bsd-2-clause/", + } + }, "bincode": { "license_file": { "check": None, diff --git a/tools/embedded-uniffi-bindgen/Cargo.toml b/tools/embedded-uniffi-bindgen/Cargo.toml index b814282add4..6c008acdf71 100644 --- a/tools/embedded-uniffi-bindgen/Cargo.toml +++ b/tools/embedded-uniffi-bindgen/Cargo.toml @@ -15,6 +15,6 @@ 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.31" } -uniffi_pipeline = { version = "0.31" } +uniffi_bindgen = { version = "0.32" } +uniffi_pipeline = { version = "0.32" } mozilla-central-workspace-hack = { version = "0.1", features = ["embedded-uniffi-bindgen"], optional = true } diff --git a/tools/embedded-uniffi-bindgen/src/uniffi_bindgen.rs b/tools/embedded-uniffi-bindgen/src/uniffi_bindgen.rs index aa09e895e21..04c07f6c68e 100644 --- a/tools/embedded-uniffi-bindgen/src/uniffi_bindgen.rs +++ b/tools/embedded-uniffi-bindgen/src/uniffi_bindgen.rs @@ -195,11 +195,12 @@ pub fn run_main() -> anyhow::Result<()> { Commands::Pipeline(args) => { let mut paths = uniffi_bindgen::BindgenPaths::default(); paths.add_layer(crate::config_supplier::NoCargoConfigSupplier); + let config = uniffi_bindgen::GlobalConfig::default(); let initial_root = if args.library_mode { - initial::Root::from_library(paths, &args.source, args.crate_name)? + initial::Root::from_library(&paths, &config, &args.source, args.crate_name)? } else { - initial::Root::from_udl(paths, &args.source, args.crate_name)? + initial::Root::from_udl(&paths, &config, &args.source, args.crate_name)? }; let opts = PrintOptions { diff --git a/tools/start-bindings/Cargo.toml b/tools/start-bindings/Cargo.toml index 3d8632fff47..2d266ec4aa8 100644 --- a/tools/start-bindings/Cargo.toml +++ b/tools/start-bindings/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] anyhow = "1" camino = "1" -cargo_metadata = "0.15" +cargo_metadata = "0.23" clap = {version = "4.2", default-features = false, features = ["std", "derive"]} askama = "0.14" serde_yaml = "0.8" diff --git a/tools/uniffi-bindgen-library-mode/Cargo.toml b/tools/uniffi-bindgen-library-mode/Cargo.toml index 6ead2cd8181..9d896128d90 100644 --- a/tools/uniffi-bindgen-library-mode/Cargo.toml +++ b/tools/uniffi-bindgen-library-mode/Cargo.toml @@ -6,9 +6,9 @@ edition = "2021" license = "MPL-2.0" [dependencies] -uniffi = { version = "0.31", features = ["cli"] } -uniffi_bindgen = { version = "0.31" } +uniffi = { version = "0.32", features = ["cli"] } +uniffi_bindgen = { version = "0.32" } clap = {version = "4.2", default-features = false, features = ["std", "derive"]} -cargo_metadata = "0.19" +cargo_metadata = "0.23" camino = "1" anyhow = "1"