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

cargo_build_script now only prints warnings to stderr. #548

Merged
merged 3 commits into from
Jan 18, 2021
Merged

cargo_build_script now only prints warnings to stderr. #548

merged 3 commits into from
Jan 18, 2021

Conversation

UebelAndre
Copy link
Collaborator

@UebelAndre UebelAndre commented Jan 6, 2021

Overview

This prevents noisy output from cargo_build_script from being printed to the terminal, instead two log files are generated (stdout, stderr) which contain the raw output of the underlying build.rs script

Details

Currently users see something similar to the following output when they use cargo_build_script:

(note, uplaoded as a file because there's a lot of output)
big_output.log

In general, this masks important information in a sea of arbitrary log lines. The changes in this PR update the output to:

INFO: From CargoBuildScriptRun external/cargo_raze__libssh2_sys__0_2_20/libssh2_sys_build_script.out_dir:
Build Script Warning: libssh2/src/bcrypt_pbkdf.c:84:46: warning: expression does not compute the number of elements in this array; element type is 'uint32_t' (aka 'unsigned int'), not 'uint64_t' (aka 'unsigned long long') [-Wsizeof-array-div]
Build Script Warning:         blf_enc(&state, cdata, sizeof(cdata) / sizeof(uint64_t));
Build Script Warning:                                       ~~~~~  ^
Build Script Warning: libssh2/src/bcrypt_pbkdf.c:65:14: note: array 'cdata' declared here
Build Script Warning:     uint32_t cdata[BCRYPT_BLOCKS];
Build Script Warning:              ^
Build Script Warning: libssh2/src/bcrypt_pbkdf.c:84:46: note: place parentheses around the 'sizeof(uint64_t)' expression to silence this warning
Build Script Warning:         blf_enc(&state, cdata, sizeof(cdata) / sizeof(uint64_t));
Build Script Warning:                                              ^
Build Script Warning: 1 warning generated.

And log files are generated for the raw stderr and stdout from the build script, ie:

bazel-out/darwin-fastbuild/bin/external/cargo_raze__libssh2_sys__0_2_20/libssh2_sys_build_script.stderr.log
bazel-out/darwin-fastbuild/bin/external/cargo_raze__libssh2_sys__0_2_20/libssh2_sys_build_script.stdout.log

(note, uplaoded as a file because there's a lot of output)
libssh2_sys_build_script.stderr.log

Additionally, the deps attribute of cargo_build_script now only accepts targets that return the DepInfo provider. All other dependencies should be passed via data.

@google-cla google-cla bot added the cla: yes label Jan 6, 2021
@UebelAndre
Copy link
Collaborator Author

@damienmg @illicitonion hey, do either of you have bandwidth for a review here? 🙏

cargo/cargo_build_script.bzl Show resolved Hide resolved
@damienmg damienmg merged commit 8c388e1 into bazelbuild:master Jan 18, 2021
@UebelAndre UebelAndre deleted the build_rs branch January 18, 2021 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants