Skip to content

Commit

Permalink
just a bit more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-thm committed Mar 21, 2024
1 parent 2a1bf26 commit 1cb6b31
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
2 changes: 1 addition & 1 deletion multitool/extension.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"multitool"
"multitool module extension"

load("//multitool/private:multitool.bzl", _hub = "hub")

Expand Down
7 changes: 4 additions & 3 deletions multitool/multitool.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"multitool"
"multitool workspace macros"

load("//multitool/private:multitool.bzl", _multitool = "multitool")
load("//multitool/private:multitool.bzl", "hub")

def multitool(name, lockfile = None, lockfiles = None):
"""(non-bzlmod) Create a multitool hub and register its toolchains.
Expand All @@ -17,4 +17,5 @@ def multitool(name, lockfile = None, lockfiles = None):

lockfiles = lockfiles if lockfiles else [lockfile]

_multitool(name, lockfiles)
hub(name, lockfiles)
native.register_toolchains("@{name}//toolchains:all".format(name = name))
16 changes: 2 additions & 14 deletions multitool/private/multitool.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ of the toolchain definitions in the latter repos to make the dependencies run ex
This implementation depends on rendering a number of templates, which are defined in sibling
folders and managed by the templates starlark file.
To maintain support both bzlmod and non-bzlmod setups, we provide two entrypoints to the rule:
- (bzlmod) hub : invoked by the hub tag in extension.bzl
- (non-bzlmod) multitool : invoked in WORKSPACE or related macros, and additionally registers toolchains
Note that we intend to support both bzlmod and non-bzlmod setups, so `hub` intentionally avoids
a register_toolchains call.
"""

load("@bazel_features//:features.bzl", "bazel_features")
Expand Down Expand Up @@ -243,14 +242,3 @@ def hub(name, lockfiles):
cpu = env[1],
)
_multitool_hub(name = name, lockfiles = lockfiles)

def multitool(name, lockfiles):
"""
(non-bzlmod) Create a multitool hub and register its toolchains.
Args:
name: resulting "hub" repo name to load tools from
lockfiles: a list of labels of multiple lockfiles
"""
hub(name, lockfiles)
native.register_toolchains("@{name}//toolchains:all".format(name = name))

0 comments on commit 1cb6b31

Please sign in to comment.