Tulsi doesn't expand location templates currently supported by Bazel
Our Tulsi generated Xcode project has indexing and auto-complete issues. We figured that it is due to the location template that we use which is currently supported by Bazel but not recognized/supported by Tulsi. This leads to different issues in Tulsi generated Xcode project like...
- Inability to jump to the definition on certain symbols.
- Not able to see proper method prototypes in auto-complete pop-up and finding
<<error type>>instead. - Unable to build
_idx_*targets which I assume means Xcode fails to index the most basic things.
However, if location template is expanded using ctx.expand_location() in tulsi_aspects.bzl (along with a minor patch in Bazel - to skip some validations) the indexing issue and <<error type>> in auto-complete pop-up get resolved.
So, I have a few questions...
- Is this a known issue? If yes, is someone working on this? (I want to collaborate instead of duplicating the effort).
- Does expanding location in
tulsi_aspects.bzlsound like an appropriate fix here?
Any other thoughts or questions or concerns?
\cc @DavidGoldman @reinhillmann @dierksen
- Not a known issue AFAIK.
- Expanding location in the aspect is probably a reasonable way to handle that.
I tried using ctx.expand_location() from an aspect but got hit with https://github.com/bazelbuild/bazel/issues/7083
Any idea what ctx.expand_location() is doing that improves indexing and auto-completion? Could Tulsi be modified to expand the location instead?
In our case, we have some copts in the objc_library() rules that include calls to $(location). Specifically, -I$(location headermap) which the rules expand to the location of a generated header map. Without explicitly expanding calling ctx.expand_location() in the Tulsi aspect, the Xcode generated project ends up with HEADER_SEARCH_PATHS set to something like "-I$(location", "headermap)" because the code is just splitting on space. This trips up Xcode's indexing.
@DavidGoldman, we have a PR, that's coming right up, to expand location using ctx.expand_location() in tulsi_aspects.bzl so that Xcode sees expanded header map paths instead of split up opts/attrs.
Can you provide an example that we could add for an integration test?
Thanks for submitting this issue but this tool is being deprecated. Please checkout rules_xcodeproj for a more complete and maintained Xcode integration.