Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Benjamin Staffin <[email protected]>
Brian Silverman <[email protected]>
David Santiago <[email protected]>
David Zbarsky <[email protected]>
Google Inc.
Jake Voytko <[email protected]>
Yuki Yugui Sonoda <[email protected]>
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Brian Silverman <[email protected]>
Damien Martin-Guillerez <[email protected]>
David Chen <[email protected]>
David Santiago <[email protected]>
David Zbarsky <[email protected]>
Fabian Meumertzheim <[email protected]>
Han-Wen Nienhuys <[email protected]>
Ian Cottrell <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions extras/gomock.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ _MOCKGEN_TOOL = Label("//extras/gomock:mockgen")
_MOCKGEN_MODEL_LIB = Label("//extras/gomock:mockgen_model")

def _gomock_source_impl(ctx):
go = go_context(ctx, include_deprecated_properties = False)
go = go_context(ctx)

# In Source mode, it's not necessary to pass through a library, as the only thing we use it for is setting up
# the relative file locations. Forcing users to pass a library makes it difficult in the case where a mock should
Expand Down Expand Up @@ -313,7 +313,7 @@ _gomock_prog_gen = rule(
)

def _gomock_prog_exec_impl(ctx):
go = go_context(ctx, include_deprecated_properties = False)
go = go_context(ctx)

args = ["-exec_only", ctx.file.prog_bin.path]
args, needed_files = _handle_shared_args(ctx, args)
Expand Down
2 changes: 1 addition & 1 deletion go/private/actions/compilepkg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def emit_compilepkg(
inputs_transitive = [sdk.headers, sdk.tools, go.stdlib.libs, headers]
outputs = [out_lib, out_export]

shared_args = go.builder_args(go, use_path_mapping = True)
shared_args = go.builder_args(go)
shared_args.add_all(sources, before_each = "-src")

compile_args = go.tool_args(go)
Expand Down
2 changes: 1 addition & 1 deletion go/private/actions/link.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def emit_link(

# use ar tool from cc toolchain if cc toolchain provides it
if go.cgo_tools and go.cgo_tools.ar_path and go.cgo_tools.ar_path.endswith("ar"):
tool_args.add_all(["-extar", go.cgo_tools.ar_path])
tool_args.add("-extar", go.cgo_tools.ar_path)

# Add in any mode specific behaviours
if go.mode.race:
Expand Down
6 changes: 3 additions & 3 deletions go/private/actions/stdlib.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ def _build_stdlib_list_json(go):
out = go.declare_file(go, "stdlib.pkg.json")
cache_dir = go.declare_directory(go, "gocache")
args = go.builder_args(go, "stdliblist")
args.add("-sdk", sdk.root_file.dirname)
args.add("-out", out)
args.add("-cache", cache_dir.path)
args.add_all("-cache", [cache_dir], expand_directories = False)
if go.export_stdlib:
args.add("-export", go.export_stdlib)

Expand All @@ -87,6 +86,7 @@ def _build_stdlib_list_json(go):
arguments = [args],
env = _build_env(go),
toolchain = GO_TOOLCHAIN_LABEL,
execution_requirements = SUPPORTS_PATH_MAPPING_REQUIREMENT,
)
return out, cache_dir

Expand Down Expand Up @@ -130,7 +130,7 @@ def _dirname(file):

def _build_stdlib(go):
pkg = go.declare_directory(go, path = "pkg")
args = go.builder_args(go, "stdlib", use_path_mapping = True)
args = go.builder_args(go, "stdlib")

# Use a file rather than pkg.dirname as the latter is just a string and thus
# not subject to path mapping.
Expand Down
20 changes: 10 additions & 10 deletions go/private/context.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _declare_directory(go, path = "", ext = "", name = ""):
def _dirname(file):
return file.dirname

def _builder_args(go, command = None, use_path_mapping = False):
def _builder_args(go, command = None):
args = go.actions.args()
args.use_param_file("-param=%s")
if command:
Expand All @@ -176,15 +176,15 @@ def _builder_args(go, command = None, use_path_mapping = False):

# Path mapping can't map the values of environment variables, so we need to pass GOROOT to the
# action via an argument instead.
if use_path_mapping:
if go.stdlib:
goroot_file = go.stdlib.root_file
else:
goroot_file = sdk_root_file
if go.stdlib:
goroot_file = go.stdlib.root_file
else:
goroot_file = sdk_root_file

# Use a file rather than goroot as the latter is just a string and thus
# not subject to path mapping.
args.add_all("-goroot", [goroot_file], map_each = _dirname, expand_directories = False)

# Use a file rather than goroot as the latter is just a string and thus
# not subject to path mapping.
args.add_all("-goroot", [goroot_file], map_each = _dirname, expand_directories = False)
mode = go.mode
args.add("-installsuffix", installsuffix(mode))
args.add_joined("-tags", mode.tags, join_with = ",")
Expand Down Expand Up @@ -457,7 +457,7 @@ default_go_config_info = GoConfigInfo(
def go_context(
ctx,
attr = None,
include_deprecated_properties = True,
include_deprecated_properties = False,
importpath = None,
importmap = None,
embed = None,
Expand Down
1 change: 0 additions & 1 deletion go/private/rules/binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def _go_binary_impl(ctx):
"""go_binary_impl emits actions for compiling and linking a go executable."""
go = go_context(
ctx,
include_deprecated_properties = False,
importpath = ctx.attr.importpath,
embed = ctx.attr.embed,
# It's a list because it is transitioned.
Expand Down
3 changes: 2 additions & 1 deletion go/private/rules/info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ load(
def _go_info_impl(ctx):
go = go_context(ctx)
report = go.declare_file(go, ext = ".txt")
args = go.builder_args(go)
args = go.actions.args()
args.add("-sdk", go.sdk.root_file.dirname)
args.add("-out", report)
go.actions.run(
inputs = depset([go.sdk.go], transitive = [go.sdk.tools]),
Expand Down
3 changes: 1 addition & 2 deletions go/private/rules/library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def _go_library_impl(ctx):
"""Implements the go_library() rule."""
go = go_context(
ctx,
include_deprecated_properties = False,
importpath = ctx.attr.importpath,
importmap = ctx.attr.importmap,
importpath_aliases = ctx.attr.importpath_aliases,
Expand Down Expand Up @@ -209,7 +208,7 @@ go_library = rule(

def _go_tool_library_impl(ctx):
"""Implements the go_tool_library() rule."""
go = go_context(ctx, include_deprecated_properties = False)
go = go_context(ctx)

go_info = new_go_info(go, ctx.attr)
archive = go.archive(go, go_info)
Expand Down
2 changes: 1 addition & 1 deletion go/private/rules/nogo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _nogo_impl(ctx):
return None

# Generate the source for the nogo binary.
go = go_context(ctx, include_deprecated_properties = False)
go = go_context(ctx)
nogo_main = go.declare_file(go, path = "nogo_main.go")
nogo_args = ctx.actions.args()
nogo_args.add("gennogomain")
Expand Down
2 changes: 1 addition & 1 deletion go/private/rules/source.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ load(

def _go_source_impl(ctx):
"""Implements the go_source() rule."""
go = go_context(ctx, include_deprecated_properties = False)
go = go_context(ctx)
go_info = new_go_info(go, ctx.attr)
return [
go_info,
Expand Down
2 changes: 1 addition & 1 deletion go/private/rules/stdlib.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ load(
)

def _stdlib_impl(ctx):
go = go_context(ctx, include_deprecated_properties = False)
go = go_context(ctx)
return go.toolchain.actions.stdlib(go)

stdlib = rule(
Expand Down
3 changes: 1 addition & 2 deletions go/private/rules/test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def _go_test_impl(ctx):

go = go_context(
ctx,
include_deprecated_properties = False,
importpath = ctx.attr.importpath,
embed = ctx.attr.embed,
# It's a list because it is transitioned.
Expand Down Expand Up @@ -117,7 +116,7 @@ def _go_test_impl(ctx):
run_dir = repo_relative_rundir

main_go = go.declare_file(go, path = "testmain.go")
arguments = go.builder_args(go, "gentestmain", use_path_mapping = True)
arguments = go.builder_args(go, "gentestmain")
arguments.add("-output", main_go)
if go.coverage_enabled:
if go.mode.race:
Expand Down
6 changes: 3 additions & 3 deletions proto/compiler.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ compiler. Typically, these are Well Known Types and proto runtime libraries.""",
"valid_archive": """A Boolean indicating whether the .go files produced
by this compiler are buildable on their own. Compilers that just add methods
to structs produced by other compilers will set this to False.""",
"always_generates": """A Boolean indicating whether this compiler
always generates files, regardless of whether the proto files have
"always_generates": """A Boolean indicating whether this compiler
always generates files, regardless of whether the proto files have
relevant definitions (e.g., services for grpc_gateway). This allows
more strict check of compiler output.""",
"internal": "Opaque value containing data used by compile.",
Expand Down Expand Up @@ -217,7 +217,7 @@ def proto_path(src, proto):
return src.path[len(prefix):]

def _go_proto_compiler_impl(ctx):
go = go_context(ctx, include_deprecated_properties = False)
go = go_context(ctx)
go_info = new_go_info(go, ctx.attr)
proto_toolchain = _find_toolchain(
ctx,
Expand Down
2 changes: 0 additions & 2 deletions proto/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ declares the \"{attr_name}\" attribute.""".format(
go = go_context(
ctx,
attr,
include_deprecated_properties = False,
importpath = attr.importpath,
go_context_data = attr._go_context_data,
)
Expand Down Expand Up @@ -111,7 +110,6 @@ def _proto_library_to_source(_go, attr, source, merge):
def _go_proto_library_impl(ctx):
go = go_context(
ctx,
include_deprecated_properties = False,
importpath = ctx.attr.importpath,
importmap = ctx.attr.importmap,
importpath_aliases = ctx.attr.importpath_aliases,
Expand Down