Commit ef1fa931 authored by Samuel Giddins's avatar Samuel Giddins

Remove pre-1.0 migration logic

parent 7d6c3b19
...@@ -12,66 +12,11 @@ module Pod ...@@ -12,66 +12,11 @@ module Pod
# The sandbox which should be migrated. # The sandbox which should be migrated.
# #
def migrate(sandbox) def migrate(sandbox)
if sandbox.manifest return unless sandbox.manifest
migrate_to_0_34(sandbox) if installation_minor?('0.34', sandbox)
migrate_to_0_36(sandbox) if installation_minor?('0.36', sandbox)
end
end end
# @!group Migration Steps # @!group Migration Steps
# Migrates from CocoaPods versions previous to 0.34.
#
# @param [Sandbox] sandbox
#
def migrate_to_0_34(sandbox)
UI.message('Migrating to CocoaPods 0.34') do
delete(sandbox.root + 'Headers')
make_path(sandbox.headers_root)
sandbox.root.children.each do |child|
relative = child.relative_path_from(sandbox.root)
case relative.to_s
when 'Manifest.lock', 'Pods.xcodeproj', 'Headers',
'Target Support Files', 'Local Podspecs'
next
when 'BuildHeaders', 'PublicHeaders'
delete(child)
else
if child.directory? && child.extname != '.xcodeproj'
next
else
delete(child)
end
end
end
end
delete(Pathname(File.join(ENV['HOME'], 'Library/Caches/CocoaPods/Git')))
end
# Migrates from CocoaPods versions prior to 0.36.
#
# @param [Sandbox] sandbox
#
def migrate_to_0_36(sandbox)
UI.message('Migrating to CocoaPods 0.36') do
move(sandbox.root + 'Headers/Build', sandbox.root + 'Headers/Private')
lockfile = sandbox.manifest.to_hash
sandbox.specifications_root.children.each do |child|
next unless child.basename.to_s =~ /\.podspec$/
spec = Specification.from_file(child)
child.delete
child = Pathname("#{child}.json")
File.open(child, 'w') { |f| f.write spec.to_pretty_json }
lockfile['SPEC CHECKSUMS'][spec.name] = Specification.from_file(child).checksum
end
sandbox.manifest = Lockfile.new(lockfile)
sandbox.manifest.write_to_disk(sandbox.manifest_path)
end
end
# @!group Private helpers # @!group Private helpers
# Check whether a migration is required # Check whether a migration is required
......
...@@ -39,9 +39,6 @@ module Pod ...@@ -39,9 +39,6 @@ module Pod
def integrate! def integrate!
UI.section(integration_message) do UI.section(integration_message) do
XCConfigIntegrator.integrate(target, native_targets) XCConfigIntegrator.integrate(target, native_targets)
update_to_cocoapods_0_34
update_to_cocoapods_0_37_1
update_to_cocoapods_0_39
add_pods_library add_pods_library
add_embed_frameworks_script_phase add_embed_frameworks_script_phase
...@@ -61,73 +58,6 @@ module Pod ...@@ -61,73 +58,6 @@ module Pod
# @!group Integration steps # @!group Integration steps
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
# Fixes the paths of the copy resource scripts.
#
# @return [Bool] whether any changes to the project were made.
#
# @todo This can be removed for CocoaPods 1.0
#
def update_to_cocoapods_0_34
phases = native_targets.map do |target|
target.shell_script_build_phases.select do |bp|
bp.name == 'Copy Pods Resources'
end
end.flatten
script_path = target.copy_resources_script_relative_path
shell_script = %("#{script_path}"\n)
phases.each do |phase|
unless phase.shell_script == shell_script
phase.shell_script = shell_script
end
end
end
# Removes the embed frameworks phase for target types.
#
# @return [Bool] whether any changes to the project were made.
#
# @todo This can be removed for CocoaPods 1.0
#
def update_to_cocoapods_0_37_1
targets_to_embed = native_targets.select do |target|
EMBED_FRAMEWORK_TARGET_TYPES.include?(target.symbol_type)
end
(native_targets - targets_to_embed).any? do |native_target|
remove_embed_frameworks_script_phase(native_target)
end
end
# Adds the embed frameworks script when integrating as a static library.
#
# @todo This can be removed for CocoaPods 1.0
#
def update_to_cocoapods_0_39
targets_to_embed = native_targets.select do |target|
EMBED_FRAMEWORK_TARGET_TYPES.include?(target.symbol_type)
end
targets_to_embed.each do |native_target|
add_embed_frameworks_script_phase_to_target(native_target)
end
frameworks = user_project.frameworks_group
native_targets.each do |native_target|
build_phase = native_target.frameworks_build_phase
product_ref = frameworks.files.find { |f| f.path == target.product_name }
if product_ref
build_file = build_phase.build_file(product_ref)
if build_file &&
build_file.settings.is_a?(Hash) &&
build_file.settings['ATTRIBUTES'].is_a?(Array) &&
build_file.settings['ATTRIBUTES'].include?('Weak')
build_file.settings = nil
end
end
end
end
# Adds spec product reference to the frameworks build phase of the # Adds spec product reference to the frameworks build phase of the
# {TargetDefinition} integration libraries. Adds a file reference to # {TargetDefinition} integration libraries. Adds a file reference to
# the frameworks group of the project and adds it to the frameworks # the frameworks group of the project and adds it to the frameworks
......
Subproject commit b0af34fb0ea6244379a1be1b5054a29b099d470d Subproject commit f8b43d7c1234dad8fa40c9e1dacbeb32980d4ea2
...@@ -2,11 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__) ...@@ -2,11 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod module Pod
describe Installer::Migrator do describe Installer::Migrator do
it "doesn't perform migrations if they are not needed" do
manifest = stub(:cocoapods_version => Version.new('999'))
config.sandbox.stubs(:manifest).returns(manifest)
Installer::Migrator.expects(:migrate_to_0_34).never
Installer::Migrator.migrate(config.sandbox)
end
end end
end end
...@@ -48,18 +48,6 @@ module Pod ...@@ -48,18 +48,6 @@ module Pod
phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh\"" phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh\""
end end
it 'fixes the "Link binary with libraries" build phase of legacy installations' do
@target_integrator.unstub(:update_to_cocoapods_0_39)
@pod_bundle.stubs(:requires_frameworks? => true)
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.frameworks_build_phase
build_file = phase.files.find { |f| f.file_ref.path == 'Pods.framework' }
build_file.settings = { 'ATTRIBUTES' => %w(Weak) }
@target_integrator.integrate!
build_file.settings.should.be.nil
end
it 'adds references to the Pods static libraries to the Frameworks group' do it 'adds references to the Pods static libraries to the Frameworks group' do
@target_integrator.integrate! @target_integrator.integrate!
@target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.be.nil @target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.be.nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment