Tinder / bazel-diff

Performs Bazel Target Diffing between two revisions in Git, allowing for Test Target Selection and Selective Building
Other
397 stars 59 forks source link

Add `--includTargetType` and `--targetType` options #194

Closed bz-canva closed 1 year ago

bz-canva commented 1 year ago

I'm aware that it's recommended to consume the generated impacted target list with bazel query, as suggested in https://github.com/Tinder/bazel-diff/issues/173 and https://github.com/Tinder/bazel-diff/issues/151. However, our use case is that we do want to avoid the extra 30-60s spent on bazel query (we have a huge workspace).

This PR adds a --includeTargetType option to generate-hashes command, which will add "target type" to the generated JSON like this:

{
  "//cli:src/test/resources/fixture/integration-test-1.zip": "SourceFile#c259eba8539f4c14e4536c61975457c2990e090067893f4a2981e7bb5f4ef4cf",
  "//external:android_gmaven_r8": "Rule#795f583449a40814c05e1cc5d833002afed8d12bce5b835579c7f139c2462d61",
  "//cli:bazel-diff_deploy.jar": "GeneratedFile#4ae310f8ad2bc728934e3509b6102ca658e828b9cd668f79990e95c6663f9633",
  ...
}

Later, an extra --targetType=Rule can be used in get-impacted-targets command to filter out the targets with specific type.

This may be not what you like, but it does help us a lot so I'm contributing this from our fork.

The tests are updated accordingly.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

tinder-maxwellelliott commented 1 year ago

Thanks!

bz-canva commented 1 year ago

Thanks @tinder-maxwellelliott ! Do you mind releasing a new version so that we can use it directly from this repo?

tinder-maxwellelliott commented 1 year ago

Thanks @tinder-maxwellelliott ! Do you mind releasing a new version so that we can use it directly from this repo?

Done

bz-canva commented 1 year ago

Thank you sooooo much!