Skip to content

Commit 73770dd

Browse files
Merge branch 'master' into newline
2 parents e68c296 + c7f4f9c commit 73770dd

File tree

12 files changed

+1107
-59
lines changed

12 files changed

+1107
-59
lines changed

.bazelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
run --show_loading_progress=false --show_progress=false --ui_event_filters='ERROR'
1+
run -c opt --show_loading_progress=false --show_progress=false --ui_event_filters='ERROR'
2+
run:verbose -c dbg --show_loading_progress=true --show_progress=true --ui_event_filters='INFO,ERROR,DEBUG'

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ Open `bazel-diff-example.sh` to see how this is implemented. This is purely an e
6666
`bazel-diff` Command
6767

6868
```terminal
69-
Usage: bazel-diff [-htV] -b=<bazelPath> [-co=<bazelCommandOptions>]
70-
[-fh=<finalHashesJSONPath>] [-o=<outputPath>]
71-
[-sh=<startingHashesJSONPath>] [-so=<bazelStartupOptions>]
72-
-w=<workspacePath> [COMMAND]
69+
Usage: bazel-diff [-hV] [-aq=<avoidQuery>] -b=<bazelPath>
70+
[-co=<bazelCommandOptions>] [-fh=<finalHashesJSONPath>]
71+
[-o=<outputPath>] [-sh=<startingHashesJSONPath>]
72+
[-so=<bazelStartupOptions>] -w=<workspacePath> [COMMAND]
7373
Writes to a file the impacted targets between two Bazel graph JSON files
7474
-aq, --avoid-query=<avoidQuery>
7575
A Bazel query string, any targets that pass this query will
@@ -166,6 +166,14 @@ To run the project
166166
bazel run :bazel-diff -- bazel-diff -h
167167
```
168168

169+
#### Debugging
170+
171+
To run `bazel-diff` with debug logging, run your commands with the `verbose` config like so:
172+
173+
```terminal
174+
bazel run :bazel-diff --config=verbose -- bazel-diff -h
175+
```
176+
169177
### Run Via JAR Release
170178

171179
```terminal

bazel-diff-example.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ final_hashes_json="/tmp/final_hashes.json"
1515
impacted_targets_path="/tmp/impacted_targets.txt"
1616
impacted_test_targets_path="/tmp/impacted_test_targets.txt"
1717

18-
$bazel_path run :bazel-diff -- modified-filepaths $previous_revision $final_revision -w $workspace_path -b $bazel_path $modified_filepaths_output
18+
shared_flags=""
19+
20+
# Uncomment the line below to see debug information
21+
# shared_flags="--config=verbose"
22+
23+
$bazel_path run :bazel-diff $shared_flags -- modified-filepaths $previous_revision $final_revision -w $workspace_path -b $bazel_path $modified_filepaths_output
1924

2025
IFS=$'\n' read -d '' -r -a modified_filepaths < $modified_filepaths_output
2126
formatted_filepaths=$(IFS=$'\n'; echo "${modified_filepaths[*]}")
@@ -26,18 +31,18 @@ echo ""
2631
git -C $workspace_path checkout $previous_revision --quiet
2732

2833
echo "Generating Hashes for Revision '$previous_revision'"
29-
$bazel_path run :bazel-diff -- generate-hashes -w $workspace_path -b $bazel_path $starting_hashes_json
34+
$bazel_path run :bazel-diff $shared_flags -- generate-hashes -w $workspace_path -b $bazel_path $starting_hashes_json
3035

3136
git -C $workspace_path checkout - --quiet
3237

3338
echo "Generating Hashes for Revision '$final_revision'"
34-
$bazel_path run :bazel-diff -- generate-hashes -w $workspace_path -b $bazel_path -m $modified_filepaths_output $final_hashes_json
39+
$bazel_path run :bazel-diff $shared_flags -- generate-hashes -w $workspace_path -b $bazel_path -m $modified_filepaths_output $final_hashes_json
3540

3641
echo "Determining Impacted Targets"
37-
$bazel_path run :bazel-diff -- -sh $starting_hashes_json -fh $final_hashes_json -w $workspace_path -b $bazel_path -o $impacted_targets_path
42+
$bazel_path run :bazel-diff $shared_flags -- -sh $starting_hashes_json -fh $final_hashes_json -w $workspace_path -b $bazel_path -o $impacted_targets_path
3843

3944
echo "Determining Impacted Test Targets"
40-
$bazel_path run :bazel-diff -- -sh $starting_hashes_json -fh $final_hashes_json -w $workspace_path -b $bazel_path -o $impacted_test_targets_path -t
45+
$bazel_path run :bazel-diff $shared_flags -- -sh $starting_hashes_json -fh $final_hashes_json -w $workspace_path -b $bazel_path -o $impacted_test_targets_path --avoid-query "//... except tests(//...)"
4146

4247
IFS=$'\n' read -d '' -r -a impacted_targets < $impacted_targets_path
4348
formatted_impacted_targets=$(IFS=$'\n'; echo "${impacted_targets[*]}")

integration/integration_test.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ bazel_path=$(which bazelisk)
55

66
previous_revision="HEAD^"
77
final_revision="HEAD"
8-
output_dir=$(mktemp -d)
9-
modified_filepaths_output="$PWD/integration/modified_filepaths.txt"
8+
output_dir="/tmp"
9+
modified_filepaths_output="$workspace_path/modified_filepaths.txt"
1010
starting_hashes_json="$output_dir/starting_hashes.json"
1111
final_hashes_json="$output_dir/final_hashes_json.json"
1212
impacted_targets_path="$output_dir/impacted_targets.txt"
13+
shared_flags="--config=verbose"
1314

1415
export USE_BAZEL_VERSION=last_downstream_green
1516

@@ -20,13 +21,13 @@ containsElement () {
2021
return 1
2122
}
2223

23-
$bazel_path run :bazel-diff -- generate-hashes -w $workspace_path -b $bazel_path $starting_hashes_json
24+
$bazel_path run :bazel-diff $shared_flags -- generate-hashes -w $workspace_path -b $bazel_path $starting_hashes_json
2425

25-
$bazel_path run :bazel-diff -- generate-hashes -w $workspace_path -b $bazel_path -m $modified_filepaths_output $final_hashes_json
26+
$bazel_path run :bazel-diff $shared_flags -- generate-hashes -w $workspace_path -b $bazel_path -m $modified_filepaths_output $final_hashes_json
2627

2728
ruby ./integration/update_final_hashes.rb
2829

29-
$bazel_path run :bazel-diff -- -sh $starting_hashes_json -fh $final_hashes_json -w $workspace_path -b $bazel_path -o $impacted_targets_path -aq "attr('tags', 'manual', //...)"
30+
$bazel_path run :bazel-diff $shared_flags -- -sh $starting_hashes_json -fh $final_hashes_json -w $workspace_path -b $bazel_path -o $impacted_targets_path -aq "attr('tags', 'manual', //...)"
3031

3132
IFS=$'\n' read -d '' -r -a impacted_targets < $impacted_targets_path
3233
target1="//test/java/com/integration:bazel-diff-integration-test-lib"

0 commit comments

Comments
 (0)