Allow module extension usages to be isolated#18529
Allow module extension usages to be isolated#18529fmeum wants to merge 5 commits intobazelbuild:masterfrom
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
aherrmann
left a comment
There was a problem hiding this comment.
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 |
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 <fabian@meumertzhe.im>
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 = Trueis 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.