Unverified Commit 77d34d36 authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by GitHub

Merge pull request #7064 from abbeycode/issue7040

Update validator to stream output as xcodebuild runs
parents 1680ff7b 3760780d
...@@ -61,6 +61,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -61,6 +61,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
* Document format of POD_NAMES in pod update * Document format of POD_NAMES in pod update
[mrh-is](https://github.com/mrh-is) [mrh-is](https://github.com/mrh-is)
* Update validator to stream output as xcodebuild runs
[abbeycode](https://github.com/abbeycode)
[#7040](https://github.com/CocoaPods/CocoaPods/issues/7040)
##### Bug Fixes ##### Bug Fixes
* Prevent `xcassets` compilation from stomping over the apps `xcassets` * Prevent `xcassets` compilation from stomping over the apps `xcassets`
......
...@@ -576,7 +576,6 @@ module Pod ...@@ -576,7 +576,6 @@ module Pod
UI.warn "Skipping compilation with `xcodebuild` because target contains no sources.\n".yellow UI.warn "Skipping compilation with `xcodebuild` because target contains no sources.\n".yellow
else else
output = xcodebuild('build', scheme, 'Release') output = xcodebuild('build', scheme, 'Release')
UI.puts output
parsed_output = parse_xcodebuild_output(output) parsed_output = parse_xcodebuild_output(output)
translate_output_to_linter_messages(parsed_output) translate_output_to_linter_messages(parsed_output)
end end
...@@ -600,7 +599,6 @@ module Pod ...@@ -600,7 +599,6 @@ module Pod
consumer.spec.test_specs.each do |test_spec| consumer.spec.test_specs.each do |test_spec|
scheme = pod_target.native_target_for_spec(test_spec) scheme = pod_target.native_target_for_spec(test_spec)
output = xcodebuild('test', scheme, 'Debug') output = xcodebuild('test', scheme, 'Debug')
UI.puts output
parsed_output = parse_xcodebuild_output(output) parsed_output = parse_xcodebuild_output(output)
translate_output_to_linter_messages(parsed_output) translate_output_to_linter_messages(parsed_output)
end end
...@@ -873,25 +871,22 @@ module Pod ...@@ -873,25 +871,22 @@ module Pod
command += Fourflusher::SimControl.new.destination(:oldest, 'tvOS', deployment_target) command += Fourflusher::SimControl.new.destination(:oldest, 'tvOS', deployment_target)
end end
output, status = _xcodebuild(command) begin
_xcodebuild(command, true)
unless status.success? rescue => e
message = 'Returned an unsuccessful exit code.' message = 'Returned an unsuccessful exit code.'
message += ' You can use `--verbose` for more information.' unless config.verbose? message += ' You can use `--verbose` for more information.' unless config.verbose?
error('xcodebuild', message) error('xcodebuild', message)
e.message
end end
output
end end
# Executes the given command in the current working directory. # Executes the given command in the current working directory.
# #
# @return [(String, Status)] The output of the given command and its # @return [String] The output of the given command
# resulting status.
# #
def _xcodebuild(command) def _xcodebuild(command, raise_on_failure = false)
UI.puts 'xcodebuild ' << command.join(' ') if config.verbose Executable.execute_command('xcodebuild', command, raise_on_failure)
Executable.capture_command('xcodebuild', command, :capture => :merge)
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
...@@ -491,9 +491,7 @@ module Pod ...@@ -491,9 +491,7 @@ module Pod
git = Executable.which(:git) git = Executable.which(:git)
Executable.stubs(:which).with('git').returns(git) Executable.stubs(:which).with('git').returns(git)
Executable.stubs(:which).with(:xcrun) Executable.stubs(:which).with(:xcrun)
status = mock validator.stubs(:_xcodebuild).raises(Informative)
status.stubs(:success?).returns(false)
validator.stubs(:_xcodebuild).returns(['Output', status])
validator.validate validator.validate
first = validator.results.map(&:to_s).first first = validator.results.map(&:to_s).first
first.should.include '[xcodebuild] Returned an unsuccessful exit code' first.should.include '[xcodebuild] Returned an unsuccessful exit code'
...@@ -504,6 +502,7 @@ module Pod ...@@ -504,6 +502,7 @@ module Pod
require 'fourflusher' require 'fourflusher'
Fourflusher::SimControl.any_instance.stubs(:destination).returns(['-destination', 'id=XXX']) Fourflusher::SimControl.any_instance.stubs(:destination).returns(['-destination', 'id=XXX'])
Validator.any_instance.unstub(:xcodebuild) Validator.any_instance.unstub(:xcodebuild)
PodTarget.any_instance.stubs(:should_build?).returns(true)
validator = Validator.new(podspec_path, config.sources_manager.master.map(&:url)) validator = Validator.new(podspec_path, config.sources_manager.master.map(&:url))
validator.stubs(:check_file_patterns) validator.stubs(:check_file_patterns)
validator.stubs(:validate_url) validator.stubs(:validate_url)
...@@ -512,16 +511,17 @@ module Pod ...@@ -512,16 +511,17 @@ module Pod
Executable.stubs(:which).with('git').returns(git) Executable.stubs(:which).with('git').returns(git)
Executable.stubs(:capture_command).with('git', ['config', '--get', 'remote.origin.url'], :capture => :out).returns(['https://github.com/CocoaPods/Specs.git']) Executable.stubs(:capture_command).with('git', ['config', '--get', 'remote.origin.url'], :capture => :out).returns(['https://github.com/CocoaPods/Specs.git'])
Executable.stubs(:which).with(:xcrun) Executable.stubs(:which).with(:xcrun)
Executable.expects(:execute_command).with { |executable, command, _| executable == 'git' && command.first == 'clone' }.once
# Command should include the pod target 'JSONKit' instead of the 'App' target. # Command should include the pod target 'JSONKit' instead of the 'App' target.
command = ['clean', 'build', '-workspace', File.join(validator.validation_dir, 'App.xcworkspace'), '-scheme', 'JSONKit', '-configuration', 'Release'] command = ['clean', 'build', '-workspace', File.join(validator.validation_dir, 'App.xcworkspace'), '-scheme', 'JSONKit', '-configuration', 'Release']
args = %w(CODE_SIGN_IDENTITY=) args = %w(CODE_SIGN_IDENTITY=)
Executable.expects(:capture_command).with('xcodebuild', command + args, :capture => :merge).once.returns(['', stub(:success? => true)]) Executable.expects(:execute_command).with('xcodebuild', command + args, true).once.returns('')
args = %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator) + Fourflusher::SimControl.new.destination('Apple TV 1080p') args = %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator) + Fourflusher::SimControl.new.destination('Apple TV 1080p')
Executable.expects(:capture_command).with('xcodebuild', command + args, :capture => :merge).once.returns(['', stub(:success? => true)]) Executable.expects(:execute_command).with('xcodebuild', command + args, true).once.returns('')
args = %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator) + Fourflusher::SimControl.new.destination('iPhone 4s') args = %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator) + Fourflusher::SimControl.new.destination('iPhone 4s')
Executable.expects(:capture_command).with('xcodebuild', command + args, :capture => :merge).once.returns(['', stub(:success? => true)]) Executable.expects(:execute_command).with('xcodebuild', command + args, true).once.returns('')
args = %w(CODE_SIGN_IDENTITY=- -sdk watchsimulator) + Fourflusher::SimControl.new.destination('Apple Watch - 38mm') args = %w(CODE_SIGN_IDENTITY=- -sdk watchsimulator) + Fourflusher::SimControl.new.destination('Apple Watch - 38mm')
Executable.expects(:capture_command).with('xcodebuild', command + args, :capture => :merge).once.returns(['', stub(:success? => true)]) Executable.expects(:execute_command).with('xcodebuild', command + args, true).once.returns('')
validator.validate validator.validate
end end
...@@ -536,15 +536,16 @@ module Pod ...@@ -536,15 +536,16 @@ module Pod
Executable.stubs(:which).with('git').returns(git) Executable.stubs(:which).with('git').returns(git)
Executable.stubs(:capture_command).with('git', ['config', '--get', 'remote.origin.url'], :capture => :out).returns(['https://github.com/CocoaPods/Specs.git']) Executable.stubs(:capture_command).with('git', ['config', '--get', 'remote.origin.url'], :capture => :out).returns(['https://github.com/CocoaPods/Specs.git'])
Executable.stubs(:which).with(:xcrun) Executable.stubs(:which).with(:xcrun)
Executable.expects(:execute_command).with { |executable, command, _| executable == 'git' && command.first == 'clone' }.once
command = ['clean', 'build', '-workspace', File.join(validator.validation_dir, 'App.xcworkspace'), '-scheme', 'App', '-configuration', 'Release'] command = ['clean', 'build', '-workspace', File.join(validator.validation_dir, 'App.xcworkspace'), '-scheme', 'App', '-configuration', 'Release']
args = %w(CODE_SIGN_IDENTITY=) args = %w(CODE_SIGN_IDENTITY=)
Executable.expects(:capture_command).with('xcodebuild', command + args, :capture => :merge).once.returns(['', stub(:success? => true)]) Executable.expects(:execute_command).with('xcodebuild', command + args, true).once.returns('')
args = %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator) + Fourflusher::SimControl.new.destination('Apple TV 1080p') args = %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator) + Fourflusher::SimControl.new.destination('Apple TV 1080p')
Executable.expects(:capture_command).with('xcodebuild', command + args, :capture => :merge).once.returns(['', stub(:success? => true)]) Executable.expects(:execute_command).with('xcodebuild', command + args, true).once.returns('')
args = %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator) + Fourflusher::SimControl.new.destination('iPhone 4s') args = %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator) + Fourflusher::SimControl.new.destination('iPhone 4s')
Executable.expects(:capture_command).with('xcodebuild', command + args, :capture => :merge).once.returns(['', stub(:success? => true)]) Executable.expects(:execute_command).with('xcodebuild', command + args, true).once.returns('')
args = %w(CODE_SIGN_IDENTITY=- -sdk watchsimulator) + Fourflusher::SimControl.new.destination('Apple Watch - 38mm') args = %w(CODE_SIGN_IDENTITY=- -sdk watchsimulator) + Fourflusher::SimControl.new.destination('Apple Watch - 38mm')
Executable.expects(:capture_command).with('xcodebuild', command + args, :capture => :merge).once.returns(['', stub(:success? => true)]) Executable.expects(:execute_command).with('xcodebuild', command + args, true).once.returns('')
validator.validate validator.validate
end end
......
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