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
Ensure private headers are declared as such in a framework's generated module map. #3004
Conversation
Do we have a good reason to generate our module map differently from Xcode defaults (see #2974 (comment))? |
def generate_private_header_exports | ||
private_headers.reduce('') do |string, header| | ||
string << %( private header "#{header}\n") | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure if this is correct.
Shouldn't the output be something like:
module Foo {
header "Foo.h"
explicit module Private {
header "Foo_Private.h"
}
}
Ref: http://clang.llvm.org/docs/Modules.html#private-module-map-files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There doesn't seem to be any tests to ensure generate
works, can we add some? (I understand if you feel this is outside of this PR, can be done separately, but I think it makes sense to add them in this PR to make sure this works correctly).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, can add some tests later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A header with the private specifier may not be included from outside the module itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There doesn't seem to be any tests to ensure generate works
That's the integration specs
@neonichu: In which way different? |
@mrackwitz I was referring to including the private headers in them, Xcode does not do that, it will merely include the actual files in a PrivateHeader directory. |
note to self: add unit test for spec with private headers |
405dd92
to
56888d5
Compare
@kylef rebased + added spec |
Hm, this only works if one specifies |
@neonichu A header wouldn't be private unless it has presence in the pod spec's |
@kylef seems unintuitive for me, especially since we introduced Pods/Headers/{Private,Public} - that suggest that a header is either considered private or public by CP and cannot be neither. This is also what http://guides.cocoapods.org/syntax/podspec.html#private_header_files suggests, so at the very least, we have to change that. |
To clarify what I mean, the current implementation in this PR would add
but not in this one:
I don't think that is intended. |
Boris, I'm pretty sure it would in the latter. Check out the file accessor. -Samuel E. Giddins On Jan 19, 2015, at 4:02 AM, Boris Bügling notifications@github.com wrote: To clarify what I mean, the current implementation in this PR would add b.h to the module map in this scenario: source_files = a.h b.h source_files = a.h b.h |
@segiddins didn't work for me in manual testing - will have a look at why that is the case, first wanted to confirm that I am not missing something and that behaviour was intended. |
@segiddins So the file accessor is actually the issue. https://github.com/CocoaPods/CocoaPods/pull/3004/files#diff-a1bd48eb509ce3365557319fdda59f25R130 contains only the contents of the But fixing that breaks the build of frameworks anyway, possibly because the private headers are not actually copied into the framework. Unfortunately, the error message is only the ever elusive "Could not build Objective-C module". |
Not copying the headers is indeed the issue, we need to add handling for private headers here https://github.com/CocoaPods/CocoaPods/blob/seg-module-map-private-headers/lib/cocoapods/installer/target_installer/pod_target_installer.rb#L68, similar to the public ones. As this copies the headers into the |
I think #3145 will make this work? |
@mrackwitz please see that this will work in conjunction with the custom modulemap PR? |
56888d5
to
6645921
Compare
We could add
This could help to find misconfigurations of the header visibility in the podspec with |
@mrackwitz if we add |
@segiddins: That should go in a separate issue. |
In that case, what needs to be done for this to be merged? |
6645921
to
d28b040
Compare
Rebuilding the integration spec. ✅ |
d28b040
to
b1ef0f6
Compare
Ensure private headers are declared as such in a framework's generated module map.
Closes #2974.
\c @mrackwitz @kylef