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,261 @@
1
+ require 'cocoapods/target/build_settings'
2
+
3
+ module Pod
4
+ # Model class which describes a Pods target.
5
+ #
6
+ # The Target class stores and provides the information necessary for
7
+ # working with a target in the Podfile and its dependent libraries.
8
+ # This class is used to represent both the targets and their libraries.
9
+ #
10
+ class Target
11
+ DEFAULT_VERSION = '1.0.0'.freeze
12
+ DEFAULT_NAME = 'Default'.freeze
13
+ DEFAULT_BUILD_CONFIGURATIONS = { 'Release' => :release, 'Debug' => :debug }.freeze
14
+
15
+ # @return [Sandbox] The sandbox where the Pods should be installed.
16
+ #
17
+ attr_reader :sandbox
18
+
19
+ # @return [Boolean] Whether the target needs to be implemented as a framework.
20
+ # Computed by analyzer.
21
+ #
22
+ attr_reader :host_requires_frameworks
23
+ alias_method :host_requires_frameworks?, :host_requires_frameworks
24
+
25
+ # @return [Hash{String=>Symbol}] A hash representing the user build
26
+ # configurations where each key corresponds to the name of a
27
+ # configuration and its value to its type (`:debug` or `:release`).
28
+ #
29
+ attr_reader :user_build_configurations
30
+
31
+ # @return [Array<String>] The value for the ARCHS build setting.
32
+ #
33
+ attr_reader :archs
34
+
35
+ # @return [Platform] the platform of this target.
36
+ #
37
+ attr_reader :platform
38
+
39
+ # @return [BuildSettings] the build settings for this target.
40
+ #
41
+ attr_reader :build_settings
42
+
43
+ # Initialize a new target
44
+ #
45
+ # @param [Sandbox] sandbox @see #sandbox
46
+ # @param [Boolean] host_requires_frameworks @see #host_requires_frameworks
47
+ # @param [Hash{String=>Symbol}] user_build_configurations @see #user_build_configurations
48
+ # @param [Array<String>] archs @see #archs
49
+ # @param [Platform] platform @see #platform
50
+ #
51
+ def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform)
52
+ @sandbox = sandbox
53
+ @host_requires_frameworks = host_requires_frameworks
54
+ @user_build_configurations = user_build_configurations
55
+ @archs = archs
56
+ @platform = platform
57
+
58
+ @build_settings = create_build_settings
59
+ end
60
+
61
+ # @return [String] the name of the library.
62
+ #
63
+ def name
64
+ label
65
+ end
66
+
67
+ alias to_s name
68
+
69
+ # @return [String] the label for the target.
70
+ #
71
+ def label
72
+ DEFAULT_NAME
73
+ end
74
+
75
+ # @return [String] The version associated with this target
76
+ #
77
+ def version
78
+ DEFAULT_VERSION
79
+ end
80
+
81
+ # @return [Boolean] Whether the target uses Swift code
82
+ #
83
+ def uses_swift?
84
+ false
85
+ end
86
+
87
+ # @return [Boolean] Whether the target should build a static framework.
88
+ #
89
+ def static_framework?
90
+ false
91
+ end
92
+
93
+ # @return [String] the name to use for the source code module constructed
94
+ # for this target, and which will be used to import the module in
95
+ # implementation source files.
96
+ #
97
+ def product_module_name
98
+ c99ext_identifier(label)
99
+ end
100
+
101
+ # @return [String] the name of the product.
102
+ #
103
+ def product_name
104
+ if requires_frameworks?
105
+ framework_name
106
+ else
107
+ static_library_name
108
+ end
109
+ end
110
+
111
+ # @return [String] the name of the product excluding the file extension or
112
+ # a product type specific prefix, depends on #requires_frameworks?
113
+ # and #product_module_name or #label.
114
+ #
115
+ def product_basename
116
+ if requires_frameworks?
117
+ product_module_name
118
+ else
119
+ label
120
+ end
121
+ end
122
+
123
+ # @return [String] the name of the framework, depends on #label.
124
+ #
125
+ # @note This may not depend on #requires_frameworks? indirectly as it is
126
+ # used for migration.
127
+ #
128
+ def framework_name
129
+ "#{product_module_name}.framework"
130
+ end
131
+
132
+ # @return [String] the name of the library, depends on #label.
133
+ #
134
+ # @note This may not depend on #requires_frameworks? indirectly as it is
135
+ # used for migration.
136
+ #
137
+ def static_library_name
138
+ "lib#{label}.a"
139
+ end
140
+
141
+ # @return [Symbol] either :framework or :static_library, depends on
142
+ # #requires_frameworks?.
143
+ #
144
+ def product_type
145
+ requires_frameworks? ? :framework : :static_library
146
+ end
147
+
148
+ # @return [String] A string suitable for debugging.
149
+ #
150
+ def inspect
151
+ "<#{self.class} name=#{name} >"
152
+ end
153
+
154
+ #-------------------------------------------------------------------------#
155
+
156
+ # @!group Framework support
157
+
158
+ # @return [Boolean] whether the generated target needs to be implemented
159
+ # as a framework
160
+ #
161
+ def requires_frameworks?
162
+ host_requires_frameworks? || false
163
+ end
164
+
165
+ #-------------------------------------------------------------------------#
166
+
167
+ # @!group Support files
168
+
169
+ # @return [Pathname] the folder where to store the support files of this
170
+ # library.
171
+ #
172
+ def support_files_dir
173
+ sandbox.target_support_files_dir(name)
174
+ end
175
+
176
+ # @param [String] variant
177
+ # The variant of the xcconfig. Used to differentiate build
178
+ # configurations.
179
+ #
180
+ # @return [Pathname] the absolute path of the xcconfig file.
181
+ #
182
+ def xcconfig_path(variant = nil)
183
+ if variant
184
+ support_files_dir + "#{label}.#{variant.gsub(File::SEPARATOR, '-').downcase}.xcconfig"
185
+ else
186
+ support_files_dir + "#{label}.xcconfig"
187
+ end
188
+ end
189
+
190
+ # @return [Pathname] the absolute path of the header file which contains
191
+ # the exported foundation constants with framework version
192
+ # information and all headers, which should been exported in the
193
+ # module map.
194
+ #
195
+ def umbrella_header_path
196
+ module_map_path.parent + "#{label}-umbrella.h"
197
+ end
198
+
199
+ def umbrella_header_path_to_write
200
+ module_map_path_to_write.parent + "#{label}-umbrella.h"
201
+ end
202
+
203
+ # @return [Pathname] the absolute path of the LLVM module map file that
204
+ # defines the module structure for the compiler.
205
+ #
206
+ def module_map_path
207
+ module_map_path_to_write
208
+ end
209
+
210
+ # @!private
211
+ #
212
+ # @return [Pathname] the absolute path of the module map file that
213
+ # CocoaPods writes. This can be different from `module_map_path`
214
+ # if the module map gets symlinked.
215
+ #
216
+ def module_map_path_to_write
217
+ basename = "#{label}.modulemap"
218
+ support_files_dir + basename
219
+ end
220
+
221
+ # @return [Pathname] the absolute path of the bridge support file.
222
+ #
223
+ def bridge_support_path
224
+ support_files_dir + "#{label}.bridgesupport"
225
+ end
226
+
227
+ # @return [Pathname] the absolute path of the Info.plist file.
228
+ #
229
+ def info_plist_path
230
+ support_files_dir + "#{label}-Info.plist"
231
+ end
232
+
233
+ # @return [Pathname] the path of the dummy source generated by CocoaPods
234
+ #
235
+ def dummy_source_path
236
+ support_files_dir + "#{label}-dummy.m"
237
+ end
238
+
239
+ #-------------------------------------------------------------------------#
240
+
241
+ private
242
+
243
+ # Transforms the given string into a valid +identifier+ after C99ext
244
+ # standard, so that it can be used in source code where escaping of
245
+ # ambiguous characters is not applicable.
246
+ #
247
+ # @param [String] name
248
+ # any name, which may contain leading numbers, spaces or invalid
249
+ # characters.
250
+ #
251
+ # @return [String]
252
+ #
253
+ def c99ext_identifier(name)
254
+ name.gsub(/^([0-9])/, '_\1').gsub(/[^a-zA-Z0-9_]/, '_')
255
+ end
256
+
257
+ def create_build_settings
258
+ BuildSettings.new(self)
259
+ end
260
+ end
261
+ end
@@ -0,0 +1,338 @@
1
+ module Pod
2
+ # Stores the information relative to the target used to cluster the targets
3
+ # of the single Pods. The client targets will then depend on this one.
4
+ #
5
+ class AggregateTarget < Target
6
+ # Product types where the product's frameworks must be embedded in a host target
7
+ #
8
+ EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES = [:app_extension, :framework, :static_library, :messages_extension, :watch_extension, :xpc_service].freeze
9
+
10
+ # @return [TargetDefinition] the target definition of the Podfile that
11
+ # generated this target.
12
+ #
13
+ attr_reader :target_definition
14
+
15
+ # @return [Pathname] the folder where the client is stored used for
16
+ # computing the relative paths. If integrating it should be the
17
+ # folder where the user project is stored, otherwise it should
18
+ # be the installation root.
19
+ #
20
+ attr_reader :client_root
21
+
22
+ # @return [Xcodeproj::Project] the user project that this target will
23
+ # integrate as identified by the analyzer.
24
+ #
25
+ attr_reader :user_project
26
+
27
+ # @return [Array<String>] the list of the UUIDs of the user targets that
28
+ # will be integrated by this target as identified by the analyzer.
29
+ #
30
+ # @note The target instances are not stored to prevent editing different
31
+ # instances.
32
+ #
33
+ attr_reader :user_target_uuids
34
+
35
+ # @return [Hash<String, Xcodeproj::Config>] Map from configuration name to
36
+ # configuration file for the target
37
+ #
38
+ # @note The configurations are generated by the {TargetInstaller} and
39
+ # used by {UserProjectIntegrator} to check for any overridden
40
+ # values.
41
+ #
42
+ attr_reader :xcconfigs
43
+
44
+ # @return [Array<PodTarget>] The dependencies for this target.
45
+ #
46
+ attr_accessor :pod_targets
47
+
48
+ # @return [Array<AggregateTarget>] The aggregate targets whose pods this
49
+ # target must be able to import, but will not directly link against.
50
+ #
51
+ attr_reader :search_paths_aggregate_targets
52
+
53
+ # Initialize a new instance
54
+ #
55
+ # @param [Sandbox] sandbox @see Target#sandbox
56
+ # @param [Boolean] host_requires_frameworks @see Target#host_requires_frameworks
57
+ # @param [Hash{String=>Symbol}] user_build_configurations @see Target#user_build_configurations
58
+ # @param [Array<String>] archs @see Target#archs
59
+ # @param [Platform] platform @see #Target#platform
60
+ # @param [TargetDefinition] target_definition @see #target_definition
61
+ # @param [Pathname] client_root @see #client_root
62
+ # @param [Xcodeproj::Project] user_project @see #user_project
63
+ # @param [Array<String>] user_target_uuids @see #user_target_uuids
64
+ # @param [Array<PodTarget>] pod_targets_for_build_configuration @see #pod_targets_for_build_configuration
65
+ #
66
+ def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform, target_definition,
67
+ client_root, user_project, user_target_uuids, pod_targets_for_build_configuration)
68
+ super(sandbox, host_requires_frameworks, user_build_configurations, archs, platform)
69
+ raise "Can't initialize an AggregateTarget without a TargetDefinition!" if target_definition.nil?
70
+ raise "Can't initialize an AggregateTarget with an abstract TargetDefinition!" if target_definition.abstract?
71
+ @target_definition = target_definition
72
+ @client_root = client_root
73
+ @user_project = user_project
74
+ @user_target_uuids = user_target_uuids
75
+ @pod_targets_for_build_configuration = pod_targets_for_build_configuration
76
+ @pod_targets = pod_targets_for_build_configuration.values.flatten.uniq
77
+ @search_paths_aggregate_targets = []
78
+ @xcconfigs = {}
79
+ end
80
+
81
+ def build_settings(configuration_name = nil)
82
+ if configuration_name
83
+ @build_settings[configuration_name] ||
84
+ raise(ArgumentError, "#{self} does not contain a build setting for the #{configuration_name.inspect} configuration, only #{@build_settings.keys.inspect}")
85
+ else
86
+ @build_settings.each_value.first ||
87
+ raise(ArgumentError, "#{self} does not contain any build settings")
88
+ end
89
+ end
90
+
91
+ # @return [Boolean] True if the user_target refers to a
92
+ # library (framework, static or dynamic lib).
93
+ #
94
+ def library?
95
+ # Without a user_project, we can't say for sure
96
+ # that this is a library
97
+ return false if user_project.nil?
98
+ symbol_types = user_targets.map(&:symbol_type).uniq
99
+ raise ArgumentError, "Expected single kind of user_target for #{name}. Found #{symbol_types.join(', ')}." unless symbol_types.count == 1
100
+ [:framework, :dynamic_library, :static_library].include? symbol_types.first
101
+ end
102
+
103
+ # @return [Boolean] True if the user_target's pods are
104
+ # for an extension and must be embedded in a host,
105
+ # target, otherwise false.
106
+ #
107
+ def requires_host_target?
108
+ # If we don't have a user_project, then we can't
109
+ # glean any info about how this target is going to
110
+ # be integrated, so return false since we can't know
111
+ # for sure that this target refers to an extension
112
+ # target that would require a host target
113
+ return false if user_project.nil?
114
+ symbol_types = user_targets.map(&:symbol_type).uniq
115
+ raise ArgumentError, "Expected single kind of user_target for #{name}. Found #{symbol_types.join(', ')}." unless symbol_types.count == 1
116
+ EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include?(symbol_types[0])
117
+ end
118
+
119
+ # @return [String] the label for the target.
120
+ #
121
+ def label
122
+ target_definition.label.to_s
123
+ end
124
+
125
+ # @return [Podfile] The podfile which declares the dependency
126
+ #
127
+ def podfile
128
+ target_definition.podfile
129
+ end
130
+
131
+ # @return [Pathname] the path of the user project that this target will
132
+ # integrate as identified by the analyzer.
133
+ #
134
+ def user_project_path
135
+ user_project.path if user_project
136
+ end
137
+
138
+ # List all user targets that will be integrated by this #target.
139
+ #
140
+ # @return [Array<PBXNativeTarget>]
141
+ #
142
+ def user_targets
143
+ return [] unless user_project
144
+ user_target_uuids.map do |uuid|
145
+ native_target = user_project.objects_by_uuid[uuid]
146
+ unless native_target
147
+ raise Informative, '[Bug] Unable to find the target with ' \
148
+ "the `#{uuid}` UUID for the `#{self}` integration library"
149
+ end
150
+ native_target
151
+ end
152
+ end
153
+
154
+ # @param [String] build_configuration The build configuration for which the
155
+ # the pod targets should be returned.
156
+ #
157
+ # @return [Array<PodTarget>] the pod targets for the given build
158
+ # configuration.
159
+ #
160
+ def pod_targets_for_build_configuration(build_configuration)
161
+ @pod_targets_for_build_configuration[build_configuration] || []
162
+ end
163
+
164
+ # @return [Array<Specification>] The specifications used by this aggregate target.
165
+ #
166
+ def specs
167
+ pod_targets.flat_map(&:specs)
168
+ end
169
+
170
+ # @return [Hash{Symbol => Array<Specification>}] The pod targets for each
171
+ # build configuration.
172
+ #
173
+ def specs_by_build_configuration
174
+ result = {}
175
+ user_build_configurations.keys.each do |build_configuration|
176
+ result[build_configuration] = pod_targets_for_build_configuration(build_configuration).
177
+ flat_map(&:specs)
178
+ end
179
+ result
180
+ end
181
+
182
+ # @return [Array<Specification::Consumer>] The consumers of the Pod.
183
+ #
184
+ def spec_consumers
185
+ specs.map { |spec| spec.consumer(platform) }
186
+ end
187
+
188
+ # @return [Boolean] Whether the target uses Swift code
189
+ #
190
+ def uses_swift?
191
+ pod_targets.any?(&:uses_swift?)
192
+ end
193
+
194
+ # @return [Hash{String => Array<Hash{Symbol => [String]}>}] The vendored dynamic artifacts and framework target
195
+ # input and output paths grouped by config
196
+ #
197
+ def framework_paths_by_config
198
+ @framework_paths_by_config ||= begin
199
+ framework_paths_by_config = {}
200
+ user_build_configurations.keys.each do |config|
201
+ relevant_pod_targets = pod_targets_for_build_configuration(config)
202
+ framework_paths_by_config[config] = relevant_pod_targets.flat_map do |pod_target|
203
+ non_test_specs = pod_target.non_test_specs.map(&:name)
204
+ pod_target.framework_paths.values_at(*non_test_specs).flatten.compact.uniq
205
+ end
206
+ end
207
+ framework_paths_by_config
208
+ end
209
+ end
210
+
211
+ # @return [Hash{String => Array<String>}] Uniqued Resources grouped by config
212
+ #
213
+ def resource_paths_by_config
214
+ @resource_paths_by_config ||= begin
215
+ relevant_pod_targets = pod_targets.reject do |pod_target|
216
+ pod_target.should_build? && pod_target.requires_frameworks? && !pod_target.static_framework?
217
+ end
218
+ user_build_configurations.keys.each_with_object({}) do |config, resources_by_config|
219
+ resources_by_config[config] = (relevant_pod_targets & pod_targets_for_build_configuration(config)).flat_map do |pod_target|
220
+ non_test_specs = pod_target.non_test_specs.map(&:name)
221
+ resource_paths = pod_target.resource_paths.values_at(*non_test_specs).flatten.compact
222
+ (resource_paths + [bridge_support_file].compact).uniq
223
+ end
224
+ end
225
+ end
226
+ end
227
+
228
+ # @return [Pathname] the path of the bridge support file relative to the
229
+ # sandbox or `nil` if bridge support is disabled.
230
+ #
231
+ def bridge_support_file
232
+ bridge_support_path.relative_path_from(sandbox.root) if podfile.generate_bridge_support?
233
+ end
234
+
235
+ #-------------------------------------------------------------------------#
236
+
237
+ # @!group Support files
238
+
239
+ # @return [Pathname] The absolute path of acknowledgements file.
240
+ #
241
+ # @note The acknowledgements generators add the extension according to
242
+ # the file type.
243
+ #
244
+ def acknowledgements_basepath
245
+ support_files_dir + "#{label}-acknowledgements"
246
+ end
247
+
248
+ # @return [Pathname] The absolute path of the copy resources script.
249
+ #
250
+ def copy_resources_script_path
251
+ support_files_dir + "#{label}-resources.sh"
252
+ end
253
+
254
+ # @return [Pathname] The absolute path of the embed frameworks script.
255
+ #
256
+ def embed_frameworks_script_path
257
+ support_files_dir + "#{label}-frameworks.sh"
258
+ end
259
+
260
+ # @return [String] The output file path fo the check manifest lock script.
261
+ #
262
+ def check_manifest_lock_script_output_file_path
263
+ "$(DERIVED_FILE_DIR)/#{label}-checkManifestLockResult.txt"
264
+ end
265
+
266
+ # @return [Pathname] The relative path of the Pods directory from user project's directory.
267
+ #
268
+ def relative_pods_root_path
269
+ sandbox.root.relative_path_from(client_root)
270
+ end
271
+
272
+ # @return [String] The xcconfig path of the root from the `$(SRCROOT)`
273
+ # variable of the user's project.
274
+ #
275
+ def relative_pods_root
276
+ "${SRCROOT}/#{relative_pods_root_path}"
277
+ end
278
+
279
+ # @return [String] The path of the Podfile directory relative to the
280
+ # root of the user project.
281
+ #
282
+ def podfile_dir_relative_path
283
+ podfile_path = target_definition.podfile.defined_in_file
284
+ return "${SRCROOT}/#{podfile_path.relative_path_from(client_root).dirname}" unless podfile_path.nil?
285
+ # Fallback to the standard path if the Podfile is not represented by a file.
286
+ '${PODS_ROOT}/..'
287
+ end
288
+
289
+ # @param [String] config_name The build configuration name to get the xcconfig for
290
+ # @return [String] The path of the xcconfig file relative to the root of
291
+ # the user project.
292
+ #
293
+ def xcconfig_relative_path(config_name)
294
+ xcconfig_path(config_name).relative_path_from(client_root).to_s
295
+ end
296
+
297
+ # @return [String] The path of the copy resources script relative to the
298
+ # root of the Pods project.
299
+ #
300
+ def copy_resources_script_relative_path
301
+ "${PODS_ROOT}/#{relative_to_pods_root(copy_resources_script_path)}"
302
+ end
303
+
304
+ # @return [String] The path of the embed frameworks relative to the
305
+ # root of the Pods project.
306
+ #
307
+ def embed_frameworks_script_relative_path
308
+ "${PODS_ROOT}/#{relative_to_pods_root(embed_frameworks_script_path)}"
309
+ end
310
+
311
+ private
312
+
313
+ # @!group Private Helpers
314
+ #-------------------------------------------------------------------------#
315
+
316
+ # Computes the relative path of a sandboxed file from the `$(PODS_ROOT)`
317
+ # variable of the Pods's project.
318
+ #
319
+ # @param [Pathname] path
320
+ # A relative path from the root of the sandbox.
321
+ #
322
+ # @return [String] The computed path.
323
+ #
324
+ def relative_to_pods_root(path)
325
+ path.relative_path_from(sandbox.root).to_s
326
+ end
327
+
328
+ def create_build_settings
329
+ settings = {}
330
+
331
+ user_build_configurations.each_key do |configuration_name|
332
+ settings[configuration_name] = BuildSettings::AggregateTargetSettings.new(self, configuration_name)
333
+ end
334
+
335
+ settings
336
+ end
337
+ end
338
+ end