Skip to content

Commit

Permalink
allow multiple overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-french committed Nov 13, 2023
1 parent f4b1e77 commit 6ba5030
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions internal/bzlmod/go_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,10 @@ def _is_dev_dependency(module_ctx, tag):

# This function processes a given override type for a given module, checks for duplicate overrides
# and inserts the override returned from the process_override_func into the overrides dict.
def _process_overrides(module_ctx, module, override_type, overrides, process_override_func, additional_overrides = None):
def _process_overrides(module_ctx, module, override_type, overrides, process_override_func):
_fail_on_non_root_overrides(module_ctx, module, override_type)
for override_tag in getattr(module.tags, override_type):
_fail_on_duplicate_overrides(override_tag.path, module.name, overrides)

# Some overrides conflict with other overrides. These can be specified in the
# additional_overrides dict. If the override is in the additional_overrides dict, then fail.
if additional_overrides:
_fail_on_duplicate_overrides(override_tag.path, module.name, additional_overrides)

overrides[override_tag.path] = process_override_func(override_tag)

def _process_gazelle_override(gazelle_override_tag):
Expand Down Expand Up @@ -220,8 +214,8 @@ def _go_deps_impl(module_ctx):
outdated_direct_dep_printer = fail

_process_overrides(module_ctx, module, "gazelle_override", gazelle_overrides, _process_gazelle_override)
_process_overrides(module_ctx, module, "module_override", module_overrides, _process_module_override, archive_overrides)
_process_overrides(module_ctx, module, "archive_override", archive_overrides, _process_archive_override, module_overrides)
_process_overrides(module_ctx, module, "module_override", module_overrides, _process_module_override)
_process_overrides(module_ctx, module, "archive_override", archive_overrides, _process_archive_override)

if len(module.tags.from_file) > 1:
fail(
Expand Down

0 comments on commit 6ba5030

Please sign in to comment.