From e2f6e147d06cc5c0c7bed83249d3fb0ec3dd27dd Mon Sep 17 00:00:00 2001 From: Simon Stewart Date: Mon, 26 Aug 2024 10:04:44 +0100 Subject: [PATCH] [bazel] Use the `release` configs for the release tasks (#14423) Rather than passing `--stamp` everywhere, use a proper config so that we can easily add additional flags. I've broken out a `remote_release` config which builds things remotely and then downloads the artifacts given on the command line to the local machine. This only makes sense for targets which we do _not_ `run` (as `run` happens locally, so we'd need to rebuild any artifacts anyway) Co-authored-by: Diego Molina --- .bazelrc | 8 +++++++- Rakefile | 23 ++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.bazelrc b/.bazelrc index 281fcd02ad7d5..f0031fc19eab8 100644 --- a/.bazelrc +++ b/.bazelrc @@ -102,8 +102,14 @@ test --test_timeout=1800 test:node_debug --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results test:ruby_debug --test_output=streamed --test_env=RUBY_DEBUG_FORK_MODE=parent --run_under="@bundle//bin:rdbg --nonstop --open --command" -build:release --config=remote + build:release --stamp +build:release --compilation_mode=opt + +# As regular `release` but all the build work happens on the RBE +build:remote_release --config=release +build:remote_release --config=remote +build:remote_release --remote_download_toplevel # RBE import %workspace%/.bazelrc.remote diff --git a/Rakefile b/Rakefile index 0dc22a2ebeba1..408c766a1f4fe 100644 --- a/Rakefile +++ b/Rakefile @@ -331,7 +331,7 @@ task ios_driver: [ # ./go java:package['--config=release'] desc 'Create stamped zipped assets for Java for uploading to GitHub' task :'java-release-zip' do - Rake::Task['java:package'].invoke('--stamp') + Rake::Task['java:package'].invoke('--config=remote_release') end task 'release-java': %i[java-release-zip publish-maven] @@ -450,7 +450,7 @@ namespace :node do nightly = args.delete('nightly') Rake::Task['node:version'].invoke('nightly') if nightly - Bazel.execute('run', ['--stamp'], '//javascript/node/selenium-webdriver:selenium-webdriver.publish') + Bazel.execute('run', ['--config=release'], '//javascript/node/selenium-webdriver:selenium-webdriver.publish') end desc 'Release Node npm package' @@ -513,7 +513,7 @@ namespace :py do Rake::Task['py:version'].invoke('nightly') if nightly command = nightly ? '//py:selenium-release-nightly' : '//py:selenium-release' - Bazel.execute('run', ['--stamp'], command) + Bazel.execute('run', ['--config=release'], command) end desc 'generate and copy files required for local development' @@ -680,10 +680,10 @@ namespace :rb do if nightly Bazel.execute('run', [], '//rb:selenium-webdriver-bump-nightly-version') - Bazel.execute('run', ['--stamp'], '//rb:selenium-webdriver-release-nightly') + Bazel.execute('run', ['--config=release'], '//rb:selenium-webdriver-release-nightly') else - Bazel.execute('run', ['--stamp'], '//rb:selenium-webdriver-release') - Bazel.execute('run', ['--stamp'], '//rb:selenium-devtools-release') + Bazel.execute('run', ['--config=release'], '//rb:selenium-webdriver-release') + Bazel.execute('run', ['--config=release'], '//rb:selenium-devtools-release') end end @@ -753,7 +753,7 @@ namespace :dotnet do args = arguments.to_a.compact nightly = args.delete('nightly') Rake::Task['dotnet:version'].invoke('nightly') if nightly - Rake::Task['dotnet:package'].invoke('--stamp') + Rake::Task['dotnet:package'].invoke('--config=remote_release') api_key = ENV.fetch('NUGET_API_KEY', nil) push_destination = 'https://api.nuget.org/v3/index.json' @@ -839,7 +839,7 @@ namespace :java do desc 'Package Java bindings and grid into releasable packages and stage for release' task :package do |_task, arguments| - args = arguments.to_a.compact.empty? ? ['--stamp'] : arguments.to_a.compact + args = arguments.to_a.compact.empty? ? ['--config=release'] : arguments.to_a.compact Bazel.execute('build', args, '//java/src/org/openqa/selenium:client-zip') Bazel.execute('build', args, '//java/src/org/openqa/selenium/grid:server-zip') Bazel.execute('build', args, '//java/src/org/openqa/selenium/grid:executable-grid') @@ -872,9 +872,10 @@ namespace :java do ENV['GPG_SIGN'] = (!nightly).to_s Rake::Task['java:version'].invoke if nightly - Rake::Task['java:package'].invoke('--stamp') - Rake::Task['java:build'].invoke('--stamp') - JAVA_RELEASE_TARGETS.each { |target| Bazel.execute('run', ['--stamp'], target) } + Rake::Task['java:package'].invoke('--config=release') + Rake::Task['java:build'].invoke('--config=release') + # Because we want to `run` things, we can't use the `release` config + JAVA_RELEASE_TARGETS.each { |target| Bazel.execute('run', ['--config=release'], target) } end desc 'Install jars to local m2 directory'