platform_build_soong/cc/linkable.go
Colin Cross 6e511a9a9f Add libraryDependencyTag to track dependencies on static and shared libraries
dependencyTag uses a set of predefined tags to identify different types
of dependencies.  There are already multiple bits of metadata stored
in the dependency tag (Library, Shared, ReexportFlags), and supporting
them all requires a combinatorial explosion of predefined tags and
causes issues when using equality comparisons if a new bit of metadata
is added.

Add a new libraryDependencyTag type that will contain the metadata
bits, and replace the quality comparisons with checks on the metadata
bits.

There are 5 TODOs where modifying the checks identified problems with
the existing checks.  These were left in place to produce identical
build output and will be fixed separately.

Bug: 162437057
Test: no change to build.ninja or {Android,make_vars,late}-${TARGET_PRODUCT}.mk
Change-Id: I72d4207dcf381c07c92e00e5a03968ebb5ed8d30
2020-07-29 13:22:30 -07:00

78 lines
1.4 KiB
Go

package cc
import (
"android/soong/android"
"github.com/google/blueprint"
)
type LinkableInterface interface {
Module() android.Module
CcLibrary() bool
CcLibraryInterface() bool
OutputFile() android.OptionalPath
CoverageFiles() android.Paths
IncludeDirs() android.Paths
SetDepsInLinkOrder([]android.Path)
GetDepsInLinkOrder() []android.Path
HasStaticVariant() bool
GetStaticVariant() LinkableInterface
NonCcVariants() bool
StubsVersions() []string
BuildStubs() bool
SetBuildStubs()
SetStubsVersions(string)
StubsVersion() string
HasStubsVariants() bool
SelectedStl() string
ApiLevel() string
BuildStaticVariant() bool
BuildSharedVariant() bool
SetStatic()
SetShared()
Static() bool
Shared() bool
Toc() android.OptionalPath
Host() bool
InRamdisk() bool
OnlyInRamdisk() bool
InRecovery() bool
OnlyInRecovery() bool
UseSdk() bool
UseVndk() bool
MustUseVendorVariant() bool
IsVndk() bool
HasVendorVariant() bool
SdkVersion() string
AlwaysSdk() bool
IsSdkVariant() bool
ToolchainLibrary() bool
NdkPrebuiltStl() bool
StubDecorator() bool
}
var (
CrtBeginDepTag = dependencyTag{name: "crtbegin"}
CrtEndDepTag = dependencyTag{name: "crtend"}
CoverageDepTag = dependencyTag{name: "coverage"}
)
func SharedDepTag() blueprint.DependencyTag {
return libraryDependencyTag{Kind: sharedLibraryDependency}
}
func StaticDepTag() blueprint.DependencyTag {
return libraryDependencyTag{Kind: staticLibraryDependency}
}