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 strip_prefix arg to bzlmod's git_override #22077

Conversation

dougthor42
Copy link
Contributor

@dougthor42 dougthor42 commented Apr 22, 2024

Add strip_prefix arg go bzlmod's git_override and pass it down to git_repository.

This allows users to work with git repositories that have other Bazel modules in subdirectories.
A prime example of such is the rules_python](https://github.com/bazelbuild/rules_python) repo:

./rules_python
├── MODULE.bazel       # available on BCR as "rules_python"
└── gazelle
    └── MODULE.bazel   # available on BCR as "rules_python_gazelle_plugin"

Fixes #22076.

RELNOTES:
bzlmod git_repository now accepts the strip_prefix arg and passes it to the underlying git_repository call.

@dougthor42 dougthor42 changed the title [WIP] Add strip_prefix arg to bzlmod git_override [WIP] Add strip_prefix arg to bzlmod's git_override Apr 22, 2024
@Wyverald
Copy link
Member

Wyverald commented Apr 22, 2024

  • Add changelog entry

You can just include a line in the PR message that begins with RELNOTES:. The part after the RELNOTES: will be included in the release notes of the next release.

  • Figure out how to run tests and then add some.

You can add to/fix this one: https://cs.opensource.google/bazel/bazel/+/master:src/test/py/bazel/bzlmod/bazel_overrides_test.py;drc=3f9d80c35d88a280c2d53682f3d201b4733a3fff;l=234

To test locally, run bazel test src/test/py/bazel:bazel_overrides_test --test_filter=<test_method>.

@dougthor42 dougthor42 force-pushed the u/dthor/support-strip-prefix-in-git-override-gh22076 branch from dc02dcc to 6f560c9 Compare April 23, 2024 02:41
Copy link
Contributor Author

@dougthor42 dougthor42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip! That really sped things along - I don't know how long it would have taken me without it, haha.

Anyway, the code and PR message have updated. I also added a couple questions to the review. PTAL when you can.

Comment on lines 1025 to 1026
"A directory prefix to strip from the extracted files. This can be used to target"
+ " a subdirectory of the git repo.",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to mention that the subdir must have it's own MODULE.bazel with module(name = "same_as_what_you_are_overriding")?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would be better!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated 👍

@dougthor42 dougthor42 changed the title [WIP] Add strip_prefix arg to bzlmod's git_override Add strip_prefix arg to bzlmod's git_override Apr 23, 2024
@dougthor42 dougthor42 marked this pull request as ready for review April 23, 2024 03:22
@github-actions github-actions bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Apr 23, 2024
@meteorcloudy meteorcloudy added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Apr 24, 2024
iancha1992 pushed a commit to iancha1992/bazel that referenced this pull request Apr 25, 2024
Add `strip_prefix` arg go bzlmod's `git_override` and pass it down to `git_repository`.

This allows users to work with git repositories that have other Bazel modules in subdirectories.
A prime example of such is the `rules_python`](https://github.com/bazelbuild/rules_python) repo:

```
./rules_python
├── MODULE.bazel       # available on BCR as "rules_python"
└── gazelle
    └── MODULE.bazel   # available on BCR as "rules_python_gazelle_plugin"
```

Fixes bazelbuild#22076.

RELNOTES:
bzlmod `git_repository` now accepts the `strip_prefix` arg and passes it to the underlying `git_repository` call.

Closes bazelbuild#22077.

PiperOrigin-RevId: 628059135
Change-Id: I8b9df3a5d41924302475fd9495aff6cd21ce6db2
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Apr 25, 2024
Add `strip_prefix` arg go bzlmod's `git_override` and pass it down to `git_repository`.

This allows users to work with git repositories that have other Bazel modules in subdirectories.
A prime example of such is the `rules_python`](https://github.com/bazelbuild/rules_python) repo:

```
./rules_python
├── MODULE.bazel       # available on BCR as "rules_python"
└── gazelle
    └── MODULE.bazel   # available on BCR as "rules_python_gazelle_plugin"
```

Fixes bazelbuild#22076.

RELNOTES:
bzlmod `git_repository` now accepts the `strip_prefix` arg and passes it to the underlying `git_repository` call.

Closes bazelbuild#22077.

PiperOrigin-RevId: 628059135
Change-Id: I8b9df3a5d41924302475fd9495aff6cd21ce6db2
@sgowroji sgowroji removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Apr 26, 2024
github-merge-queue bot pushed a commit that referenced this pull request Apr 26, 2024
Add `strip_prefix` arg go bzlmod's `git_override` and pass it down to
`git_repository`.

This allows users to work with git repositories that have other Bazel
modules in subdirectories.
A prime example of such is the
`rules_python`](https://github.com/bazelbuild/rules_python) repo:

```
./rules_python
├── MODULE.bazel       # available on BCR as "rules_python"
└── gazelle
    └── MODULE.bazel   # available on BCR as "rules_python_gazelle_plugin"
```

Fixes #22076.

RELNOTES:
bzlmod `git_repository` now accepts the `strip_prefix` arg and passes it
to the underlying `git_repository` call.

Closes #22077.

PiperOrigin-RevId: 628059135
Change-Id: I8b9df3a5d41924302475fd9495aff6cd21ce6db2

Commit
8edddb3

Co-authored-by: Douglas Thor <[email protected]>
@dougthor42 dougthor42 deleted the u/dthor/support-strip-prefix-in-git-override-gh22076 branch May 11, 2024 20:39
Kila2 pushed a commit to Kila2/bazel that referenced this pull request May 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Add `strip_prefix` arg go bzlmod's `git_override` and pass it down to `git_repository`.

This allows users to work with git repositories that have other Bazel modules in subdirectories.
A prime example of such is the `rules_python`](https://github.com/bazelbuild/rules_python) repo:

```
./rules_python
├── MODULE.bazel       # available on BCR as "rules_python"
└── gazelle
    └── MODULE.bazel   # available on BCR as "rules_python_gazelle_plugin"
```

Fixes bazelbuild#22076.

RELNOTES:
bzlmod `git_repository` now accepts the `strip_prefix` arg and passes it to the underlying `git_repository` call.

Closes bazelbuild#22077.

PiperOrigin-RevId: 628059135
Change-Id: I8b9df3a5d41924302475fd9495aff6cd21ce6db2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have MODULE's git_override support using a nested path
4 participants