Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tracing (logging) to crate_universe #2224

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

UebelAndre
Copy link
Collaborator

The CARGO_BAZEL_DEBUG environment variable will now activate verbose logging for the cargo_bazel binary (aka, in crates_repository and crates_vendor rules). An example of the output looks like the following:

~/Code/repro-cargo-bazel-lock-issue (main ✗) CARGO_BAZEL_DEBUG=1 REPIN=1 bazel build ...
Splice 2023-10-29T22:18:42.240171Z DEBUG LockGenerator::generate: cargo_bazel::metadata: Generating Cargo Lockfile for /private/var/tmp/_bazel_user/0c9b227e7e0599ba0ec95785817f1b2a/external/crate_index/splicing-workspace/Cargo.toml
Splice 2023-10-29T22:18:42.240217Z DEBUG LockGenerator::generate: cargo_bazel::metadata: Using existing lock /Users/user/Code/repro-cargo-bazel-lock-issue/Cargo.lock
Splice 2023-10-29T22:18:44.424638Z DEBUG FeatureGenerator::generate: cargo_bazel::metadata: Generating features for manifest /private/var/tmp/_bazel_user/0c9b227e7e0599ba0ec95785817f1b2a/external/crate_index/splicing-workspace/Cargo.toml
Splice 2023-10-29T22:18:44.424645Z DEBUG FeatureGenerator::generate: cargo_bazel::metadata: Spawning processes for {"aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-apple-darwin", "i686-linux-android", "i686-pc-windows-msvc", "i686-unknown-freebsd", "i686-unknown-linux-gnu", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-darwin", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-pc-windows-msvc", "x86_64-unknown-freebsd", "x86_64-unknown-linux-gnu", "x86_64-unknown-none"}
Splice 2023-10-29T22:18:44.734294Z DEBUG FeatureGenerator::generate: cargo_bazel::metadata: Process complete for aarch64-apple-darwin
Splice 2023-10-29T22:18:44.734398Z DEBUG FeatureGenerator::generate: cargo_bazel::metadata: 	For anyhow 1.0.75 features were: {"default", "std"}
Splice 2023-10-29T22:18:44.734424Z DEBUG FeatureGenerator::generate: cargo_bazel::metadata: 	For autocfg 1.1.0 features were: {}
Splice 2023-10-29T22:18:44.734426Z DEBUG FeatureGenerator::generate: cargo_bazel::metadata: 	For base64 0.21.5 features were: {"alloc", "default", "std"}
Splice 2023-10-29T22:18:44.734430Z DEBUG FeatureGenerator::generate: cargo_bazel::metadata: 	For bitflags 2.4.1 features were: {"std"}
Splice 2023-10-29T22:18:44.734431Z DEBUG FeatureGenerator::generate: cargo_bazel::metadata: 	For bytes 1.5.0 features were: {"default", "std"}

@UebelAndre
Copy link
Collaborator Author

I've yet to do a pass on what logging would make sense outside if investigating a specific issue around features. But it would be good to have more logging so users can include them in their bug reports and make identifying problems easier.

Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

I think you also need to modify CRATES_REPOSITORY_ENVIRON in crate_universe/private/generate_utils.bzl to be sensitive to this env var, because otherwise your "should this be quiet or not" will not be re-evaluated if you change this env var.

@UebelAndre
Copy link
Collaborator Author

Looks great!

I think you also need to modify CRATES_REPOSITORY_ENVIRON in crate_universe/private/generate_utils.bzl to be sensitive to this env var, because otherwise your "should this be quiet or not" will not be re-evaluated if you change this env var.

Done!

@UebelAndre UebelAndre enabled auto-merge (squash) October 30, 2023 18:18
@UebelAndre UebelAndre merged commit bbd207b into bazelbuild:main Oct 30, 2023
3 checks passed
@UebelAndre UebelAndre deleted the crate_universe_test branch October 30, 2023 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants