cocoapods 1.4.0.beta.2 → 1.4.0.rc.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 435d85f5f3ea7e2924e657bc8a5511dc477ea0be
4
- data.tar.gz: 880a615bf2c28d75295a0e1b6117e1451c696724
3
+ metadata.gz: 3fb1486e8a7724cc9a1ef5a1121aec8cc3b88801
4
+ data.tar.gz: 4f61dc7de59a46d9407f427239761da95b4cd72f
5
5
  SHA512:
6
- metadata.gz: 72ed25c0b7a5faab93b0f6576f82db05981206cdeda385f00751bbe4011f512cb1a57be9d9f927211a4833bd641601b3e199fb28dda834fe11db270cdbbcf9ce
7
- data.tar.gz: 086ff09352aa6face50b22e8a8910a22c34c38141a7dc11d6e426bc749876082951d5d07ac4675f8d9ca8e85f74febe128ca63c19aa0b6a7b9d5912673778f91
6
+ metadata.gz: 5b81780a945ded8208719682bea1db9de648a1b0373b3df6454ea1e57e2bc32e561e7bfd3c4170f343d058f949225cf995168db790dd5713e11d734335b2e587
7
+ data.tar.gz: 2f1f5de875bc175d019b6ec3f5312d72571708d1c380e19c6326db83071597673993a0f3bce777718eec66b5a3779b435a920ec5de8170f7e9ddeadafb7b898d
@@ -4,6 +4,101 @@ 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.4.0.rc.1 (2017-12-16)
8
+
9
+ ##### Enhancements
10
+
11
+ * Integrate `swift_version` DSL support into pod targets
12
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
13
+ [#7134](https://github.com/CocoaPods/CocoaPods/issues/7134)
14
+
15
+ * Add color indication to output of `pod outdated`
16
+ [iv-mexx](https://github.com/iv-mexx)
17
+ [#7204](https://github.com/CocoaPods/CocoaPods/pull/7204)
18
+
19
+ * Set syntax of podspecs from development pods to Ruby when appropriate
20
+ [Eric Amorde](https://github.com/amorde)
21
+ [#7278](https://github.com/CocoaPods/CocoaPods/pull/7278)
22
+
23
+ * Add support for editing the podspec, license, README, license, and docs of local development pods
24
+ [Eric Amorde](https://github.com/amorde)
25
+ [#7093](https://github.com/CocoaPods/CocoaPods/pull/7093)
26
+
27
+ * Show warning when SDK provider tries to push a version with an unencrypted HTTP source
28
+ [KrauseFx](https://github.com/KrauseFx)
29
+ [#7250](https://github.com/CocoaPods/CocoaPods/pull/7250)
30
+
31
+ ##### Bug Fixes
32
+
33
+ * Deduplicate output path file names for resources and frameworks
34
+ [Eric Amorde](https://github.com/amorde)
35
+ [#7259](https://github.com/CocoaPods/CocoaPods/issues/7259)
36
+
37
+ * Allow installation of a pod with its own Swift version on multiple targets
38
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
39
+ [#7261](https://github.com/CocoaPods/CocoaPods/pull/7261)
40
+
41
+ * Quote framework names in OTHER_LDFLAGS
42
+ [Tyler Stromberg](https://github.com/AquaGeek)
43
+ [#7185](https://github.com/CocoaPods/CocoaPods/issues/7185)
44
+
45
+ * Fix static framework archive regression from #7187
46
+ [Paul Beusterien](https://github.com/paulb777)
47
+ [#7225](https://github.com/CocoaPods/CocoaPods/issues/7225)
48
+
49
+ * Install resource bundles and embed frameworks for every test target's configuration
50
+ [Nickolay Tarbayev](https://github.com/tarbayev)
51
+ [#7012](https://github.com/CocoaPods/CocoaPods/issues/7012)
52
+
53
+ * Set `SWIFT_VERSION` to test native targets during validation
54
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
55
+ [#7216](https://github.com/CocoaPods/CocoaPods/pull/7216)
56
+
57
+ * Add copied resources' paths to "Copy Pods Resources" output file list
58
+ [igor-makarov](https://github.com/igor-makarov)
59
+ [#6936](https://github.com/CocoaPods/CocoaPods/issues/6936)
60
+
61
+ * Do not link system frameworks of test specs to library targets
62
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
63
+ [#7205](https://github.com/CocoaPods/CocoaPods/pull/7205)
64
+
65
+ * Be more lenient when stripping frameworks and dSYMs for non fat binaries
66
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
67
+ [#7196](https://github.com/CocoaPods/CocoaPods/issues/7196)
68
+ [#5854](https://github.com/CocoaPods/CocoaPods/issues/5854)
69
+
70
+ * Do not display script phases warnings multiple times per platform
71
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
72
+ [#7193](https://github.com/CocoaPods/CocoaPods/pull/7193)
73
+
74
+ * Fix unnecessary whole project recompilation with static frameworks
75
+ [Vladimir Gorbenko](https://github.com/volodg)
76
+ [#7187](https://github.com/CocoaPods/CocoaPods/issues/7187)
77
+
78
+ * Prevent passing empty string to git when running `pod repo update --silent`
79
+ [Jon Sorrells](https://github.com/jonsorrells)
80
+ [#7176](https://github.com/CocoaPods/CocoaPods/issues/7176)
81
+
82
+ * Do not propagate test spec frameworks and libraries into pod target xcconfig
83
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
84
+ [#7172](https://github.com/CocoaPods/CocoaPods/issues/7172)
85
+
86
+ * Set language to Swift for test native targets if any dependencies use Swift
87
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
88
+ [#7170](https://github.com/CocoaPods/CocoaPods/issues/7170)
89
+
90
+ * Prevent multiple script phases from stripping vendored dSYM
91
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
92
+ [#7166](https://github.com/CocoaPods/CocoaPods/pull/7166)
93
+
94
+ * Static library headers should all be `Project` in Xcode header build phase
95
+ [Paul Beusterien](https://github.com/paulb777)
96
+ [#4496](https://github.com/CocoaPods/CocoaPods/issues/4496)
97
+
98
+ * Fix archiving apps with static frameworks
99
+ [Paul Beusterien](https://github.com/paulb777)
100
+ [#7158](https://github.com/CocoaPods/CocoaPods/issues/7158)
101
+
7
102
  ## 1.4.0.beta.2 (2017-10-24)
8
103
 
9
104
  ##### Enhancements
@@ -67,7 +162,7 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
67
162
  [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
68
163
  [#7104](https://github.com/CocoaPods/CocoaPods/pull/7104)
69
164
 
70
- * Do not set a `CODE_SIGN_IDENTITY` for macOS app hosts or xctest bundles
165
+ * Do not set a `CODE_SIGN_IDENTITY` for macOS app hosts or xctest bundles
71
166
  [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
72
167
  [#7103](https://github.com/CocoaPods/CocoaPods/pull/7103)
73
168
 
@@ -22,10 +22,24 @@ module Pod
22
22
  if updates.empty?
23
23
  UI.puts 'No pod updates are available.'.yellow
24
24
  else
25
+ UI.section 'The color indicates what happens when you run `pod update`' do
26
+ UI.puts "#{'<green>'.green}\t\t - Will be updated to the newest version"
27
+ UI.puts "#{'<yellow>'.yellow}\t - Will be updated, but not to the newest version because of specified version in Podfile"
28
+ UI.puts "#{'<red>'.red}\t\t - Will not be updated because of specified version in Podfile"
29
+ UI.puts ''
30
+ end
25
31
  UI.section 'The following pod updates are available:' do
26
32
  updates.each do |(name, from_version, matching_version, to_version)|
27
- UI.puts "- #{name} #{from_version} -> #{matching_version} " \
28
- "(latest version #{to_version})"
33
+ color = :yellow
34
+ if matching_version == to_version
35
+ color = :green
36
+ elsif from_version == matching_version
37
+ color = :red
38
+ end
39
+ # For the specs, its necessary that to_s is called here even though it is redundant
40
+ # https://github.com/CocoaPods/CocoaPods/pull/7204#issuecomment-342512015
41
+ UI.puts "- #{name} #{from_version.to_s.send(color)} -> #{matching_version.to_s.send(color)} " \
42
+ "(latest version #{to_version.to_s})" # rubocop:disable Lint/StringConversionInInterpolation
29
43
  end
30
44
  end
31
45
  end
@@ -16,7 +16,7 @@ module Pod
16
16
  end
17
17
  store_podspec(sandbox, podspec, podspec.extname == '.json')
18
18
  is_absolute = absolute?(declared_path)
19
- sandbox.store_local_path(name, podspec.dirname, is_absolute)
19
+ sandbox.store_local_path(name, podspec, is_absolute)
20
20
  sandbox.remove_checkout_source(name)
21
21
  end
22
22
  end
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the CocoaPods command line tool.
3
3
  #
4
- VERSION = '1.4.0.beta.2'.freeze unless defined? Pod::VERSION
4
+ VERSION = '1.4.0.rc.1'.freeze unless defined? Pod::VERSION
5
5
  end
@@ -43,10 +43,14 @@ module Pod
43
43
 
44
44
  SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
45
45
 
46
+ # Used as a return value for each invocation of `strip_invalid_archs` function.
47
+ STRIP_BINARY_RETVAL=0
48
+
46
49
  # This protects against multiple targets copying the same framework dependency at the same time. The solution
47
50
  # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
48
51
  RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
49
52
 
53
+ # Copies and strips a vendored framework
50
54
  install_framework()
51
55
  {
52
56
  if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
@@ -95,21 +99,31 @@ module Pod
95
99
  fi
96
100
  }
97
101
 
98
- # Copies the dSYM of a vendored framework
102
+ # Copies and strips a vendored dSYM
99
103
  install_dsym() {
100
104
  local source="$1"
101
105
  if [ -r "$source" ]; then
102
- echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${DWARF_DSYM_FOLDER_PATH}\\""
103
- rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
104
- fi
106
+ # Copy the dSYM into a the targets temp dir.
107
+ echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${DERIVED_FILES_DIR}\\""
108
+ rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
105
109
 
106
- local basename
107
- basename="$(basename -s .framework.dSYM "$source")"
108
- binary="${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
110
+ local basename
111
+ basename="$(basename -s .framework.dSYM "$source")"
112
+ binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
109
113
 
110
- # Strip invalid architectures so "fat" simulator / device frameworks work on device
111
- if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
112
- strip_invalid_archs "$binary"
114
+ # Strip invalid architectures so "fat" simulator / device frameworks work on device
115
+ if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
116
+ strip_invalid_archs "$binary"
117
+ fi
118
+
119
+ if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
120
+ # Move the stripped file into its final destination.
121
+ echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\\" \\"${DWARF_DSYM_FOLDER_PATH}\\""
122
+ rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
123
+ else
124
+ # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
125
+ touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
126
+ fi
113
127
  fi
114
128
  }
115
129
 
@@ -131,10 +145,18 @@ module Pod
131
145
  # Strip invalid architectures
132
146
  strip_invalid_archs() {
133
147
  binary="$1"
134
- # Get architectures for current file
135
- archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
148
+ # Get architectures for current target binary
149
+ binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
150
+ # Intersect them with the architectures we are building for
151
+ intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\\n' | sort | uniq -d)"
152
+ # If there are no archs supported by this binary then warn the user
153
+ if [[ -z "$intersected_archs" ]]; then
154
+ echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
155
+ STRIP_BINARY_RETVAL=0
156
+ return
157
+ fi
136
158
  stripped=""
137
- for arch in $archs; do
159
+ for arch in $binary_archs; do
138
160
  if ! [[ "${ARCHS}" == *"$arch"* ]]; then
139
161
  # Strip non-valid architectures in-place
140
162
  lipo -remove "$arch" -output "$binary" "$binary" || exit 1
@@ -144,6 +166,7 @@ module Pod
144
166
  if [[ "$stripped" ]]; then
145
167
  echo "Stripped $binary of architectures:$stripped"
146
168
  fi
169
+ STRIP_BINARY_RETVAL=1
147
170
  }
148
171
 
149
172
  SH
@@ -64,18 +64,18 @@ module Pod
64
64
 
65
65
  @xcconfig = Xcodeproj::Config.new(config)
66
66
 
67
- XCConfigHelper.add_settings_for_file_accessors_of_target(nil, target, @xcconfig)
67
+ XCConfigHelper.add_settings_for_file_accessors_of_target(nil, target, @xcconfig, true, @test_xcconfig)
68
68
  target.file_accessors.each do |file_accessor|
69
69
  @xcconfig.merge!(file_accessor.spec_consumer.pod_target_xcconfig) if @test_xcconfig == file_accessor.spec.test_specification?
70
70
  end
71
71
  XCConfigHelper.add_target_specific_settings(target, @xcconfig)
72
72
  recursive_dependent_targets = target.recursive_dependent_targets
73
73
  @xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, recursive_dependent_targets, @test_xcconfig)
74
- XCConfigHelper.generate_vendored_build_settings(target, recursive_dependent_targets, @xcconfig, false) if target.requires_frameworks?
74
+ XCConfigHelper.generate_vendored_build_settings(target, recursive_dependent_targets, @xcconfig, false, @test_xcconfig) if target.requires_frameworks?
75
75
  if @test_xcconfig
76
76
  test_dependent_targets = [target, *target.recursive_test_dependent_targets].uniq
77
77
  @xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, test_dependent_targets - recursive_dependent_targets, @test_xcconfig)
78
- XCConfigHelper.generate_vendored_build_settings(nil, target.all_test_dependent_targets, @xcconfig)
78
+ XCConfigHelper.generate_vendored_build_settings(nil, target.all_test_dependent_targets, @xcconfig, true, @test_xcconfig)
79
79
  XCConfigHelper.generate_other_ld_flags(nil, target.all_test_dependent_targets, @xcconfig)
80
80
  XCConfigHelper.generate_ld_runpath_search_paths(target, false, true, @xcconfig)
81
81
  end
@@ -75,19 +75,24 @@ module Pod
75
75
  # @param [Boolean] include_ld_flags
76
76
  # Indicates whether or not to generate ld flags in addition to compile flags
77
77
  #
78
+ # @param [Boolean] test_xcconfig
79
+ # Whether the settings for dependent targets are being generated for a test xcconfig or not.
80
+ #
78
81
  # @return [void]
79
82
  #
80
- def self.add_settings_for_file_accessors_of_target(target, pod_target, xcconfig, include_ld_flags = true)
81
- pod_target.file_accessors.each do |file_accessor|
83
+ def self.add_settings_for_file_accessors_of_target(target, pod_target, xcconfig, include_ld_flags = true, test_xcconfig = false)
84
+ file_accessors = pod_target.file_accessors
85
+ file_accessors = file_accessors.reject { |f| f.spec.test_specification? } unless test_xcconfig
86
+ file_accessors.each do |file_accessor|
82
87
  if target.nil? || !file_accessor.spec.test_specification?
83
88
  XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, xcconfig) if include_ld_flags
84
89
  XCConfigHelper.add_static_dependency_build_settings(target, pod_target, xcconfig, file_accessor, include_ld_flags)
85
90
  end
86
91
  end
87
- XCConfigHelper.add_dynamic_dependency_build_settings(target, pod_target, xcconfig, include_ld_flags)
92
+ XCConfigHelper.add_dynamic_dependency_build_settings(target, pod_target, xcconfig, include_ld_flags, test_xcconfig)
88
93
  if pod_target.requires_frameworks?
89
94
  pod_target.dependent_targets.each do |dependent_target|
90
- XCConfigHelper.add_dynamic_dependency_build_settings(target, dependent_target, xcconfig, include_ld_flags)
95
+ XCConfigHelper.add_dynamic_dependency_build_settings(target, dependent_target, xcconfig, include_ld_flags, test_xcconfig)
91
96
  end
92
97
  end
93
98
  end
@@ -153,10 +158,15 @@ module Pod
153
158
  # @param [Boolean] include_ld_flags
154
159
  # Indicates whether or not to generate ld flags in addition to compile flags
155
160
  #
161
+ # @param [Boolean] test_xcconfig
162
+ # Whether the settings for dependent targets are being generated for a test xcconfig or not.
163
+ #
156
164
  # @return [void]
157
165
  #
158
- def self.add_dynamic_dependency_build_settings(target, pod_target, xcconfig, include_ld_flags)
159
- pod_target.file_accessors.each do |file_accessor|
166
+ def self.add_dynamic_dependency_build_settings(target, pod_target, xcconfig, include_ld_flags, test_xcconfig)
167
+ file_accessors = pod_target.file_accessors
168
+ file_accessors = file_accessors.reject { |f| f.spec.test_specification? } unless test_xcconfig
169
+ file_accessors.each do |file_accessor|
160
170
  if target.nil? || !file_accessor.spec.test_specification?
161
171
  file_accessor.vendored_dynamic_frameworks.each do |vendored_dynamic_framework|
162
172
  XCConfigHelper.add_framework_build_settings(vendored_dynamic_framework, xcconfig, pod_target.sandbox.root, include_ld_flags)
@@ -209,7 +219,7 @@ module Pod
209
219
  build_settings = {
210
220
  'FRAMEWORK_SEARCH_PATHS' => quote([dirname]),
211
221
  }
212
- build_settings['OTHER_LDFLAGS'] = "-framework #{name}" if include_ld_flags
222
+ build_settings['OTHER_LDFLAGS'] = "-framework \"#{name}\"" if include_ld_flags
213
223
  xcconfig.merge!(build_settings)
214
224
  end
215
225
 
@@ -237,7 +247,7 @@ module Pod
237
247
  build_settings = {
238
248
  'LIBRARY_SEARCH_PATHS' => quote([dirname]),
239
249
  }
240
- build_settings['OTHER_LDFLAGS'] = "-l#{name}" if include_ld_flags
250
+ build_settings['OTHER_LDFLAGS'] = "-l\"#{name}\"" if include_ld_flags
241
251
  xcconfig.merge!(build_settings)
242
252
  end
243
253
 
@@ -376,16 +386,19 @@ module Pod
376
386
  # @param [Boolean] include_ld_flags
377
387
  # Indicates whether or not to generate ld flags in addition to compile flags
378
388
  #
389
+ # @param [Boolean] test_xcconfig
390
+ # Indicates whether or not the generated ld flags are for a test xcconfig or not
391
+ #
379
392
  # @note
380
393
  # In case of generated pod targets, which require frameworks, the
381
394
  # vendored frameworks and libraries are already linked statically
382
395
  # into the framework binary and must not be linked again to the
383
396
  # user target.
384
397
  #
385
- def self.generate_vendored_build_settings(target, dep_targets, xcconfig, include_ld_flags = true)
398
+ def self.generate_vendored_build_settings(target, dep_targets, xcconfig, include_ld_flags = true, test_xcconfig = false)
386
399
  dep_targets.each do |dep_target|
387
400
  unless dep_target.should_build? && dep_target.requires_frameworks? && !dep_target.static_framework?
388
- XCConfigHelper.add_settings_for_file_accessors_of_target(target, dep_target, xcconfig, include_ld_flags)
401
+ XCConfigHelper.add_settings_for_file_accessors_of_target(target, dep_target, xcconfig, include_ld_flags, test_xcconfig)
389
402
  end
390
403
  end
391
404
  end
@@ -530,12 +530,11 @@ module Pod
530
530
  #
531
531
  def warn_for_installed_script_phases
532
532
  pods_to_install = sandbox_state.added | sandbox_state.changed
533
- pod_targets.each do |pod_target|
534
- spec = pod_target.root_spec
535
- if pods_to_install.include?(spec.name)
536
- script_phase_count = pod_target.script_phases.count
533
+ pod_targets.group_by(&:pod_name).each do |name, pod_targets|
534
+ if pods_to_install.include?(name)
535
+ script_phase_count = pod_targets.inject(0) { |sum, target| sum + target.script_phases.count }
537
536
  unless script_phase_count.zero?
538
- UI.warn "#{spec.name} has added #{pod_target.script_phases.count} #{'script phase'.pluralize(script_phase_count)}. " \
537
+ UI.warn "#{name} has added #{script_phase_count} #{'script phase'.pluralize(script_phase_count)}. " \
539
538
  'Please inspect before executing a build. See `https://guides.cocoapods.org/syntax/podspec.html#script_phases` for more information.'
540
539
  end
541
540
  end
@@ -190,6 +190,23 @@ module Pod
190
190
  end
191
191
  end
192
192
  end
193
+
194
+ # Returns an extension in the target that corresponds to the
195
+ # resource's input extension.
196
+ #
197
+ # @return [String] The output extension.
198
+ #
199
+ def output_extension_for_resource(input_extension)
200
+ case input_extension
201
+ when '.storyboard' then '.storyboardc'
202
+ when '.xib' then '.nib'
203
+ when '.framework' then '.framework'
204
+ when '.xcdatamodel' then '.mom'
205
+ when '.xcdatamodeld' then '.momd'
206
+ when '.xcmappingmodel' then '.cdm'
207
+ else input_extension
208
+ end
209
+ end
193
210
  end
194
211
 
195
212
  # Integrates the user project targets. Only the targets that do **not**
@@ -263,8 +280,14 @@ module Pod
263
280
  input_paths = []
264
281
  output_paths = []
265
282
  unless resource_paths_by_config.values.all?(&:empty?)
266
- input_paths = [target.copy_resources_script_relative_path, *resource_paths_by_config.values.flatten.uniq]
267
- output_paths = ['${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}']
283
+ resource_paths_flattened = resource_paths_by_config.values.flatten.uniq
284
+ input_paths = [target.copy_resources_script_relative_path, *resource_paths_flattened]
285
+ # convert input paths to output paths according to extensions
286
+ output_paths = resource_paths_flattened.map do |input_path|
287
+ base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}'
288
+ output_extension = TargetIntegrator.output_extension_for_resource(File.extname(input_path))
289
+ File.join(base_path, File.basename(input_path, File.extname(input_path)) + output_extension)
290
+ end.uniq
268
291
  end
269
292
  TargetIntegrator.add_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
270
293
  end
@@ -297,7 +320,7 @@ module Pod
297
320
  output_paths = []
298
321
  unless framework_paths_by_config.all?(&:empty?)
299
322
  input_paths = [target.embed_frameworks_script_relative_path, *framework_paths_by_config.map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.flatten.compact]
300
- output_paths = framework_paths_by_config.map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.flatten.compact
323
+ output_paths = framework_paths_by_config.map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.flatten.compact.uniq
301
324
  end
302
325
  TargetIntegrator.add_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths)
303
326
  end
@@ -192,13 +192,14 @@ module Pod
192
192
 
193
193
  def add_system_framework_dependencies
194
194
  # @TODO: Add Specs
195
- pod_targets.sort_by(&:name).each do |pod_target|
196
- pod_target.file_accessors.each do |file_accessor|
197
- file_accessor.spec_consumer.frameworks.each do |framework|
198
- if pod_target.should_build?
199
- pod_target.native_target.add_system_framework(framework)
200
- end
201
- end
195
+ pod_targets.select(&:should_build?).sort_by(&:name).each do |pod_target|
196
+ test_file_accessors, file_accessors = pod_target.file_accessors.partition { |fa| fa.spec.test_specification? }
197
+ file_accessors.each do |file_accessor|
198
+ add_system_frameworks_to_native_target(file_accessor, pod_target.native_target)
199
+ end
200
+ test_file_accessors.each do |test_file_accessor|
201
+ native_target = pod_target.native_target_for_spec(test_file_accessor.spec)
202
+ add_system_frameworks_to_native_target(test_file_accessor, native_target)
202
203
  end
203
204
  end
204
205
  end
@@ -315,6 +316,12 @@ module Pod
315
316
  end
316
317
  end
317
318
 
319
+ def add_system_frameworks_to_native_target(file_accessor, native_target)
320
+ file_accessor.spec_consumer.frameworks.each do |framework|
321
+ native_target.add_system_framework(framework)
322
+ end
323
+ end
324
+
318
325
  def add_resource_bundles_to_native_target(dependent_target, native_target)
319
326
  resource_bundle_targets = dependent_target.resource_bundle_targets + dependent_target.test_resource_bundle_targets
320
327
  resource_bundle_targets.each do |resource_bundle_target|
@@ -40,6 +40,7 @@ module Pod
40
40
  add_frameworks_bundles
41
41
  add_vendored_libraries
42
42
  add_resources
43
+ add_developer_files unless sandbox.development_pods.empty?
43
44
  link_headers
44
45
  end
45
46
 
@@ -109,6 +110,24 @@ module Pod
109
110
  end
110
111
  end
111
112
 
113
+ def add_developer_files
114
+ UI.message '- Adding development pod helper files to Pods project' do
115
+ file_accessors.each do |file_accessor|
116
+ pod_name = file_accessor.spec.name
117
+ next unless sandbox.local?(pod_name)
118
+ root_name = Specification.root_name(pod_name)
119
+ paths = file_accessor.developer_files
120
+ paths.each do |path|
121
+ group = pods_project.group_for_spec(root_name, :developer)
122
+ ref = pods_project.add_file_reference(path, group, false)
123
+ if path.extname == '.podspec'
124
+ pods_project.mark_ruby_file_ref(ref)
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+
112
131
  # Creates the link to the headers of the Pod in the sandbox.
113
132
  #
114
133
  # @return [void]
@@ -184,7 +203,7 @@ module Pod
184
203
  paths = allowable_project_paths(paths)
185
204
  base_path = local ? common_path(paths) : nil
186
205
  paths.each do |path|
187
- group = pods_project.group_for_spec(file_accessor.spec.name, group_key)
206
+ group = pods_project.group_for_spec(pod_name, group_key)
188
207
  pods_project.add_file_reference(path, group, local && reflect_file_system_structure_for_development, base_path)
189
208
  end
190
209
  end
@@ -242,7 +242,7 @@ module Pod
242
242
  product_type = target.product_type_for_test_type(test_type)
243
243
  name = target.test_target_label(test_type)
244
244
  platform_name = target.platform.name
245
- language = target.uses_swift? ? :swift : :objc
245
+ language = target.all_test_dependent_targets.any?(&:uses_swift?) ? :swift : :objc
246
246
  native_test_target = project.new_target(product_type, name, platform_name, deployment_target, nil, language)
247
247
  native_test_target.product_reference.name = name
248
248
 
@@ -402,7 +402,9 @@ module Pod
402
402
  def create_test_target_copy_resources_script(test_type)
403
403
  path = target.copy_resources_script_path_for_test_type(test_type)
404
404
  pod_targets = target.all_test_dependent_targets
405
- resource_paths_by_config = { 'Debug' => pod_targets.flat_map(&:resource_paths) }
405
+ resource_paths_by_config = target.user_build_configurations.keys.each_with_object({}) do |config, resources_by_config|
406
+ resources_by_config[config] = pod_targets.flat_map(&:resource_paths)
407
+ end
406
408
  generator = Generator::CopyResourcesScript.new(resource_paths_by_config, target.platform)
407
409
  update_changed_file(generator, path)
408
410
  add_file_to_support_group(path)
@@ -418,7 +420,9 @@ module Pod
418
420
  def create_test_target_embed_frameworks_script(test_type)
419
421
  path = target.embed_frameworks_script_path_for_test_type(test_type)
420
422
  pod_targets = target.all_test_dependent_targets
421
- framework_paths_by_config = { 'Debug' => pod_targets.flat_map(&:framework_paths) }
423
+ framework_paths_by_config = target.user_build_configurations.keys.each_with_object({}) do |config, paths_by_config|
424
+ paths_by_config[config] = pod_targets.flat_map(&:framework_paths)
425
+ end
422
426
  generator = Generator::EmbedFrameworksScript.new(framework_paths_by_config)
423
427
  update_changed_file(generator, path)
424
428
  add_file_to_support_group(path)
@@ -431,7 +435,7 @@ module Pod
431
435
  #
432
436
  def test_target_swift_debug_hack(test_target_bc)
433
437
  return unless test_target_bc.debug?
434
- return unless [target, *target.recursive_dependent_targets].any?(&:uses_swift?)
438
+ return unless target.all_test_dependent_targets.any?(&:uses_swift?)
435
439
  ldflags = test_target_bc.build_settings['OTHER_LDFLAGS'] ||= '$(inherited)'
436
440
  ldflags << ' -lswiftSwiftOnoneSupport'
437
441
  end
@@ -456,7 +460,7 @@ module Pod
456
460
  eos
457
461
  end
458
462
 
459
- # Creates a build phase to put the static framework archive in the appropriate framework location
463
+ # Creates a build phase to put the static framework in the appropriate framework location
460
464
  # Since Xcode does not provide template support for static library frameworks, we've built a static library
461
465
  # of the form lib{LibraryName}.a. We need to move that to the framework location -
462
466
  # {LibraryName}.framework/{LibraryName}.
@@ -464,13 +468,17 @@ module Pod
464
468
  # @return [void]
465
469
  #
466
470
  def create_build_phase_to_move_static_framework_archive
467
- build_phase = native_target.new_shell_script_build_phase('Setup Static Framework Archive')
471
+ build_phase = native_target.new_shell_script_build_phase('Setup Static Framework')
468
472
  build_phase.shell_script = <<-eos.strip_heredoc
469
473
  mkdir -p "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules"
470
- cp "${BUILT_PRODUCTS_DIR}/lib${PRODUCT_NAME}.a" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}"
471
- cp "${MODULEMAP_FILE}" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules/module.modulemap"
474
+ # The fat library archive is at a file symbolic link when archiving, so use -L option
475
+ rsync -tL "${BUILT_PRODUCTS_DIR}/lib${PRODUCT_NAME}.a" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}"
476
+ rsync -t "${MODULEMAP_FILE}" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules/module.modulemap"
472
477
  # If there's a .swiftmodule, copy it into the framework's Modules folder
473
- cp -r "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}".swiftmodule "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules/" 2>/dev/null || :
478
+ rsync -tr "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}".swiftmodule "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules/" 2>/dev/null || :
479
+ # If archiving, Headers copy is needed
480
+ rsync -tr "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.framework/Headers" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/" 2>/dev/null || :
481
+ rsync -tr "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.framework/PrivateHeaders" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/" 2>/dev/null || :
474
482
  eos
475
483
  end
476
484
 
@@ -628,7 +636,9 @@ module Pod
628
636
 
629
637
  def add_header(build_file, public_headers, private_headers, native_target)
630
638
  file_ref = build_file.file_ref
631
- acl = if public_headers.include?(file_ref.real_path)
639
+ acl = if !target.requires_frameworks? # Headers are already rooted at ${PODS_ROOT}/Headers/P*/[pod]/...
640
+ 'Project'
641
+ elsif public_headers.include?(file_ref.real_path)
632
642
  'Public'
633
643
  elsif private_headers.include?(file_ref.real_path)
634
644
  'Private'
@@ -56,8 +56,13 @@ module Pod
56
56
  input_paths = []
57
57
  output_paths = []
58
58
  unless resource_paths.empty?
59
- input_paths = [script_path, *resource_paths.flatten.uniq]
60
- output_paths = ['${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}']
59
+ resource_paths_flattened = resource_paths.flatten.uniq
60
+ input_paths = [script_path, *resource_paths_flattened]
61
+ output_paths = resource_paths_flattened.map do |input_path|
62
+ base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}'
63
+ output_extension = UserProjectIntegrator::TargetIntegrator.output_extension_for_resource(File.extname(input_path))
64
+ File.join(base_path, File.basename(input_path, File.extname(input_path)) + output_extension)
65
+ end
61
66
  end
62
67
  UserProjectIntegrator::TargetIntegrator.add_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
63
68
  end
@@ -91,6 +91,7 @@ module Pod
91
91
  end
92
92
  swift_pod_targets = pod_targets.select(&:uses_swift?)
93
93
  error_messages = swift_pod_targets.map do |pod_target|
94
+ next unless pod_target.spec_swift_version.nil?
94
95
  swift_target_definitions = pod_target.target_definitions.reject { |target| target.swift_version.blank? }
95
96
  next if swift_target_definitions.empty? || swift_target_definitions.uniq(&:swift_version).count == 1
96
97
  target_errors = swift_target_definitions.map(&error_message_for_target).join(', ')
@@ -113,6 +113,7 @@ module Pod
113
113
  SPEC_SUBGROUPS = {
114
114
  :resources => 'Resources',
115
115
  :frameworks => 'Frameworks',
116
+ :developer => 'Pod',
116
117
  }
117
118
 
118
119
  # Returns the group for the specification with the give name creating it if
@@ -220,12 +221,22 @@ module Pod
220
221
  #
221
222
  def add_podfile(podfile_path)
222
223
  new_file(podfile_path, :project).tap do |podfile_ref|
223
- podfile_ref.xc_language_specification_identifier = 'xcode.lang.ruby'
224
- podfile_ref.explicit_file_type = 'text.script.ruby'
225
- podfile_ref.last_known_file_type = 'text'
224
+ mark_ruby_file_ref(podfile_ref)
226
225
  end
227
226
  end
228
227
 
228
+ # Sets the syntax of the provided file reference to be Ruby, in the case that
229
+ # the file does not already have a ".rb" file extension (ex. the Podfile)
230
+ #
231
+ # @param [PBXFileReference] file_ref
232
+ # The file reference to change
233
+ #
234
+ def mark_ruby_file_ref(file_ref)
235
+ file_ref.xc_language_specification_identifier = 'xcode.lang.ruby'
236
+ file_ref.explicit_file_type = 'text.script.ruby'
237
+ file_ref.last_known_file_type = 'text'
238
+ end
239
+
229
240
  # Adds a new build configuration to the project and populates it with
230
241
  # default settings according to the provided type.
231
242
  #
@@ -152,7 +152,7 @@ module Pod
152
152
  def pod_dir(name)
153
153
  root_name = Specification.root_name(name)
154
154
  if local?(root_name)
155
- Pathname.new(development_pods[root_name])
155
+ Pathname.new(development_pods[root_name].dirname)
156
156
  else
157
157
  sources_root + root_name
158
158
  end
@@ -211,7 +211,7 @@ module Pod
211
211
  def specification(name)
212
212
  if file = specification_path(name)
213
213
  original_path = development_pods[name]
214
- Dir.chdir(original_path || Dir.pwd) { Specification.from_file(file) }
214
+ Specification.from_file(original_path || file)
215
215
  end
216
216
  end
217
217
 
@@ -239,8 +239,8 @@ module Pod
239
239
 
240
240
  # Stores a specification in the `Local Podspecs` folder.
241
241
  #
242
- # @param [Sandbox] sandbox
243
- # the sandbox where the podspec should be stored.
242
+ # @param [String] name
243
+ # the name of the pod
244
244
  #
245
245
  # @param [String, Pathname] podspec
246
246
  # The contents of the specification (String) or the path to a
@@ -248,8 +248,6 @@ module Pod
248
248
  #
249
249
  # @return [void]
250
250
  #
251
- # @todo Store all the specifications (including those not originating
252
- # from external sources) so users can check them.
253
251
  #
254
252
  def store_podspec(name, podspec, _external_source = false, json = false)
255
253
  file_name = json ? "#{name}.podspec.json" : "#{name}.podspec"
@@ -351,8 +349,8 @@ module Pod
351
349
  # @param [String] name
352
350
  # The name of the Pod.
353
351
  #
354
- # @param [#to_s] path
355
- # The local path where the Pod is stored.
352
+ # @param [Pathname, String] path
353
+ # The path to the local Podspec
356
354
  #
357
355
  # @param [Bool] was_absolute
358
356
  # True if the specified local path was absolute.
@@ -361,11 +359,12 @@ module Pod
361
359
  #
362
360
  def store_local_path(name, path, was_absolute = false)
363
361
  root_name = Specification.root_name(name)
364
- development_pods[root_name] = path.to_s
362
+ path = Pathname.new(path) unless path.is_a?(Pathname)
363
+ development_pods[root_name] = path
365
364
  @pods_with_absolute_path << root_name if was_absolute
366
365
  end
367
366
 
368
- # @return [Hash{String=>String}] The path of the Pods with a local source
367
+ # @return [Hash{String=>Pathname}] The path of the Pods' podspecs with a local source
369
368
  # grouped by their root name.
370
369
  #
371
370
  # @todo Rename (e.g. `pods_with_local_path`)
@@ -380,8 +379,19 @@ module Pod
380
379
  # @return [Bool] Whether the Pod is locally sourced.
381
380
  #
382
381
  def local?(name)
382
+ !local_podspec(name).nil?
383
+ end
384
+
385
+ # @param [String] name
386
+ # The name of a locally specified Pod
387
+ #
388
+ # @return [Pathname] Path to the local Podspec of the Pod
389
+ #
390
+ def local_podspec(name)
383
391
  root_name = Specification.root_name(name)
384
- !development_pods[root_name].nil?
392
+ if path = development_pods[root_name]
393
+ Pathname.new(path)
394
+ end
385
395
  end
386
396
 
387
397
  #-------------------------------------------------------------------------#
@@ -17,6 +17,8 @@ module Pod
17
17
  :license => 'licen{c,s}e{*,.*}'.freeze,
18
18
  :source_files => "*{#{SOURCE_FILE_EXTENSIONS.join(',')}}".freeze,
19
19
  :public_header_files => "*{#{HEADER_EXTENSIONS.join(',')}}".freeze,
20
+ :podspecs => '*.{podspec,podspec.json}'.freeze,
21
+ :docs => 'doc{s}{*,.*}/**/*'.freeze,
20
22
  }.freeze
21
23
 
22
24
  # @return [Sandbox::PathList] the directory where the source of the Pod
@@ -291,6 +293,34 @@ module Pod
291
293
  end
292
294
  end
293
295
 
296
+ # @return [Array<Pathname>] The paths of auto-detected podspecs
297
+ #
298
+ def specs
299
+ path_list.glob([GLOB_PATTERNS[:podspecs]])
300
+ end
301
+
302
+ # @return [Array<Pathname>] The paths of auto-detected docs
303
+ #
304
+ def docs
305
+ path_list.glob([GLOB_PATTERNS[:docs]])
306
+ end
307
+
308
+ # @return [Array<Pathname>] Paths to include for local pods to assist in development
309
+ #
310
+ def developer_files
311
+ podspecs = specs
312
+ result = [module_map, prefix_header]
313
+ if podspecs.size <= 1
314
+ result += [license, readme, podspecs, docs]
315
+ else
316
+ result << podspec_file
317
+ if file = spec_consumer.license[:file]
318
+ result << root + file
319
+ end
320
+ end
321
+ result.compact.flatten.sort
322
+ end
323
+
294
324
  #-----------------------------------------------------------------------#
295
325
 
296
326
  private
@@ -311,6 +341,12 @@ module Pod
311
341
  paths_for_attribute(:private_header_files)
312
342
  end
313
343
 
344
+ # @return [Pathname] The path of the podspec matching @spec
345
+ #
346
+ def podspec_file
347
+ specs.lazy.select { |p| File.basename(p.to_s, '.*') == spec.name }.first
348
+ end
349
+
314
350
  #-----------------------------------------------------------------------#
315
351
 
316
352
  private
@@ -104,7 +104,9 @@ module Pod
104
104
 
105
105
  def update_git_repo(show_output = false)
106
106
  Config.instance.with_changes(:verbose => show_output) do
107
- git!(%W(-C #{repo} fetch origin #{show_output ? '--progress' : ''}))
107
+ args = %W(-C #{repo} fetch origin)
108
+ args.push('--progress') if show_output
109
+ git!(args)
108
110
  current_branch = git!(%W(-C #{repo} rev-parse --abbrev-ref HEAD)).strip
109
111
  git!(%W(-C #{repo} reset --hard origin/#{current_branch}))
110
112
  end
@@ -95,10 +95,18 @@ module Pod
95
95
  end
96
96
  end
97
97
 
98
- # @return [String] the Swift version for the target.
98
+ # @return [String] the Swift version for the target. If the pod author has provided a swift version
99
+ # then that is the one returned, otherwise the Swift version is determined by the user
100
+ # targets that include this pod target.
99
101
  #
100
102
  def swift_version
101
- target_definitions.map(&:swift_version).compact.uniq.first
103
+ spec_swift_version || target_definitions.map(&:swift_version).compact.uniq.first
104
+ end
105
+
106
+ # @return [String] the Swift version within the root spec. Might be `nil` if none is set.
107
+ #
108
+ def spec_swift_version
109
+ root_spec.swift_version
102
110
  end
103
111
 
104
112
  # @note The deployment target for the pod target is the maximum of all
@@ -257,8 +257,8 @@ module Pod
257
257
  #
258
258
  def swift_version
259
259
  return @swift_version unless @swift_version.nil?
260
- if version = dot_swift_version
261
- @swift_version = version
260
+ if (version = spec.swift_version) || (version = dot_swift_version)
261
+ @swift_version = version.to_s
262
262
  else
263
263
  DEFAULT_SWIFT_VERSION
264
264
  end
@@ -307,6 +307,7 @@ module Pod
307
307
  validate_screenshots(spec)
308
308
  validate_social_media_url(spec)
309
309
  validate_documentation_url(spec)
310
+ validate_source_url(spec)
310
311
 
311
312
  valid = spec.available_platforms.send(fail_fast ? :all? : :each) do |platform|
312
313
  UI.message "\n\n#{spec} - Analyzing on #{platform} platform.".green.reversed
@@ -393,21 +394,50 @@ module Pod
393
394
  validate_url(spec.documentation_url) if spec.documentation_url
394
395
  end
395
396
 
397
+ # Performs validations related to the `source` -> `http` attribute (if exists)
398
+ #
399
+ def validate_source_url(spec)
400
+ return if spec.source.nil? || spec.source[:http].nil?
401
+ url = spec.source[:http]
402
+ return if url.downcase.start_with?('https://')
403
+ warning('http', "The URL (`#{url}`) doesn't use the encrypted HTTPs protocol. " \
404
+ 'It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. '\
405
+ 'This will be an error in future releases. Please update the URL to use https.')
406
+ end
407
+
396
408
  # Performs validation for which version of Swift is used during validation.
397
409
  #
410
+ # An error will be displayed if the user has provided a `swift_version` attribute within the podspec but is also
411
+ # using either `--swift-version` parameter or a `.swift-version with a different Swift version.
412
+ #
398
413
  # The user will be warned that the default version of Swift was used if the following things are true:
399
414
  # - The project uses Swift at all
400
415
  # - The user did not supply a Swift version via a parameter
416
+ # - There is no `swift_version` attribute set within the specification
401
417
  # - There is no `.swift-version` file present either.
402
418
  #
403
419
  def validate_swift_version
404
- if uses_swift? && @swift_version.nil? && dot_swift_version.nil?
405
- warning(:swift_version,
420
+ return unless uses_swift?
421
+ spec_swift_version = spec.swift_version
422
+ unless spec_swift_version.nil?
423
+ message = nil
424
+ if !dot_swift_version.nil? && dot_swift_version != spec_swift_version.to_s
425
+ message = "Specification `#{spec.name}` specifies an inconsistent `swift_version` (`#{spec_swift_version}`) compared to the one present in your `.swift-version` file (`#{dot_swift_version}`). " \
426
+ 'Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec.'
427
+ elsif !@swift_version.nil? && @swift_version != spec_swift_version.to_s
428
+ message = "Specification `#{spec.name}` specifies an inconsistent `swift_version` (`#{spec_swift_version}`) compared to the one passed during lint (`#{@swift_version}`)."
429
+ end
430
+ unless message.nil?
431
+ error('swift', message)
432
+ return
433
+ end
434
+ end
435
+ if @swift_version.nil? && spec_swift_version.nil? && dot_swift_version.nil?
436
+ warning('swift',
406
437
  'The validator used ' \
407
438
  "Swift #{DEFAULT_SWIFT_VERSION} by default because no Swift version was specified. " \
408
- 'If you want to use a different version of Swift during validation, then either use the `--swift-version` parameter ' \
409
- 'or use a `.swift-version` file to set the version of Swift to use for ' \
410
- 'your Pod. For example to use Swift 4.0, run: `echo "4.0" > .swift-version`.')
439
+ 'To specify a Swift version during validation, add the `swift_version` attribute in your podspec. ' \
440
+ 'Note that usage of the `--swift-version` parameter or a `.swift-version` file is now deprecated.')
411
441
  end
412
442
  end
413
443
 
@@ -471,12 +501,24 @@ module Pod
471
501
  perform_post_install_actions).each { |m| @installer.send(m) }
472
502
 
473
503
  deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name)
474
- @installer.aggregate_targets.each do |target|
504
+ configure_pod_targets(@installer.aggregate_targets, deployment_target)
505
+ @installer.pods_project.save
506
+ end
507
+
508
+ def configure_pod_targets(targets, deployment_target)
509
+ targets.each do |target|
475
510
  target.pod_targets.each do |pod_target|
476
511
  next unless (native_target = pod_target.native_target)
477
512
  native_target.build_configuration_list.build_configurations.each do |build_configuration|
478
513
  (build_configuration.build_settings['OTHER_CFLAGS'] ||= '$(inherited)') << ' -Wincomplete-umbrella'
479
- build_configuration.build_settings['SWIFT_VERSION'] = swift_version if pod_target.uses_swift?
514
+ build_configuration.build_settings['SWIFT_VERSION'] = (pod_target.swift_version || swift_version) if pod_target.uses_swift?
515
+ end
516
+ if pod_target.uses_swift?
517
+ pod_target.test_native_targets.each do |test_native_target|
518
+ test_native_target.build_configuration_list.build_configurations.each do |build_configuration|
519
+ build_configuration.build_settings['SWIFT_VERSION'] = swift_version
520
+ end
521
+ end
480
522
  end
481
523
  end
482
524
  if target.pod_targets.any?(&:uses_swift?) && consumer.platform_name == :ios &&
@@ -485,7 +527,6 @@ module Pod
485
527
  error('swift', 'Swift support uses dynamic frameworks and is therefore only supported on iOS > 8.') unless uses_xctest
486
528
  end
487
529
  end
488
- @installer.pods_project.save
489
530
  end
490
531
 
491
532
  def validate_vendored_dynamic_frameworks
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.4.0.beta.2
4
+ version: 1.4.0.rc.1
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: 2017-10-24 00:00:00.000000000 Z
14
+ date: 2017-12-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cocoapods-core
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 1.4.0.beta.2
22
+ version: 1.4.0.rc.1
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.4.0.beta.2
29
+ version: 1.4.0.rc.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: claide
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -193,21 +193,21 @@ dependencies:
193
193
  requirements:
194
194
  - - "~>"
195
195
  - !ruby/object:Gem::Version
196
- version: 0.6.1
196
+ version: 0.6.4
197
197
  type: :runtime
198
198
  prerelease: false
199
199
  version_requirements: !ruby/object:Gem::Requirement
200
200
  requirements:
201
201
  - - "~>"
202
202
  - !ruby/object:Gem::Version
203
- version: 0.6.1
203
+ version: 0.6.4
204
204
  - !ruby/object:Gem::Dependency
205
205
  name: xcodeproj
206
206
  requirement: !ruby/object:Gem::Requirement
207
207
  requirements:
208
208
  - - ">="
209
209
  - !ruby/object:Gem::Version
210
- version: 1.5.3
210
+ version: 1.5.4
211
211
  - - "<"
212
212
  - !ruby/object:Gem::Version
213
213
  version: '2.0'
@@ -217,7 +217,7 @@ dependencies:
217
217
  requirements:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
- version: 1.5.3
220
+ version: 1.5.4
221
221
  - - "<"
222
222
  - !ruby/object:Gem::Version
223
223
  version: '2.0'