-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: Initial bazel build file changes for Windows #3884
Changes from 1 commit
9b26b1e
1e5ccfc
93dd729
8d04a12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ SOURCE_VERSION | |
.cache | ||
.vimrc | ||
.vscode | ||
.vs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
echo "Start" | ||
@ECHO OFF | ||
%BAZEL_SH% -c "./repositories.sh %*" | ||
exit %ERRORLEVEL% |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
$ErrorActionPreference = "Stop"; | ||
trap { $host.SetShouldExit(1) } | ||
|
||
if ("$env:NUM_CPUS" -eq "") { | ||
$env:NUM_CPUS = (Get-WmiObject -class Win32_computersystem).NumberOfLogicalProcessors | ||
} | ||
|
||
if ("$env:ENVOY_BAZEL_ROOT" -eq "") { | ||
Write-Host "ENVOY_BAZEL_ROOT must be set!" | ||
throw | ||
} | ||
|
||
mkdir -force "$env:ENVOY_BAZEL_ROOT" > $nul | ||
|
||
$env:ENVOY_SRCDIR = [System.IO.Path]::GetFullPath("$PSScriptRoot\..") | ||
|
||
echo "ENVOY_BAZEL_ROOT: $env:ENVOY_BAZEL_ROOT" | ||
echo "ENVOY_SRCDIR: $env:ENVOY_SRCDIR" | ||
|
||
$env:BAZEL_BASE_OPTIONS="--nomaster_bazelrc --output_base=$env:ENVOY_BAZEL_ROOT --bazelrc=$env:ENVOY_SRCDIR\windows\tools\bazel.rc --batch" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$env:BAZEL_BUILD_OPTIONS="--strategy=Genrule=standalone --spawn_strategy=standalone --verbose_failures --action_env=HOME --action_env=PYTHONUSERBASE --jobs=$env:NUM_CPUS --show_task_finish $env:BAZEL_BUILD_EXTRA_OPTIONS" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does not. It doesn't look like we need any of the other |
||
$env:BAZEL_TEST_OPTIONS="$env:BAZEL_BUILD_OPTIONS --test_env=HOME --test_env=PYTHONUSERBASE --test_env=UBSAN_OPTIONS=print_stacktrace=1 --cache_test_results=no --test_output=all $env:BAZEL_EXTRA_TEST_OPTIONS" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$ErrorActionPreference = "Stop"; | ||
trap { $host.SetShouldExit(1) } | ||
|
||
. "$PSScriptRoot\build_setup.ps1" | ||
Write-Host "building using $env:NUM_CPUS CPUs" | ||
|
||
function bazel_debug_binary_build() { | ||
echo "Building..." | ||
pushd "$env:ENVOY_SRCDIR" | ||
bazel $env:BAZEL_BASE_OPTIONS.Split(" ") build $env:BAZEL_BUILD_OPTIONS.Split(" ") -c dbg "//source/exe:envoy-static" | ||
$exit = $LASTEXITCODE | ||
if ($exit -ne 0) { | ||
popd | ||
exit $exit | ||
} | ||
popd | ||
} | ||
|
||
echo "bazel debug build..." | ||
bazel_debug_binary_build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you define 3 different
config_setting
rules for Windows for thecompilation_mode
options? They are all used the same way, you could substitute them with//bazel:windows_x86_64
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the 3 different
config_setting
rules for thisselect
here: https://github.com/greenhouse-org/envoy/blob/windows-build-pr/bazel/envoy_build_system.bzl#L36-L41Specifically, we want to never append
-ggdb3
to thecopts
on Windows, but we want to keep the selection mechanism on Linux. If we just add//bazel:windows_x86_64
to thatselect
, it will fail since multiple options will be true (e.g.//bazel:windows_x86_64
and//bazel:dbg_build
).As far as we know, this is the best way to
select
on multiple conditions -- did we miss some other way to do this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. No, I think you're right. Thanks for the explanation!