-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Part of --incompatible_disable_legacy_cc_provider migration (https://github.com/bazelbuild/bazel/issues/7036) | ||
""" | ||
|
||
def get_libs_for_static_executable(dep): | ||
""" | ||
This replaces dep.cc.libs, which found the libraries | ||
used for linking a static executable. | ||
Args: | ||
dep: A cc_library target. | ||
Returns: | ||
A depset[File] | ||
""" | ||
libraries_to_link = dep[CcInfo].linking_context.libraries_to_link | ||
return depset([_get_preferred_artifact(lib) for lib in libraries_to_link]) | ||
|
||
def _get_preferred_artifact(library_to_link): | ||
return ( | ||
library_to_link.static_library or | ||
library_to_link.pic_static_library or | ||
library_to_link.interface_library or | ||
library_to_link.dynamic_library | ||
) |
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