Commit e3819855 authored by Danielle Tomlinson's avatar Danielle Tomlinson Committed by Samuel Giddins

Use modulemaps and headers

parent d603dbfa
...@@ -55,6 +55,7 @@ module Pod ...@@ -55,6 +55,7 @@ module Pod
'PRODUCT_BUNDLE_IDENTIFIER' => 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}', 'PRODUCT_BUNDLE_IDENTIFIER' => 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}',
'SKIP_INSTALL' => 'YES', 'SKIP_INSTALL' => 'YES',
'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => '$(inherited) ', 'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => '$(inherited) ',
'SWIFT_INCLUDE_PATHS' => '$(inherited) ${PODS_CONFIGURATION_BUILD_DIR}/' + target.name,
# 'USE_HEADERMAP' => 'NO' # 'USE_HEADERMAP' => 'NO'
} }
......
...@@ -20,6 +20,9 @@ module Pod ...@@ -20,6 +20,9 @@ module Pod
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform) create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
create_module_map create_module_map
create_umbrella_header create_umbrella_header
elsif target.uses_swift?
create_module_map
create_umbrella_header
end end
# Because embedded targets live in their host target, CocoaPods # Because embedded targets live in their host target, CocoaPods
# copies all of the embedded target's pod_targets to its host # copies all of the embedded target's pod_targets to its host
......
...@@ -27,26 +27,25 @@ module Pod ...@@ -27,26 +27,25 @@ module Pod
add_files_to_build_phases add_files_to_build_phases
create_xcconfig_file create_xcconfig_file
create_test_xcconfig_files if target.contains_test_specifications? create_test_xcconfig_files if target.contains_test_specifications?
if target.requires_frameworks? create_module_map
unless target.static_framework? create_umbrella_header do |generator|
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform) file_accessors = target.file_accessors
end file_accessors = file_accessors.reject { |f| f.spec.test_specification? } if target.contains_test_specifications?
create_module_map generator.imports += if header_mappings_dir
create_umbrella_header do |generator| file_accessors.flat_map(&:public_headers).map do |pathname|
file_accessors = target.file_accessors pathname.relative_path_from(header_mappings_dir)
file_accessors = file_accessors.reject { |f| f.spec.test_specification? } if target.contains_test_specifications?
generator.imports += if header_mappings_dir
file_accessors.flat_map(&:public_headers).map do |pathname|
pathname.relative_path_from(header_mappings_dir)
end
else
file_accessors.flat_map(&:public_headers).map(&:basename)
end end
end else
create_build_phase_to_symlink_header_folders file_accessors.flat_map(&:public_headers).map(&:basename)
end
end
if target.requires_frameworks?
if target.static_framework? if target.static_framework?
create_build_phase_to_move_static_framework_archive create_build_phase_to_move_static_framework_archive
end end
create_build_phase_to_symlink_header_folders
else
add_copy_module_map_build_phase
end end
unless skip_pch?(target.non_test_specs) unless skip_pch?(target.non_test_specs)
path = target.prefix_header_path path = target.prefix_header_path
...@@ -661,12 +660,38 @@ module Pod ...@@ -661,12 +660,38 @@ module Pod
copy_phase.symbol_dst_subfolder_spec = :products_directory copy_phase.symbol_dst_subfolder_spec = :products_directory
copy_phase.dst_path = "$(#{acl.upcase}_HEADERS_FOLDER_PATH)/#{sub_dir}" copy_phase.dst_path = "$(#{acl.upcase}_HEADERS_FOLDER_PATH)/#{sub_dir}"
copy_phase.add_file_reference(file_ref, true) copy_phase.add_file_reference(file_ref, true)
elsif acl != 'Project'
relative_path = file_ref.real_path.basename
copy_phase_name = "Copy #{acl} Headers"
copy_phase = native_target.copy_files_build_phases.find { |bp| bp.name == copy_phase_name } ||
native_target.new_copy_files_build_phase(copy_phase_name)
copy_phase.symbol_dst_subfolder_spec = :products_directory
copy_phase.dst_path = 'Headers/'
copy_phase.add_file_reference(file_ref, true)
else else
build_file.settings ||= {} build_file.settings ||= {}
build_file.settings['ATTRIBUTES'] = [acl] build_file.settings['ATTRIBUTES'] = [acl]
end end
end end
def support_files_group
pod_name = target.pod_name
dir = target.support_files_dir
project.pod_support_files_group(pod_name, dir)
end
def add_copy_module_map_build_phase(path = target.module_map_path.relative_path_from(target.support_files_dir))
if !target.requires_frameworks? && !target.uses_swift?
file_ref = support_files_group.find_file_by_path(path.to_s)
copy_phase_name = 'Copy modulemap'
copy_phase = native_target.copy_files_build_phases.find { |bp| bp.name == copy_phase_name } ||
native_target.new_copy_files_build_phase(copy_phase_name)
copy_phase.symbol_dst_subfolder_spec = :products_directory
copy_phase.dst_path = 'Headers/'
copy_phase.add_file_reference(file_ref, false)
end
end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
end end
end end
......
...@@ -88,6 +88,9 @@ module Pod ...@@ -88,6 +88,9 @@ module Pod
settings['PRIVATE_HEADERS_FOLDER_PATH'] = framework_name + '.framework' + '/PrivateHeaders' settings['PRIVATE_HEADERS_FOLDER_PATH'] = framework_name + '.framework' + '/PrivateHeaders'
end end
else else
# if target.uses_swift?
# settings['PRODUCT_NAME'] = target.product_module_name
# end
settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '') settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '')
end end
...@@ -169,16 +172,12 @@ module Pod ...@@ -169,16 +172,12 @@ 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?
update_changed_file(generator, path) update_changed_file(generator, path)
add_file_to_support_group(path) add_file_to_support_group(path)
......
...@@ -155,7 +155,7 @@ module Pod ...@@ -155,7 +155,7 @@ module Pod
# defines the module structure for the compiler. # defines the module structure for the compiler.
# #
def module_map_path def module_map_path
support_files_dir + "#{label}.modulemap" support_files_dir + 'module.modulemap'
end end
# @return [Pathname] the absolute path of the bridge support file. # @return [Pathname] the absolute path of the bridge support file.
......
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