-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This rule dynamically looks up crate dependencies as a repository rule. See #2 for context.
- Loading branch information
1 parent
fee3b3c
commit 3a00856
Showing
50 changed files
with
9,534 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Contributing | ||
|
||
## Tour of the codebase | ||
|
||
We start at `workspace.bzl`, which invokes the resolver. | ||
|
||
The resolver: | ||
* `config.rs`: Deserializes the Config | ||
* `parser.rs`: Parses the Config, any `Cargo.toml` files, and any additional packages, into a single unified `Cargo.toml` file | ||
* `resolver.rs`: Resolves all of the crates. | ||
* `consolidator.rs`: Patches in any WORKSPACE-specified overrides, and deals with platform-specific concerns. | ||
* `renderer.rs`: Generates BUILD files for each crate, as well as functions that can be called from BUILD files. | ||
|
||
The code started off as a very hacky Week of Code project, and there are some clear remnants of that in the codebase - nothing is sacred, feel free to improve anything! | ||
|
||
Some areas have unit testing, there are a few (very brittle) integration tests, and some examples. | ||
|
||
## How to test local changes | ||
|
||
To use a local version, first build it: | ||
```console | ||
resolver $ cargo build | ||
``` | ||
|
||
Then run a bazel build with this environment variable: | ||
```console | ||
RULES_RUST_RESOLVER_URL_OVERRIDE=file:///path/to/resolver/target/debug/resolver bazel build //whatever | ||
``` | ||
|
||
To get verbose logging, edit `workspace.bzl` to set `RUST_LOG` to `debug` or `trace` instead of `info`. In particular, that will print out the generated Cargo.toml, and the path to the generated workspace file. | ||
|
||
Note that you may need to `bazel shutdown` between bazel commands. Hopefully not, but if you're seeing stale results, try it out. This only affects local development. | ||
|
||
## Testing | ||
|
||
To test with the `resolver` built from source: | ||
|
||
```bash | ||
bin/test | ||
``` |
Oops, something went wrong.