generated from bazel-contrib/rules-template
-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: don't require users to build tools from source (#287)
Wire up the toolchains along two different codepaths, based on whether our version was stamped as a release, or otherwise a pre-release. When a release: - fetch tools from GitHub releases using `rctx.download` - each fetched tool goes into a separate external repo with its own `toolchain` declaration, so Bazel fetches only the needed ones - the resulting repos are returned to repositories.bzl which registers them When a pre-release: - continue to build the tools from source, using existing toolchains --- ### Type of change - New feature or functionality (change which adds functionality) ### Test plan - Manual testing; please provide instructions so we can reproduce: Use my personal fork to test against a release I performed there.
- Loading branch information
Showing
8 changed files
with
153 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
load("//py/private/toolchain:tools.bzl", "make_toolchain") | ||
load("//py/private/toolchain:tools.bzl", "source_toolchain") | ||
|
||
toolchain_type( | ||
name = "toolchain_type", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
make_toolchain( | ||
source_toolchain( | ||
name = "unpack", | ||
toolchain_type = ":toolchain_type", | ||
tools = { | ||
"from-source": "//py/tools/unpack_bin", | ||
"macos-amd64": "@aspect_rules_py//py/tools/unpack_bin/bins:unpack-x86_64-apple-darwin", | ||
"macos-arm64": "@aspect_rules_py//py/tools/unpack_bin/bins:unpack-aarch64-apple-darwin", | ||
"linux-amd64": "@aspect_rules_py//py/tools/unpack_bin/bins:unpack-x86_64-unknown-linux-musl", | ||
"linux-arm64": "@aspect_rules_py//py/tools/unpack_bin/bins:unpack-aarch64-unknown-linux-musl", | ||
}, | ||
bin = "//py/tools/unpack_bin", | ||
) |
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,18 +1,16 @@ | ||
load("//py/private/toolchain:tools.bzl", "make_toolchain") | ||
load("//py/private/toolchain:tools.bzl", "source_toolchain") | ||
|
||
toolchain_type( | ||
name = "toolchain_type", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
make_toolchain( | ||
source_toolchain( | ||
name = "venv", | ||
cfg = "target", | ||
# When running from source, we assume the target is the exec platform. | ||
# TODO: when we have cross-compile Mac -> Linux, pre-release users should be able to | ||
# build a py_image on their Mac and have the linux venv rust_binary end up in the container. | ||
# cfg = "target", | ||
toolchain_type = ":toolchain_type", | ||
tools = { | ||
"from-source": "//py/tools/venv_bin", | ||
"macos-amd64": "@aspect_rules_py//py/tools/venv_bin/bins:venv-x86_64-apple-darwin", | ||
"macos-arm64": "@aspect_rules_py//py/tools/venv_bin/bins:venv-aarch64-apple-darwin", | ||
"linux-amd64": "@aspect_rules_py//py/tools/venv_bin/bins:venv-x86_64-unknown-linux-musl", | ||
"linux-arm64": "@aspect_rules_py//py/tools/venv_bin/bins:venv-aarch64-unknown-linux-musl", | ||
}, | ||
bin = "//py/tools/venv_bin", | ||
) |
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