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

Automatically copy Swift.h header for static libraries #366

Conversation

brentleyjones
Copy link
Collaborator

Resolves #350, addressing 2.i.

SWIFT_OBJC_INTERFACE_HEADER_NAME is set by Xcode correctly depending on if you have Swift sources or not. We can't see that though and always get nil for it unless it's overridden. Because of this we have to check our Compile Source files for any Swift files. We only do so after ensuring that we are looking at a static library that hasn't set SWIFT_OBJC_INTERFACE_HEADER_NAME to "", for the best performance.

I initially went the route of having these files be copied with a Copy Files phase, but it had some ugliness:

  • The files used "${CONFIGURATION_TEMP_DIR}" in their path, which means you couldn't open them and they were always red.
  • The path wasn't 100% correct, because some variables could be changed by Xcode and we wouldn't know where the file would be located.

@brentleyjones
Copy link
Collaborator Author

brentleyjones commented Aug 2, 2018

@keith Wanted to make sure this is a no-op for you. The SWIFT_OBJC_INTERFACE_HEADER_NAME != "" check should prevent it from doing anything in your case.

@keith
Copy link
Collaborator

keith commented Aug 2, 2018

No diff, thanks!

@brentleyjones
Copy link
Collaborator Author

@yonaskolb This is the last thing needed to complete #350. Let me know if there is anything I can do to get this in 😺

Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Could we add a unit test and something in the TestProject fixture though?

@brentleyjones brentleyjones force-pushed the static-library-swift-objc-interface-header branch from 01fe595 to 732df18 Compare August 9, 2018 14:54
@brentleyjones brentleyjones merged commit 461de39 into yonaskolb:master Aug 9, 2018
@brentleyjones brentleyjones deleted the static-library-swift-objc-interface-header branch August 9, 2018 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants