forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[6.2.0]Add
module_ctx.is_dev_dependency
(bazelbuild#17934)
* Add `module_ctx.is_dev_dependency` Allows module extensions to determine whether a given tag represents a dev dependency. Fixes bazelbuild#17101 Work towards bazelbuild#17908 Closes bazelbuild#17909. PiperOrigin-RevId: 520645663 Change-Id: I3e3136a09d01d25fc706bcd0dfd7e53b6e7d5285 * Revert section that was accidentally cherry-picked --------- Co-authored-by: Fabian Meumertzheim <[email protected]> Co-authored-by: keertk <[email protected]>
- Loading branch information
1 parent
d24f7cb
commit 3ea18cc
Showing
8 changed files
with
213 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -446,7 +446,7 @@ public void multipleModules_devDependency() throws Exception { | |
" data_str = 'modules:'", | ||
" for mod in ctx.modules:", | ||
" for tag in mod.tags.tag:", | ||
" data_str += ' ' + tag.data", | ||
" data_str += ' ' + tag.data + ' ' + str(ctx.is_dev_dependency(tag))", | ||
" data_repo(name='ext_repo',data=data_str)", | ||
"tag=tag_class(attrs={'data':attr.string()})", | ||
"ext=module_extension(implementation=_ext_impl,tag_classes={'tag':tag})"); | ||
|
@@ -457,7 +457,8 @@ public void multipleModules_devDependency() throws Exception { | |
if (result.hasError()) { | ||
throw result.getError().getException(); | ||
} | ||
assertThat(result.get(skyKey).getModule().getGlobal("data")).isEqualTo("modules: root [email protected]"); | ||
assertThat(result.get(skyKey).getModule().getGlobal("data")) | ||
.isEqualTo("modules: root True [email protected] False"); | ||
} | ||
|
||
@Test | ||
|
@@ -497,7 +498,7 @@ public void multipleModules_ignoreDevDependency() throws Exception { | |
" data_str = 'modules:'", | ||
" for mod in ctx.modules:", | ||
" for tag in mod.tags.tag:", | ||
" data_str += ' ' + tag.data", | ||
" data_str += ' ' + tag.data + ' ' + str(ctx.is_dev_dependency(tag))", | ||
" data_repo(name='ext_repo',data=data_str)", | ||
"tag=tag_class(attrs={'data':attr.string()})", | ||
"ext=module_extension(implementation=_ext_impl,tag_classes={'tag':tag})"); | ||
|
@@ -511,7 +512,8 @@ public void multipleModules_ignoreDevDependency() throws Exception { | |
if (result.hasError()) { | ||
throw result.getError().getException(); | ||
} | ||
assertThat(result.get(skyKey).getModule().getGlobal("data")).isEqualTo("modules: [email protected]"); | ||
assertThat(result.get(skyKey).getModule().getGlobal("data")) | ||
.isEqualTo("modules: [email protected] False"); | ||
} | ||
|
||
@Test | ||
|
Oops, something went wrong.