bazel-watcher icon indicating copy to clipboard operation
bazel-watcher copied to clipboard

ibazel --target_pattern_file=/tmp/target-file.txt fails to identify files to watch

Open samcooke98 opened this issue 3 months ago • 3 comments

Describe the bug

ibazel fails to figure out what files to watch, when using --target_pattern_file.

ibazel build --target_pattern_file=/tmp/target-file.txt will spit out errors:

> bazel query //react:build > /tmp/target-file.txt
> ibazel build --target_pattern_file=/tmp/target-file.txt
iBazel [1:21PM]: Querying for files to watch...
INFO: Invocation ID: 82c7686c-0c14-4a89-bf9a-906adfac98cd
Loading: 0 packages loaded
INFO: Empty results
iBazel [1:21PM]: Didn't find any files to watch from query buildfiles(deps(set()))
INFO: Invocation ID: 3720b271-ec5a-4ebe-ad20-e24a7be0f209
Loading: 0 packages loaded
INFO: Empty results
iBazel [1:21PM]: Didn't find any files to watch from query kind('source file', deps(set()))
iBazel [1:21PM]: Building 
INFO: Invocation ID: ca171cf4-1bd3-4345-8bd8-10a17ee744af
Analyzing: target //react:build (83 packages loaded, 15 targets configured)

Reproduction instructions

Steps to reproduce the behavior:

  1. git clone [email protected]:bazelbuild/examples.git
  2. cd examples/frontend
  3. bazel query //react-router:build > /tmp/target-file.txt
  4. cat /tmp/target-file.txt
  5. Expected to see: //react-router:build
  6. Run ibazel build --target_pattern_file=/tmp/target-file.txt
  7. Observe error above.
  8. Modify: frontend/react-router/app/entry.client.tsx
  9. ibazel doesn't re-build.

Expected behavior A clear and concise description of what you expected to happen.

I expect ibazel to be able to recognize what files it needs to watch when given a target-pattern file.

Actual behavior A clear and concise description of what really happenend instead of the expected.

ibazel fails to identify what files to load.

Version (please complete the following information):

  • OS: [e.g. iOS]:

Linux Ubuntu:

uname -a Linux main 6.8.0-1036-aws #38~22.04.1-Ubuntu SMP Fri Aug 22 15:44:33 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

  • Browser [e.g. chrome, safari] Irrelevant, but Chrome.

  • ibazel Version [e.g. 0.2.4] (run ibazel 2>&1 | head -n 1 to get this) iBazel - Version v0.26.10

  • Bazel version [e.g. 3.1.0] (run bazel version to get this. Please include all the lines) bazel 7.1.0 in the example above, bazel 7.6.1 in my real-world (closed-source) use-case.

samcooke98 avatar Sep 03 '25 03:09 samcooke98

Stale issue message

github-actions[bot] avatar Nov 03 '25 02:11 github-actions[bot]

@samcooke98, sorry to say I think this is working as expected. The flag you're interacting with is a Bazel flag, not an iBazel flag. iBazel doesn't have any code to interpret that, except that we pass it into bazel without modification. The command you invoked ibazel build --target_pattern_file=/tmp/target-file.txt doesn't have a positional parameter which it will use as the query string and thus the query that returns an empty set. If you wish to watch the files associated with a particular target, you would invoke it with ibazel build $TARGET, not with --target_pattern_file.

achew22 avatar Nov 03 '25 05:11 achew22

If you wish to watch the files associated with a particular target, you would invoke it with ibazel build $TARGET, not with --target_pattern_file.

How would one work around this if the list of targets is too large to fit on a single command line?

davo-canva avatar Nov 03 '25 06:11 davo-canva