diff --git a/.circleci/config.yml b/.circleci/config.yml index 713112bb66..13487fe9c4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -120,6 +120,7 @@ commands: - run: sudo apt-get update - run: sudo apt-get install python tcl - run: sudo apt-get install python3-venv + - run: sudo apt-get install python3-pip - run: name: Install NSS build system dependencies command: sudo apt-get install ninja-build gyp zlib1g-dev diff --git a/Cargo.lock b/Cargo.lock index 07c0ea2b20..ce0ab4254b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,6 +38,24 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_log-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e" + +[[package]] +name = "android_logger" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74b7ddf197de32e415d197aa21c1c0cb36e01e4794fd801302280ac7847ee02" +dependencies = [ + "android_log-sys", + "env_logger 0.9.0", + "log", + "once_cell", +] + [[package]] name = "ansi_term" version = "0.11.0" @@ -210,7 +228,7 @@ dependencies = [ "thiserror", "types", "uniffi", - "uniffi_build", + "uniffi_build 0.19.3", "url", ] @@ -371,14 +389,13 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.13.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081e3f0755c1f380c2d010481b6fa2e02973586d5f2b24eebb7a2a1d98b143d8" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ "camino", "cargo-platform", - "semver 0.11.0", - "semver-parser 0.10.2", + "semver 1.0.12", "serde", "serde_json", ] @@ -458,16 +475,16 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.8" +version = "3.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83" +checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" dependencies = [ "atty", "bitflags", "clap_derive", "clap_lex", "indexmap", - "once_cell", + "lazy_static", "strsim 0.10.0", "termcolor", "textwrap 0.15.0", @@ -475,9 +492,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.2.7" +version = "3.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759bf187376e1afa7b85b959e6a664a3e7a95203415dba952ad19139e798f902" +checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c" dependencies = [ "heck 0.4.0", "proc-macro-error", @@ -596,8 +613,17 @@ dependencies = [ "log", "thiserror", "uniffi", - "uniffi_build", - "uniffi_macros", + "uniffi_build 0.19.3", + "uniffi_macros 0.19.3", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if 1.0.0", ] [[package]] @@ -734,6 +760,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "dashmap" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +dependencies = [ + "cfg-if 1.0.0", + "num_cpus", +] + [[package]] name = "dialoguer" version = "0.6.2" @@ -870,6 +906,18 @@ dependencies = [ "termcolor", ] +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime 2.1.0", + "log", + "termcolor", +] + [[package]] name = "error-support" version = "0.1.0" @@ -879,8 +927,8 @@ dependencies = [ "log", "parking_lot", "uniffi", - "uniffi_build", - "uniffi_macros", + "uniffi_build 0.19.3", + "uniffi_macros 0.19.3", ] [[package]] @@ -1064,6 +1112,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" +[[package]] +name = "flate2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1187,8 +1245,8 @@ dependencies = [ "sync15", "thiserror", "uniffi", - "uniffi_build", - "uniffi_macros", + "uniffi_build 0.19.3", + "uniffi_macros 0.19.3", "url", "viaduct", "viaduct-reqwest", @@ -1269,6 +1327,57 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +[[package]] +name = "glean" +version = "51.1.0" +dependencies = [ + "chrono", + "crossbeam-channel", + "glean-core", + "inherent", + "log", + "once_cell", + "serde", + "serde_json", + "thiserror", + "time 0.1.44", + "uuid", + "whatsys", +] + +[[package]] +name = "glean-build" +version = "6.1.2" +dependencies = [ + "xshell-venv", +] + +[[package]] +name = "glean-core" +version = "51.1.0" +dependencies = [ + "android_logger", + "bincode", + "chrono", + "crossbeam-channel", + "env_logger 0.9.0", + "flate2", + "log", + "once_cell", + "oslog", + "rkv", + "serde", + "serde_json", + "thiserror", + "time 0.1.44", + "uniffi", + "uniffi_build 0.19.3", + "uniffi_macros 0.19.3", + "uuid", + "whatsys", + "zeitstempel", +] + [[package]] name = "glob" version = "0.3.0" @@ -1487,6 +1596,17 @@ dependencies = [ "hashbrown 0.12.1", ] +[[package]] +name = "inherent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daa5135cb6aa90ee17b4f0a0fb2908059b0830f90fda333f12816f275b21820c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "instant" version = "0.1.12" @@ -1726,8 +1846,8 @@ dependencies = [ "tempfile", "thiserror", "uniffi", - "uniffi_build", - "uniffi_macros", + "uniffi_build 0.19.3", + "uniffi_macros 0.19.3", "url", ] @@ -1769,6 +1889,7 @@ dependencies = [ name = "megazord_focus" version = "0.1.0" dependencies = [ + "glean-core", "nimbus-sdk", "rc_log_ffi", "viaduct", @@ -1782,6 +1903,7 @@ dependencies = [ "autofill", "crashtest", "fxa-client", + "glean-core", "logins", "nimbus-sdk", "places", @@ -1965,6 +2087,8 @@ dependencies = [ "chrono", "clap 2.34.0", "env_logger 0.7.1", + "glean", + "glean-build", "hex", "jexl-eval", "log", @@ -1979,7 +2103,7 @@ dependencies = [ "thiserror", "unicode-segmentation", "uniffi", - "uniffi_build", + "uniffi_build 0.19.3", "url", "uuid", "viaduct", @@ -1997,16 +2121,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nom" -version = "5.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" -dependencies = [ - "memchr", - "version_check", -] - [[package]] name = "nom" version = "6.1.2" @@ -2288,6 +2402,17 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" +[[package]] +name = "oslog" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8343ce955f18e7e68c0207dd0ea776ec453035685395ababd2ea651c569728b3" +dependencies = [ + "cc", + "dashmap", + "log", +] + [[package]] name = "output_vt100" version = "0.1.3" @@ -2332,15 +2457,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - [[package]] name = "petgraph" version = "0.5.1" @@ -2398,8 +2514,8 @@ dependencies = [ "thiserror", "types", "uniffi", - "uniffi_build", - "uniffi_macros", + "uniffi_build 0.19.3", + "uniffi_macros 0.19.3", "url", ] @@ -2610,8 +2726,8 @@ dependencies = [ "tempfile", "thiserror", "uniffi", - "uniffi_build", - "uniffi_macros", + "uniffi_build 0.19.3", + "uniffi_macros 0.19.3", "url", "viaduct", "viaduct-reqwest", @@ -2989,40 +3105,24 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser 0.7.0", + "semver-parser", ] [[package]] name = "semver" -version = "0.11.0" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" dependencies = [ - "semver-parser 0.10.2", "serde", ] -[[package]] -name = "semver" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" - [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" version = "1.0.138" @@ -3287,8 +3387,8 @@ dependencies = [ "tabs", "thiserror", "uniffi", - "uniffi_build", - "uniffi_macros", + "uniffi_build 0.19.3", + "uniffi_macros 0.18.0", "url", ] @@ -3321,8 +3421,8 @@ dependencies = [ "tempfile", "thiserror", "uniffi", - "uniffi_build", - "uniffi_macros", + "uniffi_build 0.19.3", + "uniffi_macros 0.19.3", "url", ] @@ -3604,12 +3704,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "ucd-trie" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c" - [[package]] name = "unicase" version = "2.6.0" @@ -3669,12 +3763,13 @@ checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" [[package]] name = "uniffi" -version = "0.18.0" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0fe14882ae6ea89f31ac922ad8e6f76b3f346f07965791a60ade60cc3bcdd60" +checksum = "bc1de33ad46ce00bc9a31cea44e80ef69175d3a23007335216fe3996880a310d" dependencies = [ "anyhow", "bytes", + "camino", "cargo_metadata", "lazy_static", "log", @@ -3684,15 +3779,18 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.18.0" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9810482e988792ed22fc6747d872bd32600f7e3bfc11fe93019d155d7e89c" +checksum = "b18e05c55840ddd690ba211f72bb1f2f6ca8c50bfeb7d7211ea5ee60b0f9be07" dependencies = [ "anyhow", "askama 0.11.1", + "camino", "cargo_metadata", - "clap 3.2.8", + "clap 3.1.18", + "fs-err", "heck 0.4.0", + "lazy_static", "paste", "serde", "toml", @@ -3706,6 +3804,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcb7401cfd8da93541c23a0683c1dab3c782d2a118254536106b0aa4d9b30607" dependencies = [ "anyhow", +] + +[[package]] +name = "uniffi_build" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fff0860625e4e621f0317e5f6ac9e79966262bd86a6cfb2049e8425df23afbd" +dependencies = [ + "anyhow", + "camino", "uniffi_bindgen", ] @@ -3719,7 +3827,21 @@ dependencies = [ "proc-macro2", "quote", "syn", - "uniffi_build", + "uniffi_build 0.18.0", +] + +[[package]] +name = "uniffi_macros" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7956a6c1fb12bff15e537028ea2174f000f90dd4f87912233b276ea782d420f2" +dependencies = [ + "camino", + "glob", + "proc-macro2", + "quote", + "syn", + "uniffi_build 0.19.3", ] [[package]] @@ -3953,12 +4075,23 @@ dependencies = [ [[package]] name = "weedle2" -version = "2.0.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a69b360c3d0df7dc1a18124677ee8476576c806418f30a360a6cf6cf4e072a6" +checksum = "5d730d941cf471131c40a64cf2e8a595822009f51e64c05c5afdbc85af155857" dependencies = [ "fs-err", - "nom 5.1.2", + "nom 6.1.2", +] + +[[package]] +name = "whatsys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c24fff5aa1e0973964ba23a995e8b10fa2cdeae507e0cbbbd36f8403242a765d" +dependencies = [ + "cc", + "cfg-if 1.0.0", + "libc", ] [[package]] @@ -4086,6 +4219,30 @@ dependencies = [ "log", ] +[[package]] +name = "xshell" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d47097dc5c85234b1e41851b3422dd6d19b3befdd35b4ae5ce386724aeca981" +dependencies = [ + "xshell-macros", +] + +[[package]] +name = "xshell-macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88301b56c26dd9bf5c43d858538f82d6f3f7764767defbc5d34e59459901c41a" + +[[package]] +name = "xshell-venv" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43c2e9236bfd40d392b5ef2c073ef2719f7c69a758293cec4d8eff909a8917c" +dependencies = [ + "xshell", +] + [[package]] name = "yaml-rust" version = "0.3.5" @@ -4100,3 +4257,14 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] + +[[package]] +name = "zeitstempel" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeea3eb6a30ed24e374f59368d3917c5180a845fdd4ed6f1b2278811a9e826f8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "once_cell", +] diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index 7f458245d8..0f2796a63e 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -10,9 +10,12 @@ the details of which are reproduced below. * [MIT License: aho-corasick, byteorder, memchr, termcolor](#mit-license-aho-corasick-byteorder-memchr-termcolor) * [MIT License: atty](#mit-license-atty) * [MIT License: bincode](#mit-license-bincode) +* [MIT License: bitvec, wyz](#mit-license-bitvec-wyz) * [MIT License: bytes](#mit-license-bytes) * [MIT License: cargo_metadata](#mit-license-cargo_metadata) * [MIT License: caseless](#mit-license-caseless) +* [MIT License: dashmap](#mit-license-dashmap) +* [MIT License: funty](#mit-license-funty) * [MIT License: generic-array](#mit-license-generic-array) * [MIT License: h2](#mit-license-h2) * [MIT License: http-body](#mit-license-http-body) @@ -20,13 +23,17 @@ the details of which are reproduced below. * [MIT License: libsqlite3-sys, rusqlite](#mit-license-libsqlite3-sys-rusqlite) * [MIT License: matches](#mit-license-matches) * [MIT License: mime_guess](#mit-license-mime_guess) +* [MIT License: miniz_oxide](#mit-license-miniz_oxide) * [MIT License: mio](#mit-license-mio) * [MIT License: nom](#mit-license-nom) * [MIT License: openssl-sys](#mit-license-openssl-sys) * [MIT License: ordered-float](#mit-license-ordered-float) +* [MIT License: oslog](#mit-license-oslog) +* [MIT License: radium](#mit-license-radium) * [MIT License: schannel](#mit-license-schannel) * [MIT License: slab](#mit-license-slab) * [MIT License: strsim](#mit-license-strsim) +* [MIT License: tap](#mit-license-tap) * [MIT License: textwrap](#mit-license-textwrap) * [MIT License: tokio, tokio-util](#mit-license-tokio-tokio-util) * [MIT License: tokio-native-tls, tracing, tracing-core](#mit-license-tokio-native-tls-tracing-tracing-core) @@ -34,7 +41,10 @@ the details of which are reproduced below. * [MIT License: try-lock](#mit-license-try-lock) * [MIT License: want](#mit-license-want) * [MIT License: weedle2](#mit-license-weedle2) +* [MIT License: whatsys](#mit-license-whatsys) +* [MIT License: winapi-util](#mit-license-winapi-util) * [MIT License: winreg](#mit-license-winreg) +* [MIT License: xshell-venv](#mit-license-xshell-venv) * [CC0-1.0 License: base16](#cc0-10-license-base16) * [ISC License: ring](#isc-license-ring) * [BSD-2-Clause License: arrayref](#bsd-2-clause-license-arrayref) @@ -56,7 +66,8 @@ The following text applies to code linked from these dependencies: [uniffi](https://github.com/mozilla/uniffi-rs), [uniffi_bindgen](https://github.com/mozilla/uniffi-rs), [uniffi_build](https://github.com/mozilla/uniffi-rs), -[uniffi_macros](https://github.com/mozilla/uniffi-rs) +[uniffi_macros](https://github.com/mozilla/uniffi-rs), +[zeitstempel](https://github.com/badboy/zeitstempel) ``` Mozilla Public License Version 2.0 @@ -438,7 +449,10 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice ## Apache License 2.0 The following text applies to code linked from these dependencies: +[adler](https://github.com/jonas-schievink/adler.git), [ahash](https://github.com/tkaitchuck/ahash), +[android_log-sys](https://github.com/nercury/android_log-sys-rs), +[android_logger](https://github.com/Nercury/android_logger-rs), [anyhow](https://github.com/dtolnay/anyhow), [askama](https://github.com/djc/askama), [askama_derive](https://github.com/djc/askama), @@ -459,13 +473,18 @@ The following text applies to code linked from these dependencies: [core-foundation-sys](https://github.com/servo/core-foundation-rs), [core-foundation](https://github.com/servo/core-foundation-rs), [cpufeatures](https://github.com/RustCrypto/utils), +[crc32fast](https://github.com/srijs/rust-crc32fast), +[crossbeam-channel](https://github.com/crossbeam-rs/crossbeam), +[crossbeam-utils](https://github.com/crossbeam-rs/crossbeam), [digest](https://github.com/RustCrypto/traits), [dogear](https://github.com/mozilla/dogear), [either](https://github.com/bluss/either), +[env_logger](https://github.com/env-logger-rs/env_logger/), [fallible-iterator](https://github.com/sfackler/rust-fallible-iterator), [fallible-streaming-iterator](https://github.com/sfackler/fallible-streaming-iterator), [fastrand](https://github.com/smol-rs/fastrand), [ffi-support](https://github.com/mozilla/ffi-support), +[flate2](https://github.com/rust-lang/flate2-rs), [fnv](https://github.com/servo/rust-fnv), [foreign-types-shared](https://github.com/sfackler/foreign-types), [foreign-types](https://github.com/sfackler/foreign-types), @@ -486,10 +505,12 @@ The following text applies to code linked from these dependencies: [http](https://github.com/hyperium/http), [httparse](https://github.com/seanmonstar/httparse), [httpdate](https://github.com/pyfisch/httpdate), +[humantime](https://github.com/tailhook/humantime), [hyper-tls](https://github.com/hyperium/hyper-tls), [id-arena](https://github.com/fitzgen/id-arena), [idna](https://github.com/servo/rust-url/), [indexmap](https://github.com/bluss/indexmap), +[inherent](https://github.com/dtolnay/inherent), [ipnet](https://github.com/krisprice/ipnet), [itertools](https://github.com/rust-itertools/itertools), [itoa](https://github.com/dtolnay/itoa), @@ -518,7 +539,6 @@ The following text applies to code linked from these dependencies: [parking_lot_core](https://github.com/Amanieu/parking_lot), [paste](https://github.com/dtolnay/paste), [percent-encoding](https://github.com/servo/rust-url/), -[pest](https://github.com/pest-parser/pest), [pin-project-lite](https://github.com/taiki-e/pin-project-lite), [pin-utils](https://github.com/rust-lang-nursery/pin-utils), [pkg-config](https://github.com/rust-lang/pkg-config-rs), @@ -541,8 +561,7 @@ The following text applies to code linked from these dependencies: [scopeguard](https://github.com/bluss/scopeguard), [security-framework-sys](https://github.com/kornelski/rust-security-framework), [security-framework](https://github.com/kornelski/rust-security-framework), -[semver-parser](https://github.com/steveklabnik/semver-parser), -[semver](https://github.com/steveklabnik/semver), +[semver](https://github.com/dtolnay/semver), [serde](https://github.com/serde-rs/serde), [serde_derive](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), @@ -561,7 +580,6 @@ The following text applies to code linked from these dependencies: [tinyvec_macros](https://github.com/Soveu/tinyvec_macros), [toml](https://github.com/alexcrichton/toml-rs), [typenum](https://github.com/paholg/typenum), -[ucd-trie](https://github.com/BurntSushi/ucd-generate), [unicase](https://github.com/seanmonstar/unicase), [unicode-bidi](https://github.com/servo/unicode-bidi), [unicode-ident](https://github.com/dtolnay/unicode-ident), @@ -575,12 +593,14 @@ The following text applies to code linked from these dependencies: [winapi](https://github.com/retep998/winapi-rs), [windows-sys](https://github.com/microsoft/windows-rs), [windows_x86_64_gnu](https://github.com/microsoft/windows-rs), -[windows_x86_64_msvc](https://github.com/microsoft/windows-rs) +[windows_x86_64_msvc](https://github.com/microsoft/windows-rs), +[xshell-macros](https://github.com/matklad/xshell), +[xshell](https://github.com/matklad/xshell) ``` Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/LICENSE-2.0 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -772,7 +792,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -903,6 +923,37 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: bitvec, wyz + +The following text applies to code linked from these dependencies: +[bitvec](https://github.com/myrrlyn/bitvec), +[wyz](https://github.com/myrrlyn/wyz) + +``` +MIT License + +Copyright (c) 2018 myrrlyn (Alexander Payne) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: bytes @@ -1000,6 +1051,66 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: dashmap + +The following text applies to code linked from these dependencies: +[dashmap](https://github.com/xacrimon/dashmap) + +``` +MIT License + +Copyright (c) 2019 Acrimon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +``` +------------- +## MIT License: funty + +The following text applies to code linked from these dependencies: +[funty](https://github.com/myrrlyn/funty) + +``` +MIT License + +Copyright (c) 2020 myrrlyn (Alexander Payne) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: generic-array @@ -1219,6 +1330,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: miniz_oxide + +The following text applies to code linked from these dependencies: +[miniz_oxide](https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide) + +``` +MIT License + +Copyright (c) 2017 Frommi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: mio @@ -1344,6 +1485,66 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: oslog + +The following text applies to code linked from these dependencies: +[oslog](https://github.com/steven-joruk/oslog) + +``` +MIT License + +Copyright (c) 2020 Steven Joruk + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +``` +------------- +## MIT License: radium + +The following text applies to code linked from these dependencies: +[radium](https://github.com/mystor/radium) + +``` +MIT License + +Copyright (c) 2019 kneecaw (Nika Layzell) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: schannel @@ -1426,6 +1627,36 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: tap + +The following text applies to code linked from these dependencies: +[tap](https://github.com/myrrlyn/tap) + +``` +MIT License + +Copyright (c) 2017 Elliot Linder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: textwrap @@ -1645,6 +1876,66 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABI CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: whatsys + +The following text applies to code linked from these dependencies: +[whatsys](https://github.com/badboy/whatsys) + +``` +The MIT License (MIT) + +Copyright (c) 2021 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +``` +------------- +## MIT License: winapi-util + +The following text applies to code linked from these dependencies: +[winapi-util](https://github.com/BurntSushi/winapi-util) + +``` +The MIT License (MIT) + +Copyright (c) 2017 Andrew Gallant + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + ``` ------------- ## MIT License: winreg @@ -1673,6 +1964,36 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: xshell-venv + +The following text applies to code linked from these dependencies: +[xshell-venv](https://github.com/badboy/xshell-venv) + +``` +The MIT License (MIT) + +Copyright (c) 2022 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## CC0-1.0 License: base16 diff --git a/components/autofill/Cargo.toml b/components/autofill/Cargo.toml index 970b7821c3..04fbd5478e 100644 --- a/components/autofill/Cargo.toml +++ b/components/autofill/Cargo.toml @@ -23,7 +23,7 @@ sync15 = { path = "../sync15" } sync15-traits = {path = "../support/sync15-traits"} thiserror = "1.0" types = { path = "../support/types" } -uniffi = "^0.18" +uniffi = "^0.19" url = { version = "2.2", features = ["serde"] } [dependencies.rusqlite] @@ -36,4 +36,4 @@ libsqlite3-sys = "0.24.1" [build-dependencies] nss_build_common = { path = "../support/rc_crypto/nss/nss_build_common" } -uniffi_build = { version = "^0.18", features = [ "builtin-bindgen" ]} +uniffi_build = { version = "^0.19", features = [ "builtin-bindgen" ]} diff --git a/components/crashtest/Cargo.toml b/components/crashtest/Cargo.toml index 95fa0f3c64..0bb95cc54c 100644 --- a/components/crashtest/Cargo.toml +++ b/components/crashtest/Cargo.toml @@ -9,8 +9,8 @@ exclude = ["/android", "/ios"] [dependencies] log = "0.4" thiserror = "1.0" -uniffi = "^0.18" -uniffi_macros = "^0.18" +uniffi = "^0.19" +uniffi_macros = "^0.19" [build-dependencies] -uniffi_build = { version = "^0.18", features=["builtin-bindgen"] } +uniffi_build = { version = "^0.19", features=["builtin-bindgen"] } diff --git a/components/external/glean b/components/external/glean index d26be9d9bf..2ecec45ae6 160000 --- a/components/external/glean +++ b/components/external/glean @@ -1 +1 @@ -Subproject commit d26be9d9bf62ce55fa8a020259eae1419501de0f +Subproject commit 2ecec45ae6050318491c0d607d71dc1a6ff100e8 diff --git a/components/fxa-client/Cargo.toml b/components/fxa-client/Cargo.toml index 6e0d0a8188..271c9779d8 100644 --- a/components/fxa-client/Cargo.toml +++ b/components/fxa-client/Cargo.toml @@ -24,11 +24,11 @@ error-support = { path = "../support/error" } thiserror = "1.0" anyhow = "1.0" sync-guid = { path = "../support/guid", features = ["random"] } -uniffi = "^0.18" -uniffi_macros = "^0.18" +uniffi = "^0.19" +uniffi_macros = "^0.19" [build-dependencies] -uniffi_build = { version = "^0.18", features=["builtin-bindgen"] } +uniffi_build = { version = "^0.19", features=["builtin-bindgen"] } [dev-dependencies] viaduct-reqwest = { path = "../support/viaduct-reqwest" } diff --git a/components/logins/Cargo.toml b/components/logins/Cargo.toml index 342abc34be..a3181c5520 100644 --- a/components/logins/Cargo.toml +++ b/components/logins/Cargo.toml @@ -25,15 +25,15 @@ error-support = { path = "../support/error", features = ["reporting"] } sync-guid = { path = "../support/guid", features = ["rusqlite_support", "random"] } thiserror = "1.0" anyhow = "1.0" -uniffi = "^0.18" -uniffi_macros = "^0.18" +uniffi = "^0.19" +uniffi_macros = "^0.19" [dependencies.rusqlite] version = "0.27.0" features = ["sqlcipher", "limits", "unlock_notify"] [build-dependencies] -uniffi_build = { version = "^0.18", features=["builtin-bindgen"] } +uniffi_build = { version = "^0.19", features=["builtin-bindgen"] } [dev-dependencies] more-asserts = "0.2" diff --git a/components/logins/ios/Logins/LoginsStorage.swift b/components/logins/ios/Logins/LoginsStorage.swift index 1e42813197..2b3f7d7d38 100644 --- a/components/logins/ios/Logins/LoginsStorage.swift +++ b/components/logins/ios/Logins/LoginsStorage.swift @@ -3,8 +3,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import Foundation -import Glean import UIKit +#if canImport(MozillaRustComponents) + import MozillaRustComponents +#endif typealias LoginsStoreError = LoginsStorageError diff --git a/components/nimbus/Cargo.toml b/components/nimbus/Cargo.toml index 473a3a2585..e3237d06ec 100644 --- a/components/nimbus/Cargo.toml +++ b/components/nimbus/Cargo.toml @@ -32,12 +32,14 @@ uuid = { version = "0.8", features = ["serde", "v4"]} sha2 = "0.9" hex = "0.4" once_cell = "1" -uniffi = { version = "^0.18", optional = true } +uniffi = { version = "^0.19", optional = true } chrono = { version = "0.4", features = ["serde"]} unicode-segmentation = "1.8.0" +glean = { path = "../external/glean/glean-core/rlb" } [build-dependencies] -uniffi_build = { version = "^0.18", features = [ "builtin-bindgen" ], optional = true } +uniffi_build = { version = "^0.19", features = [ "builtin-bindgen" ], optional = true } +glean-build = { path = "../external/glean/glean-core/build" } [dev-dependencies] viaduct-reqwest = { path = "../support/viaduct-reqwest" } diff --git a/components/nimbus/build.rs b/components/nimbus/build.rs index ff3fb9fe59..44691244bb 100644 --- a/components/nimbus/build.rs +++ b/components/nimbus/build.rs @@ -2,28 +2,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use std::{env, process::Command}; +use glean_build::Builder; pub fn main() { #[cfg(feature = "uniffi-bindings")] uniffi_build::generate_scaffolding("./src/nimbus.udl").unwrap(); - // Run Glean Parser via tools/bootstrap_glean_rust.py python script - let out_dir = env::var("OUT_DIR").unwrap(); - Command::new("python") - .args(&[ - "../../tools/bootstrap_glean_rust.py", - "online", - "glean_parser", - "5.1.1", - "translate", - "-f", - "rust", - "-o", - out_dir.as_str(), - "./metrics.yaml", - ]) - .status() + Builder::default() + .file("./metrics.yaml") + .generate() .expect("Error generating Glean Rust bindings"); println!("cargo:rerun-if-changed=./metrics.yaml"); diff --git a/components/nimbus/ios/Nimbus/GleanPlumbHelpers.swift b/components/nimbus/ios/Nimbus/GleanPlumbHelpers.swift index 5fe6c53b4f..c39d5a3c60 100644 --- a/components/nimbus/ios/Nimbus/GleanPlumbHelpers.swift +++ b/components/nimbus/ios/Nimbus/GleanPlumbHelpers.swift @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import Foundation -import Glean +import MozillaRustComponents /** * Instances of this class are useful for implementing a messaging service based upon diff --git a/components/nimbus/ios/Nimbus/Nimbus.swift b/components/nimbus/ios/Nimbus/Nimbus.swift index aaad0a7247..86e41c3cb6 100644 --- a/components/nimbus/ios/Nimbus/Nimbus.swift +++ b/components/nimbus/ios/Nimbus/Nimbus.swift @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import Foundation -import Glean +import MozillaRustComponents public class Nimbus: NimbusApi { private let nimbusClient: NimbusClientProtocol @@ -58,74 +58,15 @@ private extension Nimbus { extension Nimbus: FeaturesInterface { public func recordExposureEvent(featureId: String) { - // First we need a list of the active experiments that are enrolled. - let activeExperiments = getActiveExperiments() - - // Next, we search for any experiment that has a matching featureId. This depends on the - // fact that we can only be enrolled in a single experiment per feature, so there should - // only ever be zero or one experiments for a given featureId. - if let experiment = activeExperiments.first(where: { $0.featureIds.contains(featureId) }) { - // Finally, if we do have an experiment for the given featureId, we will record the - // exposure event in Glean. This is to protect against accidentally recording an event - // for an experiment without an active enrollment. - GleanMetrics.NimbusEvents.exposure.record(GleanMetrics.NimbusEvents.ExposureExtra( - branch: experiment.branchSlug, - enrollmentId: experiment.enrollmentId, - experiment: experiment.slug - )) - } + catchAll { try nimbusClient.recordExposureEvent(featureId: featureId) } } - internal func postEnrollmentCalculation(_ events: [EnrollmentChangeEvent]) { - // We need to update the experiment enrollment annotations in Glean - // regardless of whether we recieved any events. Calling the - // `setExperimentActive` function multiple times with the same - // experiment id is safe so nothing bad should happen in case we do. - let experiments = getActiveExperiments() - recordExperimentTelemetry(experiments) - - // Record enrollment change events, if any - recordExperimentEvents(events) - + internal func postEnrollmentCalculation() { // Inform any listeners that we're done here. + let experiments = getActiveExperiments() notifyOnExperimentsApplied(experiments) } - internal func recordExperimentTelemetry(_ experiments: [EnrolledExperiment]) { - for experiment in experiments { - Glean.shared.setExperimentActive( - experiment.slug, - branch: experiment.branchSlug, - extra: ["enrollmentId": experiment.enrollmentId] - ) - } - } - - internal func recordExperimentEvents(_ events: [EnrollmentChangeEvent]) { - for event in events { - switch event.change { - case .enrollment: - GleanMetrics.NimbusEvents.enrollment.record(GleanMetrics.NimbusEvents.EnrollmentExtra( - branch: event.branchSlug, - enrollmentId: event.enrollmentId, - experiment: event.experimentSlug - )) - case .disqualification: - GleanMetrics.NimbusEvents.disqualification.record(GleanMetrics.NimbusEvents.DisqualificationExtra( - branch: event.branchSlug, - enrollmentId: event.enrollmentId, - experiment: event.experimentSlug - )) - case .unenrollment: - GleanMetrics.NimbusEvents.unenrollment.record(GleanMetrics.NimbusEvents.UnenrollmentExtra( - branch: event.branchSlug, - enrollmentId: event.enrollmentId, - experiment: event.experimentSlug - )) - } - } - } - internal func getFeatureConfigVariablesJson(featureId: String) -> [String: Any]? { return catchAll { if let string = try nimbusClient.getFeatureConfigVariables(featureId: featureId), @@ -166,8 +107,8 @@ private extension Nimbus { */ internal extension Nimbus { func setGlobalUserParticipationOnThisThread(_ value: Bool) throws { - let changes = try nimbusClient.setGlobalUserParticipation(optIn: value) - postEnrollmentCalculation(changes) + _ = try nimbusClient.setGlobalUserParticipation(optIn: value) + postEnrollmentCalculation() } func initializeOnThisThread() throws { @@ -180,8 +121,8 @@ internal extension Nimbus { } func applyPendingExperimentsOnThisThread() throws { - let changes = try nimbusClient.applyPendingExperiments() - postEnrollmentCalculation(changes) + _ = try nimbusClient.applyPendingExperiments() + postEnrollmentCalculation() } func setExperimentsLocallyOnThisThread(_ experimentsJson: String) throws { @@ -189,18 +130,18 @@ internal extension Nimbus { } func optOutOnThisThread(_ experimentId: String) throws { - let changes = try nimbusClient.optOut(experimentSlug: experimentId) - postEnrollmentCalculation(changes) + _ = try nimbusClient.optOut(experimentSlug: experimentId) + postEnrollmentCalculation() } func optInOnThisThread(_ experimentId: String, branch: String) throws { - let changes = try nimbusClient.optInWithBranch(experimentSlug: experimentId, branch: branch) - postEnrollmentCalculation(changes) + _ = try nimbusClient.optInWithBranch(experimentSlug: experimentId, branch: branch) + postEnrollmentCalculation() } func resetTelemetryIdentifiersOnThisThread(_ identifiers: AvailableRandomizationUnits) throws { - let changes = try nimbusClient.resetTelemetryIdentifiers(newRandomizationUnits: identifiers) - postEnrollmentCalculation(changes) + _ = try nimbusClient.resetTelemetryIdentifiers(newRandomizationUnits: identifiers) + postEnrollmentCalculation() } } diff --git a/components/nimbus/ios/Nimbus/NimbusApi.swift b/components/nimbus/ios/Nimbus/NimbusApi.swift index c067d7082c..cc8090558f 100644 --- a/components/nimbus/ios/Nimbus/NimbusApi.swift +++ b/components/nimbus/ios/Nimbus/NimbusApi.swift @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import Foundation -import Glean +import MozillaRustComponents /// This is the main experiments API, which is exposed through the global [Nimbus] object. /// diff --git a/components/nimbus/metrics.yaml b/components/nimbus/metrics.yaml index 8624c9ff8b..4929062b16 100644 --- a/components/nimbus/metrics.yaml +++ b/components/nimbus/metrics.yaml @@ -80,6 +80,9 @@ nimbus_events: enrollment_id: type: string description: A unique identifier generated at enrollment time + reason: + type: string + description: The reason for the disqualification bugs: - https://jira.mozilla.com/browse/SDK-126 data_reviews: @@ -115,3 +118,20 @@ nimbus_events: notification_emails: - tlong@mozilla.com, telemetry-team@mozilla.com expires: never +nimbus_health: + network_request: + type: timing_distribution + time_unit: millisecond + description: > + The time in milliseconds that the Nimbus SDK takes to fetch experiments + from remote-settings + bugs: + - https://mozilla-hub.atlassian.net/browse/EXP-2063 + data_reviews: + - https://github.com/mozilla-mobile/android-components/pull/9168#issuecomment-743461975 + data_sensitivity: + - technical + notification_emails: + - tlong@mozilla.com + - nimbus-team@mozilla.com + expires: never diff --git a/components/nimbus/src/enrollment.rs b/components/nimbus/src/enrollment.rs index e8fed6c047..bf84b1ded1 100644 --- a/components/nimbus/src/enrollment.rs +++ b/components/nimbus/src/enrollment.rs @@ -8,6 +8,8 @@ use crate::persistence::{Database, StoreId, Writer}; use crate::{evaluator::evaluate_enrollment, persistence::Readable}; use crate::{AvailableRandomizationUnits, EnrolledExperiment, Experiment, FeatureConfig}; +use crate::glean_metrics::nimbus_events; + use ::uuid::Uuid; use serde_derive::*; use std::{ @@ -373,40 +375,75 @@ impl ExperimentEnrollment { enrollment_id, branch, .. - } => EnrollmentChangeEvent::new( - &self.slug, - enrollment_id, - branch, - None, - EnrollmentChangeEventType::Enrollment, - ), + } => { + nimbus_events::enrollment.record(nimbus_events::EnrollmentExtra { + branch: Some(branch.to_string()), + enrollment_id: Some(enrollment_id.to_string()), + experiment: Some(self.slug.to_string()), + }); + let mut extra = HashMap::new(); + extra.insert("enrollment_id".to_string(), enrollment_id.to_string()); + glean::set_experiment_active( + enrollment_id.to_string(), + branch.to_string(), + Some(extra), + ); + EnrollmentChangeEvent::new( + &self.slug, + enrollment_id, + branch, + None, + EnrollmentChangeEventType::Enrollment, + ) + } EnrollmentStatus::WasEnrolled { enrollment_id, branch, .. - } => EnrollmentChangeEvent::new( - &self.slug, - enrollment_id, - branch, - None, - EnrollmentChangeEventType::Unenrollment, - ), + } => { + nimbus_events::unenrollment.record(nimbus_events::UnenrollmentExtra { + branch: Some(branch.to_string()), + enrollment_id: Some(enrollment_id.to_string()), + experiment: Some(self.slug.to_string()), + }); + glean::set_experiment_inactive(enrollment_id.to_string()); + EnrollmentChangeEvent::new( + &self.slug, + enrollment_id, + branch, + None, + EnrollmentChangeEventType::Unenrollment, + ) + } EnrollmentStatus::Disqualified { enrollment_id, branch, reason, .. - } => EnrollmentChangeEvent::new( - &self.slug, - enrollment_id, - branch, - match reason { - DisqualifiedReason::NotTargeted => Some("targeting"), - DisqualifiedReason::OptOut => Some("optout"), - DisqualifiedReason::Error => Some("error"), - }, - EnrollmentChangeEventType::Disqualification, - ), + } => { + nimbus_events::disqualification.record(nimbus_events::DisqualificationExtra { + branch: Some(branch.to_string()), + enrollment_id: Some(enrollment_id.to_string()), + experiment: Some(self.slug.to_string()), + reason: match reason { + DisqualifiedReason::NotTargeted => Some("targeting".to_string()), + DisqualifiedReason::OptOut => Some("optout".to_string()), + DisqualifiedReason::Error => Some("error".to_string()), + }, + }); + glean::set_experiment_inactive(enrollment_id.to_string()); + EnrollmentChangeEvent::new( + &self.slug, + enrollment_id, + branch, + match reason { + DisqualifiedReason::NotTargeted => Some("targeting"), + DisqualifiedReason::OptOut => Some("optout"), + DisqualifiedReason::Error => Some("error"), + }, + EnrollmentChangeEventType::Disqualification, + ) + } EnrollmentStatus::NotEnrolled { .. } | EnrollmentStatus::Error { .. } => unreachable!(), } } diff --git a/components/nimbus/src/glean_metrics.rs b/components/nimbus/src/glean_metrics.rs new file mode 100644 index 0000000000..1bb9ea0fbd --- /dev/null +++ b/components/nimbus/src/glean_metrics.rs @@ -0,0 +1,9 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use std::env; + +// This includes the generated Glean Rust bindings, which get exposed +// via the `mod glean_metrics` include in lib.rs +include!(concat!(env!("OUT_DIR"), "/glean_metrics.rs")); diff --git a/components/nimbus/src/lib.rs b/components/nimbus/src/lib.rs index cdf0bf85c9..ec9922d9d7 100644 --- a/components/nimbus/src/lib.rs +++ b/components/nimbus/src/lib.rs @@ -34,6 +34,11 @@ use evaluator::is_experiment_available; // Exposed for Example only pub use evaluator::TargetingAttributes; +// Expose generated Glean Rust metrics +pub mod glean_metrics; +use crate::glean_metrics::nimbus_events; +use crate::glean_metrics::nimbus_health; + // We only use this in a test, and with --no-default-features, we don't use it // at all #[allow(unused_imports)] @@ -225,7 +230,9 @@ impl NimbusClient { pub fn fetch_experiments(&self) -> Result<()> { log::info!("fetching experiments"); let settings_client = self.settings_client.lock().unwrap(); + let timer_id = nimbus_health::network_request.start(); let new_experiments = settings_client.fetch_experiments()?; + nimbus_health::network_request.stop_and_accumulate(timer_id); let db = self.db()?; let mut writer = db.write()?; write_pending_experiments(db, &mut writer, new_experiments)?; @@ -488,6 +495,25 @@ impl NimbusClient { let helper = NimbusStringHelper::new(context.as_object().unwrap().to_owned()); Ok(Arc::new(helper)) } + + pub fn record_exposure_event(&self, feature_id: String) -> Result<()> { + // Next, we search for any experiment that has a matching featureId. This depends on the + // fact that we can only be enrolled in a single experiment per feature, so there should + // only ever be zero or one experiments for a given featureId. + if let Some(exp) = self + .get_active_experiments()? + .iter() + .find(|exp| exp.feature_ids.contains(&feature_id)) + { + nimbus_events::exposure.record(nimbus_events::ExposureExtra { + branch: Some(exp.branch_slug.clone()), + enrollment_id: Some(exp.enrollment_id.clone()), + experiment: Some(exp.slug.clone()), + }); + } + + Ok(()) + } } #[derive(Debug, Clone)] diff --git a/components/nimbus/src/nimbus.udl b/components/nimbus/src/nimbus.udl index a391442092..36bf1475f1 100644 --- a/components/nimbus/src/nimbus.udl +++ b/components/nimbus/src/nimbus.udl @@ -197,6 +197,13 @@ interface NimbusClient { // It's first use is in GleanPlumb message helper, to add extra parameters to URLs. [Throws=NimbusError] NimbusStringHelper create_string_helper(optional JsonObject? additional_context = null); + + // If an active experiment exists with the provided feature_id, then an exposure event will be + // recorded. If there is no active experiment, then nothing happens. This makes this function + // safe to call at the point of exposure for the feature regardless of whether an experiment is + // active or not. + [Throws=NimbusError] + void record_exposure_event(string feature_id); }; [Custom] diff --git a/components/nimbus/tests/test_telemetry.rs b/components/nimbus/tests/test_telemetry.rs new file mode 100644 index 0000000000..e10f5e962c --- /dev/null +++ b/components/nimbus/tests/test_telemetry.rs @@ -0,0 +1,219 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +mod common; +#[cfg(feature = "rkv-safe-mode")] +#[cfg(test)] +mod test { + + use super::common::new_test_client_with_db; + use glean::{test_reset_glean, ClientInfoMetrics, Configuration, RecordedEvent}; + use nimbus::glean_metrics; + + #[cfg(feature = "rkv-safe-mode")] + use nimbus::error::Result; + use serde_json::json; + + #[test] + fn test_enrollment_telemetry() -> Result<()> { + // First, a little setup with a matching and non-matching experiment for testing + // the enrollment telemetry + let temp_dir = tempfile::tempdir()?; + let client = new_test_client_with_db(&temp_dir)?; + client.initialize()?; + let experiment_json = serde_json::to_string(&json!({ + "data": [{ + "schemaVersion": "1.0.0", + "slug": "secure-gold", + "endDate": null, + "featureIds": ["some-feature"], + "branches": [ + { + "slug": "control", + "ratio": 1 + }, + { + "slug": "treatment", + "ratio": 1 + } + ], + "channel": "nightly", + "probeSets": [], + "startDate": null, + "appName": "fenix", + "appId": "org.mozilla.fenix", + "bucketConfig": { + "count": 10000, + "start": 0, + "total": 10000, + "namespace": "secure-gold", + "randomizationUnit": "nimbus_id" + }, + "targeting": "false", + "userFacingName": "Diagnostic test experiment", + "referenceBranch": "control", + "isEnrollmentPaused": false, + "proposedEnrollment": 7, + "userFacingDescription": "This is a test experiment for diagnostic purposes.", + "id": "secure-copper", + "last_modified": 1_602_197_324_372i64, + }, + { + "schemaVersion": "1.0.0", + "slug": "secure-silver", + "endDate": null, + "featureIds": ["some-feature"], + "branches": [ + { + "slug": "control", + "ratio": 1 + }, + { + "slug": "treatment", + "ratio": 1 + } + ], + "channel": "nightly", + "probeSets": [], + "startDate": null, + "appName": "fenix", + "appId": "org.mozilla.fenix", + "bucketConfig": { + "count": 10000, + "start": 0, + "total": 10000, + "namespace": "secure-silver", + "randomizationUnit": "nimbus_id" + }, + "userFacingName": "Diagnostic test experiment", + "referenceBranch": "control", + "isEnrollmentPaused": false, + "proposedEnrollment": 7, + "userFacingDescription": "This is a test experiment for diagnostic purposes.", + "id": "secure-copper", + "last_modified": 1_602_197_324_372i64, + } + ] + }))?; + + let tmp_glean_dir = temp_dir.path().join("glean_data"); + test_reset_glean( + Configuration { + data_path: tmp_glean_dir, + application_id: "org.mozilla.fenix".into(), + upload_enabled: true, + max_events: None, + delay_ping_lifetime_io: false, + server_endpoint: Some("invalid-test-host".into()), + uploader: None, + use_core_mps: false, + }, + ClientInfoMetrics::unknown(), + false, + ); + + client.set_experiments_locally(experiment_json)?; + let change_events = client.apply_pending_experiments()?; + + // Check for Glean enrollment event + let events: Option> = + glean_metrics::nimbus_events::enrollment.test_get_value("events"); + assert!(events.is_some()); + assert_eq!(1, events.clone().unwrap().len()); + let event_extra = events.unwrap()[0].extra.to_owned().unwrap(); + assert_eq!("secure-silver", event_extra["experiment"]); + assert_eq!(change_events[0].branch_slug, event_extra["branch"]); + assert_eq!(change_events[0].enrollment_id, event_extra["enrollment_id"]); + + let experiment_json = serde_json::to_string(&json!({ + "data": [{ + "schemaVersion": "1.0.0", + "slug": "secure-gold", + "endDate": null, + "featureIds": ["some-feature"], + "branches": [ + { + "slug": "control", + "ratio": 1 + }, + { + "slug": "treatment", + "ratio": 1 + } + ], + "channel": "nightly", + "probeSets": [], + "startDate": null, + "appName": "fenix", + "appId": "org.mozilla.fenix", + "bucketConfig": { + "count": 10000, + "start": 0, + "total": 10000, + "namespace": "secure-gold", + "randomizationUnit": "nimbus_id" + }, + "targeting": "false", + "userFacingName": "Diagnostic test experiment", + "referenceBranch": "control", + "isEnrollmentPaused": false, + "proposedEnrollment": 7, + "userFacingDescription": "This is a test experiment for diagnostic purposes.", + "id": "secure-copper", + "last_modified": 1_602_197_324_372i64, + }] + }))?; + + // Drop the NimbusClient to terminate the underlying database connection and restart + drop(client); + let client = new_test_client_with_db(&temp_dir)?; + client.initialize()?; + client.set_experiments_locally(experiment_json)?; + let change_events = client.apply_pending_experiments()?; + + // Check for Glean unenrollment event with the correct `reason` + let events: Option> = + glean_metrics::nimbus_events::unenrollment.test_get_value("events"); + assert!(events.is_some()); + assert_eq!(1, events.clone().unwrap().len()); + let event_extra = events.unwrap()[0].extra.to_owned().unwrap(); + assert_eq!("secure-silver", event_extra["experiment"]); + assert_eq!(change_events[0].branch_slug, event_extra["branch"]); + assert_eq!(change_events[0].enrollment_id, event_extra["enrollment_id"]); + + // Now let's opt into the secure-gold experiment and check for the enrollment event + let change_events = + client.opt_in_with_branch("secure-gold".to_string(), "control".to_string())?; + + // Check for Glean enrollment event + let events: Option> = + glean_metrics::nimbus_events::enrollment.test_get_value("events"); + assert!(events.is_some()); + // This is the second enrollment. Because we didn't reset Glean and didn't send an + // events ping yet, the enrollment from above should still be there. + assert_eq!(2, events.clone().unwrap().len()); + let event_extra = events.unwrap()[1].extra.to_owned().unwrap(); + assert_eq!("secure-gold", event_extra["experiment"]); + assert_eq!(change_events[0].branch_slug, event_extra["branch"]); + assert_eq!(change_events[0].enrollment_id, event_extra["enrollment_id"]); + + // Next we will opt out of the secure-gold experiment and check for unenrollment telemetry + let change_events = client.opt_out("secure-gold".to_string())?; + + // Check for Glean disqualification event with the correct `reason` of opt-out + let events: Option> = + glean_metrics::nimbus_events::disqualification.test_get_value("events"); + assert!(events.is_some()); + assert_eq!(1, events.clone().unwrap().len()); + let event_extra = events.unwrap()[0].extra.to_owned().unwrap(); + assert_eq!("secure-gold", event_extra["experiment"]); + assert_eq!(change_events[0].branch_slug, event_extra["branch"]); + assert_eq!(change_events[0].enrollment_id, event_extra["enrollment_id"]); + assert_eq!( + *change_events[0].reason.as_ref().unwrap(), + event_extra["reason"] + ); + Ok(()) + } +} diff --git a/components/places/Cargo.toml b/components/places/Cargo.toml index 19240394b8..105b43ae42 100644 --- a/components/places/Cargo.toml +++ b/components/places/Cargo.toml @@ -31,8 +31,8 @@ error-support = { path = "../support/error", features = ["reporting"] } sync-guid = { path = "../support/guid", features = ["rusqlite_support", "random"]} thiserror = "1.0" anyhow = "1.0" -uniffi = "^0.18" -uniffi_macros = "^0.18" +uniffi = "^0.19" +uniffi_macros = "^0.19" [dependencies.rusqlite] version = "0.27.0" @@ -44,4 +44,4 @@ tempfile = "3.1" env_logger = {version = "0.7", default-features = false} [build-dependencies] -uniffi_build = { version = "^0.18", features=["builtin-bindgen"] } +uniffi_build = { version = "^0.19", features=["builtin-bindgen"] } diff --git a/components/push/Cargo.toml b/components/push/Cargo.toml index a5519641a3..14b740ed25 100644 --- a/components/push/Cargo.toml +++ b/components/push/Cargo.toml @@ -20,11 +20,11 @@ viaduct = { path = "../viaduct" } sql-support = { path = "../support/sql" } rc_crypto = { path = "../support/rc_crypto", features = ["ece"] } thiserror = "1.0" -uniffi = "^0.18" -uniffi_macros = "^0.18" +uniffi = "^0.19" +uniffi_macros = "^0.19" [build-dependencies] -uniffi_build = { version = "^0.18", features=["builtin-bindgen"] } +uniffi_build = { version = "^0.19", features=["builtin-bindgen"] } [dev-dependencies] diff --git a/components/support/error/Cargo.toml b/components/support/error/Cargo.toml index 03c2e64ef3..97a4efe51d 100644 --- a/components/support/error/Cargo.toml +++ b/components/support/error/Cargo.toml @@ -9,8 +9,8 @@ license = "MPL-2.0" log = "0.4" lazy_static = { version = "1.4", optional = true } parking_lot = { version = ">=0.11,<=0.12", optional = true } -uniffi = { version = "^0.18", optional = true } -uniffi_macros = { version = "^0.18", optional = true } +uniffi = { version = "^0.19", optional = true } +uniffi_macros = { version = "^0.19", optional = true } [dependencies.backtrace] optional = true @@ -21,4 +21,4 @@ default = [] reporting = ["lazy_static", "parking_lot", "uniffi", "uniffi_macros", "uniffi_build"] [build-dependencies] -uniffi_build = { version = "^0.18", features=["builtin-bindgen"], optional = true } +uniffi_build = { version = "^0.19", features=["builtin-bindgen"], optional = true } diff --git a/components/sync_manager/Cargo.toml b/components/sync_manager/Cargo.toml index 41d3e73c6b..b4c0659caf 100644 --- a/components/sync_manager/Cargo.toml +++ b/components/sync_manager/Cargo.toml @@ -24,8 +24,8 @@ serde_derive = "1" serde_json = "1" parking_lot = ">=0.11,<=0.12" interrupt-support = { path = "../support/interrupt" } -uniffi = "^0.18" +uniffi = "^0.19" uniffi_macros = "^0.18" [build-dependencies] -uniffi_build = { version = "^0.18", features=["builtin-bindgen"] } +uniffi_build = { version = "^0.19", features=["builtin-bindgen"] } diff --git a/components/tabs/Cargo.toml b/components/tabs/Cargo.toml index 3540e52825..e02282c114 100644 --- a/components/tabs/Cargo.toml +++ b/components/tabs/Cargo.toml @@ -20,8 +20,8 @@ sql-support = { path = "../support/sql" } sync-guid = { path = "../support/guid", features = ["random"] } sync15 = { path = "../sync15" } thiserror = "1.0" -uniffi = "^0.18" -uniffi_macros = "^0.18" +uniffi = "^0.19" +uniffi_macros = "^0.19" url = "2.1" # mozilla-central can't yet take 2.2 (see bug 1734538) [dev-dependencies] @@ -29,4 +29,4 @@ tempfile = "3.1" env_logger = { version = "0.8.0", default-features = false, features = ["termcolor", "atty", "humantime"] } [build-dependencies] -uniffi_build = { version = "^0.18", features = [ "builtin-bindgen" ]} +uniffi_build = { version = "^0.19", features = [ "builtin-bindgen" ]} diff --git a/megazords/full/DEPENDENCIES.md b/megazords/full/DEPENDENCIES.md index 2eb3616f09..b84640caeb 100644 --- a/megazords/full/DEPENDENCIES.md +++ b/megazords/full/DEPENDENCIES.md @@ -9,18 +9,26 @@ the details of which are reproduced below. * [MIT License: aho-corasick, byteorder, memchr, termcolor](#mit-license-aho-corasick-byteorder-memchr-termcolor) * [MIT License: atty](#mit-license-atty) * [MIT License: bincode](#mit-license-bincode) +* [MIT License: bitvec, wyz](#mit-license-bitvec-wyz) * [MIT License: bytes](#mit-license-bytes) * [MIT License: cargo_metadata](#mit-license-cargo_metadata) * [MIT License: caseless](#mit-license-caseless) +* [MIT License: funty](#mit-license-funty) * [MIT License: generic-array](#mit-license-generic-array) * [MIT License: libsqlite3-sys, rusqlite](#mit-license-libsqlite3-sys-rusqlite) * [MIT License: matches](#mit-license-matches) * [MIT License: mime_guess](#mit-license-mime_guess) +* [MIT License: miniz_oxide](#mit-license-miniz_oxide) * [MIT License: nom](#mit-license-nom) * [MIT License: ordered-float](#mit-license-ordered-float) +* [MIT License: radium](#mit-license-radium) * [MIT License: strsim](#mit-license-strsim) +* [MIT License: tap](#mit-license-tap) * [MIT License: textwrap](#mit-license-textwrap) * [MIT License: weedle2](#mit-license-weedle2) +* [MIT License: whatsys](#mit-license-whatsys) +* [MIT License: winapi-util](#mit-license-winapi-util) +* [MIT License: xshell-venv](#mit-license-xshell-venv) * [CC0-1.0 License: base16](#cc0-10-license-base16) * [ISC License: ring](#isc-license-ring) * [BSD-2-Clause License: arrayref](#bsd-2-clause-license-arrayref) @@ -40,7 +48,8 @@ The following text applies to code linked from these dependencies: [uniffi](https://github.com/mozilla/uniffi-rs), [uniffi_bindgen](https://github.com/mozilla/uniffi-rs), [uniffi_build](https://github.com/mozilla/uniffi-rs), -[uniffi_macros](https://github.com/mozilla/uniffi-rs) +[uniffi_macros](https://github.com/mozilla/uniffi-rs), +[zeitstempel](https://github.com/badboy/zeitstempel) ``` Mozilla Public License Version 2.0 @@ -422,7 +431,10 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice ## Apache License 2.0 The following text applies to code linked from these dependencies: +[adler](https://github.com/jonas-schievink/adler.git), [ahash](https://github.com/tkaitchuck/ahash), +[android_log-sys](https://github.com/nercury/android_log-sys-rs), +[android_logger](https://github.com/Nercury/android_logger-rs), [anyhow](https://github.com/dtolnay/anyhow), [askama](https://github.com/djc/askama), [askama_derive](https://github.com/djc/askama), @@ -441,13 +453,18 @@ The following text applies to code linked from these dependencies: [clap_derive](https://github.com/clap-rs/clap/tree/master/clap_derive), [clap_lex](https://github.com/clap-rs/clap/tree/master/clap_lex), [cpufeatures](https://github.com/RustCrypto/utils), +[crc32fast](https://github.com/srijs/rust-crc32fast), +[crossbeam-channel](https://github.com/crossbeam-rs/crossbeam), +[crossbeam-utils](https://github.com/crossbeam-rs/crossbeam), [digest](https://github.com/RustCrypto/traits), [dogear](https://github.com/mozilla/dogear), [either](https://github.com/bluss/either), +[env_logger](https://github.com/env-logger-rs/env_logger/), [fallible-iterator](https://github.com/sfackler/rust-fallible-iterator), [fallible-streaming-iterator](https://github.com/sfackler/fallible-streaming-iterator), [fastrand](https://github.com/smol-rs/fastrand), [ffi-support](https://github.com/mozilla/ffi-support), +[flate2](https://github.com/rust-lang/flate2-rs), [form_urlencoded](https://github.com/servo/rust-url), [fs-err](https://github.com/andrewhickman/fs-err), [getrandom](https://github.com/rust-random/getrandom), @@ -456,9 +473,11 @@ The following text applies to code linked from these dependencies: [hashlink](https://github.com/kyren/hashlink), [heck](https://github.com/withoutboats/heck), [hex](https://github.com/KokaKiwi/rust-hex), +[humantime](https://github.com/tailhook/humantime), [id-arena](https://github.com/fitzgen/id-arena), [idna](https://github.com/servo/rust-url/), [indexmap](https://github.com/bluss/indexmap), +[inherent](https://github.com/dtolnay/inherent), [itertools](https://github.com/rust-itertools/itertools), [itoa](https://github.com/dtolnay/itoa), [jna](https://github.com/java-native-access/jna), @@ -480,7 +499,6 @@ The following text applies to code linked from these dependencies: [parking_lot_core](https://github.com/Amanieu/parking_lot), [paste](https://github.com/dtolnay/paste), [percent-encoding](https://github.com/servo/rust-url/), -[pest](https://github.com/pest-parser/pest), [pkg-config](https://github.com/rust-lang/pkg-config-rs), [ppv-lite86](https://github.com/cryptocorrosion/cryptocorrosion), [proc-macro-error-attr](https://gitlab.com/CreepySkeleton/proc-macro-error), @@ -498,8 +516,7 @@ The following text applies to code linked from these dependencies: [rkv](https://github.com/mozilla/rkv), [ryu](https://github.com/dtolnay/ryu), [scopeguard](https://github.com/bluss/scopeguard), -[semver-parser](https://github.com/steveklabnik/semver-parser), -[semver](https://github.com/steveklabnik/semver), +[semver](https://github.com/dtolnay/semver), [serde](https://github.com/serde-rs/serde), [serde_derive](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), @@ -516,7 +533,6 @@ The following text applies to code linked from these dependencies: [tinyvec_macros](https://github.com/Soveu/tinyvec_macros), [toml](https://github.com/alexcrichton/toml-rs), [typenum](https://github.com/paholg/typenum), -[ucd-trie](https://github.com/BurntSushi/ucd-generate), [unicase](https://github.com/seanmonstar/unicase), [unicode-bidi](https://github.com/servo/unicode-bidi), [unicode-ident](https://github.com/dtolnay/unicode-ident), @@ -530,12 +546,14 @@ The following text applies to code linked from these dependencies: [winapi](https://github.com/retep998/winapi-rs), [windows-sys](https://github.com/microsoft/windows-rs), [windows_x86_64_gnu](https://github.com/microsoft/windows-rs), -[windows_x86_64_msvc](https://github.com/microsoft/windows-rs) +[windows_x86_64_msvc](https://github.com/microsoft/windows-rs), +[xshell-macros](https://github.com/matklad/xshell), +[xshell](https://github.com/matklad/xshell) ``` Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/LICENSE-2.0 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -727,7 +745,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -827,6 +845,37 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: bitvec, wyz + +The following text applies to code linked from these dependencies: +[bitvec](https://github.com/myrrlyn/bitvec), +[wyz](https://github.com/myrrlyn/wyz) + +``` +MIT License + +Copyright (c) 2018 myrrlyn (Alexander Payne) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: bytes @@ -924,6 +973,36 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: funty + +The following text applies to code linked from these dependencies: +[funty](https://github.com/myrrlyn/funty) + +``` +MIT License + +Copyright (c) 2020 myrrlyn (Alexander Payne) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: generic-array @@ -1047,6 +1126,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: miniz_oxide + +The following text applies to code linked from these dependencies: +[miniz_oxide](https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide) + +``` +MIT License + +Copyright (c) 2017 Frommi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: nom @@ -1110,6 +1219,36 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: radium + +The following text applies to code linked from these dependencies: +[radium](https://github.com/mystor/radium) + +``` +MIT License + +Copyright (c) 2019 kneecaw (Nika Layzell) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: strsim @@ -1142,6 +1281,36 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: tap + +The following text applies to code linked from these dependencies: +[tap](https://github.com/myrrlyn/tap) + +``` +MIT License + +Copyright (c) 2017 Elliot Linder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: textwrap @@ -1197,6 +1366,96 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABI CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: whatsys + +The following text applies to code linked from these dependencies: +[whatsys](https://github.com/badboy/whatsys) + +``` +The MIT License (MIT) + +Copyright (c) 2021 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +``` +------------- +## MIT License: winapi-util + +The following text applies to code linked from these dependencies: +[winapi-util](https://github.com/BurntSushi/winapi-util) + +``` +The MIT License (MIT) + +Copyright (c) 2017 Andrew Gallant + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +``` +------------- +## MIT License: xshell-venv + +The following text applies to code linked from these dependencies: +[xshell-venv](https://github.com/badboy/xshell-venv) + +``` +The MIT License (MIT) + +Copyright (c) 2022 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## CC0-1.0 License: base16 diff --git a/megazords/full/android/dependency-licenses.xml b/megazords/full/android/dependency-licenses.xml index 7a6d24a193..327d4f5634 100644 --- a/megazords/full/android/dependency-licenses.xml +++ b/megazords/full/android/dependency-licenses.xml @@ -40,14 +40,38 @@ the details of which are reproduced below. Mozilla Public License 2.0: uniffi_build https://github.com/mozilla/uniffi-rs/blob/main/LICENSE + + Mozilla Public License 2.0: uniffi_build + https://github.com/mozilla/uniffi-rs/blob/main/LICENSE + + + Mozilla Public License 2.0: uniffi_macros + https://github.com/mozilla/uniffi-rs/blob/main/LICENSE + Mozilla Public License 2.0: uniffi_macros https://github.com/mozilla/uniffi-rs/blob/main/LICENSE + + Mozilla Public License 2.0: zeitstempel + https://github.com/badboy/zeitstempel/blob/main/LICENSE + + + Apache License 2.0: adler + https://github.com/jonas-schievink/adler/blob/master/LICENSE-APACHE + Apache License 2.0: ahash https://github.com/tkaitchuck/ahash/blob/master/LICENSE-APACHE + + Apache License 2.0: android_log-sys + https://github.com/nercury/android_log-sys-rs/blob/master/LICENSE-APACHE + + + Apache License 2.0: android_logger + https://github.com/Nercury/android_logger-rs/blob/master/LICENSE-APACHE + Apache License 2.0: anyhow https://github.com/dtolnay/anyhow/blob/master/LICENSE-APACHE @@ -128,6 +152,18 @@ the details of which are reproduced below. Apache License 2.0: cpufeatures https://github.com/RustCrypto/utils/blob/master/cpufeatures/LICENSE-APACHE + + Apache License 2.0: crc32fast + https://github.com/srijs/rust-crc32fast/blob/master/LICENSE-APACHE + + + Apache License 2.0: crossbeam-channel + https://github.com/crossbeam-rs/crossbeam/blob/master/LICENSE-APACHE + + + Apache License 2.0: crossbeam-utils + https://github.com/crossbeam-rs/crossbeam/blob/master/LICENSE-APACHE + Apache License 2.0: digest https://github.com/RustCrypto/traits/blob/master/digest/LICENSE-APACHE @@ -140,6 +176,10 @@ the details of which are reproduced below. Apache License 2.0: either https://github.com/bluss/either/blob/master/LICENSE-APACHE + + Apache License 2.0: env_logger + https://github.com/env-logger-rs/env_logger/blob//main/LICENSE-APACHE + Apache License 2.0: fallible-iterator https://github.com/sfackler/rust-fallible-iterator/blob/master/LICENSE-APACHE @@ -156,6 +196,10 @@ the details of which are reproduced below. Apache License 2.0: ffi-support https://raw.githubusercontent.com/mozilla/ffi-support/main/LICENSE-APACHE + + Apache License 2.0: flate2 + https://github.com/rust-lang/flate2-rs/blob/main/LICENSE-APACHE + Apache License 2.0: form_urlencoded https://github.com/servo/rust-url/blob/master/LICENSE-APACHE @@ -192,6 +236,10 @@ the details of which are reproduced below. Apache License 2.0: hex https://github.com/KokaKiwi/rust-hex/blob/main/LICENSE-APACHE + + Apache License 2.0: humantime + https://github.com/tailhook/humantime/blob/master/LICENSE-APACHE + Apache License 2.0: id-arena https://github.com/fitzgen/id-arena/blob/master/LICENSE-APACHE @@ -204,6 +252,10 @@ the details of which are reproduced below. Apache License 2.0: indexmap https://github.com/bluss/indexmap/blob/master/LICENSE-APACHE + + Apache License 2.0: inherent + https://github.com/dtolnay/inherent/blob/master/LICENSE-APACHE + Apache License 2.0: itertools https://github.com/rust-itertools/itertools/blob/master/LICENSE-APACHE @@ -288,10 +340,6 @@ the details of which are reproduced below. Apache License 2.0: percent-encoding https://github.com/servo/rust-url/blob//master/LICENSE-APACHE - - Apache License 2.0: pest - https://github.com/pest-parser/pest/blob/master/LICENSE-APACHE - Apache License 2.0: pkg-config https://github.com/rust-lang/pkg-config-rs/blob/master/LICENSE-APACHE @@ -362,11 +410,7 @@ the details of which are reproduced below. Apache License 2.0: semver - https://github.com/steveklabnik/semver/blob/master/LICENSE-APACHE - - - Apache License 2.0: semver-parser - https://github.com/steveklabnik/semver-parser/blob/master/LICENSE-APACHE + https://github.com/dtolnay/semver/blob/master/LICENSE-APACHE Apache License 2.0: serde @@ -432,10 +476,6 @@ the details of which are reproduced below. Apache License 2.0: typenum https://github.com/paholg/typenum/blob/main/LICENSE-APACHE - - Apache License 2.0: ucd-trie - https://github.com/BurntSushi/ucd-generate/blob/master/LICENSE-APACHE - Apache License 2.0: unicase https://github.com/seanmonstar/unicase/blob/master/LICENSE-APACHE @@ -492,6 +532,14 @@ the details of which are reproduced below. Apache License 2.0: windows_x86_64_msvc https://github.com/microsoft/windows-rs/blob/master/license-mit + + Apache License 2.0: xshell + https://github.com/matklad/xshell/blob/master/LICENSE-APACHE + + + Apache License 2.0: xshell-macros + https://github.com/matklad/xshell/blob/master/LICENSE-APACHE + MIT License: aho-corasick https://github.com/BurntSushi/aho-corasick/blob/master/LICENSE-MIT @@ -516,6 +564,14 @@ the details of which are reproduced below. MIT License: bincode https://github.com/servo/bincode/blob/master/LICENSE.md + + MIT License: bitvec + https://github.com/bitvecto-rs/bitvec/blob/develop/LICENSE.txt + + + MIT License: wyz + https://github.com/myrrlyn/wyz/blob/main/LICENSE.txt + MIT License: bytes https://github.com/tokio-rs/bytes/blob/master/LICENSE @@ -528,6 +584,10 @@ the details of which are reproduced below. MIT License: caseless https://github.com/SimonSapin/rust-caseless/blob/master/LICENSE + + MIT License: funty + https://github.com/myrrlyn/funty/blob/master/LICENSE.txt + MIT License: generic-array https://github.com/fizyk20/generic-array/blob/master/LICENSE @@ -548,6 +608,10 @@ the details of which are reproduced below. MIT License: mime_guess https://github.com/abonander/mime_guess/blob/master/LICENSE + + MIT License: miniz_oxide + https://github.com/Frommi/miniz_oxide/blob/master/miniz_oxide/LICENSE-MIT.md + MIT License: nom https://github.com/Geal/nom/blob/main/LICENSE @@ -560,10 +624,18 @@ the details of which are reproduced below. MIT License: ordered-float https://github.com/reem/rust-ordered-float/blob/master/LICENSE-MIT + + MIT License: radium + https://github.com/bitvecto-rs/radium/blob/master/LICENSE.txt + MIT License: strsim https://github.com/dguo/strsim-rs/blob/master/LICENSE + + MIT License: tap + https://github.com/myrrlyn/tap/blob/main/LICENSE.txt + MIT License: textwrap https://github.com/mgeisler/textwrap/blob/master/LICENSE @@ -572,6 +644,18 @@ the details of which are reproduced below. MIT License: weedle2 https://github.com/mozilla/uniffi-rs/blob/main/weedle2/LICENSE.md + + MIT License: whatsys + https://github.com/badboy/whatsys/blob/main/LICENSE + + + MIT License: winapi-util + https://github.com/BurntSushi/winapi-util/blob/master/LICENSE-MIT + + + MIT License: xshell-venv + https://github.com/badboy/xshell-venv/blob/main/LICENSE + CC0-1.0 License: base16 https://github.com/thomcc/rust-base16/blob/master/LICENSE-CC0 diff --git a/megazords/ios-rust/Cargo.toml b/megazords/ios-rust/Cargo.toml index d53cb79318..472c2bca0c 100644 --- a/megazords/ios-rust/Cargo.toml +++ b/megazords/ios-rust/Cargo.toml @@ -20,4 +20,5 @@ autofill = { path = "../../components/autofill" } push = { path = "../../components/push" } tabs = { path = "../../components/tabs" } places = {path = "../../components/places" } +glean-core = { path = "../../components/external/glean/glean-core" } sync15 = {path = "../../components/sync15"} diff --git a/megazords/ios-rust/DEPENDENCIES.md b/megazords/ios-rust/DEPENDENCIES.md index 93803a74ed..dff764ad7d 100644 --- a/megazords/ios-rust/DEPENDENCIES.md +++ b/megazords/ios-rust/DEPENDENCIES.md @@ -10,9 +10,12 @@ the details of which are reproduced below. * [MIT License: aho-corasick, byteorder, memchr, termcolor](#mit-license-aho-corasick-byteorder-memchr-termcolor) * [MIT License: atty](#mit-license-atty) * [MIT License: bincode](#mit-license-bincode) +* [MIT License: bitvec, wyz](#mit-license-bitvec-wyz) * [MIT License: bytes](#mit-license-bytes) * [MIT License: cargo_metadata](#mit-license-cargo_metadata) * [MIT License: caseless](#mit-license-caseless) +* [MIT License: dashmap](#mit-license-dashmap) +* [MIT License: funty](#mit-license-funty) * [MIT License: generic-array](#mit-license-generic-array) * [MIT License: h2](#mit-license-h2) * [MIT License: http-body](#mit-license-http-body) @@ -20,11 +23,15 @@ the details of which are reproduced below. * [MIT License: libsqlite3-sys, rusqlite](#mit-license-libsqlite3-sys-rusqlite) * [MIT License: matches](#mit-license-matches) * [MIT License: mime_guess](#mit-license-mime_guess) +* [MIT License: miniz_oxide](#mit-license-miniz_oxide) * [MIT License: mio](#mit-license-mio) * [MIT License: nom](#mit-license-nom) * [MIT License: ordered-float](#mit-license-ordered-float) +* [MIT License: oslog](#mit-license-oslog) +* [MIT License: radium](#mit-license-radium) * [MIT License: slab](#mit-license-slab) * [MIT License: strsim](#mit-license-strsim) +* [MIT License: tap](#mit-license-tap) * [MIT License: textwrap](#mit-license-textwrap) * [MIT License: tokio, tokio-util](#mit-license-tokio-tokio-util) * [MIT License: tokio-native-tls, tracing, tracing-core](#mit-license-tokio-native-tls-tracing-tracing-core) @@ -32,6 +39,8 @@ the details of which are reproduced below. * [MIT License: try-lock](#mit-license-try-lock) * [MIT License: want](#mit-license-want) * [MIT License: weedle2](#mit-license-weedle2) +* [MIT License: whatsys](#mit-license-whatsys) +* [MIT License: xshell-venv](#mit-license-xshell-venv) * [CC0-1.0 License: base16](#cc0-10-license-base16) * [ISC License: ring](#isc-license-ring) * [BSD-2-Clause License: arrayref](#bsd-2-clause-license-arrayref) @@ -51,7 +60,8 @@ The following text applies to code linked from these dependencies: [uniffi](https://github.com/mozilla/uniffi-rs), [uniffi_bindgen](https://github.com/mozilla/uniffi-rs), [uniffi_build](https://github.com/mozilla/uniffi-rs), -[uniffi_macros](https://github.com/mozilla/uniffi-rs) +[uniffi_macros](https://github.com/mozilla/uniffi-rs), +[zeitstempel](https://github.com/badboy/zeitstempel) ``` Mozilla Public License Version 2.0 @@ -433,6 +443,7 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice ## Apache License 2.0 The following text applies to code linked from these dependencies: +[adler](https://github.com/jonas-schievink/adler.git), [ahash](https://github.com/tkaitchuck/ahash), [anyhow](https://github.com/dtolnay/anyhow), [askama](https://github.com/djc/askama), @@ -454,13 +465,18 @@ The following text applies to code linked from these dependencies: [core-foundation-sys](https://github.com/servo/core-foundation-rs), [core-foundation](https://github.com/servo/core-foundation-rs), [cpufeatures](https://github.com/RustCrypto/utils), +[crc32fast](https://github.com/srijs/rust-crc32fast), +[crossbeam-channel](https://github.com/crossbeam-rs/crossbeam), +[crossbeam-utils](https://github.com/crossbeam-rs/crossbeam), [digest](https://github.com/RustCrypto/traits), [dogear](https://github.com/mozilla/dogear), [either](https://github.com/bluss/either), +[env_logger](https://github.com/env-logger-rs/env_logger/), [fallible-iterator](https://github.com/sfackler/rust-fallible-iterator), [fallible-streaming-iterator](https://github.com/sfackler/fallible-streaming-iterator), [fastrand](https://github.com/smol-rs/fastrand), [ffi-support](https://github.com/mozilla/ffi-support), +[flate2](https://github.com/rust-lang/flate2-rs), [fnv](https://github.com/servo/rust-fnv), [form_urlencoded](https://github.com/servo/rust-url), [fs-err](https://github.com/andrewhickman/fs-err), @@ -479,10 +495,12 @@ The following text applies to code linked from these dependencies: [http](https://github.com/hyperium/http), [httparse](https://github.com/seanmonstar/httparse), [httpdate](https://github.com/pyfisch/httpdate), +[humantime](https://github.com/tailhook/humantime), [hyper-tls](https://github.com/hyperium/hyper-tls), [id-arena](https://github.com/fitzgen/id-arena), [idna](https://github.com/servo/rust-url/), [indexmap](https://github.com/bluss/indexmap), +[inherent](https://github.com/dtolnay/inherent), [ipnet](https://github.com/krisprice/ipnet), [itertools](https://github.com/rust-itertools/itertools), [itoa](https://github.com/dtolnay/itoa), @@ -506,7 +524,6 @@ The following text applies to code linked from these dependencies: [parking_lot_core](https://github.com/Amanieu/parking_lot), [paste](https://github.com/dtolnay/paste), [percent-encoding](https://github.com/servo/rust-url/), -[pest](https://github.com/pest-parser/pest), [pin-project-lite](https://github.com/taiki-e/pin-project-lite), [pin-utils](https://github.com/rust-lang-nursery/pin-utils), [pkg-config](https://github.com/rust-lang/pkg-config-rs), @@ -529,8 +546,7 @@ The following text applies to code linked from these dependencies: [scopeguard](https://github.com/bluss/scopeguard), [security-framework-sys](https://github.com/kornelski/rust-security-framework), [security-framework](https://github.com/kornelski/rust-security-framework), -[semver-parser](https://github.com/steveklabnik/semver-parser), -[semver](https://github.com/steveklabnik/semver), +[semver](https://github.com/dtolnay/semver), [serde](https://github.com/serde-rs/serde), [serde_derive](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), @@ -549,7 +565,6 @@ The following text applies to code linked from these dependencies: [tinyvec_macros](https://github.com/Soveu/tinyvec_macros), [toml](https://github.com/alexcrichton/toml-rs), [typenum](https://github.com/paholg/typenum), -[ucd-trie](https://github.com/BurntSushi/ucd-generate), [unicase](https://github.com/seanmonstar/unicase), [unicode-bidi](https://github.com/servo/unicode-bidi), [unicode-ident](https://github.com/dtolnay/unicode-ident), @@ -558,12 +573,14 @@ The following text applies to code linked from these dependencies: [url](https://github.com/servo/rust-url), [uuid](https://github.com/uuid-rs/uuid), [vcpkg](https://github.com/mcgoo/vcpkg-rs), -[version_check](https://github.com/SergioBenitez/version_check) +[version_check](https://github.com/SergioBenitez/version_check), +[xshell-macros](https://github.com/matklad/xshell), +[xshell](https://github.com/matklad/xshell) ``` Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/LICENSE-2.0 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -755,7 +772,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -886,6 +903,37 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: bitvec, wyz + +The following text applies to code linked from these dependencies: +[bitvec](https://github.com/myrrlyn/bitvec), +[wyz](https://github.com/myrrlyn/wyz) + +``` +MIT License + +Copyright (c) 2018 myrrlyn (Alexander Payne) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: bytes @@ -983,6 +1031,66 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: dashmap + +The following text applies to code linked from these dependencies: +[dashmap](https://github.com/xacrimon/dashmap) + +``` +MIT License + +Copyright (c) 2019 Acrimon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +``` +------------- +## MIT License: funty + +The following text applies to code linked from these dependencies: +[funty](https://github.com/myrrlyn/funty) + +``` +MIT License + +Copyright (c) 2020 myrrlyn (Alexander Payne) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: generic-array @@ -1202,6 +1310,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: miniz_oxide + +The following text applies to code linked from these dependencies: +[miniz_oxide](https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide) + +``` +MIT License + +Copyright (c) 2017 Frommi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: mio @@ -1293,6 +1431,66 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: oslog + +The following text applies to code linked from these dependencies: +[oslog](https://github.com/steven-joruk/oslog) + +``` +MIT License + +Copyright (c) 2020 Steven Joruk + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +``` +------------- +## MIT License: radium + +The following text applies to code linked from these dependencies: +[radium](https://github.com/mystor/radium) + +``` +MIT License + +Copyright (c) 2019 kneecaw (Nika Layzell) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: slab @@ -1359,6 +1557,36 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: tap + +The following text applies to code linked from these dependencies: +[tap](https://github.com/myrrlyn/tap) + +``` +MIT License + +Copyright (c) 2017 Elliot Linder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: textwrap @@ -1578,6 +1806,66 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABI CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: whatsys + +The following text applies to code linked from these dependencies: +[whatsys](https://github.com/badboy/whatsys) + +``` +The MIT License (MIT) + +Copyright (c) 2021 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +``` +------------- +## MIT License: xshell-venv + +The following text applies to code linked from these dependencies: +[xshell-venv](https://github.com/badboy/xshell-venv) + +``` +The MIT License (MIT) + +Copyright (c) 2022 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## CC0-1.0 License: base16 diff --git a/megazords/ios-rust/MozillaRustComponents.h b/megazords/ios-rust/MozillaRustComponents.h index 8b75e39601..bd2be0d9d1 100644 --- a/megazords/ios-rust/MozillaRustComponents.h +++ b/megazords/ios-rust/MozillaRustComponents.h @@ -10,6 +10,7 @@ #import "autofillFFI.h" #import "crashtestFFI.h" #import "fxa_clientFFI.h" +#import "gleanFFI.h" #import "loginsFFI.h" #import "nimbusFFI.h" #import "placesFFI.h" diff --git a/megazords/ios-rust/MozillaTestServices/MozillaTestServices.xcodeproj/project.pbxproj b/megazords/ios-rust/MozillaTestServices/MozillaTestServices.xcodeproj/project.pbxproj index a86925aa9f..1f65f23352 100644 --- a/megazords/ios-rust/MozillaTestServices/MozillaTestServices.xcodeproj/project.pbxproj +++ b/megazords/ios-rust/MozillaTestServices/MozillaTestServices.xcodeproj/project.pbxproj @@ -35,7 +35,6 @@ 1B5CB50E27B202B600C31B56 /* MozillaRustComponents.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B5CB50D27B202B600C31B56 /* MozillaRustComponents.xcframework */; }; 1BB64C7A27B1FA0400A4247F /* GleanPlumbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BBAC54227AE065300DAFEF2 /* GleanPlumbTests.swift */; }; 1BBAC4FC27AE049500DAFEF2 /* MozillaTestServicesApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BBAC4FB27AE049500DAFEF2 /* MozillaTestServicesApp.swift */; }; - 1BBAC55127AE06FD00DAFEF2 /* Glean in Frameworks */ = {isa = PBXBuildFile; productRef = 1BBAC55027AE06FD00DAFEF2 /* Glean */; }; 1BBAC59C27AE0BB600DAFEF2 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BBAC4FD27AE049500DAFEF2 /* ContentView.swift */; }; 1BE9B60D27C9CD770029D11A /* crashtest.udl in Sources */ = {isa = PBXBuildFile; fileRef = 1B3BC99127B1DAA300229CF6 /* crashtest.udl */; }; 1BE9B60E27C9CD770029D11A /* nimbus.udl in Sources */ = {isa = PBXBuildFile; fileRef = 1B3BC98E27B1D9D600229CF6 /* nimbus.udl */; }; @@ -57,7 +56,6 @@ 1BF50F1827B1E18000A9C8A5 /* KeychainWrapperSubscript.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BBAC56527AE085F00DAFEF2 /* KeychainWrapperSubscript.swift */; }; 1BF50F1927B1E19500A9C8A5 /* FxAccountManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BBAC54127AE065300DAFEF2 /* FxAccountManagerTests.swift */; }; 1BF50F1A27B1E19800A9C8A5 /* FxAccountMocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BBAC53C27AE065300DAFEF2 /* FxAccountMocks.swift */; }; - 1BFC469827C99F250034E0A5 /* Metrics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFC469627C99F250034E0A5 /* Metrics.swift */; }; /* End PBXBuildFile section */ /* Begin PBXBuildRule section */ @@ -164,7 +162,6 @@ 1BF50F1C27B1E1DF00A9C8A5 /* fxa_clientFFI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fxa_clientFFI.h; path = "../../../components/fxa-client/ios/Generated/fxa_clientFFI.h"; sourceTree = SOURCE_ROOT; }; 1BF50F1D27B1E1DF00A9C8A5 /* fxa_client.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = fxa_client.swift; path = "../../../components/fxa-client/ios/Generated/fxa_client.swift"; sourceTree = SOURCE_ROOT; }; 1BF50F2327B1E53E00A9C8A5 /* metrics.yaml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.yaml; name = metrics.yaml; path = ../../../components/nimbus/metrics.yaml; sourceTree = SOURCE_ROOT; }; - 1BF50F2B27B1EB7D00A9C8A5 /* sdk_generator.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = sdk_generator.sh; path = "../../../../../components/external/glean/glean-core/ios/sdk_generator.sh"; sourceTree = SOURCE_ROOT; }; 1BFC469627C99F250034E0A5 /* Metrics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Metrics.swift; path = MozillaTestServices/Generated/Metrics.swift; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -174,7 +171,6 @@ buildActionMask = 2147483647; files = ( 1B5CB50E27B202B600C31B56 /* MozillaRustComponents.xcframework in Frameworks */, - 1BBAC55127AE06FD00DAFEF2 /* Glean in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -264,7 +260,6 @@ children = ( 1BFC469427C99F250034E0A5 /* Generated */, 1BB64C7B27B1FF9F00A4247F /* TestClient */, - 1BF50F0327B1DFC900A9C8A5 /* Glean */, 1B3BC99027B1DA8700229CF6 /* Crashtest */, 1B3BC97427B1D99A00229CF6 /* Nimbus */, 1BBAC5A427AE0EF900DAFEF2 /* Places */, @@ -416,14 +411,6 @@ path = ../../../components/logins/ios/Generated; sourceTree = SOURCE_ROOT; }; - 1BF50F0327B1DFC900A9C8A5 /* Glean */ = { - isa = PBXGroup; - children = ( - 1BF50F2B27B1EB7D00A9C8A5 /* sdk_generator.sh */, - ); - path = Glean; - sourceTree = ""; - }; 1BF50F0527B1E06700A9C8A5 /* Generated */ = { isa = PBXGroup; children = ( @@ -473,7 +460,6 @@ ); name = MozillaTestServices; packageProductDependencies = ( - 1BBAC55027AE06FD00DAFEF2 /* Glean */, ); productName = MozillaTestServices; productReference = 1BBAC4F827AE049500DAFEF2 /* MozillaTestServices.app */; @@ -528,7 +514,6 @@ ); mainGroup = 1BBAC4EF27AE049500DAFEF2; packageReferences = ( - 1BBAC54F27AE06FD00DAFEF2 /* XCRemoteSwiftPackageReference "glean-swift" */, ); productRefGroup = 1BBAC4F927AE049500DAFEF2 /* Products */; projectDirPath = ""; @@ -566,17 +551,15 @@ inputFileListPaths = ( ); inputPaths = ( - "$(SRCROOT)/../../../components/nimbus/metrics.yaml", ); name = "Generate Glean Metrics"; outputFileListPaths = ( ); outputPaths = ( - "$(SRCROOT)/MozillaTestServices/Generated/Metrics.swift", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "rm -rf .venv; bash $PWD/../../../components/external/glean/glean-core/ios/sdk_generator.sh -g Glean\n"; + shellScript = "rm -rf .venv; bash $PWD/../../../components/external/glean/glean-core/ios/sdk_generator.sh -g MozillaRustComponents\n\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -590,7 +573,6 @@ 1BE9B60F27C9CD770029D11A /* places.udl in Sources */, 1BE9B61027C9CD770029D11A /* logins.udl in Sources */, 1BE9B61127C9CD770029D11A /* fxa_client.udl in Sources */, - 1BFC469827C99F250034E0A5 /* Metrics.swift in Sources */, 1B3BC98627B1D9B800229CF6 /* FeatureVariables.swift in Sources */, 1BBAC59C27AE0BB600DAFEF2 /* ContentView.swift in Sources */, 1B3BC98B27B1D9B800229CF6 /* Sysctl.swift in Sources */, @@ -907,25 +889,6 @@ defaultConfigurationName = Debug; }; /* End XCConfigurationList section */ - -/* Begin XCRemoteSwiftPackageReference section */ - 1BBAC54F27AE06FD00DAFEF2 /* XCRemoteSwiftPackageReference "glean-swift" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/mozilla/glean-swift"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 51.0.1; - }; - }; -/* End XCRemoteSwiftPackageReference section */ - -/* Begin XCSwiftPackageProductDependency section */ - 1BBAC55027AE06FD00DAFEF2 /* Glean */ = { - isa = XCSwiftPackageProductDependency; - package = 1BBAC54F27AE06FD00DAFEF2 /* XCRemoteSwiftPackageReference "glean-swift" */; - productName = Glean; - }; -/* End XCSwiftPackageProductDependency section */ }; rootObject = 1BBAC4F027AE049500DAFEF2 /* Project object */; } diff --git a/megazords/ios-rust/MozillaTestServices/MozillaTestServicesTests/LoginsTests.swift b/megazords/ios-rust/MozillaTestServices/MozillaTestServicesTests/LoginsTests.swift index 1e1afbcf2b..1c1547de0c 100644 --- a/megazords/ios-rust/MozillaTestServices/MozillaTestServicesTests/LoginsTests.swift +++ b/megazords/ios-rust/MozillaTestServices/MozillaTestServicesTests/LoginsTests.swift @@ -4,7 +4,6 @@ @testable import MozillaTestServices -import Glean import XCTest class LoginsTests: XCTestCase { @@ -12,7 +11,6 @@ class LoginsTests: XCTestCase { override func setUp() { super.setUp() - Glean.shared.resetGlean(clearStores: true) } override func tearDown() { diff --git a/megazords/ios-rust/MozillaTestServices/MozillaTestServicesTests/NimbusTests.swift b/megazords/ios-rust/MozillaTestServices/MozillaTestServicesTests/NimbusTests.swift index 7c5aff5713..8e20ea8c15 100644 --- a/megazords/ios-rust/MozillaTestServices/MozillaTestServicesTests/NimbusTests.swift +++ b/megazords/ios-rust/MozillaTestServices/MozillaTestServicesTests/NimbusTests.swift @@ -4,35 +4,10 @@ @testable import MozillaTestServices -import Glean import UIKit import XCTest class NimbusTests: XCTestCase { - override func setUp() { - Glean.shared.resetGlean(clearStores: true) - Glean.shared.enableTestingMode() - let buildDate = DateComponents( - calendar: Calendar.current, - timeZone: TimeZone(abbreviation: "UTC"), - year: 2019, - month: 10, - day: 23, - hour: 12, - minute: 52, - second: 8 - ) - let buildInfo = BuildInfo(buildDate: buildDate) - Glean.shared.initialize( - uploadEnabled: true, - configuration: Configuration( - channel: "test", - serverEndpoint: "https://example.com" - ), - buildInfo: buildInfo - ) - } - func emptyExperimentJSON() -> String { return """ { "data": [] } @@ -183,198 +158,6 @@ class NimbusTests: XCTestCase { XCTAssertEqual(appContext.deviceModel, "x86_64") } } - - func testRecordExperimentTelemetry() throws { - let appSettings = NimbusAppSettings(appName: "NimbusUnitTest", channel: "test") - let nimbus = try Nimbus.create(nil, appSettings: appSettings, dbPath: createDatabasePath()) as! Nimbus - - let enrolledExperiments = [EnrolledExperiment( - featureIds: [], - slug: "test-experiment", - userFacingName: "Test Experiment", - userFacingDescription: "A test experiment for testing experiments", - branchSlug: "test-branch", - enrollmentId: "enrollment-id" - )] - - nimbus.recordExperimentTelemetry(enrolledExperiments) - XCTAssertTrue(Glean.shared.testIsExperimentActive("test-experiment"), - "Experiment should be active") - // TODO: Below fails due to branch and extra being private members Glean - // We will need to change this if we want to remove glean as a submodule and instead - // consume it as a swift package https://github.com/mozilla/application-services/issues/4864 - - // let experimentData = Glean.shared.testGetExperimentData(experimentId: "test-experiment")! - // XCTAssertEqual("test-branch", experimentData.branch, "Experiment branch must match") - // XCTAssertEqual("enrollment-id", experimentData.extra["enrollmentId"], "Enrollment id must match") - } - - func testRecordExperimentEvents() throws { - let appSettings = NimbusAppSettings(appName: "NimbusUnitTest", channel: "test") - let nimbus = try Nimbus.create(nil, appSettings: appSettings, dbPath: createDatabasePath()) as! Nimbus - - // Create a list of events to record, one of each type, all associated with the same - // experiment - let events = [ - EnrollmentChangeEvent( - experimentSlug: "test-experiment", - branchSlug: "test-branch", - enrollmentId: "test-enrollment-id", - reason: "test-reason", - change: .enrollment - ), - EnrollmentChangeEvent( - experimentSlug: "test-experiment", - branchSlug: "test-branch", - enrollmentId: "test-enrollment-id", - reason: "test-reason", - change: .unenrollment - ), - EnrollmentChangeEvent( - experimentSlug: "test-experiment", - branchSlug: "test-branch", - enrollmentId: "test-enrollment-id", - reason: "test-reason", - change: .disqualification - ), - ] - - // Record the experiment events in Glean - nimbus.recordExperimentEvents(events) - - // Use the Glean test API to check the recorded events - - // Enrollment - XCTAssertNotNil(GleanMetrics.NimbusEvents.enrollment.testGetValue(), "Enrollment event must exist") - let enrollmentEvents = GleanMetrics.NimbusEvents.enrollment.testGetValue()! - XCTAssertEqual(1, enrollmentEvents.count, "Enrollment event count must match") - let enrollmentEventExtras = enrollmentEvents.first!.extra - XCTAssertEqual("test-experiment", enrollmentEventExtras!["experiment"], "Enrollment event experiment must match") - XCTAssertEqual("test-branch", enrollmentEventExtras!["branch"], "Enrollment event branch must match") - XCTAssertEqual("test-enrollment-id", enrollmentEventExtras!["enrollment_id"], "Enrollment event enrollment id must match") - - // Unenrollment - XCTAssertNotNil(GleanMetrics.NimbusEvents.unenrollment.testGetValue(), "Unenrollment event must exist") - let unenrollmentEvents = GleanMetrics.NimbusEvents.unenrollment.testGetValue()! - XCTAssertEqual(1, unenrollmentEvents.count, "Unenrollment event count must match") - let unenrollmentEventExtras = unenrollmentEvents.first!.extra - XCTAssertEqual("test-experiment", unenrollmentEventExtras!["experiment"], "Unenrollment event experiment must match") - XCTAssertEqual("test-branch", unenrollmentEventExtras!["branch"], "Unenrollment event branch must match") - XCTAssertEqual("test-enrollment-id", unenrollmentEventExtras!["enrollment_id"], "Unenrollment event enrollment id must match") - - // Disqualification - XCTAssertNotNil(GleanMetrics.NimbusEvents.disqualification.testGetValue(), "Disqualification event must exist") - let disqualificationEvents = GleanMetrics.NimbusEvents.disqualification.testGetValue()! - XCTAssertEqual(1, disqualificationEvents.count, "Disqualification event count must match") - let disqualificationEventExtras = disqualificationEvents.first!.extra - XCTAssertEqual("test-experiment", disqualificationEventExtras!["experiment"], "Disqualification event experiment must match") - XCTAssertEqual("test-branch", disqualificationEventExtras!["branch"], "Disqualification event branch must match") - XCTAssertEqual("test-enrollment-id", disqualificationEventExtras!["enrollment_id"], "Disqualification event enrollment id must match") - } - - func testRecordExposure() throws { - let appSettings = NimbusAppSettings(appName: "NimbusUnitTest", channel: "test") - let nimbus = try Nimbus.create(nil, appSettings: appSettings, dbPath: createDatabasePath()) as! Nimbus - - // Load an experiment in nimbus that we will record an event in. The experiment bucket configuration - // is set so that it will be guaranteed to be active. This is necessary because the SDK checks for - // active experiments before recording. - try nimbus.setExperimentsLocallyOnThisThread(minimalExperimentJSON()) - try nimbus.applyPendingExperimentsOnThisThread() - - // Assert that there are no events to start with - XCTAssertNil(GleanMetrics.NimbusEvents.exposure.testGetValue(), "Event must not have a value") - - // Record a valid exposure event in Glean that matches the featureId from the test experiment - nimbus.recordExposureEvent(featureId: "aboutwelcome") - - // Use the Glean test API to check that the valid event is present - XCTAssertNotNil(GleanMetrics.NimbusEvents.exposure.testGetValue(), "Event must have a value") - let enrollmentEvents = GleanMetrics.NimbusEvents.exposure.testGetValue()! - XCTAssertEqual(1, enrollmentEvents.count, "Event count must match") - let enrollmentEventExtras = enrollmentEvents.first!.extra - XCTAssertEqual("secure-gold", enrollmentEventExtras!["experiment"], "Experiment slug must match") - XCTAssertTrue( - enrollmentEventExtras!["branch"] == "control" || enrollmentEventExtras!["branch"] == "treatment", - "Experiment branch must match" - ) - XCTAssertNotNil(enrollmentEventExtras!["enrollment_id"], "Experiment enrollment id must not be nil") - - // Attempt to record an event for a non-existent or feature we are not enrolled in an - // experiment in to ensure nothing is recorded. - nimbus.recordExposureEvent(featureId: "not-a-feature") - - // Verify the invalid event was ignored by checking again that the valid event is still the only - // event, and that it hasn't changed any of its extra properties. - let enrollmentEventsTryTwo = GleanMetrics.NimbusEvents.exposure.testGetValue()! - XCTAssertEqual(1, enrollmentEventsTryTwo.count, "Event count must match") - let enrollmentEventExtrasTryTwo = enrollmentEventsTryTwo.first!.extra - XCTAssertEqual("secure-gold", enrollmentEventExtrasTryTwo!["experiment"], "Experiment slug must match") - XCTAssertTrue( - enrollmentEventExtrasTryTwo!["branch"] == "control" || enrollmentEventExtrasTryTwo!["branch"] == "treatment", - "Experiment branch must match" - ) - XCTAssertNotNil(enrollmentEventExtrasTryTwo!["enrollment_id"], "Experiment enrollment id must not be nil") - } - - func testRecordDisqualificationOnOptOut() throws { - let appSettings = NimbusAppSettings(appName: "NimbusUnitTest", channel: "test") - let nimbus = try Nimbus.create(nil, appSettings: appSettings, dbPath: createDatabasePath()) as! Nimbus - - // Load an experiment in nimbus that we will record an event in. The experiment bucket configuration - // is set so that it will be guaranteed to be active. This is necessary because the SDK checks for - // active experiments before recording. - try nimbus.setExperimentsLocallyOnThisThread(minimalExperimentJSON()) - try nimbus.applyPendingExperimentsOnThisThread() - - // Assert that there are no events to start with - XCTAssertNil(GleanMetrics.NimbusEvents.exposure.testGetValue(), "Event must not have a value") - - // Opt out of the experiment, which should generate a "disqualification" event - try nimbus.optOutOnThisThread("secure-gold") - - // Use the Glean test API to check that the valid event is present - XCTAssertNotNil(GleanMetrics.NimbusEvents.disqualification.testGetValue(), "Event must have a value") - let disqualificationEvents = GleanMetrics.NimbusEvents.disqualification.testGetValue()! - XCTAssertEqual(1, disqualificationEvents.count, "Event count must match") - let disqualificationEventExtras = disqualificationEvents.first!.extra - XCTAssertEqual("secure-gold", disqualificationEventExtras!["experiment"], "Experiment slug must match") - XCTAssertTrue( - disqualificationEventExtras!["branch"] == "control" || disqualificationEventExtras!["branch"] == "treatment", - "Experiment branch must match" - ) - XCTAssertNotNil(disqualificationEventExtras!["enrollment_id"], "Experiment enrollment id must not be nil") - } - - func testRecordDisqualificationOnGlobalOptOut() throws { - let appSettings = NimbusAppSettings(appName: "NimbusUnitTest", channel: "test") - let nimbus = try Nimbus.create(nil, appSettings: appSettings, dbPath: createDatabasePath()) as! Nimbus - - // Load an experiment in nimbus that we will record an event in. The experiment bucket configuration - // is set so that it will be guaranteed to be active. This is necessary because the SDK checks for - // active experiments before recording. - try nimbus.setExperimentsLocallyOnThisThread(minimalExperimentJSON()) - try nimbus.applyPendingExperimentsOnThisThread() - - // Assert that there are no events to start with - XCTAssertNil(GleanMetrics.NimbusEvents.exposure.testGetValue(), "Event must not have a value") - - // Opt out of all experiments, which should generate a "disqualification" event for the enrolled - // experiment - try nimbus.setGlobalUserParticipationOnThisThread(false) - - // Use the Glean test API to check that the valid event is present - XCTAssertNotNil(GleanMetrics.NimbusEvents.disqualification.testGetValue(), "Event must have a value") - let disqualificationEvents = GleanMetrics.NimbusEvents.disqualification.testGetValue()! - XCTAssertEqual(1, disqualificationEvents.count, "Event count must match") - let disqualificationEventExtras = disqualificationEvents.first!.extra - XCTAssertEqual("secure-gold", disqualificationEventExtras!["experiment"], "Experiment slug must match") - XCTAssertTrue( - disqualificationEventExtras!["branch"] == "control" || disqualificationEventExtras!["branch"] == "treatment", - "Experiment branch must match" - ) - XCTAssertNotNil(disqualificationEventExtras!["enrollment_id"], "Experiment enrollment id must not be nil") - } } private extension Device { diff --git a/megazords/ios-rust/MozillaTestServices/glean.udl b/megazords/ios-rust/MozillaTestServices/glean.udl new file mode 100644 index 0000000000..849c712d05 --- /dev/null +++ b/megazords/ios-rust/MozillaTestServices/glean.udl @@ -0,0 +1,549 @@ +namespace glean { + void glean_enable_logging(); + + // Initialize the logging system to send JSON messages to a file descriptor + // (Unix) or file handle (Windows). + // + // No-op on Android and iOS. Use `glean_enable_logging` instead. + void glean_enable_logging_to_fd(u64 fd); + + // Initializes Glean. + // + // This will fully initialize Glean in a separate thread. + // It will return immediately. + void glean_initialize(InternalConfiguration cfg, ClientInfoMetrics client_info, OnGleanEvents callbacks); + + // Creates and initializes a new Glean object for use in a subprocess. + // + // Importantly, this will not send any pings at startup, since that + // sort of management should only happen in the main process. + // + // Must only be used for an uploader process. + // The general API or any metrics API **will not work**. + boolean glean_initialize_for_subprocess(InternalConfiguration cfg); + + void glean_set_upload_enabled(boolean enabled); + + // Experiment reporting API + void glean_set_experiment_active(string experiment_id, string branch, record extra); + void glean_set_experiment_inactive(string experiment_id); + RecordedExperiment? glean_test_get_experiment_data(string experiment_id); + + boolean glean_set_debug_view_tag(string tag); + boolean glean_set_source_tags(sequence tags); + void glean_set_log_pings(boolean value); + + void glean_handle_client_active(); + void glean_handle_client_inactive(); + + void glean_submit_ping_by_name(string ping_name, optional string? reason = null); + boolean glean_submit_ping_by_name_sync(string ping_name, optional string? reason = null); + + void glean_set_test_mode(boolean enabled); + void glean_test_destroy_glean(boolean clear_stores); + + void glean_set_dirty_flag(boolean flag); + + PingUploadTask glean_get_upload_task(); + void glean_process_ping_upload_response(string uuid, UploadResult result); +}; + +// The Glean configuration. +// +// This exposes all configurable parameters to the SDK side. +// They should not be exposed directly to users of the SDK (except `upload_enabled`). +dictionary InternalConfiguration { + string data_path; + string application_id; + string language_binding_name; + boolean upload_enabled; + u32? max_events; + boolean delay_ping_lifetime_io; + string app_build; + boolean use_core_mps; +}; + +// Values for the `client_info` metrics. +// The language SDK should collect them on `initialize` once. +// They will be re-used, e.g. when upload is toggled from off to on, to re-set them. +// +// See https://mozilla.github.io/glean/book/user/pings/index.html#the-client_info-section for details. +dictionary ClientInfoMetrics { + string app_build; + string app_display_version; + Datetime app_build_date; + string architecture; + string os_version; + + string? channel = null; + string? locale = null; + string? device_manufacturer = null; + string? device_model = null; + string? android_sdk_version = null; +}; + +// A callback object, that is stored within the core logic for the entire lifetime of the application. +// +// This is used to trigger certain actions that need to happen on the foreign-language side. +callback interface OnGleanEvents { + // Initialization finished. + // + // The language SDK can do additional things from within the same initializer thread, + // e.g. starting to observe application events for foreground/background behavior. + // The observer then needs to call the respective client activity API. + void on_initialize_finished(); + + // Trigger the uploader whenever a ping was submitted. + // + // This should not block. + // The uploader needs to asynchronously poll Glean for new pings to upload. + void trigger_upload(); + + // Start the Metrics Ping Scheduler. + // + // *Note*: The implementor + // * DOES NOT need to schedule the uploader. + // * MUST NOT use a dispatched call in the immediate invocation. + // + // Returns whether it submitted a ping immediately. + boolean start_metrics_ping_scheduler(); + + // Called when upload is disabled and uploads should be stopped + void cancel_uploads(); +}; + +// Deserialized experiment data. +dictionary RecordedExperiment { + // The experiment's branch. + string branch; + // Any extra data associated with this experiment. + record? extra; +}; + +// Represents a request to upload a ping. +dictionary PingRequest { + // The Job ID to identify this request, + // this is the same as the ping UUID. + string document_id; + // The path for the server to upload the ping to. + string path; + // The body of the request, as a byte array. + // If gzip encoded, then the `headers` list will + // contain a `Content-Encoding` header with the value `gzip`. + sequence body; + // A map with all the headers to be sent with the request. + record headers; +}; + +// An enum representing the possible upload tasks to be performed by an uploader. +[Enum] +interface PingUploadTask { + // An upload task. + // + // * request: the ping request for upload + Upload(PingRequest request); + // A flag signaling that the pending pings directories are not done being processed, + // thus the requester should wait and come back later. + // + // * time: The time in milliseconds the requester should wait before requesting a new task. + Wait(u64 time); + + // A flag signaling that requester doesn't need to request + // any more upload tasks at this moment. + // + // * unused: _ignored_. + Done(i8 unused); +}; + +// The result of an attempted ping upload. +[Enum] +interface UploadResult { + // A recoverable failure. + // + // During upload something went wrong,/ e.g. the network connection failed. + // The upload should be retried at a later time. + // + // * unused: _ignored_. + RecoverableFailure(i8 unused); + + // An unrecoverable upload failure. + // + // A possible cause might be a malformed URL. + // + // * unused: _ignored_. + UnrecoverableFailure(i8 unused); + + // A HTTP response code. + // + // This can still indicate an error, depending on the status code. + // + // * code: The HTTP status code + HttpStatus(i32 code); +}; + +// The supported metrics' lifetimes. +// +// A metric's lifetime determines when its stored data gets reset. +enum Lifetime { + // The metric is reset with each sent ping + "Ping", + // The metric is reset on application restart + "Application", + // The metric is reset with each user profile + "User", +}; + +// The possible error types for metric recording. +enum ErrorType { + // For when the value to be recorded does not match the metric-specific restrictions + "InvalidValue", + // For when the label of a labeled metric does not match the restrictions + "InvalidLabel", + // For when the metric caught an invalid state while recording + "InvalidState", + // For when the value to be recorded overflows the metric-specific upper range + "InvalidOverflow", +}; + +interface PingType { + constructor(string name, boolean include_client_id, boolean send_if_empty, sequence reason_codes); + void submit(optional string? reason = null); +}; + +// The common set of data shared across all different metric types. +dictionary CommonMetricData { + // The metric's category. + string category; + // The metric's name. + string name; + + // List of ping names to include this metric in. + sequence send_in_pings; + // The metric's lifetime. + Lifetime lifetime; + + // Whether or not the metric is disabled. + // + // Disabled metrics are never recorded. + boolean disabled; + + // Dynamic label. + // + // When a labeled metric factory creates the specific metric to be recorded to, + // dynamic labels are stored in the specific label so that + // we can validate them when the Glean singleton is available. + string? dynamic_label = null; +}; + +interface CounterMetric { + constructor(CommonMetricData meta); + + void add(optional i32 amount = 1); + + i32? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +// Different resolutions supported by the time related metric types +// (e.g. DatetimeMetric). +enum TimeUnit { + // Represents nanosecond precision. + "Nanosecond", + // Represents microsecond precision. + "Microsecond", + // Represents millisecond precision. + "Millisecond", + // Represents second precision. + "Second", + // Represents minute precision. + "Minute", + // Represents hour precision. + "Hour", + // Represents day precision. + "Day", +}; + +interface TimespanMetric { + constructor(CommonMetricData meta, TimeUnit time_unit); + + void start(); + + void stop(); + + void cancel(); + + void set_raw_nanos(i64 elapsed); + + i64? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface BooleanMetric { + constructor(CommonMetricData meta); + + void set(boolean value); + + boolean? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface StringMetric { + constructor(CommonMetricData meta); + + void set(string value); + + string? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface LabeledCounter { + constructor(CommonMetricData meta, sequence? labels); + + CounterMetric get(string label); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface LabeledBoolean { + constructor(CommonMetricData meta, sequence? labels); + + BooleanMetric get(string label); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface LabeledString { + constructor(CommonMetricData meta, sequence? labels); + + StringMetric get(string label); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface StringListMetric { + constructor(CommonMetricData meta); + + void add(string value); + + void set(sequence value); + + sequence? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface UrlMetric { + constructor(CommonMetricData meta); + + void set(string value); + + string? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface UuidMetric { + constructor(CommonMetricData meta); + + void set(string value); + + string generate_and_set(); + + string? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface QuantityMetric { + constructor(CommonMetricData meta); + + void set(i64 value); + + i64? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +// A snapshot of all buckets and the accumulated sum of a distribution. +dictionary DistributionData { + // A map containig the bucket index mapped to the accumulated count. + record values; + + // The accumulated sum of all the samples in the distribution. + i64 sum; +}; + +// Identifier for a running timer. +// +// Its internals are considered private, +// but due to UniFFI's behavior we expose it as a dictionary for now. +dictionary TimerId { + u64 id; +}; + +interface TimingDistributionMetric { + constructor(CommonMetricData meta, TimeUnit time_unit); + + TimerId start(); + + void stop_and_accumulate(TimerId timer_id); + + void cancel(TimerId timer_id); + + void accumulate_samples(sequence samples); + + DistributionData? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +// Different resolutions supported by the memory related metric types +// (e.g. MemoryDistributionMetric). +enum MemoryUnit { + // 1 byte + "Byte", + // 2^10 bytes + "Kilobyte", + // 2^20 bytes + "Megabyte", + // 2^30 bytes + "Gigabyte", +}; + +interface MemoryDistributionMetric { + constructor(CommonMetricData meta, MemoryUnit memory_unit); + + void accumulate(i64 sample); + + void accumulate_samples(sequence samples); + + DistributionData? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +// Different kinds of histograms. +enum HistogramType { + // A histogram with linear distributed buckets. + "Linear", + // A histogram with exponential distributed buckets. + "Exponential", +}; + +interface CustomDistributionMetric { + constructor(CommonMetricData meta, i64 range_min, i64 range_max, i64 bucket_count, HistogramType histogram_type); + + void accumulate_samples(sequence samples); + + DistributionData? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +// Representation of a date, time and timezone. +dictionary Datetime { + i32 year; + u32 month; + u32 day; + u32 hour; + u32 minute; + u32 second; + u32 nanosecond; + i32 offset_seconds; +}; + +interface DatetimeMetric { + constructor(CommonMetricData meta, TimeUnit time_unit); + + void set(optional Datetime? value = null); + + Datetime? test_get_value(optional string? ping_name = null); + + string? test_get_value_as_string(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +// Represents the recorded data for a single event. +dictionary RecordedEvent { + // The timestamp of when the event was recorded. + // + // This allows to order events from a single process run. + u64 timestamp; + + // The event's category. + // + // This is defined by users in the metrics file. + string category; + + // The event's name. + // + // This is defined by users in the metrics file. + string name; + + // A map of all extra data values. + // + // The set of allowed extra keys is defined by users in the metrics file. + record? extra; +}; + +interface EventMetric { + constructor(CommonMetricData meta, sequence allowed_extra_keys); + + void record(record extra); + + sequence? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +dictionary Rate { + i32 numerator; + i32 denominator; +}; + +interface RateMetric { + constructor(CommonMetricData meta); + + void add_to_numerator(i32 amount); + + void add_to_denominator(i32 amount); + + Rate? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface DenominatorMetric { + constructor(CommonMetricData meta, sequence numerators); + + void add(i32 amount); + + i32? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface NumeratorMetric { + constructor(CommonMetricData meta); + + void add_to_numerator(i32 amount); + + Rate? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; + +interface TextMetric { + constructor(CommonMetricData meta); + + void set(string value); + + string? test_get_value(optional string? ping_name = null); + + i32 test_get_num_recorded_errors(ErrorType error); +}; diff --git a/megazords/ios-rust/build-xcframework.sh b/megazords/ios-rust/build-xcframework.sh index 4fb56fa035..7c8288227a 100755 --- a/megazords/ios-rust/build-xcframework.sh +++ b/megazords/ios-rust/build-xcframework.sh @@ -146,6 +146,7 @@ cp "$WORKING_DIR/$FRAMEWORK_NAME.h" "$COMMON/Headers" cp "$REPO_ROOT/components/rc_log/ios/RustLogFFI.h" "$COMMON/Headers" cp "$REPO_ROOT/components/viaduct/ios/RustViaductFFI.h" "$COMMON/Headers" $CARGO uniffi-bindgen generate "$REPO_ROOT/components/nimbus/src/nimbus.udl" -l swift -o "$COMMON/Headers" +$CARGO uniffi-bindgen generate "$REPO_ROOT/components/external/glean/glean-core/src/glean.udl" -l swift -o "$COMMON/Headers" # We now only move/generate the rest of the headers if we are generating a full # iOS megazord diff --git a/megazords/ios-rust/focus/Cargo.toml b/megazords/ios-rust/focus/Cargo.toml index 080382edc9..b12ef057cf 100644 --- a/megazords/ios-rust/focus/Cargo.toml +++ b/megazords/ios-rust/focus/Cargo.toml @@ -13,3 +13,4 @@ rc_log_ffi = { path = "../../../components/rc_log" } viaduct = { path = "../../../components/viaduct" } viaduct-reqwest = { path = "../../../components/support/viaduct-reqwest" } nimbus-sdk = { path = "../../../components/nimbus" } +glean-core = { path = "../../../components/external/glean/glean-core" } diff --git a/megazords/ios-rust/focus/DEPENDENCIES.md b/megazords/ios-rust/focus/DEPENDENCIES.md index ed3581787f..1c0779fbf9 100644 --- a/megazords/ios-rust/focus/DEPENDENCIES.md +++ b/megazords/ios-rust/focus/DEPENDENCIES.md @@ -10,19 +10,26 @@ the details of which are reproduced below. * [MIT License: aho-corasick, byteorder, memchr, termcolor](#mit-license-aho-corasick-byteorder-memchr-termcolor) * [MIT License: atty](#mit-license-atty) * [MIT License: bincode](#mit-license-bincode) +* [MIT License: bitvec, wyz](#mit-license-bitvec-wyz) * [MIT License: bytes](#mit-license-bytes) * [MIT License: cargo_metadata](#mit-license-cargo_metadata) +* [MIT License: dashmap](#mit-license-dashmap) +* [MIT License: funty](#mit-license-funty) * [MIT License: generic-array](#mit-license-generic-array) * [MIT License: h2](#mit-license-h2) * [MIT License: http-body](#mit-license-http-body) * [MIT License: hyper](#mit-license-hyper) * [MIT License: matches](#mit-license-matches) * [MIT License: mime_guess](#mit-license-mime_guess) +* [MIT License: miniz_oxide](#mit-license-miniz_oxide) * [MIT License: mio](#mit-license-mio) * [MIT License: nom](#mit-license-nom) * [MIT License: ordered-float](#mit-license-ordered-float) +* [MIT License: oslog](#mit-license-oslog) +* [MIT License: radium](#mit-license-radium) * [MIT License: slab](#mit-license-slab) * [MIT License: strsim](#mit-license-strsim) +* [MIT License: tap](#mit-license-tap) * [MIT License: textwrap](#mit-license-textwrap) * [MIT License: tokio, tokio-util](#mit-license-tokio-tokio-util) * [MIT License: tokio-native-tls, tracing, tracing-core](#mit-license-tokio-native-tls-tracing-tracing-core) @@ -30,6 +37,8 @@ the details of which are reproduced below. * [MIT License: try-lock](#mit-license-try-lock) * [MIT License: want](#mit-license-want) * [MIT License: weedle2](#mit-license-weedle2) +* [MIT License: whatsys](#mit-license-whatsys) +* [MIT License: xshell-venv](#mit-license-xshell-venv) * [BSD-2-Clause License: arrayref](#bsd-2-clause-license-arrayref) * [(Apache-2.0 OR MIT) AND BSD-3-Clause License: encoding_rs](#(apache-20-or-mit)-and-bsd-3-clause-license-encoding_rs) ------------- @@ -40,7 +49,9 @@ The following text applies to code linked from these dependencies: [jexl-parser](https://github.com/mozilla/jexl-rs), [uniffi](https://github.com/mozilla/uniffi-rs), [uniffi_bindgen](https://github.com/mozilla/uniffi-rs), -[uniffi_build](https://github.com/mozilla/uniffi-rs) +[uniffi_build](https://github.com/mozilla/uniffi-rs), +[uniffi_macros](https://github.com/mozilla/uniffi-rs), +[zeitstempel](https://github.com/badboy/zeitstempel) ``` Mozilla Public License Version 2.0 @@ -422,6 +433,7 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice ## Apache License 2.0 The following text applies to code linked from these dependencies: +[adler](https://github.com/jonas-schievink/adler.git), [anyhow](https://github.com/dtolnay/anyhow), [askama](https://github.com/djc/askama), [askama_derive](https://github.com/djc/askama), @@ -442,10 +454,15 @@ The following text applies to code linked from these dependencies: [core-foundation-sys](https://github.com/servo/core-foundation-rs), [core-foundation](https://github.com/servo/core-foundation-rs), [cpufeatures](https://github.com/RustCrypto/utils), +[crc32fast](https://github.com/srijs/rust-crc32fast), +[crossbeam-channel](https://github.com/crossbeam-rs/crossbeam), +[crossbeam-utils](https://github.com/crossbeam-rs/crossbeam), [digest](https://github.com/RustCrypto/traits), [either](https://github.com/bluss/either), +[env_logger](https://github.com/env-logger-rs/env_logger/), [fastrand](https://github.com/smol-rs/fastrand), [ffi-support](https://github.com/mozilla/ffi-support), +[flate2](https://github.com/rust-lang/flate2-rs), [fnv](https://github.com/servo/rust-fnv), [form_urlencoded](https://github.com/servo/rust-url), [fs-err](https://github.com/andrewhickman/fs-err), @@ -456,16 +473,19 @@ The following text applies to code linked from these dependencies: [futures-task](https://github.com/rust-lang/futures-rs), [futures-util](https://github.com/rust-lang/futures-rs), [getrandom](https://github.com/rust-random/getrandom), +[glob](https://github.com/rust-lang/glob), [hashbrown](https://github.com/rust-lang/hashbrown), [heck](https://github.com/withoutboats/heck), [hex](https://github.com/KokaKiwi/rust-hex), [http](https://github.com/hyperium/http), [httparse](https://github.com/seanmonstar/httparse), [httpdate](https://github.com/pyfisch/httpdate), +[humantime](https://github.com/tailhook/humantime), [hyper-tls](https://github.com/hyperium/hyper-tls), [id-arena](https://github.com/fitzgen/id-arena), [idna](https://github.com/servo/rust-url/), [indexmap](https://github.com/bluss/indexmap), +[inherent](https://github.com/dtolnay/inherent), [ipnet](https://github.com/krisprice/ipnet), [itertools](https://github.com/rust-itertools/itertools), [itoa](https://github.com/dtolnay/itoa), @@ -486,7 +506,6 @@ The following text applies to code linked from these dependencies: [os_str_bytes](https://github.com/dylni/os_str_bytes), [paste](https://github.com/dtolnay/paste), [percent-encoding](https://github.com/servo/rust-url/), -[pest](https://github.com/pest-parser/pest), [pin-project-lite](https://github.com/taiki-e/pin-project-lite), [pin-utils](https://github.com/rust-lang-nursery/pin-utils), [pkg-config](https://github.com/rust-lang/pkg-config-rs), @@ -504,8 +523,7 @@ The following text applies to code linked from these dependencies: [ryu](https://github.com/dtolnay/ryu), [security-framework-sys](https://github.com/kornelski/rust-security-framework), [security-framework](https://github.com/kornelski/rust-security-framework), -[semver-parser](https://github.com/steveklabnik/semver-parser), -[semver](https://github.com/steveklabnik/semver), +[semver](https://github.com/dtolnay/semver), [serde](https://github.com/serde-rs/serde), [serde_derive](https://github.com/serde-rs/serde), [serde_json](https://github.com/serde-rs/json), @@ -522,7 +540,6 @@ The following text applies to code linked from these dependencies: [tinyvec_macros](https://github.com/Soveu/tinyvec_macros), [toml](https://github.com/alexcrichton/toml-rs), [typenum](https://github.com/paholg/typenum), -[ucd-trie](https://github.com/BurntSushi/ucd-generate), [unicase](https://github.com/seanmonstar/unicase), [unicode-bidi](https://github.com/servo/unicode-bidi), [unicode-ident](https://github.com/dtolnay/unicode-ident), @@ -530,12 +547,14 @@ The following text applies to code linked from these dependencies: [unicode-segmentation](https://github.com/unicode-rs/unicode-segmentation), [url](https://github.com/servo/rust-url), [uuid](https://github.com/uuid-rs/uuid), -[version_check](https://github.com/SergioBenitez/version_check) +[version_check](https://github.com/SergioBenitez/version_check), +[xshell-macros](https://github.com/matklad/xshell), +[xshell](https://github.com/matklad/xshell) ``` Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/LICENSE-2.0 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -727,7 +746,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -858,6 +877,37 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: bitvec, wyz + +The following text applies to code linked from these dependencies: +[bitvec](https://github.com/myrrlyn/bitvec), +[wyz](https://github.com/myrrlyn/wyz) + +``` +MIT License + +Copyright (c) 2018 myrrlyn (Alexander Payne) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: bytes @@ -924,6 +974,66 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: dashmap + +The following text applies to code linked from these dependencies: +[dashmap](https://github.com/xacrimon/dashmap) + +``` +MIT License + +Copyright (c) 2019 Acrimon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +``` +------------- +## MIT License: funty + +The following text applies to code linked from these dependencies: +[funty](https://github.com/myrrlyn/funty) + +``` +MIT License + +Copyright (c) 2020 myrrlyn (Alexander Payne) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: generic-array @@ -1114,6 +1224,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: miniz_oxide + +The following text applies to code linked from these dependencies: +[miniz_oxide](https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide) + +``` +MIT License + +Copyright (c) 2017 Frommi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: mio @@ -1205,6 +1345,66 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: oslog + +The following text applies to code linked from these dependencies: +[oslog](https://github.com/steven-joruk/oslog) + +``` +MIT License + +Copyright (c) 2020 Steven Joruk + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +``` +------------- +## MIT License: radium + +The following text applies to code linked from these dependencies: +[radium](https://github.com/mystor/radium) + +``` +MIT License + +Copyright (c) 2019 kneecaw (Nika Layzell) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: slab @@ -1271,6 +1471,36 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: tap + +The following text applies to code linked from these dependencies: +[tap](https://github.com/myrrlyn/tap) + +``` +MIT License + +Copyright (c) 2017 Elliot Linder + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## MIT License: textwrap @@ -1490,6 +1720,66 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABI CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +``` +------------- +## MIT License: whatsys + +The following text applies to code linked from these dependencies: +[whatsys](https://github.com/badboy/whatsys) + +``` +The MIT License (MIT) + +Copyright (c) 2021 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +``` +------------- +## MIT License: xshell-venv + +The following text applies to code linked from these dependencies: +[xshell-venv](https://github.com/badboy/xshell-venv) + +``` +The MIT License (MIT) + +Copyright (c) 2022 Jan-Erik Rediger + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ``` ------------- ## BSD-2-Clause License: arrayref diff --git a/megazords/ios-rust/focus/MozillaRustComponents.h b/megazords/ios-rust/focus/MozillaRustComponents.h index c6d7c7c5b7..1ea02b6eeb 100644 --- a/megazords/ios-rust/focus/MozillaRustComponents.h +++ b/megazords/ios-rust/focus/MozillaRustComponents.h @@ -8,3 +8,4 @@ #import "RustLogFFI.h" #import "RustViaductFFI.h" #import "nimbusFFI.h" +#import "gleanFFI.h" diff --git a/megazords/ios-rust/focus/src/lib.rs b/megazords/ios-rust/focus/src/lib.rs index 5e06dad23d..8e25a11d83 100644 --- a/megazords/ios-rust/focus/src/lib.rs +++ b/megazords/ios-rust/focus/src/lib.rs @@ -5,6 +5,7 @@ #![allow(unknown_lints)] #![warn(rust_2018_idioms)] +pub use glean_core; pub use nimbus; pub use rc_log_ffi; pub use viaduct_reqwest; diff --git a/megazords/ios-rust/ios/Generated/glean.swift b/megazords/ios-rust/ios/Generated/glean.swift new file mode 100644 index 0000000000..ca4ab87353 --- /dev/null +++ b/megazords/ios-rust/ios/Generated/glean.swift @@ -0,0 +1,4159 @@ +// This file was autogenerated by some hot garbage in the `uniffi` crate. +// Trust me, you don't want to mess with it! +import Foundation + +// Depending on the consumer's build setup, the low-level FFI code +// might be in a separate module, or it might be compiled inline into +// this module. This is a bit of light hackery to work with both. +#if canImport(gleanFFI) + import gleanFFI +#endif + +private extension RustBuffer { + // Allocate a new buffer, copying the contents of a `UInt8` array. + init(bytes: [UInt8]) { + let rbuf = bytes.withUnsafeBufferPointer { ptr in + RustBuffer.from(ptr) + } + self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data) + } + + static func from(_ ptr: UnsafeBufferPointer) -> RustBuffer { + try! rustCall { ffi_glean_957e_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) } + } + + // Frees the buffer in place. + // The buffer must not be used after this is called. + func deallocate() { + try! rustCall { ffi_glean_957e_rustbuffer_free(self, $0) } + } +} + +private extension ForeignBytes { + init(bufferPointer: UnsafeBufferPointer) { + self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress) + } +} + +// For every type used in the interface, we provide helper methods for conveniently +// lifting and lowering that type from C-compatible data, and for reading and writing +// values of that type in a buffer. + +// Helper classes/extensions that don't change. +// Someday, this will be in a libray of its own. + +private extension Data { + init(rustBuffer: RustBuffer) { + // TODO: This copies the buffer. Can we read directly from a + // Rust buffer? + self.init(bytes: rustBuffer.data!, count: Int(rustBuffer.len)) + } +} + +// A helper class to read values out of a byte buffer. +private class Reader { + let data: Data + var offset: Data.Index + + init(data: Data) { + self.data = data + offset = 0 + } + + // Reads an integer at the current offset, in big-endian order, and advances + // the offset on success. Throws if reading the integer would move the + // offset past the end of the buffer. + func readInt() throws -> T { + let range = offset ..< offset + MemoryLayout.size + guard data.count >= range.upperBound else { + throw UniffiInternalError.bufferOverflow + } + if T.self == UInt8.self { + let value = data[offset] + offset += 1 + return value as! T + } + var value: T = 0 + _ = withUnsafeMutableBytes(of: &value) { data.copyBytes(to: $0, from: range) } + offset = range.upperBound + return value.bigEndian + } + + // Reads an arbitrary number of bytes, to be used to read + // raw bytes, this is useful when lifting strings + func readBytes(count: Int) throws -> [UInt8] { + let range = offset ..< (offset + count) + guard data.count >= range.upperBound else { + throw UniffiInternalError.bufferOverflow + } + var value = [UInt8](repeating: 0, count: count) + value.withUnsafeMutableBufferPointer { buffer in + data.copyBytes(to: buffer, from: range) + } + offset = range.upperBound + return value + } + + // Reads a float at the current offset. + @inlinable + func readFloat() throws -> Float { + return Float(bitPattern: try readInt()) + } + + // Reads a float at the current offset. + @inlinable + func readDouble() throws -> Double { + return Double(bitPattern: try readInt()) + } + + // Indicates if the offset has reached the end of the buffer. + @inlinable + func hasRemaining() -> Bool { + return offset < data.count + } +} + +// A helper class to write values into a byte buffer. +private class Writer { + var bytes: [UInt8] + var offset: Array.Index + + init() { + bytes = [] + offset = 0 + } + + func writeBytes(_ byteArr: S) where S: Sequence, S.Element == UInt8 { + bytes.append(contentsOf: byteArr) + } + + // Writes an integer in big-endian order. + // + // Warning: make sure what you are trying to write + // is in the correct type! + func writeInt(_ value: T) { + var value = value.bigEndian + withUnsafeBytes(of: &value) { bytes.append(contentsOf: $0) } + } + + @inlinable + func writeFloat(_ value: Float) { + writeInt(value.bitPattern) + } + + @inlinable + func writeDouble(_ value: Double) { + writeInt(value.bitPattern) + } +} + +// Protocol for types that transfer other types across the FFI. This is +// analogous go the Rust trait of the same name. +private protocol FfiConverter { + associatedtype FfiType + associatedtype SwiftType + + static func lift(_ value: FfiType) throws -> SwiftType + static func lower(_ value: SwiftType) -> FfiType + static func read(from buf: Reader) throws -> SwiftType + static func write(_ value: SwiftType, into buf: Writer) +} + +// Types conforming to `Primitive` pass themselves directly over the FFI. +private protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType {} + +extension FfiConverterPrimitive { + static func lift(_ value: FfiType) throws -> SwiftType { + return value + } + + static func lower(_ value: SwiftType) -> FfiType { + return value + } +} + +// Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`. +// Used for complex types where it's hard to write a custom lift/lower. +private protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} + +extension FfiConverterRustBuffer { + static func lift(_ buf: RustBuffer) throws -> SwiftType { + let reader = Reader(data: Data(rustBuffer: buf)) + let value = try read(from: reader) + if reader.hasRemaining() { + throw UniffiInternalError.incompleteData + } + buf.deallocate() + return value + } + + static func lower(_ value: SwiftType) -> RustBuffer { + let writer = Writer() + write(value, into: writer) + return RustBuffer(bytes: writer.bytes) + } +} + +// An error type for FFI errors. These errors occur at the UniFFI level, not +// the library level. +private enum UniffiInternalError: LocalizedError { + case bufferOverflow + case incompleteData + case unexpectedOptionalTag + case unexpectedEnumCase + case unexpectedNullPointer + case unexpectedRustCallStatusCode + case unexpectedRustCallError + case unexpectedStaleHandle + case rustPanic(_ message: String) + + public var errorDescription: String? { + switch self { + case .bufferOverflow: return "Reading the requested value would read past the end of the buffer" + case .incompleteData: return "The buffer still has data after lifting its containing value" + case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1" + case .unexpectedEnumCase: return "Raw enum value doesn't match any cases" + case .unexpectedNullPointer: return "Raw pointer value was null" + case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code" + case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified" + case .unexpectedStaleHandle: return "The object in the handle map has been dropped already" + case let .rustPanic(message): return message + } + } +} + +private let CALL_SUCCESS: Int8 = 0 +private let CALL_ERROR: Int8 = 1 +private let CALL_PANIC: Int8 = 2 + +private extension RustCallStatus { + init() { + self.init( + code: CALL_SUCCESS, + errorBuf: RustBuffer( + capacity: 0, + len: 0, + data: nil + ) + ) + } +} + +private func rustCall(_ callback: (UnsafeMutablePointer) -> T) throws -> T { + try makeRustCall(callback, errorHandler: { + $0.deallocate() + return UniffiInternalError.unexpectedRustCallError + }) +} + +private func rustCallWithError +(_ errorFfiConverter: F.Type, _ callback: (UnsafeMutablePointer) -> T) throws -> T + where F.SwiftType: Error, F.FfiType == RustBuffer +{ + try makeRustCall(callback, errorHandler: { try errorFfiConverter.lift($0) }) +} + +private func makeRustCall(_ callback: (UnsafeMutablePointer) -> T, errorHandler: (RustBuffer) throws -> Error) throws -> T { + var callStatus = RustCallStatus() + let returnedVal = callback(&callStatus) + switch callStatus.code { + case CALL_SUCCESS: + return returnedVal + + case CALL_ERROR: + throw try errorHandler(callStatus.errorBuf) + + case CALL_PANIC: + // When the rust code sees a panic, it tries to construct a RustBuffer + // with the message. But if that code panics, then it just sends back + // an empty buffer. + if callStatus.errorBuf.len > 0 { + throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf)) + } else { + callStatus.errorBuf.deallocate() + throw UniffiInternalError.rustPanic("Rust panic") + } + + default: + throw UniffiInternalError.unexpectedRustCallStatusCode + } +} + +// Public interface members begin here. + +private struct FfiConverterUInt8: FfiConverterPrimitive { + typealias FfiType = UInt8 + typealias SwiftType = UInt8 + + static func read(from buf: Reader) throws -> UInt8 { + return try lift(buf.readInt()) + } + + static func write(_ value: UInt8, into buf: Writer) { + buf.writeInt(lower(value)) + } +} + +private struct FfiConverterInt8: FfiConverterPrimitive { + typealias FfiType = Int8 + typealias SwiftType = Int8 + + static func read(from buf: Reader) throws -> Int8 { + return try lift(buf.readInt()) + } + + static func write(_ value: Int8, into buf: Writer) { + buf.writeInt(lower(value)) + } +} + +private struct FfiConverterUInt32: FfiConverterPrimitive { + typealias FfiType = UInt32 + typealias SwiftType = UInt32 + + static func read(from buf: Reader) throws -> UInt32 { + return try lift(buf.readInt()) + } + + static func write(_ value: SwiftType, into buf: Writer) { + buf.writeInt(lower(value)) + } +} + +private struct FfiConverterInt32: FfiConverterPrimitive { + typealias FfiType = Int32 + typealias SwiftType = Int32 + + static func read(from buf: Reader) throws -> Int32 { + return try lift(buf.readInt()) + } + + static func write(_ value: Int32, into buf: Writer) { + buf.writeInt(lower(value)) + } +} + +private struct FfiConverterUInt64: FfiConverterPrimitive { + typealias FfiType = UInt64 + typealias SwiftType = UInt64 + + static func read(from buf: Reader) throws -> UInt64 { + return try lift(buf.readInt()) + } + + static func write(_ value: SwiftType, into buf: Writer) { + buf.writeInt(lower(value)) + } +} + +private struct FfiConverterInt64: FfiConverterPrimitive { + typealias FfiType = Int64 + typealias SwiftType = Int64 + + static func read(from buf: Reader) throws -> Int64 { + return try lift(buf.readInt()) + } + + static func write(_ value: Int64, into buf: Writer) { + buf.writeInt(lower(value)) + } +} + +private struct FfiConverterBool: FfiConverter { + typealias FfiType = Int8 + typealias SwiftType = Bool + + static func lift(_ value: Int8) throws -> Bool { + return value != 0 + } + + static func lower(_ value: Bool) -> Int8 { + return value ? 1 : 0 + } + + static func read(from buf: Reader) throws -> Bool { + return try lift(buf.readInt()) + } + + static func write(_ value: Bool, into buf: Writer) { + buf.writeInt(lower(value)) + } +} + +private struct FfiConverterString: FfiConverter { + typealias SwiftType = String + typealias FfiType = RustBuffer + + static func lift(_ value: RustBuffer) throws -> String { + defer { + value.deallocate() + } + if value.data == nil { + return String() + } + let bytes = UnsafeBufferPointer(start: value.data!, count: Int(value.len)) + return String(bytes: bytes, encoding: String.Encoding.utf8)! + } + + static func lower(_ value: String) -> RustBuffer { + return value.utf8CString.withUnsafeBufferPointer { ptr in + // The swift string gives us int8_t, we want uint8_t. + ptr.withMemoryRebound(to: UInt8.self) { ptr in + // The swift string gives us a trailing null byte, we don't want it. + let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1)) + return RustBuffer.from(buf) + } + } + } + + static func read(from buf: Reader) throws -> String { + let len: Int32 = try buf.readInt() + return String(bytes: try buf.readBytes(count: Int(len)), encoding: String.Encoding.utf8)! + } + + static func write(_ value: String, into buf: Writer) { + let len = Int32(value.utf8.count) + buf.writeInt(len) + buf.writeBytes(value.utf8) + } +} + +public protocol BooleanMetricProtocol { + func set(value: Bool) + func testGetValue(pingName: String?) -> Bool? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class BooleanMetric: BooleanMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_BooleanMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_BooleanMetric_object_free(pointer, $0) } + } + + public func set(value: Bool) { + try! + rustCall { + glean_957e_BooleanMetric_set(self.pointer, + FfiConverterBool.lower(value), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> Bool? { + return try! FfiConverterOptionBool.lift( + try! + rustCall { + glean_957e_BooleanMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_BooleanMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeBooleanMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = BooleanMetric + + static func read(from buf: Reader) throws -> BooleanMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: BooleanMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> BooleanMetric { + return BooleanMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: BooleanMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol CounterMetricProtocol { + func add(amount: Int32) + func testGetValue(pingName: String?) -> Int32? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class CounterMetric: CounterMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_CounterMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_CounterMetric_object_free(pointer, $0) } + } + + public func add(amount: Int32 = 1) { + try! + rustCall { + glean_957e_CounterMetric_add(self.pointer, + FfiConverterInt32.lower(amount), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> Int32? { + return try! FfiConverterOptionInt32.lift( + try! + rustCall { + glean_957e_CounterMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_CounterMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeCounterMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = CounterMetric + + static func read(from buf: Reader) throws -> CounterMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: CounterMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> CounterMetric { + return CounterMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: CounterMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol CustomDistributionMetricProtocol { + func accumulateSamples(samples: [Int64]) + func testGetValue(pingName: String?) -> DistributionData? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class CustomDistributionMetric: CustomDistributionMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, rangeMin: Int64, rangeMax: Int64, bucketCount: Int64, histogramType: HistogramType) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_CustomDistributionMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterInt64.lower(rangeMin), + FfiConverterInt64.lower(rangeMax), + FfiConverterInt64.lower(bucketCount), + FfiConverterTypeHistogramType.lower(histogramType), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_CustomDistributionMetric_object_free(pointer, $0) } + } + + public func accumulateSamples(samples: [Int64]) { + try! + rustCall { + glean_957e_CustomDistributionMetric_accumulate_samples(self.pointer, + FfiConverterSequenceInt64.lower(samples), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> DistributionData? { + return try! FfiConverterOptionTypeDistributionData.lift( + try! + rustCall { + glean_957e_CustomDistributionMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_CustomDistributionMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeCustomDistributionMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = CustomDistributionMetric + + static func read(from buf: Reader) throws -> CustomDistributionMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: CustomDistributionMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> CustomDistributionMetric { + return CustomDistributionMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: CustomDistributionMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol DatetimeMetricProtocol { + func set(value: Datetime?) + func testGetValue(pingName: String?) -> Datetime? + func testGetValueAsString(pingName: String?) -> String? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class DatetimeMetric: DatetimeMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, timeUnit: TimeUnit) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_DatetimeMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterTypeTimeUnit.lower(timeUnit), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_DatetimeMetric_object_free(pointer, $0) } + } + + public func set(value: Datetime? = nil) { + try! + rustCall { + glean_957e_DatetimeMetric_set(self.pointer, + FfiConverterOptionTypeDatetime.lower(value), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> Datetime? { + return try! FfiConverterOptionTypeDatetime.lift( + try! + rustCall { + glean_957e_DatetimeMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetValueAsString(pingName: String? = nil) -> String? { + return try! FfiConverterOptionString.lift( + try! + rustCall { + glean_957e_DatetimeMetric_test_get_value_as_string(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_DatetimeMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeDatetimeMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = DatetimeMetric + + static func read(from buf: Reader) throws -> DatetimeMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: DatetimeMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> DatetimeMetric { + return DatetimeMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: DatetimeMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol DenominatorMetricProtocol { + func add(amount: Int32) + func testGetValue(pingName: String?) -> Int32? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class DenominatorMetric: DenominatorMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, numerators: [CommonMetricData]) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_DenominatorMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterSequenceTypeCommonMetricData.lower(numerators), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_DenominatorMetric_object_free(pointer, $0) } + } + + public func add(amount: Int32) { + try! + rustCall { + glean_957e_DenominatorMetric_add(self.pointer, + FfiConverterInt32.lower(amount), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> Int32? { + return try! FfiConverterOptionInt32.lift( + try! + rustCall { + glean_957e_DenominatorMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_DenominatorMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeDenominatorMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = DenominatorMetric + + static func read(from buf: Reader) throws -> DenominatorMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: DenominatorMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> DenominatorMetric { + return DenominatorMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: DenominatorMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol EventMetricProtocol { + func record(extra: [String: String]) + func testGetValue(pingName: String?) -> [RecordedEvent]? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class EventMetric: EventMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, allowedExtraKeys: [String]) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_EventMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterSequenceString.lower(allowedExtraKeys), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_EventMetric_object_free(pointer, $0) } + } + + public func record(extra: [String: String]) { + try! + rustCall { + glean_957e_EventMetric_record(self.pointer, + FfiConverterDictionaryStringString.lower(extra), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> [RecordedEvent]? { + return try! FfiConverterOptionSequenceTypeRecordedEvent.lift( + try! + rustCall { + glean_957e_EventMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_EventMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeEventMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = EventMetric + + static func read(from buf: Reader) throws -> EventMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: EventMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> EventMetric { + return EventMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: EventMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol LabeledBooleanProtocol { + func get(label: String) -> BooleanMetric + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class LabeledBoolean: LabeledBooleanProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, labels: [String]?) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_LabeledBoolean_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterOptionSequenceString.lower(labels), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_LabeledBoolean_object_free(pointer, $0) } + } + + public func get(label: String) -> BooleanMetric { + return try! FfiConverterTypeBooleanMetric.lift( + try! + rustCall { + glean_957e_LabeledBoolean_get(self.pointer, + FfiConverterString.lower(label), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_LabeledBoolean_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeLabeledBoolean: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = LabeledBoolean + + static func read(from buf: Reader) throws -> LabeledBoolean { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: LabeledBoolean, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> LabeledBoolean { + return LabeledBoolean(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: LabeledBoolean) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol LabeledCounterProtocol { + func get(label: String) -> CounterMetric + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class LabeledCounter: LabeledCounterProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, labels: [String]?) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_LabeledCounter_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterOptionSequenceString.lower(labels), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_LabeledCounter_object_free(pointer, $0) } + } + + public func get(label: String) -> CounterMetric { + return try! FfiConverterTypeCounterMetric.lift( + try! + rustCall { + glean_957e_LabeledCounter_get(self.pointer, + FfiConverterString.lower(label), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_LabeledCounter_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeLabeledCounter: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = LabeledCounter + + static func read(from buf: Reader) throws -> LabeledCounter { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: LabeledCounter, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> LabeledCounter { + return LabeledCounter(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: LabeledCounter) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol LabeledStringProtocol { + func get(label: String) -> StringMetric + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class LabeledString: LabeledStringProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, labels: [String]?) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_LabeledString_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterOptionSequenceString.lower(labels), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_LabeledString_object_free(pointer, $0) } + } + + public func get(label: String) -> StringMetric { + return try! FfiConverterTypeStringMetric.lift( + try! + rustCall { + glean_957e_LabeledString_get(self.pointer, + FfiConverterString.lower(label), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_LabeledString_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeLabeledString: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = LabeledString + + static func read(from buf: Reader) throws -> LabeledString { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: LabeledString, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> LabeledString { + return LabeledString(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: LabeledString) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol MemoryDistributionMetricProtocol { + func accumulate(sample: Int64) + func accumulateSamples(samples: [Int64]) + func testGetValue(pingName: String?) -> DistributionData? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class MemoryDistributionMetric: MemoryDistributionMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, memoryUnit: MemoryUnit) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_MemoryDistributionMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterTypeMemoryUnit.lower(memoryUnit), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_MemoryDistributionMetric_object_free(pointer, $0) } + } + + public func accumulate(sample: Int64) { + try! + rustCall { + glean_957e_MemoryDistributionMetric_accumulate(self.pointer, + FfiConverterInt64.lower(sample), $0) + } + } + + public func accumulateSamples(samples: [Int64]) { + try! + rustCall { + glean_957e_MemoryDistributionMetric_accumulate_samples(self.pointer, + FfiConverterSequenceInt64.lower(samples), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> DistributionData? { + return try! FfiConverterOptionTypeDistributionData.lift( + try! + rustCall { + glean_957e_MemoryDistributionMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_MemoryDistributionMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeMemoryDistributionMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = MemoryDistributionMetric + + static func read(from buf: Reader) throws -> MemoryDistributionMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: MemoryDistributionMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> MemoryDistributionMetric { + return MemoryDistributionMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: MemoryDistributionMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol NumeratorMetricProtocol { + func addToNumerator(amount: Int32) + func testGetValue(pingName: String?) -> Rate? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class NumeratorMetric: NumeratorMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_NumeratorMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_NumeratorMetric_object_free(pointer, $0) } + } + + public func addToNumerator(amount: Int32) { + try! + rustCall { + glean_957e_NumeratorMetric_add_to_numerator(self.pointer, + FfiConverterInt32.lower(amount), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> Rate? { + return try! FfiConverterOptionTypeRate.lift( + try! + rustCall { + glean_957e_NumeratorMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_NumeratorMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeNumeratorMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = NumeratorMetric + + static func read(from buf: Reader) throws -> NumeratorMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: NumeratorMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> NumeratorMetric { + return NumeratorMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: NumeratorMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol PingTypeProtocol { + func submit(reason: String?) +} + +public class PingType: PingTypeProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(name: String, includeClientId: Bool, sendIfEmpty: Bool, reasonCodes: [String]) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_PingType_new( + FfiConverterString.lower(name), + FfiConverterBool.lower(includeClientId), + FfiConverterBool.lower(sendIfEmpty), + FfiConverterSequenceString.lower(reasonCodes), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_PingType_object_free(pointer, $0) } + } + + public func submit(reason: String? = nil) { + try! + rustCall { + glean_957e_PingType_submit(self.pointer, + FfiConverterOptionString.lower(reason), $0) + } + } +} + +private struct FfiConverterTypePingType: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = PingType + + static func read(from buf: Reader) throws -> PingType { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: PingType, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> PingType { + return PingType(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: PingType) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol QuantityMetricProtocol { + func set(value: Int64) + func testGetValue(pingName: String?) -> Int64? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class QuantityMetric: QuantityMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_QuantityMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_QuantityMetric_object_free(pointer, $0) } + } + + public func set(value: Int64) { + try! + rustCall { + glean_957e_QuantityMetric_set(self.pointer, + FfiConverterInt64.lower(value), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> Int64? { + return try! FfiConverterOptionInt64.lift( + try! + rustCall { + glean_957e_QuantityMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_QuantityMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeQuantityMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = QuantityMetric + + static func read(from buf: Reader) throws -> QuantityMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: QuantityMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> QuantityMetric { + return QuantityMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: QuantityMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol RateMetricProtocol { + func addToNumerator(amount: Int32) + func addToDenominator(amount: Int32) + func testGetValue(pingName: String?) -> Rate? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class RateMetric: RateMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_RateMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_RateMetric_object_free(pointer, $0) } + } + + public func addToNumerator(amount: Int32) { + try! + rustCall { + glean_957e_RateMetric_add_to_numerator(self.pointer, + FfiConverterInt32.lower(amount), $0) + } + } + + public func addToDenominator(amount: Int32) { + try! + rustCall { + glean_957e_RateMetric_add_to_denominator(self.pointer, + FfiConverterInt32.lower(amount), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> Rate? { + return try! FfiConverterOptionTypeRate.lift( + try! + rustCall { + glean_957e_RateMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_RateMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeRateMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = RateMetric + + static func read(from buf: Reader) throws -> RateMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: RateMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RateMetric { + return RateMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: RateMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol StringListMetricProtocol { + func add(value: String) + func set(value: [String]) + func testGetValue(pingName: String?) -> [String]? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class StringListMetric: StringListMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_StringListMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_StringListMetric_object_free(pointer, $0) } + } + + public func add(value: String) { + try! + rustCall { + glean_957e_StringListMetric_add(self.pointer, + FfiConverterString.lower(value), $0) + } + } + + public func set(value: [String]) { + try! + rustCall { + glean_957e_StringListMetric_set(self.pointer, + FfiConverterSequenceString.lower(value), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> [String]? { + return try! FfiConverterOptionSequenceString.lift( + try! + rustCall { + glean_957e_StringListMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_StringListMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeStringListMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = StringListMetric + + static func read(from buf: Reader) throws -> StringListMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: StringListMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> StringListMetric { + return StringListMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: StringListMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol StringMetricProtocol { + func set(value: String) + func testGetValue(pingName: String?) -> String? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class StringMetric: StringMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_StringMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_StringMetric_object_free(pointer, $0) } + } + + public func set(value: String) { + try! + rustCall { + glean_957e_StringMetric_set(self.pointer, + FfiConverterString.lower(value), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> String? { + return try! FfiConverterOptionString.lift( + try! + rustCall { + glean_957e_StringMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_StringMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeStringMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = StringMetric + + static func read(from buf: Reader) throws -> StringMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: StringMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> StringMetric { + return StringMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: StringMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol TextMetricProtocol { + func set(value: String) + func testGetValue(pingName: String?) -> String? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class TextMetric: TextMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_TextMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_TextMetric_object_free(pointer, $0) } + } + + public func set(value: String) { + try! + rustCall { + glean_957e_TextMetric_set(self.pointer, + FfiConverterString.lower(value), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> String? { + return try! FfiConverterOptionString.lift( + try! + rustCall { + glean_957e_TextMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_TextMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeTextMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = TextMetric + + static func read(from buf: Reader) throws -> TextMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: TextMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> TextMetric { + return TextMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: TextMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol TimespanMetricProtocol { + func start() + func stop() + func cancel() + func setRawNanos(elapsed: Int64) + func testGetValue(pingName: String?) -> Int64? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class TimespanMetric: TimespanMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, timeUnit: TimeUnit) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_TimespanMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterTypeTimeUnit.lower(timeUnit), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_TimespanMetric_object_free(pointer, $0) } + } + + public func start() { + try! + rustCall { + glean_957e_TimespanMetric_start(self.pointer, $0) + } + } + + public func stop() { + try! + rustCall { + glean_957e_TimespanMetric_stop(self.pointer, $0) + } + } + + public func cancel() { + try! + rustCall { + glean_957e_TimespanMetric_cancel(self.pointer, $0) + } + } + + public func setRawNanos(elapsed: Int64) { + try! + rustCall { + glean_957e_TimespanMetric_set_raw_nanos(self.pointer, + FfiConverterInt64.lower(elapsed), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> Int64? { + return try! FfiConverterOptionInt64.lift( + try! + rustCall { + glean_957e_TimespanMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_TimespanMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeTimespanMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = TimespanMetric + + static func read(from buf: Reader) throws -> TimespanMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: TimespanMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> TimespanMetric { + return TimespanMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: TimespanMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol TimingDistributionMetricProtocol { + func start() -> TimerId + func stopAndAccumulate(timerId: TimerId) + func cancel(timerId: TimerId) + func accumulateSamples(samples: [Int64]) + func testGetValue(pingName: String?) -> DistributionData? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class TimingDistributionMetric: TimingDistributionMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData, timeUnit: TimeUnit) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_TimingDistributionMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), + FfiConverterTypeTimeUnit.lower(timeUnit), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_TimingDistributionMetric_object_free(pointer, $0) } + } + + public func start() -> TimerId { + return try! FfiConverterTypeTimerId.lift( + try! + rustCall { + glean_957e_TimingDistributionMetric_start(self.pointer, $0) + } + ) + } + + public func stopAndAccumulate(timerId: TimerId) { + try! + rustCall { + glean_957e_TimingDistributionMetric_stop_and_accumulate(self.pointer, + FfiConverterTypeTimerId.lower(timerId), $0) + } + } + + public func cancel(timerId: TimerId) { + try! + rustCall { + glean_957e_TimingDistributionMetric_cancel(self.pointer, + FfiConverterTypeTimerId.lower(timerId), $0) + } + } + + public func accumulateSamples(samples: [Int64]) { + try! + rustCall { + glean_957e_TimingDistributionMetric_accumulate_samples(self.pointer, + FfiConverterSequenceInt64.lower(samples), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> DistributionData? { + return try! FfiConverterOptionTypeDistributionData.lift( + try! + rustCall { + glean_957e_TimingDistributionMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_TimingDistributionMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeTimingDistributionMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = TimingDistributionMetric + + static func read(from buf: Reader) throws -> TimingDistributionMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: TimingDistributionMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> TimingDistributionMetric { + return TimingDistributionMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: TimingDistributionMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol UrlMetricProtocol { + func set(value: String) + func testGetValue(pingName: String?) -> String? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class UrlMetric: UrlMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_UrlMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_UrlMetric_object_free(pointer, $0) } + } + + public func set(value: String) { + try! + rustCall { + glean_957e_UrlMetric_set(self.pointer, + FfiConverterString.lower(value), $0) + } + } + + public func testGetValue(pingName: String? = nil) -> String? { + return try! FfiConverterOptionString.lift( + try! + rustCall { + glean_957e_UrlMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_UrlMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeUrlMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = UrlMetric + + static func read(from buf: Reader) throws -> UrlMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: UrlMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> UrlMetric { + return UrlMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: UrlMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public protocol UuidMetricProtocol { + func set(value: String) + func generateAndSet() -> String + func testGetValue(pingName: String?) -> String? + func testGetNumRecordedErrors(error: ErrorType) -> Int32 +} + +public class UuidMetric: UuidMetricProtocol { + fileprivate let pointer: UnsafeMutableRawPointer + + // TODO: We'd like this to be `private` but for Swifty reasons, + // we can't implement `FfiConverter` without making this `required` and we can't + // make it `required` without making it `public`. + required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + public convenience init(meta: CommonMetricData) { + self.init(unsafeFromRawPointer: try! + + rustCall { + glean_957e_UuidMetric_new( + FfiConverterTypeCommonMetricData.lower(meta), $0 + ) + }) + } + + deinit { + try! rustCall { ffi_glean_957e_UuidMetric_object_free(pointer, $0) } + } + + public func set(value: String) { + try! + rustCall { + glean_957e_UuidMetric_set(self.pointer, + FfiConverterString.lower(value), $0) + } + } + + public func generateAndSet() -> String { + return try! FfiConverterString.lift( + try! + rustCall { + glean_957e_UuidMetric_generate_and_set(self.pointer, $0) + } + ) + } + + public func testGetValue(pingName: String? = nil) -> String? { + return try! FfiConverterOptionString.lift( + try! + rustCall { + glean_957e_UuidMetric_test_get_value(self.pointer, + FfiConverterOptionString.lower(pingName), $0) + } + ) + } + + public func testGetNumRecordedErrors(error: ErrorType) -> Int32 { + return try! FfiConverterInt32.lift( + try! + rustCall { + glean_957e_UuidMetric_test_get_num_recorded_errors(self.pointer, + FfiConverterTypeErrorType.lower(error), $0) + } + ) + } +} + +private struct FfiConverterTypeUuidMetric: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer + typealias SwiftType = UuidMetric + + static func read(from buf: Reader) throws -> UuidMetric { + let v: UInt64 = try buf.readInt() + // The Rust code won't compile if a pointer won't fit in a UInt64. + // We have to go via `UInt` because that's the thing that's the size of a pointer. + let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) + if ptr == nil { + throw UniffiInternalError.unexpectedNullPointer + } + return try lift(ptr!) + } + + static func write(_ value: UuidMetric, into buf: Writer) { + // This fiddling is because `Int` is the thing that's the same size as a pointer. + // The Rust code won't compile if a pointer won't fit in a `UInt64`. + buf.writeInt(UInt64(bitPattern: Int64(Int(bitPattern: lower(value))))) + } + + static func lift(_ pointer: UnsafeMutableRawPointer) throws -> UuidMetric { + return UuidMetric(unsafeFromRawPointer: pointer) + } + + static func lower(_ value: UuidMetric) -> UnsafeMutableRawPointer { + return value.pointer + } +} + +public struct ClientInfoMetrics { + public var appBuild: String + public var appDisplayVersion: String + public var appBuildDate: Datetime + public var architecture: String + public var osVersion: String + public var channel: String? + public var locale: String? + public var deviceManufacturer: String? + public var deviceModel: String? + public var androidSdkVersion: String? + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(appBuild: String, appDisplayVersion: String, appBuildDate: Datetime, architecture: String, osVersion: String, channel: String? = nil, locale: String? = nil, deviceManufacturer: String? = nil, deviceModel: String? = nil, androidSdkVersion: String? = nil) { + self.appBuild = appBuild + self.appDisplayVersion = appDisplayVersion + self.appBuildDate = appBuildDate + self.architecture = architecture + self.osVersion = osVersion + self.channel = channel + self.locale = locale + self.deviceManufacturer = deviceManufacturer + self.deviceModel = deviceModel + self.androidSdkVersion = androidSdkVersion + } +} + +extension ClientInfoMetrics: Equatable, Hashable { + public static func == (lhs: ClientInfoMetrics, rhs: ClientInfoMetrics) -> Bool { + if lhs.appBuild != rhs.appBuild { + return false + } + if lhs.appDisplayVersion != rhs.appDisplayVersion { + return false + } + if lhs.appBuildDate != rhs.appBuildDate { + return false + } + if lhs.architecture != rhs.architecture { + return false + } + if lhs.osVersion != rhs.osVersion { + return false + } + if lhs.channel != rhs.channel { + return false + } + if lhs.locale != rhs.locale { + return false + } + if lhs.deviceManufacturer != rhs.deviceManufacturer { + return false + } + if lhs.deviceModel != rhs.deviceModel { + return false + } + if lhs.androidSdkVersion != rhs.androidSdkVersion { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(appBuild) + hasher.combine(appDisplayVersion) + hasher.combine(appBuildDate) + hasher.combine(architecture) + hasher.combine(osVersion) + hasher.combine(channel) + hasher.combine(locale) + hasher.combine(deviceManufacturer) + hasher.combine(deviceModel) + hasher.combine(androidSdkVersion) + } +} + +private struct FfiConverterTypeClientInfoMetrics: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> ClientInfoMetrics { + return try ClientInfoMetrics( + appBuild: FfiConverterString.read(from: buf), + appDisplayVersion: FfiConverterString.read(from: buf), + appBuildDate: FfiConverterTypeDatetime.read(from: buf), + architecture: FfiConverterString.read(from: buf), + osVersion: FfiConverterString.read(from: buf), + channel: FfiConverterOptionString.read(from: buf), + locale: FfiConverterOptionString.read(from: buf), + deviceManufacturer: FfiConverterOptionString.read(from: buf), + deviceModel: FfiConverterOptionString.read(from: buf), + androidSdkVersion: FfiConverterOptionString.read(from: buf) + ) + } + + fileprivate static func write(_ value: ClientInfoMetrics, into buf: Writer) { + FfiConverterString.write(value.appBuild, into: buf) + FfiConverterString.write(value.appDisplayVersion, into: buf) + FfiConverterTypeDatetime.write(value.appBuildDate, into: buf) + FfiConverterString.write(value.architecture, into: buf) + FfiConverterString.write(value.osVersion, into: buf) + FfiConverterOptionString.write(value.channel, into: buf) + FfiConverterOptionString.write(value.locale, into: buf) + FfiConverterOptionString.write(value.deviceManufacturer, into: buf) + FfiConverterOptionString.write(value.deviceModel, into: buf) + FfiConverterOptionString.write(value.androidSdkVersion, into: buf) + } +} + +public struct CommonMetricData { + public var category: String + public var name: String + public var sendInPings: [String] + public var lifetime: Lifetime + public var disabled: Bool + public var dynamicLabel: String? + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(category: String, name: String, sendInPings: [String], lifetime: Lifetime, disabled: Bool, dynamicLabel: String? = nil) { + self.category = category + self.name = name + self.sendInPings = sendInPings + self.lifetime = lifetime + self.disabled = disabled + self.dynamicLabel = dynamicLabel + } +} + +extension CommonMetricData: Equatable, Hashable { + public static func == (lhs: CommonMetricData, rhs: CommonMetricData) -> Bool { + if lhs.category != rhs.category { + return false + } + if lhs.name != rhs.name { + return false + } + if lhs.sendInPings != rhs.sendInPings { + return false + } + if lhs.lifetime != rhs.lifetime { + return false + } + if lhs.disabled != rhs.disabled { + return false + } + if lhs.dynamicLabel != rhs.dynamicLabel { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(category) + hasher.combine(name) + hasher.combine(sendInPings) + hasher.combine(lifetime) + hasher.combine(disabled) + hasher.combine(dynamicLabel) + } +} + +private struct FfiConverterTypeCommonMetricData: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> CommonMetricData { + return try CommonMetricData( + category: FfiConverterString.read(from: buf), + name: FfiConverterString.read(from: buf), + sendInPings: FfiConverterSequenceString.read(from: buf), + lifetime: FfiConverterTypeLifetime.read(from: buf), + disabled: FfiConverterBool.read(from: buf), + dynamicLabel: FfiConverterOptionString.read(from: buf) + ) + } + + fileprivate static func write(_ value: CommonMetricData, into buf: Writer) { + FfiConverterString.write(value.category, into: buf) + FfiConverterString.write(value.name, into: buf) + FfiConverterSequenceString.write(value.sendInPings, into: buf) + FfiConverterTypeLifetime.write(value.lifetime, into: buf) + FfiConverterBool.write(value.disabled, into: buf) + FfiConverterOptionString.write(value.dynamicLabel, into: buf) + } +} + +public struct Datetime { + public var year: Int32 + public var month: UInt32 + public var day: UInt32 + public var hour: UInt32 + public var minute: UInt32 + public var second: UInt32 + public var nanosecond: UInt32 + public var offsetSeconds: Int32 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(year: Int32, month: UInt32, day: UInt32, hour: UInt32, minute: UInt32, second: UInt32, nanosecond: UInt32, offsetSeconds: Int32) { + self.year = year + self.month = month + self.day = day + self.hour = hour + self.minute = minute + self.second = second + self.nanosecond = nanosecond + self.offsetSeconds = offsetSeconds + } +} + +extension Datetime: Equatable, Hashable { + public static func == (lhs: Datetime, rhs: Datetime) -> Bool { + if lhs.year != rhs.year { + return false + } + if lhs.month != rhs.month { + return false + } + if lhs.day != rhs.day { + return false + } + if lhs.hour != rhs.hour { + return false + } + if lhs.minute != rhs.minute { + return false + } + if lhs.second != rhs.second { + return false + } + if lhs.nanosecond != rhs.nanosecond { + return false + } + if lhs.offsetSeconds != rhs.offsetSeconds { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(year) + hasher.combine(month) + hasher.combine(day) + hasher.combine(hour) + hasher.combine(minute) + hasher.combine(second) + hasher.combine(nanosecond) + hasher.combine(offsetSeconds) + } +} + +private struct FfiConverterTypeDatetime: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> Datetime { + return try Datetime( + year: FfiConverterInt32.read(from: buf), + month: FfiConverterUInt32.read(from: buf), + day: FfiConverterUInt32.read(from: buf), + hour: FfiConverterUInt32.read(from: buf), + minute: FfiConverterUInt32.read(from: buf), + second: FfiConverterUInt32.read(from: buf), + nanosecond: FfiConverterUInt32.read(from: buf), + offsetSeconds: FfiConverterInt32.read(from: buf) + ) + } + + fileprivate static func write(_ value: Datetime, into buf: Writer) { + FfiConverterInt32.write(value.year, into: buf) + FfiConverterUInt32.write(value.month, into: buf) + FfiConverterUInt32.write(value.day, into: buf) + FfiConverterUInt32.write(value.hour, into: buf) + FfiConverterUInt32.write(value.minute, into: buf) + FfiConverterUInt32.write(value.second, into: buf) + FfiConverterUInt32.write(value.nanosecond, into: buf) + FfiConverterInt32.write(value.offsetSeconds, into: buf) + } +} + +public struct DistributionData { + public var values: [Int64: Int64] + public var sum: Int64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(values: [Int64: Int64], sum: Int64) { + self.values = values + self.sum = sum + } +} + +extension DistributionData: Equatable, Hashable { + public static func == (lhs: DistributionData, rhs: DistributionData) -> Bool { + if lhs.values != rhs.values { + return false + } + if lhs.sum != rhs.sum { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(values) + hasher.combine(sum) + } +} + +private struct FfiConverterTypeDistributionData: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> DistributionData { + return try DistributionData( + values: FfiConverterDictionaryInt64Int64.read(from: buf), + sum: FfiConverterInt64.read(from: buf) + ) + } + + fileprivate static func write(_ value: DistributionData, into buf: Writer) { + FfiConverterDictionaryInt64Int64.write(value.values, into: buf) + FfiConverterInt64.write(value.sum, into: buf) + } +} + +public struct InternalConfiguration { + public var dataPath: String + public var applicationId: String + public var languageBindingName: String + public var uploadEnabled: Bool + public var maxEvents: UInt32? + public var delayPingLifetimeIo: Bool + public var appBuild: String + public var useCoreMps: Bool + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(dataPath: String, applicationId: String, languageBindingName: String, uploadEnabled: Bool, maxEvents: UInt32?, delayPingLifetimeIo: Bool, appBuild: String, useCoreMps: Bool) { + self.dataPath = dataPath + self.applicationId = applicationId + self.languageBindingName = languageBindingName + self.uploadEnabled = uploadEnabled + self.maxEvents = maxEvents + self.delayPingLifetimeIo = delayPingLifetimeIo + self.appBuild = appBuild + self.useCoreMps = useCoreMps + } +} + +extension InternalConfiguration: Equatable, Hashable { + public static func == (lhs: InternalConfiguration, rhs: InternalConfiguration) -> Bool { + if lhs.dataPath != rhs.dataPath { + return false + } + if lhs.applicationId != rhs.applicationId { + return false + } + if lhs.languageBindingName != rhs.languageBindingName { + return false + } + if lhs.uploadEnabled != rhs.uploadEnabled { + return false + } + if lhs.maxEvents != rhs.maxEvents { + return false + } + if lhs.delayPingLifetimeIo != rhs.delayPingLifetimeIo { + return false + } + if lhs.appBuild != rhs.appBuild { + return false + } + if lhs.useCoreMps != rhs.useCoreMps { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(dataPath) + hasher.combine(applicationId) + hasher.combine(languageBindingName) + hasher.combine(uploadEnabled) + hasher.combine(maxEvents) + hasher.combine(delayPingLifetimeIo) + hasher.combine(appBuild) + hasher.combine(useCoreMps) + } +} + +private struct FfiConverterTypeInternalConfiguration: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> InternalConfiguration { + return try InternalConfiguration( + dataPath: FfiConverterString.read(from: buf), + applicationId: FfiConverterString.read(from: buf), + languageBindingName: FfiConverterString.read(from: buf), + uploadEnabled: FfiConverterBool.read(from: buf), + maxEvents: FfiConverterOptionUInt32.read(from: buf), + delayPingLifetimeIo: FfiConverterBool.read(from: buf), + appBuild: FfiConverterString.read(from: buf), + useCoreMps: FfiConverterBool.read(from: buf) + ) + } + + fileprivate static func write(_ value: InternalConfiguration, into buf: Writer) { + FfiConverterString.write(value.dataPath, into: buf) + FfiConverterString.write(value.applicationId, into: buf) + FfiConverterString.write(value.languageBindingName, into: buf) + FfiConverterBool.write(value.uploadEnabled, into: buf) + FfiConverterOptionUInt32.write(value.maxEvents, into: buf) + FfiConverterBool.write(value.delayPingLifetimeIo, into: buf) + FfiConverterString.write(value.appBuild, into: buf) + FfiConverterBool.write(value.useCoreMps, into: buf) + } +} + +public struct PingRequest { + public var documentId: String + public var path: String + public var body: [UInt8] + public var headers: [String: String] + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(documentId: String, path: String, body: [UInt8], headers: [String: String]) { + self.documentId = documentId + self.path = path + self.body = body + self.headers = headers + } +} + +extension PingRequest: Equatable, Hashable { + public static func == (lhs: PingRequest, rhs: PingRequest) -> Bool { + if lhs.documentId != rhs.documentId { + return false + } + if lhs.path != rhs.path { + return false + } + if lhs.body != rhs.body { + return false + } + if lhs.headers != rhs.headers { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(documentId) + hasher.combine(path) + hasher.combine(body) + hasher.combine(headers) + } +} + +private struct FfiConverterTypePingRequest: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> PingRequest { + return try PingRequest( + documentId: FfiConverterString.read(from: buf), + path: FfiConverterString.read(from: buf), + body: FfiConverterSequenceUInt8.read(from: buf), + headers: FfiConverterDictionaryStringString.read(from: buf) + ) + } + + fileprivate static func write(_ value: PingRequest, into buf: Writer) { + FfiConverterString.write(value.documentId, into: buf) + FfiConverterString.write(value.path, into: buf) + FfiConverterSequenceUInt8.write(value.body, into: buf) + FfiConverterDictionaryStringString.write(value.headers, into: buf) + } +} + +public struct Rate { + public var numerator: Int32 + public var denominator: Int32 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(numerator: Int32, denominator: Int32) { + self.numerator = numerator + self.denominator = denominator + } +} + +extension Rate: Equatable, Hashable { + public static func == (lhs: Rate, rhs: Rate) -> Bool { + if lhs.numerator != rhs.numerator { + return false + } + if lhs.denominator != rhs.denominator { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(numerator) + hasher.combine(denominator) + } +} + +private struct FfiConverterTypeRate: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> Rate { + return try Rate( + numerator: FfiConverterInt32.read(from: buf), + denominator: FfiConverterInt32.read(from: buf) + ) + } + + fileprivate static func write(_ value: Rate, into buf: Writer) { + FfiConverterInt32.write(value.numerator, into: buf) + FfiConverterInt32.write(value.denominator, into: buf) + } +} + +public struct RecordedEvent { + public var timestamp: UInt64 + public var category: String + public var name: String + public var extra: [String: String]? + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(timestamp: UInt64, category: String, name: String, extra: [String: String]?) { + self.timestamp = timestamp + self.category = category + self.name = name + self.extra = extra + } +} + +extension RecordedEvent: Equatable, Hashable { + public static func == (lhs: RecordedEvent, rhs: RecordedEvent) -> Bool { + if lhs.timestamp != rhs.timestamp { + return false + } + if lhs.category != rhs.category { + return false + } + if lhs.name != rhs.name { + return false + } + if lhs.extra != rhs.extra { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(timestamp) + hasher.combine(category) + hasher.combine(name) + hasher.combine(extra) + } +} + +private struct FfiConverterTypeRecordedEvent: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> RecordedEvent { + return try RecordedEvent( + timestamp: FfiConverterUInt64.read(from: buf), + category: FfiConverterString.read(from: buf), + name: FfiConverterString.read(from: buf), + extra: FfiConverterOptionDictionaryStringString.read(from: buf) + ) + } + + fileprivate static func write(_ value: RecordedEvent, into buf: Writer) { + FfiConverterUInt64.write(value.timestamp, into: buf) + FfiConverterString.write(value.category, into: buf) + FfiConverterString.write(value.name, into: buf) + FfiConverterOptionDictionaryStringString.write(value.extra, into: buf) + } +} + +public struct RecordedExperiment { + public var branch: String + public var extra: [String: String]? + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(branch: String, extra: [String: String]?) { + self.branch = branch + self.extra = extra + } +} + +extension RecordedExperiment: Equatable, Hashable { + public static func == (lhs: RecordedExperiment, rhs: RecordedExperiment) -> Bool { + if lhs.branch != rhs.branch { + return false + } + if lhs.extra != rhs.extra { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(branch) + hasher.combine(extra) + } +} + +private struct FfiConverterTypeRecordedExperiment: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> RecordedExperiment { + return try RecordedExperiment( + branch: FfiConverterString.read(from: buf), + extra: FfiConverterOptionDictionaryStringString.read(from: buf) + ) + } + + fileprivate static func write(_ value: RecordedExperiment, into buf: Writer) { + FfiConverterString.write(value.branch, into: buf) + FfiConverterOptionDictionaryStringString.write(value.extra, into: buf) + } +} + +public struct TimerId { + public var id: UInt64 + + // Default memberwise initializers are never public by default, so we + // declare one manually. + public init(id: UInt64) { + self.id = id + } +} + +extension TimerId: Equatable, Hashable { + public static func == (lhs: TimerId, rhs: TimerId) -> Bool { + if lhs.id != rhs.id { + return false + } + return true + } + + public func hash(into hasher: inout Hasher) { + hasher.combine(id) + } +} + +private struct FfiConverterTypeTimerId: FfiConverterRustBuffer { + fileprivate static func read(from buf: Reader) throws -> TimerId { + return try TimerId( + id: FfiConverterUInt64.read(from: buf) + ) + } + + fileprivate static func write(_ value: TimerId, into buf: Writer) { + FfiConverterUInt64.write(value.id, into: buf) + } +} + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. +public enum ErrorType { + case invalidValue + case invalidLabel + case invalidState + case invalidOverflow +} + +private struct FfiConverterTypeErrorType: FfiConverterRustBuffer { + typealias SwiftType = ErrorType + + static func read(from buf: Reader) throws -> ErrorType { + let variant: Int32 = try buf.readInt() + switch variant { + case 1: return .invalidValue + + case 2: return .invalidLabel + + case 3: return .invalidState + + case 4: return .invalidOverflow + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + static func write(_ value: ErrorType, into buf: Writer) { + switch value { + case .invalidValue: + buf.writeInt(Int32(1)) + + case .invalidLabel: + buf.writeInt(Int32(2)) + + case .invalidState: + buf.writeInt(Int32(3)) + + case .invalidOverflow: + buf.writeInt(Int32(4)) + } + } +} + +extension ErrorType: Equatable, Hashable {} + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. +public enum HistogramType { + case linear + case exponential +} + +private struct FfiConverterTypeHistogramType: FfiConverterRustBuffer { + typealias SwiftType = HistogramType + + static func read(from buf: Reader) throws -> HistogramType { + let variant: Int32 = try buf.readInt() + switch variant { + case 1: return .linear + + case 2: return .exponential + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + static func write(_ value: HistogramType, into buf: Writer) { + switch value { + case .linear: + buf.writeInt(Int32(1)) + + case .exponential: + buf.writeInt(Int32(2)) + } + } +} + +extension HistogramType: Equatable, Hashable {} + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. +public enum Lifetime { + case ping + case application + case user +} + +private struct FfiConverterTypeLifetime: FfiConverterRustBuffer { + typealias SwiftType = Lifetime + + static func read(from buf: Reader) throws -> Lifetime { + let variant: Int32 = try buf.readInt() + switch variant { + case 1: return .ping + + case 2: return .application + + case 3: return .user + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + static func write(_ value: Lifetime, into buf: Writer) { + switch value { + case .ping: + buf.writeInt(Int32(1)) + + case .application: + buf.writeInt(Int32(2)) + + case .user: + buf.writeInt(Int32(3)) + } + } +} + +extension Lifetime: Equatable, Hashable {} + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. +public enum MemoryUnit { + case byte + case kilobyte + case megabyte + case gigabyte +} + +private struct FfiConverterTypeMemoryUnit: FfiConverterRustBuffer { + typealias SwiftType = MemoryUnit + + static func read(from buf: Reader) throws -> MemoryUnit { + let variant: Int32 = try buf.readInt() + switch variant { + case 1: return .byte + + case 2: return .kilobyte + + case 3: return .megabyte + + case 4: return .gigabyte + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + static func write(_ value: MemoryUnit, into buf: Writer) { + switch value { + case .byte: + buf.writeInt(Int32(1)) + + case .kilobyte: + buf.writeInt(Int32(2)) + + case .megabyte: + buf.writeInt(Int32(3)) + + case .gigabyte: + buf.writeInt(Int32(4)) + } + } +} + +extension MemoryUnit: Equatable, Hashable {} + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. +public enum PingUploadTask { + case upload(request: PingRequest) + case wait(time: UInt64) + case done(unused: Int8) +} + +private struct FfiConverterTypePingUploadTask: FfiConverterRustBuffer { + typealias SwiftType = PingUploadTask + + static func read(from buf: Reader) throws -> PingUploadTask { + let variant: Int32 = try buf.readInt() + switch variant { + case 1: return .upload( + request: try FfiConverterTypePingRequest.read(from: buf) + ) + + case 2: return .wait( + time: try FfiConverterUInt64.read(from: buf) + ) + + case 3: return .done( + unused: try FfiConverterInt8.read(from: buf) + ) + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + static func write(_ value: PingUploadTask, into buf: Writer) { + switch value { + case let .upload(request): + buf.writeInt(Int32(1)) + FfiConverterTypePingRequest.write(request, into: buf) + + case let .wait(time): + buf.writeInt(Int32(2)) + FfiConverterUInt64.write(time, into: buf) + + case let .done(unused): + buf.writeInt(Int32(3)) + FfiConverterInt8.write(unused, into: buf) + } + } +} + +extension PingUploadTask: Equatable, Hashable {} + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. +public enum TimeUnit { + case nanosecond + case microsecond + case millisecond + case second + case minute + case hour + case day +} + +private struct FfiConverterTypeTimeUnit: FfiConverterRustBuffer { + typealias SwiftType = TimeUnit + + static func read(from buf: Reader) throws -> TimeUnit { + let variant: Int32 = try buf.readInt() + switch variant { + case 1: return .nanosecond + + case 2: return .microsecond + + case 3: return .millisecond + + case 4: return .second + + case 5: return .minute + + case 6: return .hour + + case 7: return .day + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + static func write(_ value: TimeUnit, into buf: Writer) { + switch value { + case .nanosecond: + buf.writeInt(Int32(1)) + + case .microsecond: + buf.writeInt(Int32(2)) + + case .millisecond: + buf.writeInt(Int32(3)) + + case .second: + buf.writeInt(Int32(4)) + + case .minute: + buf.writeInt(Int32(5)) + + case .hour: + buf.writeInt(Int32(6)) + + case .day: + buf.writeInt(Int32(7)) + } + } +} + +extension TimeUnit: Equatable, Hashable {} + +// Note that we don't yet support `indirect` for enums. +// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. +public enum UploadResult { + case recoverableFailure(unused: Int8) + case unrecoverableFailure(unused: Int8) + case httpStatus(code: Int32) +} + +private struct FfiConverterTypeUploadResult: FfiConverterRustBuffer { + typealias SwiftType = UploadResult + + static func read(from buf: Reader) throws -> UploadResult { + let variant: Int32 = try buf.readInt() + switch variant { + case 1: return .recoverableFailure( + unused: try FfiConverterInt8.read(from: buf) + ) + + case 2: return .unrecoverableFailure( + unused: try FfiConverterInt8.read(from: buf) + ) + + case 3: return .httpStatus( + code: try FfiConverterInt32.read(from: buf) + ) + + default: throw UniffiInternalError.unexpectedEnumCase + } + } + + static func write(_ value: UploadResult, into buf: Writer) { + switch value { + case let .recoverableFailure(unused): + buf.writeInt(Int32(1)) + FfiConverterInt8.write(unused, into: buf) + + case let .unrecoverableFailure(unused): + buf.writeInt(Int32(2)) + FfiConverterInt8.write(unused, into: buf) + + case let .httpStatus(code): + buf.writeInt(Int32(3)) + FfiConverterInt32.write(code, into: buf) + } + } +} + +extension UploadResult: Equatable, Hashable {} + +private extension NSLock { + func withLock(f: () throws -> T) rethrows -> T { + lock() + defer { self.unlock() } + return try f() + } +} + +private typealias Handle = UInt64 +private class ConcurrentHandleMap { + private var leftMap: [Handle: T] = [:] + private var counter: [Handle: UInt64] = [:] + private var rightMap: [ObjectIdentifier: Handle] = [:] + + private let lock = NSLock() + private var currentHandle: Handle = 0 + private let stride: Handle = 1 + + func insert(obj: T) -> Handle { + lock.withLock { + let id = ObjectIdentifier(obj as AnyObject) + let handle = rightMap[id] ?? { + currentHandle += stride + let handle = currentHandle + leftMap[handle] = obj + rightMap[id] = handle + return handle + }() + counter[handle] = (counter[handle] ?? 0) + 1 + return handle + } + } + + func get(handle: Handle) -> T? { + lock.withLock { + leftMap[handle] + } + } + + func delete(handle: Handle) { + remove(handle: handle) + } + + @discardableResult + func remove(handle: Handle) -> T? { + lock.withLock { + defer { counter[handle] = (counter[handle] ?? 1) - 1 } + guard counter[handle] == 1 else { return leftMap[handle] } + let obj = leftMap.removeValue(forKey: handle) + if let obj = obj { + rightMap.removeValue(forKey: ObjectIdentifier(obj as AnyObject)) + } + return obj + } + } +} + +// Magic number for the Rust proxy to call using the same mechanism as every other method, +// to free the callback once it's dropped by Rust. +private let IDX_CALLBACK_FREE: Int32 = 0 + +// Declaration and FfiConverters for OnGleanEvents Callback Interface + +public protocol OnGleanEvents: AnyObject { + func onInitializeFinished() + func triggerUpload() + func startMetricsPingScheduler() -> Bool + func cancelUploads() +} + +// The ForeignCallback that is passed to Rust. +private let foreignCallbackCallbackInterfaceOnGleanEvents: ForeignCallback = + { (handle: Handle, method: Int32, args: RustBuffer, out_buf: UnsafeMutablePointer) -> Int32 in + func invokeOnInitializeFinished(_ swiftCallbackInterface: OnGleanEvents, _ args: RustBuffer) throws -> RustBuffer { + defer { args.deallocate() } + swiftCallbackInterface.onInitializeFinished() + return RustBuffer() + // TODO: catch errors and report them back to Rust. + // https://github.com/mozilla/uniffi-rs/issues/351 + } + func invokeTriggerUpload(_ swiftCallbackInterface: OnGleanEvents, _ args: RustBuffer) throws -> RustBuffer { + defer { args.deallocate() } + swiftCallbackInterface.triggerUpload() + return RustBuffer() + // TODO: catch errors and report them back to Rust. + // https://github.com/mozilla/uniffi-rs/issues/351 + } + func invokeStartMetricsPingScheduler(_ swiftCallbackInterface: OnGleanEvents, _ args: RustBuffer) throws -> RustBuffer { + defer { args.deallocate() } + let result = swiftCallbackInterface.startMetricsPingScheduler() + let writer = Writer() + FfiConverterBool.write(result, into: writer) + return RustBuffer(bytes: writer.bytes) // TODO: catch errors and report them back to Rust. + // https://github.com/mozilla/uniffi-rs/issues/351 + } + func invokeCancelUploads(_ swiftCallbackInterface: OnGleanEvents, _ args: RustBuffer) throws -> RustBuffer { + defer { args.deallocate() } + swiftCallbackInterface.cancelUploads() + return RustBuffer() + // TODO: catch errors and report them back to Rust. + // https://github.com/mozilla/uniffi-rs/issues/351 + } + + let cb = try! FfiConverterCallbackInterfaceOnGleanEvents.lift(handle) + switch method { + case IDX_CALLBACK_FREE: + FfiConverterCallbackInterfaceOnGleanEvents.drop(handle: handle) + // No return value. + // See docs of ForeignCallback in `uniffi/src/ffi/foreigncallbacks.rs` + return 0 + case 1: + let buffer = try! invokeOnInitializeFinished(cb, args) + out_buf.pointee = buffer + // Value written to out buffer. + // See docs of ForeignCallback in `uniffi/src/ffi/foreigncallbacks.rs` + return 1 + case 2: + let buffer = try! invokeTriggerUpload(cb, args) + out_buf.pointee = buffer + // Value written to out buffer. + // See docs of ForeignCallback in `uniffi/src/ffi/foreigncallbacks.rs` + return 1 + case 3: + let buffer = try! invokeStartMetricsPingScheduler(cb, args) + out_buf.pointee = buffer + // Value written to out buffer. + // See docs of ForeignCallback in `uniffi/src/ffi/foreigncallbacks.rs` + return 1 + case 4: + let buffer = try! invokeCancelUploads(cb, args) + out_buf.pointee = buffer + // Value written to out buffer. + // See docs of ForeignCallback in `uniffi/src/ffi/foreigncallbacks.rs` + return 1 + + // This should never happen, because an out of bounds method index won't + // ever be used. Once we can catch errors, we should return an InternalError. + // https://github.com/mozilla/uniffi-rs/issues/351 + default: + // An unexpected error happened. + // See docs of ForeignCallback in `uniffi/src/ffi/foreigncallbacks.rs` + return -1 + } + } + +// FFIConverter protocol for callback interfaces +private enum FfiConverterCallbackInterfaceOnGleanEvents { + // Initialize our callback method with the scaffolding code + private static var callbackInitialized = false + private static func initCallback() { + try! rustCall { (err: UnsafeMutablePointer) in + ffi_glean_957e_OnGleanEvents_init_callback(foreignCallbackCallbackInterfaceOnGleanEvents, err) + } + } + + private static func ensureCallbackinitialized() { + if !callbackInitialized { + initCallback() + callbackInitialized = true + } + } + + static func drop(handle: Handle) { + handleMap.remove(handle: handle) + } + + private static var handleMap = ConcurrentHandleMap() +} + +extension FfiConverterCallbackInterfaceOnGleanEvents: FfiConverter { + typealias SwiftType = OnGleanEvents + // We can use Handle as the FFIType because it's a typealias to UInt64 + typealias FfiType = Handle + + static func lift(_ handle: Handle) throws -> SwiftType { + ensureCallbackinitialized() + guard let callback = handleMap.get(handle: handle) else { + throw UniffiInternalError.unexpectedStaleHandle + } + return callback + } + + static func read(from buf: Reader) throws -> SwiftType { + ensureCallbackinitialized() + let handle: Handle = try buf.readInt() + return try lift(handle) + } + + static func lower(_ v: SwiftType) -> Handle { + ensureCallbackinitialized() + return handleMap.insert(obj: v) + } + + static func write(_ v: SwiftType, into buf: Writer) { + ensureCallbackinitialized() + buf.writeInt(lower(v)) + } +} + +private struct FfiConverterOptionUInt32: FfiConverterRustBuffer { + typealias SwiftType = UInt32? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterUInt32.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterUInt32.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionInt32: FfiConverterRustBuffer { + typealias SwiftType = Int32? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterInt32.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterInt32.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionInt64: FfiConverterRustBuffer { + typealias SwiftType = Int64? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterInt64.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterInt64.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionBool: FfiConverterRustBuffer { + typealias SwiftType = Bool? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterBool.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterBool.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionString: FfiConverterRustBuffer { + typealias SwiftType = String? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterString.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterString.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionTypeDatetime: FfiConverterRustBuffer { + typealias SwiftType = Datetime? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterTypeDatetime.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeDatetime.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionTypeDistributionData: FfiConverterRustBuffer { + typealias SwiftType = DistributionData? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterTypeDistributionData.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeDistributionData.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionTypeRate: FfiConverterRustBuffer { + typealias SwiftType = Rate? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterTypeRate.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeRate.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionTypeRecordedExperiment: FfiConverterRustBuffer { + typealias SwiftType = RecordedExperiment? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterTypeRecordedExperiment.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterTypeRecordedExperiment.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionSequenceString: FfiConverterRustBuffer { + typealias SwiftType = [String]? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterSequenceString.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterSequenceString.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionSequenceTypeRecordedEvent: FfiConverterRustBuffer { + typealias SwiftType = [RecordedEvent]? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterSequenceTypeRecordedEvent.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterSequenceTypeRecordedEvent.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterOptionDictionaryStringString: FfiConverterRustBuffer { + typealias SwiftType = [String: String]? + + static func write(_ value: SwiftType, into buf: Writer) { + guard let value = value else { + buf.writeInt(Int8(0)) + return + } + buf.writeInt(Int8(1)) + FfiConverterDictionaryStringString.write(value, into: buf) + } + + static func read(from buf: Reader) throws -> SwiftType { + switch try buf.readInt() as Int8 { + case 0: return nil + case 1: return try FfiConverterDictionaryStringString.read(from: buf) + default: throw UniffiInternalError.unexpectedOptionalTag + } + } +} + +private struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { + typealias SwiftType = [UInt8] + + static func write(_ value: [UInt8], into buf: Writer) { + let len = Int32(value.count) + buf.writeInt(len) + for item in value { + FfiConverterUInt8.write(item, into: buf) + } + } + + static func read(from buf: Reader) throws -> [UInt8] { + let len: Int32 = try buf.readInt() + var seq = [UInt8]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterUInt8.read(from: buf)) + } + return seq + } +} + +private struct FfiConverterSequenceInt64: FfiConverterRustBuffer { + typealias SwiftType = [Int64] + + static func write(_ value: [Int64], into buf: Writer) { + let len = Int32(value.count) + buf.writeInt(len) + for item in value { + FfiConverterInt64.write(item, into: buf) + } + } + + static func read(from buf: Reader) throws -> [Int64] { + let len: Int32 = try buf.readInt() + var seq = [Int64]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterInt64.read(from: buf)) + } + return seq + } +} + +private struct FfiConverterSequenceString: FfiConverterRustBuffer { + typealias SwiftType = [String] + + static func write(_ value: [String], into buf: Writer) { + let len = Int32(value.count) + buf.writeInt(len) + for item in value { + FfiConverterString.write(item, into: buf) + } + } + + static func read(from buf: Reader) throws -> [String] { + let len: Int32 = try buf.readInt() + var seq = [String]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterString.read(from: buf)) + } + return seq + } +} + +private struct FfiConverterSequenceTypeCommonMetricData: FfiConverterRustBuffer { + typealias SwiftType = [CommonMetricData] + + static func write(_ value: [CommonMetricData], into buf: Writer) { + let len = Int32(value.count) + buf.writeInt(len) + for item in value { + FfiConverterTypeCommonMetricData.write(item, into: buf) + } + } + + static func read(from buf: Reader) throws -> [CommonMetricData] { + let len: Int32 = try buf.readInt() + var seq = [CommonMetricData]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterTypeCommonMetricData.read(from: buf)) + } + return seq + } +} + +private struct FfiConverterSequenceTypeRecordedEvent: FfiConverterRustBuffer { + typealias SwiftType = [RecordedEvent] + + static func write(_ value: [RecordedEvent], into buf: Writer) { + let len = Int32(value.count) + buf.writeInt(len) + for item in value { + FfiConverterTypeRecordedEvent.write(item, into: buf) + } + } + + static func read(from buf: Reader) throws -> [RecordedEvent] { + let len: Int32 = try buf.readInt() + var seq = [RecordedEvent]() + seq.reserveCapacity(Int(len)) + for _ in 0 ..< len { + seq.append(try FfiConverterTypeRecordedEvent.read(from: buf)) + } + return seq + } +} + +private struct FfiConverterDictionaryInt64Int64: FfiConverterRustBuffer { + fileprivate static func write(_ value: [Int64: Int64], into buf: Writer) { + let len = Int32(value.count) + buf.writeInt(len) + for (key, value) in value { + FfiConverterInt64.write(key, into: buf) + FfiConverterInt64.write(value, into: buf) + } + } + + fileprivate static func read(from buf: Reader) throws -> [Int64: Int64] { + let len: Int32 = try buf.readInt() + var dict = [Int64: Int64]() + dict.reserveCapacity(Int(len)) + for _ in 0 ..< len { + let key = try FfiConverterInt64.read(from: buf) + let value = try FfiConverterInt64.read(from: buf) + dict[key] = value + } + return dict + } +} + +private struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { + fileprivate static func write(_ value: [String: String], into buf: Writer) { + let len = Int32(value.count) + buf.writeInt(len) + for (key, value) in value { + FfiConverterString.write(key, into: buf) + FfiConverterString.write(value, into: buf) + } + } + + fileprivate static func read(from buf: Reader) throws -> [String: String] { + let len: Int32 = try buf.readInt() + var dict = [String: String]() + dict.reserveCapacity(Int(len)) + for _ in 0 ..< len { + let key = try FfiConverterString.read(from: buf) + let value = try FfiConverterString.read(from: buf) + dict[key] = value + } + return dict + } +} + +public func gleanEnableLogging() { + try! + + rustCall { + glean_957e_glean_enable_logging($0) + } +} + +public func gleanEnableLoggingToFd(fd: UInt64) { + try! + + rustCall { + glean_957e_glean_enable_logging_to_fd( + FfiConverterUInt64.lower(fd), $0 + ) + } +} + +public func gleanInitialize(cfg: InternalConfiguration, clientInfo: ClientInfoMetrics, callbacks: OnGleanEvents) { + try! + + rustCall { + glean_957e_glean_initialize( + FfiConverterTypeInternalConfiguration.lower(cfg), + FfiConverterTypeClientInfoMetrics.lower(clientInfo), + FfiConverterCallbackInterfaceOnGleanEvents.lower(callbacks), $0 + ) + } +} + +public func gleanInitializeForSubprocess(cfg: InternalConfiguration) -> Bool { + return try! FfiConverterBool.lift( + try! + + rustCall { + glean_957e_glean_initialize_for_subprocess( + FfiConverterTypeInternalConfiguration.lower(cfg), $0 + ) + } + ) +} + +public func gleanSetUploadEnabled(enabled: Bool) { + try! + + rustCall { + glean_957e_glean_set_upload_enabled( + FfiConverterBool.lower(enabled), $0 + ) + } +} + +public func gleanSetExperimentActive(experimentId: String, branch: String, extra: [String: String]) { + try! + + rustCall { + glean_957e_glean_set_experiment_active( + FfiConverterString.lower(experimentId), + FfiConverterString.lower(branch), + FfiConverterDictionaryStringString.lower(extra), $0 + ) + } +} + +public func gleanSetExperimentInactive(experimentId: String) { + try! + + rustCall { + glean_957e_glean_set_experiment_inactive( + FfiConverterString.lower(experimentId), $0 + ) + } +} + +public func gleanTestGetExperimentData(experimentId: String) -> RecordedExperiment? { + return try! FfiConverterOptionTypeRecordedExperiment.lift( + try! + + rustCall { + glean_957e_glean_test_get_experiment_data( + FfiConverterString.lower(experimentId), $0 + ) + } + ) +} + +public func gleanSetDebugViewTag(tag: String) -> Bool { + return try! FfiConverterBool.lift( + try! + + rustCall { + glean_957e_glean_set_debug_view_tag( + FfiConverterString.lower(tag), $0 + ) + } + ) +} + +public func gleanSetSourceTags(tags: [String]) -> Bool { + return try! FfiConverterBool.lift( + try! + + rustCall { + glean_957e_glean_set_source_tags( + FfiConverterSequenceString.lower(tags), $0 + ) + } + ) +} + +public func gleanSetLogPings(value: Bool) { + try! + + rustCall { + glean_957e_glean_set_log_pings( + FfiConverterBool.lower(value), $0 + ) + } +} + +public func gleanHandleClientActive() { + try! + + rustCall { + glean_957e_glean_handle_client_active($0) + } +} + +public func gleanHandleClientInactive() { + try! + + rustCall { + glean_957e_glean_handle_client_inactive($0) + } +} + +public func gleanSubmitPingByName(pingName: String, reason: String? = nil) { + try! + + rustCall { + glean_957e_glean_submit_ping_by_name( + FfiConverterString.lower(pingName), + FfiConverterOptionString.lower(reason), $0 + ) + } +} + +public func gleanSubmitPingByNameSync(pingName: String, reason: String? = nil) -> Bool { + return try! FfiConverterBool.lift( + try! + + rustCall { + glean_957e_glean_submit_ping_by_name_sync( + FfiConverterString.lower(pingName), + FfiConverterOptionString.lower(reason), $0 + ) + } + ) +} + +public func gleanSetTestMode(enabled: Bool) { + try! + + rustCall { + glean_957e_glean_set_test_mode( + FfiConverterBool.lower(enabled), $0 + ) + } +} + +public func gleanTestDestroyGlean(clearStores: Bool) { + try! + + rustCall { + glean_957e_glean_test_destroy_glean( + FfiConverterBool.lower(clearStores), $0 + ) + } +} + +public func gleanSetDirtyFlag(flag: Bool) { + try! + + rustCall { + glean_957e_glean_set_dirty_flag( + FfiConverterBool.lower(flag), $0 + ) + } +} + +public func gleanGetUploadTask() -> PingUploadTask { + return try! FfiConverterTypePingUploadTask.lift( + try! + + rustCall { + glean_957e_glean_get_upload_task($0) + } + ) +} + +public func gleanProcessPingUploadResponse(uuid: String, result: UploadResult) { + try! + + rustCall { + glean_957e_glean_process_ping_upload_response( + FfiConverterString.lower(uuid), + FfiConverterTypeUploadResult.lower(result), $0 + ) + } +} + +/** + * Top level initializers and tear down methods. + * + * This is generated by uniffi. + */ +public enum GleanLifecycle { + /** + * Initialize the FFI and Rust library. This should be only called once per application. + */ + func initialize() {} +} diff --git a/megazords/ios-rust/ios/Generated/gleanFFI.h b/megazords/ios-rust/ios/Generated/gleanFFI.h new file mode 100644 index 0000000000..5858bf10dc --- /dev/null +++ b/megazords/ios-rust/ios/Generated/gleanFFI.h @@ -0,0 +1,592 @@ +// This file was autogenerated by some hot garbage in the `uniffi` crate. +// Trust me, you don't want to mess with it! + +#pragma once + +#include +#include + +// The following structs are used to implement the lowest level +// of the FFI, and thus useful to multiple uniffied crates. +// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H. +#ifdef UNIFFI_SHARED_H + // We also try to prevent mixing versions of shared uniffi header structs. + // If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V4 + #ifndef UNIFFI_SHARED_HEADER_V4 + #error Combining helper code from multiple versions of uniffi is not supported + #endif // ndef UNIFFI_SHARED_HEADER_V4 +#else +#define UNIFFI_SHARED_H +#define UNIFFI_SHARED_HEADER_V4 +// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ +// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️ + +typedef struct RustBuffer +{ + int32_t capacity; + int32_t len; + uint8_t *_Nullable data; +} RustBuffer; + +typedef int32_t (*ForeignCallback)(uint64_t, int32_t, RustBuffer, RustBuffer *_Nonnull); + +typedef struct ForeignBytes +{ + int32_t len; + const uint8_t *_Nullable data; +} ForeignBytes; + +// Error definitions +typedef struct RustCallStatus { + int8_t code; + RustBuffer errorBuf; +} RustCallStatus; + +// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️ +// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️ +#endif // def UNIFFI_SHARED_H + +void ffi_glean_957e_PingType_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_PingType_new( + RustBuffer name,int8_t include_client_id,int8_t send_if_empty,RustBuffer reason_codes, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_PingType_submit( + void*_Nonnull ptr,RustBuffer reason, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_CounterMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_CounterMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_CounterMetric_add( + void*_Nonnull ptr,int32_t amount, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_CounterMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_CounterMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_TimespanMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_TimespanMetric_new( + RustBuffer meta,RustBuffer time_unit, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_TimespanMetric_start( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_TimespanMetric_stop( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_TimespanMetric_cancel( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_TimespanMetric_set_raw_nanos( + void*_Nonnull ptr,int64_t elapsed, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_TimespanMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_TimespanMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_BooleanMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_BooleanMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_BooleanMetric_set( + void*_Nonnull ptr,int8_t value, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_BooleanMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_BooleanMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_StringMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_StringMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_StringMetric_set( + void*_Nonnull ptr,RustBuffer value, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_StringMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_StringMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_LabeledCounter_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_LabeledCounter_new( + RustBuffer meta,RustBuffer labels, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_LabeledCounter_get( + void*_Nonnull ptr,RustBuffer label, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_LabeledCounter_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_LabeledBoolean_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_LabeledBoolean_new( + RustBuffer meta,RustBuffer labels, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_LabeledBoolean_get( + void*_Nonnull ptr,RustBuffer label, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_LabeledBoolean_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_LabeledString_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_LabeledString_new( + RustBuffer meta,RustBuffer labels, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_LabeledString_get( + void*_Nonnull ptr,RustBuffer label, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_LabeledString_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_StringListMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_StringListMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_StringListMetric_add( + void*_Nonnull ptr,RustBuffer value, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_StringListMetric_set( + void*_Nonnull ptr,RustBuffer value, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_StringListMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_StringListMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_UrlMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_UrlMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_UrlMetric_set( + void*_Nonnull ptr,RustBuffer value, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_UrlMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_UrlMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_UuidMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_UuidMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_UuidMetric_set( + void*_Nonnull ptr,RustBuffer value, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_UuidMetric_generate_and_set( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_UuidMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_UuidMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_QuantityMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_QuantityMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_QuantityMetric_set( + void*_Nonnull ptr,int64_t value, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_QuantityMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_QuantityMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_TimingDistributionMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_TimingDistributionMetric_new( + RustBuffer meta,RustBuffer time_unit, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_TimingDistributionMetric_start( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_TimingDistributionMetric_stop_and_accumulate( + void*_Nonnull ptr,RustBuffer timer_id, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_TimingDistributionMetric_cancel( + void*_Nonnull ptr,RustBuffer timer_id, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_TimingDistributionMetric_accumulate_samples( + void*_Nonnull ptr,RustBuffer samples, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_TimingDistributionMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_TimingDistributionMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_MemoryDistributionMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_MemoryDistributionMetric_new( + RustBuffer meta,RustBuffer memory_unit, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_MemoryDistributionMetric_accumulate( + void*_Nonnull ptr,int64_t sample, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_MemoryDistributionMetric_accumulate_samples( + void*_Nonnull ptr,RustBuffer samples, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_MemoryDistributionMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_MemoryDistributionMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_CustomDistributionMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_CustomDistributionMetric_new( + RustBuffer meta,int64_t range_min,int64_t range_max,int64_t bucket_count,RustBuffer histogram_type, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_CustomDistributionMetric_accumulate_samples( + void*_Nonnull ptr,RustBuffer samples, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_CustomDistributionMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_CustomDistributionMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_DatetimeMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_DatetimeMetric_new( + RustBuffer meta,RustBuffer time_unit, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_DatetimeMetric_set( + void*_Nonnull ptr,RustBuffer value, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_DatetimeMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_DatetimeMetric_test_get_value_as_string( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_DatetimeMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_EventMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_EventMetric_new( + RustBuffer meta,RustBuffer allowed_extra_keys, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_EventMetric_record( + void*_Nonnull ptr,RustBuffer extra, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_EventMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_EventMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_RateMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_RateMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_RateMetric_add_to_numerator( + void*_Nonnull ptr,int32_t amount, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_RateMetric_add_to_denominator( + void*_Nonnull ptr,int32_t amount, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_RateMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_RateMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_DenominatorMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_DenominatorMetric_new( + RustBuffer meta,RustBuffer numerators, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_DenominatorMetric_add( + void*_Nonnull ptr,int32_t amount, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_DenominatorMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_DenominatorMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_NumeratorMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_NumeratorMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_NumeratorMetric_add_to_numerator( + void*_Nonnull ptr,int32_t amount, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_NumeratorMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_NumeratorMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_TextMetric_object_free( + void*_Nonnull ptr, + RustCallStatus *_Nonnull out_status + ); +void*_Nonnull glean_957e_TextMetric_new( + RustBuffer meta, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_TextMetric_set( + void*_Nonnull ptr,RustBuffer value, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_TextMetric_test_get_value( + void*_Nonnull ptr,RustBuffer ping_name, + RustCallStatus *_Nonnull out_status + ); +int32_t glean_957e_TextMetric_test_get_num_recorded_errors( + void*_Nonnull ptr,RustBuffer error, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_OnGleanEvents_init_callback( + ForeignCallback _Nonnull callback_stub, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_enable_logging( + + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_enable_logging_to_fd( + uint64_t fd, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_initialize( + RustBuffer cfg,RustBuffer client_info,uint64_t callbacks, + RustCallStatus *_Nonnull out_status + ); +int8_t glean_957e_glean_initialize_for_subprocess( + RustBuffer cfg, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_set_upload_enabled( + int8_t enabled, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_set_experiment_active( + RustBuffer experiment_id,RustBuffer branch,RustBuffer extra, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_set_experiment_inactive( + RustBuffer experiment_id, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_glean_test_get_experiment_data( + RustBuffer experiment_id, + RustCallStatus *_Nonnull out_status + ); +int8_t glean_957e_glean_set_debug_view_tag( + RustBuffer tag, + RustCallStatus *_Nonnull out_status + ); +int8_t glean_957e_glean_set_source_tags( + RustBuffer tags, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_set_log_pings( + int8_t value, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_handle_client_active( + + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_handle_client_inactive( + + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_submit_ping_by_name( + RustBuffer ping_name,RustBuffer reason, + RustCallStatus *_Nonnull out_status + ); +int8_t glean_957e_glean_submit_ping_by_name_sync( + RustBuffer ping_name,RustBuffer reason, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_set_test_mode( + int8_t enabled, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_test_destroy_glean( + int8_t clear_stores, + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_set_dirty_flag( + int8_t flag, + RustCallStatus *_Nonnull out_status + ); +RustBuffer glean_957e_glean_get_upload_task( + + RustCallStatus *_Nonnull out_status + ); +void glean_957e_glean_process_ping_upload_response( + RustBuffer uuid,RustBuffer result, + RustCallStatus *_Nonnull out_status + ); +RustBuffer ffi_glean_957e_rustbuffer_alloc( + int32_t size, + RustCallStatus *_Nonnull out_status + ); +RustBuffer ffi_glean_957e_rustbuffer_from_bytes( + ForeignBytes bytes, + RustCallStatus *_Nonnull out_status + ); +void ffi_glean_957e_rustbuffer_free( + RustBuffer buf, + RustCallStatus *_Nonnull out_status + ); +RustBuffer ffi_glean_957e_rustbuffer_reserve( + RustBuffer buf,int32_t additional, + RustCallStatus *_Nonnull out_status + ); diff --git a/megazords/ios-rust/ios/Generated/gleanFFI.modulemap b/megazords/ios-rust/ios/Generated/gleanFFI.modulemap new file mode 100644 index 0000000000..75e176f931 --- /dev/null +++ b/megazords/ios-rust/ios/Generated/gleanFFI.modulemap @@ -0,0 +1,6 @@ +// This file was autogenerated by some hot garbage in the `uniffi` crate. +// Trust me, you don't want to mess with it! +module gleanFFI { + header "gleanFFI.h" + export * +} \ No newline at end of file diff --git a/megazords/ios-rust/src/lib.rs b/megazords/ios-rust/src/lib.rs index bea5330966..e979eb15e4 100644 --- a/megazords/ios-rust/src/lib.rs +++ b/megazords/ios-rust/src/lib.rs @@ -8,6 +8,7 @@ pub use autofill; pub use crashtest; pub use fxa_client; +pub use glean_core; pub use logins; pub use nimbus; pub use places; diff --git a/tools/bootstrap_glean_rust.py b/tools/bootstrap_glean_rust.py deleted file mode 100644 index 821ba40f55..0000000000 --- a/tools/bootstrap_glean_rust.py +++ /dev/null @@ -1,39 +0,0 @@ -#!python3 -# Python 3 - -import importlib -import subprocess -import sys -offline = sys.argv[1] == 'offline' -module_name = sys.argv[2] -expected_version = sys.argv[3] -try: - module = importlib.import_module(module_name) -except ImportError: - found_version = None -else: - found_version = getattr(module, '__version__') -if found_version != expected_version: - if not offline: - subprocess.check_call([ - sys.executable, - '-m', - 'pip', - 'install', - '--upgrade', - f'{module_name}=={expected_version}' - ]) - else: - print(f'Using Python environment at {sys.executable},') - print(f'expected glean_parser version {expected_version}, found {found_version}.') - sys.exit(1) -try: - subprocess.check_call([ - sys.executable, - '-m', - module_name - ] + sys.argv[4:]) -except: - # We don't need to show a traceback in this helper script. - # Only the output of the subprocess is interesting. - sys.exit(1) diff --git a/tools/dependency_summary.py b/tools/dependency_summary.py index a27cc4596d..5b929c937a 100755 --- a/tools/dependency_summary.py +++ b/tools/dependency_summary.py @@ -817,6 +817,19 @@ "fixup": "https://raw.githubusercontent.com/hsivonen/encoding_rs/master/COPYRIGHT" } }, + "xshell-macros": { + "license": { + "check": "MIT OR Apache-2.0", + }, + "license_url": { + "check": None, + "fixup": "https://github.com/matklad/xshell/blob/master/LICENSE-APACHE" + }, + "license_file": { + "check": None, + "fixup": "https://raw.githubusercontent.com/matklad/xshell/master/LICENSE-APACHE" + } + }, # The following crates do not have repositories in the package metadata "openssl-macros": { diff --git a/tools/embedded-uniffi-bindgen/Cargo.toml b/tools/embedded-uniffi-bindgen/Cargo.toml index bf817ac926..dd79df111d 100644 --- a/tools/embedded-uniffi-bindgen/Cargo.toml +++ b/tools/embedded-uniffi-bindgen/Cargo.toml @@ -7,4 +7,4 @@ license = "MPL-2.0" [dependencies] anyhow = "1" -uniffi_bindgen = "^0.18" +uniffi_bindgen = "^0.19"