Move stubs related methods out of LinkableInterface
The stubs methods are very specific to cc for now, move them out
of LinkableInterface so they are not shared with rust. Instead,
create a cc.Module.library field that contains the libraryInterface
to simplify calling libraryInterface methods on cc modules.
Test: all Soong tests
Test: no change to Soong outputs
Change-Id: I0289d866ce1f7a765631fe3101a62b1b4988ba1c
diff --git a/cc/fuzz.go b/cc/fuzz.go
index 681e3bc..fe3c12b 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -174,12 +174,25 @@
// TODO(b/144090547): We should be parsing these modules using
// ModuleDependencyTag instead of the current brute-force checking.
- if linkable, ok := dependency.(LinkableInterface); !ok || // Discard non-linkables.
- !linkable.CcLibraryInterface() || !linkable.Shared() || // Discard static libs.
- linkable.UseVndk() || // Discard vendor linked libraries.
+ linkable, ok := dependency.(LinkableInterface)
+ if !ok || !linkable.CcLibraryInterface() {
+ // Discard non-linkables.
+ return false
+ }
+
+ if !linkable.Shared() {
+ // Discard static libs.
+ return false
+ }
+
+ if linkable.UseVndk() {
+ // Discard vendor linked libraries.
+ return false
+ }
+
+ if lib := moduleLibraryInterface(dependency); lib != nil && lib.buildStubs() && linkable.CcLibrary() {
// Discard stubs libs (only CCLibrary variants). Prebuilt libraries should not
// be excluded on the basis of they're not CCLibrary()'s.
- (linkable.CcLibrary() && linkable.BuildStubs()) {
return false
}