tulsi icon indicating copy to clipboard operation
tulsi copied to clipboard

Tulsi doesn't expand location templates currently supported by Bazel

Open ravimandala opened this issue 7 years ago • 6 comments

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...

  1. Inability to jump to the definition on certain symbols.
  2. Not able to see proper method prototypes in auto-complete pop-up and finding <<error type>> instead.
  3. 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...

  1. Is this a known issue? If yes, is someone working on this? (I want to collaborate instead of duplicating the effort).
  2. Does expanding location in tulsi_aspects.bzl sound like an appropriate fix here?

Any other thoughts or questions or concerns?

\cc @DavidGoldman @reinhillmann @dierksen

ravimandala avatar Jan 16 '19 22:01 ravimandala

  1. Not a known issue AFAIK.
  2. Expanding location in the aspect is probably a reasonable way to handle that.

dierksen avatar Jan 16 '19 23:01 dierksen

I tried using ctx.expand_location() from an aspect but got hit with https://github.com/bazelbuild/bazel/issues/7083

ob avatar Jan 16 '19 23:01 ob

Any idea what ctx.expand_location() is doing that improves indexing and auto-completion? Could Tulsi be modified to expand the location instead?

DavidGoldman avatar Jan 25 '19 18:01 DavidGoldman

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.

ob avatar Jan 28 '19 17:01 ob

@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.

ravimandala avatar Jan 29 '19 18:01 ravimandala

Can you provide an example that we could add for an integration test?

dierksen avatar Feb 06 '19 23:02 dierksen

Thanks for submitting this issue but this tool is being deprecated. Please checkout rules_xcodeproj for a more complete and maintained Xcode integration.

keith avatar Feb 15 '23 17:02 keith