|
|
|
@@ -194,7 +194,7 @@ type ModuleContextIntf interface {
|
|
|
|
|
noDefaultCompilerFlags() bool
|
|
|
|
|
sdk() bool
|
|
|
|
|
sdkVersion() string
|
|
|
|
|
useVndk() bool
|
|
|
|
|
vndk() bool
|
|
|
|
|
isVndk() bool
|
|
|
|
|
isVndkSp() bool
|
|
|
|
|
createVndkSourceAbiDump() bool
|
|
|
|
@@ -377,7 +377,7 @@ func (c *Module) isDependencyRoot() bool {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *Module) useVndk() bool {
|
|
|
|
|
func (c *Module) vndk() bool {
|
|
|
|
|
return c.Properties.UseVndk
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -403,8 +403,10 @@ type moduleContext struct {
|
|
|
|
|
moduleContextImpl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ctx *moduleContext) InstallOnVendorPartition() bool {
|
|
|
|
|
return ctx.ModuleContext.Vendor() || (ctx.mod.useVndk() && !ctx.mod.isVndk())
|
|
|
|
|
// Vendor returns true for vendor modules excluding VNDK libraries so that
|
|
|
|
|
// they get installed onto the correct partition
|
|
|
|
|
func (ctx *moduleContext) Vendor() bool {
|
|
|
|
|
return ctx.ModuleContext.Vendor() || (ctx.mod.vndk() && !ctx.mod.isVndk())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type moduleContextImpl struct {
|
|
|
|
@@ -443,7 +445,7 @@ func (ctx *moduleContextImpl) noDefaultCompilerFlags() bool {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ctx *moduleContextImpl) sdk() bool {
|
|
|
|
|
if ctx.ctx.Device() && !ctx.useVndk() {
|
|
|
|
|
if ctx.ctx.Device() && !ctx.vndk() {
|
|
|
|
|
return ctx.mod.Properties.Sdk_version != ""
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
@@ -451,7 +453,7 @@ func (ctx *moduleContextImpl) sdk() bool {
|
|
|
|
|
|
|
|
|
|
func (ctx *moduleContextImpl) sdkVersion() string {
|
|
|
|
|
if ctx.ctx.Device() {
|
|
|
|
|
if ctx.useVndk() {
|
|
|
|
|
if ctx.vndk() {
|
|
|
|
|
return "current"
|
|
|
|
|
} else {
|
|
|
|
|
return ctx.mod.Properties.Sdk_version
|
|
|
|
@@ -460,12 +462,13 @@ func (ctx *moduleContextImpl) sdkVersion() string {
|
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ctx *moduleContextImpl) vndk() bool {
|
|
|
|
|
return ctx.mod.vndk()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ctx *moduleContextImpl) isVndk() bool {
|
|
|
|
|
return ctx.mod.isVndk()
|
|
|
|
|
}
|
|
|
|
|
func (ctx *moduleContextImpl) useVndk() bool {
|
|
|
|
|
return ctx.mod.useVndk()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ctx *moduleContextImpl) isVndkSp() bool {
|
|
|
|
|
if vndk := ctx.mod.vndkdep; vndk != nil {
|
|
|
|
@@ -476,7 +479,7 @@ func (ctx *moduleContextImpl) isVndkSp() bool {
|
|
|
|
|
|
|
|
|
|
// Create source abi dumps if the module belongs to the list of VndkLibraries.
|
|
|
|
|
func (ctx *moduleContextImpl) createVndkSourceAbiDump() bool {
|
|
|
|
|
return ctx.ctx.Device() && ((ctx.useVndk() && ctx.isVndk()) || inList(ctx.baseModuleName(), llndkLibraries))
|
|
|
|
|
return ctx.ctx.Device() && ((ctx.vndk() && ctx.isVndk()) || inList(ctx.baseModuleName(), llndkLibraries))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ctx *moduleContextImpl) selectedStl() string {
|
|
|
|
@@ -530,7 +533,6 @@ func (c *Module) Name() string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|
|
|
|
|
|
|
|
|
ctx := &moduleContext{
|
|
|
|
|
ModuleContext: actx,
|
|
|
|
|
moduleContextImpl: moduleContextImpl{
|
|
|
|
@@ -762,23 +764,19 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|
|
|
|
if ctx.Os() == android.Android {
|
|
|
|
|
version := ctx.sdkVersion()
|
|
|
|
|
|
|
|
|
|
// rewriteNdkLibs takes a list of names of shared libraries and scans it for three types
|
|
|
|
|
// of names:
|
|
|
|
|
// Rewrites the names of shared libraries into the names of the NDK
|
|
|
|
|
// libraries where appropriate. This returns two slices.
|
|
|
|
|
//
|
|
|
|
|
// 1. Name of an NDK library that refers to a prebuilt module.
|
|
|
|
|
// For each of these, it adds the name of the prebuilt module (which will be in
|
|
|
|
|
// prebuilts/ndk) to the list of nonvariant libs.
|
|
|
|
|
// 2. Name of an NDK library that refers to an ndk_library module.
|
|
|
|
|
// For each of these, it adds the name of the ndk_library module to the list of
|
|
|
|
|
// variant libs.
|
|
|
|
|
// 3. Anything else (so anything that isn't an NDK library).
|
|
|
|
|
// It adds these to the nonvariantLibs list.
|
|
|
|
|
// The first is a list of non-variant shared libraries (either rewritten
|
|
|
|
|
// NDK libraries to the modules in prebuilts/ndk, or not rewritten
|
|
|
|
|
// because they are not NDK libraries).
|
|
|
|
|
//
|
|
|
|
|
// The caller can then know to add the variantLibs dependencies differently from the
|
|
|
|
|
// nonvariantLibs
|
|
|
|
|
rewriteNdkLibs := func(list []string) (nonvariantLibs []string, variantLibs []string) {
|
|
|
|
|
variantLibs = []string{}
|
|
|
|
|
nonvariantLibs = []string{}
|
|
|
|
|
// The second is a list of ndk_library modules. These need to be
|
|
|
|
|
// separated because they are a variation dependency and must be added
|
|
|
|
|
// in a different manner.
|
|
|
|
|
rewriteNdkLibs := func(list []string) ([]string, []string) {
|
|
|
|
|
variantLibs := []string{}
|
|
|
|
|
nonvariantLibs := []string{}
|
|
|
|
|
for _, entry := range list {
|
|
|
|
|
if ctx.sdk() && inList(entry, ndkPrebuiltSharedLibraries) {
|
|
|
|
|
if !inList(entry, ndkMigratedLibs) {
|
|
|
|
@@ -786,7 +784,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|
|
|
|
} else {
|
|
|
|
|
variantLibs = append(variantLibs, entry+ndkLibrarySuffix)
|
|
|
|
|
}
|
|
|
|
|
} else if ctx.useVndk() && inList(entry, llndkLibraries) {
|
|
|
|
|
} else if ctx.vndk() && inList(entry, llndkLibraries) {
|
|
|
|
|
nonvariantLibs = append(nonvariantLibs, entry+llndkLibrarySuffix)
|
|
|
|
|
} else {
|
|
|
|
|
nonvariantLibs = append(nonvariantLibs, entry)
|
|
|
|
@@ -888,118 +886,117 @@ func (c *Module) clang(ctx BaseModuleContext) bool {
|
|
|
|
|
return clang
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Whether a module can link to another module, taking into
|
|
|
|
|
// account NDK linking.
|
|
|
|
|
func checkLinkType(ctx android.ModuleContext, from *Module, to *Module) {
|
|
|
|
|
if from.Target().Os != android.Android {
|
|
|
|
|
// Host code is not restricted
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if from.Properties.UseVndk {
|
|
|
|
|
// Though vendor code is limited by the vendor mutator,
|
|
|
|
|
// each vendor-available module needs to check
|
|
|
|
|
// link-type for VNDK.
|
|
|
|
|
if from.vndkdep != nil {
|
|
|
|
|
from.vndkdep.vndkCheckLinkType(ctx, to)
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if from.Properties.Sdk_version == "" {
|
|
|
|
|
// Platform code can link to anything
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if _, ok := to.linker.(*toolchainLibraryDecorator); ok {
|
|
|
|
|
// These are always allowed
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if _, ok := to.linker.(*ndkPrebuiltLibraryLinker); ok {
|
|
|
|
|
// These are allowed, but they don't set sdk_version
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if _, ok := to.linker.(*ndkPrebuiltStlLinker); ok {
|
|
|
|
|
// These are allowed, but they don't set sdk_version
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if _, ok := to.linker.(*stubDecorator); ok {
|
|
|
|
|
// These aren't real libraries, but are the stub shared libraries that are included in
|
|
|
|
|
// the NDK.
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if to.Properties.Sdk_version == "" {
|
|
|
|
|
// NDK code linking to platform code is never okay.
|
|
|
|
|
ctx.ModuleErrorf("depends on non-NDK-built library %q",
|
|
|
|
|
ctx.OtherModuleName(to))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// At this point we know we have two NDK libraries, but we need to
|
|
|
|
|
// check that we're not linking against anything built against a higher
|
|
|
|
|
// API level, as it is only valid to link against older or equivalent
|
|
|
|
|
// APIs.
|
|
|
|
|
|
|
|
|
|
if from.Properties.Sdk_version == "current" {
|
|
|
|
|
// Current can link against anything.
|
|
|
|
|
return
|
|
|
|
|
} else if to.Properties.Sdk_version == "current" {
|
|
|
|
|
// Current can't be linked against by anything else.
|
|
|
|
|
ctx.ModuleErrorf("links %q built against newer API version %q",
|
|
|
|
|
ctx.OtherModuleName(to), "current")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fromApi, err := strconv.Atoi(from.Properties.Sdk_version)
|
|
|
|
|
if err != nil {
|
|
|
|
|
ctx.PropertyErrorf("sdk_version",
|
|
|
|
|
"Invalid sdk_version value (must be int): %q",
|
|
|
|
|
from.Properties.Sdk_version)
|
|
|
|
|
}
|
|
|
|
|
toApi, err := strconv.Atoi(to.Properties.Sdk_version)
|
|
|
|
|
if err != nil {
|
|
|
|
|
ctx.PropertyErrorf("sdk_version",
|
|
|
|
|
"Invalid sdk_version value (must be int): %q",
|
|
|
|
|
to.Properties.Sdk_version)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if toApi > fromApi {
|
|
|
|
|
ctx.ModuleErrorf("links %q built against newer API version %q",
|
|
|
|
|
ctx.OtherModuleName(to), to.Properties.Sdk_version)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Convert dependencies to paths. Returns a PathDeps containing paths
|
|
|
|
|
func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|
|
|
|
var depPaths PathDeps
|
|
|
|
|
|
|
|
|
|
ctx.VisitDirectDeps(func(dep blueprint.Module) {
|
|
|
|
|
depName := ctx.OtherModuleName(dep)
|
|
|
|
|
depTag := ctx.OtherModuleDependencyTag(dep)
|
|
|
|
|
// Whether a module can link to another module, taking into
|
|
|
|
|
// account NDK linking.
|
|
|
|
|
checkLinkType := func(from, to *Module) {
|
|
|
|
|
if from.Target().Os != android.Android {
|
|
|
|
|
// Host code is not restricted
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if from.Properties.UseVndk {
|
|
|
|
|
// Though vendor code is limited by the vendor mutator,
|
|
|
|
|
// each vendor-available module needs to check
|
|
|
|
|
// link-type for VNDK.
|
|
|
|
|
if from.vndkdep != nil {
|
|
|
|
|
from.vndkdep.vndkCheckLinkType(ctx, to)
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if from.Properties.Sdk_version == "" {
|
|
|
|
|
// Platform code can link to anything
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if _, ok := to.linker.(*toolchainLibraryDecorator); ok {
|
|
|
|
|
// These are always allowed
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if _, ok := to.linker.(*ndkPrebuiltLibraryLinker); ok {
|
|
|
|
|
// These are allowed, but don't set sdk_version
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if _, ok := to.linker.(*ndkPrebuiltStlLinker); ok {
|
|
|
|
|
// These are allowed, but don't set sdk_version
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if _, ok := to.linker.(*stubDecorator); ok {
|
|
|
|
|
// These aren't real libraries, but are the stub shared libraries that are included in
|
|
|
|
|
// the NDK.
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if to.Properties.Sdk_version == "" {
|
|
|
|
|
// NDK code linking to platform code is never okay.
|
|
|
|
|
ctx.ModuleErrorf("depends on non-NDK-built library %q",
|
|
|
|
|
ctx.OtherModuleName(to))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
aDep, _ := dep.(android.Module)
|
|
|
|
|
if aDep == nil {
|
|
|
|
|
ctx.ModuleErrorf("module %q not an android module", depName)
|
|
|
|
|
// All this point we know we have two NDK libraries, but we need to
|
|
|
|
|
// check that we're not linking against anything built against a higher
|
|
|
|
|
// API level, as it is only valid to link against older or equivalent
|
|
|
|
|
// APIs.
|
|
|
|
|
|
|
|
|
|
if from.Properties.Sdk_version == "current" {
|
|
|
|
|
// Current can link against anything.
|
|
|
|
|
return
|
|
|
|
|
} else if to.Properties.Sdk_version == "current" {
|
|
|
|
|
// Current can't be linked against by anything else.
|
|
|
|
|
ctx.ModuleErrorf("links %q built against newer API version %q",
|
|
|
|
|
ctx.OtherModuleName(to), "current")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fromApi, err := strconv.Atoi(from.Properties.Sdk_version)
|
|
|
|
|
if err != nil {
|
|
|
|
|
ctx.PropertyErrorf("sdk_version",
|
|
|
|
|
"Invalid sdk_version value (must be int): %q",
|
|
|
|
|
from.Properties.Sdk_version)
|
|
|
|
|
}
|
|
|
|
|
toApi, err := strconv.Atoi(to.Properties.Sdk_version)
|
|
|
|
|
if err != nil {
|
|
|
|
|
ctx.PropertyErrorf("sdk_version",
|
|
|
|
|
"Invalid sdk_version value (must be int): %q",
|
|
|
|
|
to.Properties.Sdk_version)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if toApi > fromApi {
|
|
|
|
|
ctx.ModuleErrorf("links %q built against newer API version %q",
|
|
|
|
|
ctx.OtherModuleName(to), to.Properties.Sdk_version)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ctx.VisitDirectDeps(func(m blueprint.Module) {
|
|
|
|
|
name := ctx.OtherModuleName(m)
|
|
|
|
|
tag := ctx.OtherModuleDependencyTag(m)
|
|
|
|
|
|
|
|
|
|
a, _ := m.(android.Module)
|
|
|
|
|
if a == nil {
|
|
|
|
|
ctx.ModuleErrorf("module %q not an android module", name)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ccDep, _ := dep.(*Module)
|
|
|
|
|
if ccDep == nil {
|
|
|
|
|
// handling for a few module types that aren't cc Module but that are also supported
|
|
|
|
|
switch depTag {
|
|
|
|
|
cc, _ := m.(*Module)
|
|
|
|
|
if cc == nil {
|
|
|
|
|
switch tag {
|
|
|
|
|
case android.DefaultsDepTag, android.SourceDepTag:
|
|
|
|
|
// Nothing to do
|
|
|
|
|
case genSourceDepTag:
|
|
|
|
|
if genRule, ok := dep.(genrule.SourceFileGenerator); ok {
|
|
|
|
|
if genRule, ok := m.(genrule.SourceFileGenerator); ok {
|
|
|
|
|
depPaths.GeneratedSources = append(depPaths.GeneratedSources,
|
|
|
|
|
genRule.GeneratedSourceFiles()...)
|
|
|
|
|
} else {
|
|
|
|
|
ctx.ModuleErrorf("module %q is not a gensrcs or genrule", depName)
|
|
|
|
|
ctx.ModuleErrorf("module %q is not a gensrcs or genrule", name)
|
|
|
|
|
}
|
|
|
|
|
// Support exported headers from a generated_sources dependency
|
|
|
|
|
fallthrough
|
|
|
|
|
case genHeaderDepTag, genHeaderExportDepTag:
|
|
|
|
|
if genRule, ok := dep.(genrule.SourceFileGenerator); ok {
|
|
|
|
|
if genRule, ok := m.(genrule.SourceFileGenerator); ok {
|
|
|
|
|
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders,
|
|
|
|
|
genRule.GeneratedSourceFiles()...)
|
|
|
|
|
flags := includeDirsToFlags(genRule.GeneratedHeaderDirs())
|
|
|
|
|
depPaths.Flags = append(depPaths.Flags, flags)
|
|
|
|
|
if depTag == genHeaderExportDepTag {
|
|
|
|
|
if tag == genHeaderExportDepTag {
|
|
|
|
|
depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags)
|
|
|
|
|
depPaths.ReexportedFlagsDeps = append(depPaths.ReexportedFlagsDeps,
|
|
|
|
|
genRule.GeneratedSourceFiles()...)
|
|
|
|
@@ -1008,46 +1005,46 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ctx.ModuleErrorf("module %q is not a genrule", depName)
|
|
|
|
|
ctx.ModuleErrorf("module %q is not a genrule", name)
|
|
|
|
|
}
|
|
|
|
|
case linkerScriptDepTag:
|
|
|
|
|
if genRule, ok := dep.(genrule.SourceFileGenerator); ok {
|
|
|
|
|
if genRule, ok := m.(genrule.SourceFileGenerator); ok {
|
|
|
|
|
files := genRule.GeneratedSourceFiles()
|
|
|
|
|
if len(files) == 1 {
|
|
|
|
|
depPaths.LinkerScript = android.OptionalPathForPath(files[0])
|
|
|
|
|
} else if len(files) > 1 {
|
|
|
|
|
ctx.ModuleErrorf("module %q can only generate a single file if used for a linker script", depName)
|
|
|
|
|
ctx.ModuleErrorf("module %q can only generate a single file if used for a linker script", name)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ctx.ModuleErrorf("module %q is not a genrule", depName)
|
|
|
|
|
ctx.ModuleErrorf("module %q is not a genrule", name)
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
ctx.ModuleErrorf("depends on non-cc module %q", depName)
|
|
|
|
|
ctx.ModuleErrorf("depends on non-cc module %q", name)
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// some validation
|
|
|
|
|
if !aDep.Enabled() {
|
|
|
|
|
if !a.Enabled() {
|
|
|
|
|
if ctx.AConfig().AllowMissingDependencies() {
|
|
|
|
|
ctx.AddMissingDependencies([]string{depName})
|
|
|
|
|
ctx.AddMissingDependencies([]string{name})
|
|
|
|
|
} else {
|
|
|
|
|
ctx.ModuleErrorf("depends on disabled module %q", depName)
|
|
|
|
|
ctx.ModuleErrorf("depends on disabled module %q", name)
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if aDep.Target().Os != ctx.Os() {
|
|
|
|
|
ctx.ModuleErrorf("OS mismatch between %q and %q", ctx.ModuleName(), depName)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if aDep.Target().Arch.ArchType != ctx.Arch().ArchType {
|
|
|
|
|
ctx.ModuleErrorf("Arch mismatch between %q and %q", ctx.ModuleName(), depName)
|
|
|
|
|
|
|
|
|
|
if a.Target().Os != ctx.Os() {
|
|
|
|
|
ctx.ModuleErrorf("OS mismatch between %q and %q", ctx.ModuleName(), name)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// re-exporting flags
|
|
|
|
|
if depTag == reuseObjTag {
|
|
|
|
|
if l, ok := ccDep.compiler.(libraryInterface); ok {
|
|
|
|
|
if a.Target().Arch.ArchType != ctx.Arch().ArchType {
|
|
|
|
|
ctx.ModuleErrorf("Arch mismatch between %q and %q", ctx.ModuleName(), name)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if tag == reuseObjTag {
|
|
|
|
|
if l, ok := cc.compiler.(libraryInterface); ok {
|
|
|
|
|
objs, flags, deps := l.reuseObjs()
|
|
|
|
|
depPaths.Objs = depPaths.Objs.Append(objs)
|
|
|
|
|
depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags...)
|
|
|
|
@@ -1055,8 +1052,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if t, ok := depTag.(dependencyTag); ok && t.library {
|
|
|
|
|
if i, ok := ccDep.linker.(exportedFlagsProducer); ok {
|
|
|
|
|
|
|
|
|
|
if t, ok := tag.(dependencyTag); ok && t.library {
|
|
|
|
|
if i, ok := cc.linker.(exportedFlagsProducer); ok {
|
|
|
|
|
flags := i.exportedFlags()
|
|
|
|
|
deps := i.exportedFlagsDeps()
|
|
|
|
|
depPaths.Flags = append(depPaths.Flags, flags...)
|
|
|
|
@@ -1072,38 +1070,38 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkLinkType(ctx, c, ccDep)
|
|
|
|
|
checkLinkType(c, cc)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ptr *android.Paths
|
|
|
|
|
var depPtr *android.Paths
|
|
|
|
|
|
|
|
|
|
linkFile := ccDep.outputFile
|
|
|
|
|
linkFile := cc.outputFile
|
|
|
|
|
depFile := android.OptionalPath{}
|
|
|
|
|
|
|
|
|
|
switch depTag {
|
|
|
|
|
switch tag {
|
|
|
|
|
case ndkStubDepTag, sharedDepTag, sharedExportDepTag:
|
|
|
|
|
ptr = &depPaths.SharedLibs
|
|
|
|
|
depPtr = &depPaths.SharedLibsDeps
|
|
|
|
|
depFile = ccDep.linker.(libraryInterface).toc()
|
|
|
|
|
depFile = cc.linker.(libraryInterface).toc()
|
|
|
|
|
case lateSharedDepTag, ndkLateStubDepTag:
|
|
|
|
|
ptr = &depPaths.LateSharedLibs
|
|
|
|
|
depPtr = &depPaths.LateSharedLibsDeps
|
|
|
|
|
depFile = ccDep.linker.(libraryInterface).toc()
|
|
|
|
|
depFile = cc.linker.(libraryInterface).toc()
|
|
|
|
|
case staticDepTag, staticExportDepTag:
|
|
|
|
|
ptr = &depPaths.StaticLibs
|
|
|
|
|
case lateStaticDepTag:
|
|
|
|
|
ptr = &depPaths.LateStaticLibs
|
|
|
|
|
case wholeStaticDepTag:
|
|
|
|
|
ptr = &depPaths.WholeStaticLibs
|
|
|
|
|
staticLib, ok := ccDep.linker.(libraryInterface)
|
|
|
|
|
staticLib, ok := cc.linker.(libraryInterface)
|
|
|
|
|
if !ok || !staticLib.static() {
|
|
|
|
|
ctx.ModuleErrorf("module %q not a static library", depName)
|
|
|
|
|
ctx.ModuleErrorf("module %q not a static library", name)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if missingDeps := staticLib.getWholeStaticMissingDeps(); missingDeps != nil {
|
|
|
|
|
postfix := " (required by " + ctx.OtherModuleName(dep) + ")"
|
|
|
|
|
postfix := " (required by " + ctx.OtherModuleName(m) + ")"
|
|
|
|
|
for i := range missingDeps {
|
|
|
|
|
missingDeps[i] += postfix
|
|
|
|
|
}
|
|
|
|
@@ -1120,11 +1118,11 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|
|
|
|
depPaths.CrtEnd = linkFile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch depTag {
|
|
|
|
|
switch tag {
|
|
|
|
|
case staticDepTag, staticExportDepTag, lateStaticDepTag:
|
|
|
|
|
staticLib, ok := ccDep.linker.(libraryInterface)
|
|
|
|
|
staticLib, ok := cc.linker.(libraryInterface)
|
|
|
|
|
if !ok || !staticLib.static() {
|
|
|
|
|
ctx.ModuleErrorf("module %q not a static library", depName)
|
|
|
|
|
ctx.ModuleErrorf("module %q not a static library", name)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1135,12 +1133,11 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|
|
|
|
staticLib.objs().coverageFiles...)
|
|
|
|
|
depPaths.StaticLibObjs.sAbiDumpFiles = append(depPaths.StaticLibObjs.sAbiDumpFiles,
|
|
|
|
|
staticLib.objs().sAbiDumpFiles...)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ptr != nil {
|
|
|
|
|
if !linkFile.Valid() {
|
|
|
|
|
ctx.ModuleErrorf("module %q missing output file", depName)
|
|
|
|
|
ctx.ModuleErrorf("module %q missing output file", name)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
*ptr = append(*ptr, linkFile.Path())
|
|
|
|
@@ -1154,24 +1151,24 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|
|
|
|
*depPtr = append(*depPtr, dep.Path())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Export the shared libs to Make.
|
|
|
|
|
switch depTag {
|
|
|
|
|
// Export the shared libs to the make world. In doing so, .vendor suffix
|
|
|
|
|
// is added if the lib has both core and vendor variants and this module
|
|
|
|
|
// is building against vndk. This is because the vendor variant will be
|
|
|
|
|
// have .vendor suffix in its name in the make world. However, if the
|
|
|
|
|
// lib is a vendor-only lib or this lib is not building against vndk,
|
|
|
|
|
// then the suffix is not added.
|
|
|
|
|
switch tag {
|
|
|
|
|
case sharedDepTag, sharedExportDepTag, lateSharedDepTag:
|
|
|
|
|
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
|
|
|
|
|
libName := strings.TrimSuffix(name, llndkLibrarySuffix)
|
|
|
|
|
libName = strings.TrimPrefix(libName, "prebuilt_")
|
|
|
|
|
isLLndk := inList(libName, llndkLibraries)
|
|
|
|
|
var makeLibName string
|
|
|
|
|
bothVendorAndCoreVariantsExist := Bool(ccDep.VendorProperties.Vendor_available) || isLLndk
|
|
|
|
|
if c.useVndk() && bothVendorAndCoreVariantsExist {
|
|
|
|
|
// The vendor module in Make will have been renamed to not conflict with the core
|
|
|
|
|
// module, so update the dependency name here accordingly.
|
|
|
|
|
makeLibName = libName + vendorSuffix
|
|
|
|
|
} else {
|
|
|
|
|
makeLibName = libName
|
|
|
|
|
if c.vndk() && (Bool(cc.VendorProperties.Vendor_available) || isLLndk) {
|
|
|
|
|
libName += vendorSuffix
|
|
|
|
|
}
|
|
|
|
|
// Note: the order of libs in this list is not important because
|
|
|
|
|
// they merely serve as Make dependencies and do not affect this lib itself.
|
|
|
|
|
c.Properties.AndroidMkSharedLibs = append(c.Properties.AndroidMkSharedLibs, makeLibName)
|
|
|
|
|
// they merely serve as dependencies in the make world and do not
|
|
|
|
|
// affect this lib itself.
|
|
|
|
|
c.Properties.AndroidMkSharedLibs = append(c.Properties.AndroidMkSharedLibs, libName)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
@@ -1368,8 +1365,8 @@ outer:
|
|
|
|
|
return list[:k]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// lastUniqueElements returns all unique elements of a slice, keeping the last copy of each.
|
|
|
|
|
// It modifies the slice contents in place, and returns a subslice of the original slice
|
|
|
|
|
// lastUniqueElements returns all unique elements of a slice, keeping the last copy of each
|
|
|
|
|
// modifies the slice contents in place, and returns a subslice of the original slice
|
|
|
|
|
func lastUniqueElements(list []string) []string {
|
|
|
|
|
totalSkip := 0
|
|
|
|
|
for i := len(list) - 1; i >= totalSkip; i-- {
|
|
|
|
|