Remove IsDependencyRoot from interface
This is equivalent to Binary() -- reduce the interface and improve
clarity.
Test: go test soong tests
Change-Id: I770f5ce79fd4d888586d31ec5e67be88153626b6
diff --git a/cc/binary.go b/cc/binary.go
index 48f70d9..c177a08 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -183,11 +183,6 @@
return deps
}
-func (binary *binaryDecorator) isDependencyRoot() bool {
- // Binaries are always the dependency root.
- return true
-}
-
// NewBinary builds and returns a new Module corresponding to a C++ binary.
// Individual module implementations which comprise a C++ binary should call this function,
// set some fields on the result, and then call the Init function.
diff --git a/cc/cc.go b/cc/cc.go
index 1f73149..ca88913 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1119,17 +1119,6 @@
return c
}
-// Returns true for dependency roots (binaries)
-// TODO(ccross): also handle dlopenable libraries
-func (c *Module) IsDependencyRoot() bool {
- if root, ok := c.linker.(interface {
- isDependencyRoot() bool
- }); ok {
- return root.isDependencyRoot()
- }
- return false
-}
-
func (c *Module) UseVndk() bool {
return c.Properties.VndkVersion != ""
}
diff --git a/cc/linkable.go b/cc/linkable.go
index dd87334..c42c875 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -14,11 +14,6 @@
// SanitizePropDefined returns whether the Sanitizer properties struct for this module is defined.
SanitizePropDefined() bool
- // IsDependencyRoot returns whether a module is of a type which cannot be a linkage dependency
- // of another module. For example, cc_binary and rust_binary represent dependency roots as other
- // modules cannot have linkage dependencies against these types.
- IsDependencyRoot() bool
-
// IsSanitizerEnabled returns whether a sanitizer is enabled.
IsSanitizerEnabled(t SanitizerType) bool
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 4cc70e0..e95a935 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -1250,7 +1250,7 @@
func sanitizerMutator(t SanitizerType) func(android.BottomUpMutatorContext) {
return func(mctx android.BottomUpMutatorContext) {
if c, ok := mctx.Module().(PlatformSanitizeable); ok && c.SanitizePropDefined() {
- if c.IsDependencyRoot() && c.IsSanitizerEnabled(t) {
+ if c.Binary() && c.IsSanitizerEnabled(t) {
modules := mctx.CreateVariations(t.variationName())
modules[0].(PlatformSanitizeable).SetSanitizer(t, true)
} else if c.IsSanitizerEnabled(t) || c.SanitizeDep() {
diff --git a/rust/binary.go b/rust/binary.go
index 8d0a0a7..2c3f548 100644
--- a/rust/binary.go
+++ b/rust/binary.go
@@ -155,7 +155,3 @@
}
return binary.baseCompiler.stdLinkage(ctx)
}
-
-func (binary *binaryDecorator) isDependencyRoot() bool {
- return true
-}
diff --git a/rust/compiler.go b/rust/compiler.go
index 1598ebf..0b28135 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -289,10 +289,6 @@
return android.OptionalPathForPath(compiler.cargoOutDir)
}
-func (compiler *baseCompiler) isDependencyRoot() bool {
- return false
-}
-
func (compiler *baseCompiler) strippedOutputFilePath() android.OptionalPath {
return compiler.strippedOutputFile
}
diff --git a/rust/rust.go b/rust/rust.go
index a11a04c..0a9869f 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -172,13 +172,6 @@
return mod.sanitize != nil && mod.compiler != nil
}
-func (mod *Module) IsDependencyRoot() bool {
- if mod.compiler != nil {
- return mod.compiler.isDependencyRoot()
- }
- panic("IsDependencyRoot called on a non-compiler Rust module")
-}
-
func (mod *Module) IsPrebuilt() bool {
if _, ok := mod.compiler.(*prebuiltLibraryDecorator); ok {
return true
@@ -449,7 +442,6 @@
SetDisabled()
stdLinkage(ctx *depsContext) RustLinkage
- isDependencyRoot() bool
strippedOutputFilePath() android.OptionalPath
}