MobileNativeFoundation / rules_xcodeproj

Bazel rules for generating Xcode projects.
MIT License
520 stars 82 forks source link

[Incremental] Bug: Index failed: 'fatal error: virtual filesystem overlay file not found' #2852

Closed LLlkaiwen closed 8 months ago

LLlkaiwen commented 8 months ago

Description

Index failed when run examples/rules_ios in incremental mode. Howerver it works in legacy mode. Detail error shown as below: fatal error: virtual filesystem overlay file '/*/rules_xcodeproj/examples/rules_ios/bazel-output-base/rules_xcodeproj.noindex/indexbuild_output_base/execroot/_main/bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-dbg-ST-a4a9813474a3/bin/iOSApp/Test/MixedUnitTests/iOSAppMixedUnitTests_vfs.yaml' not found

Reproduction steps

  1. checkout to main branch (currently at commit 46f7a1f47c02e8bec3398913c5d018dd3cc71da5) of 'rules_xcodeproj'
  2. cd examples/rules_ios
  3. run bazel run //:xcodeproj-incremental
  4. open rules_ios.xcodeproj
  5. wait for Index

Expected behavior

Index works in incremental mode.

rules_xcodeproj version

46f7a1f47c02e8bec3398913c5d018dd3cc71da5

Xcode version

15.1

Bazel version

7.0.0

rules_apple version

No response

rules_swift version

No response

Additional information

No response

LLlkaiwen commented 8 months ago

That vfsoverlay file is produced by Bazel target defined by rule framework_vfs_overlay, which is considered as unsupported target in both incremental mode and legacy mode. And I find that CcInfo of such unsupported target is collected to inputs of XcodeProj in legacy mode while not in incremental mode

brentleyjones commented 8 months ago

Thanks for the detailed report. I'm looking into it.

brentleyjones commented 8 months ago

Which file failed to index? do you have a fuller error? I'm not able to reproduce this. I do get this error when editing SwiftUnitTests.swift:

/<unknown>: error: cannot open file '/*/rules_xcodeproj/examples/rules_ios/bazel-output-base/rules_xcodeproj.noindex/indexbuild_output_base/execroot/_main/bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-dbg-ST-a4a9813474a3/bin/iOSApp/Test/MixedUnitTests/iOSAppMixedUnitTests_swift_vfs.yaml' (No such file or directory)

But it goes away once the correct Index Build that generates that file finishes.

LLlkaiwen commented 8 months ago
image

It is file rules_xcodeproj/examples/rules_ios/iOSApp/Test/MixedUnitTests/ObjCUnitTests.m. And as shown in the above picture, there are also some other files failed due to virtual filesystem overlay file not found.

LLlkaiwen commented 8 months ago

The errors occur in process of Indexing, at which time the Index Build has already finished.

brentleyjones commented 8 months ago

Thanks! #2859 fixed that in my testing.