Update Bazel build rules

Update package metadata in Cargo.toml so that compile_data attributes
are generated for those packages to compile under Bazel.

Add rustc flags to BUILD file targets to ignore the false positive lint
on rental_impl.

Update WORKSPACE.bazel to use dependency helper macro from rules_cros.

BUG=None
TEST=None

Change-Id: I50267f7260d33acd16c8885dc301905f9b7b276f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/build/drydock/+/3408365
Reviewed-by: Sloan Johnson <sloanjohnson@google.com>
Tested-by: Chris McDonald <cjmcdonald@chromium.org>
4 files changed
tree: af9015115ee90f673c99a7e83375690d8f4315d7
  1. cargo/
  2. resources/
  3. src/
  4. tests/
  5. .gitignore
  6. BUILD.bazel
  7. Cargo.toml
  8. DIR_METADATA
  9. LICENSE
  10. OWNERS
  11. README.md
  12. WORKSPACE.bazel
README.md

drydock

drydock is a tool for querying Portage profiles and producing useful diagnostic output. drydock aims to demystify Portage configuration for users by providing fast queries of configuration values and detailed explanations of where those values came from.

drydock aims to not only answer what a value set to, but where and how that is value defined.

Currently, drydock does not interact with ebuilds at all and cannot evaluate package dependencies.

Commands

Run drydock --help to see a list of all commands.

eval

Print the value of a variable as it would be seen by Portage. Example:

drydock eval USE --profile grunt:base

blame

Show the value of a variable annotated with details of where the contents of that variable are set throughout the profile hierarchy. Running the following example:

drydock blame BOARD_COMPILER_FLAGS --profile octopus:base

will output something similar to:

-march=goldmont
^______________^ chipset-glk/profiles/base/make.defaults:L14

Indicating the value of the BOARD_COMPILER_FLAGS variable and where that value was set. In this case, line 14 of the make.defaults file in the base profile of the chipset-glk overlay. (The exact value may have changed since this README was written.)

parents

Print a graphviz representation or text tree of a profile's inheritance tree. Example:

drydock parents --graph samus:base

Options and Settings

Get started with drydock --help to see a list of commands. If you're a Chrome OS developer you probably want to start with drydock config --default to generate a default configuration file.

By default drydock tries to read from a configuration file under $XDG_CONFIG_HOME or ~/.config/drydock, but the config file path can be specified with the --config-file argument. All drydock settings can be specified as command-line arguments in addition to the configuration file, check drydock --help or drydock <subcmd> --help for more details.

Building & Installing

drydock requires a stable Rust toolchain, best obtained via https://rustup.rs/

Installing

You can install drydock via cargo by running

cargo install --path ${DRYDOCK_CHECKOUT_DIR?}

Building

drydock can be built by running

cargo build --release

while in the project directory. The output binary can then be found at target/release/drydock and can be moved to the location of your choosing.

Running without installing

drydock can also be compiled and run directly from the project directory via

cargo run --release -- ${YOUR_ARGS?}

Building with Bazel

drydock fully supports being built via Bazel.

To run drydock's test suite via Bazel, run bazel test :all from your drydock checkout.

To build an optimized version of the drydock binary suitable for installation, run bazel build :drydock -c opt from within your drydock checkout. The binary can then be found at bazel-bin/drydock.