bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.1k stars 4.05k forks source link

`--override_repo` flag for injecting `override_repo` #23879

Open tpudlik opened 1 week ago

tpudlik commented 1 week ago

Description of the feature request:

override_repo allows overriding a repository created by a module extension. The FR is for a flag exposing this functionality, analogous to --override_module and --override_repository.

Actually, I thought something like --override_repository=module_repo_canonical_name+extension_name+repo_name=path might "just work", but if it does then I could not spell it right!

@wyv

Which category does this issue belong to?

External Dependency

What underlying problem are you trying to solve with this feature?

The use cases for this are basically the same as for --override_module: just like developers want to be able to override a module from the command line, they want to be able to override repos created by module extensions.

A specific use case I have in mind are CI builders that use a different version of a CIPD package.

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Wyverald commented 1 week ago

The FR sounds fair to me.

Actually, I thought something like --override_repository=module_repo_canonical_name+extension_name+repo_name=path might "just work", but if it does then I could not spell it right!

This should just work. But obviously it would be a local_repository override.

Wyverald commented 1 week ago

Actually, a couple of problems with this idea:

  1. override_repo works by overriding a specific repo generated by a specific module extension. How do you propose that to be expressed via a flag?
  2. What should we call this flag? --override_repo would be way too similar to --override_repository.
fmeum commented 1 week ago

If you want to override with a local directory, --override_repository can do that already for extension repos.

If you want to override with anything more complex, I'm not sure that a flag would work well. Could you try to use buildozer to add an override to the module file instead?