Bug: Indexing fails when using VFS overlays
Description
We recently updated rules_xcodeproj from 1.5.1 to 1.8.1 and started seeing errors in Xcode's background indexer.
The Index Build tasks are ok, but the background indexer (the one when you open/edit files) is failing to find other modules.
We don't use rules_ios, just rules_apple and rules_swift.
I did manage to set up a repro here.
Reproduction steps
Please clone https://github.com/andre-alves/xcodeproj_indexing_error_repro and do these steps:
bazelisk run //BazelSample:BazelSampleXcodeProj
open BazelSample/BazelSample.xcodeproj
Do nothing, just wait for all Index Build tasks to finish.
When BazelSample is Ready, open DrinkDiscoveryInteractor.swift
Check the background indexing logs.
Tested with Xcode 14.3.1 and 14.1
Expected behavior
Expected no error logs in Xcode's background indexer.
rules_xcodeproj version
1.8.1
Xcode version
14.3.1
Bazel version
6.2.1
rules_apple version
2.5.0
rules_swift version
1.9.1
Additional information
No response
This is probably caused by #2016 and fixed by something like #2264. Does waiting for Index Build to be finished, closing Xcode, and opening it again fix it?
Does waiting for Index Build to be finished, closing Xcode, and opening it again fix it?
Unfortunately not, it's always failing.
It seems that the error started in 1.7.0 because 1.6.0 works fine in the repro.
You closed Xcode, not just the project, right?
If so, it would be helpful to get a repro of this. There seems to be a hard to repro bug related to this that I'm having a hard time tracking down personally.
Ahh, I now see the repo link. I'll dig in. Thanks!
Humm, just removed this line from the .bazelrc and the problem no longer happens:
build --features="swift.vfsoverlay"
Seems to be related to the vfsoverlay. The background indexer is working fine now.
You closed Xcode, not just the project, right?
Yep, everything.
Ahh... that's a know issue. Also this: #2348. I have an idea on how to fix that, but it's ugly.
Will probably add build:rules_xcodeproj --features="-swift.vfsoverlay" to workaround this issue :+1:
--- edit Sorry, I miss clicked and closed the issue xD.