cocoapods 1.5.3 → 1.6.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +200 -0
  3. data/lib/cocoapods.rb +0 -1
  4. data/lib/cocoapods/command/init.rb +1 -1
  5. data/lib/cocoapods/command/install.rb +7 -0
  6. data/lib/cocoapods/command/lib/lint.rb +8 -1
  7. data/lib/cocoapods/command/outdated.rb +2 -7
  8. data/lib/cocoapods/command/repo/add.rb +1 -1
  9. data/lib/cocoapods/command/repo/list.rb +1 -1
  10. data/lib/cocoapods/command/repo/push.rb +17 -12
  11. data/lib/cocoapods/command/repo/remove.rb +1 -1
  12. data/lib/cocoapods/command/repo/update.rb +1 -1
  13. data/lib/cocoapods/command/setup.rb +1 -1
  14. data/lib/cocoapods/command/spec/create.rb +39 -39
  15. data/lib/cocoapods/command/spec/lint.rb +8 -1
  16. data/lib/cocoapods/config.rb +13 -2
  17. data/lib/cocoapods/downloader/cache.rb +1 -1
  18. data/lib/cocoapods/executable.rb +2 -2
  19. data/lib/cocoapods/external_sources.rb +7 -4
  20. data/lib/cocoapods/external_sources/abstract_external_source.rb +23 -13
  21. data/lib/cocoapods/gem_version.rb +1 -1
  22. data/lib/cocoapods/generator/acknowledgements/markdown.rb +6 -0
  23. data/lib/cocoapods/generator/acknowledgements/plist.rb +11 -0
  24. data/lib/cocoapods/generator/app_target_helper.rb +102 -16
  25. data/lib/cocoapods/generator/copy_resources_script.rb +6 -0
  26. data/lib/cocoapods/generator/dummy_source.rb +14 -5
  27. data/lib/cocoapods/generator/embed_frameworks_script.rb +13 -2
  28. data/lib/cocoapods/generator/header.rb +1 -1
  29. data/lib/cocoapods/generator/info_plist_file.rb +12 -4
  30. data/lib/cocoapods/generator/prefix_header.rb +2 -2
  31. data/lib/cocoapods/hooks_manager.rb +28 -17
  32. data/lib/cocoapods/installer.rb +103 -42
  33. data/lib/cocoapods/installer/analyzer.rb +362 -277
  34. data/lib/cocoapods/installer/analyzer/analysis_result.rb +52 -22
  35. data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +9 -6
  36. data/lib/cocoapods/installer/analyzer/pod_variant.rb +4 -5
  37. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +3 -14
  38. data/lib/cocoapods/installer/analyzer/specs_state.rb +28 -4
  39. data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +24 -16
  40. data/lib/cocoapods/installer/analyzer/target_inspector.rb +17 -11
  41. data/lib/cocoapods/installer/pod_source_installer.rb +31 -43
  42. data/lib/cocoapods/installer/post_install_hooks_context.rb +71 -46
  43. data/lib/cocoapods/installer/pre_install_hooks_context.rb +22 -13
  44. data/lib/cocoapods/installer/source_provider_hooks_context.rb +3 -1
  45. data/lib/cocoapods/installer/user_project_integrator.rb +0 -2
  46. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +38 -28
  47. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +44 -11
  48. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +129 -119
  49. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +25 -16
  50. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +95 -0
  51. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +12 -45
  52. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +277 -169
  53. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +31 -24
  54. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +93 -0
  55. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +60 -69
  56. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +72 -0
  57. data/lib/cocoapods/installer/xcode/target_validator.rb +15 -9
  58. data/lib/cocoapods/project.rb +14 -14
  59. data/lib/cocoapods/resolver.rb +38 -50
  60. data/lib/cocoapods/sandbox.rb +22 -38
  61. data/lib/cocoapods/sandbox/file_accessor.rb +11 -6
  62. data/lib/cocoapods/sandbox/headers_store.rb +9 -8
  63. data/lib/cocoapods/sandbox/path_list.rb +5 -8
  64. data/lib/cocoapods/sources_manager.rb +1 -1
  65. data/lib/cocoapods/target.rb +92 -37
  66. data/lib/cocoapods/target/aggregate_target.rb +140 -84
  67. data/lib/cocoapods/target/build_settings.rb +1076 -0
  68. data/lib/cocoapods/target/pod_target.rb +198 -294
  69. data/lib/cocoapods/user_interface.rb +5 -0
  70. data/lib/cocoapods/validator.rb +133 -41
  71. metadata +18 -18
  72. data/lib/cocoapods/generator/xcconfig.rb +0 -13
  73. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +0 -260
  74. data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +0 -87
  75. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +0 -558
@@ -16,11 +16,11 @@ module Pod
16
16
  # @return [Pathname] The root of the list whose files and directories
17
17
  # are used to perform the matching operations.
18
18
  #
19
- attr_accessor :root
19
+ attr_reader :root
20
20
 
21
21
  # Initialize a new instance
22
22
  #
23
- # @param [Pathname] root The root of the PathList.
23
+ # @param [Pathname] root @see #root
24
24
  #
25
25
  def initialize(root)
26
26
  root_dir = ActiveSupport::Multibyte::Unicode.normalize(root.to_s)
@@ -88,7 +88,8 @@ module Pod
88
88
  # @return [Array<Pathname>]
89
89
  #
90
90
  def glob(patterns, options = {})
91
- relative_glob(patterns, options).map { |p| root.join(p) }
91
+ cache_key = options.merge(:patterns => patterns)
92
+ @glob_cache[cache_key] ||= relative_glob(patterns, options).map { |p| root.join(p) }
92
93
  end
93
94
 
94
95
  # The list of relative paths that are case insensitively matched by a
@@ -115,10 +116,6 @@ module Pod
115
116
  def relative_glob(patterns, options = {})
116
117
  return [] if patterns.empty?
117
118
 
118
- cache_key = options.merge(:patterns => patterns)
119
- cached_value = @glob_cache[cache_key]
120
- return cached_value if cached_value
121
-
122
119
  dir_pattern = options[:dir_pattern]
123
120
  exclude_patterns = options[:exclude_patterns]
124
121
  include_dirs = options[:include_dirs]
@@ -155,7 +152,7 @@ module Pod
155
152
  exclude_options = { :dir_pattern => '**/*', :include_dirs => include_dirs }
156
153
  list -= relative_glob(exclude_patterns, exclude_options)
157
154
  end
158
- @glob_cache[cache_key] = list
155
+ list
159
156
  end
160
157
 
161
158
  #-----------------------------------------------------------------------#
@@ -31,7 +31,7 @@ module Pod
31
31
  "named `#{name}`.\n"
32
32
  message << "(#{e})\n" if Config.instance.verbose?
33
33
  message << 'You can try adding it manually in ' \
34
- '`~/.cocoapods/repos` or via `pod repo add`.'
34
+ "`#{Config.instance.repos_dir}` or via `pod repo add`."
35
35
  raise Informative, message
36
36
  ensure
37
37
  UI.title_level = previous_title_level
@@ -1,3 +1,5 @@
1
+ require 'cocoapods/target/build_settings'
2
+
1
3
  module Pod
2
4
  # Model class which describes a Pods target.
3
5
  #
@@ -7,6 +9,8 @@ module Pod
7
9
  #
8
10
  class Target
9
11
  DEFAULT_VERSION = '1.0.0'.freeze
12
+ DEFAULT_NAME = 'Default'.freeze
13
+ DEFAULT_BUILD_CONFIGURATIONS = { 'Release' => :release, 'Debug' => :debug }.freeze
10
14
 
11
15
  # @return [Sandbox] The sandbox where the Pods should be installed.
12
16
  #
@@ -15,13 +19,43 @@ module Pod
15
19
  # @return [Boolean] Whether the target needs to be implemented as a framework.
16
20
  # Computed by analyzer.
17
21
  #
18
- attr_accessor :host_requires_frameworks
22
+ attr_reader :host_requires_frameworks
19
23
  alias_method :host_requires_frameworks?, :host_requires_frameworks
20
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
+
21
43
  # Initialize a new target
22
44
  #
23
- def initialize
24
- @archs = []
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
25
59
  end
26
60
 
27
61
  # @return [String] the name of the library.
@@ -30,6 +64,40 @@ module Pod
30
64
  label
31
65
  end
32
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
+
33
101
  # @return [String] the name of the product.
34
102
  #
35
103
  def product_name
@@ -85,6 +153,8 @@ module Pod
85
153
 
86
154
  #-------------------------------------------------------------------------#
87
155
 
156
+ # @!group Framework support
157
+
88
158
  # @return [Boolean] whether the generated target needs to be implemented
89
159
  # as a framework
90
160
  #
@@ -92,33 +162,6 @@ module Pod
92
162
  host_requires_frameworks? || false
93
163
  end
94
164
 
95
- # @return [Boolean] Whether the target should build a static framework.
96
- #
97
- def static_framework?
98
- return if is_a?(Pod::AggregateTarget)
99
- return if specs.empty?
100
- specs.all? { |spec| spec.root.static_framework }
101
- end
102
-
103
- #-------------------------------------------------------------------------#
104
-
105
- # @!group Information storage
106
-
107
- # @return [Hash{String=>Symbol}] A hash representing the user build
108
- # configurations where each key corresponds to the name of a
109
- # configuration and its value to its type (`:debug` or `:release`).
110
- #
111
- attr_accessor :user_build_configurations
112
-
113
- # @return [PBXNativeTarget] the target generated in the Pods project for
114
- # this library.
115
- #
116
- attr_accessor :native_target
117
-
118
- # @return [Array<String>] The value for the ARCHS build setting.
119
- #
120
- attr_accessor :archs
121
-
122
165
  #-------------------------------------------------------------------------#
123
166
 
124
167
  # @!group Support files
@@ -153,10 +196,24 @@ module Pod
153
196
  module_map_path.parent + "#{label}-umbrella.h"
154
197
  end
155
198
 
199
+ def umbrella_header_path_to_write
200
+ module_map_path_to_write.parent + "#{label}-umbrella.h"
201
+ end
202
+
156
203
  # @return [Pathname] the absolute path of the LLVM module map file that
157
204
  # defines the module structure for the compiler.
158
205
  #
159
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
160
217
  basename = "#{label}.modulemap"
161
218
  support_files_dir + basename
162
219
  end
@@ -170,7 +227,7 @@ module Pod
170
227
  # @return [Pathname] the absolute path of the Info.plist file.
171
228
  #
172
229
  def info_plist_path
173
- support_files_dir + 'Info.plist'
230
+ support_files_dir + "#{label}-Info.plist"
174
231
  end
175
232
 
176
233
  # @return [Pathname] the path of the dummy source generated by CocoaPods
@@ -179,12 +236,6 @@ module Pod
179
236
  support_files_dir + "#{label}-dummy.m"
180
237
  end
181
238
 
182
- # @return [String] The version associated with this target
183
- #
184
- def version
185
- DEFAULT_VERSION
186
- end
187
-
188
239
  #-------------------------------------------------------------------------#
189
240
 
190
241
  private
@@ -202,5 +253,9 @@ module Pod
202
253
  def c99ext_identifier(name)
203
254
  name.gsub(/^([0-9])/, '_\1').gsub(/[^a-zA-Z0-9_]/, '_')
204
255
  end
256
+
257
+ def create_build_settings
258
+ BuildSettings.new(self)
259
+ end
205
260
  end
206
261
  end
@@ -3,30 +3,109 @@ module Pod
3
3
  # of the single Pods. The client targets will then depend on this one.
4
4
  #
5
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
+
6
10
  # @return [TargetDefinition] the target definition of the Podfile that
7
11
  # generated this target.
12
+ #
8
13
  attr_reader :target_definition
9
14
 
10
- # Product types where the product's frameworks must be embedded in a host target
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.
11
19
  #
12
- EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES = [:app_extension, :framework, :static_library, :messages_extension, :watch_extension, :xpc_service].freeze
20
+ attr_reader :client_root
13
21
 
14
- # Initialize a new instance
22
+ # @return [Xcodeproj::Project] the user project that this target will
23
+ # integrate as identified by the analyzer.
15
24
  #
16
- # @param [TargetDefinition] target_definition @see target_definition
17
- # @param [Sandbox] sandbox @see sandbox
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.
18
41
  #
19
- def initialize(target_definition, sandbox)
20
- raise "Can't initialize an AggregateTarget with an abstract TargetDefinition" if target_definition.abstract?
21
- super()
42
+ attr_reader :xcconfigs
43
+
44
+ # @return [Array<PodTarget>] The dependencies for this target.
45
+ #
46
+ attr_reader :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 [Hash{String=>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?
22
71
  @target_definition = target_definition
23
- @sandbox = sandbox
24
- @pod_targets = []
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
25
77
  @search_paths_aggregate_targets = []
26
- @file_accessors = []
27
78
  @xcconfigs = {}
28
79
  end
29
80
 
81
+ # Merges this aggregate target with additional pod targets that are part of embedded aggregate targets.
82
+ #
83
+ # @param [Hash{String=>Array<PodTarget>}] embedded_pod_targets_for_build_configuration
84
+ # The pod targets to merge with.
85
+ #
86
+ # @return [AggregateTarget] a new instance of this aggregate target with additional pod targets to be used from
87
+ # pod targets of embedded aggregate targets.
88
+ #
89
+ def merge_embedded_pod_targets(embedded_pod_targets_for_build_configuration)
90
+ merged = @pod_targets_for_build_configuration.merge(embedded_pod_targets_for_build_configuration) do |_, before, after|
91
+ (before + after).uniq
92
+ end
93
+ AggregateTarget.new(sandbox, host_requires_frameworks, user_build_configurations, archs, platform,
94
+ target_definition, client_root, user_project, user_target_uuids, merged).tap do |aggregate_target|
95
+ aggregate_target.search_paths_aggregate_targets.concat(search_paths_aggregate_targets).freeze
96
+ end
97
+ end
98
+
99
+ def build_settings(configuration_name = nil)
100
+ if configuration_name
101
+ @build_settings[configuration_name] ||
102
+ raise(ArgumentError, "#{self} does not contain a build setting for the #{configuration_name.inspect} configuration, only #{@build_settings.keys.inspect}")
103
+ else
104
+ @build_settings.each_value.first ||
105
+ raise(ArgumentError, "#{self} does not contain any build settings")
106
+ end
107
+ end
108
+
30
109
  # @return [Boolean] True if the user_target refers to a
31
110
  # library (framework, static or dynamic lib).
32
111
  #
@@ -61,38 +140,12 @@ module Pod
61
140
  target_definition.label.to_s
62
141
  end
63
142
 
64
- # @return [String] the name to use for the source code module constructed
65
- # for this target, and which will be used to import the module in
66
- # implementation source files.
67
- #
68
- def product_module_name
69
- c99ext_identifier(label)
70
- end
71
-
72
- # @return [Platform] the platform for this target.
73
- #
74
- def platform
75
- @platform ||= target_definition.platform
76
- end
77
-
78
143
  # @return [Podfile] The podfile which declares the dependency
79
144
  #
80
145
  def podfile
81
146
  target_definition.podfile
82
147
  end
83
148
 
84
- # @return [Pathname] the folder where the client is stored used for
85
- # computing the relative paths. If integrating it should be the
86
- # folder where the user project is stored, otherwise it should
87
- # be the installation root.
88
- #
89
- attr_accessor :client_root
90
-
91
- # @return [Xcodeproj::Project] the user project that this target will
92
- # integrate as identified by the analyzer.
93
- #
94
- attr_accessor :user_project
95
-
96
149
  # @return [Pathname] the path of the user project that this target will
97
150
  # integrate as identified by the analyzer.
98
151
  #
@@ -100,14 +153,6 @@ module Pod
100
153
  user_project.path if user_project
101
154
  end
102
155
 
103
- # @return [Array<String>] the list of the UUIDs of the user targets that
104
- # will be integrated by this target as identified by the analyzer.
105
- #
106
- # @note The target instances are not stored to prevent editing different
107
- # instances.
108
- #
109
- attr_accessor :user_target_uuids
110
-
111
156
  # List all user targets that will be integrated by this #target.
112
157
  #
113
158
  # @return [Array<PBXNativeTarget>]
@@ -124,24 +169,6 @@ module Pod
124
169
  end
125
170
  end
126
171
 
127
- # @return [Hash<String, Xcodeproj::Config>] Map from configuration name to
128
- # configuration file for the target
129
- #
130
- # @note The configurations are generated by the {TargetInstaller} and
131
- # used by {UserProjectIntegrator} to check for any overridden
132
- # values.
133
- #
134
- attr_reader :xcconfigs
135
-
136
- # @return [Array<PodTarget>] The dependencies for this target.
137
- #
138
- attr_accessor :pod_targets
139
-
140
- # @return [Array<AggregateTarget>] The aggregate targets whose pods this
141
- # target must be able to import, but will not directly link against.
142
- #
143
- attr_reader :search_paths_aggregate_targets
144
-
145
172
  # @param [String] build_configuration The build configuration for which the
146
173
  # the pod targets should be returned.
147
174
  #
@@ -149,14 +176,7 @@ module Pod
149
176
  # configuration.
150
177
  #
151
178
  def pod_targets_for_build_configuration(build_configuration)
152
- @pod_targets_for_build_configuration ||= {}
153
- @pod_targets_for_build_configuration[build_configuration] ||= pod_targets.select do |pod_target|
154
- pod_target.include_in_build_config?(target_definition, build_configuration)
155
- end
156
- end
157
-
158
- def pod_targets_to_link
159
- @pod_targets_to_link ||= pod_targets.to_set - search_paths_aggregate_targets.flat_map(&:pod_targets)
179
+ @pod_targets_for_build_configuration[build_configuration] || []
160
180
  end
161
181
 
162
182
  # @return [Array<Specification>] The specifications used by this aggregate target.
@@ -189,6 +209,19 @@ module Pod
189
209
  pod_targets.any?(&:uses_swift?)
190
210
  end
191
211
 
212
+ # @return [Boolean] Whether the target contains any resources
213
+ #
214
+ def includes_resources?
215
+ !resource_paths_by_config.values.all?(&:empty?)
216
+ end
217
+
218
+ # @return [Boolean] Whether the target contains framework to be embedded into
219
+ # the user target
220
+ #
221
+ def includes_frameworks?
222
+ !framework_paths_by_config.values.all?(&:empty?)
223
+ end
224
+
192
225
  # @return [Hash{String => Array<Hash{Symbol => [String]}>}] The vendored dynamic artifacts and framework target
193
226
  # input and output paths grouped by config
194
227
  #
@@ -197,7 +230,10 @@ module Pod
197
230
  framework_paths_by_config = {}
198
231
  user_build_configurations.keys.each do |config|
199
232
  relevant_pod_targets = pod_targets_for_build_configuration(config)
200
- framework_paths_by_config[config] = relevant_pod_targets.flat_map { |pt| pt.framework_paths(false) }
233
+ framework_paths_by_config[config] = relevant_pod_targets.flat_map do |pod_target|
234
+ non_test_specs = pod_target.non_test_specs.map(&:name)
235
+ pod_target.framework_paths.values_at(*non_test_specs).flatten.compact.uniq
236
+ end
201
237
  end
202
238
  framework_paths_by_config
203
239
  end
@@ -211,8 +247,12 @@ module Pod
211
247
  pod_target.should_build? && pod_target.requires_frameworks? && !pod_target.static_framework?
212
248
  end
213
249
  user_build_configurations.keys.each_with_object({}) do |config, resources_by_config|
214
- resources_by_config[config] = (relevant_pod_targets & pod_targets_for_build_configuration(config)).flat_map do |pod_target|
215
- (pod_target.resource_paths(false) + [bridge_support_file].compact).uniq
250
+ targets = relevant_pod_targets & pod_targets_for_build_configuration(config)
251
+ resources_by_config[config] = targets.flat_map do |pod_target|
252
+ non_test_specs = pod_target.non_test_specs.map(&:name)
253
+ resource_paths = pod_target.resource_paths.values_at(*non_test_specs).flatten
254
+ resource_paths << bridge_support_file
255
+ resource_paths.compact.uniq
216
256
  end
217
257
  end
218
258
  end
@@ -256,11 +296,17 @@ module Pod
256
296
  "$(DERIVED_FILE_DIR)/#{label}-checkManifestLockResult.txt"
257
297
  end
258
298
 
299
+ # @return [Pathname] The relative path of the Pods directory from user project's directory.
300
+ #
301
+ def relative_pods_root_path
302
+ sandbox.root.relative_path_from(client_root)
303
+ end
304
+
259
305
  # @return [String] The xcconfig path of the root from the `$(SRCROOT)`
260
306
  # variable of the user's project.
261
307
  #
262
308
  def relative_pods_root
263
- "${SRCROOT}/#{sandbox.root.relative_path_from(client_root)}"
309
+ "${SRCROOT}/#{relative_pods_root_path}"
264
310
  end
265
311
 
266
312
  # @return [String] The path of the Podfile directory relative to the
@@ -278,21 +324,21 @@ module Pod
278
324
  # the user project.
279
325
  #
280
326
  def xcconfig_relative_path(config_name)
281
- relative_to_srcroot(xcconfig_path(config_name)).to_s
327
+ xcconfig_path(config_name).relative_path_from(client_root).to_s
282
328
  end
283
329
 
284
330
  # @return [String] The path of the copy resources script relative to the
285
- # root of the user project.
331
+ # root of the Pods project.
286
332
  #
287
333
  def copy_resources_script_relative_path
288
- "${SRCROOT}/#{relative_to_srcroot(copy_resources_script_path)}"
334
+ "${PODS_ROOT}/#{relative_to_pods_root(copy_resources_script_path)}"
289
335
  end
290
336
 
291
337
  # @return [String] The path of the embed frameworks relative to the
292
- # root of the user project.
338
+ # root of the Pods project.
293
339
  #
294
340
  def embed_frameworks_script_relative_path
295
- "${SRCROOT}/#{relative_to_srcroot(embed_frameworks_script_path)}"
341
+ "${PODS_ROOT}/#{relative_to_pods_root(embed_frameworks_script_path)}"
296
342
  end
297
343
 
298
344
  private
@@ -300,16 +346,26 @@ module Pod
300
346
  # @!group Private Helpers
301
347
  #-------------------------------------------------------------------------#
302
348
 
303
- # Computes the relative path of a sandboxed file from the `$(SRCROOT)`
304
- # variable of the user's project.
349
+ # Computes the relative path of a sandboxed file from the `$(PODS_ROOT)`
350
+ # variable of the Pods's project.
305
351
  #
306
352
  # @param [Pathname] path
307
353
  # A relative path from the root of the sandbox.
308
354
  #
309
355
  # @return [String] The computed path.
310
356
  #
311
- def relative_to_srcroot(path)
312
- path.relative_path_from(client_root).to_s
357
+ def relative_to_pods_root(path)
358
+ path.relative_path_from(sandbox.root).to_s
359
+ end
360
+
361
+ def create_build_settings
362
+ settings = {}
363
+
364
+ user_build_configurations.each_key do |configuration_name|
365
+ settings[configuration_name] = BuildSettings::AggregateTargetSettings.new(self, configuration_name)
366
+ end
367
+
368
+ settings
313
369
  end
314
370
  end
315
371
  end