spotify / XCRemoteCache

Other
825 stars 50 forks source link

Xcode 14 Find Call Hierarchy always show "No Call Result for" #171

Closed xuyuheng closed 1 year ago

xuyuheng commented 1 year ago

Use -fdebug-prefix-map in Xcode project, Xcode 14 Find Call Hierarchy always show "No Call Result for".

polac24 commented 1 year ago

@xuyuheng, can you provide more details, e.g. if you also pass -debug-prefix-map or If that issue is exclusive to Xcode 14?

xuyuheng commented 1 year ago

@polac24

All case test in same target,with xcremotecache and non-xcremotecache xcodeproj in same time.

polac24 commented 1 year ago

@xuyuheng, I built a project that tries to reproduce that but it works for me (Xcode 14). Here is the sample project with a script to follow: https://github.com/polac24/XCRCReportingDemo/tree/call-usage

I recommend enabling indexing logs in Xcode and observing the process of indexing (Xcode restart required). It is possible that local indexing is still in progress:

defaults write com.apple.dt.Xcode IDEIndexerActivityShowNumericProgress -bool YES
defaults write com.apple.dt.Xcode IDEIndexShowLog -bool YES

image

xuyuheng commented 1 year ago

@polac24 sample project work for me (Xcode 14). I continue test my project, my project's xcremotecache modified, automatically change to offline mode when no artifacts available for producing xccc file.

xuyuheng commented 1 year ago

@polac24 issue can be reproduced by manual changing -fdebug-prefix-map=/private/tmp/DemoReferences=$(XCRC_FAKE_SRCROOT) to -fdebug-prefix-map=$(SRCROOT)=$(XCRC_FAKE_SRCROOT) with sample project, $(SRCROOT) is used in cocoapods-xcremotecache plugin.

polac24 commented 1 year ago

@xuyuheng, can you elaborate? The "starting" project doesn't have any -fdebug-prefix-map build settings so all -fdebug-prefix-map BuildSettings you have in a consumer mode are introduced by cocoapods-xcremotecache plugin. Why manually modify that?

xuyuheng commented 1 year ago

@polac24 my project use Pods with cocoapods-xcremotecache, i'm trying to fix "Call Hierarchy" problem. in consumer mode, after pod install, -fdebug-prefix-map will automatically add with $(SRCROOT), in this case, lead to "Call Hierarchy" issue.

xuyuheng commented 1 year ago

By the way, call-usage branch also has -fdebug-prefix-map by default.

image
polac24 commented 1 year ago

@xuyuheng, I guess you may face an issue because /tmp is not a good location to place your sample project. Technically, on macOS, /tmp is just a symbolic link to private/tmp and as written in the XCRemoteCache requirements, that is not recommended

Recommended: avoid having a symbolic link in the source root (e.g. placing a project in /tmp)

I suggest cloning the repo somewhere else and checking if you can reproduce a problem because then $(SRCROOT) should resolve to the same location as expected.

xuyuheng commented 1 year ago

@polac24 i test https://github.com/polac24/XCRCReportingDemo/tree/call-usage project again with you suggestion, and reproduce problem by removing Xcode DerivedData/DemoReferences-hhvspvruhrwwongeahnrcwnlqxjd directory before continue "2. Preparing for a consumer step....". Compare to producer mode, consumer mode missing DataStore and UniDB index directory.

image
polac24 commented 1 year ago

I looked at that again:

  1. Found that the starting project contained leftover references to /tmp. I cleaned that up here
  2. With that change, I followed your suggestion to delete the DataStore+UniDB (I nuked the entire DerivedData) and after a while, indexing works fine for me. In the consumer mode, shortly after the build (~30s) the DataStore and UniDB are correctly generated.