@@ -19,6 +19,13 @@ Track the feature request for target diffing in Bazel [here](https://github.com/
19
19
20
20
This approach was inspired by the [ following BazelConf talk] ( https://www.youtube.com/watch?v=9Dk7mtIm7_A ) by Benjamin Peterson.
21
21
22
+ > There are simpler and faster ways to approximate the affected set of targets.
23
+ > However an incorrect solution can result in a system you can't trust,
24
+ > because tests could be broken at a commit where you didn't select to run them.
25
+ > Then you can't rely on green-to-red (or red-to-green) transitions and
26
+ > lose much of the value from your CI system as breakages can be discovered
27
+ > later on unrelated commits.
28
+
22
29
## Prerequisites
23
30
24
31
* Git
@@ -156,16 +163,43 @@ workspace.
156
163
157
164
## Installing
158
165
159
- ### Run from Source
166
+ ### Integrate into your project (recommended)
160
167
161
- After cloning down the repo, you are good to go, Bazel will handle the rest
168
+ Add to your ` WORKSPACE ` file:
162
169
163
- To run the project
170
+ ``` bazel
171
+ load(" @bazel_tools//tools/build_defs/repo:http.bzl" , " http_jar" )
172
+
173
+ http_jar(
174
+ name = " bazel_diff" ,
175
+ urls = [
176
+ " https://github.com/Tinder/bazel-diff/releases/download/2.0.0/bazel-diff_deploy.jar" ,
177
+ ],
178
+ sha256 = " c16296d2c770365a410253c8f6dc88061f412ca94cc1cbe4328705e4eed50378" ,
179
+ )
180
+ ```
181
+
182
+ and then in your root ` BUILD.bazel ` file:
183
+
184
+ ``` bazel
185
+ load(" @rules_java//java:defs.bzl" , " java_binary" )
186
+
187
+ java_binary(
188
+ name = " bazel-diff" ,
189
+ main_class = " com.bazel_diff.BazelDiff" ,
190
+ runtime_deps = [" @bazel_diff//jar" ],
191
+ )
192
+ ```
193
+
194
+ now run the tool with
164
195
165
196
``` terminal
166
- bazel run :bazel-diff -- bazel-diff -h
197
+ bazel run // :bazel-diff
167
198
```
168
199
200
+
201
+ > Note, in releases prior to 2.0.0 the value for the ` main_class ` attribute is just ` BazelDiff `
202
+
169
203
#### Debugging
170
204
171
205
To run ` bazel-diff ` with debug logging, run your commands with the ` verbose ` config like so:
@@ -181,14 +215,24 @@ curl -LO bazel-diff.jar GITHUB_RELEASE_JAR_URL
181
215
java -jar bazel-diff.jar -h
182
216
```
183
217
218
+ ### Build from Source
219
+
220
+ After cloning down the repo, you are good to go, Bazel will handle the rest
221
+
222
+ To run the project
223
+
224
+ ``` terminal
225
+ bazel run :bazel-diff -- bazel-diff -h
226
+ ```
227
+
184
228
### Build your own deployable JAR
185
229
186
230
``` terminal
187
231
bazel build //src/main/java/com/bazel_diff:bazel-diff_deploy.jar
188
232
java -jar bazel-bin/src/main/java/com/bazel_diff/bazel-diff_deploy.jar # This JAR can be run anywhere
189
233
```
190
234
191
- ### Integrate directly into your Bazel Project
235
+ ### Build from sources in your Bazel Project
192
236
193
237
Add the following to your ` WORKSPACE ` file to add the external repositories, replacing the ` RELEASE_ARCHIVE_URL ` with the archive url of the bazel-diff release you wish to depend on:
194
238
0 commit comments