Skip to content

Commit

Permalink
[bazel] Use the release configs for the release tasks (SeleniumHQ#1…
Browse files Browse the repository at this point in the history
…4423)

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 <[email protected]>
  • Loading branch information
shs96c and diemol authored Aug 26, 2024
1 parent ef1b422 commit e2f6e14
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
8 changes: 7 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 12 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit e2f6e14

Please sign in to comment.