cargo_build_script now only prints warnings to stderr. (#548)

## 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](https://github.com/bazelbuild/rules_rust/files/5777780/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:
```output
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:

```output
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](https://github.com/bazelbuild/rules_rust/files/5777782/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`.
3 files changed
tree: 921249494490e6ed6661d473af11b073b7c4dd22
  1. .bazelci/
  2. bindgen/
  3. cargo/
  4. docs/
  5. examples/
  6. proto/
  7. rust/
  8. test/
  9. tools/
  10. util/
  11. wasm_bindgen/
  12. .bazelignore
  13. .gitignore
  14. AUTHORS
  15. BUILD
  16. CODEOWNERS
  17. CONTRIBUTING.md
  18. CONTRIBUTORS
  19. LICENSE.txt
  20. README.md
  21. WORKSPACE
  22. workspace.bzl
README.md

Rust Rules

  • Postsubmit Build status
  • Postsubmit + Current Bazel Incompatible Flags Build status

Overview

This repository provides rules for building Rust projects with Bazel.

Please refer to the full documentation.