Skip to content

Commit

Permalink
Merge pull request #48 from dulaccc/fix-chdir-xcode8
Browse files Browse the repository at this point in the history
Avoid using chdir since the behavior is unexpected now
  • Loading branch information
segiddins authored Oct 4, 2016
2 parents 46feede + bbadafd commit d601719
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/cocoapods-rome/post_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def build_for_iosish_platform(sandbox, build_dir, target, device, simulator)
end

def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil)
args = %W(-project #{sandbox.project_path.basename} -scheme #{target} -configuration #{CONFIGURATION} -sdk #{sdk})
args = %W(-project #{sandbox.project_path.realdirpath} -scheme #{target} -configuration #{CONFIGURATION} -sdk #{sdk})
platform = PLATFORMS[sdk]
args += Fourflusher::SimControl.new.destination(:oldest, platform, deployment_target) unless platform.nil?
Pod::Executable.execute_command 'xcodebuild', args, true
Expand All @@ -48,16 +48,14 @@ def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil)
Pod::UI.puts 'Building frameworks'

build_dir.rmtree if build_dir.directory?
Dir.chdir(sandbox.project_path.dirname) do
targets = installer_context.umbrella_targets.select { |t| t.specs.any? }
targets.each do |target|
case target.platform_name
when :ios then build_for_iosish_platform(sandbox, build_dir, target, 'iphoneos', 'iphonesimulator')
when :osx then xcodebuild(sandbox, target.cocoapods_target_label)
when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator')
when :watchos then build_for_iosish_platform(sandbox, build_dir, target, 'watchos', 'watchsimulator')
else raise "Unknown platform '#{target.platform_name}'" end
end
targets = installer_context.umbrella_targets.select { |t| t.specs.any? }
targets.each do |target|
case target.platform_name
when :ios then build_for_iosish_platform(sandbox, build_dir, target, 'iphoneos', 'iphonesimulator')
when :osx then xcodebuild(sandbox, target.cocoapods_target_label)
when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator')
when :watchos then build_for_iosish_platform(sandbox, build_dir, target, 'watchos', 'watchsimulator')
else raise "Unknown platform '#{target.platform_name}'" end
end

raise Pod::Informative, 'The build directory was not found in the expected location.' unless build_dir.directory?
Expand Down

0 comments on commit d601719

Please sign in to comment.