Copy shared_libs and system_shared_libs to module snapshot
This change ensures that the runtime dependencies between a binary/shared library are correctly specified in the snapshot so that the build can ensure that shared libraries are built before the targets that use them. It adds support for differentiating between references that are required to refer to another sdk member (required) and those that may refer to either an sdk member or a non-sdk member (optional). The latter is used for shared library references as the libraries used by an sdk member may be provided from outside the sdk. e.g. liblog is not part of the ART module but is used by some members of the ART sdk. Bug: 142935992 Test: m nothing Change-Id: Ia8509ffe79b208c23beba1880fe9c8a92b732685
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
|
||||
"android/soong/android"
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
// This file contains support for using cc library modules within an sdk.
|
||||
@@ -108,8 +109,11 @@ func (mt *librarySdkMemberType) AddPrebuiltModule(sdkModuleContext android.Modul
|
||||
}
|
||||
|
||||
func (mt *librarySdkMemberType) FinalizeModule(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember, bpModule android.BpModule) {
|
||||
bpModule.AddProperty("stl", "none")
|
||||
bpModule.AddProperty("system_shared_libs", []string{})
|
||||
ccModule := (member.Variants()[0]).(*Module)
|
||||
stl := ccModule.stl.Properties.Stl
|
||||
if stl != nil {
|
||||
bpModule.AddProperty("stl", proptools.String(stl))
|
||||
}
|
||||
}
|
||||
|
||||
func (mt *librarySdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
|
||||
@@ -193,6 +197,14 @@ func addPossiblyArchSpecificProperties(sdkModuleContext android.ModuleContext, b
|
||||
outputProperties.AddProperty("srcs", []string{nativeLibraryPath})
|
||||
}
|
||||
|
||||
if len(libInfo.SharedLibs) > 0 {
|
||||
outputProperties.AddPropertyWithTag("shared_libs", libInfo.SharedLibs, builder.SdkMemberReferencePropertyTag(false))
|
||||
}
|
||||
|
||||
if len(libInfo.SystemSharedLibs) > 0 {
|
||||
outputProperties.AddPropertyWithTag("system_shared_libs", libInfo.SystemSharedLibs, builder.SdkMemberReferencePropertyTag(false))
|
||||
}
|
||||
|
||||
// Map from property name to the include dirs to add to the prebuilt module in the snapshot.
|
||||
includeDirs := make(map[string][]string)
|
||||
|
||||
@@ -299,6 +311,16 @@ type nativeLibInfoProperties struct {
|
||||
// This field is exported as its contents may not be arch specific.
|
||||
ExportedFlags []string
|
||||
|
||||
// The set of shared libraries
|
||||
//
|
||||
// This field is exported as its contents may not be arch specific.
|
||||
SharedLibs []string
|
||||
|
||||
// The set of system shared libraries
|
||||
//
|
||||
// This field is exported as its contents may not be arch specific.
|
||||
SystemSharedLibs []string
|
||||
|
||||
// outputFile is not exported as it is always arch specific.
|
||||
outputFile android.Path
|
||||
}
|
||||
@@ -323,6 +345,13 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(variant android.SdkAware)
|
||||
p.exportedGeneratedIncludeDirs = exportedGeneratedIncludeDirs
|
||||
p.ExportedSystemIncludeDirs = ccModule.ExportedSystemIncludeDirs()
|
||||
p.ExportedFlags = ccModule.ExportedFlags()
|
||||
if ccModule.linker != nil {
|
||||
specifiedDeps := specifiedDeps{}
|
||||
specifiedDeps = ccModule.linker.linkerSpecifiedDeps(specifiedDeps)
|
||||
|
||||
p.SharedLibs = specifiedDeps.sharedLibs
|
||||
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
|
||||
}
|
||||
p.exportedGeneratedHeaders = ccModule.ExportedGeneratedHeaders()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user