Commit 64a8b1ee authored by Samuel Giddins's avatar Samuel Giddins

[ModuleMap] Extra header string generation into a Header class

parent 7300c82c
...@@ -10,12 +10,38 @@ module Pod ...@@ -10,12 +10,38 @@ module Pod
# #
attr_reader :target attr_reader :target
attr_reader :headers
Header = Struct.new(:path, :umbrella, :private, :textual, :size, :mtime) do
alias private? private
def to_s
[
(:private if private?),
(:textual if textual),
(:umbrella if umbrella),
'header',
%("#{path}"),
attrs,
].compact.join(' ')
end
def attrs
attrs = {
'size' => size,
'mtime' => mtime,
}.reject {|k,v| v.nil? }
return nil if attrs.empty?
attrs.to_s
end
end
# Initialize a new instance # Initialize a new instance
# #
# @param [PodTarget] target @see target # @param [PodTarget] target @see target
# #
def initialize(target) def initialize(target)
@target = target @target = target
@headers = [Header.new(target.umbrella_header_path.basename, true)]
end end
# Generates and saves the Info.plist to the given path. # Generates and saves the Info.plist to the given path.
...@@ -39,7 +65,7 @@ module Pod ...@@ -39,7 +65,7 @@ module Pod
def generate def generate
<<-MODULE_MAP.strip_heredoc <<-MODULE_MAP.strip_heredoc
#{module_specificier_prefix}module #{target.product_module_name} { #{module_specificier_prefix}module #{target.product_module_name} {
umbrella header "#{target.umbrella_header_path.basename}" #{headers.join("\n ")}
export * export *
module * { export * } module * { export * }
......
...@@ -176,6 +176,7 @@ module Pod ...@@ -176,6 +176,7 @@ module Pod
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?
update_changed_file(generator, path) update_changed_file(generator, path)
add_file_to_support_group(path) add_file_to_support_group(path)
......
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