xcocoapods 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +6303 -0
  3. data/LICENSE +28 -0
  4. data/README.md +80 -0
  5. data/bin/pod +56 -0
  6. data/bin/sandbox-pod +168 -0
  7. data/lib/cocoapods.rb +73 -0
  8. data/lib/cocoapods/command.rb +175 -0
  9. data/lib/cocoapods/command/cache.rb +28 -0
  10. data/lib/cocoapods/command/cache/clean.rb +90 -0
  11. data/lib/cocoapods/command/cache/list.rb +69 -0
  12. data/lib/cocoapods/command/env.rb +66 -0
  13. data/lib/cocoapods/command/init.rb +128 -0
  14. data/lib/cocoapods/command/install.rb +45 -0
  15. data/lib/cocoapods/command/ipc.rb +19 -0
  16. data/lib/cocoapods/command/ipc/list.rb +40 -0
  17. data/lib/cocoapods/command/ipc/podfile.rb +31 -0
  18. data/lib/cocoapods/command/ipc/podfile_json.rb +30 -0
  19. data/lib/cocoapods/command/ipc/repl.rb +51 -0
  20. data/lib/cocoapods/command/ipc/spec.rb +29 -0
  21. data/lib/cocoapods/command/ipc/update_search_index.rb +24 -0
  22. data/lib/cocoapods/command/lib.rb +11 -0
  23. data/lib/cocoapods/command/lib/create.rb +105 -0
  24. data/lib/cocoapods/command/lib/lint.rb +121 -0
  25. data/lib/cocoapods/command/list.rb +39 -0
  26. data/lib/cocoapods/command/options/project_directory.rb +36 -0
  27. data/lib/cocoapods/command/options/repo_update.rb +34 -0
  28. data/lib/cocoapods/command/outdated.rb +140 -0
  29. data/lib/cocoapods/command/repo.rb +29 -0
  30. data/lib/cocoapods/command/repo/add.rb +103 -0
  31. data/lib/cocoapods/command/repo/lint.rb +82 -0
  32. data/lib/cocoapods/command/repo/list.rb +93 -0
  33. data/lib/cocoapods/command/repo/push.rb +281 -0
  34. data/lib/cocoapods/command/repo/remove.rb +36 -0
  35. data/lib/cocoapods/command/repo/update.rb +28 -0
  36. data/lib/cocoapods/command/setup.rb +103 -0
  37. data/lib/cocoapods/command/spec.rb +112 -0
  38. data/lib/cocoapods/command/spec/cat.rb +51 -0
  39. data/lib/cocoapods/command/spec/create.rb +283 -0
  40. data/lib/cocoapods/command/spec/edit.rb +87 -0
  41. data/lib/cocoapods/command/spec/env_spec.rb +53 -0
  42. data/lib/cocoapods/command/spec/lint.rb +137 -0
  43. data/lib/cocoapods/command/spec/which.rb +43 -0
  44. data/lib/cocoapods/command/update.rb +101 -0
  45. data/lib/cocoapods/config.rb +347 -0
  46. data/lib/cocoapods/core_overrides.rb +1 -0
  47. data/lib/cocoapods/downloader.rb +190 -0
  48. data/lib/cocoapods/downloader/cache.rb +233 -0
  49. data/lib/cocoapods/downloader/request.rb +86 -0
  50. data/lib/cocoapods/downloader/response.rb +16 -0
  51. data/lib/cocoapods/executable.rb +222 -0
  52. data/lib/cocoapods/external_sources.rb +57 -0
  53. data/lib/cocoapods/external_sources/abstract_external_source.rb +205 -0
  54. data/lib/cocoapods/external_sources/downloader_source.rb +30 -0
  55. data/lib/cocoapods/external_sources/path_source.rb +55 -0
  56. data/lib/cocoapods/external_sources/podspec_source.rb +54 -0
  57. data/lib/cocoapods/gem_version.rb +5 -0
  58. data/lib/cocoapods/generator/acknowledgements.rb +107 -0
  59. data/lib/cocoapods/generator/acknowledgements/markdown.rb +44 -0
  60. data/lib/cocoapods/generator/acknowledgements/plist.rb +94 -0
  61. data/lib/cocoapods/generator/app_target_helper.rb +244 -0
  62. data/lib/cocoapods/generator/bridge_support.rb +22 -0
  63. data/lib/cocoapods/generator/constant.rb +19 -0
  64. data/lib/cocoapods/generator/copy_resources_script.rb +230 -0
  65. data/lib/cocoapods/generator/dummy_source.rb +31 -0
  66. data/lib/cocoapods/generator/embed_frameworks_script.rb +215 -0
  67. data/lib/cocoapods/generator/header.rb +103 -0
  68. data/lib/cocoapods/generator/info_plist_file.rb +116 -0
  69. data/lib/cocoapods/generator/module_map.rb +99 -0
  70. data/lib/cocoapods/generator/prefix_header.rb +60 -0
  71. data/lib/cocoapods/generator/umbrella_header.rb +46 -0
  72. data/lib/cocoapods/hooks_manager.rb +132 -0
  73. data/lib/cocoapods/installer.rb +703 -0
  74. data/lib/cocoapods/installer/analyzer.rb +972 -0
  75. data/lib/cocoapods/installer/analyzer/analysis_result.rb +87 -0
  76. data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +98 -0
  77. data/lib/cocoapods/installer/analyzer/pod_variant.rb +67 -0
  78. data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +157 -0
  79. data/lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb +54 -0
  80. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +240 -0
  81. data/lib/cocoapods/installer/analyzer/specs_state.rb +84 -0
  82. data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +53 -0
  83. data/lib/cocoapods/installer/analyzer/target_inspector.rb +260 -0
  84. data/lib/cocoapods/installer/installation_options.rb +158 -0
  85. data/lib/cocoapods/installer/pod_source_installer.rb +202 -0
  86. data/lib/cocoapods/installer/pod_source_preparer.rb +77 -0
  87. data/lib/cocoapods/installer/podfile_validator.rb +139 -0
  88. data/lib/cocoapods/installer/post_install_hooks_context.rb +132 -0
  89. data/lib/cocoapods/installer/pre_install_hooks_context.rb +51 -0
  90. data/lib/cocoapods/installer/source_provider_hooks_context.rb +34 -0
  91. data/lib/cocoapods/installer/user_project_integrator.rb +250 -0
  92. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +463 -0
  93. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +146 -0
  94. data/lib/cocoapods/installer/xcode.rb +8 -0
  95. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +416 -0
  96. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +181 -0
  97. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +84 -0
  98. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +334 -0
  99. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +777 -0
  100. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +116 -0
  101. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +86 -0
  102. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +256 -0
  103. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +68 -0
  104. data/lib/cocoapods/installer/xcode/target_validator.rb +147 -0
  105. data/lib/cocoapods/open-uri.rb +33 -0
  106. data/lib/cocoapods/project.rb +414 -0
  107. data/lib/cocoapods/resolver.rb +585 -0
  108. data/lib/cocoapods/resolver/lazy_specification.rb +79 -0
  109. data/lib/cocoapods/sandbox.rb +404 -0
  110. data/lib/cocoapods/sandbox/file_accessor.rb +444 -0
  111. data/lib/cocoapods/sandbox/headers_store.rb +146 -0
  112. data/lib/cocoapods/sandbox/path_list.rb +220 -0
  113. data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +85 -0
  114. data/lib/cocoapods/sandbox/podspec_finder.rb +23 -0
  115. data/lib/cocoapods/sources_manager.rb +157 -0
  116. data/lib/cocoapods/target.rb +261 -0
  117. data/lib/cocoapods/target/aggregate_target.rb +338 -0
  118. data/lib/cocoapods/target/build_settings.rb +1075 -0
  119. data/lib/cocoapods/target/pod_target.rb +559 -0
  120. data/lib/cocoapods/user_interface.rb +459 -0
  121. data/lib/cocoapods/user_interface/error_report.rb +187 -0
  122. data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
  123. data/lib/cocoapods/validator.rb +981 -0
  124. metadata +533 -0
@@ -0,0 +1,116 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ class PodsProjectGenerator
5
+ # This class is responsible for integrating a pod target. This includes integrating
6
+ # the test targets included by each pod target.
7
+ #
8
+ class PodTargetIntegrator
9
+ # @return [TargetInstallationResult] the installation result of the target that should be integrated.
10
+ #
11
+ attr_reader :target_installation_result
12
+
13
+ # Initialize a new instance
14
+ #
15
+ # @param [TargetInstallationResult] target_installation_result @see #target_installation_result
16
+ #
17
+ def initialize(target_installation_result)
18
+ @target_installation_result = target_installation_result
19
+ end
20
+
21
+ # Integrates the pod target.
22
+ #
23
+ # @return [void]
24
+ #
25
+ def integrate!
26
+ UI.section(integration_message) do
27
+ target_installation_result.test_specs_by_native_target.each do |test_native_target, test_specs|
28
+ add_embed_frameworks_script_phase(test_native_target)
29
+ add_copy_resources_script_phase(test_native_target)
30
+ UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(test_specs), test_native_target)
31
+ end
32
+ specs = target.non_test_specs
33
+ UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(specs), target_installation_result.native_target)
34
+ end
35
+ end
36
+
37
+ # @return [String] a string representation suitable for debugging.
38
+ #
39
+ def inspect
40
+ "#<#{self.class} for target `#{target.label}'>"
41
+ end
42
+
43
+ private
44
+
45
+ # @!group Integration steps
46
+ #---------------------------------------------------------------------#
47
+
48
+ # Find or create a 'Copy Pods Resources' build phase
49
+ #
50
+ # @return [void]
51
+ #
52
+ def add_copy_resources_script_phase(native_target)
53
+ test_type = target.test_type_for_product_type(native_target.symbol_type)
54
+ script_path = "${PODS_ROOT}/#{target.copy_resources_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
55
+ resource_paths = target.all_dependent_targets.flat_map do |dependent_target|
56
+ spec_paths_to_include = dependent_target == target ? dependent_target.specs.map(&:name) : dependent_target.non_test_specs.map(&:name)
57
+ dependent_target.resource_paths.values_at(*spec_paths_to_include).flatten.compact
58
+ end
59
+ input_paths = []
60
+ output_paths = []
61
+ unless resource_paths.empty?
62
+ resource_paths_flattened = resource_paths.flatten.uniq
63
+ input_paths = [script_path, *resource_paths_flattened]
64
+ output_paths = UserProjectIntegrator::TargetIntegrator.resource_output_paths(resource_paths_flattened)
65
+ end
66
+ UserProjectIntegrator::TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths)
67
+ UserProjectIntegrator::TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
68
+ end
69
+
70
+ # Find or create a 'Embed Pods Frameworks' Copy Files Build Phase
71
+ #
72
+ # @return [void]
73
+ #
74
+ def add_embed_frameworks_script_phase(native_target)
75
+ test_type = target.test_type_for_product_type(native_target.symbol_type)
76
+ script_path = "${PODS_ROOT}/#{target.embed_frameworks_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
77
+ framework_paths = target.all_dependent_targets.flat_map do |dependent_target|
78
+ spec_paths_to_include = dependent_target == target ? dependent_target.specs.map(&:name) : dependent_target.non_test_specs.map(&:name)
79
+ dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact.uniq
80
+ end
81
+ input_paths = []
82
+ output_paths = []
83
+ unless framework_paths.empty?
84
+ input_paths = [script_path, *framework_paths.flat_map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.compact]
85
+ output_paths = framework_paths.flat_map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.compact
86
+ end
87
+ UserProjectIntegrator::TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths)
88
+ UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths)
89
+ end
90
+
91
+ # @return [String] the message that should be displayed for the target
92
+ # integration.
93
+ #
94
+ def integration_message
95
+ "Integrating target `#{target.name}`"
96
+ end
97
+
98
+ # @return [PodTarget] the target part of the installation result.
99
+ #
100
+ def target
101
+ target_installation_result.target
102
+ end
103
+
104
+ # @param [Array<Specification] specs
105
+ # the specs to return script phrases from.
106
+ #
107
+ # @return [Array<Hash<Symbol=>String>] an array of all combined script phases from the specs.
108
+ #
109
+ def script_phases_for_specs(specs)
110
+ specs.flat_map { |spec| spec.consumer(target.platform).script_phases }
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,86 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ class PodsProjectGenerator
5
+ # A simple container produced after a target installation is completed.
6
+ #
7
+ class TargetInstallationResult
8
+ # @return [Target] target
9
+ # The target this installation result is for.
10
+ #
11
+ attr_reader :target
12
+
13
+ # @return [PBXNativeTarget] native_target
14
+ # The native target that was produced for this target.
15
+ #
16
+ attr_reader :native_target
17
+
18
+ # @return [Array<PBXNativeTarget>] resource_bundle_targets
19
+ # The resource bundle targets that were produced for this target. Can be empty if the target had
20
+ # no resource bundles.
21
+ #
22
+ attr_reader :resource_bundle_targets
23
+
24
+ # @return [Array<PBXNativeTarget>] test_native_targets
25
+ # The test native targets that were produced for this target. Can be empty if there were no test
26
+ # native targets created (e.g. no test specs present).
27
+ #
28
+ attr_reader :test_native_targets
29
+
30
+ # @return [Hash{String=>Array<PBXNativeTarget>}] test_resource_bundle_targets
31
+ # The test resource bundle targets that were produced for this target keyed by test spec name.
32
+ # Can be empty if the target had no resource bundles for any tests.
33
+ #
34
+ attr_reader :test_resource_bundle_targets
35
+
36
+ # Initialize a new instance
37
+ #
38
+ # @param [Target] target @see #target
39
+ # @param [PBXNativeTarget] native_target @see #native_target
40
+ # @param [Array<PBXNativeTarget>] resource_bundle_targets @see #resource_bundle_targets
41
+ # @param [Array<PBXNativeTarget>] test_native_targets @see #test_native_targets
42
+ # @param [Hash{String=>Array<PBXNativeTarget>}] test_resource_bundle_targets @see #test_resource_bundle_targets
43
+ #
44
+ def initialize(target, native_target, resource_bundle_targets = [], test_native_targets = [],
45
+ test_resource_bundle_targets = {})
46
+ @target = target
47
+ @native_target = native_target
48
+ @resource_bundle_targets = resource_bundle_targets
49
+ @test_native_targets = test_native_targets
50
+ @test_resource_bundle_targets = test_resource_bundle_targets
51
+ end
52
+
53
+ # Returns the corresponding native target to use based on the provided specification.
54
+ #
55
+ # @param [Specification] spec
56
+ # The specification to base from in order to find the native target.
57
+ #
58
+ # @return [PBXNativeTarget] the native target to use or `nil` if none is found.
59
+ #
60
+ def native_target_for_spec(spec)
61
+ return native_target unless spec.test_specification?
62
+ test_native_target_from_spec(spec)
63
+ end
64
+
65
+ # @return [Hash{Array => Specification}] a hash where the keys are the test native targets and the value
66
+ # an array of all the test specs associated with this native target.
67
+ #
68
+ def test_specs_by_native_target
69
+ test_specs_by_native_target = target.test_specs.group_by do |test_spec|
70
+ test_native_target_from_spec(test_spec)
71
+ end
72
+ test_specs_by_native_target.delete_if { |k, _| k.nil? }
73
+ end
74
+
75
+ private
76
+
77
+ def test_native_target_from_spec(spec)
78
+ test_native_targets.find do |test_native_target|
79
+ test_native_target.symbol_type == target.product_type_for_test_type(spec.test_type)
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,256 @@
1
+ require 'stringio'
2
+
3
+ module Pod
4
+ class Installer
5
+ class Xcode
6
+ class PodsProjectGenerator
7
+ # Controller class responsible of creating and configuring the static
8
+ # library target in Pods project. It also creates the support file needed
9
+ # by the target.
10
+ #
11
+ class TargetInstaller
12
+ include TargetInstallerHelper
13
+
14
+ # @return [Sandbox] sandbox
15
+ # The sandbox where the support files should be generated.
16
+ #
17
+ attr_reader :sandbox
18
+
19
+ # @return [Pod::Project]
20
+ # The `Pods/Pods.xcodeproj` to install the target into.
21
+ #
22
+ attr_reader :project
23
+
24
+ # @return [Target] target
25
+ # The library whose target needs to be generated.
26
+ #
27
+ attr_reader :target
28
+
29
+ # Initialize a new instance
30
+ #
31
+ # @param [Sandbox] sandbox @see #sandbox
32
+ # @param [Pod::Project] project @see #project
33
+ # @param [Target] target @see #target
34
+ #
35
+ def initialize(sandbox, project, target)
36
+ @sandbox = sandbox
37
+ @project = project
38
+ @target = target
39
+ end
40
+
41
+ private
42
+
43
+ #-----------------------------------------------------------------------#
44
+
45
+ # @!group Installation steps
46
+
47
+ # Adds the target for the library to the Pods project with the
48
+ # appropriate build configurations.
49
+ #
50
+ # @note The `PODS_HEADERS_SEARCH_PATHS` overrides the xcconfig.
51
+ #
52
+ # @return [PBXNativeTarget] the native target that was added.
53
+ #
54
+ def add_target
55
+ product_type = target.product_type
56
+ name = target.label
57
+ platform = target.platform.name
58
+ language = target.uses_swift? ? :swift : :objc
59
+ native_target = project.new_target(product_type, name, platform, deployment_target, nil, language)
60
+
61
+ product_name = target.product_name
62
+ product = native_target.product_reference
63
+ product.name = product_name
64
+
65
+ target.user_build_configurations.each do |bc_name, type|
66
+ native_target.add_build_configuration(bc_name, type)
67
+ end
68
+
69
+ native_target.build_configurations.each do |configuration|
70
+ configuration.build_settings.merge!(custom_build_settings)
71
+ end
72
+
73
+ native_target
74
+ end
75
+
76
+ # @return [String] The deployment target.
77
+ #
78
+ def deployment_target
79
+ target.platform.deployment_target.to_s
80
+ end
81
+
82
+ # Returns the customized build settings which are overridden in the build
83
+ # settings of the user target.
84
+ #
85
+ # @return [Hash{String => String}]
86
+ #
87
+ def custom_build_settings
88
+ settings = {}
89
+
90
+ unless target.archs.empty?
91
+ settings['ARCHS'] = target.archs
92
+ end
93
+
94
+ if target.requires_frameworks?
95
+ if target.static_framework?
96
+ settings['MACH_O_TYPE'] = 'staticlib'
97
+ end
98
+ else
99
+ settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '')
100
+ end
101
+
102
+ settings
103
+ end
104
+
105
+ # Creates the directory where to store the support files of the target.
106
+ #
107
+ def create_support_files_dir
108
+ target.support_files_dir.mkpath
109
+ end
110
+
111
+ # Remove temp file whose store .prefix/config/dummy file.
112
+ #
113
+ def clean_support_files_temp_dir
114
+ support_files_temp_dir.rmtree if support_files_temp_dir.exist?
115
+ end
116
+
117
+ # @return [String] The temp file path to store temporary files.
118
+ #
119
+ def support_files_temp_dir
120
+ sandbox.target_support_files_dir('generated_files_tmp')
121
+ end
122
+
123
+ # Creates the Info.plist file which sets public framework attributes
124
+ #
125
+ # @param [Pathname] path
126
+ # the path to save the generated Info.plist file.
127
+ #
128
+ # @param [PBXNativeTarget] native_target
129
+ # the native target to link the generated Info.plist file into.
130
+ #
131
+ # @param [Version] version
132
+ # the version to use for when generating this Info.plist file.
133
+ #
134
+ # @param [Platform] platform
135
+ # the platform to use for when generating this Info.plist file.
136
+ #
137
+ # @param [Symbol] bundle_package_type
138
+ # the CFBundlePackageType of the target this Info.plist file is for.
139
+ #
140
+ # @return [void]
141
+ #
142
+ def create_info_plist_file(path, native_target, version, platform, bundle_package_type = :fmwk)
143
+ create_info_plist_file_with_sandbox(@sandbox, path, native_target, version, platform, bundle_package_type)
144
+ add_file_to_support_group(path)
145
+ end
146
+
147
+ # Creates the module map file which ensures that the umbrella header is
148
+ # recognized with a customized path
149
+ #
150
+ # @param [PBXNativeTarget] native_target
151
+ # the native target to link the module map file into.
152
+ #
153
+ # @return [void]
154
+ #
155
+ def create_module_map(native_target)
156
+ path = target.module_map_path_to_write
157
+ UI.message "- Generating module map file at #{UI.path(path)}" do
158
+ generator = Generator::ModuleMap.new(target)
159
+ yield generator if block_given?
160
+ update_changed_file(generator, path)
161
+ add_file_to_support_group(path)
162
+
163
+ linked_path = target.module_map_path
164
+ if path != linked_path
165
+ linked_path.dirname.mkpath
166
+ FileUtils.ln_sf(path, linked_path)
167
+ end
168
+
169
+ relative_path_string = target.module_map_path.relative_path_from(sandbox.root).to_s
170
+ native_target.build_configurations.each do |c|
171
+ c.build_settings['MODULEMAP_FILE'] = relative_path_string
172
+ end
173
+ end
174
+ end
175
+
176
+ # Generates a header which ensures that all header files are exported
177
+ # in the module map
178
+ #
179
+ # @param [PBXNativeTarget] native_target
180
+ # the native target to link the umbrella header file into.
181
+ #
182
+ # @yield_param [Generator::UmbrellaHeader]
183
+ # yielded once to configure the imports
184
+ #
185
+ # @return [void]
186
+ #
187
+ def create_umbrella_header(native_target)
188
+ path = target.umbrella_header_path_to_write
189
+ UI.message "- Generating umbrella header at #{UI.path(path)}" do
190
+ generator = Generator::UmbrellaHeader.new(target)
191
+ yield generator if block_given?
192
+ update_changed_file(generator, path)
193
+
194
+ # Add the file to the support group and the native target,
195
+ # so it will been added to the header build phase
196
+ file_ref = add_file_to_support_group(path)
197
+ build_file = native_target.headers_build_phase.add_file_reference(file_ref)
198
+
199
+ linked_path = target.umbrella_header_path
200
+ if path != linked_path
201
+ linked_path.dirname.mkpath
202
+ FileUtils.ln_sf(path, linked_path)
203
+ end
204
+
205
+ acl = target.requires_frameworks? ? 'Public' : 'Project'
206
+ build_file.settings ||= {}
207
+ build_file.settings['ATTRIBUTES'] = [acl]
208
+ end
209
+ end
210
+
211
+ # Generates a dummy source file for each target so libraries that contain
212
+ # only categories build.
213
+ #
214
+ # @param [PBXNativeTarget] native_target
215
+ # the native target to link the dummy source file into.
216
+ #
217
+ # @return [void]
218
+ #
219
+ def create_dummy_source(native_target)
220
+ path = target.dummy_source_path
221
+ UI.message "- Generating dummy source at #{UI.path(path)}" do
222
+ generator = Generator::DummySource.new(target.label)
223
+ update_changed_file(generator, path)
224
+ file_reference = add_file_to_support_group(path)
225
+ native_target.source_build_phase.add_file_reference(file_reference)
226
+ end
227
+ end
228
+
229
+ private
230
+
231
+ #-----------------------------------------------------------------------#
232
+
233
+ # @!group Private helpers.
234
+
235
+ # @return [PBXGroup] the group where the file references to the support
236
+ # files should be stored.
237
+ #
238
+ attr_reader :support_files_group
239
+
240
+ # Adds a reference to the given file in the support group of this target.
241
+ #
242
+ # @param [Pathname] path
243
+ # The path of the file to which the reference should be added.
244
+ #
245
+ # @return [PBXFileReference] the file reference of the added file.
246
+ #
247
+ def add_file_to_support_group(path)
248
+ support_files_group.new_file(path)
249
+ end
250
+
251
+ #-----------------------------------------------------------------------#
252
+ end
253
+ end
254
+ end
255
+ end
256
+ end