Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --includTargetType and --targetType options #194

Merged
merged 2 commits into from
Oct 9, 2023

Conversation

bz-canva
Copy link
Contributor

I'm aware that it's recommended to consume the generated impacted target list with bazel query, as suggested in #173 and #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
Copy link

CLAassistant commented Sep 29, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@tinder-maxwellelliott tinder-maxwellelliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this!

@@ -38,6 +38,13 @@ class GetImpactedTargetsCommand : Callable<Int> {
)
lateinit var finalHashesJSONPath: File

@CommandLine.Option(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be an array? You could desire to filter out for multiple types of target. Maybe this could also be backed by an enumeration to display the allowed values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I have changed it to a Set to support multiple values. However, I was hesitant to change it to enum because in case of new types are added in the future, I expect the current code still work without need to add new values to the enum.

@tinder-maxwellelliott
Copy link
Collaborator

Thanks!

@tinder-maxwellelliott tinder-maxwellelliott merged commit 0a60a58 into Tinder:master Oct 9, 2023
9 checks passed
@bz-canva
Copy link
Contributor Author

bz-canva commented Oct 9, 2023

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

@tinder-maxwellelliott
Copy link
Collaborator

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

Done

@bz-canva
Copy link
Contributor Author

Thank you sooooo much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants