cocoapods 1.5.2 → 1.6.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 (81) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +365 -1
  3. data/bin/pod +1 -1
  4. data/lib/cocoapods/command/cache/clean.rb +1 -1
  5. data/lib/cocoapods/command/init.rb +4 -2
  6. data/lib/cocoapods/command/install.rb +7 -0
  7. data/lib/cocoapods/command/lib/lint.rb +8 -1
  8. data/lib/cocoapods/command/outdated.rb +4 -9
  9. data/lib/cocoapods/command/repo/add.rb +1 -1
  10. data/lib/cocoapods/command/repo/list.rb +1 -1
  11. data/lib/cocoapods/command/repo/push.rb +17 -12
  12. data/lib/cocoapods/command/repo/remove.rb +1 -1
  13. data/lib/cocoapods/command/repo/update.rb +1 -1
  14. data/lib/cocoapods/command/setup.rb +1 -1
  15. data/lib/cocoapods/command/spec/create.rb +39 -39
  16. data/lib/cocoapods/command/spec/lint.rb +8 -1
  17. data/lib/cocoapods/command.rb +3 -1
  18. data/lib/cocoapods/config.rb +13 -2
  19. data/lib/cocoapods/downloader/cache.rb +1 -1
  20. data/lib/cocoapods/executable.rb +3 -3
  21. data/lib/cocoapods/external_sources/abstract_external_source.rb +23 -13
  22. data/lib/cocoapods/external_sources.rb +7 -4
  23. data/lib/cocoapods/gem_version.rb +1 -1
  24. data/lib/cocoapods/generator/acknowledgements/markdown.rb +6 -0
  25. data/lib/cocoapods/generator/acknowledgements/plist.rb +13 -2
  26. data/lib/cocoapods/generator/app_target_helper.rb +141 -17
  27. data/lib/cocoapods/generator/copy_resources_script.rb +14 -3
  28. data/lib/cocoapods/generator/dummy_source.rb +14 -5
  29. data/lib/cocoapods/generator/embed_frameworks_script.rb +37 -20
  30. data/lib/cocoapods/generator/header.rb +1 -1
  31. data/lib/cocoapods/generator/info_plist_file.rb +12 -4
  32. data/lib/cocoapods/generator/prefix_header.rb +2 -2
  33. data/lib/cocoapods/hooks_manager.rb +28 -17
  34. data/lib/cocoapods/installer/analyzer/analysis_result.rb +52 -22
  35. data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +14 -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 +27 -14
  40. data/lib/cocoapods/installer/analyzer/target_inspector.rb +17 -11
  41. data/lib/cocoapods/installer/analyzer.rb +391 -284
  42. data/lib/cocoapods/installer/installation_options.rb +2 -0
  43. data/lib/cocoapods/installer/pod_source_installer.rb +31 -43
  44. data/lib/cocoapods/installer/post_install_hooks_context.rb +72 -47
  45. data/lib/cocoapods/installer/pre_install_hooks_context.rb +22 -13
  46. data/lib/cocoapods/installer/source_provider_hooks_context.rb +3 -1
  47. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +44 -11
  48. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +69 -29
  49. data/lib/cocoapods/installer/user_project_integrator.rb +6 -4
  50. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +25 -16
  51. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +104 -0
  52. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +23 -50
  53. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +296 -177
  54. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +51 -33
  55. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +93 -0
  56. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +62 -69
  57. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +72 -0
  58. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +130 -122
  59. data/lib/cocoapods/installer/xcode/target_validator.rb +15 -9
  60. data/lib/cocoapods/installer.rb +140 -63
  61. data/lib/cocoapods/project.rb +16 -14
  62. data/lib/cocoapods/resolver/resolver_specification.rb +41 -0
  63. data/lib/cocoapods/resolver.rb +79 -98
  64. data/lib/cocoapods/sandbox/file_accessor.rb +11 -6
  65. data/lib/cocoapods/sandbox/headers_store.rb +9 -8
  66. data/lib/cocoapods/sandbox/path_list.rb +5 -8
  67. data/lib/cocoapods/sandbox.rb +31 -43
  68. data/lib/cocoapods/sources_manager.rb +1 -1
  69. data/lib/cocoapods/target/aggregate_target.rb +143 -85
  70. data/lib/cocoapods/target/build_settings.rb +1124 -0
  71. data/lib/cocoapods/target/framework_paths.rb +36 -0
  72. data/lib/cocoapods/target/pod_target.rb +198 -295
  73. data/lib/cocoapods/target.rb +92 -37
  74. data/lib/cocoapods/user_interface.rb +5 -0
  75. data/lib/cocoapods/validator.rb +149 -44
  76. data/lib/cocoapods.rb +0 -1
  77. metadata +31 -23
  78. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +0 -260
  79. data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +0 -87
  80. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +0 -558
  81. data/lib/cocoapods/generator/xcconfig.rb +0 -13
@@ -8,21 +8,21 @@ module Pod
8
8
  class AggregateTargetInstaller < TargetInstaller
9
9
  # Creates the target in the Pods project and the relative support files.
10
10
  #
11
- # @return [void]
11
+ # @return [TargetInstallationResult] the result of the installation of this target.
12
12
  #
13
13
  def install!
14
14
  UI.message "- Installing target `#{target.name}` #{target.platform}" do
15
- add_target
15
+ native_target = add_target
16
16
  create_support_files_dir
17
17
  create_support_files_group
18
- create_xcconfig_file
18
+ create_xcconfig_file(native_target)
19
19
  if target.requires_frameworks?
20
20
  create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
21
- create_module_map
22
- create_umbrella_header
21
+ create_module_map(native_target)
22
+ create_umbrella_header(native_target)
23
23
  elsif target.uses_swift?
24
- create_module_map
25
- create_umbrella_header
24
+ create_module_map(native_target)
25
+ create_umbrella_header(native_target)
26
26
  end
27
27
  # Because embedded targets live in their host target, CocoaPods
28
28
  # copies all of the embedded target's pod_targets to its host
@@ -30,11 +30,13 @@ module Pod
30
30
  # cause an App Store rejection because frameworks cannot be
31
31
  # embedded in embedded targets.
32
32
  #
33
- create_embed_frameworks_script unless target.requires_host_target?
34
- create_bridge_support_file
35
- create_copy_resources_script
33
+ create_embed_frameworks_script if target.includes_frameworks? && !target.requires_host_target?
34
+ create_bridge_support_file(native_target)
35
+ create_copy_resources_script if target.includes_resources?
36
36
  create_acknowledgements
37
- create_dummy_source
37
+ create_dummy_source(native_target)
38
+ clean_support_files_temp_dir
39
+ TargetInstallationResult.new(target, native_target)
38
40
  end
39
41
  end
40
42
 
@@ -87,14 +89,18 @@ module Pod
87
89
 
88
90
  # Generates the contents of the xcconfig file and saves it to disk.
89
91
  #
92
+ # @param [PBXNativeTarget] native_target
93
+ # the native target to link the module map file into.
94
+ #
90
95
  # @return [void]
91
96
  #
92
- def create_xcconfig_file
97
+ def create_xcconfig_file(native_target)
93
98
  native_target.build_configurations.each do |configuration|
99
+ next unless target.user_build_configurations.key?(configuration.name)
94
100
  path = target.xcconfig_path(configuration.name)
95
- gen = Generator::XCConfig::AggregateXCConfig.new(target, configuration.name)
96
- update_changed_file(gen, path)
97
- target.xcconfigs[configuration.name] = gen.xcconfig
101
+ build_settings = target.build_settings(configuration.name)
102
+ update_changed_file(build_settings, path)
103
+ target.xcconfigs[configuration.name] = build_settings.xcconfig
98
104
  xcconfig_file_ref = add_file_to_support_group(path)
99
105
  configuration.base_configuration_reference = xcconfig_file_ref
100
106
  end
@@ -106,9 +112,12 @@ module Pod
106
112
  # target because it is needed for environments interpreted at
107
113
  # runtime.
108
114
  #
115
+ # @param [PBXNativeTarget] native_target
116
+ # the native target to add the bridge support file into.
117
+ #
109
118
  # @return [void]
110
119
  #
111
- def create_bridge_support_file
120
+ def create_bridge_support_file(native_target)
112
121
  if target.podfile.generate_bridge_support?
113
122
  path = target.bridge_support_path
114
123
  headers = native_target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path }
@@ -0,0 +1,104 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ class PodsProjectGenerator
5
+ # Installs an app host target to a given project.
6
+ #
7
+ class AppHostInstaller
8
+ include TargetInstallerHelper
9
+
10
+ # @return [Sandbox]
11
+ # The sandbox used for this installation.
12
+ #
13
+ attr_reader :sandbox
14
+
15
+ # @return [Pod::Project]
16
+ # The `Pods/Pods.xcodeproj` to install the app host into.
17
+ #
18
+ attr_reader :project
19
+
20
+ # @return [Platform] the platform to use for this app host.
21
+ #
22
+ attr_reader :platform
23
+
24
+ # @return [String] the name to use for this app host target.
25
+ #
26
+ attr_reader :name
27
+
28
+ # @return [String] the name of the pod the app host installer will be installing within.
29
+ #
30
+ attr_reader :pod_name
31
+
32
+ # Initialize a new instance
33
+ #
34
+ # @param [Sandbox] sandbox @see #sandbox
35
+ # @param [Pod::Project] project @see #project
36
+ # @param [Platform] platform @see #platform
37
+ # @param [String] name @see #name
38
+ # @param [String] pod_name @see #pod_name
39
+ #
40
+ def initialize(sandbox, project, platform, name, pod_name)
41
+ @sandbox = sandbox
42
+ @project = project
43
+ @platform = platform
44
+ @name = name
45
+ @pod_name = pod_name
46
+ target_group = project.pod_group(pod_name)
47
+ @group = target_group[name] || target_group.new_group(name)
48
+ end
49
+
50
+ # @return [PBXNativeTarget] the app host native target that was installed.
51
+ #
52
+ def install!
53
+ platform_name = platform.name
54
+ app_host_target = Pod::Generator::AppTargetHelper.add_app_target(project, platform_name, deployment_target,
55
+ name)
56
+ app_host_target.build_configurations.each do |configuration|
57
+ configuration.build_settings['PRODUCT_NAME'] = name
58
+ configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}'
59
+ configuration.build_settings['CODE_SIGN_IDENTITY'] = '' if platform == :osx
60
+ configuration.build_settings['CURRENT_PROJECT_VERSION'] = '1'
61
+ end
62
+
63
+ Pod::Generator::AppTargetHelper.add_app_host_main_file(project, app_host_target, platform_name, @group, name)
64
+ Pod::Generator::AppTargetHelper.add_launchscreen_storyboard(project, app_host_target, @group, deployment_target, name) if platform == :ios
65
+ additional_entries = platform == :ios ? ADDITIONAL_IOS_INFO_PLIST_ENTRIES : {}
66
+ create_info_plist_file_with_sandbox(sandbox, app_host_info_plist_path, app_host_target, '1.0.0', platform,
67
+ :appl, additional_entries)
68
+ @group.new_file(app_host_info_plist_path)
69
+ app_host_target
70
+ end
71
+
72
+ private
73
+
74
+ ADDITIONAL_IOS_INFO_PLIST_ENTRIES = {
75
+ 'UILaunchStoryboardName' => 'LaunchScreen',
76
+ 'UISupportedInterfaceOrientations' => %w(
77
+ UIInterfaceOrientationPortrait
78
+ UIInterfaceOrientationLandscapeLeft
79
+ UIInterfaceOrientationLandscapeRight
80
+ ),
81
+ 'UISupportedInterfaceOrientations~ipad' => %w(
82
+ UIInterfaceOrientationPortrait
83
+ UIInterfaceOrientationPortraitUpsideDown
84
+ UIInterfaceOrientationLandscapeLeft
85
+ UIInterfaceOrientationLandscapeRight
86
+ ),
87
+ }.freeze
88
+
89
+ # @return [Pathname] The absolute path of the Info.plist to use for an app host.
90
+ #
91
+ def app_host_info_plist_path
92
+ project.path.dirname.+(name).+("#{name}-Info.plist")
93
+ end
94
+
95
+ # @return [String] The deployment target.
96
+ #
97
+ def deployment_target
98
+ platform.deployment_target.to_s
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
@@ -18,16 +18,22 @@ module Pod
18
18
  #
19
19
  attr_reader :pods_project
20
20
 
21
+ # @return [Bool] add support for preserving the file structure of externally sourced pods, in addition to local pods.
22
+ #
23
+ attr_reader :preserve_pod_file_structure
24
+
21
25
  # Initialize a new instance
22
26
  #
23
- # @param [Sandbox] sandbox @see sandbox
24
- # @param [Array<PodTarget>] pod_targets @see pod_targets
25
- # @param [Project] pods_project @see pod_project
27
+ # @param [Sandbox] sandbox @see #sandbox
28
+ # @param [Array<PodTarget>] pod_targets @see #pod_targets
29
+ # @param [Project] pods_project @see #pods_project
30
+ # @param [Bool] preserve_pod_file_structure @see #preserve_pod_file_structure
26
31
  #
27
- def initialize(sandbox, pod_targets, pods_project)
32
+ def initialize(sandbox, pod_targets, pods_project, preserve_pod_file_structure = false)
28
33
  @sandbox = sandbox
29
34
  @pod_targets = pod_targets
30
35
  @pods_project = pods_project
36
+ @preserve_pod_file_structure = preserve_pod_file_structure
31
37
  end
32
38
 
33
39
  # Installs the file references.
@@ -115,8 +121,9 @@ module Pod
115
121
  next unless sandbox.local?(pod_name)
116
122
  root_name = Specification.root_name(pod_name)
117
123
  paths = file_accessor.developer_files
124
+ next if paths.empty?
125
+ group = pods_project.group_for_spec(root_name, :developer)
118
126
  paths.each do |path|
119
- group = pods_project.group_for_spec(root_name, :developer)
120
127
  ref = pods_project.add_file_reference(path, group, false)
121
128
  if path.extname == '.podspec'
122
129
  pods_project.mark_ruby_file_ref(ref)
@@ -143,7 +150,8 @@ module Pod
143
150
  added_build_headers = false
144
151
  added_public_headers = false
145
152
 
146
- pod_target.file_accessors.each do |file_accessor|
153
+ file_accessors = pod_target.file_accessors.reject { |fa| fa.spec.test_specification? }
154
+ file_accessors.each do |file_accessor|
147
155
  # Private headers will always end up in Pods/Headers/Private/PodA/*.h
148
156
  # This will allow for `""` imports to work.
149
157
  header_mappings(headers_sandbox, file_accessor, file_accessor.headers).each do |namespaced_path, files|
@@ -157,13 +165,6 @@ module Pod
157
165
  added_public_headers = true
158
166
  sandbox.public_headers.add_files(namespaced_path, files)
159
167
  end
160
-
161
- unless pod_target.requires_frameworks?
162
- vendored_frameworks_header_mappings(headers_sandbox, file_accessor).each do |namespaced_path, files|
163
- added_public_headers = true
164
- sandbox.public_headers.add_files(namespaced_path, files)
165
- end
166
- end
167
168
  end
168
169
 
169
170
  pod_target.build_headers.add_search_path(headers_sandbox, pod_target.platform) if added_build_headers
@@ -195,22 +196,24 @@ module Pod
195
196
  # @param [Symbol] group_key
196
197
  # The key of the group of the Pods project.
197
198
  #
198
- # @param [Bool] reflect_file_system_structure_for_development
199
+ # @param [Bool] reflect_file_system_structure
199
200
  # Whether organizing a local pod's files in subgroups inside
200
201
  # the pod's group is allowed.
201
202
  #
202
203
  # @return [void]
203
204
  #
204
- def add_file_accessors_paths_to_pods_group(file_accessor_key, group_key = nil, reflect_file_system_structure_for_development = false)
205
+ def add_file_accessors_paths_to_pods_group(file_accessor_key, group_key = nil, reflect_file_system_structure = false)
205
206
  file_accessors.each do |file_accessor|
206
- pod_name = file_accessor.spec.name
207
- local = sandbox.local?(pod_name)
208
207
  paths = file_accessor.send(file_accessor_key)
209
208
  paths = allowable_project_paths(paths)
210
- base_path = local ? common_path(paths) : nil
209
+ next if paths.empty?
210
+
211
+ pod_name = file_accessor.spec.name
212
+ preserve_pod_file_structure_flag = (sandbox.local?(pod_name) || preserve_pod_file_structure)
213
+ base_path = preserve_pod_file_structure_flag ? common_path(paths) : nil
214
+ group = pods_project.group_for_spec(pod_name, group_key)
211
215
  paths.each do |path|
212
- group = pods_project.group_for_spec(pod_name, group_key)
213
- pods_project.add_file_reference(path, group, local && reflect_file_system_structure_for_development, base_path)
216
+ pods_project.add_file_reference(path, group, preserve_pod_file_structure_flag && reflect_file_system_structure, base_path)
214
217
  end
215
218
  end
216
219
  end
@@ -329,36 +332,6 @@ module Pod
329
332
  mappings
330
333
  end
331
334
 
332
- # Computes the destination sub-directory in the sandbox for headers
333
- # from inside vendored frameworks.
334
- #
335
- # @param [Pathname] headers_sandbox
336
- # The sandbox where the header links should be stored for this
337
- # Pod.
338
- #
339
- # @param [Sandbox::FileAccessor] file_accessor
340
- # The consumer file accessor for which the headers need to be
341
- # linked.
342
- #
343
- def vendored_frameworks_header_mappings(headers_sandbox, file_accessor)
344
- mappings = {}
345
- file_accessor.vendored_frameworks.each do |framework|
346
- headers_dir = Sandbox::FileAccessor.vendored_frameworks_headers_dir(framework)
347
- headers = Sandbox::FileAccessor.vendored_frameworks_headers(framework)
348
- framework_name = framework.basename(framework.extname)
349
- dir = headers_sandbox + framework_name
350
- headers.each do |header|
351
- # the relative path of framework headers should be kept,
352
- # not flattened like is done for most public headers.
353
- relative_path = header.relative_path_from(headers_dir)
354
- sub_dir = dir + relative_path.dirname
355
- mappings[sub_dir] ||= []
356
- mappings[sub_dir] << header
357
- end
358
- end
359
- mappings
360
- end
361
-
362
335
  #-----------------------------------------------------------------------#
363
336
  end
364
337
  end