@@ -159,6 +159,8 @@ def parse_mergefile
159159 else
160160 merge_groups [ group_name ] [ 'flags' ] [ line . strip . delete ( '!' ) ] = true
161161 end
162+ elsif line . strip . include? ( 'platform' )
163+ merge_groups [ group_name ] [ 'platforms' ] . append ( line )
162164 else
163165 merge_groups [ group_name ] [ 'lines' ] . append ( line )
164166 line = line . split ( ',' ) . first
@@ -174,7 +176,7 @@ def parse_mergefile
174176 abort ( "Duplicate Group Name: #{ group_name } . Please make sure all groups have different names!" . red )
175177 end
176178
177- merge_groups [ group_name ] = { 'titles' => [ ] , 'lines' => [ ] , 'flags' => { } , 'swift_version' => '' }
179+ merge_groups [ group_name ] = { 'titles' => [ ] , 'lines' => [ ] , 'flags' => { } , 'swift_version' => '' , 'platforms' => [ ] }
178180 parsing_a_group = true
179181 end
180182 end
@@ -189,6 +191,7 @@ def merge(merged_framework_name, group_contents, podfile_info)
189191 pods_to_merge = group_contents [ 'titles' ]
190192 flags = group_contents [ 'flags' ]
191193 forced_swift_language_version = group_contents [ 'swift_version' ]
194+ platforms_in_target = group_contents [ 'platforms' ]
192195 public_headers_by_pod = { }
193196 frameworks = [ ]
194197 prefix_header_contents = [ ]
@@ -217,7 +220,7 @@ def merge(merged_framework_name, group_contents, podfile_info)
217220 Pod ::UI . puts 'Downloading Pods in the group' . cyan
218221 FileUtils . mkdir CacheDirectory unless File . directory? ( CacheDirectory )
219222
220- create_cache_podfile ( podfile_info , group_contents [ 'lines' ] , forced_swift_language_version )
223+ create_cache_podfile ( podfile_info , group_contents [ 'lines' ] , forced_swift_language_version , platforms_in_target )
221224
222225 Dir . chdir ( CacheDirectory ) do
223226 system ( 'pod install' ) || raise ( 'Failed to download pods to merge' )
@@ -418,7 +421,7 @@ def array_wrapped(object)
418421 return [ object ] if object . class == String || object . class == Hash
419422 end
420423
421- def create_cache_podfile ( podfile_info , pods , swift_language_version )
424+ def create_cache_podfile ( podfile_info , pods , swift_language_version , platforms_in_target )
422425 FileUtils . touch ( "#{ CacheDirectory } /Podfile" )
423426 file = File . new ( "#{ CacheDirectory } /Podfile" , 'w' )
424427
@@ -442,8 +445,11 @@ def create_cache_podfile(podfile_info, pods, swift_language_version)
442445 podfile_info . sources . each do |source |
443446 file . puts source
444447 end
445- podfile_info . platforms . each do |platform |
446- file . puts platform
448+
449+ if platforms_in_target . length == 0
450+ podfile_info . platforms . each do |platform |
451+ file . puts platform
452+ end
447453 end
448454
449455 if uses_swift
@@ -453,6 +459,9 @@ def create_cache_podfile(podfile_info, pods, swift_language_version)
453459 end
454460
455461 file . puts ( "target 'Dummy' do" )
462+ platforms_in_target . each do |platform |
463+ file . puts platform . to_s
464+ end
456465 pods . each do |line |
457466 file . puts line . to_s
458467 end
0 commit comments