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

Add overlays to git_repository and http_archive #22395

Open
Clement-Jean opened this issue May 16, 2024 · 0 comments
Open

Add overlays to git_repository and http_archive #22395

Clement-Jean opened this issue May 16, 2024 · 0 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request

Comments

@Clement-Jean
Copy link

Clement-Jean commented May 16, 2024

Description of the feature request:

It would be great to have a way to add new files to a git_repository or http_archive without having to generate a dummy diff file for them.

An example for this is the following. Let us say that we have the following directory:

.
├── MODULE.bazel
├── overlays
│   └── src
│       └── a.go
└── patches
    └── b.diff

where a.txt is a new file and b.diff is a regular patch on ./main.go.

I could then have a git_repository like the following:

.
├── main.go // patched
└── src
    ├── a.go // copied over (overlay)
    └── c.go

I think that in the MODULE.bazel, it could look like the following:

git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
    //...
    patch_args = ["-p1"],
    patches = [
        "//patches:b.diff",
    ],
    overlays_root = "//:overlays",
    overlays = [ # this could also be a call to glob function
        "//overlays/src:a.go",
    ],
)

it would take the path of each overlay and substitute the overlays_root by the %worskpace% of the repo.

Which category does this issue belong to?

Configurability

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

I'm trying to avoid having to go through all my new files (overlays) and execute something like git diff /dev/null $file. We should not have to create dummy patch files for new files. They can simply be copied over.

Which operating system are you running Bazel on?

MacOS

What is the output of bazel info release?

release 7.1.2

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?

I only found something similar in bazel-gazelle but this is now deprecated (see: https://github.com/bazelbuild/bazel-gazelle/blob/master/repository.md#git_repository).

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

No response

@github-actions github-actions bot added team-Configurability Issues for Configurability team labels May 16, 2024
@Wyverald Wyverald added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. and removed team-Configurability Issues for Configurability team labels May 16, 2024
@meteorcloudy meteorcloudy added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: feature request
Projects
None yet
Development

No branches or pull requests

6 participants