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
@@ -38,26 +38,46 @@ module Pod
38
38
  # @param [Symbol] platform
39
39
  # the platform of the target. Can be `:ios` or `:osx`, etc.
40
40
  #
41
- # @param [Boolean] use_frameworks
42
- # whether to use frameworks or not when generating the contents of the import file.
43
- #
44
41
  # @param [String] name
45
42
  # The name to use for the target, defaults to 'App'.
46
43
  #
47
44
  # @return [Array<PBXBuildFile>] the created build file references.
48
45
  #
49
- def self.add_app_project_import(project, target, pod_target, platform, use_frameworks, name = 'App')
50
- source_file = AppTargetHelper.create_app_import_source_file(project, pod_target, platform, use_frameworks, name)
51
- source_file_ref = project.new_group(name, name).new_file(source_file)
46
+ def self.add_app_project_import(project, target, pod_target, platform, name = 'App')
47
+ source_file = AppTargetHelper.create_app_import_source_file(project, pod_target, platform, name)
48
+ group = project[name] || project.new_group(name, name)
49
+ source_file_ref = group.new_file(source_file)
52
50
  target.add_file_references([source_file_ref])
53
51
  end
54
52
 
55
- # Creates and links a default app host 'main.m' file.
53
+ # Creates and links an empty Swift file for the given target.
56
54
  #
57
55
  # @param [Project] project
58
56
  # the Xcodeproj to generate the target into.
59
57
  #
60
58
  # @param [PBXNativeTarget] target
59
+ # the native target to link the generated import file into.
60
+ #
61
+ # @param [String] name
62
+ # The name to use for the target, defaults to 'App'.
63
+ #
64
+ # @return [Array<PBXBuildFile>] the created build file references.
65
+ #
66
+ def self.add_empty_swift_file(project, target, name = 'App')
67
+ swift_file = project.path.dirname.+("#{name}/dummy.swift")
68
+ swift_file.parent.mkpath
69
+ File.write(swift_file, '')
70
+ group = project[name] || project.new_group(name, name)
71
+ swift_file_ref = group.new_file(swift_file)
72
+ target.add_file_references([swift_file_ref])
73
+ end
74
+
75
+ # Creates and links a default app host 'main.m' file.
76
+ #
77
+ # @param [Project] project
78
+ # the Xcodeproj to generate the main file into.
79
+ #
80
+ # @param [PBXNativeTarget] target
61
81
  # the native target to link the generated main file into.
62
82
  #
63
83
  # @param [Symbol] platform
@@ -68,12 +88,37 @@ module Pod
68
88
  #
69
89
  # @return [Array<PBXBuildFile>] the created build file references.
70
90
  #
71
- def self.add_app_host_main_file(project, target, platform, name = 'App')
91
+ def self.add_app_host_main_file(project, target, platform, group, name = 'App')
72
92
  source_file = AppTargetHelper.create_app_host_main_file(project, platform, name)
73
- source_file_ref = project.new_group(name, name).new_file(source_file)
93
+ source_file_ref = group.new_file(source_file)
74
94
  target.add_file_references([source_file_ref])
75
95
  end
76
96
 
97
+ # Creates a default launchscreen storyboard.
98
+ #
99
+ # @param [Project] project
100
+ # the Xcodeproj to generate the launchscreen storyboard into.
101
+ #
102
+ # @param [PBXNativeTarget] target
103
+ # the native target to link the generated launchscreen storyboard into.
104
+ #
105
+ # @param [Symbol] platform
106
+ # the platform of the target. Can be `:ios` or `:osx`, etc.
107
+ #
108
+ # @param [String] deployment_target
109
+ # the deployment target for the platform.
110
+ #
111
+ # @param [String] name
112
+ # The name to use for the target, defaults to 'App'.
113
+ #
114
+ # @return [PBXFileReference] the created file reference of the launchscreen storyboard.
115
+ #
116
+ def self.add_launchscreen_storyboard(project, target, group, deployment_target, name = 'App')
117
+ launch_storyboard_file = AppTargetHelper.create_launchscreen_storyboard_file(project, deployment_target, name)
118
+ launch_storyboard_ref = group.new_file(launch_storyboard_file)
119
+ target.resources_build_phase.add_file_reference(launch_storyboard_ref)
120
+ end
121
+
77
122
  # Adds the xctest framework search paths into the given target.
78
123
  #
79
124
  # @param [PBXNativeTarget] target
@@ -116,26 +161,23 @@ module Pod
116
161
  # @param [Symbol] platform
117
162
  # the platform of the target. Can be `:ios` or `:osx`, etc.
118
163
  #
119
- # @param [Boolean] use_frameworks
120
- # whether to use frameworks or not when generating the contents of the import file.
121
- #
122
164
  # @param [String] name
123
165
  # The name of the folder to use and save the generated main file.
124
166
  #
125
167
  # @return [Pathname] the new source file that was generated.
126
168
  #
127
- def self.create_app_import_source_file(project, pod_target, platform, use_frameworks, name = 'App')
169
+ def self.create_app_import_source_file(project, pod_target, platform, name = 'App')
128
170
  language = pod_target.uses_swift? ? :swift : :objc
129
171
 
130
172
  if language == :swift
131
173
  source_file = project.path.dirname.+("#{name}/main.swift")
132
174
  source_file.parent.mkpath
133
- import_statement = use_frameworks && pod_target.should_build? ? "import #{pod_target.product_module_name}\n" : ''
175
+ import_statement = pod_target.should_build? && pod_target.defines_module? ? "import #{pod_target.product_module_name}\n" : ''
134
176
  source_file.open('w') { |f| f << import_statement }
135
177
  else
136
178
  source_file = project.path.dirname.+("#{name}/main.m")
137
179
  source_file.parent.mkpath
138
- import_statement = if use_frameworks && pod_target.should_build?
180
+ import_statement = if pod_target.should_build? && pod_target.defines_module?
139
181
  "@import #{pod_target.product_module_name};\n"
140
182
  else
141
183
  header_name = "#{pod_target.product_module_name}/#{pod_target.product_module_name}.h"
@@ -155,6 +197,30 @@ module Pod
155
197
  source_file
156
198
  end
157
199
 
200
+ # Creates a default launchscreen storyboard file.
201
+ #
202
+ # @param [Project] project
203
+ # the Xcodeproj to generate the launchscreen storyboard into.
204
+ #
205
+ # @param [String] deployment_target
206
+ # the deployment target for the platform.
207
+ #
208
+ # @param [String] name
209
+ # The name of the folder to use and save the generated launchscreen storyboard file.
210
+ #
211
+ # @return [Pathname] the new launchscreen storyboard file that was generated.
212
+ #
213
+ def self.create_launchscreen_storyboard_file(project, deployment_target, name = 'App')
214
+ launch_storyboard_file = project.path.dirname.+("#{name}/LaunchScreen.storyboard")
215
+ launch_storyboard_file.parent.mkpath
216
+ if Version.new(deployment_target) >= Version.new('9.0')
217
+ File.write(launch_storyboard_file, LAUNCHSCREEN_STORYBOARD_CONTENTS)
218
+ else
219
+ File.write(launch_storyboard_file, LAUNCHSCREEN_STORYBOARD_CONTENTS_IOS_8)
220
+ end
221
+ launch_storyboard_file
222
+ end
223
+
158
224
  # Creates a default app host 'main.m' file.
159
225
  #
160
226
  # @param [Project] project
@@ -176,7 +242,7 @@ module Pod
176
242
  when :ios, :tvos
177
243
  f << IOS_APP_HOST_MAIN_CONTENTS
178
244
  when :osx
179
- f << MACOS_APP_APP_HOST_MAIN_CONTENTS
245
+ f << MACOS_APP_HOST_MAIN_CONTENTS
180
246
  end
181
247
  end
182
248
  source_file
@@ -215,13 +281,71 @@ int main(int argc, char *argv[])
215
281
  }
216
282
  EOS
217
283
 
218
- MACOS_APP_APP_HOST_MAIN_CONTENTS = <<EOS.freeze
284
+ MACOS_APP_HOST_MAIN_CONTENTS = <<EOS.freeze
219
285
  #import <Cocoa/Cocoa.h>
220
286
 
221
287
  int main(int argc, const char * argv[]) {
222
288
  return NSApplicationMain(argc, argv);
223
289
  }
224
290
  EOS
291
+
292
+ LAUNCHSCREEN_STORYBOARD_CONTENTS_IOS_8 = <<-XML.strip_heredoc.freeze
293
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
294
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
295
+ <dependencies>
296
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
297
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
298
+ </dependencies>
299
+ <scenes>
300
+ <!--View Controller-->
301
+ <scene sceneID="EHf-IW-A2E">
302
+ <objects>
303
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
304
+ <layoutGuides>
305
+ <viewControllerLayoutGuide type="top" id="rUq-ht-380"/>
306
+ <viewControllerLayoutGuide type="bottom" id="a9l-8d-mfx"/>
307
+ </layoutGuides>
308
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
309
+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
310
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
311
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
312
+ </view>
313
+ </viewController>
314
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
315
+ </objects>
316
+ <point key="canvasLocation" x="53" y="375"/>
317
+ </scene>
318
+ </scenes>
319
+ </document>
320
+ XML
321
+
322
+ LAUNCHSCREEN_STORYBOARD_CONTENTS = <<-XML.strip_heredoc.freeze
323
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
324
+ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
325
+ <dependencies>
326
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
327
+ <capability name="Safe area layout guides" minToolsVersion="9.0"/>
328
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
329
+ </dependencies>
330
+ <scenes>
331
+ <!--View Controller-->
332
+ <scene sceneID="EHf-IW-A2E">
333
+ <objects>
334
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
335
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
336
+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
337
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
338
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
339
+ <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
340
+ </view>
341
+ </viewController>
342
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
343
+ </objects>
344
+ <point key="canvasLocation" x="53" y="375"/>
345
+ </scene>
346
+ </scenes>
347
+ </document>
348
+ XML
225
349
  end
226
350
  end
227
351
  end
@@ -38,6 +38,12 @@ module Pod
38
38
  File.chmod(0755, pathname.to_s)
39
39
  end
40
40
 
41
+ # @return [String] The contents of the copy resources script.
42
+ #
43
+ def generate
44
+ script
45
+ end
46
+
41
47
  private
42
48
 
43
49
  # @!group Private Helpers
@@ -99,10 +105,15 @@ set -e
99
105
  set -u
100
106
  set -o pipefail
101
107
 
108
+ function on_error {
109
+ echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
110
+ }
111
+ trap 'on_error $LINENO' ERR
112
+
102
113
  if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
103
- # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy
104
- # resources to, so exit 0 (signalling the script phase was successful).
105
- exit 0
114
+ # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy
115
+ # resources to, so exit 0 (signalling the script phase was successful).
116
+ exit 0
106
117
  fi
107
118
 
108
119
  mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
@@ -8,13 +8,22 @@ module Pod
8
8
  @class_name = "PodsDummy_#{validated_class_name_identifier}"
9
9
  end
10
10
 
11
+ # @return [String] the string contents of the dummy source file.
12
+ #
13
+ def generate
14
+ result = <<-source.strip_heredoc
15
+ #import <Foundation/Foundation.h>
16
+ @interface #{class_name} : NSObject
17
+ @end
18
+ @implementation #{class_name}
19
+ @end
20
+ source
21
+ result
22
+ end
23
+
11
24
  def save_as(pathname)
12
25
  pathname.open('w') do |source|
13
- source.puts '#import <Foundation/Foundation.h>'
14
- source.puts "@interface #{class_name} : NSObject"
15
- source.puts '@end'
16
- source.puts "@implementation #{class_name}"
17
- source.puts '@end'
26
+ source.write(generate)
18
27
  end
19
28
  end
20
29
  end
@@ -1,12 +1,14 @@
1
+ require 'cocoapods/target/framework_paths'
2
+
1
3
  module Pod
2
4
  module Generator
3
5
  class EmbedFrameworksScript
4
- # @return [Hash{String => Array<String>}] Multiple lists of frameworks per
6
+ # @return [Hash{String => Array<FrameworkPaths>}] Multiple lists of frameworks per
5
7
  # configuration.
6
8
  #
7
9
  attr_reader :frameworks_by_config
8
10
 
9
- # @param [Hash{String => Array<String>] frameworks_by_config
11
+ # @param [Hash{String => Array<FrameworkPaths>] frameworks_by_config
10
12
  # @see #frameworks_by_config
11
13
  #
12
14
  def initialize(frameworks_by_config)
@@ -27,6 +29,12 @@ module Pod
27
29
  File.chmod(0755, pathname.to_s)
28
30
  end
29
31
 
32
+ # @return [String] The contents of the embed frameworks script.
33
+ #
34
+ def generate
35
+ script
36
+ end
37
+
30
38
  private
31
39
 
32
40
  # @!group Private Helpers
@@ -40,10 +48,15 @@ module Pod
40
48
  set -u
41
49
  set -o pipefail
42
50
 
51
+ function on_error {
52
+ echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
53
+ }
54
+ trap 'on_error $LINENO' ERR
55
+
43
56
  if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
44
- # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
45
- # frameworks to, so exit 0 (signalling the script phase was successful).
46
- exit 0
57
+ # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
58
+ # frameworks to, so exit 0 (signalling the script phase was successful).
59
+ exit 0
47
60
  fi
48
61
 
49
62
  echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
@@ -73,8 +86,8 @@ module Pod
73
86
  local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
74
87
 
75
88
  if [ -L "${source}" ]; then
76
- echo "Symlinked..."
77
- source="$(readlink "${source}")"
89
+ echo "Symlinked..."
90
+ source="$(readlink "${source}")"
78
91
  fi
79
92
 
80
93
  # Use filter instead of exclude so missing patterns don't throw errors.
@@ -84,8 +97,13 @@ module Pod
84
97
  local basename
85
98
  basename="$(basename -s .framework "$1")"
86
99
  binary="${destination}/${basename}.framework/${basename}"
100
+
87
101
  if ! [ -r "$binary" ]; then
88
102
  binary="${destination}/${basename}"
103
+ elif [ -L "${binary}" ]; then
104
+ echo "Destination binary is symlinked..."
105
+ dirname="$(dirname "${binary}")"
106
+ binary="${dirname}/$(readlink "${binary}")"
89
107
  fi
90
108
 
91
109
  # Strip invalid architectures so "fat" simulator / device frameworks work on device
@@ -99,7 +117,7 @@ module Pod
99
117
  # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
100
118
  if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
101
119
  local swift_runtime_libs
102
- swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u && exit ${PIPESTATUS[0]})
120
+ swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u)
103
121
  for lib in $swift_runtime_libs; do
104
122
  echo "rsync -auv \\"${SWIFT_STDLIB_PATH}/${lib}\\" \\"${destination}\\""
105
123
  rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
@@ -138,8 +156,8 @@ module Pod
138
156
 
139
157
  # Signs a framework with the provided identity
140
158
  code_sign_if_enabled() {
141
- if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
142
- # Use the current code_sign_identitiy
159
+ if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
160
+ # Use the current code_sign_identity
143
161
  echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
144
162
  local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
145
163
 
@@ -168,7 +186,7 @@ module Pod
168
186
  for arch in $binary_archs; do
169
187
  if ! [[ "${ARCHS}" == *"$arch"* ]]; then
170
188
  # Strip non-valid architectures in-place
171
- lipo -remove "$arch" -output "$binary" "$binary" || exit 1
189
+ lipo -remove "$arch" -output "$binary" "$binary"
172
190
  stripped="$stripped $arch"
173
191
  fi
174
192
  done
@@ -181,16 +199,15 @@ module Pod
181
199
  SH
182
200
  script << "\n" unless frameworks_by_config.values.all?(&:empty?)
183
201
  frameworks_by_config.each do |config, frameworks_with_dsyms|
184
- unless frameworks_with_dsyms.empty?
185
- script << %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
186
- frameworks_with_dsyms.each do |framework_with_dsym|
187
- script << %( install_framework "#{framework_with_dsym[:input_path]}"\n)
188
- # Vendored frameworks might have a dSYM file next to them so ensure its copied. Frameworks built from
189
- # sources will have their dSYM generated and copied by Xcode.
190
- script << %( install_dsym "#{framework_with_dsym[:dsym_input_path]}"\n) unless framework_with_dsym[:dsym_input_path].nil?
191
- end
192
- script << "fi\n"
202
+ next if frameworks_with_dsyms.empty?
203
+ script << %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
204
+ frameworks_with_dsyms.each do |framework_with_dsym|
205
+ script << %( install_framework "#{framework_with_dsym.source_path}"\n)
206
+ # Vendored frameworks might have a dSYM file next to them so ensure its copied. Frameworks built from
207
+ # sources will have their dSYM generated and copied by Xcode.
208
+ script << %( install_dsym "#{framework_with_dsym.dsym_path}"\n) unless framework_with_dsym.dsym_path.nil?
193
209
  end
210
+ script << "fi\n"
194
211
  end
195
212
  script << <<-SH.strip_heredoc
196
213
  if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
@@ -17,7 +17,7 @@ module Pod
17
17
 
18
18
  # @return [Array<String>] The list of the modules to import.
19
19
  #
20
- attr_accessor :module_imports
20
+ attr_reader :module_imports
21
21
 
22
22
  # Initialize a new instance
23
23
  #
@@ -18,16 +18,22 @@ module Pod
18
18
  #
19
19
  attr_reader :bundle_package_type
20
20
 
21
+ # @return [Hash] any additional entries to include in this Info.plist
22
+ #
23
+ attr_reader :additional_entries
24
+
21
25
  # Initialize a new instance
22
26
  #
23
- # @param [Version] version @see version
24
- # @param [Platform] platform @see platform
25
- # @param [Symbol] bundle_package_type @see bundle_package_type
27
+ # @param [Version] version @see #version
28
+ # @param [Platform] platform @see #platform
29
+ # @param [Symbol] bundle_package_type @see #bundle_package_type
30
+ # @param [Hash] additional_entries @see #additional_entries
26
31
  #
27
- def initialize(version, platform, bundle_package_type = :fmwk)
32
+ def initialize(version, platform, bundle_package_type = :fmwk, additional_entries = {})
28
33
  @version = version
29
34
  @platform = platform
30
35
  @bundle_package_type = bundle_package_type
36
+ @additional_entries = additional_entries
31
37
  end
32
38
 
33
39
  # Generates and saves the Info.plist to the given path.
@@ -109,6 +115,8 @@ module Pod
109
115
  info['CFBundleVersion'] = '1' if bundle_package_type == :bndl
110
116
  info['NSPrincipalClass'] = 'NSApplication' if bundle_package_type == :appl && platform == :osx
111
117
 
118
+ info.merge!(additional_entries)
119
+
112
120
  info
113
121
  end
114
122
  end
@@ -15,10 +15,10 @@ module Pod
15
15
  # Initialize a new instance
16
16
  #
17
17
  # @param [Array<FileAccessor>] file_accessors
18
- # @see file_accessors
18
+ # @see #file_accessors
19
19
  #
20
20
  # @param [Platform] platform
21
- # @see platform
21
+ # @see Header#platform
22
22
  #
23
23
  def initialize(file_accessors, platform)
24
24
  @file_accessors = file_accessors
@@ -76,6 +76,20 @@ module Pod
76
76
  @registrations[hook_name] << Hook.new(hook_name, plugin_name, block)
77
77
  end
78
78
 
79
+ # Returns all the hooks to run for the given event name
80
+ # and set of whitelisted plugins
81
+ #
82
+ # @see #run
83
+ #
84
+ # @return [Array<Hook>] the hooks to run
85
+ #
86
+ def hooks_to_run(name, whitelisted_plugins = nil)
87
+ return [] unless registrations
88
+ hooks = registrations.fetch(name, [])
89
+ return hooks unless whitelisted_plugins
90
+ hooks.select { |hook| whitelisted_plugins.key?(hook.plugin_name) }
91
+ end
92
+
79
93
  # Runs all the registered blocks for the hook with the given name.
80
94
  #
81
95
  # @param [Symbol] name
@@ -94,23 +108,20 @@ module Pod
94
108
  raise ArgumentError, 'Missing name' unless name
95
109
  raise ArgumentError, 'Missing options' unless context
96
110
 
97
- if registrations
98
- hooks = registrations[name]
99
- if hooks
100
- UI.message "- Running #{name.to_s.tr('_', ' ')} hooks" do
101
- hooks.each do |hook|
102
- next if whitelisted_plugins && !whitelisted_plugins.key?(hook.plugin_name)
103
- UI.message "- #{hook.plugin_name} from " \
104
- "`#{hook.block.source_location.first}`" do
105
- block = hook.block
106
- if block.arity > 1
107
- user_options = whitelisted_plugins[hook.plugin_name]
108
- user_options = user_options.with_indifferent_access if user_options
109
- block.call(context, user_options)
110
- else
111
- block.call(context)
112
- end
113
- end
111
+ hooks = hooks_to_run(name, whitelisted_plugins)
112
+ return if hooks.empty?
113
+
114
+ UI.message "- Running #{name.to_s.tr('_', ' ')} hooks" do
115
+ hooks.each do |hook|
116
+ UI.message "- #{hook.plugin_name} from " \
117
+ "`#{hook.block.source_location.first}`" do
118
+ block = hook.block
119
+ if block.arity > 1
120
+ user_options = whitelisted_plugins[hook.plugin_name]
121
+ user_options = user_options.with_indifferent_access if user_options
122
+ block.call(context, user_options)
123
+ else
124
+ block.call(context)
114
125
  end
115
126
  end
116
127
  end
@@ -1,45 +1,52 @@
1
1
  module Pod
2
2
  class Installer
3
3
  class Analyzer
4
+ # A simple container produced after a analysis is completed by the {Analyzer}.
5
+ #
4
6
  class AnalysisResult
5
7
  # @return [SpecsState] the states of the Podfile specs.
6
8
  #
7
- attr_accessor :podfile_state
9
+ attr_reader :podfile_state
8
10
 
9
- # @return [Hash{TargetDefinition => Array<Specification>}] the
10
- # specifications grouped by target.
11
+ # @return [Hash{TargetDefinition => Array<Specification>}] the specifications grouped by target.
11
12
  #
12
- attr_accessor :specs_by_target
13
+ attr_reader :specs_by_target
13
14
 
14
- # @return [Hash{Source => Array<Specification>}] the
15
- # specifications grouped by spec repo source.
15
+ # @return [Hash{Source => Array<Specification>}] the specifications grouped by spec repo source.
16
16
  #
17
- attr_accessor :specs_by_source
17
+ attr_reader :specs_by_source
18
18
 
19
- # @return [Array<Specification>] the specifications of the resolved
20
- # version of Pods that should be installed.
19
+ # @return [Array<Specification>] the specifications of the resolved version of Pods that should be installed.
21
20
  #
22
- attr_accessor :specifications
21
+ attr_reader :specifications
23
22
 
24
- # @return [SpecsState] the states of the {Sandbox} respect the resolved
25
- # specifications.
23
+ # @return [SpecsState] the states of the {Sandbox} respect the resolved specifications.
26
24
  #
27
- attr_accessor :sandbox_state
25
+ attr_reader :sandbox_state
28
26
 
29
- # @return [Array<AggregateTarget>] The aggregate targets created for each
30
- # {TargetDefinition} from the {Podfile}.
27
+ # @return [Array<AggregateTarget>] The aggregate targets created for each {TargetDefinition} from the {Podfile}.
31
28
  #
32
- attr_accessor :targets
29
+ attr_reader :targets
33
30
 
34
- # @return [Hash{TargetDefinition => Array<TargetInspectionResult>}] the
35
- # results of inspecting the user targets
31
+ # @return [Array<PodTarget>] The pod targets created for all the aggregate targets.
36
32
  #
37
- attr_accessor :target_inspections
33
+ attr_reader :pod_targets
38
34
 
39
- # @return [PodfileDependencyCache] the cache of all dependencies in the
40
- # podfile.
35
+ # @return [PodfileDependencyCache] the cache of all dependencies in the podfile.
41
36
  #
42
- attr_accessor :podfile_dependency_cache
37
+ attr_reader :podfile_dependency_cache
38
+
39
+ def initialize(podfile_state, specs_by_target, specs_by_source, specifications, sandbox_state, targets, pod_targets,
40
+ podfile_dependency_cache)
41
+ @podfile_state = podfile_state
42
+ @specs_by_target = specs_by_target
43
+ @specs_by_source = specs_by_source
44
+ @specifications = specifications
45
+ @sandbox_state = sandbox_state
46
+ @targets = targets
47
+ @pod_targets = pod_targets
48
+ @podfile_dependency_cache = podfile_dependency_cache
49
+ end
43
50
 
44
51
  # @return [Hash{String=>Symbol}] A hash representing all the user build
45
52
  # configurations across all integration targets. Each key
@@ -51,6 +58,29 @@ module Pod
51
58
  result.merge(target.user_build_configurations)
52
59
  end
53
60
  end
61
+
62
+ # @return [Bool] Whether an installation should be performed or this
63
+ # CocoaPods project is already up to date.
64
+ #
65
+ def needs_install?
66
+ podfile_needs_install? || sandbox_needs_install?
67
+ end
68
+
69
+ # @return [Bool] Whether the podfile has changes respect to the lockfile.
70
+ #
71
+ def podfile_needs_install?
72
+ state = podfile_state
73
+ needing_install = state.added.length + state.changed.length + state.deleted.length
74
+ needing_install > 0
75
+ end
76
+
77
+ # @return [Bool] Whether the sandbox is in synch with the lockfile.
78
+ #
79
+ def sandbox_needs_install?
80
+ state = sandbox_state
81
+ needing_install = state.added.length + state.changed.length + state.deleted.length
82
+ needing_install > 0
83
+ end
54
84
  end
55
85
  end
56
86
  end