Skip to content

Commit d20596c

Browse files
Add docs on generate hashes (#171)
Related Documentation does not say what generated hashes actually represent #166
1 parent 5398450 commit d20596c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@
77
`bazel-diff` offers several key advantages over rolling your own target diffing solution
88

99
1. `bazel-diff` is designed for very large Bazel projects. We use Java Protobuf's `parseDelimitedFrom` method alongside Bazel Query's `streamed_proto` output option. These two together allow you to parse Gigabyte or larger protobuf messages. We have tested it with projects containing tens of thousands of targets.
10-
2. We avoid usage of large command line query lists when interacting with Bazel, [issue here](https://github.com/bazelbuild/bazel/issues/8609). When you interact with Bazel with thousands of query parameters you can reach an upper maximum limit, seeing this error:
11-
12-
```terminal
13-
bash: /usr/local/bin/bazel: Argument list too long
14-
```
15-
16-
`bazel-diff` is smart enough to prevent these errors
17-
10+
2. We avoid usage of large command line query lists when interacting with Bazel, [issue here](https://github.com/bazelbuild/bazel/issues/8609). When you interact with Bazel with thousands of query parameters you can reach an upper maximum limit, seeing this error `bash: /usr/local/bin/bazel: Argument list too long`. `bazel-diff` is smart enough to avoid these errors.
1811
3. `bazel-diff` has been tested with file renames, deletions, and modifications. Works on `bzl` files, `WORKSPACE` files, `BUILD` files and regular files
1912

2013
Track the feature request for target diffing in Bazel [here](https://github.com/bazelbuild/bazel/issues/7962)
@@ -71,6 +64,7 @@ Open `bazel-diff-example.sh` to see how this is implemented. This is purely an e
7164
## CLI Interface
7265

7366
`bazel-diff` Command
67+
7468
```terminal
7569
Usage: bazel-diff [-hvV] [COMMAND]
7670
Writes to a file the impacted targets between two Bazel graph JSON files
@@ -104,7 +98,7 @@ workspace.
10498
Path to content hash json file. It's a map which maps
10599
relative file path from workspace path to its
106100
content hash. Files in this map will skip content
107-
hashing and use provided value
101+
hashing and use provided value
108102
-h, --help Show this help message and exit.
109103
-k, --[no-]keep_going This flag controls if `bazel query` will be executed
110104
with the `--keep_going` flag or not. Disabling this
@@ -124,6 +118,14 @@ workspace.
124118
Path to Bazel workspace directory.
125119
```
126120

121+
### What does the SHA256 value of `generate-hashes` represent?
122+
123+
`generate-hashes` is a canonical SHA256 value representing all attributes and inputs into a target. These inputs
124+
are the summation of the of the rule implementation hash, the SHA256 value
125+
for every attribute of the rule and then the summation of the SHA256 value for
126+
all `rule_inputs` using the same exact algorithm. For source_file inputs the
127+
content of the file are converted into a SHA256 value.
128+
127129
### `get-impacted-targets` command
128130

129131
```terminal

0 commit comments

Comments
 (0)