-
-
Notifications
You must be signed in to change notification settings - Fork 684
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
stdlib: zip sdk file inputs when executing remotely #2460
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -459,6 +459,7 @@ def go_context(ctx, attr = None): | |
importpath_aliases = importpath_aliases, | ||
pathtype = pathtype, | ||
cgo_tools = cgo_tools, | ||
zipper = toolchain._zipper, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather not expose anything in the |
||
nogo = nogo, | ||
coverdata = coverdata, | ||
coverage_enabled = ctx.configuration.coverage_enabled, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,9 +54,10 @@ def _go_toolchain_impl(ctx): | |
|
||
# Internal fields -- may be read by emit functions. | ||
_builder = ctx.executable.builder, | ||
_zipper = ctx.executable.zipper, | ||
)] | ||
|
||
go_toolchain = rule( | ||
_go_toolchain = rule( | ||
_go_toolchain_impl, | ||
attrs = { | ||
# Minimum requirements to specify a toolchain | ||
|
@@ -87,11 +88,25 @@ go_toolchain = rule( | |
"cgo_link_flags": attr.string_list( | ||
doc = "Flags passed to the external linker (if it is used)", | ||
), | ||
# helper tool for the stdlib action | ||
"zipper": attr.label( | ||
cfg = "exec", | ||
executable = True, | ||
doc = "The zipper helper utility", | ||
), | ||
}, | ||
doc = "Defines a Go toolchain based on an SDK", | ||
provides = [platform_common.ToolchainInfo], | ||
) | ||
|
||
def go_toolchain(**kwargs): | ||
"""Macro wrapping go_toolchain (to be able to use select expressions).""" | ||
kwargs.setdefault("zipper", select({ | ||
"@bazel_tools//src/conditions:remote": "@bazel_tools//third_party/ijar:zipper", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. Will avoid a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can also depend on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like when remote execution is enabled, A zip tool will still be needed if we generate a .zip in the repository rule, which would cut the I'd rather not do |
||
"//conditions:default": None, | ||
})) | ||
_go_toolchain(**kwargs) | ||
|
||
def declare_toolchains(host, sdk, builder): | ||
"""Declares go_toolchain and toolchain targets for each platform.""" | ||
|
||
|
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.
I don't understand why this speeds things up. Why doesn't
GoStdlibZip
execute on the remote worker, taking just as long asGoStdLib
did previously?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.
Point taken. I didn't put the mnemonic behind a strategy flag, so it calls into question why I saw any speedup at all! Perhaps in the course of the work flipping between local and remote configurations I was able to build it locally and the zip was pushed up into the cache. I'll have to study this better.