Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass -fapplication_extension to modules #321

Open
keith opened this issue Jan 31, 2019 · 2 comments
Open

Pass -fapplication_extension to modules #321

keith opened this issue Jan 31, 2019 · 2 comments
Labels
P3 Would be nice, but probably next quarter at the earliest type: bug Something isn't working

Comments

@keith
Copy link
Member

keith commented Jan 31, 2019

Currently when you build for an application extension rules_apple (or rules_swift) don't pass -fapplication_extension or -application_extension to the compiler. This is passed to the linker to create the final application extension binary but I assume based on the ld manpage that this just validates dynamic libraries being used, and not the limited API set (for example some API from UIKit are valid, but some like UIApplication are not).

In the case of shared transitive dependencies between applications and their extensions, Xcode always passes these arguments and uses the same build artifact for both final binaries. I think that case is ideal (as opposed to building them twice similar to #319).

@thomasvl
Copy link
Member

Yea, on the linker side it just sets a flag, the compiler needs the flag to change the warnings/error during compilation.

We've had some discussions internally about this and the problem is avoiding the double build; so it currently isn't passed.

Slight aside - Xcode doesn't always use the same artifacts, it all depends on how you set thing up. If you put sources/dependencies directly into your extension and app targets, they are compiled twice with the differing flags. When you use a framework and mark it for extension safe, then it can generate the warnings/errors and both the app and extension(s) can link against the framework with the App being able to call apis tagged as not extension safe while the extension can't call those apis.

@keith
Copy link
Member Author

keith commented Jan 31, 2019

Ah yea, to clarify I meant that we would have a shared module, not just shared sources, so the module could be compiled once.

@sergiocampama sergiocampama added P3 Would be nice, but probably next quarter at the earliest type: bug Something isn't working labels Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Would be nice, but probably next quarter at the earliest type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants