-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only download necessary toolchains (#16)
Fixes #13. We now create a repo per 'environment' (os/cpu combo) in addition to the hub repo, and then refer to the downloads of those repos from the hub.
- Loading branch information
Showing
7 changed files
with
174 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# generated by multitool |
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 @@ | ||
# generated by multitool |
3 changes: 3 additions & 0 deletions
3
multitool/private/env_repo_tool_template/BUILD.bazel.template
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,3 @@ | ||
# generated by multitool | ||
|
||
exports_files(glob(include=["*_executable"])) |
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,46 @@ | ||
"multitool templating" | ||
|
||
_ENV_TEMPLATE = "//multitool/private:env_repo_template/{filename}.template" | ||
_ENV_TOOL_TEMPLATE = "//multitool/private:env_repo_tool_template/{filename}.template" | ||
|
||
_HUB_TEMPLATE = "//multitool/private:hub_repo_template/{filename}.template" | ||
_HUB_TOOL_TEMPLATE = "//multitool/private:hub_repo_tool_template/{filename}.template" | ||
|
||
def _render_env(rctx, filename, substitutions = None): | ||
rctx.template( | ||
filename, | ||
Label(_ENV_TEMPLATE.format(filename = filename)), | ||
substitutions = substitutions or {}, | ||
) | ||
|
||
def _render_env_tool(rctx, tool_name, filename, substitutions = None): | ||
rctx.template( | ||
"tools/{tool_name}/{filename}".format(tool_name = tool_name, filename = filename), | ||
Label(_ENV_TOOL_TEMPLATE.format(filename = filename)), | ||
substitutions = { | ||
"{name}": tool_name, | ||
} | (substitutions or {}), | ||
) | ||
|
||
def _render_hub(rctx, filename, substitutions = None): | ||
rctx.template( | ||
filename, | ||
Label(_HUB_TEMPLATE.format(filename = filename)), | ||
substitutions = substitutions or {}, | ||
) | ||
|
||
def _render_hub_tool(rctx, tool_name, filename, substitutions = None): | ||
rctx.template( | ||
"tools/{tool_name}/{filename}".format(tool_name = tool_name, filename = filename), | ||
Label(_HUB_TOOL_TEMPLATE.format(filename = filename)), | ||
substitutions = { | ||
"{name}": tool_name, | ||
} | (substitutions or {}), | ||
) | ||
|
||
templates = struct( | ||
env = _render_env, | ||
env_tool = _render_env_tool, | ||
hub = _render_hub, | ||
hub_tool = _render_hub_tool, | ||
) |