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

ibazel ought to use CQuery instead of regular query #594

Closed
jakeleventhal opened this issue Mar 28, 2023 · 7 comments
Closed

ibazel ought to use CQuery instead of regular query #594

jakeleventhal opened this issue Mar 28, 2023 · 7 comments

Comments

@jakeleventhal
Copy link
Contributor

Describe the bug
Running bazel build <target> then bazel query <target> invalidates the cache sometimes because bazel query doesn't consider select statements.

Reproduction instructions
Any repo with a target with select statements. Run the above commands and see the cache is invalidated.

Expected behavior
The cache should not be invalidated. This leads to really long boot up times.

Version (please complete the following information):

  • OS: MacOS 13.3
  • Browser: N/A
  • ibazel Version: v0.16.2
  • Bazel version: 6.1.0
@csmulhern
Copy link

csmulhern commented Apr 4, 2023

I believe ac2ce9f might have broken something with ibazel. I'm seeing this error when running ibazel:

ERROR: Error doing post analysis query: Evaluation failed: buildfiles() doesn't make sense for the configured target graph
INFO: Elapsed time: 0.102s, Critical Path: 0.00s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
iBazel [9:14AM]: Bazel cquery failed: exit status 1
iBazel [9:14AM]: Error querying for source files: exit status 1

I believe this means that ibazel will not reload if there are changes to BUILD / bzl files that affect the watched target. I believe the issue is that buildfiles only works with query, not cquery.

The fix is to have this query still use query, rather than cquery:

i.watchFiles(fmt.Sprintf(buildQuery, joinedTargets), i.buildFileWatcher)

@loeffel-io
Copy link

same here!

@purkhusid
Copy link

Same error here. Any chance we could rollback the change @achew22 ?

@achew22
Copy link
Member

achew22 commented Apr 18, 2023

Yeah, let's roll it back

@achew22
Copy link
Member

achew22 commented Apr 18, 2023

Looks like there may be more complexity here than initially thought. Rolling back to restore functionality. Thanks for the reporting everyone!

@jakeleventhal
Copy link
Contributor Author

This issue should be reopened. The cache invalidation issue still exists

@achew22 achew22 reopened this Apr 19, 2023
@github-actions
Copy link

Stale issue message

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2023
tobiaskohlbau added a commit to tobiaskohlbau/bazel-watcher that referenced this issue Oct 24, 2024
This takes antoher stub at bazelbuild#594 by introducing cquery back in. In
difference to the previous attempt this splits up the resolving of
buildfiles. CQuery does not support buildfiles but without cquery
bazel-watcher could watch files which are not reflected in the build
for e.g. dependencies behind a select statement. In order to avoid
depending on such cases first a cquery is issued which resolves
dependencies of selected targets. These dependencies are then injected
into the buildfiles query in order to get dependent build files.

Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
tobiaskohlbau added a commit to tobiaskohlbau/bazel-watcher that referenced this issue Oct 24, 2024
This takes antoher stub at bazelbuild#594 by introducing cquery back in. In
difference to the previous attempt this splits up the resolving of
buildfiles. CQuery does not support buildfiles but without cquery
bazel-watcher could watch files which are not reflected in the build
for e.g. dependencies behind a select statement. In order to avoid
depending on such cases first a cquery is issued which resolves
dependencies of selected targets. These dependencies are then injected
into the buildfiles query in order to get dependent build files.

Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
tobiaskohlbau added a commit to tobiaskohlbau/bazel-watcher that referenced this issue Oct 24, 2024
This takes antoher stub at bazelbuild#594 by introducing cquery back in. In
difference to the previous attempt this splits up the resolving of
buildfiles. CQuery does not support buildfiles but without cquery
bazel-watcher could watch files which are not reflected in the build
for e.g. dependencies behind a select statement. In order to avoid
depending on such cases first a cquery is issued which resolves
dependencies of selected targets. These dependencies are then injected
into the buildfiles query in order to get dependent build files.

Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
tobiaskohlbau added a commit to tobiaskohlbau/bazel-watcher that referenced this issue Oct 24, 2024
This takes antoher stub at bazelbuild#594 by introducing cquery back in. In
difference to the previous attempt this splits up the resolving of
buildfiles. CQuery does not support buildfiles but without cquery
bazel-watcher could watch files which are not reflected in the build
for e.g. dependencies behind a select statement. In order to avoid
depending on such cases first a cquery is issued which resolves
dependencies of selected targets. These dependencies are then injected
into the buildfiles query in order to get dependent build files.

Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
tobiaskohlbau added a commit to tobiaskohlbau/bazel-watcher that referenced this issue Oct 24, 2024
This takes antoher stub at bazelbuild#594 by introducing cquery back in. In
difference to the previous attempt this splits up the resolving of
buildfiles. CQuery does not support buildfiles but without cquery
bazel-watcher could watch files which are not reflected in the build
for e.g. dependencies behind a select statement. In order to avoid
depending on such cases first a cquery is issued which resolves
dependencies of selected targets. These dependencies are then injected
into the buildfiles query in order to get dependent build files.

Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
tobiaskohlbau added a commit to tobiaskohlbau/bazel-watcher that referenced this issue Oct 25, 2024
This takes antoher stub at bazelbuild#594 by introducing cquery back in. In
difference to the previous attempt this splits up the resolving of
buildfiles. CQuery does not support buildfiles but without cquery
bazel-watcher could watch files which are not reflected in the build
for e.g. dependencies behind a select statement. In order to avoid
depending on such cases first a cquery is issued which resolves
dependencies of selected targets. These dependencies are then injected
into the buildfiles query in order to get dependent build files.

Signed-off-by: Tobias Kohlbau <tobias@kohlbau.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants