Commit 847e309e authored by Samuel Giddins's avatar Samuel Giddins

[PodTargetInstaller] Write custom module maps using a generator

parent d9e19706
...@@ -614,25 +614,20 @@ module Pod ...@@ -614,25 +614,20 @@ module Pod
def create_module_map def create_module_map
return super unless custom_module_map return super unless custom_module_map
path = target.module_map_path path = target.module_map_path
path.mkpath
UI.message "- Copying module map file to #{UI.path(path)}" do UI.message "- Copying module map file to #{UI.path(path)}" do
Tempfile.open(path.basename.to_s) do |tmp_module_map| contents = custom_module_map.read
contents = custom_module_map.read unless target.requires_frameworks?
unless target.requires_frameworks? contents.gsub!(/^(\s*)framework\s+module/, '\1module')
contents.gsub!(/^(\s*)framework\s+module/, '\1module') end
end generator = Generator::Constant.new(contents)
tmp_module_map.write contents update_changed_file(generator, path)
tmp_module_map.rewind add_file_to_support_group(path)
unless path.exist? && FileUtils.identical?(tmp_module_map, path)
FileUtils.cp(tmp_module_map, path)
end
add_file_to_support_group(path)
native_target.build_configurations.each do |c| native_target.build_configurations.each do |c|
relative_path = path.relative_path_from(sandbox.root) relative_path = path.relative_path_from(sandbox.root)
c.build_settings['MODULEMAP_FILE'] = relative_path.to_s c.build_settings['MODULEMAP_FILE'] = relative_path.to_s
end
end 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