Bug 1812615 - Update to Glean v52.2.0, glean_parser 7.0.0 and UniFFI 0.23. r=chutten,markh,glandium,supply-chain-reviewers

The in-tree UniFFI bindings were regenerated with:

    ./mach uniffi generate

Differential Revision: https://phabricator.services.mozilla.com/D168060
This commit is contained in:
Jan-Erik Rediger 2023-01-31 11:12:05 +00:00
Родитель 2e09707d8a
Коммит 5cd8c5650a
279 изменённых файлов: 6427 добавлений и 4672 удалений

Просмотреть файл

@ -15,6 +15,11 @@ git = "https://github.com/FirefoxGraphics/wpf-gpu-raster"
rev = "a6514854d4518b02f2805719ff6cd74dae7dfde6"
replace-with = "vendored-sources"
[source."https://github.com/bendk/application-services"]
git = "https://github.com/bendk/application-services"
rev = "ecb35df5fc40357c49922f90e86bf4147fa52953"
replace-with = "vendored-sources"
[source."https://github.com/chris-zen/coremidi.git"]
git = "https://github.com/chris-zen/coremidi.git"
rev = "fc68464b5445caf111e41f643a2e69ccce0b4f83"
@ -75,11 +80,6 @@ git = "https://github.com/mozilla-spidermonkey/jsparagus"
rev = "688a6574cf830b4a3adaf9c5d41efc1f7dd4017f"
replace-with = "vendored-sources"
[source."https://github.com/mozilla/application-services"]
git = "https://github.com/mozilla/application-services"
rev = "c6370008f53328529e8bcf06aaa5014dffcd298b"
replace-with = "vendored-sources"
[source."https://github.com/mozilla/audioipc"]
git = "https://github.com/mozilla/audioipc"
rev = "fb7a2b12ced3b43e6a268621989c6191d1ed7e39"
@ -112,7 +112,7 @@ replace-with = "vendored-sources"
[source."https://github.com/mozilla/uniffi-rs.git"]
git = "https://github.com/mozilla/uniffi-rs.git"
rev = "846612a1d4fb5d11e246bf0682da4a499409424c"
rev = "bc7ff8977bf38d0fdd1a458810b14f434d4dc4de"
replace-with = "vendored-sources"
[source."https://github.com/rust-minidump/minidump-writer.git"]

161
Cargo.lock сгенерированный
Просмотреть файл

@ -657,15 +657,16 @@ dependencies = [
[[package]]
name = "cargo_metadata"
version = "0.14.2"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa"
checksum = "982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a"
dependencies = [
"camino",
"cargo-platform",
"semver",
"serde",
"serde_json",
"thiserror",
]
[[package]]
@ -1592,14 +1593,23 @@ dependencies = [
[[package]]
name = "error-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=c6370008f53328529e8bcf06aaa5014dffcd298b#c6370008f53328529e8bcf06aaa5014dffcd298b"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
dependencies = [
"error-support-macros",
"lazy_static",
"log",
"parking_lot 0.12.999",
"uniffi",
"uniffi_build",
"uniffi_macros",
]
[[package]]
name = "error-support-macros"
version = "0.1.0"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -2295,9 +2305,9 @@ dependencies = [
[[package]]
name = "glean"
version = "52.0.1"
version = "52.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b82332dcb52cd5abbcda9728131f105865c94cd68f5c2814c970b685f70547b4"
checksum = "3dea54c0198181ff3bd8c7d39bdc69f22a4c0504da5dd9138666edef084e26be"
dependencies = [
"chrono",
"crossbeam-channel",
@ -2315,15 +2325,14 @@ dependencies = [
[[package]]
name = "glean-core"
version = "52.0.1"
version = "52.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "122d2fe5b0d4cfa163cca9bdc349da07341765ec42a0fca1a5d245d54f80de55"
checksum = "01c3b0c688d31dbe58dd799d771d4ab60d9a20932fa0eac80dbb08f20149f36b"
dependencies = [
"android_logger",
"bincode",
"chrono",
"crossbeam-channel",
"env_logger 0.9.999",
"flate2",
"log",
"once_cell",
@ -2335,10 +2344,7 @@ dependencies = [
"thiserror",
"time 0.1.45",
"uniffi",
"uniffi_build",
"uniffi_macros",
"uuid",
"whatsys",
"zeitstempel",
]
@ -2700,7 +2706,7 @@ dependencies = [
[[package]]
name = "interrupt-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=c6370008f53328529e8bcf06aaa5014dffcd298b#c6370008f53328529e8bcf06aaa5014dffcd298b"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
dependencies = [
"lazy_static",
"parking_lot 0.12.999",
@ -3823,7 +3829,7 @@ dependencies = [
[[package]]
name = "nss_build_common"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=c6370008f53328529e8bcf06aaa5014dffcd298b#c6370008f53328529e8bcf06aaa5014dffcd298b"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
[[package]]
name = "nsstring"
@ -5037,7 +5043,7 @@ dependencies = [
[[package]]
name = "sql-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=c6370008f53328529e8bcf06aaa5014dffcd298b#c6370008f53328529e8bcf06aaa5014dffcd298b"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
dependencies = [
"ffi-support",
"interrupt-support",
@ -5219,7 +5225,7 @@ dependencies = [
[[package]]
name = "sync-guid"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=c6370008f53328529e8bcf06aaa5014dffcd298b#c6370008f53328529e8bcf06aaa5014dffcd298b"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
dependencies = [
"base64",
"rand 0.8.5",
@ -5230,7 +5236,7 @@ dependencies = [
[[package]]
name = "sync15"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=c6370008f53328529e8bcf06aaa5014dffcd298b#c6370008f53328529e8bcf06aaa5014dffcd298b"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
dependencies = [
"anyhow",
"error-support",
@ -5260,7 +5266,7 @@ dependencies = [
[[package]]
name = "tabs"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=c6370008f53328529e8bcf06aaa5014dffcd298b#c6370008f53328529e8bcf06aaa5014dffcd298b"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
dependencies = [
"anyhow",
"error-support",
@ -5276,8 +5282,6 @@ dependencies = [
"sync15",
"thiserror",
"uniffi",
"uniffi_build",
"uniffi_macros",
"url",
]
@ -5783,19 +5787,13 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "uniffi"
version = "0.21.1"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b983553c0d1ad73547c65fa0c399aa800bee4a70ad330198e1c7a523212da5ee"
checksum = "f71cc01459bc34cfe43fabf32b39f1228709bc6db1b3a664a92940af3d062376"
dependencies = [
"anyhow",
"bytes 1.3.0",
"camino",
"cargo_metadata",
"log",
"once_cell",
"paste",
"static_assertions",
"uniffi_bindgen",
"uniffi_build",
"uniffi_core",
"uniffi_macros",
]
@ -5811,18 +5809,17 @@ dependencies = [
"heck",
"serde",
"toml",
"uniffi",
"uniffi_bindgen",
]
[[package]]
name = "uniffi-example-arithmetic"
version = "0.21.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=846612a1d4fb5d11e246bf0682da4a499409424c#846612a1d4fb5d11e246bf0682da4a499409424c"
version = "0.22.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=bc7ff8977bf38d0fdd1a458810b14f434d4dc4de#bc7ff8977bf38d0fdd1a458810b14f434d4dc4de"
dependencies = [
"thiserror",
"uniffi",
"uniffi_build",
"uniffi_macros",
]
[[package]]
@ -5833,51 +5830,41 @@ dependencies = [
"bytes 1.3.0",
"serde_json",
"uniffi",
"uniffi_build",
"uniffi_macros",
"url",
]
[[package]]
name = "uniffi-example-geometry"
version = "0.21.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=846612a1d4fb5d11e246bf0682da4a499409424c#846612a1d4fb5d11e246bf0682da4a499409424c"
version = "0.22.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=bc7ff8977bf38d0fdd1a458810b14f434d4dc4de#bc7ff8977bf38d0fdd1a458810b14f434d4dc4de"
dependencies = [
"uniffi",
"uniffi_build",
"uniffi_macros",
]
[[package]]
name = "uniffi-example-rondpoint"
version = "0.21.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=846612a1d4fb5d11e246bf0682da4a499409424c#846612a1d4fb5d11e246bf0682da4a499409424c"
version = "0.22.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=bc7ff8977bf38d0fdd1a458810b14f434d4dc4de#bc7ff8977bf38d0fdd1a458810b14f434d4dc4de"
dependencies = [
"uniffi",
"uniffi_build",
"uniffi_macros",
]
[[package]]
name = "uniffi-example-sprites"
version = "0.21.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=846612a1d4fb5d11e246bf0682da4a499409424c#846612a1d4fb5d11e246bf0682da4a499409424c"
version = "0.22.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=bc7ff8977bf38d0fdd1a458810b14f434d4dc4de#bc7ff8977bf38d0fdd1a458810b14f434d4dc4de"
dependencies = [
"uniffi",
"uniffi_build",
"uniffi_macros",
]
[[package]]
name = "uniffi-example-todolist"
version = "0.21.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=846612a1d4fb5d11e246bf0682da4a499409424c#846612a1d4fb5d11e246bf0682da4a499409424c"
version = "0.22.0"
source = "git+https://github.com/mozilla/uniffi-rs.git?rev=bc7ff8977bf38d0fdd1a458810b14f434d4dc4de#bc7ff8977bf38d0fdd1a458810b14f434d4dc4de"
dependencies = [
"once_cell",
"thiserror",
"uniffi",
"uniffi_build",
"uniffi_macros",
]
[[package]]
@ -5886,8 +5873,6 @@ version = "0.21.0"
dependencies = [
"thiserror",
"uniffi",
"uniffi_build",
"uniffi_macros",
]
[[package]]
@ -5897,20 +5882,20 @@ dependencies = [
"thiserror",
"uniffi",
"uniffi-example-geometry",
"uniffi_build",
"uniffi_macros",
]
[[package]]
name = "uniffi_bindgen"
version = "0.21.1"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbbba5103051c18f10b22f80a74439ddf7100273f217a547005d2735b2498994"
dependencies = [
"anyhow",
"askama",
"bincode",
"camino",
"clap",
"fs-err",
"glob",
"goblin",
"heck",
"once_cell",
@ -5919,14 +5904,15 @@ dependencies = [
"serde_json",
"toml",
"uniffi_meta",
"uniffi_testing",
"weedle2",
]
[[package]]
name = "uniffi_build"
version = "0.21.1"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d035e50433ee3d52ab0dcdcf3b9b26f2cc2ec39294b3c07d95865a518709455f"
checksum = "0ee1a28368ff3d83717e3d3e2e15a66269c43488c3f036914131bb68892f29fb"
dependencies = [
"anyhow",
"camino",
@ -5935,19 +5921,35 @@ dependencies = [
[[package]]
name = "uniffi_checksum_derive"
version = "0.21.1"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b6e16d46caf942016997af8bbdf4b163bf8ae3deb0b667d9643de7b7ffd4c9"
checksum = "03de61393a42b4ad4984a3763c0600594ac3e57e5aaa1d05cede933958987c03"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "uniffi_macros"
version = "0.21.1"
name = "uniffi_core"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c96a574677566f83ea8458dac1dd7792fd63e7c3f9dbcd865f0e8d6f8057b127"
checksum = "7a2b4852d638d74ca2d70e450475efb6d91fe6d54a7cd8d6bd80ad2ee6cd7daa"
dependencies = [
"anyhow",
"bytes 1.3.0",
"camino",
"cargo_metadata",
"log",
"once_cell",
"paste",
"static_assertions",
]
[[package]]
name = "uniffi_macros"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa03394de21e759e0022f1ea8d992d2e39290d735b9ed52b1f74b20a684f794e"
dependencies = [
"bincode",
"camino",
@ -5964,15 +5966,30 @@ dependencies = [
[[package]]
name = "uniffi_meta"
version = "0.21.1"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "729835442da829c9b6f7c111c76cf87b2498e129101203bec94f0c39a3296a38"
checksum = "66fdab2c436aed7a6391bec64204ec33948bfed9b11b303235740771f85c4ea6"
dependencies = [
"serde",
"siphasher",
"uniffi_checksum_derive",
]
[[package]]
name = "uniffi_testing"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92b0570953ec41d97ce23e3b92161ac18231670a1f97523258a6d2ab76d7f76c"
dependencies = [
"anyhow",
"camino",
"cargo_metadata",
"fs-err",
"once_cell",
"serde",
"serde_json",
]
[[package]]
name = "unix_path"
version = "1.0.1"
@ -6023,7 +6040,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "viaduct"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=c6370008f53328529e8bcf06aaa5014dffcd298b#c6370008f53328529e8bcf06aaa5014dffcd298b"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
dependencies = [
"ffi-support",
"log",
@ -6179,7 +6196,7 @@ dependencies = [
[[package]]
name = "webext-storage"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=c6370008f53328529e8bcf06aaa5014dffcd298b#c6370008f53328529e8bcf06aaa5014dffcd298b"
source = "git+https://github.com/bendk/application-services?rev=ecb35df5fc40357c49922f90e86bf4147fa52953#ecb35df5fc40357c49922f90e86bf4147fa52953"
dependencies = [
"error-support",
"ffi-support",
@ -6417,9 +6434,9 @@ dependencies = [
[[package]]
name = "whatsys"
version = "0.1.2"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c24fff5aa1e0973964ba23a995e8b10fa2cdeae507e0cbbbd36f8403242a765d"
checksum = "bb632c0076024630111a08ca9fcbd34736c80d10b9ae517077487b0c82f46a36"
dependencies = [
"cc",
"cfg-if 1.0.0",

Просмотреть файл

@ -47,6 +47,10 @@ exclude = [
# This is required for 'third_party/rust/wgpu-hal'
resolver = "2"
[workspace.dependencies]
# Shared across multiple UniFFI consumers.
uniffi = "0.23"
# Explicitly specify what our profiles use. The opt-level setting here is
# a total fiction; see the setup of MOZ_RUST_DEFAULT_FLAGS for what the
# opt-level setting will be as a result of various other configure flags.
@ -164,31 +168,21 @@ warp = { git = "https://github.com/glandium/warp", rev = "4af45fae95bc98b0eba1ef
cssparser = { git = "https://github.com/servo/rust-cssparser", rev = "d3670a89bae26ba3a8db4758eb7976616113987d" }
# application-services overrides to make updating them all simpler.
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "c6370008f53328529e8bcf06aaa5014dffcd298b" }
sql-support = { git = "https://github.com/mozilla/application-services", rev = "c6370008f53328529e8bcf06aaa5014dffcd298b" }
sync15 = { git = "https://github.com/mozilla/application-services", rev = "c6370008f53328529e8bcf06aaa5014dffcd298b" }
tabs = { git = "https://github.com/mozilla/application-services", rev = "c6370008f53328529e8bcf06aaa5014dffcd298b" }
viaduct = { git = "https://github.com/mozilla/application-services", rev = "c6370008f53328529e8bcf06aaa5014dffcd298b" }
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "c6370008f53328529e8bcf06aaa5014dffcd298b" }
interrupt-support = { git = "https://github.com/bendk/application-services", rev = "ecb35df5fc40357c49922f90e86bf4147fa52953" }
sql-support = { git = "https://github.com/bendk/application-services", rev = "ecb35df5fc40357c49922f90e86bf4147fa52953" }
sync15 = { git = "https://github.com/bendk/application-services", rev = "ecb35df5fc40357c49922f90e86bf4147fa52953" }
tabs = { git = "https://github.com/bendk/application-services", rev = "ecb35df5fc40357c49922f90e86bf4147fa52953" }
viaduct = { git = "https://github.com/bendk/application-services", rev = "ecb35df5fc40357c49922f90e86bf4147fa52953" }
webext-storage = { git = "https://github.com/bendk/application-services", rev = "ecb35df5fc40357c49922f90e86bf4147fa52953" }
# Patch mio 0.6 to use winapi 0.3 and miow 0.3, getting rid of winapi 0.2.
# There is not going to be new version of mio 0.6, mio now being >= 0.7.11.
[patch.crates-io.mio]
path = "third_party/rust/mio-0.6.23"
# These are used to test UniFFI functionality. We haven't figured out how we
# want to publish these yet, so they are only accessible via git. This works
# okay, but it means that their dependencies on UniFFI crates will normally
# also be the git versions. Patch them to use the published versions to avoid
# duplicate crates.
[patch."https://github.com/mozilla/uniffi-rs.git"]
uniffi = "=0.21.1"
#uniffi_bindgen = "=0.21.1"
uniffi_build = "=0.21.1"
uniffi_macros = "=0.21.1"
uniffi = "=0.23.0"
uniffi_bindgen = "=0.23.0"
uniffi_build = "=0.23.0"
uniffi_macros = "=0.23.0"
weedle2 = "=4.0.0"
# Patched to use uniffi_version = 0.21.0 for checksums and with
# https://github.com/mozilla/uniffi-rs/pull/1405
[patch.crates-io.uniffi_bindgen]
path = "third_party/rust/uniffi_bindgen"

Просмотреть файл

@ -36,7 +36,7 @@ allprojects {
topsrcdir = gradle.mozconfig.topsrcdir
topobjdir = gradle.mozconfig.topobjdir
gleanVersion = "52.0.1"
gleanVersion = "52.2.0"
if (gleanVersion != getRustVersionFor("glean")) {
throw new StopExecutionException("Mismatched Glean version, expected: ${gleanVersion}," +
" found ${getRustVersionFor("glean")}")

205
gfx/wr/Cargo.lock сгенерированный
Просмотреть файл

@ -229,15 +229,16 @@ dependencies = [
[[package]]
name = "cargo_metadata"
version = "0.14.2"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa"
checksum = "982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a"
dependencies = [
"camino",
"cargo-platform",
"semver",
"serde",
"serde_json",
"thiserror",
]
[[package]]
@ -292,29 +293,14 @@ checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"clap_lex",
"indexmap",
"lazy_static",
"strsim",
"termcolor",
"textwrap",
"yaml-rust",
]
[[package]]
name = "clap_derive"
version = "3.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.2.0"
@ -859,9 +845,9 @@ dependencies = [
[[package]]
name = "glean"
version = "52.0.1"
version = "52.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b82332dcb52cd5abbcda9728131f105865c94cd68f5c2814c970b685f70547b4"
checksum = "3dea54c0198181ff3bd8c7d39bdc69f22a4c0504da5dd9138666edef084e26be"
dependencies = [
"chrono",
"crossbeam-channel",
@ -879,15 +865,14 @@ dependencies = [
[[package]]
name = "glean-core"
version = "52.0.1"
version = "52.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "122d2fe5b0d4cfa163cca9bdc349da07341765ec42a0fca1a5d245d54f80de55"
checksum = "01c3b0c688d31dbe58dd799d771d4ab60d9a20932fa0eac80dbb08f20149f36b"
dependencies = [
"android_logger",
"bincode",
"chrono",
"crossbeam-channel",
"env_logger",
"flate2",
"log",
"once_cell",
@ -899,13 +884,16 @@ dependencies = [
"thiserror",
"time",
"uniffi",
"uniffi_build",
"uniffi_macros",
"uuid",
"whatsys",
"zeitstempel",
]
[[package]]
name = "glob"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "glsl"
version = "6.0.1"
@ -999,9 +987,9 @@ dependencies = [
[[package]]
name = "goblin"
version = "0.5.4"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7666983ed0dd8d21a6f6576ee00053ca0926fb281a5522577a4dbd0f1b54143"
checksum = "572564d6cba7d09775202c8e7eebc4d534d5ae36578ab402fb21e182a0ac9505"
dependencies = [
"log",
"plain",
@ -1673,30 +1661,6 @@ dependencies = [
"toml",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.36"
@ -1989,6 +1953,12 @@ dependencies = [
"libc",
]
[[package]]
name = "siphasher"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
[[package]]
name = "smallvec"
version = "1.10.0"
@ -2091,18 +2061,18 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "thiserror"
version = "1.0.30"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.30"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [
"proc-macro2",
"quote",
@ -2200,9 +2170,66 @@ checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
[[package]]
name = "uniffi"
version = "0.21.0"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f54af5ada67d1173457a99a7bb44a7917f63e7466764cb4714865c7a6678b830"
checksum = "f71cc01459bc34cfe43fabf32b39f1228709bc6db1b3a664a92940af3d062376"
dependencies = [
"anyhow",
"uniffi_build",
"uniffi_core",
"uniffi_macros",
]
[[package]]
name = "uniffi_bindgen"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbbba5103051c18f10b22f80a74439ddf7100273f217a547005d2735b2498994"
dependencies = [
"anyhow",
"askama",
"bincode",
"camino",
"fs-err",
"glob",
"goblin",
"heck",
"once_cell",
"paste",
"serde",
"serde_json",
"toml",
"uniffi_meta",
"uniffi_testing",
"weedle2",
]
[[package]]
name = "uniffi_build"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1a28368ff3d83717e3d3e2e15a66269c43488c3f036914131bb68892f29fb"
dependencies = [
"anyhow",
"camino",
"uniffi_bindgen",
]
[[package]]
name = "uniffi_checksum_derive"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03de61393a42b4ad4984a3763c0600594ac3e57e5aaa1d05cede933958987c03"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "uniffi_core"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2b4852d638d74ca2d70e450475efb6d91fe6d54a7cd8d6bd80ad2ee6cd7daa"
dependencies = [
"anyhow",
"bytes",
@ -2212,48 +2239,13 @@ dependencies = [
"once_cell",
"paste",
"static_assertions",
"uniffi_macros",
]
[[package]]
name = "uniffi_bindgen"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12cc4af3c0180c7e86c4a3acf2b6587af04ba2567b1e948993df10f421796621"
dependencies = [
"anyhow",
"askama",
"bincode",
"camino",
"clap",
"fs-err",
"goblin",
"heck",
"once_cell",
"paste",
"serde",
"serde_json",
"toml",
"uniffi_meta",
"weedle2",
]
[[package]]
name = "uniffi_build"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "510287c368a9386eb731ebe824a6fc6c82a105e20d020af1aa20519c1c1561db"
dependencies = [
"anyhow",
"camino",
"uniffi_bindgen",
]
[[package]]
name = "uniffi_macros"
version = "0.21.0"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c8604503caa2cbcf271578dc51ca236d40e3b22e1514ffa2e638e2c39f6ad10"
checksum = "fa03394de21e759e0022f1ea8d992d2e39290d735b9ed52b1f74b20a684f794e"
dependencies = [
"bincode",
"camino",
@ -2270,11 +2262,28 @@ dependencies = [
[[package]]
name = "uniffi_meta"
version = "0.21.0"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd9417cc653937681436b93838d8c5f97a5b8c58697813982ee8810bd1dc3b57"
checksum = "66fdab2c436aed7a6391bec64204ec33948bfed9b11b303235740771f85c4ea6"
dependencies = [
"serde",
"siphasher",
"uniffi_checksum_derive",
]
[[package]]
name = "uniffi_testing"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92b0570953ec41d97ce23e3b92161ac18231670a1f97523258a6d2ab76d7f76c"
dependencies = [
"anyhow",
"camino",
"cargo_metadata",
"fs-err",
"once_cell",
"serde",
"serde_json",
]
[[package]]
@ -2566,9 +2575,9 @@ dependencies = [
[[package]]
name = "whatsys"
version = "0.1.2"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c24fff5aa1e0973964ba23a995e8b10fa2cdeae507e0cbbbd36f8403242a765d"
checksum = "5a48baa5192a81e347fbaae5f5e50bc27955ef084fc0fda5ccb1f8f9aecd73c9"
dependencies = [
"cc",
"cfg-if 1.0.0",

Просмотреть файл

@ -52,7 +52,7 @@ svg_fmt = "0.4"
tracy-rs = "0.1.2"
derive_more = { version = "0.99", default-features = false, features = ["add_assign"] }
etagere = "0.2.6"
glean = "52.0.1"
glean = "52.2.0"
firefox-on-glean = { version = "0.1.0", optional = true }
swgl = { path = "../swgl", optional = true }
topological-sort = "0.1"

Просмотреть файл

@ -136,7 +136,7 @@ pth:xpcom/geckoprocesstypes_generator
pth:xpcom/idl-parser
# glean-sdk may not be installable if a wheel isn't available
# and it has to be built from source.
pypi-optional:glean-sdk==52.0.1:telemetry will not be collected
pypi-optional:glean-sdk==52.2.0:telemetry will not be collected
# Mach gracefully handles the case where `psutil` is unavailable.
# We aren't (yet) able to pin packages in automation, so we have to
# support down to the oldest locally-installed version (5.4.2).

Просмотреть файл

@ -232,6 +232,12 @@ who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"
delta = "1.0.9 -> 1.1.1"
[[audits.cargo_metadata]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
version = "0.15.2"
notes = "I reviewed the whole code base. Parser for the output of cargo-metadata, relying mostly on serde. No unsafe code used."
[[audits.chardetng]]
who = "Henri Sivonen <hsivonen@hsivonen.fi>"
criteria = "safe-to-deploy"
@ -905,6 +911,12 @@ criteria = "safe-to-deploy"
delta = "52.0.0 -> 52.0.1"
notes = "Maintained by the Glean team at Mozilla"
[[audits.glean]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "52.0.1 -> 52.2.0"
notes = "Maintained by the Glean team at Mozilla"
[[audits.glean-core]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
@ -988,6 +1000,12 @@ criteria = "safe-to-deploy"
delta = "52.0.0 -> 52.0.1"
notes = "Maintained by the Glean team at Mozilla"
[[audits.glean-core]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "52.0.1 -> 52.2.0"
notes = "Maintained by the Glean team at Mozilla"
[[audits.goblin]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
@ -2279,6 +2297,12 @@ criteria = "safe-to-deploy"
delta = "0.21.0 -> 0.21.1"
notes = "No changes."
[[audits.uniffi]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.21.1 -> 0.23.0"
notes = "Maintained by the Glean and Application Services team."
[[audits.uniffi_bindgen]]
who = "Travis Long <tlong@mozilla.com>"
criteria = "safe-to-deploy"
@ -2308,6 +2332,12 @@ criteria = "safe-to-deploy"
delta = "0.21.0 -> 0.21.1"
notes = "I authored the changes in this version."
[[audits.uniffi_bindgen]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.21.1 -> 0.23.0"
notes = "Maintained by the Glean and Application Services team."
[[audits.uniffi_build]]
who = "Travis Long <tlong@mozilla.com>"
criteria = "safe-to-deploy"
@ -2337,12 +2367,30 @@ criteria = "safe-to-deploy"
delta = "0.21.0 -> 0.21.1"
notes = "No changes."
[[audits.uniffi_build]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.21.1 -> 0.23.0"
notes = "Maintained by the Glean and Application Services team."
[[audits.uniffi_checksum_derive]]
who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"
version = "0.21.1"
notes = "I authored this crate."
[[audits.uniffi_checksum_derive]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.21.1 -> 0.23.0"
notes = "Maintained by the Glean and Application Services team."
[[audits.uniffi_core]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
version = "0.23.0"
notes = "Maintained by the Glean and Application Services teams."
[[audits.uniffi_macros]]
who = "Travis Long <tlong@mozilla.com>"
criteria = "safe-to-deploy"
@ -2372,6 +2420,12 @@ criteria = "safe-to-deploy"
delta = "0.21.0 -> 0.21.1"
notes = "No changes."
[[audits.uniffi_macros]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.21.1 -> 0.23.0"
notes = "Maintained by the Glean and Application Services team."
[[audits.uniffi_meta]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
@ -2395,6 +2449,18 @@ criteria = "safe-to-deploy"
delta = "0.21.0 -> 0.21.1"
notes = "I authored the changes in this version."
[[audits.uniffi_meta]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.21.1 -> 0.23.0"
notes = "Maintained by the Glean and Application Services team."
[[audits.uniffi_testing]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
version = "0.23.0"
notes = "Maintained by the Glean and Application Services team."
[[audits.uuid]]
who = "Gabriele Svelto <gsvelto@mozilla.com>"
criteria = "safe-to-deploy"
@ -2643,6 +2709,12 @@ also contains a small C file compiled at build-time. I audited all of it and it
looks correct.
"""
[[audits.whatsys]]
who = "Jan-Erik Rediger <jrediger@mozilla.com>"
criteria = "safe-to-deploy"
delta = "0.1.2 -> 0.3.1"
notes = "Maintained by me. I have written or reviewed all of the code."
[[audits.winreg]]
who = "Ray Kraesig <rkraesig@mozilla.com>"
criteria = "safe-to-run"

Просмотреть файл

@ -162,10 +162,6 @@ notes = "This is a first-party crate which is entirely unrelated to the crates.i
audit-as-crates-io = false
notes = "This is a first-party crate, maintained by the appservices team, which is entirely unrelated to the crates.io package of the same name."
[policy.uniffi_bindgen]
audit-as-crates-io = false
notes = "This is a first-party crate, normally vendored, but currently patched in-tree until next update."
[policy.viaduct]
audit-as-crates-io = false
notes = "This is a first-party crate, maintained by the appservices team, which is entirely unrelated to the crates.io package of the same name."
@ -299,10 +295,6 @@ criteria = "safe-to-deploy"
version = "0.1.2"
criteria = "safe-to-deploy"
[[exemptions.cargo_metadata]]
version = "0.14.2"
criteria = "safe-to-deploy"
[[exemptions.cexpr]]
version = "0.6.0"
criteria = "safe-to-deploy"

Просмотреть файл

@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: glean-parser
Version: 6.4.0
Version: 7.0.0
Summary: Parser tools for Mozilla's Glean telemetry
Home-page: https://github.com/mozilla/glean_parser
Author: The Glean Team
@ -8,7 +8,7 @@ Author-email: glean-team@mozilla.com
License: UNKNOWN
Keywords: glean_parser
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Description-Content-Type: text/markdown
Requires-Dist: appdirs (>=1.4)
Requires-Dist: Click (>=7)
@ -86,6 +87,15 @@ $ glean_parser check < ping.json
## Unreleased
## 7.0.0
- BUGFIX: Remove internal-only fields from serialized metrics data ([#550](https://github.com/mozilla/glean_parser/pull/550))
- FEATURE: New subcommand: `dump` to dump the metrics data as JSON ([#550](https://github.com/mozilla/glean_parser/pull/550))
- BUGFIX: Kotlin: Generate enums with the right generic bound for ping reason codes ([#551](https://github.com/mozilla/glean_parser/pull/551)).
- **BREAKING CHANGE:** Fully remove support for the old events API ([#549](https://github.com/mozilla/glean_parser/pull/549))
Adds a new lint `OLD_EVENT_API` to warn about missing `type` attributes on event extra keys.
Note that the Glean SDK already dropped support for the old events API.
## 6.4.0
- BUGFIX: Correct code generation for labeled metrics in Rust ([#533](https://github.com/mozilla/glean_parser/pull/533))

Просмотреть файл

@ -1,16 +1,16 @@
glean_parser/__init__.py,sha256=bJljD052_0y-efcBhYpllICVCXOMHLcXRLNyrvfgt5A,533
glean_parser/__main__.py,sha256=ZrmFSG6rJfs_bnXOSb-3b7_Bega-CmhE3SZgWO3G3_E,7066
glean_parser/__main__.py,sha256=7kIBMO-kL7boJxYrKp3CkRr4xX4_ct4BqCiCvtg2jjU,8631
glean_parser/coverage.py,sha256=2IwC4XMDtDamMkBFoYilmqJzW4gyypq65YVCur8SNas,4405
glean_parser/data_review.py,sha256=BweeeTkNNS6HrIDkztawhbDByrk_-Avxpg7YeST3VAs,2152
glean_parser/javascript.py,sha256=w4ZhNBHBKWYk0h3t7G0Ud2tR__hRqzn9dlEXNKLdQrA,11230
glean_parser/kotlin.py,sha256=kMCpULsg_LTx4UI1HMtRXtkA3YtEruqtvfOIauMlO74,13271
glean_parser/lint.py,sha256=Fl0taRjo8ibOtVrauxshR7PduLEY67yGxInzvo9Ahfw,17098
glean_parser/kotlin.py,sha256=5z8_74xlqvHDsedwZhGf1_qb7swPEgIZumkJIuj3ef8,12598
glean_parser/lint.py,sha256=UhVy_9fQ0eAZJXJu7-ZE83DtmamMzHDrkxcU0Vc1CFs,17638
glean_parser/markdown.py,sha256=GkCr1CrV6mnRQseT6FO1-JJ7Eup8X3lxUfRMBTxXpe4,9066
glean_parser/metrics.py,sha256=hu_tXhAGTLUss-AklwUgMdfre_oW37h_8J26UUQ_4l8,12645
glean_parser/parser.py,sha256=pcgB0gRnmXWCPqNHqQf67mAS6DrD89tMpi4oxjQC4k4,15749
glean_parser/metrics.py,sha256=CSad9CbUWKF771Z82LhBAFAL9uXum0ycRwIHtl_i91E,12384
glean_parser/parser.py,sha256=JUXFVaVEQC448tuktF8B0hxRpjY170h_CmbwG_Cf-ag,15277
glean_parser/pings.py,sha256=yh_DzRAI9k2_NiCIlpQiNg-ggVrttB4hk7gwtKlr72s,2815
glean_parser/rust.py,sha256=9umG_JVap-WVEIEGqX3wT-47lp0o7og_6VkbjpUFNaY,6805
glean_parser/swift.py,sha256=0ncUjywXLqhCNta1qkzxb8PoVCmWi47UedCvb7bkdLc,9062
glean_parser/rust.py,sha256=PJzTfYWzAumJYCP5IYPc6fhS_Qa30Q8NTK9plg3sDnk,6744
glean_parser/swift.py,sha256=T1BSGahd9wUd6VDeNC89SdN6M34jKXDlydMpSI0QLOs,8379
glean_parser/tags.py,sha256=bemKYvcbMO4JrghiNSe-A4BNNDtx_FlUPkgrPPJy84Y,1391
glean_parser/translate.py,sha256=4mHMtRjOusbFNvS7-zibKg6zE_qCRmpjWh6GjwaabSo,7964
glean_parser/translation_options.py,sha256=Lxzr6G7MP0tC_ZYlZXftS4j0SLiqO-5mGVTEc7ggXis,2037
@ -26,15 +26,15 @@ glean_parser/templates/javascript.buildinfo.jinja2,sha256=4mXiZCQIk9if4lxlA05kpS
glean_parser/templates/javascript.jinja2,sha256=cT_bG-jC6m4afECXmcsqHwiiHjRuVtJnfv90OD2Mwxw,2669
glean_parser/templates/kotlin.buildinfo.jinja2,sha256=X0lk2SNu5OIIj2i6mUyF9CWFQIonLgfqkgT5fA-5G6c,920
glean_parser/templates/kotlin.geckoview.jinja2,sha256=MJOgtoDXmBjE9pwk-G6T89y36RZuMbDWM_-DBN_gFJo,5099
glean_parser/templates/kotlin.jinja2,sha256=h6RaxhGwh1G1NVqhGb4l2Jtl2orhyf8iFL-Cj3qb6lk,5162
glean_parser/templates/kotlin.jinja2,sha256=3DqUMXJRkmTvSp_5IRyvGmw5iXYWdox7coMFe3YDxcc,5247
glean_parser/templates/markdown.jinja2,sha256=vAHHGGm28HRDPd3zO_wQMAUZIuxE9uQ7hl3NpXxcKV4,3425
glean_parser/templates/qmldir.jinja2,sha256=m6IGsp-tgTiOfQ7VN8XW6GqX0gJqJkt3B6Pkaul6FVo,156
glean_parser/templates/rust.jinja2,sha256=3X4JNVVz2KLhFXTsCg8LQ9JL_dopi7P-yhZcir7-dTw,11104
glean_parser/templates/swift.jinja2,sha256=yfv1qJLrfR2cc3t35fFPgveuuATBjg1Hge-3ka5rpFc,5270
glean_parser-6.4.0.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455
glean_parser-6.4.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
glean_parser-6.4.0.dist-info/METADATA,sha256=KCIe8KhuFNZ6K6HSTvLerHhAylYwBLxCK1AHptxKgoc,27009
glean_parser-6.4.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
glean_parser-6.4.0.dist-info/entry_points.txt,sha256=s-clJTIqp-PpJD-n3AnIQZFkTafIrzsTbAPX9vNY018,69
glean_parser-6.4.0.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13
glean_parser-6.4.0.dist-info/RECORD,,
glean_parser/templates/rust.jinja2,sha256=tznLKaZxi_Z9puGqDKD0uuWefZcVHiNdQHB4BP9zJfs,10797
glean_parser/templates/swift.jinja2,sha256=OsaEIlEdcOrUMvI_UzbxWv75lluTAWZGncH_pU-pbZQ,4809
glean_parser-7.0.0.dist-info/AUTHORS.md,sha256=yxgj8MioO4wUnrh0gmfb8l3DJJrf-l4HmmEDbQsbbNI,455
glean_parser-7.0.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
glean_parser-7.0.0.dist-info/METADATA,sha256=9prq1WrdB0qdruA1PU-f94aWStO7T97kdF2HSozhc7E,27770
glean_parser-7.0.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
glean_parser-7.0.0.dist-info/entry_points.txt,sha256=s-clJTIqp-PpJD-n3AnIQZFkTafIrzsTbAPX9vNY018,69
glean_parser-7.0.0.dist-info/top_level.txt,sha256=q7T3duD-9tYZFyDry6Wv2LcdMsK2jGnzdDFhxWcT2Z8,13
glean_parser-7.0.0.dist-info/RECORD,,

Просмотреть файл

@ -6,11 +6,13 @@
"""Console script for glean_parser."""
import datetime
import io
from pathlib import Path
import sys
import click
import json
import glean_parser
@ -180,6 +182,67 @@ def glinter(input, allow_reserved, allow_missing_files, require_tags):
)
@click.command()
@click.argument(
"input",
type=click.Path(exists=True, dir_okay=False, file_okay=True, readable=True),
nargs=-1,
)
@click.option(
"--allow-reserved",
is_flag=True,
help=(
"If provided, allow the use of reserved fields. "
"Should only be set when building the Glean library itself."
),
)
@click.option(
"--allow-missing-files",
is_flag=True,
help=("Do not treat missing input files as an error."),
)
@click.option(
"--require-tags",
is_flag=True,
help=("Require tags to be specified for metrics and pings."),
)
def dump(input, allow_reserved, allow_missing_files, require_tags):
"""
Dump the list of metrics/pings as JSON to stdout.
"""
results = glean_parser.parser.parse_objects(
[Path(x) for x in input],
{
"allow_reserved": allow_reserved,
"allow_missing_files": allow_missing_files,
"require_tags": require_tags,
},
)
errs = list(results)
assert len(errs) == 0
metrics = {
metric.identifier(): metric.serialize()
for category, probes in results.value.items()
for probe_name, metric in probes.items()
}
def date_serializer(o):
if isinstance(o, datetime.datetime):
return o.isoformat()
print(
json.dumps(
metrics,
sort_keys=True,
indent=2,
separators=(",", ": "),
default=date_serializer,
)
)
@click.command()
@click.option(
"-c",
@ -261,6 +324,7 @@ def main(args=None):
main.add_command(translate)
main.add_command(check)
main.add_command(glinter)
main.add_command(dump)
main.add_command(coverage)
main.add_command(data_review_request, "data-review")

Просмотреть файл

@ -92,31 +92,20 @@ def type_name(obj: Union[metrics.Metric, pings.Ping]) -> str:
"""
generate_enums = getattr(obj, "_generate_enums", [])
if len(generate_enums):
template_args = []
generic = None
for member, suffix in generate_enums:
if len(getattr(obj, member)):
# Ugly hack to support the newer event extras API
# along the deprecated API.
# We need to specify both generic parameters,
# but only for event metrics.
# Plus `eventExtraKeys` use camelCase (lower),
# whereas proper class names should use CamelCase.
if suffix == "Extra":
if isinstance(obj, metrics.Event):
template_args.append("NoExtraKeys")
template_args.append(util.Camelize(obj.name) + suffix)
if isinstance(obj, metrics.Event):
generic = util.Camelize(obj.name) + suffix
else:
template_args.append(util.camelize(obj.name) + suffix)
if isinstance(obj, metrics.Event):
template_args.append("NoExtras")
generic = util.camelize(obj.name) + suffix
else:
if suffix == "Keys":
template_args.append("NoExtraKeys")
template_args.append("NoExtras")
if isinstance(obj, metrics.Event):
generic = "NoExtras"
else:
template_args.append("No" + suffix)
generic = "No" + suffix
return "{}<{}>".format(class_name(obj.type), ", ".join(template_args))
return "{}<{}>".format(class_name(obj.type), generic)
return class_name(obj.type)

Просмотреть файл

@ -273,6 +273,21 @@ def check_expired_metric(
yield ("Metric has expired. Please consider removing it.")
def check_old_event_api(
metric: metrics.Metric, parser_config: Dict[str, Any]
) -> LintGenerator:
# Glean v52.0.0 removed the old events API.
# The metrics-2-0-0 schema still supports it.
# We want to warn about it.
# This can go when we introduce 3-0-0
if not isinstance(metric, metrics.Event):
return
if not all("type" in x for x in metric.extra_keys.values()):
yield ("The old event API is gone. Extra keys require a type.")
def check_redundant_ping(
pings: pings.Ping, parser_config: Dict[str, Any]
) -> LintGenerator:
@ -318,6 +333,7 @@ METRIC_CHECKS: Dict[
"EXPIRATION_DATE_TOO_FAR": (check_expired_date, CheckType.warning),
"USER_LIFETIME_EXPIRATION": (check_user_lifetime_expiration, CheckType.warning),
"EXPIRED": (check_expired_metric, CheckType.warning),
"OLD_EVENT_API": (check_old_event_api, CheckType.warning),
}

Просмотреть файл

@ -177,6 +177,8 @@ class Metric:
d[key] = [x.name for x in val]
del d["name"]
del d["category"]
d.pop("_config", None)
d.pop("_generate_enums", None)
return d
def _serialize_input(self) -> Dict[str, util.JSONType]:
@ -305,14 +307,11 @@ class Event(Metric):
default_store_names = ["events"]
_generate_enums = [("allowed_extra_keys", "Keys")]
def __init__(self, *args, **kwargs):
self.extra_keys = kwargs.pop("extra_keys", {})
self.validate_extra_keys(self.extra_keys, kwargs.get("_config", {}))
if self.has_extra_types:
self._generate_enums = [("allowed_extra_keys_with_types", "Extra")]
super().__init__(*args, **kwargs)
self._generate_enums = [("allowed_extra_keys_with_types", "Extra")]
@property
def allowed_extra_keys(self):
@ -327,14 +326,6 @@ class Event(Metric):
key=lambda x: x[0],
)
@property
def has_extra_types(self):
"""
If any extra key has a `type` specified,
we generate the new struct/object-based API.
"""
return any("type" in x for x in self.extra_keys.values())
@staticmethod
def validate_extra_keys(extra_keys: Dict[str, str], config: Dict[str, Any]) -> None:
if not config.get("allow_reserved") and any(

Просмотреть файл

@ -150,22 +150,6 @@ def _get_schema_for_content(
return _get_schema(schema_url, filepath)
def get_parameter_doc(key: str) -> str:
"""
Returns documentation about a specific metric parameter.
"""
schema, _ = _get_schema(METRICS_ID)
return schema["definitions"]["metric"]["properties"][key]["description"]
def get_ping_parameter_doc(key: str) -> str:
"""
Returns documentation about a specific ping parameter.
"""
schema, _ = _get_schema(PINGS_ID)
return schema["additionalProperties"]["properties"][key]["description"]
def validate(
content: Dict[str, util.JSONType], filepath: Union[str, Path] = "<input>"
) -> Generator[str, None, None]:

Просмотреть файл

@ -103,16 +103,18 @@ def type_name(obj):
return "LabeledMetric<{}>".format(class_name(obj.type))
generate_enums = getattr(obj, "_generate_enums", []) # Extra Keys? Reasons?
if len(generate_enums):
generic = None
for name, suffix in generate_enums:
if not len(getattr(obj, name)) and suffix == "Keys":
return class_name(obj.type) + "<NoExtraKeys>"
if len(getattr(obj, name)):
generic = util.Camelize(obj.name) + suffix
else:
# we always use the `extra` suffix,
# because we only expose the new event API
suffix = "Extra"
return "{}<{}>".format(
class_name(obj.type), util.Camelize(obj.name) + suffix
)
if isinstance(obj, metrics.Event):
generic = "NoExtra"
else:
generic = "No" + suffix
return "{}<{}>".format(class_name(obj.type), generic)
return class_name(obj.type)

Просмотреть файл

@ -94,29 +94,17 @@ def type_name(obj: Union[metrics.Metric, pings.Ping]) -> str:
"""
generate_enums = getattr(obj, "_generate_enums", [])
if len(generate_enums):
template_args = []
generic = None
for member, suffix in generate_enums:
if len(getattr(obj, member)):
# Ugly hack to support the newer event extras API
# along the deprecated API.
# We need to specify both generic parameters,
# but only for event metrics.
if suffix == "Extra":
if isinstance(obj, metrics.Event):
template_args.append("NoExtraKeys")
template_args.append(util.Camelize(obj.name) + suffix)
else:
template_args.append(util.Camelize(obj.name) + suffix)
if isinstance(obj, metrics.Event):
template_args.append("NoExtras")
generic = util.Camelize(obj.name) + suffix
else:
if suffix == "Keys":
template_args.append("NoExtraKeys")
template_args.append("NoExtras")
if isinstance(obj, metrics.Event):
generic = "NoExtras"
else:
template_args.append("No" + suffix)
generic = "No" + suffix
return "{}<{}>".format(class_name(obj.type), ", ".join(template_args))
return "{}<{}>".format(class_name(obj.type), generic)
return class_name(obj.type)

Просмотреть файл

@ -34,12 +34,12 @@ Jinja2 template is not. Please file bugs! #}
{% if lazy %}}{% endif %}
{%- endmacro -%}
{%- macro enum_decl(obj, name, suffix) -%}
{%- macro reason_enum_decl(obj, name, suffix) -%}
@Suppress("ClassNaming", "EnumNaming")
enum class {{ obj.name|camelize }}{{ suffix }} : EventExtraKey {
enum class {{ obj.name|camelize }}{{ suffix }} : ReasonCode {
{% for key in obj|attr(name) %}
{{ key|camelize }} {
override fun keyName(): String = "{{ key }}"
override fun code(): Int = {{ loop.index-1 }}
}{{ "," if not loop.last }}{{ ";" if loop.last }}
{% endfor %}
@ -71,13 +71,12 @@ data class {{ obj.name|Camelize }}{{ suffix }}(
package {{ namespace }}
import {{ glean_namespace }}.private.CommonMetricData // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.EventExtraKey // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.EventExtras // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.HistogramType // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.Lifetime // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.MemoryUnit // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.NoExtraKeys // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.NoExtras // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.ReasonCode // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.NoReasonCodes // ktlint-disable import-ordering no-unused-imports
import {{ glean_namespace }}.private.TimeUnit // ktlint-disable import-ordering no-unused-imports
{% for obj_type in obj_types %}
@ -89,17 +88,23 @@ import {{ glean_namespace }}.private.LabeledMetricType // ktlint-disable import-
internal object {{ category_name|Camelize }} {
{% for obj in objs.values() %}
{% if obj.type == "ping" %}
{% if obj|attr("_generate_enums") %}
{% for name, suffix in obj["_generate_enums"] %}
{% if obj|attr(name)|length %}
{% if obj.has_extra_types %}
{{ struct_decl(obj, name, suffix)|indent }}
{% else %}
{{ enum_decl(obj, name, suffix)|indent }}
{% endif %}
{{ reason_enum_decl(obj, name, suffix)|indent }}
{% endif %}
{% endfor %}
{% endif %}
{% else %}
{% if obj|attr("_generate_enums") %}
{% for name, suffix in obj["_generate_enums"] %}
{% if obj|attr(name)|length %}
{{ struct_decl(obj, name, suffix)|indent }}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% for obj in objs.values() %}
{% if obj.labeled %}

Просмотреть файл

@ -13,11 +13,7 @@ Jinja2 template is not. Please file bugs! #}
{# we always use the `extra` suffix, because we only expose the new event API #}
{% set suffix = "Extra" %}
{% if obj|attr(name)|length %}
{% if obj.has_extra_types %}
{{ extra_keys_with_types(obj, name, suffix)|indent }}
{% else %}
compile_error!("Untyped event extras not supported. Please annotate event extras with a type. See documentation for details. (Metric: {{obj.category}}.{{obj.name}}, defined in: {{obj.defined_in['filepath']}}:{{obj.defined_in['line']}})");
{% endif %}
{% endif %}
{% endfor %}
{% endmacro %}

Просмотреть файл

@ -24,18 +24,6 @@ Jinja2 template is not. Please file bugs! #}
)
{% endmacro %}
{% macro enum_decl(obj, name, suffix) %}
enum {{ obj.name|Camelize }}{{ suffix }}: Int32, ExtraKeys {
{% for key in obj|attr(name) %}
case {{ key|camelize|variable_name }} = {{ loop.index-1 }}
{% endfor %}
public func index() -> Int32 {
return self.rawValue
}
}
{% endmacro %}
{% macro struct_decl(obj, name, suffix) %}
struct {{ obj.name|Camelize }}{{ suffix }}: EventExtras {
{% for item, typ in obj|attr(name) %}
@ -119,11 +107,7 @@ extension {{ namespace }} {
{% if obj|attr("_generate_enums") %}
{% for name, suffix in obj["_generate_enums"] %}
{% if obj|attr(name)|length %}
{% if obj.has_extra_types %}
{{ struct_decl(obj, name, suffix)|indent }}
{% else %}
{{ enum_decl(obj, name, suffix)|indent }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}

2
third_party/python/requirements.in поставляемый
Просмотреть файл

@ -13,7 +13,7 @@ ecdsa==0.15
esprima==4.0.1
fluent.migrate==0.11
fluent.syntax==0.18.1
glean_parser==6.4.0
glean_parser==7.0.0
# Pin importlib-metadata to a version compatible with poetry
importlib-metadata==1.7.0
jsmin==2.1.0

6
third_party/python/requirements.txt поставляемый
Просмотреть файл

@ -94,9 +94,9 @@ fluent.syntax==0.18.1 \
giturlparse==0.10.0; python_version >= "3.6" \
--hash=sha256:04ba1a3a099c3093fa8d24a422913c6a9b2c2cd22bcffc939cf72e3e98f672d7 \
--hash=sha256:2595ab291d30717cda8474b874c9fd509f1b9802ad7f6968c36a45e4b13eb337
glean-parser==6.4.0 \
--hash=sha256:011c187aeb655af03a24bf1970aeac685e29a8ff1cbdfe9ccbd441bca9d7005e \
--hash=sha256:f7e53d911324710634b636a8e8f9a2d124ea874c70d29154d3fc595e56b090a3
glean-parser==7.0.0 \
--hash=sha256:c9df09b8cbe149e840125153e0ffebda264f45cd9e51805dbc0288bf203c54ab \
--hash=sha256:c48960dd6fc0dc506f54e1229ff92ed10766cc65e598e9b9c8b798be81a4ccd5
idna-ssl==1.1.0; python_version < "3.7" and python_version >= "3.6" \
--hash=sha256:a933e3bb13da54383f9e8f35dc4f9cb9eb9b3b78c6b36f311254d6d0d92c6c7c
idna==2.10; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" or python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.7" or python_version < "3.7" and python_version >= "3.6" and python_full_version >= "3.4.0" or python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6" \

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"54000139d1ac9e044f44f5d7c6e947e9e59316516fd3998ea4d3acce87fe9ff2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"d51a5b3347bed2441b20986be81bfd4611ca2c5614f950116b273199a9bcf2de","src/dependency.rs":"c593ddc73d863c5712e2aba58b5f4d9bd915a5ac0bc17df71642aa79aa93bfdc","src/diagnostic.rs":"fee47d27390f1026ff99ffade5dfd2ab3e9b9839c3f33ce91a7dcde875551374","src/errors.rs":"2d67e46ef8f29a9ae2dd00ce39cc50e6ccae4dec9a09a9bad7c36bd8be4f62cc","src/lib.rs":"d9301e463425f9c4bd7d17e5f3de08c03f3c1a0ff1e361125cf29dea2ddbd234","src/messages.rs":"a6c32c539d079be131746cb175039e0d2d73416351f2bc1f7ded0e465a6fae9c","tests/selftest.rs":"3a48e0b44679945af6ae7f05e2a473a38684bb106dc5b22cab12b40d8b087b51","tests/test_samples.rs":"9d5d2ef8c03ca4309c7bd735f1da7d563fef00f0baaff4cf3869861ddd8f0fd3"},"package":"4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa"}
{"files":{"CHANGELOG.md":"8b3e29799cdedf02f169bb519072ace2e2b6b9413f4ce8fa0666c2d1d964084e","Cargo.toml":"4985edbf3071a2f67c7b6292840634b73f26dd667981bf9cbebb5b254416ced2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"d51a5b3347bed2441b20986be81bfd4611ca2c5614f950116b273199a9bcf2de","src/dependency.rs":"c593ddc73d863c5712e2aba58b5f4d9bd915a5ac0bc17df71642aa79aa93bfdc","src/diagnostic.rs":"fee47d27390f1026ff99ffade5dfd2ab3e9b9839c3f33ce91a7dcde875551374","src/errors.rs":"797afd61efdd843ae570d9e972dd2425d33823d4a78c0c488028493dffb45c7a","src/lib.rs":"20216b98b9af855b9ef61cb4ecf68ae17b443add83e6888d14f578b8de4ad6ea","src/messages.rs":"a8e3ee31dc8cce5762b4b085be29fe4d7189a789f3a149ef2b6c17604d94528b","tests/selftest.rs":"73afd494c1bf7dd4e1a99971e9ff66a0e21fc7bf3e327663df15d2350dcdfc70","tests/test_samples.rs":"ee2b4737adfa1930c1610bb3ec0fc94b7f1a3691bb09545da69044eef2f5ba6b"},"package":"982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a"}

38
third_party/rust/cargo_metadata/CHANGELOG.md поставляемый Normal file
Просмотреть файл

@ -0,0 +1,38 @@
# Changelog
## Unreleased
### Added
- Re-exported `semver` crate directly.
### Changed
- Made `parse_stream` more versatile by accepting anything that implements `Read`.
### Removed
- Removed re-exports for `BuildMetadata` and `Prerelease` from `semver` crate.
### Fixed
- Added missing `manifest_path` field to `Artifact`. Fixes #187.
## [0.15.0] - 2022-06-22
### Added
- Re-exported `BuildMetadata` and `Prerelease` from `semver` crate.
- Added `workspace_packages` function.
- Added `Edition` enum to better parse edition field.
- Added `rust-version` field to Cargo manifest.
### Changed
- Bumped msrv from `1.40.0` to `1.42.0`.
### Internal Changes
- Updated `derive_builder` to the latest version.
- Made use of `matches!` macros where possible.
- Fixed some tests

22
third_party/rust/cargo_metadata/Cargo.toml поставляемый
Просмотреть файл

@ -11,39 +11,45 @@
[package]
edition = "2018"
rust-version = "1.42.0"
name = "cargo_metadata"
version = "0.14.2"
version = "0.15.2"
authors = ["Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>"]
description = "structured access to the output of `cargo metadata`"
readme = "README.md"
license = "MIT"
repository = "https://github.com/oli-obk/cargo_metadata"
[package.metadata.cargo_metadata_test]
other_field = "foo"
some_field = true
other_field = "foo"
[dependencies.camino]
version = "1.0.1"
version = "1.0.7"
features = ["serde1"]
[dependencies.cargo-platform]
version = "0.1"
version = "0.1.2"
[dependencies.derive_builder]
version = "0.9.0"
version = "0.11.1"
optional = true
[dependencies.semver]
version = "1"
version = "1.0.7"
features = ["serde"]
[dependencies.serde]
version = "1.0.107"
version = "1.0.136"
features = ["derive"]
[dependencies.serde_json]
version = "1.0.59"
version = "1.0.79"
features = ["unbounded_depth"]
[dependencies.thiserror]
version = "1.0.31"
[features]
builder = ["derive_builder"]
default = []

82
third_party/rust/cargo_metadata/src/errors.rs поставляемый
Просмотреть файл

@ -1,7 +1,4 @@
use std::fmt;
use std::io;
use std::str::Utf8Error;
use std::string::FromUtf8Error;
use std::{io, str::Utf8Error, string::FromUtf8Error};
/// Custom result type for `cargo_metadata::Error`
pub type Result<T> = ::std::result::Result<T, Error>;
@ -24,87 +21,32 @@ pub type Result<T> = ::std::result::Result<T, Error>;
/// really want to. (Either through foreign_links or by making it a field
/// value of a `ErrorKind` variant).
///
#[derive(Debug)]
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Error during execution of `cargo metadata`
#[error("`cargo metadata` exited with an error: {stderr}")]
CargoMetadata {
/// stderr returned by the `cargo metadata` command
stderr: String,
},
/// IO Error during execution of `cargo metadata`
Io(io::Error),
#[error("failed to start `cargo metadata`: {0}")]
Io(#[from] io::Error),
/// Output of `cargo metadata` was not valid utf8
Utf8(Utf8Error),
#[error("cannot convert the stdout of `cargo metadata`: {0}")]
Utf8(#[from] Utf8Error),
/// Error output of `cargo metadata` was not valid utf8
ErrUtf8(FromUtf8Error),
#[error("cannot convert the stderr of `cargo metadata`: {0}")]
ErrUtf8(#[from] FromUtf8Error),
/// Deserialization error (structure of json did not match expected structure)
Json(::serde_json::Error),
#[error("failed to interpret `cargo metadata`'s json: {0}")]
Json(#[from] ::serde_json::Error),
/// The output did not contain any json
#[error("could not find any json in the output of `cargo metadata`")]
NoJson,
}
impl From<io::Error> for Error {
fn from(v: io::Error) -> Self {
Error::Io(v)
}
}
impl From<Utf8Error> for Error {
fn from(v: Utf8Error) -> Self {
Error::Utf8(v)
}
}
impl From<FromUtf8Error> for Error {
fn from(v: FromUtf8Error) -> Self {
Error::ErrUtf8(v)
}
}
impl From<::serde_json::Error> for Error {
fn from(v: ::serde_json::Error) -> Self {
Error::Json(v)
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::CargoMetadata { stderr } => {
write!(
f,
"`cargo metadata` exited with an error: {}",
stderr.trim_end()
)
}
Error::Io(err) => write!(f, "failed to start `cargo metadata`: {}", err),
Error::Utf8(err) => write!(f, "cannot convert the stdout of `cargo metadata`: {}", err),
Error::ErrUtf8(err) => {
write!(f, "cannot convert the stderr of `cargo metadata`: {}", err)
}
Error::Json(err) => write!(f, "failed to interpret `cargo metadata`'s json: {}", err),
Error::NoJson => write!(
f,
"could not find any json in the output of `cargo metadata`"
),
}
}
}
impl ::std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Error::CargoMetadata { .. } => None,
Error::Io(err) => Some(err),
Error::Utf8(err) => Some(err),
Error::ErrUtf8(err) => Some(err),
Error::Json(err) => Some(err),
Error::NoJson => None,
}
}
}

173
third_party/rust/cargo_metadata/src/lib.rs поставляемый
Просмотреть файл

@ -84,12 +84,14 @@ use derive_builder::Builder;
use std::collections::HashMap;
use std::env;
use std::fmt;
use std::hash::Hash;
use std::path::PathBuf;
use std::process::Command;
use std::process::{Command, Stdio};
use std::str::from_utf8;
pub use camino;
pub use semver::{Version, VersionReq};
pub use semver;
use semver::{Version, VersionReq};
pub use dependency::{Dependency, DependencyKind};
use diagnostic::Diagnostic;
@ -124,12 +126,9 @@ impl std::fmt::Display for PackageId {
}
}
// Helpers for default metadata fields
/// Helpers for default metadata fields
fn is_null(value: &serde_json::Value) -> bool {
match value {
serde_json::Value::Null => true,
_ => false,
}
matches!(value, serde_json::Value::Null)
}
#[derive(Clone, Serialize, Deserialize, Debug)]
@ -156,10 +155,30 @@ pub struct Metadata {
}
impl Metadata {
/// Get the root package of this metadata instance.
/// Get the workspace's root package of this metadata instance.
pub fn root_package(&self) -> Option<&Package> {
let root = self.resolve.as_ref()?.root.as_ref()?;
self.packages.iter().find(|pkg| &pkg.id == root)
match &self.resolve {
Some(resolve) => {
// if dependencies are resolved, use Cargo's answer
let root = resolve.root.as_ref()?;
self.packages.iter().find(|pkg| &pkg.id == root)
}
None => {
// if dependencies aren't resolved, check for a root package manually
let root_manifest_path = self.workspace_root.join("Cargo.toml");
self.packages
.iter()
.find(|pkg| pkg.manifest_path == root_manifest_path)
}
}
}
/// Get the workspace packages.
pub fn workspace_packages(&self) -> Vec<&Package> {
self.packages
.iter()
.filter(|&p| self.workspace_members.contains(&p.id))
.collect()
}
}
@ -310,8 +329,8 @@ pub struct Package {
///
/// Beware that individual targets may specify their own edition in
/// [`Target::edition`].
#[serde(default = "edition_default")]
pub edition: String,
#[serde(default)]
pub edition: Edition,
/// Contents of the free form package.metadata section
///
/// This contents can be serialized to a struct using serde:
@ -368,9 +387,12 @@ impl Package {
/// Full path to the readme file if one is present in the manifest
pub fn readme(&self) -> Option<Utf8PathBuf> {
self.readme
.as_ref()
.map(|file| self.manifest_path.join(file))
self.readme.as_ref().map(|file| {
self.manifest_path
.parent()
.unwrap_or(&self.manifest_path)
.join(file)
})
}
}
@ -403,7 +425,7 @@ impl std::fmt::Display for Source {
pub struct Target {
/// Name as given in the `Cargo.toml` or generated from the file name
pub name: String,
/// Kind of target ("bin", "example", "test", "bench", "lib")
/// Kind of target ("bin", "example", "test", "bench", "lib", "custom-build")
pub kind: Vec<String>,
/// Almost the same as `kind`, except when an example is a library instead of an executable.
/// In that case `crate_types` contains things like `rlib` and `dylib` while `kind` is `example`
@ -420,9 +442,9 @@ pub struct Target {
/// Path to the main source file of the target
pub src_path: Utf8PathBuf,
/// Rust edition for this target
#[serde(default = "edition_default")]
#[cfg_attr(feature = "builder", builder(default = "edition_default()"))]
pub edition: String,
#[serde(default)]
#[cfg_attr(feature = "builder", builder(default))]
pub edition: Edition,
/// Whether or not this target has doc tests enabled, and the target is
/// compatible with doc testing.
///
@ -444,12 +466,97 @@ pub struct Target {
pub doc: bool,
}
fn default_true() -> bool {
true
impl Target {
fn is_kind(&self, name: &str) -> bool {
self.kind.iter().any(|kind| kind == name)
}
/// Return true if this target is of kind "lib".
pub fn is_lib(&self) -> bool {
self.is_kind("lib")
}
/// Return true if this target is of kind "bin".
pub fn is_bin(&self) -> bool {
self.is_kind("bin")
}
/// Return true if this target is of kind "example".
pub fn is_example(&self) -> bool {
self.is_kind("example")
}
/// Return true if this target is of kind "test".
pub fn is_test(&self) -> bool {
self.is_kind("test")
}
/// Return true if this target is of kind "bench".
pub fn is_bench(&self) -> bool {
self.is_kind("bench")
}
/// Return true if this target is of kind "custom-build".
pub fn is_custom_build(&self) -> bool {
self.is_kind("custom-build")
}
}
fn edition_default() -> String {
"2015".to_string()
/// The Rust edition
///
/// As of writing this comment rust editions 2024, 2027 and 2030 are not actually a thing yet but are parsed nonetheless for future proofing.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[non_exhaustive]
pub enum Edition {
/// Edition 2015
#[serde(rename = "2015")]
E2015,
/// Edition 2018
#[serde(rename = "2018")]
E2018,
/// Edition 2021
#[serde(rename = "2021")]
E2021,
#[doc(hidden)]
#[serde(rename = "2024")]
_E2024,
#[doc(hidden)]
#[serde(rename = "2027")]
_E2027,
#[doc(hidden)]
#[serde(rename = "2030")]
_E2030,
}
impl Edition {
/// Return the string representation of the edition
pub fn as_str(&self) -> &'static str {
use Edition::*;
match self {
E2015 => "2015",
E2018 => "2018",
E2021 => "2021",
_E2024 => "2024",
_E2027 => "2027",
_E2030 => "2030",
}
}
}
impl fmt::Display for Edition {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
impl Default for Edition {
fn default() -> Self {
Self::E2015
}
}
fn default_true() -> bool {
true
}
/// Cargo features flags
@ -474,7 +581,7 @@ pub struct MetadataCommand {
manifest_path: Option<PathBuf>,
/// Current directory of the `cargo metadata` process.
current_dir: Option<PathBuf>,
/// Output information only about the root package and don't fetch dependencies.
/// Output information only about workspace members and don't fetch dependencies.
no_deps: bool,
/// Collections of `CargoOpt::SomeFeatures(..)`
features: Vec<String>,
@ -485,6 +592,8 @@ pub struct MetadataCommand {
/// Arbitrary command line flags to pass to `cargo`. These will be added
/// to the end of the command line invocation.
other_options: Vec<String>,
/// Show stderr
verbose: bool,
}
impl MetadataCommand {
@ -510,7 +619,7 @@ impl MetadataCommand {
self.current_dir = Some(path.into());
self
}
/// Output information only about the root package and don't fetch dependencies.
/// Output information only about workspace members and don't fetch dependencies.
pub fn no_deps(&mut self) -> &mut MetadataCommand {
self.no_deps = true;
self
@ -580,6 +689,12 @@ impl MetadataCommand {
self
}
/// Set whether to show stderr
pub fn verbose(&mut self, verbose: bool) -> &mut MetadataCommand {
self.verbose = verbose;
self
}
/// Builds a command for `cargo metadata`. This is the first
/// part of the work of `exec`.
pub fn cargo_command(&self) -> Command {
@ -626,7 +741,11 @@ impl MetadataCommand {
/// Runs configured `cargo metadata` and returns parsed `Metadata`.
pub fn exec(&self) -> Result<Metadata> {
let output = self.cargo_command().output()?;
let mut command = self.cargo_command();
if self.verbose {
command.stderr(Stdio::inherit());
}
let output = command.output()?;
if !output.status.success() {
return Err(Error::CargoMetadata {
stderr: String::from_utf8(output.stderr)?,
@ -635,7 +754,7 @@ impl MetadataCommand {
let stdout = from_utf8(&output.stdout)?
.lines()
.find(|line| line.starts_with('{'))
.ok_or_else(|| Error::NoJson)?;
.ok_or(Error::NoJson)?;
Self::parse(stdout)
}
}

Просмотреть файл

@ -4,7 +4,7 @@ use camino::Utf8PathBuf;
use derive_builder::Builder;
use serde::{Deserialize, Serialize};
use std::fmt;
use std::io::{self, BufRead, Lines, Read};
use std::io::{self, BufRead, Read};
/// Profile settings used to determine which compiler flags to use for a
/// target.
@ -34,6 +34,9 @@ pub struct ArtifactProfile {
pub struct Artifact {
/// The package this artifact belongs to
pub package_id: PackageId,
/// Path to the `Cargo.toml` file
#[serde(default)]
pub manifest_path: Utf8PathBuf,
/// The target this artifact was compiled for
pub target: Target,
/// The profile this artifact was compiled with
@ -122,10 +125,8 @@ pub enum Message {
impl Message {
/// Creates an iterator of Message from a Read outputting a stream of JSON
/// messages. For usage information, look at the top-level documentation.
pub fn parse_stream<R: BufRead>(input: R) -> MessageIter<R> {
MessageIter {
lines: input.lines(),
}
pub fn parse_stream<R: Read>(input: R) -> MessageIter<R> {
MessageIter { input }
}
}
@ -137,19 +138,28 @@ impl fmt::Display for CompilerMessage {
/// An iterator of Messages.
pub struct MessageIter<R> {
lines: Lines<R>,
input: R,
}
impl<R: BufRead> Iterator for MessageIter<R> {
type Item = io::Result<Message>;
fn next(&mut self) -> Option<Self::Item> {
let line = self.lines.next()?;
let message = line.map(|it| {
let mut deserializer = serde_json::Deserializer::from_str(&it);
deserializer.disable_recursion_limit();
Message::deserialize(&mut deserializer).unwrap_or(Message::TextLine(it))
});
Some(message)
let mut line = String::new();
self.input
.read_line(&mut line)
.map(|n| {
if n == 0 {
None
} else {
if line.ends_with('\n') {
line.truncate(line.len() - 1);
}
let mut deserializer = serde_json::Deserializer::from_str(&line);
deserializer.disable_recursion_limit();
Some(Message::deserialize(&mut deserializer).unwrap_or(Message::TextLine(line)))
}
})
.transpose()
}
}

Просмотреть файл

@ -132,6 +132,10 @@ fn metadata_deps() {
assert_eq!(this.name, "cargo_metadata");
let workspace_packages = metadata.workspace_packages();
assert_eq!(workspace_packages.len(), 1);
assert_eq!(&workspace_packages[0].id, this_id);
let lib = this
.targets
.iter()

Просмотреть файл

@ -4,7 +4,7 @@ extern crate semver;
extern crate serde_json;
use camino::Utf8PathBuf;
use cargo_metadata::{CargoOpt, DependencyKind, Metadata, MetadataCommand};
use cargo_metadata::{CargoOpt, DependencyKind, Edition, Metadata, MetadataCommand};
#[test]
fn old_minimal() {
@ -81,8 +81,8 @@ fn old_minimal() {
assert_eq!(dep.source, None);
assert_eq!(dep.req, semver::VersionReq::parse("^1.0").unwrap());
assert_eq!(dep.kind, DependencyKind::Normal);
assert_eq!(dep.optional, false);
assert_eq!(dep.uses_default_features, true);
assert!(!dep.optional);
assert!(dep.uses_default_features);
assert_eq!(dep.features.len(), 0);
assert!(dep.target.is_none());
assert_eq!(dep.rename, None);
@ -94,10 +94,10 @@ fn old_minimal() {
assert_eq!(target.crate_types, vec!["bin"]);
assert_eq!(target.required_features.len(), 0);
assert_eq!(target.src_path, "/foo/src/main.rs");
assert_eq!(target.edition, "2015");
assert_eq!(target.doctest, true);
assert_eq!(target.test, true);
assert_eq!(target.doc, true);
assert_eq!(target.edition, Edition::E2015);
assert!(target.doctest);
assert!(target.test);
assert!(target.doc);
assert_eq!(pkg.features.len(), 0);
assert_eq!(pkg.manifest_path, "/foo/Cargo.toml");
assert_eq!(pkg.categories.len(), 0);
@ -106,7 +106,7 @@ fn old_minimal() {
assert_eq!(pkg.repository, None);
assert_eq!(pkg.homepage, None);
assert_eq!(pkg.documentation, None);
assert_eq!(pkg.edition, "2015");
assert_eq!(pkg.edition, Edition::E2015);
assert_eq!(pkg.metadata, serde_json::Value::Null);
assert_eq!(pkg.links, None);
assert_eq!(pkg.publish, None);
@ -224,7 +224,7 @@ fn all_the_fields() {
bitflags.source,
Some("registry+https://github.com/rust-lang/crates.io-index".to_string())
);
assert_eq!(bitflags.optional, true);
assert!(bitflags.optional);
assert_eq!(bitflags.req, semver::VersionReq::parse("^1.0").unwrap());
let path_dep = all
@ -251,7 +251,7 @@ fn all_the_fields() {
.find(|d| d.name == "featdep")
.unwrap();
assert_eq!(featdep.features, vec!["i128"]);
assert_eq!(featdep.uses_default_features, false);
assert!(!featdep.uses_default_features);
let renamed = all
.dependencies
@ -297,28 +297,28 @@ fn all_the_fields() {
vec!["cdylib", "rlib", "staticlib"]
);
assert_eq!(lib.required_features.len(), 0);
assert_eq!(lib.edition, "2018");
assert_eq!(lib.doctest, true);
assert_eq!(lib.test, true);
assert_eq!(lib.doc, true);
assert_eq!(lib.edition, Edition::E2018);
assert!(lib.doctest);
assert!(lib.test);
assert!(lib.doc);
let main = get_file_name!("main.rs");
assert_eq!(main.crate_types, vec!["bin"]);
assert_eq!(main.kind, vec!["bin"]);
assert_eq!(main.doctest, false);
assert_eq!(main.test, true);
assert_eq!(main.doc, true);
assert!(!main.doctest);
assert!(main.test);
assert!(main.doc);
let otherbin = get_file_name!("otherbin.rs");
assert_eq!(otherbin.edition, "2015");
assert_eq!(otherbin.doc, false);
assert_eq!(otherbin.edition, Edition::E2015);
assert!(!otherbin.doc);
let reqfeat = get_file_name!("reqfeat.rs");
assert_eq!(reqfeat.required_features, vec!["feat2"]);
let ex1 = get_file_name!("ex1.rs");
assert_eq!(ex1.kind, vec!["example"]);
assert_eq!(ex1.test, false);
assert!(!ex1.test);
let t1 = get_file_name!("t1.rs");
assert_eq!(t1.kind, vec!["test"]);
@ -344,6 +344,7 @@ fn all_the_fields() {
assert_eq!(all.categories, vec!["command-line-utilities"]);
assert_eq!(all.keywords, vec!["cli"]);
assert_eq!(all.readme, Some(Utf8PathBuf::from("README.md")));
assert!(all.readme().unwrap().ends_with("tests/all/README.md"));
assert_eq!(
all.repository,
Some("https://github.com/oli-obk/cargo_metadata/".to_string())
@ -356,7 +357,7 @@ fn all_the_fields() {
all.documentation,
Some("https://docs.rs/cargo_metadata/".to_string())
);
assert_eq!(all.edition, "2018");
assert_eq!(all.edition, Edition::E2018);
assert_eq!(
all.metadata,
json!({
@ -532,9 +533,9 @@ fn current_dir() {
fn parse_stream_is_robust() {
// Proc macros can print stuff to stdout, which naturally breaks JSON messages.
// Let's check that we don't die horribly in this case, and report an error.
let json_output = r##"{"reason":"compiler-artifact","package_id":"chatty 0.1.0 (path+file:///chatty-macro/chatty)","target":{"kind":["proc-macro"],"crate_types":["proc-macro"],"name":"chatty","src_path":"/chatty-macro/chatty/src/lib.rs","edition":"2018","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/chatty-macro/target/debug/deps/libchatty-f2adcff24cdf3bb2.so"],"executable":null,"fresh":false}
let json_output = r##"{"reason":"compiler-artifact","package_id":"chatty 0.1.0 (path+file:///chatty-macro/chatty)","manifest_path":"chatty-macro/Cargo.toml","target":{"kind":["proc-macro"],"crate_types":["proc-macro"],"name":"chatty","src_path":"/chatty-macro/chatty/src/lib.rs","edition":"2018","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/chatty-macro/target/debug/deps/libchatty-f2adcff24cdf3bb2.so"],"executable":null,"fresh":false}
Evil proc macro was here!
{"reason":"compiler-artifact","package_id":"chatty-macro 0.1.0 (path+file:///chatty-macro)","target":{"kind":["lib"],"crate_types":["lib"],"name":"chatty-macro","src_path":"/chatty-macro/src/lib.rs","edition":"2018","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/chatty-macro/target/debug/libchatty_macro.rlib","/chatty-macro/target/debug/deps/libchatty_macro-cb5956ed52a11fb6.rmeta"],"executable":null,"fresh":false}
{"reason":"compiler-artifact","package_id":"chatty-macro 0.1.0 (path+file:///chatty-macro)","manifest_path":"chatty-macro/Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"chatty-macro","src_path":"/chatty-macro/src/lib.rs","edition":"2018","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/chatty-macro/target/debug/libchatty_macro.rlib","/chatty-macro/target/debug/deps/libchatty_macro-cb5956ed52a11fb6.rmeta"],"executable":null,"fresh":false}
"##;
let mut n_messages = 0;
let mut text = String::new();
@ -622,3 +623,25 @@ fn depkind_to_string() {
assert_eq!(DependencyKind::Build.to_string(), "build");
assert_eq!(DependencyKind::Unknown.to_string(), "Unknown");
}
#[test]
fn basic_workspace_root_package_exists() {
// First try with dependencies
let meta = MetadataCommand::new()
.manifest_path("tests/basic_workspace/Cargo.toml")
.exec()
.unwrap();
assert_eq!(meta.root_package().unwrap().name, "ex_bin");
// Now with no_deps, it should still work exactly the same
let meta = MetadataCommand::new()
.manifest_path("tests/basic_workspace/Cargo.toml")
.no_deps()
.exec()
.unwrap();
assert_eq!(
meta.root_package()
.expect("workspace root still exists when no_deps used")
.name,
"ex_bin"
);
}

1
third_party/rust/error-support-macros/.cargo-checksum.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"files":{"Cargo.toml":"2a41a998c288fd049dd4dd62bc20e3ad13ded43642c27880dd5af0260bb72865","src/argument.rs":"1e4ec4140c536d2feea30eb1e4eef3a6e24533192108e91610ee5c2e75eb5e75","src/lib.rs":"fbd9c048ac86c16ef388fbb9a3c40f60d3aecab41a902740c81b3df6ee6631fe"},"package":null}

14
third_party/rust/error-support-macros/Cargo.toml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,14 @@
[package]
name = "error-support-macros"
version = "0.1.0"
edition = "2021"
license = "MPL-2.0"
publish = false
[lib]
proc-macro = true
[dependencies]
syn = { version = "1.0", features = ["derive", "parsing", "full"]}
quote = "1.0"
proc-macro2 = "1.0"

17
third_party/rust/error-support-macros/src/argument.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,17 @@
/* 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/. */
pub(crate) fn validate(arguments: &syn::AttributeArgs) -> syn::Result<()> {
// For now we validate that there are no arguments.
// if we want to improve the macro to support attributes, for example,
// if we'd like to pass in the return type of the body we can modify this
// logic to parse and return the type.
if !arguments.is_empty() {
return Err(syn::Error::new(
proc_macro2::Span::call_site(),
"Expected #[handle_error] with no arguments",
));
}
Ok(())
}

101
third_party/rust/error-support-macros/src/lib.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,101 @@
/* 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 proc_macro::TokenStream;
use quote::quote;
use syn::{parse_quote, spanned::Spanned};
mod argument;
/// A procedural macro that exposes internal errors to external errors the
/// consuming applications should handle. It requires that the internal error
/// implements [`error_support::ErrorHandling`].
///
/// Additionally, this procedural macro has side effects, including:
/// * It would log the error based on a pre-defined log level. The log level is defined
/// in the [`error_support::ErrorHandling`] implementation.
/// * It would report some errors using an external error reporter, in practice, this
/// is implemented using Sentry in the app.
///
/// # Example
/// ```ignore
/// use error_support::{handle_error, GetErrorHandling, ErrorHandling};
/// use std::fmt::Display
///#[derive(Debug, thiserror::Error)]
/// struct Error {}
/// type Result<T, E = Error> = std::result::Result<T, E>;
/// impl Display for Error {
/// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
/// write!(f, "Internal Error!")
/// }
/// }
///
/// #[derive(Debug, thiserror::Error)]
/// struct ExternalError {}
///
/// impl Display for ExternalError {
/// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
/// write!(f, "External Error!")
/// }
/// }
///
/// impl GetErrorHandling for Error {
/// type ExternalError = ExternalError;
///
/// fn get_error_handling(&self) -> ErrorHandling<Self::ExternalError> {
/// ErrorHandling::convert(ExternalError {})
/// }
/// }
///
/// #[handle_error]
/// fn do_something() -> std::result::Result<String, ExternalError> {
/// // The `handle_error` macro maps from `Error` to `ExternalError`
/// Err(Error{})
/// }
///
/// // The error here is an `ExternalError`
/// let _: ExternalError = do_something().unwrap_err();
/// ```
#[proc_macro_attribute]
pub fn handle_error(args: TokenStream, input: TokenStream) -> TokenStream {
let args = syn::parse_macro_input!(args as syn::AttributeArgs);
let parsed = syn::parse_macro_input!(input as syn::Item);
TokenStream::from(match impl_handle_error(&parsed, &args) {
Ok(res) => res,
Err(e) => e.to_compile_error(),
})
}
fn impl_handle_error(
input: &syn::Item,
arguments: &syn::AttributeArgs,
) -> syn::Result<proc_macro2::TokenStream> {
if let syn::Item::Fn(item_fn) = input {
argument::validate(arguments)?;
let original_body = &item_fn.block;
let mut new_fn = item_fn.clone();
new_fn.block = parse_quote! {
{
// Note: the `Result` here is a smell
// because the macro is **assuming** a `Result` exists
// that reflects the return value of the block
// An improvement would include the error of the `original_block`
// as an attribute to the macro itself.
(|| -> Result<_> {
#original_body
})().map_err(::error_support::convert_log_report_error)
}
};
Ok(quote! {
#new_fn
})
} else {
Err(syn::Error::new(
input.span(),
"#[handle_error] can only be used on functions",
))
}
}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"83ebcdeefa2cf29b7f1d3bbfad39ef9da77ca3fabc21db6125b0550f46d9e71e","README.md":"7719c19eacb99e3208c611374a5e08da331d1317d5e0d5df7c0db25936d5d767","android/build.gradle":"200fe9fcf26477ae4e941dd1e702c43deae9fb0a7252569bd7352eac1771efbe","android/src/main/AndroidManifest.xml":"4f8b16fa6a03120ac810c6438a3a60294075414d92e06caa7e85388e389e5d17","build.rs":"587f12902443392d5bbbf46f20937018acb4b3f180d1240934bb646583c430eb","src/errorsupport.udl":"e793034d01a2608298528051757f38405e006ee1abc4cf65dc6f18c53590ace8","src/handling.rs":"545c969d71907d81cb5af93f435ba443508adda2ec57ac2a975fed7d9828ccea","src/lib.rs":"623ad5e238bf41a071e833a8ac0d50394ab8fd63bf7aa4eed5675d1d95e32195","src/macros.rs":"de029394fec9d0367d1b7f5156c60ebe547b79370b04c78f4c1de9ffe2f8ea86","src/redact.rs":"c9a4df1a87be68b15d583587bda941d4c60a1d0449e2d43ff99f3611a290a863","src/reporting.rs":"38efd24d86ba8facfb181cb27e8b698d2831db0afab85691ffda034a4dc68dfa","uniffi.toml":"644fe81c12fe3c01ee81e017ca3c00d0e611f014b7eade51aadaf208179a3450"},"package":null}
{"files":{"Cargo.toml":"75ddc7a958a32731df00ba4e9a409fd673de0d8a94db317d208408586e43422f","README.md":"8030b4a314b1be31ba018ac12c3b586bb736db5307c3c395f2857fffe0130322","android/build.gradle":"200fe9fcf26477ae4e941dd1e702c43deae9fb0a7252569bd7352eac1771efbe","android/src/main/AndroidManifest.xml":"4f8b16fa6a03120ac810c6438a3a60294075414d92e06caa7e85388e389e5d17","build.rs":"c8d3c38c1208eea36224662b284d8daf3e7ad1b07d22d750524f3da1cc66ccca","src/errorsupport.udl":"e793034d01a2608298528051757f38405e006ee1abc4cf65dc6f18c53590ace8","src/handling.rs":"545c969d71907d81cb5af93f435ba443508adda2ec57ac2a975fed7d9828ccea","src/lib.rs":"96ae3cc2c1077ae45442ace6b5b5311b86267d0b9067f3ff58396af30ccbbc07","src/macros.rs":"0d03f82fab20c96a182f941baf3fcf2a286b00fea871ee7fd8e339abc14f9522","src/redact.rs":"c9a4df1a87be68b15d583587bda941d4c60a1d0449e2d43ff99f3611a290a863","src/reporting.rs":"38efd24d86ba8facfb181cb27e8b698d2831db0afab85691ffda034a4dc68dfa","uniffi.toml":"644fe81c12fe3c01ee81e017ca3c00d0e611f014b7eade51aadaf208179a3450"},"package":null}

7
third_party/rust/error-support/Cargo.toml поставляемый
Просмотреть файл

@ -4,17 +4,18 @@ version = "0.1.0"
authors = ["Thom Chiovoloni <tchiovoloni@mozilla.com>"]
edition = "2021"
license = "MPL-2.0"
autotests = false
[dependencies]
log = "0.4"
lazy_static = { version = "1.4" }
parking_lot = { version = ">=0.11,<=0.12" }
uniffi = { version = "^0.21" }
uniffi_macros = { version = "^0.21" }
uniffi = "0.23"
error-support-macros = { path = "macros" }
[dependencies.backtrace]
optional = true
version = "0.3"
[build-dependencies]
uniffi_build = { version = "^0.21", features=["builtin-bindgen"] }
uniffi = { version = "0.23", features = ["build"] }

2
third_party/rust/error-support/README.md поставляемый
Просмотреть файл

@ -64,7 +64,7 @@ be reported or not, which type name to report it with, etc. Eventually we also
hope to allow expected errors to be counted in telemetry (think things like
network errors, shutdown errors, etc.).
To assist this conversion, the `handle_error!` macro can be used to
To assist this conversion, the `handle_error` procedural macro can be used to
automatically convert between `Result` and `ApiResult` using
`GetErrorHandling`. Note that this depends on having the `Result` type
imported in your module with a `use` statement.

2
third_party/rust/error-support/build.rs поставляемый
Просмотреть файл

@ -4,5 +4,5 @@
*/
fn main() {
uniffi_build::generate_scaffolding("./src/errorsupport.udl").unwrap();
uniffi::generate_scaffolding("./src/errorsupport.udl").unwrap();
}

4
third_party/rust/error-support/src/lib.rs поставляемый
Просмотреть файл

@ -33,6 +33,8 @@ pub use reporting::{
unset_application_error_reporter, ApplicationErrorReporter,
};
pub use error_support_macros::handle_error;
mod handling;
pub use handling::{convert_log_report_error, ErrorHandling, ErrorReporting, GetErrorHandling};
@ -157,4 +159,4 @@ macro_rules! define_error {
};
}
uniffi_macros::include_scaffolding!("errorsupport");
uniffi::include_scaffolding!("errorsupport");

13
third_party/rust/error-support/src/macros.rs поставляемый
Просмотреть файл

@ -60,16 +60,3 @@ macro_rules! breadcrumb {
}
};
}
/// Function wrapper macro to convert from a component's internal errors to external errors
/// and optionally log and report the error.
#[macro_export]
macro_rules! handle_error {
{ $($tt:tt)* } => {
let body = || {
$($tt)*
};
let result: Result<_> = body();
result.map_err($crate::convert_log_report_error)
}
}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

34
third_party/rust/glean-core/Cargo.toml поставляемый
Просмотреть файл

@ -10,9 +10,10 @@
# See Cargo.toml.orig for the original contents.
[package]
edition = "2018"
edition = "2021"
rust-version = "1.60"
name = "glean-core"
version = "52.0.1"
version = "52.2.0"
authors = [
"Jan-Erik Rediger <jrediger@mozilla.com>",
"The Glean Team <glean-team@mozilla.com>",
@ -32,9 +33,10 @@ readme = "README.md"
keywords = ["telemetry"]
license = "MPL-2.0"
repository = "https://github.com/mozilla/glean"
resolver = "1"
[package.metadata.glean]
glean-parser = "6.4.0"
glean-parser = "7.0.0"
[dependencies.bincode]
version = "1.2.1"
@ -46,6 +48,11 @@ features = ["serde"]
[dependencies.crossbeam-channel]
version = "0.5"
[dependencies.env_logger]
version = "0.9.0"
optional = true
default-features = false
[dependencies.flate2]
version = "1.0.19"
@ -77,18 +84,13 @@ version = "1.0.4"
version = "0.1.40"
[dependencies.uniffi]
version = "0.21.0"
[dependencies.uniffi_macros]
version = "0.21.0"
version = "0.23.0"
default-features = false
[dependencies.uuid]
version = "1.0"
features = ["v4"]
[dependencies.whatsys]
version = "0.1.2"
[dependencies.zeitstempel]
version = "0.1.0"
@ -110,17 +112,15 @@ version = "0.4"
[dev-dependencies.tempfile]
version = "3.1.0"
[build-dependencies.uniffi_build]
version = "0.21.0"
features = ["builtin-bindgen"]
[build-dependencies.uniffi]
version = "0.23.0"
features = ["build"]
default-features = false
[features]
enable_env_logger = ["env_logger"]
preinit_million_queue = []
[target."cfg(not(target_os = \"android\"))".dependencies.env_logger]
version = "0.9.0"
default-features = false
[target."cfg(target_os = \"android\")".dependencies.android_logger]
version = "0.11.0"
default-features = false

2
third_party/rust/glean-core/build.rs поставляемый
Просмотреть файл

@ -1,3 +1,3 @@
fn main() {
uniffi_build::generate_scaffolding("./src/glean.udl").unwrap();
uniffi::generate_scaffolding("./src/glean.udl").unwrap();
}

Просмотреть файл

@ -2,7 +2,9 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
use crate::metrics::{Datetime, DatetimeMetric, StringMetric, TimeUnit, TimespanMetric};
use crate::metrics::{
Datetime, DatetimeMetric, QuantityMetric, StringMetric, TimeUnit, TimespanMetric,
};
use crate::{CommonMetricData, Lifetime};
use once_cell::sync::Lazy;
@ -26,6 +28,8 @@ pub struct ClientInfoMetrics {
pub channel: Option<String>,
/// The Android specific SDK version of the software running on this hardware device (e.g. "23").
pub android_sdk_version: Option<String>,
/// The Windows specific OS build version (e.g. 19043)
pub windows_build_number: Option<i64>,
/// The manufacturer of the device the application is running on.
/// Not set if the device manufacturer can't be determined (e.g. on Desktop).
pub device_manufacturer: Option<String>,
@ -50,6 +54,7 @@ impl ClientInfoMetrics {
os_version: "Unknown".to_string(),
channel: Some("Unknown".to_string()),
android_sdk_version: None,
windows_build_number: None,
device_manufacturer: None,
device_model: None,
locale: None,
@ -141,6 +146,17 @@ pub mod internal_metrics {
})
});
pub static windows_build_number: Lazy<QuantityMetric> = Lazy::new(|| {
QuantityMetric::new(CommonMetricData {
name: "windows_build_number".into(),
category: "".into(),
send_in_pings: vec!["glean_client_info".into()],
lifetime: Lifetime::Application,
disabled: false,
..Default::default()
})
});
pub static device_manufacturer: Lazy<StringMetric> = Lazy::new(|| {
StringMetric::new(CommonMetricData {
name: "device_manufacturer".into(),

Просмотреть файл

@ -22,10 +22,6 @@
//! });
//! ```
// TODO: remove this once bug 1672440 is merged and the code below
// will actually be used somewhere.
#![allow(dead_code)]
use std::{
mem,
sync::{
@ -177,6 +173,12 @@ impl DispatchGuard {
Ok(())
}
/// Flushes the pre-init buffer.
///
/// This function blocks until tasks queued prior to this call are finished.
/// Once the initial queue is empty the dispatcher will wait for new tasks to be launched.
///
/// Returns an error if called multiple times.
fn flush_init(&mut self) -> Result<usize, DispatchError> {
// We immediately stop queueing in the pre-init buffer.
let old_val = self.queue_preinit.swap(false, Ordering::SeqCst);
@ -320,29 +322,16 @@ impl Dispatcher {
self.guard.clone()
}
fn block_on_queue(&self) {
self.guard().block_on_queue()
}
/// Waits for the worker thread to finish and finishes the dispatch queue.
///
/// You need to call `shutdown` to initiate a shutdown of the queue.
#[cfg(test)]
fn join(mut self) -> Result<(), DispatchError> {
if let Some(worker) = self.worker.take() {
worker.join().map_err(|_| DispatchError::WorkerPanic)?;
}
Ok(())
}
/// Flushes the pre-init buffer.
///
/// This function blocks until tasks queued prior to this call are finished.
/// Once the initial queue is empty the dispatcher will wait for new tasks to be launched.
///
/// Returns an error if called multiple times.
pub fn flush_init(&mut self) -> Result<usize, DispatchError> {
self.guard().flush_init()
}
}
#[cfg(test)]
@ -365,10 +354,11 @@ mod test {
let main_thread_id = thread::current().id();
let thread_canary = Arc::new(AtomicBool::new(false));
let mut dispatcher = Dispatcher::new(100);
let dispatcher = Dispatcher::new(100);
// Force the Dispatcher out of the pre-init queue mode.
dispatcher
.guard()
.flush_init()
.expect("Failed to get out of preinit queue mode");
@ -384,7 +374,7 @@ mod test {
})
.expect("Failed to dispatch the test task");
dispatcher.block_on_queue();
dispatcher.guard().block_on_queue();
assert!(thread_canary.load(Ordering::SeqCst));
assert_eq!(main_thread_id, thread::current().id());
}
@ -396,7 +386,7 @@ mod test {
let main_thread_id = thread::current().id();
let thread_canary = Arc::new(AtomicU8::new(0));
let mut dispatcher = Dispatcher::new(100);
let dispatcher = Dispatcher::new(100);
// Add 3 tasks to queue each one increasing thread_canary by 1 to
// signal that the tasks ran.
@ -417,6 +407,7 @@ mod test {
// Flush the queue and wait for the tasks to complete.
dispatcher
.guard()
.flush_init()
.expect("Failed to get out of preinit queue mode");
// Validate that we have the expected canary value.
@ -427,7 +418,7 @@ mod test {
fn preinit_tasks_are_processed_after_flush() {
enable_test_logging();
let mut dispatcher = Dispatcher::new(10);
let dispatcher = Dispatcher::new(10);
let result = Arc::new(Mutex::new(vec![]));
for i in 1..=5 {
@ -441,7 +432,7 @@ mod test {
}
result.lock().unwrap().push(0);
dispatcher.flush_init().unwrap();
dispatcher.guard().flush_init().unwrap();
for i in 6..=10 {
let result = Arc::clone(&result);
dispatcher
@ -452,7 +443,7 @@ mod test {
.unwrap();
}
dispatcher.block_on_queue();
dispatcher.guard().block_on_queue();
// This additionally checks that tasks were executed in order.
assert_eq!(
@ -465,11 +456,11 @@ mod test {
fn tasks_after_shutdown_are_not_processed() {
enable_test_logging();
let mut dispatcher = Dispatcher::new(10);
let dispatcher = Dispatcher::new(10);
let result = Arc::new(Mutex::new(vec![]));
dispatcher.flush_init().unwrap();
dispatcher.guard().flush_init().unwrap();
dispatcher.guard().shutdown().unwrap();
{
@ -491,7 +482,7 @@ mod test {
fn preinit_buffer_fills_up() {
enable_test_logging();
let mut dispatcher = Dispatcher::new(5);
let dispatcher = Dispatcher::new(5);
let result = Arc::new(Mutex::new(vec![]));
@ -513,7 +504,7 @@ mod test {
assert_eq!(Err(DispatchError::QueueFull), err);
}
dispatcher.flush_init().unwrap();
dispatcher.guard().flush_init().unwrap();
{
let result = Arc::clone(&result);
@ -525,7 +516,7 @@ mod test {
.unwrap();
}
dispatcher.block_on_queue();
dispatcher.guard().block_on_queue();
assert_eq!(&*result.lock().unwrap(), &[1, 2, 3, 4, 5, 20]);
}
@ -538,7 +529,7 @@ mod test {
// but we can quickly queue more slow tasks than the pre-init buffer holds
// and then guarantuee they all run.
let mut dispatcher = Dispatcher::new(5);
let dispatcher = Dispatcher::new(5);
let result = Arc::new(Mutex::new(vec![]));
@ -552,7 +543,7 @@ mod test {
.unwrap();
}
dispatcher.flush_init().unwrap();
dispatcher.guard().flush_init().unwrap();
// Queue more than 5 tasks,
// Each one is slow to process, so we should be faster in queueing

Просмотреть файл

@ -479,6 +479,9 @@ impl EventDatabase {
// Adjust things so this group starts 1ms after the previous one.
inter_group_offset = highest_ts + 1;
}
} else if cur_ec == 0 {
// bug 1811872 - cur_ec might need initialization.
cur_ec = execution_counter;
}
event.event.timestamp = event.event.timestamp - intra_group_offset + inter_group_offset;
if execution_counter != cur_ec {
@ -1199,4 +1202,90 @@ mod test {
)
);
}
#[test]
fn normalize_store_non_zero_ec() {
// After the first run, execution_counter will likely be non-zero.
// Ensure normalizing a store that begins with non-zero ec works.
let (glean, _dir) = new_glean(None);
let store_name = "store-name";
let glean_restarted = StoredEvent {
event: RecordedEvent {
timestamp: 2,
category: "glean".into(),
name: "restarted".into(),
extra: None,
},
execution_counter: Some(2),
};
let not_glean_restarted = StoredEvent {
event: RecordedEvent {
timestamp: 20,
category: "category".into(),
name: "name".into(),
extra: None,
},
execution_counter: Some(2),
};
let glean_restarted_2 = StoredEvent {
event: RecordedEvent {
timestamp: 2,
category: "glean".into(),
name: "restarted".into(),
extra: None,
},
execution_counter: Some(3),
};
let mut store = vec![
glean_restarted,
not_glean_restarted.clone(),
glean_restarted_2,
];
let glean_start_time = glean.start_time();
glean
.event_storage()
.normalize_store(&glean, store_name, &mut store, glean_start_time);
assert_eq!(1, store.len());
assert_eq!(
StoredEvent {
event: RecordedEvent {
timestamp: 0,
..not_glean_restarted.event
},
execution_counter: None
},
store[0]
);
// And we should have no InvalidState errors on glean.restarted.
assert!(test_get_num_recorded_errors(
&glean,
&CommonMetricData {
name: "restarted".into(),
category: "glean".into(),
send_in_pings: vec![store_name.into()],
lifetime: Lifetime::Ping,
..Default::default()
}
.into(),
ErrorType::InvalidState
)
.is_err());
// (and, just because we're here, double-check there are no InvalidValue either).
assert!(test_get_num_recorded_errors(
&glean,
&CommonMetricData {
name: "restarted".into(),
category: "glean".into(),
send_in_pings: vec![store_name.into()],
lifetime: Lifetime::Ping,
..Default::default()
}
.into(),
ErrorType::InvalidValue
)
.is_err());
}
}

1
third_party/rust/glean-core/src/glean.udl поставляемый
Просмотреть файл

@ -85,6 +85,7 @@ dictionary ClientInfoMetrics {
string? device_manufacturer = null;
string? device_model = null;
string? android_sdk_version = null;
i64? windows_build_number = null;
};
[Error]

27
third_party/rust/glean-core/src/lib.rs поставляемый
Просмотреть файл

@ -3,6 +3,7 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#![allow(clippy::significant_drop_in_scrutinee)]
#![allow(clippy::uninlined_format_args)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(missing_docs)]
@ -340,7 +341,6 @@ fn initialize_inner(
// send a dirty startup baseline ping below. Immediately set it to
// `false` so that dirty startup pings won't be sent if Glean
// initialization does not complete successfully.
// TODO Bug 1672956 will decide where to set this flag again.
dirty_flag = glean.is_dirty_flag_set();
glean.set_dirty_flag(false);
@ -535,6 +535,9 @@ fn initialize_core_metrics(glean: &Glean, client_info: &ClientInfoMetrics) {
if let Some(android_sdk_version) = client_info.android_sdk_version.as_ref() {
core_metrics::internal_metrics::android_sdk_version.set_sync(glean, android_sdk_version);
}
if let Some(windows_build_number) = client_info.windows_build_number.as_ref() {
core_metrics::internal_metrics::windows_build_number.set_sync(glean, *windows_build_number);
}
if let Some(device_manufacturer) = client_info.device_manufacturer.as_ref() {
core_metrics::internal_metrics::device_manufacturer.set_sync(glean, device_manufacturer);
}
@ -602,10 +605,14 @@ pub extern "C" fn glean_enable_logging() {
};
}
// Make sure logging does something on non Android platforms as well.
// When specifically requested make sure logging does something on non-Android platforms as well.
// Use the RUST_LOG environment variable to set the desired log level,
// e.g. setting RUST_LOG=debug sets the log level to debug.
#[cfg(all(not(target_os = "android"), not(target_os = "ios")))]
#[cfg(all(
not(target_os = "android"),
not(target_os = "ios"),
feature = "enable_env_logger"
))]
{
match env_logger::try_init() {
Ok(_) => log::trace!("stdout logging should be hooked up!"),
@ -936,11 +943,17 @@ static FD_LOGGER: OnceCell<fd_logger::FdLogger> = OnceCell::new();
/// `fd` is a writable file descriptor (on Unix) or file handle (on Windows).
///
/// # Safety
/// Unsafe because the fd u64 passed in will be interpreted as either a file
/// descriptor (Unix) or file handle (Windows) without any checking.
///
/// `fd` MUST be a valid open file descriptor (Unix) or file handle (Windows).
/// This function is marked safe,
/// because we can't call unsafe functions from generated UniFFI code.
#[cfg(all(not(target_os = "android"), not(target_os = "ios")))]
pub fn glean_enable_logging_to_fd(fd: u64) {
// SAFETY: TODO.
// SAFETY:
// This functions is unsafe.
// Due to UniFFI restrictions we cannot mark it as such.
//
// `fd` MUST be a valid open file descriptor (Unix) or file handle (Windows).
unsafe {
// Set up logging to a file descriptor/handle. For this usage, the
// language binding should setup a pipe and pass in the descriptor to
@ -965,7 +978,7 @@ pub fn glean_enable_logging_to_fd(_fd: u64) {
#[allow(missing_docs)]
mod ffi {
use super::*;
uniffi_macros::include_scaffolding!("glean");
uniffi::include_scaffolding!("glean");
type CowString = Cow<'static, str>;

Просмотреть файл

@ -1075,6 +1075,6 @@ fn test_activity_api() {
// Signal back that client is ianctive.
glean.handle_client_inactive();
// Check that we set everything we needed for the 'inactuve' status.
// Check that we set everything we needed for the 'inactive' status.
assert!(!glean.is_dirty_flag_set());
}

2
third_party/rust/glean-core/src/ping/mod.rs поставляемый
Просмотреть файл

@ -37,7 +37,7 @@ pub struct PingMaker;
fn merge(a: &mut JsonValue, b: &JsonValue) {
match (a, b) {
(&mut JsonValue::Object(ref mut a), &JsonValue::Object(ref b)) => {
(&mut JsonValue::Object(ref mut a), JsonValue::Object(b)) => {
for (k, v) in b {
merge(a.entry(k.clone()).or_insert(JsonValue::Null), v);
}

10
third_party/rust/glean-core/tests/labeled.rs поставляемый
Просмотреть файл

@ -372,7 +372,7 @@ fn seen_labels_get_reloaded_from_disk() {
{
// Set the maximum number of labels
for i in 1..=16 {
let label = format!("label{}", i);
let label = format!("label{i}");
labeled.get(label).add_sync(&glean, i);
}
@ -382,7 +382,7 @@ fn seen_labels_get_reloaded_from_disk() {
// Check that the data is there
for i in 1..=16 {
let label = format!("label{}", i);
let label = format!("label{i}");
assert_eq!(
i,
snapshot["labeled_counter"]["telemetry.labeled_metric"][&label]
@ -405,7 +405,7 @@ fn seen_labels_get_reloaded_from_disk() {
// Check that the old data is still there
for i in 1..=16 {
let label = format!("label{}", i);
let label = format!("label{i}");
assert_eq!(
i,
snapshot["labeled_counter"]["telemetry.labeled_metric"][&label]
@ -438,7 +438,7 @@ fn caching_metrics_with_dynamic_labels() {
// Create multiple metric instances and cache them for later use.
let metrics = (1..=20)
.map(|i| {
let label = format!("label{}", i);
let label = format!("label{i}");
labeled.get(label)
})
.collect::<Vec<_>>();
@ -472,7 +472,7 @@ fn caching_metrics_with_dynamic_labels_across_pings() {
// Create multiple metric instances and cache them for later use.
let metrics = (1..=20)
.map(|i| {
let label = format!("label{}", i);
let label = format!("label{i}");
labeled.get(label)
})
.collect::<Vec<_>>();

6
third_party/rust/glean-core/tests/uuid.rs поставляемый
Просмотреть файл

@ -26,16 +26,14 @@ fn uuid_is_generated_and_stored() {
let snapshot = glean.snapshot("core", false);
assert!(
snapshot.contains(r#""local.uuid": ""#),
"Snapshot 1: {}",
snapshot
"Snapshot 1: {snapshot}"
);
uuid.generate_and_set_sync(&glean);
let snapshot = glean.snapshot("core", false);
assert!(
snapshot.contains(r#""local.uuid": ""#),
"Snapshot 2: {}",
snapshot
"Snapshot 2: {snapshot}"
);
}

2
third_party/rust/glean/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"25c5fac663fdf1019bfefc5303507f9e2d11a018f30eb98e6dded07a80002465","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5bc5b1c46695f628e1023662752272e938a963b535d5686bd1ecc433f9e018c4","src/common_test.rs":"7d7d75ec7c3b3c9c79ada8ca8a31042aa1d7305091ae6f65af2d1ae8eb5ab3a6","src/configuration.rs":"5c460d3f512409f04a970a3180b3d81bdf18eec8ba115dc5cc434066b58b6b17","src/core_metrics.rs":"76ac5350cb6f82d9a193d519b085a08f138dceba77da3514bd0c636bcdefefca","src/lib.rs":"eaaa52789edbfbb1c8674c752ca3656212ac725eff2ec1b85381d023c784b965","src/net/http_uploader.rs":"43812a70d19a38e8d7a093c8076c2b6345372c3c861b0f3511428762700a65e0","src/net/mod.rs":"e05e61860f5828caa529c3ea75a2fff7371bfa3dce057077a74c09baf41a568a","src/private/event.rs":"02bbebf545695812e5055741cc0b5f3c99eda2039e684e26fcdd5f087ed15fe3","src/private/mod.rs":"0364ecf5f0439443a5b209583f4ff2c474b79f7c253c981ab0b7cdc528368698","src/private/ping.rs":"cbdc57f41fc9d46e56b4dfff91ac683753d1f8b3ecd0aa9bc3419e3595b8b81b","src/system.rs":"4e0ec743f6d06a9c83e46c95d0286d5745f4642398c942fce8ae7a1ea5202d37","src/test.rs":"167fad6dd350f8c63efaf0d2ba5b161e067203534a0e3a454881c1927fdd2899","tests/common/mod.rs":"37cd4c48e140c793b852ae09fb3e812da28a4412977295015bcbffd632fcf294","tests/init_fails.rs":"179788f0ead2e1fe1cbcd498b891cf9367b9dcb0b03b2961fbba084223682de7","tests/never_init.rs":"1f33b8ce7ca3514b57b48cc16d98408974c85cf8aa7d13257ffc2ad878ebb295","tests/no_time_to_init.rs":"91d789fc0b46a9015b6613aa80cd6b5106a7b012624a174130ea2c54b1b0574f","tests/overflowing_preinit.rs":"a7878a115bde1f291dc6fd71d5772bcffa2c172186b0fa49bb534c6d1f3a1307","tests/persist_ping_lifetime.rs":"251540b6b567d5867a408b81fac478c08aa5bdcb313c2ced5bdda97d806cc4cc","tests/persist_ping_lifetime_nopanic.rs":"c862d124f0e82ada02c87f13ff116d55f35687774a49da0971ab46a46c547b44","tests/schema.rs":"390b5533ac5c4d49bb049ea1311a71d7d5b911ce259e7a07baadb7f1fc755946","tests/simple.rs":"fb0c99773ffd25edae1431be14680c1051266cfff497b9225cabd2afd270ef04"},"package":"b82332dcb52cd5abbcda9728131f105865c94cd68f5c2814c970b685f70547b4"}
{"files":{"Cargo.toml":"4bc54950917443a58e03b3cfb7b82a5ae696823e000fef651a4e70beab427360","LICENSE":"1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5","README.md":"5627cc81e6187ab6c2b4dff061af16d559edcab64ba786bac39daa69c703c595","src/common_test.rs":"de47b53dcca37985c0a2b8c02daecbf32309aa54f5a4dd9290719c2c1fd0fa55","src/configuration.rs":"4ca9be0a49a9c50f4ebe868d4bfa04fe27619c871a436911f850b4dcf6e7a7b2","src/core_metrics.rs":"dd17b482613894af08b51a2cff6dc1e84a6dbd853c14a55566e6698348941ced","src/lib.rs":"51fbcce68289ff8733e85143692b811683ff3c630e8323d7a0b9701a001ad491","src/net/http_uploader.rs":"43812a70d19a38e8d7a093c8076c2b6345372c3c861b0f3511428762700a65e0","src/net/mod.rs":"e05e61860f5828caa529c3ea75a2fff7371bfa3dce057077a74c09baf41a568a","src/private/event.rs":"02bbebf545695812e5055741cc0b5f3c99eda2039e684e26fcdd5f087ed15fe3","src/private/mod.rs":"0364ecf5f0439443a5b209583f4ff2c474b79f7c253c981ab0b7cdc528368698","src/private/ping.rs":"cbdc57f41fc9d46e56b4dfff91ac683753d1f8b3ecd0aa9bc3419e3595b8b81b","src/system.rs":"6eae5b41c15eba9cad6dbd116abe3519ee3e1fe034e79bdd692b029829a8c384","src/test.rs":"d367c85a106df58272b8a779da1769664ba8a39357fd650d9f21c21855b38906","tests/common/mod.rs":"37cd4c48e140c793b852ae09fb3e812da28a4412977295015bcbffd632fcf294","tests/init_fails.rs":"28fd7726e76ca1295eb0905eca0b2ec65b0accfa28432c9ff90ec8f92616fc79","tests/never_init.rs":"1f33b8ce7ca3514b57b48cc16d98408974c85cf8aa7d13257ffc2ad878ebb295","tests/no_time_to_init.rs":"e7df75b47897fbf2c860a2e1c1c225b57598b8d1a39125ca897fe8d825bf0338","tests/overflowing_preinit.rs":"7ad4b2274dd9240b53430859a4eb1d2597cf508a5a678333f3d3abbadd2ed4a7","tests/persist_ping_lifetime.rs":"81415dc1d74743f02269f0d0dfa524003147056853f080276972e64a0b761d3c","tests/persist_ping_lifetime_nopanic.rs":"18379d3ffbf4a2c8c684c04ff7a0660b86dfbbb447db2d24dfed6073cb7ddf8f","tests/schema.rs":"030ff2b88c56f1f9a3c580277a9311ccc579f25e44f2a89f2afc09d7c4ddf054","tests/simple.rs":"b099034b0599bdf4650e0fa09991a8413fc5fbf397755fc06c8963d4c7c8dfa6"},"package":"3dea54c0198181ff3bd8c7d39bdc69f22a4c0504da5dd9138666edef084e26be"}

10
third_party/rust/glean/Cargo.toml поставляемый
Просмотреть файл

@ -10,9 +10,10 @@
# See Cargo.toml.orig for the original contents.
[package]
edition = "2018"
edition = "2021"
rust-version = "1.60"
name = "glean"
version = "52.0.1"
version = "52.2.0"
authors = [
"Jan-Erik Rediger <jrediger@mozilla.com>",
"The Glean Team <glean-team@mozilla.com>",
@ -32,6 +33,7 @@ keywords = [
]
license = "MPL-2.0"
repository = "https://github.com/mozilla/glean"
resolver = "1"
[dependencies.chrono]
version = "0.4.10"
@ -41,7 +43,7 @@ features = ["serde"]
version = "0.5"
[dependencies.glean-core]
version = "52.0.1"
version = "52.2.0"
[dependencies.inherent]
version = "1"
@ -70,7 +72,7 @@ version = "1.0"
features = ["v4"]
[dependencies.whatsys]
version = "0.1.2"
version = "0.3.0"
[dev-dependencies.env_logger]
version = "0.9.0"

10
third_party/rust/glean/README.md поставляемый
Просмотреть файл

@ -19,15 +19,9 @@ All documentation is available online:
## Example
```rust,no_run
use glean::{Configuration, Error, metrics::*};
use glean::{ConfigurationBuilder, Error, metrics::*};
let cfg = Configuration {
data_path: "/tmp/data".into(),
application_id: "org.mozilla.glean_core.example".into(),
upload_enabled: true,
max_events: None,
delay_ping_lifetime_io: false,
};
let cfg = ConfigurationBuilder::new(true, "/tmp/data", "org.mozilla.glean_core.example").build();
glean::initialize(cfg)?;
let prototype_ping = PingType::new("prototype", true, true, vec![]);

16
third_party/rust/glean/src/common_test.rs поставляемый
Просмотреть файл

@ -3,7 +3,7 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
use crate::ClientInfoMetrics;
use crate::Configuration;
use crate::{Configuration, ConfigurationBuilder};
use std::sync::{Mutex, MutexGuard};
use once_cell::sync::Lazy;
@ -40,17 +40,9 @@ pub(crate) fn new_glean(
let cfg = match configuration {
Some(c) => c,
None => Configuration {
data_path: tmpname,
application_id: GLOBAL_APPLICATION_ID.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,
trim_data_to_registered_pings: false,
},
None => ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID)
.with_server_endpoint("invalid-test-host")
.build(),
};
crate::test_reset_glean(cfg, ClientInfoMetrics::unknown(), clear_stores);

106
third_party/rust/glean/src/configuration.rs поставляемый
Просмотреть файл

@ -35,3 +35,109 @@ pub struct Configuration {
/// _before_ init, you shouldn't use this.
pub trim_data_to_registered_pings: bool,
}
/// Configuration builder.
///
/// Let's you build a configuration from the required fields
/// and let you set optional fields individually.
#[derive(Debug)]
pub struct Builder {
/// Required: Whether upload should be enabled.
pub upload_enabled: bool,
/// Required: Path to a directory to store all data in.
pub data_path: PathBuf,
/// Required: The application ID (will be sanitized during initialization).
pub application_id: String,
/// Optional: The maximum number of events to store before sending a ping containing events.
/// Default: `None`
pub max_events: Option<usize>,
/// Optional: Whether Glean should delay persistence of data from metrics with ping lifetime.
/// Default: `false`
pub delay_ping_lifetime_io: bool,
/// Optional: The server pings are sent to.
/// Default: `None`
pub server_endpoint: Option<String>,
/// Optional: The instance of the uploader used to send pings.
/// Default: `None`
pub uploader: Option<Box<dyn PingUploader + 'static>>,
/// Optional: Whether Glean should schedule "metrics" pings for you.
/// Default: `false`
pub use_core_mps: bool,
/// Optional: Whether Glean should limit its storage to only that of registered pings.
/// Unless you know that all your and your libraries' pings are appropriately registered
/// _before_ init, you shouldn't use this.
/// Default: `false`
pub trim_data_to_registered_pings: bool,
}
impl Builder {
/// A new configuration builder.
pub fn new<P: Into<PathBuf>, S: Into<String>>(
upload_enabled: bool,
data_path: P,
application_id: S,
) -> Self {
Self {
upload_enabled,
data_path: data_path.into(),
application_id: application_id.into(),
max_events: None,
delay_ping_lifetime_io: false,
server_endpoint: None,
uploader: None,
use_core_mps: false,
trim_data_to_registered_pings: false,
}
}
/// Generate the full configuration.
pub fn build(self) -> Configuration {
Configuration {
upload_enabled: self.upload_enabled,
data_path: self.data_path,
application_id: self.application_id,
max_events: self.max_events,
delay_ping_lifetime_io: self.delay_ping_lifetime_io,
server_endpoint: self.server_endpoint,
uploader: self.uploader,
use_core_mps: self.use_core_mps,
trim_data_to_registered_pings: self.trim_data_to_registered_pings,
}
}
/// Set the maximum number of events to store before sending a ping containing events.
pub fn with_max_events(mut self, max_events: usize) -> Self {
self.max_events = Some(max_events);
self
}
/// Set whether Glean should delay persistence of data from metrics with ping lifetime.
pub fn with_delay_ping_lifetime_io(mut self, value: bool) -> Self {
self.delay_ping_lifetime_io = value;
self
}
/// Set the server pings are sent to.
pub fn with_server_endpoint<S: Into<String>>(mut self, server_endpoint: S) -> Self {
self.server_endpoint = Some(server_endpoint.into());
self
}
/// Set the instance of the uploader used to send pings.
pub fn with_uploader<U: PingUploader + 'static>(mut self, uploader: U) -> Self {
self.uploader = Some(Box::new(uploader));
self
}
/// Set whether Glean should schedule "metrics" pings for you.
pub fn with_use_core_mps(mut self, value: bool) -> Self {
self.use_core_mps = value;
self
}
/// Set whether Glean should limit its storage to only that of registered pings.
pub fn with_trim_data_to_registered_pings(mut self, value: bool) -> Self {
self.trim_data_to_registered_pings = value;
self
}
}

1
third_party/rust/glean/src/core_metrics.rs поставляемый
Просмотреть файл

@ -33,6 +33,7 @@ impl From<ClientInfoMetrics> for glean_core::ClientInfoMetrics {
app_display_version: metrics.app_display_version,
channel: metrics.channel,
os_version: system::get_os_version(),
windows_build_number: system::get_windows_build_number(),
architecture: system::ARCH.to_string(),
..Default::default()
}

17
third_party/rust/glean/src/lib.rs поставляемый
Просмотреть файл

@ -2,6 +2,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#![allow(clippy::uninlined_format_args)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(missing_docs)]
@ -18,18 +19,8 @@
//! Initialize Glean, register a ping and then send it.
//!
//! ```rust,no_run
//! # use glean::{Configuration, ClientInfoMetrics, Error, private::*};
//! let cfg = Configuration {
//! data_path: "/tmp/data".into(),
//! application_id: "org.mozilla.glean_core.example".into(),
//! upload_enabled: true,
//! max_events: None,
//! delay_ping_lifetime_io: false,
//! server_endpoint: None,
//! uploader: None,
//! use_core_mps: false,
//! trim_data_to_registered_pings: false,
//! };
//! # use glean::{ConfigurationBuilder, ClientInfoMetrics, Error, private::*};
//! let cfg = ConfigurationBuilder::new(true, "/tmp/data", "org.mozilla.glean_core.example").build();
//! glean::initialize(cfg, ClientInfoMetrics::unknown());
//!
//! let prototype_ping = PingType::new("prototype", true, true, vec!());
@ -40,8 +31,8 @@
use std::collections::HashMap;
use std::path::Path;
pub use configuration::Configuration;
use configuration::DEFAULT_GLEAN_ENDPOINT;
pub use configuration::{Builder as ConfigurationBuilder, Configuration};
pub use core_metrics::ClientInfoMetrics;
pub use glean_core::{
metrics::{Datetime, DistributionData, MemoryUnit, Rate, RecordedEvent, TimeUnit, TimerId},

16
third_party/rust/glean/src/system.rs поставляемый
Просмотреть файл

@ -73,6 +73,22 @@ pub fn get_os_version() -> String {
parse_linux_os_string(whatsys::kernel_version().unwrap_or_else(|| "Unknown".to_owned()))
}
#[cfg(target_os = "windows")]
/// Returns the Windows build number, e.g. 22000
pub fn get_windows_build_number() -> Option<i64> {
match whatsys::windows_build_number() {
// Cast to i64 to work with QuantityMetric type
Some(i) => Some(i as i64),
_ => None,
}
}
#[cfg(not(target_os = "windows"))]
/// Returns None, for non-Windows operating systems
pub fn get_windows_build_number() -> Option<i64> {
None
}
#[cfg(target_os = "linux")]
fn parse_linux_os_string(os_str: String) -> String {
os_str.split('.').take(2).collect::<Vec<&str>>().join(".")

231
third_party/rust/glean/src/test.rs поставляемый
Просмотреть файл

@ -2,9 +2,13 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
use std::io::Read;
use std::sync::{Arc, Barrier, Mutex};
use std::thread::{self, ThreadId};
use flate2::read::GzDecoder;
use serde_json::Value as JsonValue;
use crate::private::PingType;
use crate::private::{BooleanMetric, CounterMetric, EventMetric, StringMetric};
@ -473,9 +477,50 @@ fn initializing_twice_is_a_noop() {
}
#[test]
#[ignore] // TODO: To be done in bug 1673668.
fn dont_handle_events_when_uninitialized() {
todo!()
let _lock = lock_test();
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
test_reset_glean(
Configuration {
data_path: tmpname.clone(),
application_id: GLOBAL_APPLICATION_ID.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,
trim_data_to_registered_pings: false,
},
ClientInfoMetrics::unknown(),
true,
);
// Ensure there's at least one event recorded,
// otherwise the ping is not sent.
let click: EventMetric<traits::NoExtraKeys> = private::EventMetric::new(CommonMetricData {
name: "click".into(),
category: "ui".into(),
send_in_pings: vec!["events".into()],
lifetime: Lifetime::Ping,
disabled: false,
..Default::default()
});
click.record(None);
// Wait for the dispatcher.
assert_ne!(None, click.test_get_value(None));
// Now destroy Glean. We test submission when not initialized.
destroy_glean(false, &tmpname);
// We reach into `glean_core` to test this,
// only there we can synchronously submit and get a return value.
assert!(!glean_core::glean_submit_ping_by_name_sync(
"events".to_string(),
None
));
}
// TODO: Should probably move into glean-core.
@ -542,9 +587,89 @@ fn the_app_channel_must_be_correctly_set_if_requested() {
}
#[test]
#[ignore] // TODO: To be done in bug 1673672.
fn ping_collection_must_happen_after_concurrently_scheduled_metrics_recordings() {
todo!()
// Given the following block of code:
//
// Metric.A.set("SomeTestValue")
// Glean.submitPings(listOf("custom-ping-1"))
//
// This test ensures that "custom-ping-1" contains "metric.a" with a value of "SomeTestValue"
// when the ping is collected.
let _lock = lock_test();
let (s, r) = crossbeam_channel::bounded(1);
// Define a fake uploader that reports back the submission URL
// using a crossbeam channel.
#[derive(Debug)]
pub struct FakeUploader {
sender: crossbeam_channel::Sender<(String, JsonValue)>,
}
impl net::PingUploader for FakeUploader {
fn upload(
&self,
url: String,
body: Vec<u8>,
_headers: Vec<(String, String)>,
) -> net::UploadResult {
// Decode the gzipped body.
let mut gzip_decoder = GzDecoder::new(&body[..]);
let mut s = String::with_capacity(body.len());
let data = gzip_decoder
.read_to_string(&mut s)
.ok()
.map(|_| &s[..])
.or_else(|| std::str::from_utf8(&body).ok())
.and_then(|payload| serde_json::from_str(payload).ok())
.unwrap();
self.sender.send((url, data)).unwrap();
net::UploadResult::http_status(200)
}
}
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
test_reset_glean(
Configuration {
data_path: tmpname,
application_id: GLOBAL_APPLICATION_ID.into(),
upload_enabled: true,
max_events: None,
delay_ping_lifetime_io: false,
server_endpoint: Some("invalid-test-host".into()),
uploader: Some(Box::new(FakeUploader { sender: s })),
use_core_mps: false,
trim_data_to_registered_pings: false,
},
ClientInfoMetrics::unknown(),
true,
);
let ping_name = "custom_ping_1";
let ping = private::PingType::new(ping_name, true, false, vec![]);
let metric = private::StringMetric::new(CommonMetricData {
name: "string_metric".into(),
category: "telemetry".into(),
send_in_pings: vec![ping_name.into()],
lifetime: Lifetime::Ping,
disabled: false,
..Default::default()
});
let test_value = "SomeTestValue";
metric.set(test_value.to_string());
ping.submit(None);
// Wait for the ping to arrive.
let (url, body) = r.recv().unwrap();
assert!(url.contains(ping_name));
assert_eq!(
test_value,
body["metrics"]["string"]["telemetry.string_metric"]
);
}
#[test]
@ -751,15 +876,99 @@ fn no_sending_of_deletion_ping_if_unchanged_outside_of_run() {
}
#[test]
#[ignore] // TODO: To be done in bug 1672956.
fn test_sending_of_startup_baseline_ping_with_application_lifetime_metric() {
todo!()
}
let _lock = lock_test();
#[test]
#[ignore] // TODO: To be done in bug 1672956.
fn test_dirty_flag_is_reset_to_false() {
todo!()
let (s, r) = crossbeam_channel::bounded(1);
// Define a fake uploader that reports back the submission URL
// using a crossbeam channel.
#[derive(Debug)]
pub struct FakeUploader {
sender: crossbeam_channel::Sender<(String, JsonValue)>,
}
impl net::PingUploader for FakeUploader {
fn upload(
&self,
url: String,
body: Vec<u8>,
_headers: Vec<(String, String)>,
) -> net::UploadResult {
// Decode the gzipped body.
let mut gzip_decoder = GzDecoder::new(&body[..]);
let mut s = String::with_capacity(body.len());
let data = gzip_decoder
.read_to_string(&mut s)
.ok()
.map(|_| &s[..])
.or_else(|| std::str::from_utf8(&body).ok())
.and_then(|payload| serde_json::from_str(payload).ok())
.unwrap();
self.sender.send((url, data)).unwrap();
net::UploadResult::http_status(200)
}
}
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
test_reset_glean(
Configuration {
data_path: tmpname.clone(),
application_id: GLOBAL_APPLICATION_ID.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,
trim_data_to_registered_pings: false,
},
ClientInfoMetrics::unknown(),
true,
);
// Reaching into the core.
glean_core::glean_set_dirty_flag(true);
let metric = private::StringMetric::new(CommonMetricData {
name: "app_lifetime".into(),
category: "telemetry".into(),
send_in_pings: vec!["baseline".into()],
lifetime: Lifetime::Application,
disabled: false,
..Default::default()
});
let test_value = "HELLOOOOO!";
metric.set(test_value.into());
assert_eq!(test_value, metric.test_get_value(None).unwrap());
// Restart glean and don't clear the stores.
test_reset_glean(
Configuration {
data_path: tmpname,
application_id: GLOBAL_APPLICATION_ID.into(),
upload_enabled: true,
max_events: None,
delay_ping_lifetime_io: false,
server_endpoint: Some("invalid-test-host".into()),
uploader: Some(Box::new(FakeUploader { sender: s })),
use_core_mps: false,
trim_data_to_registered_pings: false,
},
ClientInfoMetrics::unknown(),
false,
);
let (url, body) = r.recv().unwrap();
assert!(url.contains("/baseline/"));
// We set the dirty bit above.
assert_eq!("dirty_startup", body["ping_info"]["reason"]);
assert_eq!(
test_value,
body["metrics"]["string"]["telemetry.app_lifetime"]
);
}
#[test]

16
third_party/rust/glean/tests/init_fails.rs поставляемый
Просмотреть файл

@ -12,7 +12,7 @@ mod common;
use std::{thread, time::Duration};
use glean::Configuration;
use glean::ConfigurationBuilder;
/// Some user metrics.
mod metrics {
@ -59,17 +59,9 @@ fn init_fails() {
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
let cfg = Configuration {
data_path: tmpname,
application_id: "".into(), // An empty application ID is invalid.
upload_enabled: true,
max_events: None,
delay_ping_lifetime_io: false,
server_endpoint: Some("invalid-test-host".into()),
uploader: None,
use_core_mps: false,
trim_data_to_registered_pings: false,
};
let cfg = ConfigurationBuilder::new(true, tmpname, "")
.with_server_endpoint("invalid-test-host")
.build();
common::initialize(cfg);
metrics::initialization.stop();

Просмотреть файл

@ -10,7 +10,7 @@
mod common;
use glean::Configuration;
use glean::ConfigurationBuilder;
/// Some user metrics.
mod metrics {
@ -57,17 +57,9 @@ fn init_fails() {
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
let cfg = Configuration {
data_path: tmpname,
application_id: "firefox-desktop".into(), // An empty application ID is invalid.
upload_enabled: true,
max_events: None,
delay_ping_lifetime_io: false,
server_endpoint: Some("invalid-test-host".into()),
uploader: None,
use_core_mps: false,
trim_data_to_registered_pings: false,
};
let cfg = ConfigurationBuilder::new(true, tmpname, "firefox-desktop")
.with_server_endpoint("invalid-test-host")
.build();
common::initialize(cfg);
metrics::initialization.stop();

Просмотреть файл

@ -10,7 +10,7 @@
mod common;
use glean::Configuration;
use glean::ConfigurationBuilder;
/// Some user metrics.
mod metrics {
@ -62,17 +62,9 @@ fn overflowing_the_task_queue_records_telemetry() {
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
let cfg = Configuration {
data_path: tmpname,
application_id: "firefox-desktop".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,
trim_data_to_registered_pings: false,
};
let cfg = ConfigurationBuilder::new(true, tmpname, "firefox-desktop")
.with_server_endpoint("invalid-test-host")
.build();
// Insert a bunch of tasks to overflow the queue.
for _ in 0..1010 {

Просмотреть файл

@ -10,7 +10,7 @@
mod common;
use glean::{ClientInfoMetrics, Configuration};
use glean::{ClientInfoMetrics, Configuration, ConfigurationBuilder};
use std::path::PathBuf;
/// Some user metrics.
@ -34,17 +34,10 @@ mod metrics {
}
fn cfg_new(tmpname: PathBuf) -> Configuration {
Configuration {
data_path: tmpname,
application_id: "firefox-desktop".into(),
upload_enabled: true,
max_events: None,
delay_ping_lifetime_io: true,
server_endpoint: Some("invalid-test-host".into()),
uploader: None,
use_core_mps: false,
trim_data_to_registered_pings: false,
}
ConfigurationBuilder::new(true, tmpname, "firefox-desktop")
.with_server_endpoint("invalid-test-host")
.with_delay_ping_lifetime_io(true)
.build()
}
/// Test scenario: Are ping-lifetime data persisted on shutdown when delayed?

Просмотреть файл

@ -10,21 +10,14 @@
mod common;
use glean::Configuration;
use glean::{Configuration, ConfigurationBuilder};
use std::path::PathBuf;
fn cfg_new(tmpname: PathBuf) -> Configuration {
Configuration {
data_path: tmpname,
application_id: "firefox-desktop".into(),
upload_enabled: true,
max_events: None,
delay_ping_lifetime_io: true,
server_endpoint: Some("invalid-test-host".into()),
uploader: None,
use_core_mps: false,
trim_data_to_registered_pings: false,
}
ConfigurationBuilder::new(true, tmpname, "firefox-desktop")
.with_server_endpoint("invalid-test-host")
.with_delay_ping_lifetime_io(true)
.build()
}
/// Test scenario: `persist_ping_lifetime_data` called after shutdown.

176
third_party/rust/glean/tests/schema.rs поставляемый
Просмотреть файл

@ -2,15 +2,20 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
use std::collections::HashMap;
use std::io::Read;
use flate2::read::GzDecoder;
use glean_core::TextMetric;
use jsonschema_valid::{self, schemas::Draft};
use serde_json::Value;
//use glean::private::{DenominatorMetric, NumeratorMetric, RateMetric};
use glean::net::UploadResult;
use glean::{ClientInfoMetrics, Configuration};
use glean::private::*;
use glean::{
traits, ClientInfoMetrics, CommonMetricData, Configuration, ConfigurationBuilder,
HistogramType, MemoryUnit, TimeUnit,
};
const SCHEMA_JSON: &str = include_str!("../../../glean.1.schema.json");
@ -20,6 +25,26 @@ fn load_schema() -> Value {
const GLOBAL_APPLICATION_ID: &str = "org.mozilla.glean.test.app";
struct SomeExtras {
extra1: Option<String>,
extra2: Option<bool>,
}
impl traits::ExtraKeys for SomeExtras {
const ALLOWED_KEYS: &'static [&'static str] = &["extra1", "extra2"];
fn into_ffi_extra(self) -> HashMap<String, String> {
let mut map = HashMap::new();
self.extra1
.and_then(|val| map.insert("extra1".to_string(), val));
self.extra2
.and_then(|val| map.insert("extra2".to_string(), val.to_string()));
map
}
}
// Create a new instance of Glean with a temporary directory.
// We need to keep the `TempDir` alive, so that it's not deleted before we stop using it.
fn new_glean(configuration: Option<Configuration>) -> tempfile::TempDir {
@ -28,17 +53,9 @@ fn new_glean(configuration: Option<Configuration>) -> tempfile::TempDir {
let cfg = match configuration {
Some(c) => c,
None => Configuration {
data_path: tmpname,
application_id: GLOBAL_APPLICATION_ID.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,
trim_data_to_registered_pings: false,
},
None => ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID)
.with_server_endpoint("invalid-test-host")
.build(),
};
let client_info = ClientInfoMetrics {
@ -80,75 +97,93 @@ fn validate_against_schema() {
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
let cfg = Configuration {
data_path: tmpname,
application_id: GLOBAL_APPLICATION_ID.into(),
upload_enabled: true,
max_events: None,
delay_ping_lifetime_io: false,
server_endpoint: Some("invalid-test-host".into()),
uploader: Some(Box::new(ValidatingUploader { sender: s })),
use_core_mps: false,
trim_data_to_registered_pings: false,
};
let cfg = ConfigurationBuilder::new(true, tmpname, GLOBAL_APPLICATION_ID)
.with_server_endpoint("invalid-test-host")
.with_uploader(ValidatingUploader { sender: s })
.build();
let _ = new_glean(Some(cfg));
const PING_NAME: &str = "test-ping";
let common = |name: &str| CommonMetricData {
category: "test".into(),
name: name.into(),
send_in_pings: vec![PING_NAME.into()],
..Default::default()
};
// Test each of the metric types, just for basic smoke testing against the
// schema
// TODO: 1695762 Test all of the metric types against the schema from Rust
/*
let rate_metric: RateMetric = RateMetric::new(CommonMetricData {
category: "test".into(),
name: "rate".into(),
send_in_pings: vec![PING_NAME.into()],
..Default::default()
let counter_metric = CounterMetric::new(common("counter"));
counter_metric.add(42);
let bool_metric = BooleanMetric::new(common("bool"));
bool_metric.set(true);
let string_metric = StringMetric::new(common("string"));
string_metric.set("test".into());
let stringlist_metric = StringListMetric::new(common("stringlist"));
stringlist_metric.add("one".into());
stringlist_metric.add("two".into());
let timespan_metric = TimespanMetric::new(common("timespan"), TimeUnit::Nanosecond);
timespan_metric.start();
timespan_metric.stop();
let timing_dist = TimingDistributionMetric::new(common("timing_dist"), TimeUnit::Nanosecond);
let id = timing_dist.start();
timing_dist.stop_and_accumulate(id);
let memory_dist = MemoryDistributionMetric::new(common("memory_dist"), MemoryUnit::Byte);
memory_dist.accumulate(100);
let uuid_metric = UuidMetric::new(common("uuid"));
// chosen by fair dic roll (`uuidgen`)
uuid_metric.set("3ee4db5f-ee26-4557-9a66-bc7425d7893f".into());
// We can't test the URL metric,
// because the regex used in the schema uses a negative lookahead,
// which the regex crate doesn't handle.
//
//let url_metric = UrlMetric::new(common("url"));
//url_metric.set("https://mozilla.github.io/glean/");
let datetime_metric = DatetimeMetric::new(common("datetime"), TimeUnit::Day);
datetime_metric.set(None);
let event_metric = EventMetric::<SomeExtras>::new(common("event"));
event_metric.record(None);
event_metric.record(SomeExtras {
extra1: Some("test".into()),
extra2: Some(false),
});
let custom_dist =
CustomDistributionMetric::new(common("custom_dist"), 1, 100, 100, HistogramType::Linear);
custom_dist.accumulate_samples(vec![50, 51]);
let quantity_metric = QuantityMetric::new(common("quantity"));
quantity_metric.set(0);
let rate_metric = RateMetric::new(common("rate"));
rate_metric.add_to_numerator(1);
rate_metric.add_to_denominator(1);
let numerator_metric1: NumeratorMetric = NumeratorMetric::new(CommonMetricData {
category: "test".into(),
name: "num1".into(),
send_in_pings: vec![PING_NAME.into()],
..Default::default()
});
let numerator_metric2: NumeratorMetric = NumeratorMetric::new(CommonMetricData {
category: "test".into(),
name: "num2".into(),
send_in_pings: vec![PING_NAME.into()],
..Default::default()
});
let denominator_metric: DenominatorMetric = DenominatorMetric::new(
CommonMetricData {
category: "test".into(),
name: "den".into(),
send_in_pings: vec![PING_NAME.into()],
..Default::default()
},
vec![
CommonMetricData {
category: "test".into(),
name: "num1".into(),
send_in_pings: vec![PING_NAME.into()],
..Default::default()
},
CommonMetricData {
category: "test".into(),
name: "num2".into(),
send_in_pings: vec![PING_NAME.into()],
..Default::default()
},
],
);
let numerator_metric1 = NumeratorMetric::new(common("num1"));
let numerator_metric2 = NumeratorMetric::new(common("num2"));
let denominator_metric =
DenominatorMetric::new(common("den"), vec![common("num1"), common("num2")]);
numerator_metric1.add_to_numerator(1);
numerator_metric2.add_to_numerator(2);
denominator_metric.add(3);
*/
let text_metric = TextMetric::new(common("text"));
text_metric.set("loooooong text".repeat(100));
// Define a new ping and submit it.
let custom_ping = glean::private::PingType::new(PING_NAME, true, true, vec![]);
@ -174,9 +209,14 @@ fn validate_against_schema() {
let validation = cfg.validate(&data);
match validation {
Ok(()) => {}
Err(e) => {
let errors = e.map(|e| format!("{}", e)).collect::<Vec<_>>();
panic!("Data: {:#?}\nErrors: {:#?}", data, errors);
Err(errors) => {
let mut msg = format!("Data: {data:#?}\n Errors:\n");
for (idx, error) in errors.enumerate() {
msg.push_str(&format!("Error {}: ", idx + 1));
msg.push_str(&error.to_string());
msg.push('\n');
}
panic!("{}", msg);
}
}
}

16
third_party/rust/glean/tests/simple.rs поставляемый
Просмотреть файл

@ -10,7 +10,7 @@
mod common;
use glean::Configuration;
use glean::ConfigurationBuilder;
/// Some user metrics.
mod metrics {
@ -59,17 +59,9 @@ fn simple_lifecycle() {
let dir = tempfile::tempdir().unwrap();
let tmpname = dir.path().to_path_buf();
let cfg = Configuration {
data_path: tmpname,
application_id: "firefox-desktop".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,
trim_data_to_registered_pings: false,
};
let cfg = ConfigurationBuilder::new(true, tmpname, "firefox-desktop")
.with_server_endpoint("invalid-test-host")
.build();
common::initialize(cfg);
metrics::initialization.stop();

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"1f11acaa90a112979205b4c7af9ba0c015afab5f3141dd082d58c862c84490e3","README.md":"6d4ff5b079ac5340d18fa127f583e7ad793c5a2328b8ecd12c3fc723939804f2","src/bso/content.rs":"d2d650f4932e9a7068a25dd7df0085b92cd8976a0635320e6ae306d5a425075c","src/bso/crypto.rs":"27602dcccb37d3a55620ee4e16b705da455d49af575de115c7c79c0178eb1d6d","src/bso/mod.rs":"09e723dc7e99295ecafdcadffaf604d66ea27cf2b7f1fd9ab3cac4f4698ff6a7","src/bso/test_utils.rs":"4ec5a2df5e1c0ec14dc770681e959bdcef6ef04f6fde435999197f46a8ae4831","src/client/coll_state.rs":"b0c47e44168ea2c7017cd8531f76bb230f9be66b119bb7416537b8693a1d0a0a","src/client/coll_update.rs":"cc12dfde0817eae68aa8e176497ed16e9e3307f72a33faa3fe329d7a3bfd1598","src/client/collection_keys.rs":"c27b2277a3a52033b58ab01490fc2ea7007494195dd5e6dc2c6931a4ca96795a","src/client/mod.rs":"9500b1d22a5064bbbd6a3d6bcc63fc4191e8ea4605ded359bc6c2dc2887626a3","src/client/request.rs":"8841524e37d8195867bdf6ba98c75f610cf47a4644adeebd6372cc6713f2260a","src/client/state.rs":"4e31193ef2471c1dfabf1c6a391bcb95e14ddb45855786a4194ff187d5c9347c","src/client/status.rs":"f445a8765dac9789444e23b5145148413407bb1d18a15ef56682243997f591bf","src/client/storage_client.rs":"3637b4522048353b06ad24031c150c66c13d9c27cef293e400db88807421633c","src/client/sync.rs":"ed7225c314df27793ed5de6da93cc4b75a98da1c14ac82e37a723a99821d4dc7","src/client/sync_multiple.rs":"3729d4afd90ab1bd9982a3506252c99d8f37619cc1792ef4feba352ad01a7192","src/client/token.rs":"b268759d31e0fe17e0e2a428694cd9a317fcfbdd52f023d5d8c7cc6f00f1a102","src/client/util.rs":"71cc70ee41f821f53078675e636e9fad9c6046fa1a989e37f5487e340a2277d6","src/client_types.rs":"3c3cac1540b92482f43660d9e43bdde8481c4cc1a98253a68c80e791231f5976","src/clients_engine/engine.rs":"b4a9c92f251b23e5a5452930e4472e7fea9ed12784a78836ce7337a94457ab86","src/clients_engine/mod.rs":"461729e6f89b66b2cbd89b041a03d4d6a8ba582284ed4f3015cb13e1a0c6da97","src/clients_engine/record.rs":"69357413571d688eea3a5207f9b88088cde285b9373c7bd4ea1e018dbc823dd2","src/clients_engine/ser.rs":"9796e44ed7daf04f22afbb51238ac25fd0de1438b72181351b4ca29fd70fd429","src/device_type.rs":"fe217453f19b374abcc10e9f503b25f4f712b555497bebe5aefcf2e9b258d28e","src/enc_payload.rs":"aa3eea7df49b24cd59831680a47c417b73a3e36e6b0f3f4baf14ca66bd68be6b","src/engine/bridged_engine.rs":"9c0d602b3553932e77a87caba9262d3a0fc146500c6d46f1770273be6636d064","src/engine/changeset.rs":"5e323aa07f0b18d22495a695b829326d18287ff75155b4818adf66b86e16ba00","src/engine/mod.rs":"f84a254642c1876fe56506703fb010a7866eb5d40af3fc238bf92b62a61cb6cc","src/engine/request.rs":"f40bac0b3f5286446a4056de885fd81e4fa77e4dc7d5bbb6aa644b93201046de","src/engine/sync_engine.rs":"5314d0163ccc93d78f5879d52cf2b60b9622e80722d84d3482cfa7c26df6bfdd","src/error.rs":"a45cfe02e6301f473c34678b694943c1a04308b8c292c6e0448bf495194c3b5e","src/key_bundle.rs":"addff41977fd7416c8d809d7aec2582658d76d232c4f215157b941d3e2fce4ca","src/lib.rs":"25bec0ac0f8ed0e6a341f645f7f265c7e9a19332c13d05876f7332eccbd2a2de","src/record_types.rs":"02bb3d352fb808131d298f9b90d9c95b7e9e0138b97c5401f3b9fdacc5562f44","src/server_timestamp.rs":"0020f31971ccbfc485894cabc3087459d42252b86d7de07f2136997864b0373b","src/telemetry.rs":"67869a067e15191c7ecdaffded50bdabebd9c1fee21d87b840ca89247fe9eb17"},"package":null}
{"files":{"Cargo.toml":"1f11acaa90a112979205b4c7af9ba0c015afab5f3141dd082d58c862c84490e3","README.md":"6d4ff5b079ac5340d18fa127f583e7ad793c5a2328b8ecd12c3fc723939804f2","src/bso/content.rs":"d2d650f4932e9a7068a25dd7df0085b92cd8976a0635320e6ae306d5a425075c","src/bso/crypto.rs":"27602dcccb37d3a55620ee4e16b705da455d49af575de115c7c79c0178eb1d6d","src/bso/mod.rs":"09e723dc7e99295ecafdcadffaf604d66ea27cf2b7f1fd9ab3cac4f4698ff6a7","src/bso/test_utils.rs":"4ec5a2df5e1c0ec14dc770681e959bdcef6ef04f6fde435999197f46a8ae4831","src/client/coll_state.rs":"b0c47e44168ea2c7017cd8531f76bb230f9be66b119bb7416537b8693a1d0a0a","src/client/coll_update.rs":"cc12dfde0817eae68aa8e176497ed16e9e3307f72a33faa3fe329d7a3bfd1598","src/client/collection_keys.rs":"c27b2277a3a52033b58ab01490fc2ea7007494195dd5e6dc2c6931a4ca96795a","src/client/mod.rs":"9500b1d22a5064bbbd6a3d6bcc63fc4191e8ea4605ded359bc6c2dc2887626a3","src/client/request.rs":"8841524e37d8195867bdf6ba98c75f610cf47a4644adeebd6372cc6713f2260a","src/client/state.rs":"4e31193ef2471c1dfabf1c6a391bcb95e14ddb45855786a4194ff187d5c9347c","src/client/status.rs":"f445a8765dac9789444e23b5145148413407bb1d18a15ef56682243997f591bf","src/client/storage_client.rs":"3637b4522048353b06ad24031c150c66c13d9c27cef293e400db88807421633c","src/client/sync.rs":"ed7225c314df27793ed5de6da93cc4b75a98da1c14ac82e37a723a99821d4dc7","src/client/sync_multiple.rs":"3729d4afd90ab1bd9982a3506252c99d8f37619cc1792ef4feba352ad01a7192","src/client/token.rs":"b268759d31e0fe17e0e2a428694cd9a317fcfbdd52f023d5d8c7cc6f00f1a102","src/client/util.rs":"71cc70ee41f821f53078675e636e9fad9c6046fa1a989e37f5487e340a2277d6","src/client_types.rs":"3c3cac1540b92482f43660d9e43bdde8481c4cc1a98253a68c80e791231f5976","src/clients_engine/engine.rs":"b4a9c92f251b23e5a5452930e4472e7fea9ed12784a78836ce7337a94457ab86","src/clients_engine/mod.rs":"461729e6f89b66b2cbd89b041a03d4d6a8ba582284ed4f3015cb13e1a0c6da97","src/clients_engine/record.rs":"69357413571d688eea3a5207f9b88088cde285b9373c7bd4ea1e018dbc823dd2","src/clients_engine/ser.rs":"9796e44ed7daf04f22afbb51238ac25fd0de1438b72181351b4ca29fd70fd429","src/device_type.rs":"fe217453f19b374abcc10e9f503b25f4f712b555497bebe5aefcf2e9b258d28e","src/enc_payload.rs":"aa3eea7df49b24cd59831680a47c417b73a3e36e6b0f3f4baf14ca66bd68be6b","src/engine/bridged_engine.rs":"9c0d602b3553932e77a87caba9262d3a0fc146500c6d46f1770273be6636d064","src/engine/changeset.rs":"5e323aa07f0b18d22495a695b829326d18287ff75155b4818adf66b86e16ba00","src/engine/mod.rs":"f84a254642c1876fe56506703fb010a7866eb5d40af3fc238bf92b62a61cb6cc","src/engine/request.rs":"f40bac0b3f5286446a4056de885fd81e4fa77e4dc7d5bbb6aa644b93201046de","src/engine/sync_engine.rs":"5314d0163ccc93d78f5879d52cf2b60b9622e80722d84d3482cfa7c26df6bfdd","src/error.rs":"a45cfe02e6301f473c34678b694943c1a04308b8c292c6e0448bf495194c3b5e","src/key_bundle.rs":"ff8b10b95add934ecbc434b37ed089805886828ed159fd38bd692d1f01d06f7f","src/lib.rs":"25bec0ac0f8ed0e6a341f645f7f265c7e9a19332c13d05876f7332eccbd2a2de","src/record_types.rs":"02bb3d352fb808131d298f9b90d9c95b7e9e0138b97c5401f3b9fdacc5562f44","src/server_timestamp.rs":"0020f31971ccbfc485894cabc3087459d42252b86d7de07f2136997864b0373b","src/telemetry.rs":"35e0313a052f16326e451e3d6e371337c1d71a471f32234ad9649fc1fa9f2237"},"package":null}

4
third_party/rust/sync15/src/key_bundle.rs поставляемый
Просмотреть файл

@ -194,7 +194,7 @@ mod test {
let s = key_bundle.decrypt(&ciphertext, IV_B64, HMAC_B16).unwrap();
let cleartext =
String::from_utf8(base64::decode(&CLEARTEXT_B64_PIECES.join("")).unwrap()).unwrap();
String::from_utf8(base64::decode(CLEARTEXT_B64_PIECES.join("")).unwrap()).unwrap();
assert_eq!(&cleartext, &s);
}
@ -203,7 +203,7 @@ mod test {
let key_bundle = KeyBundle::from_base64(ENC_KEY_B64, HMAC_KEY_B64).unwrap();
let iv = base64::decode(IV_B64).unwrap();
let cleartext_bytes = base64::decode(&CLEARTEXT_B64_PIECES.join("")).unwrap();
let cleartext_bytes = base64::decode(CLEARTEXT_B64_PIECES.join("")).unwrap();
let (enc_base64, _hmac_base16) = key_bundle
.encrypt_bytes_with_iv(&cleartext_bytes, &iv)
.unwrap();

2
third_party/rust/sync15/src/telemetry.rs поставляемый
Просмотреть файл

@ -508,7 +508,7 @@ mod engine_tests {
#[test]
fn test_engine_not_finished() {
let e = Engine::new("test_engine");
serde_json::to_value(&e).expect_err("unfinished stopwatch should fail");
serde_json::to_value(e).expect_err("unfinished stopwatch should fail");
}
#[test]

2
third_party/rust/tabs/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"c8183d47c99830e628827da4c1510a4dd939071f85fc7ca85c9419ae2521ba41","README.md":"c48b8f391ef822c4f3971b5f453a1e7b43bea232752d520460d2f04803aead1a","build.rs":"024918c1d468c8dae03e4edaad14d827b7ebe7995809a8fe99efb1d9faa1206a","src/error.rs":"ac3d450f0ba6a855c37fa2dd829004b22dce5ad4416ebec66a3d7d6212bdbcd7","src/lib.rs":"d7eff9e1c28f88a48bfffa5acc0e8da12336c0c6ad55f5df211da4720927cce7","src/schema.rs":"2b7b51f3c2edc0ca603495c10b917603fd9ac791c4a366080e40d090b13b91f2","src/storage.rs":"0a74e341d33b6734f6ef0130e2ba506ec313b5a5f8d6660c535ffc53520edabc","src/store.rs":"ab0b6214b30b0f0fa7c6a89098ff3db1a8f76264f6711c4481c0be460afe522b","src/sync/bridge.rs":"e20e332c5279c86126839c67c5714dac384030050122183ff2b16ecee91f5d54","src/sync/engine.rs":"ec730ab2807074f25b5504cf9c4e5d33cb5b7eb027549b98f4165750b480e74a","src/sync/full_sync.rs":"07c705bac97eb403a65a766a48fd1e3acd2056f01ed6d1bc3e8b3fb8d07511f3","src/sync/mod.rs":"81f98303b2a60aa6c6ed0d9777a95d6bbff46e57a494a0172d81c5819296802e","src/sync/record.rs":"896ebc6aa213bac9e6170c7e0b7dbee322f62e5f6c28462cb6da0bfe8ce938ba","src/tabs.udl":"a555fe11b5fa7ea9aefa7d7be31906a63b31cbc16b9b7f5ad952fd0e08ba5c61","uniffi.toml":"5156701368f0b5856e658143714a43058385c8ac53bee72d7a5a332b576dfb82"},"package":null}
{"files":{"Cargo.toml":"8ae43dd6969feea0eabc5c53d830960212e6cb1a18b43a00f47e8784c2fd0063","README.md":"c48b8f391ef822c4f3971b5f453a1e7b43bea232752d520460d2f04803aead1a","build.rs":"33e61b811b19ed2b58e319cc65d5988bed258d2c4fea2d706301184c59847a0f","src/error.rs":"ac3d450f0ba6a855c37fa2dd829004b22dce5ad4416ebec66a3d7d6212bdbcd7","src/lib.rs":"7208f78955e015ef8bab7916307e551cd3c1bd56d7fe14f8b53cd53bc4b38555","src/schema.rs":"2b7b51f3c2edc0ca603495c10b917603fd9ac791c4a366080e40d090b13b91f2","src/storage.rs":"0a74e341d33b6734f6ef0130e2ba506ec313b5a5f8d6660c535ffc53520edabc","src/store.rs":"ab0b6214b30b0f0fa7c6a89098ff3db1a8f76264f6711c4481c0be460afe522b","src/sync/bridge.rs":"a444c97991cfa8e0dd92ba3b35c6864ddd0cfec1d17e5cc514b9c36ada8d46c3","src/sync/engine.rs":"bbee416c9d45b90b945016d26c2133639c1ad057c6f52fdbdfa5a4f4f631a378","src/sync/full_sync.rs":"514668bb76d1fe6de3a36e64e6984b8dbd391155685ea21cbf91f67a957babdd","src/sync/mod.rs":"81f98303b2a60aa6c6ed0d9777a95d6bbff46e57a494a0172d81c5819296802e","src/sync/record.rs":"896ebc6aa213bac9e6170c7e0b7dbee322f62e5f6c28462cb6da0bfe8ce938ba","src/tabs.udl":"a555fe11b5fa7ea9aefa7d7be31906a63b31cbc16b9b7f5ad952fd0e08ba5c61","uniffi.toml":"5156701368f0b5856e658143714a43058385c8ac53bee72d7a5a332b576dfb82"},"package":null}

5
third_party/rust/tabs/Cargo.toml поставляемый
Просмотреть файл

@ -33,8 +33,7 @@ sql-support = { path = "../support/sql" }
sync-guid = { path = "../support/guid", features = ["random"] }
sync15 = { path = "../sync15", features = ["sync-engine"] }
thiserror = "1.0"
uniffi = "^0.21"
uniffi_macros = "^0.21"
uniffi = "0.23"
url = "2.1" # mozilla-central can't yet take 2.2 (see bug 1734538)
[dev-dependencies]
@ -42,4 +41,4 @@ env_logger = { version = "0.8.0", default-features = false, features = ["termcol
tempfile = "3.1"
[build-dependencies]
uniffi_build = { version = "^0.21", features = [ "builtin-bindgen" ]}
uniffi = { version = "0.23", features = ["build"] }

2
third_party/rust/tabs/build.rs поставляемый
Просмотреть файл

@ -3,5 +3,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
fn main() {
uniffi_build::generate_scaffolding("./src/tabs.udl").unwrap();
uniffi::generate_scaffolding("./src/tabs.udl").unwrap();
}

2
third_party/rust/tabs/src/lib.rs поставляемый
Просмотреть файл

@ -12,7 +12,7 @@ mod storage;
mod store;
mod sync;
uniffi_macros::include_scaffolding!("tabs");
uniffi::include_scaffolding!("tabs");
// Our UDL uses a `Guid` type.
use sync_guid::Guid as TabsGuid;

190
third_party/rust/tabs/src/sync/bridge.rs поставляемый
Просмотреть файл

@ -47,71 +47,68 @@ impl BridgedEngineImpl {
impl BridgedEngine for BridgedEngineImpl {
type Error = TabsApiError;
#[handle_error]
fn last_sync(&self) -> ApiResult<i64> {
handle_error! {
Ok(self
.sync_impl
.lock()
.unwrap()
.get_last_sync()?
.unwrap_or_default()
.as_millis())
}
Ok(self
.sync_impl
.lock()
.unwrap()
.get_last_sync()?
.unwrap_or_default()
.as_millis())
}
#[handle_error]
fn set_last_sync(&self, last_sync_millis: i64) -> ApiResult<()> {
handle_error! {
self.sync_impl.lock().unwrap().set_last_sync(ServerTimestamp::from_millis(last_sync_millis))?;
Ok(())
}
self.sync_impl
.lock()
.unwrap()
.set_last_sync(ServerTimestamp::from_millis(last_sync_millis))?;
Ok(())
}
#[handle_error]
fn sync_id(&self) -> ApiResult<Option<String>> {
handle_error! {
Ok(match self.sync_impl.lock().unwrap().get_sync_assoc()? {
EngineSyncAssociation::Connected(id) => Some(id.coll.to_string()),
EngineSyncAssociation::Disconnected => None,
})
}
Ok(match self.sync_impl.lock().unwrap().get_sync_assoc()? {
EngineSyncAssociation::Connected(id) => Some(id.coll.to_string()),
EngineSyncAssociation::Disconnected => None,
})
}
#[handle_error]
fn reset_sync_id(&self) -> ApiResult<String> {
handle_error! {
let new_id = SyncGuid::random().to_string();
let new_id = SyncGuid::random().to_string();
let new_coll_ids = CollSyncIds {
global: SyncGuid::empty(),
coll: new_id.clone().into(),
};
self.sync_impl
.lock()
.unwrap()
.reset(&EngineSyncAssociation::Connected(new_coll_ids))?;
Ok(new_id)
}
#[handle_error]
fn ensure_current_sync_id(&self, sync_id: &str) -> ApiResult<String> {
let mut sync_impl = self.sync_impl.lock().unwrap();
let assoc = sync_impl.get_sync_assoc()?;
if matches!(assoc, EngineSyncAssociation::Connected(c) if c.coll == sync_id) {
log::debug!("ensure_current_sync_id is current");
} else {
let new_coll_ids = CollSyncIds {
global: SyncGuid::empty(),
coll: new_id.clone().into(),
coll: sync_id.into(),
};
self.sync_impl
.lock()
.unwrap()
.reset(&EngineSyncAssociation::Connected(new_coll_ids))?;
Ok(new_id)
}
}
fn ensure_current_sync_id(&self, sync_id: &str) -> ApiResult<String> {
handle_error! {
let mut sync_impl = self.sync_impl.lock().unwrap();
let assoc = sync_impl.get_sync_assoc()?;
if matches!(assoc, EngineSyncAssociation::Connected(c) if c.coll == sync_id) {
log::debug!("ensure_current_sync_id is current");
} else {
let new_coll_ids = CollSyncIds {
global: SyncGuid::empty(),
coll: sync_id.into(),
};
sync_impl.reset(&EngineSyncAssociation::Connected(new_coll_ids))?;
}
Ok(sync_id.to_string()) // this is a bit odd, why the result?
sync_impl.reset(&EngineSyncAssociation::Connected(new_coll_ids))?;
}
Ok(sync_id.to_string()) // this is a bit odd, why the result?
}
#[handle_error]
fn prepare_for_sync(&self, client_data: &str) -> ApiResult<()> {
handle_error! {
let data: ClientData = serde_json::from_str(client_data)?;
self.sync_impl.lock().unwrap().prepare_for_sync(data)
}
let data: ClientData = serde_json::from_str(client_data)?;
self.sync_impl.lock().unwrap().prepare_for_sync(data)
}
fn sync_started(&self) -> ApiResult<()> {
@ -119,65 +116,58 @@ impl BridgedEngine for BridgedEngineImpl {
Ok(())
}
#[handle_error]
fn store_incoming(&self, incoming: Vec<IncomingBso>) -> ApiResult<()> {
handle_error! {
// Store the incoming payload in memory so we can use it in apply
*(self.incoming.lock().unwrap()) = incoming;
Ok(())
}
// Store the incoming payload in memory so we can use it in apply
*(self.incoming.lock().unwrap()) = incoming;
Ok(())
}
#[handle_error]
fn apply(&self) -> ApiResult<ApplyResults> {
handle_error! {
let mut incoming = self.incoming.lock().unwrap();
// We've a reference to a Vec<> but it's owned by the mutex - swap the mutex owned
// value for an empty vec so we can consume the original.
let mut records = Vec::new();
std::mem::swap(&mut records, &mut *incoming);
let mut telem = sync15::telemetry::Engine::new("tabs");
let mut incoming = self.incoming.lock().unwrap();
// We've a reference to a Vec<> but it's owned by the mutex - swap the mutex owned
// value for an empty vec so we can consume the original.
let mut records = Vec::new();
std::mem::swap(&mut records, &mut *incoming);
let mut telem = sync15::telemetry::Engine::new("tabs");
let mut sync_impl = self.sync_impl.lock().unwrap();
let outgoing = sync_impl.apply_incoming(records, &mut telem)?;
let mut sync_impl = self.sync_impl.lock().unwrap();
let outgoing = sync_impl.apply_incoming(records, &mut telem)?;
Ok(ApplyResults {
records: outgoing,
num_reconciled: Some(0),
})
}
Ok(ApplyResults {
records: outgoing,
num_reconciled: Some(0),
})
}
#[handle_error]
fn set_uploaded(&self, server_modified_millis: i64, ids: &[SyncGuid]) -> ApiResult<()> {
handle_error! {
self
.sync_impl
.lock()
.unwrap()
.sync_finished(ServerTimestamp::from_millis(server_modified_millis), ids)
}
self.sync_impl
.lock()
.unwrap()
.sync_finished(ServerTimestamp::from_millis(server_modified_millis), ids)
}
#[handle_error]
fn sync_finished(&self) -> ApiResult<()> {
handle_error! {
*(self.incoming.lock().unwrap()) = Vec::default();
Ok(())
}
*(self.incoming.lock().unwrap()) = Vec::default();
Ok(())
}
#[handle_error]
fn reset(&self) -> ApiResult<()> {
handle_error! {
self.sync_impl
.lock()
.unwrap()
.reset(&EngineSyncAssociation::Disconnected)?;
Ok(())
}
self.sync_impl
.lock()
.unwrap()
.reset(&EngineSyncAssociation::Disconnected)?;
Ok(())
}
#[handle_error]
fn wipe(&self) -> ApiResult<()> {
handle_error! {
self.sync_impl.lock().unwrap().wipe()?;
Ok(())
}
self.sync_impl.lock().unwrap().wipe()?;
Ok(())
}
}
@ -220,25 +210,23 @@ impl TabsBridgedEngine {
}
// Decode the JSON-encoded IncomingBso's that UniFFI passes to us
#[handle_error]
fn convert_incoming_bsos(&self, incoming: Vec<String>) -> ApiResult<Vec<IncomingBso>> {
handle_error! {
let mut bsos = Vec::with_capacity(incoming.len());
for inc in incoming {
bsos.push(serde_json::from_str::<IncomingBso>(&inc)?);
}
Ok(bsos)
let mut bsos = Vec::with_capacity(incoming.len());
for inc in incoming {
bsos.push(serde_json::from_str::<IncomingBso>(&inc)?);
}
Ok(bsos)
}
// Encode OutgoingBso's into JSON for UniFFI
#[handle_error]
fn convert_outgoing_bsos(&self, outgoing: Vec<OutgoingBso>) -> ApiResult<Vec<String>> {
handle_error! {
let mut bsos = Vec::with_capacity(outgoing.len());
for e in outgoing {
bsos.push(serde_json::to_string(&e)?);
}
Ok(bsos)
let mut bsos = Vec::with_capacity(outgoing.len());
for e in outgoing {
bsos.push(serde_json::to_string(&e)?);
}
Ok(bsos)
}
pub fn store_incoming(&self, incoming: Vec<String>) -> ApiResult<()> {

2
third_party/rust/tabs/src/sync/engine.rs поставляемый
Просмотреть файл

@ -261,7 +261,7 @@ impl TabsSyncImpl {
pub fn set_last_sync(&self, last_sync: ServerTimestamp) -> Result<()> {
let mut storage = self.store.storage.lock().unwrap();
log::debug!("Updating last sync to {}", last_sync);
let last_sync_millis = last_sync.as_millis() as i64;
let last_sync_millis = last_sync.as_millis();
storage.put_meta(schema::LAST_SYNC_META_KEY, &last_sync_millis)
}

78
third_party/rust/tabs/src/sync/full_sync.rs поставляемый
Просмотреть файл

@ -11,15 +11,15 @@ use sync15::engine::EngineSyncAssociation;
use sync15::KeyBundle;
impl TabsStore {
#[handle_error]
pub fn reset(self: Arc<Self>) -> ApiResult<()> {
handle_error! {
let mut sync_impl = TabsSyncImpl::new(Arc::clone(&self));
sync_impl.reset(&EngineSyncAssociation::Disconnected)?;
Ok(())
}
let mut sync_impl = TabsSyncImpl::new(Arc::clone(&self));
sync_impl.reset(&EngineSyncAssociation::Disconnected)?;
Ok(())
}
/// A convenience wrapper around sync_multiple.
#[handle_error]
pub fn sync(
self: Arc<Self>,
key_id: String,
@ -28,45 +28,43 @@ impl TabsStore {
tokenserver_url: String,
local_id: String,
) -> ApiResult<String> {
handle_error! {
let mut mem_cached_state = MemoryCachedState::default();
let engine = TabsEngine::new(Arc::clone(&self));
let mut mem_cached_state = MemoryCachedState::default();
let engine = TabsEngine::new(Arc::clone(&self));
// Since we are syncing without the sync manager, there's no
// command processor, therefore no clients engine, and in
// consequence `TabsStore::prepare_for_sync` is never called
// which means our `local_id` will never be set.
// Do it here.
engine.sync_impl.lock().unwrap().local_id = local_id;
// Since we are syncing without the sync manager, there's no
// command processor, therefore no clients engine, and in
// consequence `TabsStore::prepare_for_sync` is never called
// which means our `local_id` will never be set.
// Do it here.
engine.sync_impl.lock().unwrap().local_id = local_id;
let storage_init = &Sync15StorageClientInit {
key_id,
access_token,
tokenserver_url: url::Url::parse(tokenserver_url.as_str())?,
};
let root_sync_key = &KeyBundle::from_ksync_base64(sync_key.as_str())?;
let storage_init = &Sync15StorageClientInit {
key_id,
access_token,
tokenserver_url: url::Url::parse(tokenserver_url.as_str())?,
};
let root_sync_key = &KeyBundle::from_ksync_base64(sync_key.as_str())?;
let mut result = sync_multiple(
&[&engine],
&mut None,
&mut mem_cached_state,
storage_init,
root_sync_key,
&NeverInterrupts,
None,
);
let mut result = sync_multiple(
&[&engine],
&mut None,
&mut mem_cached_state,
storage_init,
root_sync_key,
&NeverInterrupts,
None,
);
// for b/w compat reasons, we do some dances with the result.
// XXX - note that this means telemetry isn't going to be reported back
// to the app - we need to check with lockwise about whether they really
// need these failures to be reported or whether we can loosen this.
if let Err(e) = result.result {
return Err(e.into());
}
match result.engine_results.remove("tabs") {
None | Some(Ok(())) => Ok(serde_json::to_string(&result.telemetry)?),
Some(Err(e)) => Err(e.into()),
}
// for b/w compat reasons, we do some dances with the result.
// XXX - note that this means telemetry isn't going to be reported back
// to the app - we need to check with lockwise about whether they really
// need these failures to be reported or whether we can loosen this.
if let Err(e) = result.result {
return Err(e.into());
}
match result.engine_results.remove("tabs") {
None | Some(Ok(())) => Ok(serde_json::to_string(&result.telemetry)?),
Some(Err(e)) => Err(e.into()),
}
}
}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"a4dd6685118bebe4eef690470cf112e51cc862162cf7d4c21c133d452ed7c488","build.rs":"05089b35ac197b5ff83c75872a70df023834141831d0c2051faa35b4c9df55ba","src/arithmetic.udl":"8554c6907ece627645f6b896f71430e5412bf19b0ac6becf63eb9a69868d0f7a","src/lib.rs":"92ebd9fc4d3403ab1960d2d8520c1217971147ea3aebff89228a61fcbb8b2af3","tests/bindings/test_arithmetic.kts":"e0e9347755db4e18f70b1b74c2d5a4aa328373015090ed959b46d65c2a205d92","tests/bindings/test_arithmetic.py":"3e41d69e21e96a6830197c760f3b7bddd754edc0c5515b7bd33b79cccb10f941","tests/bindings/test_arithmetic.rb":"ea0fdce0a4c7b557b427db77521da05240cd6e87d60a128ac2307fab3bbbc76d","tests/bindings/test_arithmetic.swift":"455b87d95fc690af9c35f9e43676e9c855dedddd2fc1c9e1cbaa6a02835c2d4c","tests/test_generated_bindings.rs":"09b0e79c7e769bcf5f3a8b768247a05892d408d48e0295f6737de3c8dab28479","uniffi.toml":"ad149df611a6e3a853a029d90a88a694660f6a4ebe18dcb5f9f503819761dacd"},"package":null}
{"files":{"Cargo.toml":"fd62bbb197298f592c3c0822cec65f7c6542cf08b3455e7014462276f0890b2d","build.rs":"937e2a5fdb7c0e850af07a4d7676e57f62f06b842cbc0aa7291ffe58b5725caa","src/arithmetic.udl":"8554c6907ece627645f6b896f71430e5412bf19b0ac6becf63eb9a69868d0f7a","src/lib.rs":"c454193443e92d49f997c760f4131192fb66bf213bbac1710c1ebde19e765e5d","tests/bindings/test_arithmetic.kts":"e0e9347755db4e18f70b1b74c2d5a4aa328373015090ed959b46d65c2a205d92","tests/bindings/test_arithmetic.py":"3e41d69e21e96a6830197c760f3b7bddd754edc0c5515b7bd33b79cccb10f941","tests/bindings/test_arithmetic.rb":"ea0fdce0a4c7b557b427db77521da05240cd6e87d60a128ac2307fab3bbbc76d","tests/bindings/test_arithmetic.swift":"455b87d95fc690af9c35f9e43676e9c855dedddd2fc1c9e1cbaa6a02835c2d4c","tests/test_generated_bindings.rs":"26b92d6b3e648f6fadd4182cbdba4f412b73da48a789785fd98cd486b29abf05","uniffi.toml":"ad149df611a6e3a853a029d90a88a694660f6a4ebe18dcb5f9f503819761dacd"},"package":null}

Просмотреть файл

@ -1,7 +1,7 @@
[package]
name = "uniffi-example-arithmetic"
edition = "2021"
version = "0.21.0"
version = "0.22.0"
authors = ["Firefox Sync Team <sync-team@mozilla.com>"]
license = "MPL-2.0"
publish = false
@ -11,9 +11,11 @@ crate-type = ["lib", "cdylib"]
name = "arithmetical"
[dependencies]
uniffi_macros = {path = "../../uniffi_macros"}
uniffi = {path = "../../uniffi", features=["builtin-bindgen"]}
uniffi = {path = "../../uniffi"}
thiserror = "1.0"
[build-dependencies]
uniffi_build = {path = "../../uniffi_build", features=["builtin-bindgen"]}
uniffi = {path = "../../uniffi", features = ["build"] }
[dev-dependencies]
uniffi = {path = "../../uniffi", features = ["bindgen-tests"] }

Просмотреть файл

@ -3,5 +3,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
fn main() {
uniffi_build::generate_scaffolding("./src/arithmetic.udl").unwrap();
uniffi::generate_scaffolding("./src/arithmetic.udl").unwrap();
}

Просмотреть файл

@ -31,4 +31,4 @@ fn equal(a: u64, b: u64) -> bool {
type Result<T, E = ArithmeticError> = std::result::Result<T, E>;
uniffi_macros::include_scaffolding!("arithmetic");
uniffi::include_scaffolding!("arithmetic");

Просмотреть файл

@ -1,9 +1,6 @@
uniffi_macros::build_foreign_language_testcases!(
["src/arithmetic.udl",],
[
"tests/bindings/test_arithmetic.rb",
"tests/bindings/test_arithmetic.py",
"tests/bindings/test_arithmetic.kts",
"tests/bindings/test_arithmetic.swift",
]
uniffi::build_foreign_language_testcases!(
"tests/bindings/test_arithmetic.rb",
"tests/bindings/test_arithmetic.py",
"tests/bindings/test_arithmetic.kts",
"tests/bindings/test_arithmetic.swift",
);

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"ae167d6d92c007dac4db511c1b9ea2e4c7a7d6edb8f2fa95463b877825a3395a","build.rs":"94ca4e70e538a2159cb77157c227d487973756373c4b27ea5cea05a6698cb60b","src/geometry.udl":"7da7a6ec080c7117ec3c25206e23f9ed436e60b1a26fba34f991547680443550","src/lib.rs":"be9c624f691a8d1ebe3be6dbbcde44033759b8321a3a298453018dd69b9c14c7","tests/bindings/test_geometry.kts":"e537185e3c699df1c0468525700e8a38f9a504b2a663c38442146b951e38e9a7","tests/bindings/test_geometry.py":"3ea483b8a4fbe13aefa6641177ae149f75f734bc32bf0da533b97c1abf3dc317","tests/bindings/test_geometry.rb":"17c2fe8a7b477419a6646983dd88f1b07a0304b58a568c03e9bfa640d5b2df5c","tests/bindings/test_geometry.swift":"a61fec6bfe16020809e20e4da372748c24366767138c5672a0bfff85c4b62d78","tests/test_generated_bindings.rs":"8ba67396105b96cc554f78078c7a8c6e8ce86ecc868d97a069a5f60fd87c1a36","uniffi.toml":"5b28f45d3c2581a52cf886a502f034778a002815b66994e5da2081a5c9f5284b"},"package":null}
{"files":{"Cargo.toml":"0f562dfb0dc717c85d2ffb6242a7e4757b81a58b2f44731346670211a310bee7","build.rs":"8b13adbcc027872d444923e5b5d5b941d085a5de0f4a32ffa4f77f9a86ad78a0","src/geometry.udl":"7da7a6ec080c7117ec3c25206e23f9ed436e60b1a26fba34f991547680443550","src/lib.rs":"be9c624f691a8d1ebe3be6dbbcde44033759b8321a3a298453018dd69b9c14c7","tests/bindings/test_geometry.kts":"e537185e3c699df1c0468525700e8a38f9a504b2a663c38442146b951e38e9a7","tests/bindings/test_geometry.py":"3ea483b8a4fbe13aefa6641177ae149f75f734bc32bf0da533b97c1abf3dc317","tests/bindings/test_geometry.rb":"17c2fe8a7b477419a6646983dd88f1b07a0304b58a568c03e9bfa640d5b2df5c","tests/bindings/test_geometry.swift":"a61fec6bfe16020809e20e4da372748c24366767138c5672a0bfff85c4b62d78","tests/test_generated_bindings.rs":"ff8fc093ccb6ee3ee2235c09276c7bb87234ad143667429cb721e46379577f3d","uniffi.toml":"5b28f45d3c2581a52cf886a502f034778a002815b66994e5da2081a5c9f5284b"},"package":null}

Просмотреть файл

@ -1,7 +1,7 @@
[package]
name = "uniffi-example-geometry"
edition = "2021"
version = "0.21.0"
version = "0.22.0"
authors = ["Firefox Sync Team <sync-team@mozilla.com>"]
license = "MPL-2.0"
publish = false
@ -11,8 +11,10 @@ crate-type = ["lib", "cdylib"]
name = "uniffi_geometry"
[dependencies]
uniffi_macros = {path = "../../uniffi_macros"}
uniffi = {path = "../../uniffi", features=["builtin-bindgen"]}
uniffi = {path = "../../uniffi"}
[build-dependencies]
uniffi_build = {path = "../../uniffi_build", features=["builtin-bindgen"]}
uniffi = {path = "../../uniffi", features = ["build"] }
[dev-dependencies]
uniffi = {path = "../../uniffi", features = ["bindgen-tests"] }

Просмотреть файл

@ -3,5 +3,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
fn main() {
uniffi_build::generate_scaffolding("./src/geometry.udl").unwrap();
uniffi::generate_scaffolding("./src/geometry.udl").unwrap();
}

Просмотреть файл

@ -1,9 +1,6 @@
uniffi_macros::build_foreign_language_testcases!(
["src/geometry.udl",],
[
"tests/bindings/test_geometry.py",
"tests/bindings/test_geometry.rb",
"tests/bindings/test_geometry.kts",
"tests/bindings/test_geometry.swift",
]
uniffi::build_foreign_language_testcases!(
"tests/bindings/test_geometry.py",
"tests/bindings/test_geometry.rb",
"tests/bindings/test_geometry.kts",
"tests/bindings/test_geometry.swift",
);

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"3cb89faf843332975007e3b6f9ad53cbcbdcaebc91c6abda2106b2b75ea01c70","build.rs":"c48df8045c6cf73a8f3b8e93af7878f4ce1e7baa11f0688d661405f339df4ba4","src/lib.rs":"b5eb9861fc436ab9fe9b0c00f95e374d812bbc0ea10b98cf746d38c96e44343a","src/rondpoint.udl":"ca4d8720758608b06ffd5f81bfc73881fbd0693a7a5b21bfe61a4557ea052048","tests/bindings/test_rondpoint.kts":"87b3d507f4260aae4e4711263c13b7158b9a814cb97bf5219d1451f348cd7372","tests/bindings/test_rondpoint.py":"d618274170af767f8a5614a2565ea698b26ea3e1a222d5c110e7b2d00763e73b","tests/bindings/test_rondpoint.rb":"9cc49df311823d6caedbe7b05ff8c4da6329063c2ce16810192aaaa7edcdf5f5","tests/bindings/test_rondpoint.swift":"471cf430be35dcdc19b3166adbc08561e0bd939931edc37da974e0fd16a49331","tests/test_generated_bindings.rs":"5843b2c9d6b86b35ab932349d278d9f281493880a1395e0b7566e297fad36c7d"},"package":null}
{"files":{"Cargo.toml":"310001adfc0a0484824f9f1bc66003287b6f945050f405133aab7d0f5c2239eb","build.rs":"8fcc699e02a7a7a163c03784a0d78f527ca34ab79a1fe583a01c1b320d8669ce","src/lib.rs":"b5eb9861fc436ab9fe9b0c00f95e374d812bbc0ea10b98cf746d38c96e44343a","src/rondpoint.udl":"ca4d8720758608b06ffd5f81bfc73881fbd0693a7a5b21bfe61a4557ea052048","tests/bindings/test_rondpoint.kts":"4aac8353278807f4add95c81f4c6c61187204b9767f882fd64872ed8ac1f6451","tests/bindings/test_rondpoint.py":"d618274170af767f8a5614a2565ea698b26ea3e1a222d5c110e7b2d00763e73b","tests/bindings/test_rondpoint.rb":"9cc49df311823d6caedbe7b05ff8c4da6329063c2ce16810192aaaa7edcdf5f5","tests/bindings/test_rondpoint.swift":"fa806e7e09c22ed44496658f6e0781765447bbdd250d7adf4b1152248ed70e69","tests/test_generated_bindings.rs":"5464f89e91c458f164b83a454c6df67a2953873e8a785a4720a2253d843f88e5"},"package":null}

Просмотреть файл

@ -1,7 +1,7 @@
[package]
name = "uniffi-example-rondpoint"
edition = "2021"
version = "0.21.0"
version = "0.22.0"
authors = ["Firefox Sync Team <sync-team@mozilla.com>"]
license = "MPL-2.0"
publish = false
@ -11,8 +11,10 @@ crate-type = ["lib", "cdylib"]
name = "uniffi_rondpoint"
[dependencies]
uniffi_macros = {path = "../../uniffi_macros"}
uniffi = {path = "../../uniffi", features=["builtin-bindgen"]}
uniffi = {path = "../../uniffi"}
[build-dependencies]
uniffi_build = {path = "../../uniffi_build", features=["builtin-bindgen"]}
uniffi = {path = "../../uniffi", features = ["build"] }
[dev-dependencies]
uniffi = {path = "../../uniffi", features = ["bindgen-tests"] }

Просмотреть файл

@ -3,5 +3,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
fn main() {
uniffi_build::generate_scaffolding("./src/rondpoint.udl").unwrap();
uniffi::generate_scaffolding("./src/rondpoint.udl").unwrap();
}

Просмотреть файл

@ -128,7 +128,7 @@ listOf(0L, 1L, -1L, Long.MIN_VALUE, Long.MAX_VALUE).affirmEnchaine(st::toStringI
listOf(0u, 1u, ULong.MIN_VALUE, ULong.MAX_VALUE).affirmEnchaine(st::toStringU64)
// Floats
// MIN_VAUE is 1.4E-45. Accuracy and formatting get weird at small sizes.
// MIN_VALUE is 1.4E-45. Accuracy and formatting get weird at small sizes.
listOf(0.0F, 1.0F, -1.0F, Float.MIN_VALUE, Float.MAX_VALUE).affirmEnchaine(st::toStringFloat) { s, n -> s.toFloat() == n }
// Doubles
@ -224,7 +224,7 @@ op.destroy()
// Testing defaulting properties in record types.
val defaultes = OptionneurDictionnaire()
val explicite = OptionneurDictionnaire(
val explicites = OptionneurDictionnaire(
i8Var = -8,
u8Var = 8u,
i16Var = -16,
@ -241,7 +241,7 @@ val explicite = OptionneurDictionnaire(
enumerationVar = Enumeration.DEUX,
dictionnaireVar = null
)
assert(defaultes == explicite)
assert(defaultes == explicites)
// …and makes sure they travel across and back the FFI.
val rt2 = Retourneur()

Просмотреть файл

@ -209,7 +209,7 @@ assert(op.sinonEnum() == .trois)
// Testing defaulting properties in record types.
let defaultes = OptionneurDictionnaire()
let explicite = OptionneurDictionnaire(
let explicites = OptionneurDictionnaire(
i8Var: Int8(-8),
u8Var: UInt8(8),
i16Var: Int16(-16),
@ -228,5 +228,5 @@ let explicite = OptionneurDictionnaire(
)
// and makes sure they travel across and back the FFI.
assert(defaultes == explicite)
assert(defaultes == explicites)
[defaultes].affirmAllerRetour(rt.identiqueOptionneurDictionnaire)

Просмотреть файл

@ -1,9 +1,6 @@
uniffi_macros::build_foreign_language_testcases!(
["src/rondpoint.udl",],
[
"tests/bindings/test_rondpoint.kts",
"tests/bindings/test_rondpoint.swift",
"tests/bindings/test_rondpoint.py",
"tests/bindings/test_rondpoint.rb",
]
uniffi::build_foreign_language_testcases!(
"tests/bindings/test_rondpoint.kts",
"tests/bindings/test_rondpoint.swift",
"tests/bindings/test_rondpoint.py",
"tests/bindings/test_rondpoint.rb",
);

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"78217b44063b2583832205fcbc5be8f1e92d4a77b58a97718edbdc9b2c60e604","build.rs":"d36e4ff477007611d216e60998d6d8a51b33895bb95159e3d7732e2b8cbc1783","src/lib.rs":"857ae59f3194cb7fe117a308854bc793b2b56441e297bd0e327795fd435494da","src/sprites.udl":"bfd35f04ba0549301189dfb8fc45b0f39bad00956c324f33be0e845fb7ff78aa","tests/bindings/test_sprites.kts":"06ed115325f37ce59ed6f33e2d651cd2aa352fddcc644580f62a6da6ca075844","tests/bindings/test_sprites.py":"2e6ce838cfb387586257703c3500062438e840dd7ae57d185cdc244dc0745b8f","tests/bindings/test_sprites.rb":"6289a1833c7c8f4583ee4f0488d680de2ee46cfb203095a9b66d7234e2f07d53","tests/bindings/test_sprites.swift":"b2c0a6f4d5edfd7de7c2ba77b838865ffda153a6f364f273456175192d3e6e00","tests/test_generated_bindings.rs":"920c532011c8a6c20bdb1f39c50ef7a2803729a62a1bd425d81e40300958778a"},"package":null}
{"files":{"Cargo.toml":"890a03ab8daf02579f8409ffbab0a4c634ea2dad9b923fe65eaadbe7a0909f90","build.rs":"84ba28d15fc0987d8efb5d523a643717c6b4b9b29570c0cc9cff81126ecfce7f","src/lib.rs":"857ae59f3194cb7fe117a308854bc793b2b56441e297bd0e327795fd435494da","src/sprites.udl":"bfd35f04ba0549301189dfb8fc45b0f39bad00956c324f33be0e845fb7ff78aa","tests/bindings/test_sprites.kts":"06ed115325f37ce59ed6f33e2d651cd2aa352fddcc644580f62a6da6ca075844","tests/bindings/test_sprites.py":"2e6ce838cfb387586257703c3500062438e840dd7ae57d185cdc244dc0745b8f","tests/bindings/test_sprites.rb":"6289a1833c7c8f4583ee4f0488d680de2ee46cfb203095a9b66d7234e2f07d53","tests/bindings/test_sprites.swift":"b2c0a6f4d5edfd7de7c2ba77b838865ffda153a6f364f273456175192d3e6e00","tests/test_generated_bindings.rs":"9a22d693c97fc6d90031cc60f61ece1d9279165ad6a92c9fe937448e126e8de6"},"package":null}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше