Skip to content

Commit

Permalink
Improving crazyfun-bazel integration for non-windows systems
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Oct 3, 2019
1 parent 8e9dca1 commit 2d1e0bb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions rakelib/bazel.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'pp'
require 'rake/task'
require 'rake_tasks/selenium_rake/checks'
require 'rakelib/bazel/task'
require 'rakelib/rake/dsl'

Expand All @@ -8,15 +9,22 @@ module Bazel
def execute(kind, args, target, &block)
verbose = Rake::FileUtilsExt.verbose_flag

cmd = %w[bazel] + [kind, target] + (args || []) + ["2>&1"]
cmd_line = cmd.join(" ")
puts cmd_line

cmd_out = `#{cmd_line}`
cmd = %w[bazel] + [kind, target] + (args || [])
puts cmd.join(" ")

if SeleniumRake::Checks::windows?
cmd = cmd + ["2>&1"]
cmd_line = cmd.join(" ")
cmd_out = `#{cmd_line}`
cmd_exit_code = $?.success?
else
cmd_out = `#{cmd_line}`
cmd_exit_code = $?.success?
end

puts cmd_out if verbose

raise "#{cmd.join(' ')} failed with exit code: #{$?.success?}" if not $?.success?
raise "#{cmd.join(' ')} failed with exit code: #{cmd_exit_code}" if not cmd_exit_code

block&.call(cmd_out)
out_artifact = Regexp.last_match(1) if cmd_out =~ %r{\s+(bazel-bin/\S+)}
Expand Down

0 comments on commit 2d1e0bb

Please sign in to comment.