Skip to content

Commit

Permalink
Reduce number of declared files in emit_stdlib (#3366)
Browse files Browse the repository at this point in the history
* The `src` directory is declared, but not passed to downstream rules.
  It has been declared since cfc58d9,
  but hasn't been exposed since 3680494
* Instead of writing a new root file, use the existing `pkg` directory.
  • Loading branch information
fmeum authored Nov 28, 2022
1 parent 82e0124 commit 79e0037
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions go/private/actions/stdlib.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,11 @@ def _sdk_stdlib(go):

def _build_stdlib(go):
pkg = go.declare_directory(go, path = "pkg")
src = go.declare_directory(go, path = "src")
root_file = go.declare_file(go, path = "ROOT")
args = go.builder_args(go, "stdlib")
args.add("-out", root_file.dirname)
args.add("-out", pkg.dirname)
if go.mode.race:
args.add("-race")
args.add_all(link_mode_args(go.mode))
go.actions.write(root_file, "")
env = go.env
if go.mode.pure:
env.update({"CGO_ENABLED": "0"})
Expand All @@ -105,7 +102,7 @@ def _build_stdlib(go):
go.sdk.tools +
[go.sdk.go, go.sdk.package_list, go.sdk.root_file] +
go.crosstool)
outputs = [pkg, src]
outputs = [pkg]
go.actions.run(
inputs = inputs,
outputs = outputs,
Expand All @@ -117,5 +114,5 @@ def _build_stdlib(go):
return GoStdLib(
_list_json = _build_stdlib_list_json(go),
libs = [pkg],
root_file = root_file,
root_file = pkg,
)
2 changes: 1 addition & 1 deletion go/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ from GoSDK_, or it may be another library compiled for the target mode.
+--------------------------------+-----------------------------------------------------------------+
| :param:`root_file` | :type:`File` |
+--------------------------------+-----------------------------------------------------------------+
| A file in the standard library root directory. Used to determine ``GOROOT``. |
| A file or directory in the standard library root directory. Used to determine ``GOROOT``. |
+--------------------------------+-----------------------------------------------------------------+
| :param:`libs` | :type:`list of File` |
+--------------------------------+-----------------------------------------------------------------+
Expand Down

0 comments on commit 79e0037

Please sign in to comment.