-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Allow module extension usages to be isolated #18529
Conversation
4d34d12
to
c816feb
Compare
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelDepGraphFunction.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionId.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileGlobals.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this idea. I think this would help with the distinction between globally unified and local packages in rules_nixpkgs, see here. The globally unified ones would be provided by a regular extension, and the local ones by an isolated extension.
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileGlobals.java
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileGlobals.java
Outdated
Show resolved
Hide resolved
I added tests as well as @Wyverald bazelbuild/buildtools#1171 is the corresponding change to buildozer. |
Gson doesn't seem to handle Edit: I found a way, but it's rather verbose. |
c83e00e
to
23291be
Compare
Unfortunately not. Probably writing an adapter for it, though you will still need to handle the object type somehow Ex: via TypeToken or something. |
I ended up writing my own |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileGlobals.java
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleFileGlobals.java
Outdated
Show resolved
Hide resolved
src/test/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionResolutionTest.java
Outdated
Show resolved
Hide resolved
If `isolated = True` is specified on `use_extension`, that particular usage will be isolated from all other usages, both in the same and other modules. Module extensions can check whether they are isolated (e.g. in case they can only be used in this way) via `module_ctx.is_isolated`.
Just in case you missed it: I changed the name of the parameter from |
@bazel-io flag |
@bazel-io fork 6.3.0 |
If `isolate = True` is specified on `use_extension`, that particular usage will be isolated from all other usages, both in the same and other modules. Module extensions can check whether they are isolated (e.g. in case they can only be used in this way) via `module_ctx.is_isolated`. Closes bazelbuild#18529. PiperOrigin-RevId: 541823020 Change-Id: I68a7b49914bbc1fd50df2fda7a0af1e47421bb92
If `isolate = True` is specified on `use_extension`, that particular usage will be isolated from all other usages, both in the same and other modules. Module extensions can check whether they are isolated (e.g. in case they can only be used in this way) via `module_ctx.is_isolated`. Closes #18529. PiperOrigin-RevId: 541823020 Change-Id: I68a7b49914bbc1fd50df2fda7a0af1e47421bb92 Co-authored-by: Fabian Meumertzheim <[email protected]>
This uses the new isolated module extensions feature [1], instead of a hub-repository approach [2] [3], to distinguish globally unified repositories and locally specialized repositories. [1]: bazelbuild/bazel#18529 [2]: bazelbuild/bazel#17048 [3]: bazelbuild/bazel#17493
If
isolate = True
is specified onuse_extension
, that particular usage will be isolated from all other usages, both in the same and other modules.Module extensions can check whether they are isolated (e.g. in case they can only be used in this way) via
module_ctx.is_isolated
.