cocoapods-pod-merge 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-pod-merge/Main.rb +48 -11
- data/lib/cocoapods-pod-merge/gem_version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c15e511e82a904dc11616d9ac811f643216f5d1d34646518ad29a6dbde1e0ec2
|
4
|
+
data.tar.gz: 7a94572e547e895e73f48a99989a81b0444a2fba735e2cc3ac777dbf92845f49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3d41d5e2c522632f5a42810e6837bb128da441780efb802704cc5af7d5e10076c9c927f096c6a4b3195e058ecfaee4e8de898b74e2673b62f52cad95cca5923
|
7
|
+
data.tar.gz: 3b438bfa2eda55b58bd0740af5aba4401d25e00f813a1d2d29a4071abceaf70f0fa23094e26a5f235328591fd8ab6db523484d28ef4e544cb58a195065b37606
|
@@ -142,7 +142,15 @@ module CocoapodsPodMerge
|
|
142
142
|
if line.strip == 'end'
|
143
143
|
parsing_a_group = false
|
144
144
|
elsif line.strip.include?('!')
|
145
|
-
|
145
|
+
if line.strip.include?('swift_version!')
|
146
|
+
extracted_swift_version = line.strip.delete('swift_version!').delete('\'').delete('\"').strip.to_f
|
147
|
+
if extracted_swift_version == 0
|
148
|
+
abort("Found an invalid Swift version specified for group \'#{group_name}\' in the MergeFile. Please specify one like: swift_version! '5.0'".red)
|
149
|
+
end
|
150
|
+
merge_groups[group_name]['swift_version'] = extracted_swift_version.to_s
|
151
|
+
else
|
152
|
+
merge_groups[group_name]['flags'][line.strip.delete('!')] = true
|
153
|
+
end
|
146
154
|
else
|
147
155
|
merge_groups[group_name]['lines'].append(line)
|
148
156
|
line = line.split(',').first
|
@@ -158,7 +166,7 @@ module CocoapodsPodMerge
|
|
158
166
|
abort("Duplicate Group Name: #{group_name}. Please make sure all groups have different names!".red)
|
159
167
|
end
|
160
168
|
|
161
|
-
merge_groups[group_name] = { 'titles' => [], 'lines' => [], 'flags' => {} }
|
169
|
+
merge_groups[group_name] = { 'titles' => [], 'lines' => [], 'flags' => {}, 'swift_version' => '' }
|
162
170
|
parsing_a_group = true
|
163
171
|
end
|
164
172
|
end
|
@@ -172,6 +180,7 @@ module CocoapodsPodMerge
|
|
172
180
|
|
173
181
|
pods_to_merge = group_contents['titles']
|
174
182
|
flags = group_contents['flags']
|
183
|
+
forced_swift_language_version = group_contents['swift_version']
|
175
184
|
public_headers_by_pod = {}
|
176
185
|
frameworks = []
|
177
186
|
prefix_header_contents = []
|
@@ -200,7 +209,7 @@ module CocoapodsPodMerge
|
|
200
209
|
Pod::UI.puts 'Downloading Pods in the group'.cyan
|
201
210
|
FileUtils.mkdir CacheDirectory unless File.directory?(CacheDirectory)
|
202
211
|
|
203
|
-
create_cache_podfile(podfile_info, group_contents['lines'])
|
212
|
+
create_cache_podfile(podfile_info, group_contents['lines'], forced_swift_language_version)
|
204
213
|
|
205
214
|
Dir.chdir(CacheDirectory) do
|
206
215
|
system('pod install') || raise('Failed to download pods to merge')
|
@@ -286,18 +295,23 @@ module CocoapodsPodMerge
|
|
286
295
|
end
|
287
296
|
|
288
297
|
# Generate Module Map
|
289
|
-
Pod::UI.puts "\tGenerating module map".magenta
|
290
298
|
unless mixed_language_group
|
299
|
+
Pod::UI.puts "\tGenerating module map".magenta
|
291
300
|
generate_module_map(merged_framework_name, public_headers_by_pod)
|
292
301
|
end
|
293
302
|
|
294
303
|
# Verify there's a common Swift language version across the group
|
295
304
|
if mixed_language_group
|
296
|
-
|
297
|
-
|
298
|
-
|
305
|
+
if !forced_swift_language_version.empty?
|
306
|
+
swift_version = [forced_swift_language_version]
|
307
|
+
else
|
308
|
+
swift_version = swift_versions.each_value.reduce { |final_swift_version, versions| final_swift_version & versions }
|
309
|
+
unless swift_version&.first
|
310
|
+
Pod::UI.puts "Could not find a common compatible Swift version across the pods to be merged group #{merged_framework_name}: #{swift_versions}".red
|
311
|
+
abort("or specify a swift version in this group using the swift_version! flag, example: swift_version! '5.0'".red)
|
312
|
+
end
|
299
313
|
end
|
300
|
-
Pod::UI.puts "\tUsing Swift Version #{swift_version.first} for the group: #{merged_framework_name}".
|
314
|
+
Pod::UI.puts "\tUsing Swift Version #{swift_version.first} for the group: #{merged_framework_name}".yellow
|
301
315
|
end
|
302
316
|
|
303
317
|
# Create the local podspec
|
@@ -386,9 +400,26 @@ module CocoapodsPodMerge
|
|
386
400
|
return [object] if object.class == String || object.class == Hash
|
387
401
|
end
|
388
402
|
|
389
|
-
def create_cache_podfile(podfile_info, pods)
|
403
|
+
def create_cache_podfile(podfile_info, pods, swift_language_version)
|
390
404
|
FileUtils.touch("#{CacheDirectory}/Podfile")
|
391
405
|
file = File.new("#{CacheDirectory}/Podfile", 'w')
|
406
|
+
|
407
|
+
uses_swift = !swift_language_version.empty?
|
408
|
+
|
409
|
+
# Create a temporary Xcode project for pods missing Swift_Version in the Podspec
|
410
|
+
if uses_swift
|
411
|
+
project = Xcodeproj::Project.new("#{CacheDirectory}/Dummy.xcodeproj")
|
412
|
+
target = project.new_target(:application, 'Dummy', :ios, '13.1', nil, :swift)
|
413
|
+
swift_file = project.main_group.new_file('./dummy.swift')
|
414
|
+
target.add_file_references([swift_file])
|
415
|
+
project.targets.each do |target|
|
416
|
+
target.build_configurations.each do |config|
|
417
|
+
config.build_settings['SWIFT_VERSION'] ||= swift_language_version
|
418
|
+
end
|
419
|
+
end
|
420
|
+
project.save
|
421
|
+
end
|
422
|
+
|
392
423
|
file.puts("require 'json'")
|
393
424
|
podfile_info.sources.each do |source|
|
394
425
|
file.puts source
|
@@ -396,7 +427,13 @@ module CocoapodsPodMerge
|
|
396
427
|
podfile_info.platforms.each do |platform|
|
397
428
|
file.puts platform
|
398
429
|
end
|
399
|
-
|
430
|
+
|
431
|
+
if uses_swift
|
432
|
+
file.puts("install! 'cocoapods', :lock_pod_sources => false")
|
433
|
+
else
|
434
|
+
file.puts("install! 'cocoapods', :integrate_targets => false, :lock_pod_sources => false")
|
435
|
+
end
|
436
|
+
|
400
437
|
file.puts("target 'Dummy' do")
|
401
438
|
pods.each do |line|
|
402
439
|
file.puts line.to_s
|
@@ -413,7 +450,7 @@ module CocoapodsPodMerge
|
|
413
450
|
module_map = File.new("#{InstallationDirectory}/#{merged_framework_name}/Sources/module.modulemap", 'w')
|
414
451
|
module_map.puts("framework module #{merged_framework_name} {")
|
415
452
|
public_headers.each do |pod, headers|
|
416
|
-
module_map.puts("\n\texplicit module #{pod} {")
|
453
|
+
module_map.puts("\n\texplicit module #{pod.delete('+').delete('_')} {")
|
417
454
|
headers.each do |header|
|
418
455
|
module_map.puts("\t\theader \"#{header}\"")
|
419
456
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-pod-merge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siddharth Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '10.0'
|
41
41
|
description: Cocoapods plugin to merge your pods into one framework, to reduce dylib
|
42
42
|
loading time on app startup.
|
43
43
|
email:
|
@@ -62,7 +62,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements:
|
63
63
|
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
65
|
+
version: 2.0.0
|
66
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - ">="
|