Skip to content

Commit

Permalink
Fix generating podspec for platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Feb 16, 2016
1 parent 9f75dcf commit b61a83c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 32 deletions.
27 changes: 8 additions & 19 deletions lib/cocoapods-packager/pod_utils.rb
Expand Up @@ -39,27 +39,17 @@ def install_pod(platform_name, sandbox)
end

def podfile_from_spec(path, spec_name, platform_name, deployment_target, subspecs, sources)
options = {}
if path
options[:podspec] = path
else
options[:path] = '.'
end
options[:subspecs] = subspecs if subspecs
Pod::Podfile.new do

sources.each { |s| source s }
platform(platform_name, deployment_target)
if path
if subspecs
subspecs.each do |subspec|
pod spec_name + '/' + subspec, :podspec => path
end
else
pod spec_name, :podspec => path
end
else
if subspecs
subspecs.each do |subspec|
pod spec_name + '/' + subspec, :path => '.'
end
else
pod spec_name, :path => '.'
end
end
pod(spec_name, options)
end
end

Expand Down Expand Up @@ -230,7 +220,6 @@ def write_pod_project(dynamic_project, dynamic_sandbox)
dynamic_project.development_pods.remove_from_project if dynamic_project.development_pods.empty?
dynamic_project.sort(:groups_position => :below)
dynamic_project.recreate_user_schemes(false)
dynamic_project.predictabilize_uuids if config.deterministic_uuids?

# Edit search paths so that we can find our dependency headers
dynamic_project.targets.first.build_configuration_list.build_configurations.each do |config|
Expand Down
15 changes: 2 additions & 13 deletions lib/cocoapods-packager/spec_builder.rb
Expand Up @@ -19,12 +19,12 @@ def spec_platform(platform)
fwk_base = platform.name.to_s + '/' + framework_path
if @dynamic
spec = <<RB
s.#{platform.name}.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}'
s.#{platform.name}.deployment_target = '#{platform.deployment_target}'
s.#{platform.name}.vendored_framework = '#{fwk_base}'
RB
else
spec = <<SPEC
s.#{platform.name}.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}'
s.#{platform.name}.deployment_target = '#{platform.deployment_target}'
s.#{platform.name}.preserve_paths = '#{fwk_base}'
s.#{platform.name}.public_header_files = '#{fwk_base}/Versions/A/Headers/*.h'
s.#{platform.name}.resource = '#{fwk_base}/Versions/A/Resources/**/*'
Expand All @@ -46,7 +46,6 @@ def spec_platform(platform)

def spec_metadata
spec = spec_header
spec += spec_single_platform_fix
spec
end

Expand All @@ -71,15 +70,5 @@ def spec_header

spec + " s.source = #{@source}\n\n"
end

def spec_single_platform_fix
return '' if @spec.available_platforms.length > 1

platform = @spec.available_platforms.first

<<SPEC
s.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}'
SPEC
end
end
end

0 comments on commit b61a83c

Please sign in to comment.