Bazel build rules

* Dependency build rules generated by running `cargo-raze` in the project root
* Fixed up test resource path detection to work with Bazel & Cargo both

BUG=None
TEST=`cargo test`
TEST=`bazel test :all`

Change-Id: Ie0840f0247c0b87b73bac496d0d412ebc96850d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/build/drydock/+/2906119
Tested-by: Chris McDonald <cjmcdonald@chromium.org>
Reviewed-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
117 files changed
tree: e39740fa6fabd6a74e71a996e52abbe7607528ce
  1. cargo/
  2. resources/
  3. src/
  4. tests/
  5. .gitignore
  6. BUILD.bazel
  7. Cargo.toml
  8. LICENSE
  9. OWNERS
  10. README.md
  11. 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.