From 5881e86ddfa68883a5f5742e358125895f70aa90 Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Tue, 26 Sep 2023 08:05:41 -0700 Subject: [PATCH] Update rcfile advice for force_pic and disable it by default While we're here, clean up some other non-functional irregularies: - Remove irrelevant rules_python flag. - Use the correct working directory during `bazel version`. --- drake_bazel_external/.bazelrc | 9 +++++---- drake_bazel_installed/.bazelrc | 10 +++++----- .../continuous_integration/common/drake_bazel_external | 3 +-- .../common/drake_bazel_installed | 3 +-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drake_bazel_external/.bazelrc b/drake_bazel_external/.bazelrc index 04c4875a..29d084cb 100644 --- a/drake_bazel_external/.bazelrc +++ b/drake_bazel_external/.bazelrc @@ -1,13 +1,9 @@ # SPDX-License-Identifier: MIT-0 -# Disable native Python rules in Bazel versions before 3.0. -build --incompatible_load_python_rules_from_bzl=yes - # Default to an optimized build. build --compilation_mode=opt # Default build options. -build --force_pic=yes build --strip=never # Default test options. @@ -21,6 +17,11 @@ build --host_cxxopt=-std=c++17 # https://github.com/bazelbuild/bazel/issues/1164 build --action_env=CCACHE_DISABLE=1 +# For Ubuntu builds, this flag can cut build times in half. For macOS builds, +# this flag might cause build errors. We suggest turning it on if and only if +# your project doesn't use macOS. +## build --force_pic=yes + # TODO(jwnimmer-tri) We should see if we can reuse more of Drake's # customizations somehow. diff --git a/drake_bazel_installed/.bazelrc b/drake_bazel_installed/.bazelrc index 2bbbbe5e..29d084cb 100644 --- a/drake_bazel_installed/.bazelrc +++ b/drake_bazel_installed/.bazelrc @@ -1,14 +1,9 @@ # SPDX-License-Identifier: MIT-0 -# Disable native Python rules in Bazel versions before 3.0. -# TODO(jamiesnape): Uncomment the below line when @drake uses @rules_python. -# build --incompatible_load_python_rules_from_bzl=yes - # Default to an optimized build. build --compilation_mode=opt # Default build options. -build --force_pic=yes build --strip=never # Default test options. @@ -22,6 +17,11 @@ build --host_cxxopt=-std=c++17 # https://github.com/bazelbuild/bazel/issues/1164 build --action_env=CCACHE_DISABLE=1 +# For Ubuntu builds, this flag can cut build times in half. For macOS builds, +# this flag might cause build errors. We suggest turning it on if and only if +# your project doesn't use macOS. +## build --force_pic=yes + # TODO(jwnimmer-tri) We should see if we can reuse more of Drake's # customizations somehow. diff --git a/scripts/continuous_integration/common/drake_bazel_external b/scripts/continuous_integration/common/drake_bazel_external index d8cd2f8c..9efbfe5c 100755 --- a/scripts/continuous_integration/common/drake_bazel_external +++ b/scripts/continuous_integration/common/drake_bazel_external @@ -3,10 +3,9 @@ set -euxo pipefail -bazel version - pushd drake_bazel_external +bazel version bazel test //... popd diff --git a/scripts/continuous_integration/common/drake_bazel_installed b/scripts/continuous_integration/common/drake_bazel_installed index 3167dc10..ba6104e5 100755 --- a/scripts/continuous_integration/common/drake_bazel_installed +++ b/scripts/continuous_integration/common/drake_bazel_installed @@ -3,10 +3,9 @@ set -euxo pipefail -bazel version - pushd drake_bazel_installed +bazel version bazel test //... popd