-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build] Disable autoloaded (built-in) bazel rules
The release-notable changes here are the addition of rules_java and rules_shell as new dependencies and the bump of the minimum supported bazel version up to 7.4. As part of uniform loading of rules we also refactor to provide a single point of control for shell and java, like we had previously done for cc and python and tidy up some missing pieces.
- Loading branch information
1 parent
c2ace99
commit 0f5f74b
Showing
29 changed files
with
162 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
"""Provides a single point of control for rules_cc inside Drake. | ||
For all code built by Drake (both first-party code, and built-from-source | ||
externals), we should be using this file's macros. We should never call | ||
`native.cc_foo()` from anywhere other than this file, and any BUILD file | ||
that uses `cc_foo()` rules should load these macros instead of relying | ||
on the (implicitly loaded) `native.cc_foo()` default. | ||
TODO(jwnimmer-tri) Consider writing a linter to check for this, in case | ||
we find that people are unable to manually maintain this invariant. | ||
externals), we should be using this file's macros. Any BUILD file that uses | ||
`cc_foo()` rules should load these macros instead of loading from @rules_cc | ||
directly. | ||
""" | ||
|
||
load( | ||
"@rules_cc//cc:defs.bzl", | ||
_CcInfo = "CcInfo", | ||
_cc_binary = "cc_binary", | ||
_cc_import = "cc_import", | ||
_cc_library = "cc_library", | ||
_cc_shared_library = "cc_shared_library", | ||
_cc_test = "cc_test", | ||
_objc_library = "objc_library", | ||
) | ||
|
||
def cc_binary(**kwargs): | ||
native.cc_binary(**kwargs) | ||
_cc_binary(**kwargs) | ||
|
||
def cc_import(**kwargs): | ||
native.cc_import(**kwargs) | ||
_cc_import(**kwargs) | ||
|
||
def cc_library(**kwargs): | ||
native.cc_library(**kwargs) | ||
_cc_library(**kwargs) | ||
|
||
def cc_shared_library(**kwargs): | ||
native.cc_shared_library(**kwargs) | ||
_cc_shared_library(**kwargs) | ||
|
||
def cc_test(**kwargs): | ||
native.cc_test(**kwargs) | ||
_cc_test(**kwargs) | ||
|
||
def objc_library(**kwargs): | ||
_objc_library(**kwargs) | ||
|
||
CcInfo = _CcInfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""Provides a single point of control for rules_shell inside Drake.""" | ||
|
||
load("@rules_shell//shell:sh_binary.bzl", _sh_binary = "sh_binary") | ||
load("@rules_shell//shell:sh_test.bzl", _sh_test = "sh_test") | ||
|
||
def sh_binary(name, **kwargs): | ||
_sh_binary( | ||
name = name, | ||
**kwargs | ||
) | ||
|
||
def sh_test(name, **kwargs): | ||
_sh_test( | ||
name = name, | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
load("//tools/lint:lint.bzl", "add_lint_tests") | ||
|
||
# Required for workspace_bzlmod_sync_test.py. | ||
exports_files( | ||
["repository.bzl"], | ||
visibility = ["//tools/workspace:__pkg__"], | ||
) | ||
|
||
add_lint_tests() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
load("//tools/workspace:github.bzl", "github_archive") | ||
|
||
# Note that we do NOT install a LICENSE file as part of the Drake install | ||
# because this repository is required only when building and testing with | ||
# Bazel. | ||
|
||
def rules_java_repository( | ||
name, | ||
mirrors = None): | ||
if native.bazel_version[0:2] == "7.": | ||
# The new rules_java only works with Bazel 8; for bazel 7 we'll use the | ||
# built-in rules_java. We can remove this once Drake's minimum Bazel | ||
# version is >= 8. | ||
return | ||
github_archive( | ||
name = name, | ||
repository = "bazelbuild/rules_java", # License: Apache-2.0, | ||
upgrade_advice = """ | ||
When updating, you must also manually propagate to the new version | ||
number into the MODULE.bazel file (at the top level of Drake). | ||
""", | ||
commit = "8.6.1", | ||
sha256 = "b2519fabcd360529071ade8732f208b3755489ed7668b118f8f90985c0e51324", # noqa | ||
mirrors = mirrors, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
load("//tools/lint:lint.bzl", "add_lint_tests") | ||
|
||
# Required for workspace_bzlmod_sync_test.py. | ||
exports_files( | ||
["repository.bzl"], | ||
visibility = ["//tools/workspace:__pkg__"], | ||
) | ||
|
||
add_lint_tests() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("//tools/workspace:github.bzl", "github_archive") | ||
|
||
# Note that we do NOT install a LICENSE file as part of the Drake install | ||
# because this repository is required only when building and testing with | ||
# Bazel. | ||
|
||
def rules_shell_repository( | ||
name, | ||
mirrors = None): | ||
github_archive( | ||
name = name, | ||
repository = "bazelbuild/rules_shell", # License: Apache-2.0, | ||
upgrade_advice = """ | ||
When updating, you must also manually propagate to the new version | ||
number into the MODULE.bazel file (at the top level of Drake). | ||
""", | ||
commit = "v0.3.0", | ||
sha256 = "d8cd4a3a91fc1dc68d4c7d6b655f09def109f7186437e3f50a9b60ab436a0c53", # noqa | ||
mirrors = mirrors, | ||
) |
Oops, something went wrong.