-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
bash: Add a toolchain for local Bash. #4980
bash: Add a toolchain for local Bash. #4980
Conversation
tools/bash/BUILD.tools
Outdated
exports_files(["bash_def.bzl"]) | ||
|
||
toolchain_type( | ||
name = "bash_toolchain_type", |
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.
For consistency with other toolchains (and to save typing) I recommend naming this simply "toolchain_type".
f078872
to
a61ccfc
Compare
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.
LGTM, up to you whether the file splitting makes sense.
tools/shell/shell_toolchain.bzl
Outdated
"""shell_toolchain rule implementation.""" | ||
return [platform_common.ToolchainInfo(path = ctx.attr.path)] | ||
|
||
def _is_windows(repository_ctx): |
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.
Most of this file is the repository rule that autodetects the shell toolchain. Is it worth splitting the definition of the actual shell_toolchain rule to a separate .bzl file, so that people defining standalone shell toolchains aren't loading all of 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.
Good point, done.
tools/shell/shell_toolchain.bzl
Outdated
"""shell_toolchain rule implementation.""" | ||
return [platform_common.ToolchainInfo(path = ctx.attr.path)] | ||
|
||
def _is_windows(repository_ctx): |
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.
Also, and this isn't part of this change but a general comment, we need a general purpose library of repository functions for common tasks like os detection.
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.
Good idea.
I'll fix up #5001 and submit it today to unblock you. |
0155984
to
60ed7af
Compare
7e65c29
to
1a544c3
Compare
Bazel automatically detects the local Bash and creates a custom toolchain rule for it. Later, rules that use Bash will require this toolchain and retrieve Bash's path from it instead of relying on hardcoded paths or the --shell_executable flag. See bazelbuild#4319 Change-Id: Idd8242a20d202b1f5a56cddac95b625c6c08ede9
Change-Id: If36e21ae29fb56f8f7e02e9d97205b5a6cb0117e
Change-Id: Ib2c75a834ac850e70ac4408842ce3ce28d9a9e08
Change-Id: I6e6ed809c8efb8ad2dd73bfa1335a17ec0790070
Change-Id: I62598bb5e0b6c2da1eddb9d8958347e96583a3d3
Change-Id: I88462c3b24b278ac0b60bdbf00d48bd88b36096b
Change-Id: Ic8798b198e49d8759b9c52d04ff1bcbfa5fcf854
Change-Id: Ie3a2169fe8217660399217650b1e8b0207c912b9
Change-Id: I9a40499f1a980187487541b21042c80dd35459d8
Change-Id: Iabe85677694216068a8011b8f8bbc18048e45e06
Change-Id: Ide80a8813809cb932a089916cedf42abf84d307c
The assertion in line bazelbuild#235 passes on Linux if the limit is 9, on Darwin if it is 10. Commenting out the code in BazelRulesModule.java that automatically loads the sh_configure() rule which instantiates @local_config_sh makes the test pass with the old limit (8). Change-Id: Ic2406a4da260b284e15852070d58472ca18340af
1a544c3
to
8da6df1
Compare
Change-Id: I30658deb98e7964989e761f63e63ab595c47f578
Bazel automatically detects the local Bash and
creates a custom toolchain rule for it.
Later, rules that use Bash will require this
toolchain and retrieve Bash's path from it instead
of relying on hardcoded paths or the
--shell_executable
flag.See #4319
Change-Id: Idd8242a20d202b1f5a56cddac95b625c6c08ede9