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

Command hangs on bazel query #252

Closed
antspy opened this issue Oct 30, 2024 · 2 comments
Closed

Command hangs on bazel query #252

antspy opened this issue Oct 30, 2024 · 2 comments

Comments

@antspy
Copy link

antspy commented Oct 30, 2024

Hi,

The lib looks really cool, thanks for sharing! But I am having trouble getting this to work - it seems like it hangs forever whatever I do :)

I downloaded the java binary and I am running it as so:
java -jar bazel-diff.jar generate-hashes -v --excludeExternalTargets --includeTargetType -co --noimplicit_deps -w /workspaces/myrepo -m tmp.txt

Thanks to -v, I see the output:

[Info] Executing Query: '//...:all-targets'
[Info] Command: bazel, query, --output, streamed_proto, --order_output=no, --keep_going, --noimplicit_deps, --query_file, /tmp/8186454315808972442.txt

This hangs forever. I see that it's trying to query all targets, which is slow, but not that slow, especially as I pass the noimplicit_deps flag. In fact, if I run it myself:
bazel query //...:all-targets --noimplicit_deps
it takes around 10 seconds.

I have tried many things:

  1. Adding or removing the --excludeExternalTargets and --includeTargetType options make no difference. The output is the same, it says [Info] Executing Query: '//...:all-targets' and hangs forever.
  2. Adding or removing the modified filepaths option: -m makes no difference. The output is the same, it says [Info] Executing Query: '//...:all-targets' and hangs forever.
  3. I am trying to find a way to build all targets within a directory (equivalent to bazel query //src/...:all-targets --noimplicit_deps) but I don't seem to find an option to make this happen.
  4. Alternatively, would be nice to be able remove some directories from consideration (e.g. //node_modules). I am not sure how the code recognizes 'external targets', and I don't get how to modify it.

Would really appreciate any help here! I would love to be able to use this :)

@antspy antspy changed the title Command hands on bazel query Command hangs on bazel query Oct 30, 2024
@tinder-maxwellelliott
Copy link
Collaborator

Can you test with this change and see if it unblocks you? #246

@antspy
Copy link
Author

antspy commented Nov 2, 2024

I was using the 8.1.1 release, so the fix was already being used.

Turns out if I use bazel run //:bazel-diff -- generate-hashes ... it works as expected. If I try to instead use the script:

bazel run //:bazel-diff --script_path=${path}
${path} generate-hashes ...

then it hangs forever! No idea why - but I just switched to using bazel run directly.
Thank you! :)

@antspy antspy closed this as completed Nov 2, 2024
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

No branches or pull requests

2 participants