Commit 8bbe9974 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3004 from CocoaPods/seg-module-map-private-headers

Ensure private headers are declared as such in a framework's generated module map.
parents e2530f4b 10897f20
...@@ -38,6 +38,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -38,6 +38,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Chris Brauchli](https://github.com/cbrauchli) [Chris Brauchli](https://github.com/cbrauchli)
[#2633](https://github.com/CocoaPods/CocoaPods/issues/2633) [#2633](https://github.com/CocoaPods/CocoaPods/issues/2633)
* Ensure private headers are declared as such in a framework's generated module
map.
[Samuel Giddins](https://github.com/segiddins)
[#2974](https://github.com/CocoaPods/CocoaPods/issues/2974)
##### Bug Fixes ##### Bug Fixes
* Do not pass code-sign arguments to xcodebuild when linting OS X targets. * Do not pass code-sign arguments to xcodebuild when linting OS X targets.
......
...@@ -10,10 +10,15 @@ module Pod ...@@ -10,10 +10,15 @@ module Pod
# #
attr_reader :target attr_reader :target
# @return [Array] the private headers of the module
#
attr_accessor :private_headers
# @param [Target] target @see target # @param [Target] target @see target
# #
def initialize(target) def initialize(target)
@target = target @target = target
@private_headers = []
end end
# Generates and saves the Info.plist to the given path. # Generates and saves the Info.plist to the given path.
...@@ -35,14 +40,24 @@ module Pod ...@@ -35,14 +40,24 @@ module Pod
# @return [String] # @return [String]
# #
def generate def generate
<<-eos.strip_heredoc result = <<-eos.strip_heredoc
framework module #{target.product_module_name} { framework module #{target.product_module_name} {
umbrella header "#{target.umbrella_header_path.basename}" umbrella header "#{target.umbrella_header_path.basename}"
export * export *
module * { export * } module * { export * }
}
eos eos
result << "\n#{generate_private_header_exports}" unless private_headers.empty?
result << "}\n"
end
private
def generate_private_header_exports
private_headers.reduce('') do |string, header|
string << %( private header "#{header}"\n)
end
end end
end end
end end
......
...@@ -107,12 +107,16 @@ module Pod ...@@ -107,12 +107,16 @@ module Pod
# Creates the module map file which ensures that the umbrella header is # Creates the module map file which ensures that the umbrella header is
# recognized with a customized path # recognized with a customized path
# #
# @yield_param [Generator::ModuleMap]
# yielded once to configure the private headers
#
# @return [void] # @return [void]
# #
def create_module_map def create_module_map
path = target.module_map_path path = target.module_map_path
UI.message "- Generating module map file at #{UI.path(path)}" do UI.message "- Generating module map file at #{UI.path(path)}" do
generator = Generator::ModuleMap.new(target) generator = Generator::ModuleMap.new(target)
yield generator if block_given?
generator.save_as(path) generator.save_as(path)
add_file_to_support_group(path) add_file_to_support_group(path)
......
...@@ -22,7 +22,9 @@ module Pod ...@@ -22,7 +22,9 @@ module Pod
create_xcconfig_file create_xcconfig_file
if target.requires_frameworks? if target.requires_frameworks?
create_info_plist_file create_info_plist_file
create_module_map create_module_map do |generator|
generator.private_headers += target.file_accessors.flat_map(&:private_headers).map(&:basename)
end
create_umbrella_header do |generator| create_umbrella_header do |generator|
generator.imports += target.file_accessors.flat_map(&:public_headers).map(&:basename) generator.imports += target.file_accessors.flat_map(&:public_headers).map(&:basename)
end end
......
Subproject commit bd72f0ebff59e9251e7b6d651012ff9159ddd0a7 Subproject commit 79c9522a24befa20029b881118aac302dac65800
...@@ -21,5 +21,19 @@ module Pod ...@@ -21,5 +21,19 @@ module Pod
} }
EOS EOS
end end
it 'correctly adds private headers' do
@gen.stubs(:private_headers).returns(['Private.h'])
@gen.generate.should == <<-EOS.strip_heredoc
framework module BananaLib {
umbrella header "Pods-default-BananaLib-umbrella.h"
export *
module * { export * }
private header "Private.h"
}
EOS
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment