diff --git a/.envrc b/.envrc index 8f2c2eca..2dc69441 100644 --- a/.envrc +++ b/.envrc @@ -15,3 +15,6 @@ use_trunk.io() { } use trunk.io + +# Needed by `rust-analyzer`. Hash should be the same for all platforms. +export RUST_SRC_PATH="$HOME/.cache/trunk/tools/rust-src/2024-05-01-d4daa7f4db5f9d74e00218df573de113/rust-src-nightly/rust-src/lib/rustlib/src/rust/library" diff --git a/.github/actions/setup_rust_cargo/action.yaml b/.github/actions/setup_rust_cargo/action.yaml index 2a2191ee..f2531e3e 100644 --- a/.github/actions/setup_rust_cargo/action.yaml +++ b/.github/actions/setup_rust_cargo/action.yaml @@ -9,16 +9,6 @@ runs: with: targets: wasm32-unknown-unknown - - name: Install protoc - shell: bash - run: | - if [ -f /opt/homebrew/bin/brew ]; then - /opt/homebrew/bin/brew install protobuf - elif [ -f /usr/bin/apt ]; then - sudo /usr/bin/apt update - sudo /usr/bin/apt install -y protobuf-compiler - fi - - uses: actions/cache@v4 with: path: | diff --git a/.github/workflows/pyo3.yml b/.github/workflows/pyo3.yml index 09dc86d4..e97cca60 100644 --- a/.github/workflows/pyo3.yml +++ b/.github/workflows/pyo3.yml @@ -60,16 +60,6 @@ jobs: /usr/bin/apt update /usr/bin/apt install -y pkg-config libssl-dev unzip fi - - if [ "$(uname -m)" == "aarch64" ]; then - curl -L https://github.com/protocolbuffers/protobuf/releases/download/v29.1/protoc-29.1-linux-aarch_64.zip -o protoc.zip - unzip protoc.zip - export PROTOC=$(pwd)/bin/protoc - else - curl -L https://github.com/protocolbuffers/protobuf/releases/download/v29.1/protoc-29.1-linux-x86_64.zip -o protoc.zip - unzip protoc.zip - export PROTOC=$(pwd)/bin/protoc - fi - name: Upload wheels uses: actions/upload-artifact@v4 with: diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 3b0eb6e8..5ebb1422 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -14,8 +14,8 @@ runtimes: enabled: - node@18.12.1 - python@3.10.8 - - rust@1.81.0 - ruby@3.1.0 + - rust@2024-05-01 # This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) lint: enabled: @@ -24,7 +24,7 @@ lint: - bandit@1.7.10 - black@24.10.0 - checkov@3.2.296 - - clippy@1.81.0 + - clippy@2024-05-01 - eslint@9.14.0 - git-diff-check - isort@5.13.2 @@ -32,7 +32,7 @@ lint: - osv-scanner@1.9.1 - prettier@3.3.3 - ruff@0.7.3 - - rustfmt@1.81.0 + - rustfmt@2024-05-01 - taplo@0.9.3 - trufflehog@3.83.7 - yamllint@1.35.1 @@ -48,9 +48,43 @@ lint: run: pyright -p context-py --outputjson target: . batch: false + - name: clippy + runtime: rust + environment: + - name: PATH + list: ["${runtime}", "${env.PATH}"] + commands: + - name: lint + run: + cargo clippy --message-format json --locked --all-targets --all-features -- + --cap-lints=warn --no-deps + output: clippy + target: ${parent_with(Cargo.toml)} + success_codes: [0, 101, 383] + run_from: ${target_directory} + disable_upstream: true + - name: rustfmt + runtime: rust + commands: + - name: format + output: rewrite + read_output_from: stdout + stdin: true + success_codes: [0] + cache_results: false # sometimes caches an empty file for some reason + in_place: false + batch: false + run: rustfmt --edition=2021 + ignore: + - linters: [ALL] + paths: + # Ignore generated files + - target/** + - "**/target/**" actions: definitions: - id: generate-pyi + runtime: rust description: Generate Python stubs # Don't use hermetic runtime so we can use nightly cargo run: | @@ -63,36 +97,33 @@ actions: - trunk-fmt-pre-commit - trunk-upgrade-available downloads: - - name: protoc + - name: rust downloads: - os: - linux: linux - macos: osx + macos: apple-darwin + linux: unknown-linux-gnu cpu: x86_64: x86_64 - arm_64: aarch_64 - url: https://github.com/protocolbuffers/protobuf/releases/download/v${version}/protoc-${version}-${os}-${cpu}.zip - - os: - windows: windows - cpu: - x86_64: x86_64 - url: https://github.com/protocolbuffers/protobuf/releases/download/v29.1/protoc-29.1-win64.zip + arm_64: aarch64 + url: https://static.rust-lang.org/dist/${version}/rust-nightly-${cpu}-${os}.tar.gz + strip_components: 2 + - name: rust-src + downloads: + - url: https://static.rust-lang.org/dist/${version}/rust-src-nightly.tar.xz tools: definitions: - - name: protoc - download: protoc - known_good_version: 29.1 - shims: [protoc] - environment: - - name: PATH - list: ["${tool}/bin"] - health_checks: - - command: protoc --version - parse_regex: libprotoc (\d+\.\d+) + - name: rust-src + download: rust-src + known_good_version: 2024-05-01 + shims: [rust-src] runtimes: - ruby - node + - rust enabled: - gh@2.62.0 - pnpm@9.14.2 - - protoc@29.1 + # Update `RUST_SRC_PATH` path to `rust-src` if this is updated + # IfChange + - rust-src@2024-05-01 + # ThenChange .envrc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1abc3dc3..f478b639 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,6 @@ These are instructions for building, running, and testing the Rust CLI locally. ## Prerequisites - Install a nightly version of Cargo using [rustup](https://doc.rust-lang.org/cargo/getting-started/installation.html) -- Install [protoc](https://grpc.io/docs/protoc-installation/) - Run `trunk tools install` ### Optional Prerequisites diff --git a/Cargo.lock b/Cargo.lock index e5ce8432..bb237d03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -395,7 +395,7 @@ dependencies = [ "futures-util", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "itoa", "matchit", "memchr", @@ -528,9 +528,10 @@ dependencies = [ "pbjson", "pbjson-build", "pbjson-types", - "prost 0.13.4", - "prost-build 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-build", + "prost-types", + "protox", "serde", "serde_json", "tonic", @@ -778,7 +779,7 @@ version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.90", @@ -964,7 +965,7 @@ dependencies = [ "codeowners", "context", "futures-io", - "prost 0.13.4", + "prost", "proto", "pyo3", "pyo3-stub-gen", @@ -1965,6 +1966,12 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "heck" version = "0.5.0" @@ -2079,9 +2086,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.31" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ "bytes", "futures-channel", @@ -2145,7 +2152,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.31", + "hyper 0.14.32", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -2392,6 +2399,15 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.12.1" @@ -3014,9 +3030,9 @@ dependencies = [ [[package]] name = "pbjson" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e6349fa080353f4a597daffd05cb81572a9c031a6d4fff7e504947496fcc68" +checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" dependencies = [ "base64 0.21.7", "serde", @@ -3024,28 +3040,28 @@ dependencies = [ [[package]] name = "pbjson-build" -version = "0.7.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eea3058763d6e656105d1403cb04e0a41b7bbac6362d413e7c33be0c32279c9" +checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" dependencies = [ - "heck", - "itertools 0.13.0", - "prost 0.13.4", - "prost-types 0.13.4", + "heck 0.4.1", + "itertools 0.11.0", + "prost", + "prost-types", ] [[package]] name = "pbjson-types" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54e5e7bfb1652f95bc361d76f3c780d8e526b134b85417e774166ee941f0887" +checksum = "18f596653ba4ac51bdecbb4ef6773bc7f56042dc13927910de1684ad3d32aa12" dependencies = [ "bytes", "chrono", "pbjson", "pbjson-build", - "prost 0.13.4", - "prost-build 0.13.4", + "prost", + "prost-build", "serde", ] @@ -3237,17 +3253,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", - "prost-derive 0.12.6", -] - -[[package]] -name = "prost" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0fef6c4230e4ccf618a35c59d7ede15dea37de8427500f50aff708806e42ec" -dependencies = [ - "bytes", - "prost-derive 0.13.4", + "prost-derive", ] [[package]] @@ -3257,35 +3263,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", - "heck", + "heck 0.5.0", "itertools 0.12.1", "log", "multimap", "once_cell", "petgraph", "prettyplease", - "prost 0.12.6", - "prost-types 0.12.6", - "regex", - "syn 2.0.90", - "tempfile", -] - -[[package]] -name = "prost-build" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f3e5beed80eb580c68e2c600937ac2c4eedabdfd5ef1e5b7ea4f3fba84497b" -dependencies = [ - "heck", - "itertools 0.13.0", - "log", - "multimap", - "once_cell", - "petgraph", - "prettyplease", - "prost 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-types", "regex", "syn 2.0.90", "tempfile", @@ -3304,30 +3290,17 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "prost-derive" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" -dependencies = [ - "anyhow", - "itertools 0.13.0", - "proc-macro2", - "quote", - "syn 2.0.90", -] - [[package]] name = "prost-reflect" -version = "0.14.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20ae544fca2892fd4b7e9ff26cba1090cedf1d4d95c2aded1af15d2f93f270b8" +checksum = "6f5eec97d5d34bdd17ad2db2219aabf46b054c6c41bd5529767c9ce55be5898f" dependencies = [ "logos", "miette", "once_cell", - "prost 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-types", ] [[package]] @@ -3336,27 +3309,18 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" dependencies = [ - "prost 0.12.6", -] - -[[package]] -name = "prost-types" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2f1e56baa61e93533aebc21af4d2134b70f66275e0fcdf3cbe43d77ff7e8fc" -dependencies = [ - "prost 0.13.4", + "prost", ] [[package]] name = "prost-wkt" -version = "0.6.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d84e2bee181b04c2bac339f2bfe818c46a99750488cc6728ce4181d5aa8299" +checksum = "5fb7ec2850c138ebaa7ab682503b5d08c3cb330343e9c94776612928b6ddb53f" dependencies = [ "chrono", "inventory", - "prost 0.13.4", + "prost", "serde", "serde_derive", "serde_json", @@ -3365,29 +3329,30 @@ dependencies = [ [[package]] name = "prost-wkt-build" -version = "0.6.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a669d5acbe719010c6f62a64e6d7d88fdedc1fe46e419747949ecb6312e9b14" +checksum = "598b7365952c2ed4e32902de0533653aafbe5ae3da436e8e2335c7d375a1cef3" dependencies = [ - "heck", - "prost 0.13.4", - "prost-build 0.13.4", - "prost-types 0.13.4", + "heck 0.5.0", + "prost", + "prost-build", + "prost-types", "quote", ] [[package]] name = "prost-wkt-types" -version = "0.6.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ef068e9b82e654614b22e6b13699bd545b6c0e2e721736008b00b38aeb4f64" +checksum = "1a8eadc2381640a49c1fbfb9f4a857794b4e5bf5a2cbc2d858cfdb74f64dcd22" dependencies = [ "chrono", - "prost 0.13.4", - "prost-build 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-build", + "prost-types", "prost-wkt", "prost-wkt-build", + "protox", "regex", "serde", "serde_derive", @@ -3398,9 +3363,9 @@ dependencies = [ name = "proto" version = "0.0.0" dependencies = [ - "prost 0.13.4", - "prost-build 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-build", + "prost-types", "prost-wkt-types", "protox", "serde", @@ -3408,28 +3373,28 @@ dependencies = [ [[package]] name = "protox" -version = "0.7.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "873f359bdecdfe6e353752f97cb9ee69368df55b16363ed2216da85e03232a58" +checksum = "ac532509cee918d40f38c3e12f8ef9230f215f017d54de7dd975015538a42ce7" dependencies = [ "bytes", "miette", - "prost 0.13.4", + "prost", "prost-reflect", - "prost-types 0.13.4", + "prost-types", "protox-parse", "thiserror 1.0.69", ] [[package]] name = "protox-parse" -version = "0.7.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a462d115462c080ae000c29a47f0b3985737e5d3a995fcdbcaa5c782068dde" +checksum = "7f6c33f43516fe397e2f930779d720ca12cd057f7da4cd6326a0ef78d69dee96" dependencies = [ "logos", "miette", - "prost-types 0.13.4", + "prost-types", "thiserror 1.0.69", ] @@ -3489,7 +3454,7 @@ version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "pyo3-build-config", "quote", @@ -4268,7 +4233,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "rustversion", @@ -4396,7 +4361,7 @@ dependencies = [ "js-sys", "magnus", "more-asserts", - "prost 0.13.4", + "prost", "prost-wkt-types", "proto", "serde_json", @@ -4651,9 +4616,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" dependencies = [ "async-stream", "async-trait", @@ -4663,11 +4628,11 @@ dependencies = [ "h2", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.12.6", + "prost", "tokio", "tokio-stream", "tower 0.4.13", @@ -4678,13 +4643,13 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" +checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" dependencies = [ "prettyplease", "proc-macro2", - "prost-build 0.12.6", + "prost-build", "quote", "syn 2.0.90", ] diff --git a/bazel-bep/Cargo.toml b/bazel-bep/Cargo.toml index ce2995e7..d2e5cd66 100644 --- a/bazel-bep/Cargo.toml +++ b/bazel-bep/Cargo.toml @@ -7,21 +7,22 @@ license = "MIT" repository = "https://github.com/ChristianBelloni/bazel-bep" [dependencies] -tonic = { version = "0.10", default-features = false, features = [ +tonic = { version = "0.11.0", default-features = false, features = [ "codegen", "prost", ] } -prost = "0.13.3" -prost-types = "0.13.3" -pbjson = "0.7.0" -pbjson-types = "0.7.0" +prost = "0.12.6" +prost-types = "0.12.6" +pbjson = "0.6.0" +pbjson-types = "0.6.0" serde = { version = "1.0.215", default-features = false, features = ["derive"] } serde_json = "1.0.133" [build-dependencies] -tonic-build = "0.10" -prost-build = "0.13.3" -pbjson-build = "0.7.0" +tonic-build = "0.11.0" +prost-build = "0.12.6" +pbjson-build = "0.6.2" +protox = "0.6.1" [features] default = [] diff --git a/bazel-bep/build.rs b/bazel-bep/build.rs index bc48ca10..61d1a283 100644 --- a/bazel-bep/build.rs +++ b/bazel-bep/build.rs @@ -1,4 +1,6 @@ -use std::{env, io, path::PathBuf}; +use std::{env, fs, io, path::PathBuf}; + +use protox::prost::Message; fn main() -> io::Result<()> { let protos = std::fs::read_dir("proto")? @@ -20,16 +22,21 @@ fn main() -> io::Result<()> { #[cfg(not(feature = "server"))] let compiler = compiler.build_server(false); + let file_descriptors = protox::compile(&protos, ["proto/"]).unwrap(); + let file_descriptors_bytes = file_descriptors.encode_to_vec(); + + fs::write(&descriptor_path, &file_descriptors_bytes).unwrap(); + compiler .file_descriptor_set_path(&descriptor_path) + .skip_protoc_run() .compile_well_known_types(true) // Override prost-types with pbjson-types .extern_path(".google.protobuf", "::pbjson_types") .compile(&protos, &["proto/"])?; - let descriptor_set = std::fs::read(descriptor_path)?; pbjson_build::Builder::new() - .register_descriptors(&descriptor_set)? + .register_descriptors(&file_descriptors_bytes)? .build(&["."])?; Ok(()) diff --git a/bazel-bep/src/lib.rs b/bazel-bep/src/lib.rs index f0ddcc81..903ddcd8 100644 --- a/bazel-bep/src/lib.rs +++ b/bazel-bep/src/lib.rs @@ -45,6 +45,8 @@ pub mod types { } } +// NOTE: `build_event_stream(.serde).rs` has some failing clippy lints +#[allow(clippy::all)] pub(crate) mod build_event_stream { include!(concat!(env!("OUT_DIR"), "/build_event_stream.rs")); include!(concat!(env!("OUT_DIR"), "/build_event_stream.serde.rs")); diff --git a/cli/src/upload.rs b/cli/src/upload.rs index 88f6316e..252b0add 100644 --- a/cli/src/upload.rs +++ b/cli/src/upload.rs @@ -17,8 +17,6 @@ use bundle::{ use codeowners::CodeOwners; use constants::{EXIT_FAILURE, EXIT_SUCCESS}; #[cfg(target_os = "macos")] -use context::junit::junit_path::JunitReportStatus; -#[cfg(target_os = "macos")] use context::repo::RepoUrlParts; use context::{ bazel_bep::parser::{BazelBepParser, BepParseResult}, diff --git a/context-py/Cargo.toml b/context-py/Cargo.toml index 1b234d2f..98701aa6 100644 --- a/context-py/Cargo.toml +++ b/context-py/Cargo.toml @@ -20,7 +20,7 @@ pyo3-stub-gen = "0.6.0" futures-io = "0.3.31" tokio = { version = "*", default-features = false, features = ["rt"] } proto = { path = "../proto" } -prost = "0.13.4" +prost = "0.12.6" [target.'cfg(target_os = "linux")'.dependencies] pyo3 = { version = "0.22.5", features = ["abi3-py39", "extension-module"] } diff --git a/context-ruby/ext/context_ruby/Cargo.lock b/context-ruby/ext/context_ruby/Cargo.lock index 4a5f4e93..6bbb2c68 100644 --- a/context-ruby/ext/context_ruby/Cargo.lock +++ b/context-ruby/ext/context_ruby/Cargo.lock @@ -357,9 +357,10 @@ dependencies = [ "pbjson", "pbjson-build", "pbjson-types", - "prost 0.13.4", - "prost-build 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-build", + "prost-types", + "protox", "serde", "serde_json", "tonic", @@ -602,7 +603,7 @@ version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.90", @@ -1573,6 +1574,12 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "heck" version = "0.5.0" @@ -1943,18 +1950,18 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" -version = "0.12.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] [[package]] name = "itertools" -version = "0.13.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -2400,9 +2407,9 @@ dependencies = [ [[package]] name = "pbjson" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e6349fa080353f4a597daffd05cb81572a9c031a6d4fff7e504947496fcc68" +checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" dependencies = [ "base64 0.21.7", "serde", @@ -2410,28 +2417,28 @@ dependencies = [ [[package]] name = "pbjson-build" -version = "0.7.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eea3058763d6e656105d1403cb04e0a41b7bbac6362d413e7c33be0c32279c9" +checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" dependencies = [ - "heck", - "itertools 0.13.0", - "prost 0.13.4", - "prost-types 0.13.4", + "heck 0.4.1", + "itertools 0.11.0", + "prost", + "prost-types", ] [[package]] name = "pbjson-types" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54e5e7bfb1652f95bc361d76f3c780d8e526b134b85417e774166ee941f0887" +checksum = "18f596653ba4ac51bdecbb4ef6773bc7f56042dc13927910de1684ad3d32aa12" dependencies = [ "bytes", "chrono", "pbjson", "pbjson-build", - "prost 0.13.4", - "prost-build 0.13.4", + "prost", + "prost-build", "serde", ] @@ -2566,17 +2573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", - "prost-derive 0.12.6", -] - -[[package]] -name = "prost" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0fef6c4230e4ccf618a35c59d7ede15dea37de8427500f50aff708806e42ec" -dependencies = [ - "bytes", - "prost-derive 0.13.4", + "prost-derive", ] [[package]] @@ -2586,35 +2583,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", - "heck", + "heck 0.5.0", "itertools 0.12.1", "log", "multimap", "once_cell", "petgraph", "prettyplease", - "prost 0.12.6", - "prost-types 0.12.6", - "regex", - "syn 2.0.90", - "tempfile", -] - -[[package]] -name = "prost-build" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f3e5beed80eb580c68e2c600937ac2c4eedabdfd5ef1e5b7ea4f3fba84497b" -dependencies = [ - "heck", - "itertools 0.13.0", - "log", - "multimap", - "once_cell", - "petgraph", - "prettyplease", - "prost 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-types", "regex", "syn 2.0.90", "tempfile", @@ -2633,30 +2610,17 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "prost-derive" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" -dependencies = [ - "anyhow", - "itertools 0.13.0", - "proc-macro2", - "quote", - "syn 2.0.90", -] - [[package]] name = "prost-reflect" -version = "0.14.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20ae544fca2892fd4b7e9ff26cba1090cedf1d4d95c2aded1af15d2f93f270b8" +checksum = "6f5eec97d5d34bdd17ad2db2219aabf46b054c6c41bd5529767c9ce55be5898f" dependencies = [ "logos", "miette", "once_cell", - "prost 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-types", ] [[package]] @@ -2665,27 +2629,18 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" dependencies = [ - "prost 0.12.6", -] - -[[package]] -name = "prost-types" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2f1e56baa61e93533aebc21af4d2134b70f66275e0fcdf3cbe43d77ff7e8fc" -dependencies = [ - "prost 0.13.4", + "prost", ] [[package]] name = "prost-wkt" -version = "0.6.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d84e2bee181b04c2bac339f2bfe818c46a99750488cc6728ce4181d5aa8299" +checksum = "5fb7ec2850c138ebaa7ab682503b5d08c3cb330343e9c94776612928b6ddb53f" dependencies = [ "chrono", "inventory", - "prost 0.13.4", + "prost", "serde", "serde_derive", "serde_json", @@ -2694,29 +2649,30 @@ dependencies = [ [[package]] name = "prost-wkt-build" -version = "0.6.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a669d5acbe719010c6f62a64e6d7d88fdedc1fe46e419747949ecb6312e9b14" +checksum = "598b7365952c2ed4e32902de0533653aafbe5ae3da436e8e2335c7d375a1cef3" dependencies = [ - "heck", - "prost 0.13.4", - "prost-build 0.13.4", - "prost-types 0.13.4", + "heck 0.5.0", + "prost", + "prost-build", + "prost-types", "quote", ] [[package]] name = "prost-wkt-types" -version = "0.6.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ef068e9b82e654614b22e6b13699bd545b6c0e2e721736008b00b38aeb4f64" +checksum = "1a8eadc2381640a49c1fbfb9f4a857794b4e5bf5a2cbc2d858cfdb74f64dcd22" dependencies = [ "chrono", - "prost 0.13.4", - "prost-build 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-build", + "prost-types", "prost-wkt", "prost-wkt-build", + "protox", "regex", "serde", "serde_derive", @@ -2727,9 +2683,9 @@ dependencies = [ name = "proto" version = "0.0.0" dependencies = [ - "prost 0.13.4", - "prost-build 0.13.4", - "prost-types 0.13.4", + "prost", + "prost-build", + "prost-types", "prost-wkt-types", "protox", "serde", @@ -2737,28 +2693,28 @@ dependencies = [ [[package]] name = "protox" -version = "0.7.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "873f359bdecdfe6e353752f97cb9ee69368df55b16363ed2216da85e03232a58" +checksum = "ac532509cee918d40f38c3e12f8ef9230f215f017d54de7dd975015538a42ce7" dependencies = [ "bytes", "miette", - "prost 0.13.4", + "prost", "prost-reflect", - "prost-types 0.13.4", + "prost-types", "protox-parse", "thiserror 1.0.69", ] [[package]] name = "protox-parse" -version = "0.7.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a462d115462c080ae000c29a47f0b3985737e5d3a995fcdbcaa5c782068dde" +checksum = "7f6c33f43516fe397e2f930779d720ca12cd057f7da4cd6326a0ef78d69dee96" dependencies = [ "logos", "miette", - "prost-types 0.13.4", + "prost-types", "thiserror 1.0.69", ] @@ -3464,7 +3420,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "rustversion", @@ -3563,7 +3519,7 @@ dependencies = [ "anyhow", "chrono", "magnus", - "prost 0.13.4", + "prost", "prost-wkt-types", "proto", "serde_json", @@ -3754,9 +3710,9 @@ dependencies = [ [[package]] name = "tonic" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" dependencies = [ "async-trait", "base64 0.21.7", @@ -3765,7 +3721,7 @@ dependencies = [ "http-body 0.4.6", "percent-encoding", "pin-project", - "prost 0.12.6", + "prost", "tokio", "tokio-stream", "tower-layer", @@ -3775,13 +3731,13 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" +checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" dependencies = [ "prettyplease", "proc-macro2", - "prost-build 0.12.6", + "prost-build", "quote", "syn 2.0.90", ] diff --git a/context/Cargo.toml b/context/Cargo.toml index b4c9bae1..3c12ad66 100644 --- a/context/Cargo.toml +++ b/context/Cargo.toml @@ -8,7 +8,6 @@ pretty_assertions = "0.6" junit-mock = { path = "../junit-mock" } test_utils = { path = "../test_utils" } tempfile = "3.2.0" -prost-wkt-types = "0.6.0" [dependencies] anyhow = "1.0.44" @@ -34,7 +33,7 @@ uuid = { version = "1.10.0", features = ["v5"] } wasm-bindgen = { version = "0.2.95", optional = true } magnus = { version = "0.7.1", optional = true, default-features = false } proto = { path = "../proto" } -prost-wkt-types = "0.6.0" +prost-wkt-types = { version = "0.5.1", features = ["vendored-protox"] } [target.'cfg(target_os = "linux")'.dependencies] pyo3 = { version = "0.22.5", optional = true, features = [ diff --git a/context/src/junit/bindings.rs b/context/src/junit/bindings.rs index a331e68b..3bd33dd0 100644 --- a/context/src/junit/bindings.rs +++ b/context/src/junit/bindings.rs @@ -107,15 +107,18 @@ impl From for BindingsReport { ) }); let (name, timestamp, timestamp_micros) = match uploader_metadata { - Some(t) => ( - t.origin, - Some(t.upload_time.unwrap_or_default().seconds), - Some( - chrono::Duration::nanoseconds(t.upload_time.unwrap_or_default().nanos as i64) - .num_microseconds() - .unwrap_or_default(), - ), - ), + Some(t) => { + let upload_time = t.upload_time.clone().unwrap_or_default(); + ( + t.origin, + Some(upload_time.seconds), + Some( + chrono::Duration::nanoseconds(upload_time.nanos as i64) + .num_microseconds() + .unwrap_or_default(), + ), + ) + } None => ("Unknown".to_string(), None, None), }; BindingsReport { @@ -148,9 +151,9 @@ impl From for BindingsTestCase { attempt_number, }: TestCaseRun, ) -> Self { - let timestamp = chrono::DateTime::from(started_at.unwrap_or_default()); - let timestamp_micros = - chrono::DateTime::from(started_at.unwrap_or_default()).timestamp_subsec_micros() as i64; + let started_at = started_at.unwrap_or_default(); + let timestamp = chrono::DateTime::from(started_at.clone()); + let timestamp_micros = chrono::DateTime::from(started_at).timestamp_subsec_micros() as i64; let time = (chrono::DateTime::from(finished_at.unwrap_or_default()) - timestamp) .to_std() .unwrap_or_default(); @@ -933,8 +936,8 @@ fn parse_test_report_to_bindings() { line: 1, status: TestCaseRunStatus::Success.into(), attempt_number: 1, - started_at: Some(test_started_at), - finished_at: Some(test_finished_at), + started_at: Some(test_started_at.clone()), + finished_at: Some(test_finished_at.clone()), status_output_message: "test_status_output_message".into(), ..Default::default() }; @@ -948,7 +951,7 @@ fn parse_test_report_to_bindings() { line: 1, status: TestCaseRunStatus::Failure.into(), attempt_number: 1, - started_at: Some(test_started_at), + started_at: Some(test_started_at.clone()), finished_at: Some(test_finished_at), status_output_message: "test_status_output_message".into(), ..Default::default() @@ -978,7 +981,7 @@ fn parse_test_report_to_bindings() { assert_eq!(test_case1.assertions, None); assert_eq!( test_case1.timestamp, - Some(test1.started_at.unwrap().seconds) + Some(test1.started_at.clone().unwrap().seconds) ); assert_eq!( test_case1.timestamp_micros, @@ -1003,7 +1006,7 @@ fn parse_test_report_to_bindings() { assert_eq!(test_case2.assertions, None); assert_eq!( test_case2.timestamp, - Some(test2.started_at.unwrap().seconds) + Some(test2.started_at.clone().unwrap().seconds) ); assert_eq!( test_case2.timestamp_micros, diff --git a/context/src/lib.rs b/context/src/lib.rs index 0df1425e..f5519459 100644 --- a/context/src/lib.rs +++ b/context/src/lib.rs @@ -1,5 +1,3 @@ -// NOTE: This lint isn't applicable since we compile with nightly -/* trunk-ignore(clippy/E0554) */ #![feature(round_char_boundary)] pub mod bazel_bep; diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 7c677fc9..4362f599 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -9,11 +9,11 @@ name = "proto" path = "src/lib.rs" [dependencies] -prost = "0.13.4" -prost-types = "0.13.4" -prost-wkt-types = "0.6.0" +prost = "0.12.6" +prost-types = "0.12.6" +prost-wkt-types = { version = "0.5.1", features = ["vendored-protox"] } serde = "1.0.215" [build-dependencies] -prost-build = "0.13.4" -protox = "0.7.1" +prost-build = "0.12.6" +protox = "0.6.1" diff --git a/proto/src/build.rs b/proto/src/build.rs index 527a8bce..77963f40 100644 --- a/proto/src/build.rs +++ b/proto/src/build.rs @@ -1,10 +1,8 @@ -use std::io::Result; - -fn main() -> Result<()> { - let mut prost_build = prost_build::Config::new(); - prost_build +fn main() { + let file_descriptors = protox::compile(["proto/test_context.proto"], ["proto/"]).unwrap(); + prost_build::Config::new() .type_attribute(".", "#[derive(serde::Serialize,serde::Deserialize)]") .extern_path(".google.protobuf.Timestamp", "::prost_wkt_types::Timestamp") - .compile_protos(&["proto/test_context.proto"], &["proto/"])?; - Ok(()) + .compile_fds(file_descriptors) + .unwrap(); } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 045bd13e..5d1d9ae4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,3 @@ [toolchain] -channel = "nightly-2024-05-01" # Output tests in JSON for Junit reports requires nightly +channel = "nightly-2024-05-01" +components = ["clippy", "rustfmt", "rust-src"] diff --git a/test_report/Cargo.toml b/test_report/Cargo.toml index e89777c3..8fbf4d66 100644 --- a/test_report/Cargo.toml +++ b/test_report/Cargo.toml @@ -8,8 +8,8 @@ wasm-bindgen = { version = "0.2.95", optional = true } magnus = { version = "0.7.1", optional = true, default-features = false } proto = { path = "../proto" } trunk-analytics-cli = { path = "../cli" } -prost-wkt-types = "0.6.0" -prost = "0.13.4" +prost-wkt-types = { version = "0.5.1", features = ["vendored-protox"] } +prost = "0.12.6" tempfile = "3.2.0" chrono = "0.4.33" serde_json = "1.0.133"