-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix apply_binaries for Google3 (#243)
**Problem** When using `--no-aggregate-source` option with py_binary, I noticed that we end up generating py_binary twice, first time for main, and second time for test. **Solution** This implements `TargetEntries::combine(ts1, ts2)`, which can dedupliate the target entries based on the name. There's an example in `examples/com` demonstrating the usage.
- Loading branch information
Showing
6 changed files
with
106 additions
and
35 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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
def py_binary( | ||
name = None, | ||
binary_refs_value = None, | ||
owning_library = None, | ||
entity_path = None, | ||
visibility = None, | ||
**kwargs): | ||
if name == None: | ||
fail("Need to specify name") | ||
if owning_library == None: | ||
fail("Need to specify owning_library") | ||
if entity_path == None: | ||
fail("Need to specify entity_path") | ||
if visibility == None: | ||
fail("Need to specify visibility") | ||
idx = entity_path.rindex("/") | ||
relative_entity_path = entity_path | ||
if idx >= 0: | ||
relative_entity_path = entity_path[idx + 1:] | ||
|
||
# buildifier: disable=native-python | ||
native.py_binary( | ||
name = name, | ||
main = relative_entity_path, | ||
legacy_create_init = 1, | ||
deps = [ | ||
owning_library, | ||
], | ||
srcs = [ | ||
relative_entity_path, | ||
], | ||
visibility = visibility, | ||
) |
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