cocoapods 1.1.0.rc.2 → 1.1.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aebcc4002b70feee0826ac1cbf41542ee77dc7fb
4
- data.tar.gz: ec14f7a2ef3245902fbfbf8fb417d8ab934cee66
3
+ metadata.gz: 45edd0b5b0ad6bf88e868720fa0687caa2868670
4
+ data.tar.gz: 265395164853e3b9f4c665e54117a0452768eb0a
5
5
  SHA512:
6
- metadata.gz: 0d31345327fe79582442d32038fcd9e514f5ec20baf9628c74e00c9bc3e1c0f80da70bb5b3e2ac07c59d518575a4a901e028610b7db7a09e1150374d7d3af3d1
7
- data.tar.gz: 622983ea3bacabd5658dda55f5146bcbce917077d89dc338f472d6a1e3d539a7b61dcbe2d3e579a45ed2975c86c5133974e4cac0c2aa59594417e671ddde3113
6
+ metadata.gz: a253db5e9296fbaf7b49ef3fcf451c899d476e122bf2ca6f2f178f0cd0f2b3e4ac6f344e21ebd19d602e713efaa705aa717844a939014ed0417b67dd59a385fa
7
+ data.tar.gz: e1188063833e80370ade4fac40d14a5aa1a31f15e815e4bf63277157d16cdb4b72006a84ab8d0dd91e2739068b78d28336ea57d62f55b567c67608b342f6760e
data/CHANGELOG.md CHANGED
@@ -4,11 +4,71 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
4
4
 
5
5
  To install release candidates run `[sudo] gem install cocoapods --pre`
6
6
 
7
+ ## 1.1.0.rc.3 (2016-10-11)
8
+
9
+ ##### Enhancements
10
+
11
+ * Cache result of inhibit_warnings and include_in_build_config to speed up pod install.
12
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
13
+ [#5934](https://github.com/CocoaPods/CocoaPods/pull/5934)
14
+
15
+ * Tell users about the .swift-version file on validation failures.
16
+ [Danielle Tomlinson](https://github.com/dantoml)
17
+ [#5951](https://github.com/CocoaPods/CocoaPods/pull/5951)
18
+
19
+ * Improve performance of PathList.read_file_system
20
+ [Heath Borders](https://github.com/hborders)
21
+ [#5890](https://github.com/CocoaPods/CocoaPods/issues/5890)
22
+
23
+ * Cache result of uses_swift and should_build to speed up pod install.
24
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
25
+ [#5837](https://github.com/CocoaPods/CocoaPods/pull/5837)
26
+
27
+ * Remove uses of `cd` in generated scripts
28
+ [Ben Asher](https://github.com/benasher44)
29
+ [#5959](https://github.com/CocoaPods/CocoaPods/pull/5959)
30
+
31
+ * Error with helpful message when integrating a pod into targets that have mismatched Swift versions.
32
+ [Ben Asher](https://github.com/benasher44)
33
+ [#5984](https://github.com/CocoaPods/CocoaPods/pull/5984)
34
+
35
+ * Allow users to share pods between Objective-C and Swift targets.
36
+ [Danielle Tomlinson](https://github.com/dantoml)
37
+ [#5984](https://github.com/CocoaPods/CocoaPods/pull/5984)
38
+
39
+ * Allow setting the linting Swift version via `--swift-version=VERSION`
40
+ [Danielle Tomlinson](https://github.com/dantoml)
41
+ [#5989](https://github.com/CocoaPods/CocoaPods/pull/5989)
42
+
43
+ * Greenify pod install success message
44
+ [Stephen Hayes](https://github.com/schayes04)
45
+ [#5713](https://github.com/CocoaPods/CocoaPods/issues/5713)
46
+
47
+ * Update EMBEDDED_CONTENT_CONTAINS_SWIFT flag behaviour based on xcode version.
48
+ [codymoorhouse](https://github.com/codymoorhouse)
49
+ [#5732](https://github.com/CocoaPods/CocoaPods/issues/5732)
50
+
51
+ ##### Bug Fixes
52
+
53
+ * Remove special handling for messages apps
54
+ [Ben Asher](https://github.com/benasher44)
55
+ [#5860](https://github.com/CocoaPods/CocoaPods/issues/5860)
56
+
57
+ * Ensure messages apps have an embed frameworks build phase
58
+ [Ben Asher](https://github.com/benasher44)
59
+ [#5860](https://github.com/CocoaPods/CocoaPods/issues/5860)
60
+
61
+ * Fix linting of private pods when using libraries.
62
+ [Stefan Pühringer](https://github.com/b-ray)
63
+ [#5891](https://github.com/CocoaPods/CocoaPods/issues/5891)
64
+
65
+
7
66
  ## 1.1.0.rc.2 (2016-09-13)
8
67
 
9
68
  ##### Enhancements
10
69
 
11
- * Use the SWIFT_VERSION when linting pods.
70
+ * Use the SWIFT_VERSION when linting pods. To lint with Swift 3.0
71
+ add a Swift Version file. `echo "3.0" >> .swift-version`.
12
72
  [Danielle Tomlinson](https://github.com/dantoml)
13
73
  [#5841](https://github.com/CocoaPods/CocoaPods/pull/5841)
14
74
 
@@ -27,6 +87,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
27
87
 
28
88
  ##### Bug Fixes
29
89
 
90
+ * Wrap generated import headers with __OBJC__ to fix C only pods.
91
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
92
+ [#5291](https://github.com/CocoaPods/CocoaPods/issues/5291)
93
+
30
94
  * Prevent crash when generating acknowledgements when license type is not specified.
31
95
  [Marcelo Fabri](https://github.com/marcelofabri)
32
96
  [#5826](https://github.com/CocoaPods/CocoaPods/issues/5826)
@@ -21,6 +21,8 @@ module Pod
21
21
  '(defaults to https://github.com/CocoaPods/Specs.git). ' \
22
22
  'Multiple sources must be comma-delimited.'],
23
23
  ['--private', 'Lint skips checks that apply only to public specs'],
24
+ ['--swift-version=VERSION', 'The SWIFT_VERSION that should be used to lint the spec. ' \
25
+ 'This takes precedence over a .swift-version file.'],
24
26
  ].concat(super)
25
27
  end
26
28
 
@@ -34,6 +36,7 @@ module Pod
34
36
  @use_frameworks = !argv.flag?('use-libraries')
35
37
  @source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
36
38
  @private = argv.flag?('private', false)
39
+ @swift_version = argv.option('swift-version', nil)
37
40
  @podspecs_paths = argv.arguments!
38
41
  super
39
42
  end
@@ -55,6 +58,7 @@ module Pod
55
58
  validator.only_subspec = @only_subspec
56
59
  validator.use_frameworks = @use_frameworks
57
60
  validator.ignore_public_only_results = @private
61
+ validator.swift_version = @swift_version
58
62
  validator.validate
59
63
 
60
64
  unless @clean
@@ -27,6 +27,8 @@ module Pod
27
27
  '(defaults to https://github.com/CocoaPods/Specs.git). ' \
28
28
  'Multiple sources must be comma-delimited.'],
29
29
  ['--private', 'Lint skips checks that apply only to public specs'],
30
+ ['--swift-version=VERSION', 'The SWIFT_VERSION that should be used to lint the spec. ' \
31
+ 'This takes precedence over a .swift-version file.'],
30
32
  ].concat(super)
31
33
  end
32
34
 
@@ -40,6 +42,7 @@ module Pod
40
42
  @use_frameworks = !argv.flag?('use-libraries')
41
43
  @source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
42
44
  @private = argv.flag?('private', false)
45
+ @swift_version = argv.option('swift-version', nil)
43
46
  @podspecs_paths = argv.arguments!
44
47
  super
45
48
  end
@@ -57,6 +60,7 @@ module Pod
57
60
  validator.only_subspec = @only_subspec
58
61
  validator.use_frameworks = @use_frameworks
59
62
  validator.ignore_public_only_results = @private
63
+ validator.swift_version = @swift_version
60
64
  validator.validate
61
65
  failure_reasons << validator.failure_reason
62
66
 
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the CocoaPods command line tool.
3
3
  #
4
- VERSION = '1.1.0.rc.2'.freeze unless defined? Pod::VERSION
4
+ VERSION = '1.1.0.rc.3'.freeze unless defined? Pod::VERSION
5
5
  end
@@ -119,12 +119,6 @@ case "${TARGETED_DEVICE_FAMILY}" in
119
119
  ;;
120
120
  esac
121
121
 
122
- realpath() {
123
- DIRECTORY="$(cd "${1%/*}" && pwd)"
124
- FILENAME="${1##*/}"
125
- echo "$DIRECTORY/$FILENAME"
126
- }
127
-
128
122
  install_resource()
129
123
  {
130
124
  if [[ "$1" = /* ]] ; then
@@ -166,7 +160,7 @@ EOM
166
160
  xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
167
161
  ;;
168
162
  *.xcassets)
169
- ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH")
163
+ ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
170
164
  XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
171
165
  ;;
172
166
  *)
@@ -195,7 +189,7 @@ then
195
189
  # Find all other xcassets (this unfortunately includes those of path pods and other targets).
196
190
  OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
197
191
  while read line; do
198
- if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
192
+ if [[ $line != "${PODS_ROOT}*" ]]; then
199
193
  XCASSET_FILES+=("$line")
200
194
  fi
201
195
  done <<<"$OTHER_XCASSETS"
@@ -40,8 +40,9 @@ module Pod
40
40
  #
41
41
  def generate
42
42
  result = ''
43
+ result << "#ifdef __OBJC__\n"
43
44
  result << generate_platform_import_header
44
-
45
+ result << "#endif\n"
45
46
  result << "\n"
46
47
 
47
48
  imports.each do |import|
@@ -55,18 +55,6 @@ module Pod
55
55
 
56
56
  result
57
57
  end
58
-
59
- protected
60
-
61
- # Generates the contents of the header according to the platform.
62
- #
63
- # @return [String]
64
- #
65
- def generate_platform_import_header
66
- result = "#ifdef __OBJC__\n"
67
- result << super
68
- result << "#endif\n"
69
- end
70
58
  end
71
59
  end
72
60
  end
@@ -60,20 +60,8 @@ module Pod
60
60
  'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
61
61
  'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ',
62
62
  'LIBRARY_SEARCH_PATHS' => '$(inherited) ',
63
- }
64
- # For embedded targets, which live in a host target, CocoaPods
65
- # copies all of the embedded target's pod_targets its host
66
- # target. Therefore, this check will properly require the Swift
67
- # libs in the host target, if the embedded target has any pod targets
68
- # that use Swift. Setting this for the embedded target would
69
- # cause an App Store rejection because frameworks cannot be embedded
70
- # in embedded targets.
71
- if !target.requires_host_target? && pod_targets.any?(&:uses_swift?)
72
- config['EMBEDDED_CONTENT_CONTAINS_SWIFT'] = 'YES'
73
- config['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
74
- else
75
- config['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO'
76
- end
63
+ }.merge(embedded_content_settings)
64
+
77
65
  @xcconfig = Xcodeproj::Config.new(config)
78
66
 
79
67
  @xcconfig.merge!(merged_user_target_xcconfigs)
@@ -100,6 +88,41 @@ module Pod
100
88
 
101
89
  protected
102
90
 
91
+ def target_swift_version
92
+ settings = target.native_target.resolved_build_setting('SWIFT_VERSION') unless target.native_target.nil?
93
+ settings.values.compact.uniq.first unless settings.nil?
94
+ end
95
+
96
+ EMBED_STANDARD_LIBRARIES_MINIMUM_VERSION = Gem::Version.new('2.3')
97
+
98
+ # @return [Hash<String, String>] the build settings necessary for Swift
99
+ # targets to be correctly embedded in their host.
100
+ #
101
+ def embedded_content_settings
102
+ # For embedded targets, which live in a host target, CocoaPods
103
+ # copies all of the embedded target's pod_targets its host
104
+ # target. Therefore, this check will properly require the Swift
105
+ # libs in the host target, if the embedded target has any pod targets
106
+ # that use Swift. Setting this for the embedded target would
107
+ # cause an App Store rejection because frameworks cannot be embedded
108
+ # in embedded targets.
109
+
110
+ swift_version = Gem::Version.new(target_swift_version)
111
+ should_embed = !target.requires_host_target? && pod_targets.any?(&:uses_swift?)
112
+ embed_value = should_embed ? 'YES' : 'NO'
113
+
114
+ config = {
115
+ 'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES' => embed_value,
116
+ 'EMBEDDED_CONTENT_CONTAINS_SWIFT' => embed_value,
117
+ }
118
+
119
+ if swift_version >= EMBED_STANDARD_LIBRARIES_MINIMUM_VERSION || !should_embed
120
+ config.delete('EMBEDDED_CONTENT_CONTAINS_SWIFT')
121
+ end
122
+
123
+ config
124
+ end
125
+
103
126
  # @return [Hash<String, String>] the build settings necessary to import
104
127
  # the pod targets.
105
128
  #
@@ -478,10 +478,12 @@ module Pod
478
478
  def print_post_install_message
479
479
  podfile_dependencies = podfile.dependencies.uniq.size
480
480
  pods_installed = root_specs.size
481
- UI.info('Pod installation complete! ' \
482
- "There #{podfile_dependencies == 1 ? 'is' : 'are'} #{podfile_dependencies} " \
483
- "#{'dependency'.pluralize(podfile_dependencies)} from the Podfile " \
484
- "and #{pods_installed} total #{'pod'.pluralize(pods_installed)} installed.")
481
+ title_options = { :verbose_prefix => '-> '.green }
482
+ UI.titled_section('Pod installation complete! ' \
483
+ "There #{podfile_dependencies == 1 ? 'is' : 'are'} #{podfile_dependencies} " \
484
+ "#{'dependency'.pluralize(podfile_dependencies)} from the Podfile " \
485
+ "and #{pods_installed} total #{'pod'.pluralize(pods_installed)} installed.".green,
486
+ title_options)
485
487
  end
486
488
 
487
489
  # Runs the registered callbacks for the plugins post install hooks.
@@ -281,11 +281,7 @@ module Pod
281
281
  embedded_aggregate_targets.each do |target|
282
282
  host_uuids = []
283
283
  aggregate_target_user_projects.product(target.user_targets).each do |user_project, user_target|
284
- host_targets = user_project.host_targets_for_embedded_target(user_target)
285
- host_targets.map(&:symbol_type).each do |product_type|
286
- target.add_host_target_product_type(product_type)
287
- end
288
- host_uuids += host_targets.map(&:uuid)
284
+ host_uuids += user_project.host_targets_for_embedded_target(user_target).map(&:uuid)
289
285
  end
290
286
  # For each host, keep track of its embedded target definitions
291
287
  # to later verify each embedded target's compatiblity with its host,
@@ -353,6 +349,7 @@ module Pod
353
349
  #
354
350
  def generate_targets
355
351
  specs_by_target = result.specs_by_target.reject { |td, _| td.abstract? }
352
+ check_pod_target_swift_versions(specs_by_target)
356
353
  pod_targets = generate_pod_targets(specs_by_target)
357
354
  aggregate_targets = specs_by_target.keys.map do |target_definition|
358
355
  generate_target(target_definition, pod_targets)
@@ -410,6 +407,39 @@ module Pod
410
407
  target
411
408
  end
412
409
 
410
+ # Verify that targets using a pod have the same swift version
411
+ #
412
+ # @param [Hash{Podfile::TargetDefinition => Array<Specification>}] specs_by_target
413
+ # the resolved specifications grouped by target.
414
+ #
415
+ # @note raises Informative if targets using a pod do not have
416
+ # the same swift version
417
+ #
418
+ def check_pod_target_swift_versions(specs_by_target)
419
+ targets_by_spec = {}
420
+ specs_by_target.each do |target, specs|
421
+ specs.each do |spec|
422
+ (targets_by_spec[spec] ||= []) << target
423
+ end
424
+ end
425
+
426
+ error_message_for_target = lambda do |target|
427
+ "#{target.name} (Swift #{target.swift_version})"
428
+ end
429
+
430
+ error_messages = targets_by_spec.map do |spec, targets|
431
+ swift_targets = targets.reject { |target| target.swift_version.blank? }
432
+ next if swift_targets.empty? || swift_targets.uniq(&:swift_version).count == 1
433
+ target_errors = swift_targets.map(&error_message_for_target).join(', ')
434
+ "- #{spec.name} required by #{target_errors}"
435
+ end.compact
436
+
437
+ unless error_messages.empty?
438
+ raise Informative, 'The following pods are integrated into targets ' \
439
+ "that do not have the same Swift version:\n\n#{error_messages.join("\n")}"
440
+ end
441
+ end
442
+
413
443
  # Setup the pod targets for an aggregate target. Deduplicates resulting
414
444
  # targets by grouping by platform and subspec by their root
415
445
  # to create a {PodTarget} for each spec.
@@ -424,7 +454,7 @@ module Pod
424
454
  distinct_targets = specs_by_target.each_with_object({}) do |dependency, hash|
425
455
  target_definition, dependent_specs = *dependency
426
456
  dependent_specs.group_by(&:root).each do |root_spec, specs|
427
- pod_variant = PodVariant.new(specs, target_definition.platform, target_definition.uses_frameworks?, target_definition.swift_version)
457
+ pod_variant = PodVariant.new(specs, target_definition.platform, target_definition.uses_frameworks?)
428
458
  hash[root_spec] ||= {}
429
459
  (hash[root_spec][pod_variant] ||= []) << target_definition
430
460
  end
@@ -16,10 +16,6 @@ module Pod
16
16
  attr_accessor :requires_frameworks
17
17
  alias_method :requires_frameworks?, :requires_frameworks
18
18
 
19
- # @return [String] the Swift version
20
- #
21
- attr_accessor :swift_version
22
-
23
19
  # @return [Specification] the root specification
24
20
  #
25
21
  def root_spec
@@ -32,11 +28,10 @@ module Pod
32
28
  # @param [Platform] platform @see #platform
33
29
  # @param [Bool] requires_frameworks @see #requires_frameworks?
34
30
  #
35
- def initialize(specs, platform, requires_frameworks = false, swift_version = nil)
31
+ def initialize(specs, platform, requires_frameworks = false)
36
32
  self.specs = specs
37
33
  self.platform = platform
38
34
  self.requires_frameworks = requires_frameworks
39
- self.swift_version = swift_version
40
35
  end
41
36
 
42
37
  # @return [Bool] whether the {PodVariant} is equal to another taking all
@@ -46,8 +41,7 @@ module Pod
46
41
  self.class == other.class &&
47
42
  specs == other.specs &&
48
43
  platform == other.platform &&
49
- requires_frameworks == other.requires_frameworks &&
50
- swift_version == other.swift_version
44
+ requires_frameworks == other.requires_frameworks
51
45
  end
52
46
  alias_method :eql?, :==
53
47
 
@@ -57,7 +51,7 @@ module Pod
57
51
  #
58
52
  # @!visibility private
59
53
  def hash
60
- [specs, platform, requires_frameworks, swift_version].hash
54
+ [specs, platform, requires_frameworks].hash
61
55
  end
62
56
  end
63
57
  end
@@ -25,7 +25,7 @@ module Pod
25
25
  # For messages extensions, this only applies if it's embedded in a messages
26
26
  # application.
27
27
  #
28
- EMBED_FRAMEWORK_TARGET_TYPES = [:application, :unit_test_bundle, :ui_test_bundle, :watch2_extension, :messages_extension].freeze
28
+ EMBED_FRAMEWORK_TARGET_TYPES = [:application, :unit_test_bundle, :ui_test_bundle, :watch2_extension, :messages_application].freeze
29
29
 
30
30
  # @return [String] the name of the embed frameworks phase
31
31
  #
@@ -241,9 +241,9 @@ module Pod
241
241
 
242
242
  build_phase = native_target.new_shell_script_build_phase('Create Symlinks to Header Folders')
243
243
  build_phase.shell_script = <<-eos.strip_heredoc
244
- cd "$CONFIGURATION_BUILD_DIR/$WRAPPER_NAME"
245
- ln -fs ${PUBLIC_HEADERS_FOLDER_PATH\#$WRAPPER_NAME/} ${PUBLIC_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}
246
- ln -fs ${PRIVATE_HEADERS_FOLDER_PATH\#\$WRAPPER_NAME/} ${PRIVATE_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}
244
+ base="$CONFIGURATION_BUILD_DIR/$WRAPPER_NAME"
245
+ ln -fs $base/${PUBLIC_HEADERS_FOLDER_PATH\#$WRAPPER_NAME/} $base/${PUBLIC_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}
246
+ ln -fs $base/${PRIVATE_HEADERS_FOLDER_PATH\#\$WRAPPER_NAME/} $base/${PRIVATE_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}
247
247
  eos
248
248
  end
249
249
 
@@ -72,11 +72,11 @@ module Pod
72
72
  #
73
73
  def add_files(namespace, relative_header_paths)
74
74
  relative_header_paths.map do |relative_header_path|
75
- add_file(namespace, relative_header_path, relative_header_path.basename)
75
+ add_file(namespace, relative_header_path)
76
76
  end
77
77
  end
78
78
 
79
- # Adds a header to the directory under different name.
79
+ # Adds a header to the directory.
80
80
  #
81
81
  # @param [Pathname] namespace
82
82
  # the path where the header file should be stored relative to the
@@ -86,23 +86,17 @@ module Pod
86
86
  # the path of the header file relative to the Pods project
87
87
  # (`PODS_ROOT` variable of the xcconfigs).
88
88
  #
89
- # @param [String] final_name
90
- # the name under which the file should be available in the
91
- # headers directory.
92
- #
93
89
  # @note This method does _not_ add the file to the search paths.
94
90
  #
95
91
  # @return [Pathname]
96
92
  #
97
- def add_file(namespace, relative_header_path, final_name)
93
+ def add_file(namespace, relative_header_path)
98
94
  namespaced_path = root + namespace
99
95
  namespaced_path.mkpath unless File.exist?(namespaced_path)
100
96
 
101
97
  absolute_source = (sandbox.root + relative_header_path)
102
98
  source = absolute_source.relative_path_from(namespaced_path)
103
- Dir.chdir(namespaced_path) do
104
- FileUtils.ln_sf(source, final_name)
105
- end
99
+ FileUtils.ln_sf(source, namespaced_path)
106
100
  namespaced_path + relative_header_path.basename
107
101
  end
108
102
 
@@ -51,11 +51,22 @@ module Pod
51
51
  raise Informative, "Attempt to read non existent folder `#{root}`."
52
52
  end
53
53
  escaped_root = escape_path_for_glob(root)
54
- absolute_paths = Pathname.glob(escaped_root + '**/*', File::FNM_DOTMATCH)
54
+
55
+ absolute_paths = Pathname.glob(escaped_root + '**/*', File::FNM_DOTMATCH).lazy
55
56
  dirs_and_files = absolute_paths.reject { |path| path.basename.to_s =~ /^\.\.?$/ }
56
- relative_paths = dirs_and_files.map { |path| path.relative_path_from(root) }
57
- sorted_paths = relative_paths.map(&:to_s).sort_by(&:upcase)
58
- @dirs, @files = sorted_paths.partition { |path| File.directory?(root + path) }
57
+ dirs, files = dirs_and_files.partition { |path| File.directory?(path) }
58
+
59
+ root_length = root.cleanpath.to_s.length + File::SEPARATOR.length
60
+ sorted_relative_paths_from_full_paths = lambda do |paths|
61
+ relative_paths = paths.lazy.map do |path|
62
+ path_string = path.to_s
63
+ path_string.slice(root_length, path_string.length - root_length)
64
+ end
65
+ relative_paths.sort_by(&:upcase)
66
+ end
67
+
68
+ @dirs = sorted_relative_paths_from_full_paths.call(dirs)
69
+ @files = sorted_relative_paths_from_full_paths.call(files)
59
70
  @glob_cache = {}
60
71
  end
61
72
 
@@ -9,8 +9,6 @@ module Pod
9
9
 
10
10
  # Product types where the product's frameworks must be embedded in a host target
11
11
  #
12
- # @note :messages_extension only applies when it is embedded in an app (as opposed to a messages app)
13
- #
14
12
  EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES = [:app_extension, :framework, :messages_extension, :watch_extension].freeze
15
13
 
16
14
  # Initialize a new instance
@@ -27,21 +25,6 @@ module Pod
27
25
  @search_paths_aggregate_targets = []
28
26
  @file_accessors = []
29
27
  @xcconfigs = {}
30
- @host_target_types = Set.new # Product types of the host target, if this target is embedded
31
- end
32
-
33
- # Adds product type to the list of product types for the host
34
- # targets, in which this target will be embedded
35
- #
36
- # @param [Symbol] product_type Product type (symbol representation)
37
- # of a host, in which this target will be embedded
38
- #
39
- # @note This is important for messages extensions, since a messages
40
- # extension has its frameworks embedded in its host when
41
- # its host is an app but not when it's a messages app
42
- #
43
- def add_host_target_product_type(product_type)
44
- @host_target_types << product_type
45
28
  end
46
29
 
47
30
  # @return [Boolean] True if the user_target's pods are
@@ -57,7 +40,7 @@ module Pod
57
40
  return false if user_project.nil?
58
41
  symbol_types = user_targets.map(&:symbol_type).uniq
59
42
  raise ArgumentError, "Expected single kind of user_target for #{name}. Found #{symbol_types.join(', ')}." unless symbol_types.count == 1
60
- EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include?(symbol_types[0]) && !@host_target_types.include?(:messages_application)
43
+ EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include?(symbol_types[0])
61
44
  end
62
45
 
63
46
  # @return [String] the label for the target.
@@ -47,6 +47,7 @@ module Pod
47
47
  @file_accessors = []
48
48
  @resource_bundle_targets = []
49
49
  @dependent_targets = []
50
+ @build_config_cache = {}
50
51
  end
51
52
 
52
53
  # @param [Hash{Array => PodTarget}] cache
@@ -141,9 +142,12 @@ module Pod
141
142
  # A target should not be build if it has no source files.
142
143
  #
143
144
  def should_build?
144
- source_files = file_accessors.flat_map(&:source_files)
145
- source_files -= file_accessors.flat_map(&:headers)
146
- !source_files.empty?
145
+ return @should_build if defined? @should_build
146
+ @should_build = begin
147
+ source_files = file_accessors.flat_map(&:source_files)
148
+ source_files -= file_accessors.flat_map(&:headers)
149
+ !source_files.empty?
150
+ end
147
151
  end
148
152
 
149
153
  # @return [Array<Specification::Consumer>] the specification consumers for
@@ -156,8 +160,11 @@ module Pod
156
160
  # @return [Boolean] Whether the target uses Swift code
157
161
  #
158
162
  def uses_swift?
159
- file_accessors.any? do |file_accessor|
160
- file_accessor.source_files.any? { |sf| sf.extname == '.swift' }
163
+ return @uses_swift if defined? @uses_swift
164
+ @uses_swift = begin
165
+ file_accessors.any? do |file_accessor|
166
+ file_accessor.source_files.any? { |sf| sf.extname == '.swift' }
167
+ end
161
168
  end
162
169
  end
163
170
 
@@ -216,13 +223,20 @@ module Pod
216
223
  # The name of the build configuration.
217
224
  #
218
225
  def include_in_build_config?(target_definition, configuration_name)
226
+ key = [target_definition.label, configuration_name]
227
+ if @build_config_cache.key?(key)
228
+ return @build_config_cache[key]
229
+ end
230
+
219
231
  whitelists = target_definition_dependencies(target_definition).map do |dependency|
220
232
  target_definition.pod_whitelisted_for_configuration?(dependency.name, configuration_name)
221
233
  end.uniq
222
234
 
223
235
  if whitelists.empty?
236
+ @build_config_cache[key] = true
224
237
  return true
225
238
  elsif whitelists.count == 1
239
+ @build_config_cache[key] = whitelists.first
226
240
  whitelists.first
227
241
  else
228
242
  raise Informative, "The subspecs of `#{pod_name}` are linked to " \
@@ -237,13 +251,16 @@ module Pod
237
251
  # @return [Bool]
238
252
  #
239
253
  def inhibit_warnings?
254
+ return @inhibit_warnings if defined? @inhibit_warnings
240
255
  whitelists = target_definitions.map do |target_definition|
241
256
  target_definition.inhibits_warnings_for_pod?(root_spec.name)
242
257
  end.uniq
243
258
 
244
259
  if whitelists.empty?
260
+ @inhibit_warnings = false
245
261
  return false
246
262
  elsif whitelists.count == 1
263
+ @inhibit_warnings = whitelists.first
247
264
  whitelists.first
248
265
  else
249
266
  UI.warn "The pod `#{pod_name}` is linked to different targets " \
@@ -142,7 +142,15 @@ module Pod
142
142
  reasons << 'all results apply only to public specs, but you can use ' \
143
143
  '`--private` to ignore them if linting the specification for a private pod'
144
144
  end
145
- reasons.to_sentence
145
+ if dot_swift_version.nil?
146
+ reasons.to_sentence + ".\n[!] The validator for Swift projects uses " \
147
+ 'Swift 2.3 by default, if you are using a different version of ' \
148
+ 'swift you can use a `.swift-version` file to set the version for ' \
149
+ "your Pod. For example to use Swift 3.0, run: \n" \
150
+ ' `echo "3.0" > .swift-version`'
151
+ else
152
+ reasons.to_sentence
153
+ end
146
154
  end
147
155
 
148
156
  #-------------------------------------------------------------------------#
@@ -243,6 +251,10 @@ module Pod
243
251
  @swift_version ||= dot_swift_version || '2.3'
244
252
  end
245
253
 
254
+ # Set the SWIFT_VERSION that should be used to validate the pod.
255
+ #
256
+ attr_writer :swift_version
257
+
246
258
  # @return [String] the SWIFT_VERSION in the .swift-version file or nil.
247
259
  #
248
260
  def dot_swift_version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.rc.2
4
+ version: 1.1.0.rc.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-09-13 00:00:00.000000000 Z
14
+ date: 2016-10-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cocoapods-core
@@ -19,21 +19,21 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 1.1.0.rc.2
22
+ version: 1.1.0.rc.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.1.0.rc.2
29
+ version: 1.1.0.rc.3
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: claide
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 1.0.0
36
+ version: 1.0.1
37
37
  - - "<"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '2.0'
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.0.0
46
+ version: 1.0.1
47
47
  - - "<"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '2.0'
@@ -151,22 +151,16 @@ dependencies:
151
151
  name: cocoapods-trunk
152
152
  requirement: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - ">="
155
- - !ruby/object:Gem::Version
156
- version: 1.0.0
157
- - - "<"
154
+ - - '='
158
155
  - !ruby/object:Gem::Version
159
- version: '2.0'
156
+ version: 1.1.0.beta.1
160
157
  type: :runtime
161
158
  prerelease: false
162
159
  version_requirements: !ruby/object:Gem::Requirement
163
160
  requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: 1.0.0
167
- - - "<"
161
+ - - '='
168
162
  - !ruby/object:Gem::Version
169
- version: '2.0'
163
+ version: 1.1.0.beta.1
170
164
  - !ruby/object:Gem::Dependency
171
165
  name: cocoapods-try
172
166
  requirement: !ruby/object:Gem::Requirement
@@ -207,7 +201,7 @@ dependencies:
207
201
  requirements:
208
202
  - - ">="
209
203
  - !ruby/object:Gem::Version
210
- version: 1.3.1
204
+ version: 1.3.2
211
205
  - - "<"
212
206
  - !ruby/object:Gem::Version
213
207
  version: '2.0'
@@ -217,7 +211,7 @@ dependencies:
217
211
  requirements:
218
212
  - - ">="
219
213
  - !ruby/object:Gem::Version
220
- version: 1.3.1
214
+ version: 1.3.2
221
215
  - - "<"
222
216
  - !ruby/object:Gem::Version
223
217
  version: '2.0'
@@ -275,14 +269,14 @@ dependencies:
275
269
  requirements:
276
270
  - - "~>"
277
271
  - !ruby/object:Gem::Version
278
- version: 1.0.1
272
+ version: '2.0'
279
273
  type: :runtime
280
274
  prerelease: false
281
275
  version_requirements: !ruby/object:Gem::Requirement
282
276
  requirements:
283
277
  - - "~>"
284
278
  - !ruby/object:Gem::Version
285
- version: 1.0.1
279
+ version: '2.0'
286
280
  - !ruby/object:Gem::Dependency
287
281
  name: gh_inspector
288
282
  requirement: !ruby/object:Gem::Requirement