diff --git a/Rakefile b/Rakefile index dc652ff69de20..6a82265c6e8ad 100644 --- a/Rakefile +++ b/Rakefile @@ -32,15 +32,16 @@ require 'rake_tasks/selenium_rake/java_formatter' require 'rake_tasks/selenium_rake/cpp_formatter' require 'rake_tasks/selenium_rake/type_definitions_generator' +# Our modifications to the Rake library +require 'rake_tasks/rake/task' +require 'rake_tasks/rake/dsl' + # Require the migrated rake files, which need to be tidied up further # These are the final items mixed into the global NS require 'rake_tasks/bazel' require 'rake_tasks/copyright' require 'rake_tasks/python' -# Our modifications to the Rake library -require 'rake_tasks/rake/task' - $DEBUG = orig_verbose != Rake::FileUtilsExt::DEFAULT ? true : false $DEBUG = true if ENV['debug'] == 'true' diff --git a/rake_tasks/bazel.rb b/rake_tasks/bazel.rb index 05ba65a9cd5f8..961c2ac092595 100644 --- a/rake_tasks/bazel.rb +++ b/rake_tasks/bazel.rb @@ -3,58 +3,54 @@ require 'rake/task' require 'rake_tasks/selenium_rake/checks' require 'rake_tasks/bazel/task' -require 'rake_tasks/rake/dsl' module Bazel - class << self - def execute(kind, args, target, &block) - verbose = Rake::FileUtilsExt.verbose_flag + def self.execute(kind, args, target, &block) + verbose = Rake::FileUtilsExt.verbose_flag - if target.end_with?(":run") - kind = "run" - target = target[0, target.length - 4] - end + if target.end_with?(':run') + kind = 'run' + target = target[0, target.length - 4] + end - 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 - Open3.popen2e(*cmd) do |stdin, stdouts, wait| - is_running = true - stdin.close - cmd_out = '' - while is_running - begin - pipes = IO.select([stdouts]) - if pipes.empty? - is_running = false - else - line = stdouts.readpartial(512) - cmd_out << line - STDOUT.print line if verbose - end - rescue EOFError + cmd = %w[bazel] + [kind, target] + (args || []) + + if SeleniumRake::Checks.windows? + cmd = cmd + ["2>&1"] + cmd_line = cmd.join(' ') + cmd_out = `#{cmd_line}` + cmd_exit_code = $?.success? + else + Open3.popen2e(*cmd) do |stdin, stdouts, wait| + is_running = true + stdin.close + cmd_out = '' + while is_running + begin + pipes = IO.select([stdouts]) + if pipes.empty? is_running = false + else + line = stdouts.readpartial(512) + cmd_out << line + STDOUT.print line if verbose end + rescue EOFError + is_running = false end - cmd_exit_code = wait.value.exitstatus end + cmd_exit_code = wait.value.exitstatus end + end - puts cmd_out if verbose + puts cmd_out if verbose - raise "#{cmd.join(' ')} failed with exit code: #{cmd_exit_code}" if not cmd_exit_code + raise "#{cmd.join(' ')} failed with exit code: #{cmd_exit_code}" unless cmd_exit_code - block&.call(cmd_out) - out_artifact = Regexp.last_match(1) if cmd_out =~ %r{\s+(bazel-bin/\S+)} + block&.call(cmd_out) + out_artifact = Regexp.last_match(1) if cmd_out =~ %r{\s+(bazel-bin/\S+)} - puts "#{target} -> #{out_artifact}" if out_artifact - out_artifact - end + puts "#{target} -> #{out_artifact}" if out_artifact + out_artifact end end \ No newline at end of file diff --git a/rake_tasks/crazy_fun/mappings/python.rb b/rake_tasks/crazy_fun/mappings/python.rb index 3926a1b1867b0..dd22d53aba65c 100644 --- a/rake_tasks/crazy_fun/mappings/python.rb +++ b/rake_tasks/crazy_fun/mappings/python.rb @@ -1,8 +1,5 @@ require 'rake_tasks/selenium_rake/checks' -require_relative 'python/add_normal_dependencies' -require_relative 'python/py_task' - module Python def self.lib_dir Dir.glob('build/lib*')[0] || 'build/lib' diff --git a/rake_tasks/crazy_fun/mappings/python/add_normal_dependencies.rb b/rake_tasks/crazy_fun/mappings/python/add_normal_dependencies.rb deleted file mode 100644 index 53bb892254fac..0000000000000 --- a/rake_tasks/crazy_fun/mappings/python/add_normal_dependencies.rb +++ /dev/null @@ -1,8 +0,0 @@ -module Python - class AddNormalDependencies < PyTask - def handle(fun, dir, args) - target = Rake::Task[task_name(dir, "#{args[:name]}")] - add_dependencies(target, dir, args[:deps]) - end - end -end diff --git a/rake_tasks/crazy_fun/mappings/python/py_task.rb b/rake_tasks/crazy_fun/mappings/python/py_task.rb deleted file mode 100644 index 51e270d043d54..0000000000000 --- a/rake_tasks/crazy_fun/mappings/python/py_task.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Python - class PyTask < Tasks - def get_resources(_browser, args) - resources = [] - resources.concat(args[:resources]) if args[:resources] - resources - end - end -end diff --git a/rake_tasks/crazy_fun/mappings/rename.rb b/rake_tasks/crazy_fun/mappings/rename.rb deleted file mode 100644 index 70aa27d15eb5e..0000000000000 --- a/rake_tasks/crazy_fun/mappings/rename.rb +++ /dev/null @@ -1 +0,0 @@ -require_relative 'rename_mappings'