tl;dr the project has several dozen targets depending on a macro, and Xcode spends a lot of time indexing SwiftParser, SwiftDiagnostics, SwiftOperators. It does this for every target which adds up to hours.
I suspect the issue is caused by macros, so I'd like to try to expand all macros, replace them with the generated code, remove the dependency, and see if this fixes the issue. Doing this manually will probably take days (there are around 250 instances in the project), so I was wondering if there's a way to automate this. I know there's -Xfrontend -dump-macro-expansions but afaik I will still need to copy and paste the expanded code manually.
I also thought about checking out a version of the project prior to macro adoption, but it will require Xcode 15 which may not have this issue.
That is unexpected. Since this sounds like an Xcode issue, could you file a feedback at https://feedbackassistant.apple.com and attach /tmp/indexbuild.txt after running xcindex-test as follows:
Thanks for the suggestion! I filed a feedback, here's the ID: FB16035141
I saw a bunch of errors in the log even though the target builds successfully in Xcode. Also, the command finished in ~3 minutes (which seems normal), while Xcode took ~3 hours to index the project, so I'm not sure I did everything correctly.
I haven't figured out how to automate the expansion of macros but replacing the swift-syntax dependency in the macro package with GitHub - sjavora/swift-syntax-xcframeworks worked like a charm. Indexing time is down to just a couple of minutes, and my Xcode is no longer crippled, search, refactoring, etc. work again.