Merge "native shared libs in an SDK can be snapshotted"
This commit is contained in:
33
cc/cc.go
33
cc/cc.go
@@ -853,6 +853,27 @@ func (c *Module) nativeCoverage() bool {
|
||||
return c.linker != nil && c.linker.nativeCoverage()
|
||||
}
|
||||
|
||||
func (c *Module) ExportedIncludeDirs() android.Paths {
|
||||
if flagsProducer, ok := c.linker.(exportedFlagsProducer); ok {
|
||||
return flagsProducer.exportedDirs()
|
||||
}
|
||||
return []android.Path{}
|
||||
}
|
||||
|
||||
func (c *Module) ExportedSystemIncludeDirs() android.Paths {
|
||||
if flagsProducer, ok := c.linker.(exportedFlagsProducer); ok {
|
||||
return flagsProducer.exportedSystemDirs()
|
||||
}
|
||||
return []android.Path{}
|
||||
}
|
||||
|
||||
func (c *Module) ExportedFlags() []string {
|
||||
if flagsProducer, ok := c.linker.(exportedFlagsProducer); ok {
|
||||
return flagsProducer.exportedFlags()
|
||||
}
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func isBionic(name string) bool {
|
||||
switch name {
|
||||
case "libc", "libm", "libdl", "linker":
|
||||
@@ -1456,7 +1477,7 @@ func (c *Module) beginMutator(actx android.BottomUpMutatorContext) {
|
||||
}
|
||||
|
||||
// Split name#version into name and version
|
||||
func stubsLibNameAndVersion(name string) (string, string) {
|
||||
func StubsLibNameAndVersion(name string) (string, string) {
|
||||
if sharp := strings.LastIndex(name, "#"); sharp != -1 && sharp != len(name)-1 {
|
||||
version := name[sharp+1:]
|
||||
libname := name[:sharp]
|
||||
@@ -1503,7 +1524,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||
nonvariantLibs = []string{}
|
||||
for _, entry := range list {
|
||||
// strip #version suffix out
|
||||
name, _ := stubsLibNameAndVersion(entry)
|
||||
name, _ := StubsLibNameAndVersion(entry)
|
||||
if ctx.useSdk() && inList(name, ndkPrebuiltSharedLibraries) {
|
||||
if !inList(name, ndkMigratedLibs) {
|
||||
nonvariantLibs = append(nonvariantLibs, name+".ndk."+version)
|
||||
@@ -1609,7 +1630,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||
// If the version is not specified, add dependency to the latest stubs library.
|
||||
// The stubs library will be used when the depending module is built for APEX and
|
||||
// the dependent module is not in the same APEX.
|
||||
latestVersion := latestStubsVersionFor(actx.Config(), name)
|
||||
latestVersion := LatestStubsVersionFor(actx.Config(), name)
|
||||
if version == "" && latestVersion != "" && versionVariantAvail {
|
||||
actx.AddVariationDependencies([]blueprint.Variation{
|
||||
{Mutator: "link", Variation: "shared"},
|
||||
@@ -1632,7 +1653,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||
lib = impl
|
||||
}
|
||||
|
||||
name, version := stubsLibNameAndVersion(lib)
|
||||
name, version := StubsLibNameAndVersion(lib)
|
||||
sharedLibNames = append(sharedLibNames, name)
|
||||
|
||||
addSharedLibDependencies(depTag, name, version)
|
||||
@@ -2329,7 +2350,9 @@ func (c *Module) IsInstallableToApex() bool {
|
||||
if shared, ok := c.linker.(interface {
|
||||
shared() bool
|
||||
}); ok {
|
||||
return shared.shared()
|
||||
// Stub libs and prebuilt libs in a versioned SDK are not
|
||||
// installable to APEX even though they are shared libs.
|
||||
return shared.shared() && !c.IsStubs() && c.ContainingSdk().Unversioned()
|
||||
} else if _, ok := c.linker.(testPerSrc); ok {
|
||||
return true
|
||||
}
|
||||
|
@@ -158,6 +158,10 @@ type FlagExporterProperties struct {
|
||||
// listed in local_include_dirs.
|
||||
Export_include_dirs []string `android:"arch_variant"`
|
||||
|
||||
// list of directories that will be added to the system include path
|
||||
// using -isystem for this module and any module that links against this module.
|
||||
Export_system_include_dirs []string `android:"arch_variant"`
|
||||
|
||||
Target struct {
|
||||
Vendor struct {
|
||||
// list of exported include directories, like
|
||||
@@ -245,10 +249,13 @@ func (f *flagExporter) exportedIncludes(ctx ModuleContext) android.Paths {
|
||||
|
||||
func (f *flagExporter) exportIncludes(ctx ModuleContext) {
|
||||
f.dirs = append(f.dirs, f.exportedIncludes(ctx)...)
|
||||
f.systemDirs = append(f.systemDirs, android.PathsForModuleSrc(ctx, f.Properties.Export_system_include_dirs)...)
|
||||
}
|
||||
|
||||
func (f *flagExporter) exportIncludesAsSystem(ctx ModuleContext) {
|
||||
// all dirs are force exported as system
|
||||
f.systemDirs = append(f.systemDirs, f.exportedIncludes(ctx)...)
|
||||
f.systemDirs = append(f.systemDirs, android.PathsForModuleSrc(ctx, f.Properties.Export_system_include_dirs)...)
|
||||
}
|
||||
|
||||
func (f *flagExporter) reexportDirs(dirs ...android.Path) {
|
||||
@@ -1294,7 +1301,7 @@ func stubsVersionsFor(config android.Config) map[string][]string {
|
||||
|
||||
var stubsVersionsLock sync.Mutex
|
||||
|
||||
func latestStubsVersionFor(config android.Config, name string) string {
|
||||
func LatestStubsVersionFor(config android.Config, name string) string {
|
||||
versions, ok := stubsVersionsFor(config)[name]
|
||||
if ok && len(versions) > 0 {
|
||||
// the versions are alreay sorted in ascending order
|
||||
|
Reference in New Issue
Block a user