Skip to content
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

fix(bzlmod): allow passing build_extra_args in gazelle_override #1648

Merged
15 changes: 15 additions & 0 deletions internal/bzlmod/go_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ def _get_build_file_generation(path, gazelle_overrides):

return DEFAULT_BUILD_FILE_GENERATION_BY_PATH.get(path, "auto")

def _get_build_extra_args(path, gazelle_overrides):
override = gazelle_overrides.get(path)
if override:
return override.build_extra_args

return []
casuallyhostile marked this conversation as resolved.
Show resolved Hide resolved
casuallyhostile marked this conversation as resolved.
Show resolved Hide resolved

def _get_directives(path, gazelle_overrides):
override = gazelle_overrides.get(path)
if override:
Expand Down Expand Up @@ -131,6 +138,7 @@ def _process_gazelle_override(gazelle_override_tag):
return struct(
directives = gazelle_override_tag.directives,
build_file_generation = gazelle_override_tag.build_file_generation,
build_extra_args = gazelle_override_tag.build_extra_args,
)

def _process_module_override(module_override_tag):
Expand Down Expand Up @@ -374,6 +382,7 @@ def _go_deps_impl(module_ctx):
"importpath": path,
"build_directives": _get_directives(path, gazelle_overrides),
"build_file_generation": _get_build_file_generation(path, gazelle_overrides),
"build_extra_args": _get_build_extra_args(path, gazelle_overrides),
"patches": _get_patches(path, module_overrides),
"patch_args": _get_patch_args(path, module_overrides),
}
Expand Down Expand Up @@ -527,6 +536,12 @@ _gazelle_override_tag = tag_class(
"on",
],
),
"build_extra_args": attr.string_list(
default = [],
doc = """
A list of additional command line arguments to pass to Gazelle when generating build files.
""",
),
"directives": attr.string_list(
doc = """Gazelle configuration directives to use for this Go module's external repository.

Expand Down
Loading