rules_swift icon indicating copy to clipboard operation
rules_swift copied to clipboard

Ensure quote_includes are set for swift_library's CcInfo

Open steeve opened this issue 3 years ago • 3 comments

This mimics the behavior of cc_library.

When consuming CcInfo from a swift_library, if the library is in an external repo, the quote_includes paths are not set. In the case of a cc_library, both the workspace root and the bindir + workspace_root are set.

If the workspace_root isn't set (in case of a non external repo), include the current sandbox's path ..

steeve avatar Nov 15 '21 08:11 steeve

I think cc_library (and objc_library)'s behavior was a regression since Bazel 3.0, since it adds all external dependencies' workspace paths into includes even though not all of them are required. This can slow down the build a lot of you have a lot of external repositories. I thought I've filed a bug for it before but couldn't find it now, but I still have a reproduce example:

https://github.com/thii/objc-external-repos-quote-includes/blob/9a9545eaf6da650c6e46d82d2bc986e3e329298f/objc.diff

thii avatar Nov 15 '21 08:11 thii

Is it a regression though? It makes sense to do this since, if not, include paths will be different wether the code is compiled from the main workspace or via an external one. It would also need to be included as external/repo1/path/to/the/pkg/include.h.

(great repro, btw!)

steeve avatar Nov 15 '21 13:11 steeve

Why I think it was a regression is because the change degrades the build times (but that was a very long time ago and I don't remember the details now).

Is this something you can't do in your target declarations?

thii avatar Dec 15 '21 01:12 thii