-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.4.0] Support --target_pattern_file for fetch and vendor command (#…
…23663) Fixes: #23628 RELNOTES: Bazel fetch and vendor command now supports --target_pattern_file for specifying target patterns. Closes #23640. PiperOrigin-RevId: 676063442 Change-Id: Ibbbf7879dfec4ec10093631fb002f87c9dddc8ef Commit 3120d35 --------- Co-authored-by: Yun Peng <[email protected]> Co-authored-by: Xùdōng Yáng <[email protected]>
- Loading branch information
1 parent
7361bcc
commit d769217
Showing
5 changed files
with
102 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -304,6 +304,44 @@ def testFetchTarget(self): | |
_, stdout, _ = self.RunBazel(['run', '//:main', '--nofetch']) | ||
self.assertIn('Hello there! => [email protected]', stdout) | ||
|
||
def testFetchWithTargetPatternFile(self): | ||
self.main_registry.createCcModule('aaa', '1.0').createCcModule( | ||
'bbb', '1.0', {'aaa': '1.0'} | ||
) | ||
self.ScratchFile( | ||
'MODULE.bazel', | ||
[ | ||
'bazel_dep(name = "bbb", version = "1.0")', | ||
], | ||
) | ||
self.ScratchFile( | ||
'BUILD', | ||
[ | ||
'cc_binary(', | ||
' name = "main",', | ||
' srcs = ["main.cc"],', | ||
' deps = [', | ||
' "@bbb//:lib_bbb",', | ||
' ],', | ||
')', | ||
], | ||
) | ||
self.ScratchFile( | ||
'main.cc', | ||
[ | ||
'#include "aaa.h"', | ||
'int main() {', | ||
' hello_aaa("Hello there!");', | ||
'}', | ||
], | ||
) | ||
self.ScratchFile('targets.params', ['//:main']) | ||
self.RunBazel(['fetch', '--target_pattern_file=targets.params']) | ||
# If we can run the target with --nofetch, this means we successfully | ||
# fetched all its needed repos | ||
_, stdout, _ = self.RunBazel(['run', '//:main', '--nofetch']) | ||
self.assertIn('Hello there! => [email protected]', stdout) | ||
|
||
|
||
if __name__ == '__main__': | ||
absltest.main() |
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