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
#
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
#
# @param [PodTarget] target @see target
#
def initialize(target)
@target = target
@headers = [Header.new(target.umbrella_header_path.basename, true)]
end
# Generates and saves the Info.plist to the given path.
......@@ -39,7 +65,7 @@ module Pod
def generate
<<-MODULE_MAP.strip_heredoc
#{module_specificier_prefix}module #{target.product_module_name} {
umbrella header "#{target.umbrella_header_path.basename}"
#{headers.join("\n ")}
export *
module * { export * }
......
......@@ -176,6 +176,7 @@ module Pod
path = target.module_map_path
UI.message "- Generating module map file at #{UI.path(path)}" do
generator = Generator::ModuleMap.new(target)
yield generator if block_given?
update_changed_file(generator, 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