Export cc vendor functions for usage by rust.
This CL exports and refactors some cc vendor-snapshot related functions so they can be reused by rust modules to support vendor snapshotting. Bug: 184042776 Test: m nothing Change-Id: I12706e62ce0ac3b2b4298085fafc1d77b8e0a0c4
This commit is contained in:
187
cc/cc.go
187
cc/cc.go
@@ -1980,15 +1980,19 @@ func GetCrtVariations(ctx android.BottomUpMutatorContext,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) addSharedLibDependenciesWithVersions(ctx android.BottomUpMutatorContext,
|
func AddSharedLibDependenciesWithVersions(ctx android.BottomUpMutatorContext, mod LinkableInterface,
|
||||||
variations []blueprint.Variation, depTag libraryDependencyTag, name, version string, far bool) {
|
variations []blueprint.Variation, depTag blueprint.DependencyTag, name, version string, far bool) {
|
||||||
|
|
||||||
variations = append([]blueprint.Variation(nil), variations...)
|
variations = append([]blueprint.Variation(nil), variations...)
|
||||||
|
|
||||||
if version != "" && CanBeOrLinkAgainstVersionVariants(c) {
|
if version != "" && CanBeOrLinkAgainstVersionVariants(mod) {
|
||||||
// Version is explicitly specified. i.e. libFoo#30
|
// Version is explicitly specified. i.e. libFoo#30
|
||||||
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
|
variations = append(variations, blueprint.Variation{Mutator: "version", Variation: version})
|
||||||
depTag.explicitlyVersioned = true
|
if tag, ok := depTag.(libraryDependencyTag); ok {
|
||||||
|
tag.explicitlyVersioned = true
|
||||||
|
} else {
|
||||||
|
panic(fmt.Errorf("Unexpected dependency tag: %T", depTag))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if far {
|
if far {
|
||||||
@@ -1998,6 +2002,74 @@ func (c *Module) addSharedLibDependenciesWithVersions(ctx android.BottomUpMutato
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetSnapshot(c LinkableInterface, snapshotInfo **SnapshotInfo, actx android.BottomUpMutatorContext) SnapshotInfo {
|
||||||
|
// Only modules with BOARD_VNDK_VERSION uses snapshot. Others use the zero value of
|
||||||
|
// SnapshotInfo, which provides no mappings.
|
||||||
|
if *snapshotInfo == nil {
|
||||||
|
// Only retrieve the snapshot on demand in order to avoid circular dependencies
|
||||||
|
// between the modules in the snapshot and the snapshot itself.
|
||||||
|
var snapshotModule []blueprint.Module
|
||||||
|
if c.InVendor() && c.VndkVersion() == actx.DeviceConfig().VndkVersion() {
|
||||||
|
snapshotModule = actx.AddVariationDependencies(nil, nil, "vendor_snapshot")
|
||||||
|
} else if recoverySnapshotVersion := actx.DeviceConfig().RecoverySnapshotVersion(); recoverySnapshotVersion != "current" && recoverySnapshotVersion != "" && c.InRecovery() {
|
||||||
|
snapshotModule = actx.AddVariationDependencies(nil, nil, "recovery_snapshot")
|
||||||
|
}
|
||||||
|
if len(snapshotModule) > 0 {
|
||||||
|
snapshot := actx.OtherModuleProvider(snapshotModule[0], SnapshotInfoProvider).(SnapshotInfo)
|
||||||
|
*snapshotInfo = &snapshot
|
||||||
|
// republish the snapshot for use in later mutators on this module
|
||||||
|
actx.SetProvider(SnapshotInfoProvider, snapshot)
|
||||||
|
} else {
|
||||||
|
*snapshotInfo = &SnapshotInfo{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return **snapshotInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
func RewriteSnapshotLib(lib string, snapshotMap map[string]string) string {
|
||||||
|
if snapshot, ok := snapshotMap[lib]; ok {
|
||||||
|
return snapshot
|
||||||
|
}
|
||||||
|
|
||||||
|
return lib
|
||||||
|
}
|
||||||
|
|
||||||
|
// RewriteLibs takes a list of names of shared libraries and scans it for three types
|
||||||
|
// of names:
|
||||||
|
//
|
||||||
|
// 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 caller can then know to add the variantLibs dependencies differently from the
|
||||||
|
// nonvariantLibs
|
||||||
|
func RewriteLibs(c LinkableInterface, snapshotInfo **SnapshotInfo, actx android.BottomUpMutatorContext, config android.Config, list []string) (nonvariantLibs []string, variantLibs []string) {
|
||||||
|
variantLibs = []string{}
|
||||||
|
|
||||||
|
nonvariantLibs = []string{}
|
||||||
|
for _, entry := range list {
|
||||||
|
// strip #version suffix out
|
||||||
|
name, _ := StubsLibNameAndVersion(entry)
|
||||||
|
if c.InRecovery() {
|
||||||
|
nonvariantLibs = append(nonvariantLibs, RewriteSnapshotLib(entry, GetSnapshot(c, snapshotInfo, actx).SharedLibs))
|
||||||
|
} else if c.UseSdk() && inList(name, *getNDKKnownLibs(config)) {
|
||||||
|
variantLibs = append(variantLibs, name+ndkLibrarySuffix)
|
||||||
|
} else if c.UseVndk() {
|
||||||
|
nonvariantLibs = append(nonvariantLibs, RewriteSnapshotLib(entry, GetSnapshot(c, snapshotInfo, actx).SharedLibs))
|
||||||
|
} else {
|
||||||
|
// put name#version back
|
||||||
|
nonvariantLibs = append(nonvariantLibs, entry)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nonvariantLibs, variantLibs
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||||
if !c.Enabled() {
|
if !c.Enabled() {
|
||||||
return
|
return
|
||||||
@@ -2016,83 +2088,16 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
c.Properties.AndroidMkSystemSharedLibs = deps.SystemSharedLibs
|
c.Properties.AndroidMkSystemSharedLibs = deps.SystemSharedLibs
|
||||||
|
|
||||||
var snapshotInfo *SnapshotInfo
|
var snapshotInfo *SnapshotInfo
|
||||||
getSnapshot := func() SnapshotInfo {
|
|
||||||
// Only modules with BOARD_VNDK_VERSION uses snapshot. Others use the zero value of
|
|
||||||
// SnapshotInfo, which provides no mappings.
|
|
||||||
if snapshotInfo == nil {
|
|
||||||
// Only retrieve the snapshot on demand in order to avoid circular dependencies
|
|
||||||
// between the modules in the snapshot and the snapshot itself.
|
|
||||||
var snapshotModule []blueprint.Module
|
|
||||||
if c.InVendor() && c.VndkVersion() == actx.DeviceConfig().VndkVersion() {
|
|
||||||
snapshotModule = ctx.AddVariationDependencies(nil, nil, "vendor_snapshot")
|
|
||||||
} else if recoverySnapshotVersion := actx.DeviceConfig().RecoverySnapshotVersion(); recoverySnapshotVersion != "current" && recoverySnapshotVersion != "" && c.InRecovery() {
|
|
||||||
snapshotModule = ctx.AddVariationDependencies(nil, nil, "recovery_snapshot")
|
|
||||||
}
|
|
||||||
if len(snapshotModule) > 0 {
|
|
||||||
snapshot := ctx.OtherModuleProvider(snapshotModule[0], SnapshotInfoProvider).(SnapshotInfo)
|
|
||||||
snapshotInfo = &snapshot
|
|
||||||
// republish the snapshot for use in later mutators on this module
|
|
||||||
ctx.SetProvider(SnapshotInfoProvider, snapshot)
|
|
||||||
} else {
|
|
||||||
snapshotInfo = &SnapshotInfo{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return *snapshotInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
rewriteSnapshotLib := func(lib string, snapshotMap map[string]string) string {
|
|
||||||
if snapshot, ok := snapshotMap[lib]; ok {
|
|
||||||
return snapshot
|
|
||||||
}
|
|
||||||
|
|
||||||
return lib
|
|
||||||
}
|
|
||||||
|
|
||||||
variantNdkLibs := []string{}
|
variantNdkLibs := []string{}
|
||||||
variantLateNdkLibs := []string{}
|
variantLateNdkLibs := []string{}
|
||||||
if ctx.Os() == android.Android {
|
if ctx.Os() == android.Android {
|
||||||
// rewriteLibs takes a list of names of shared libraries and scans it for three types
|
deps.SharedLibs, variantNdkLibs = RewriteLibs(c, &snapshotInfo, actx, ctx.Config(), deps.SharedLibs)
|
||||||
// of names:
|
deps.LateSharedLibs, variantLateNdkLibs = RewriteLibs(c, &snapshotInfo, actx, ctx.Config(), deps.LateSharedLibs)
|
||||||
//
|
deps.ReexportSharedLibHeaders, _ = RewriteLibs(c, &snapshotInfo, actx, ctx.Config(), deps.ReexportSharedLibHeaders)
|
||||||
// 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 caller can then know to add the variantLibs dependencies differently from the
|
|
||||||
// nonvariantLibs
|
|
||||||
|
|
||||||
rewriteLibs := func(list []string) (nonvariantLibs []string, variantLibs []string) {
|
|
||||||
variantLibs = []string{}
|
|
||||||
nonvariantLibs = []string{}
|
|
||||||
for _, entry := range list {
|
|
||||||
// strip #version suffix out
|
|
||||||
name, _ := StubsLibNameAndVersion(entry)
|
|
||||||
if c.InRecovery() {
|
|
||||||
nonvariantLibs = append(nonvariantLibs, rewriteSnapshotLib(entry, getSnapshot().SharedLibs))
|
|
||||||
} else if ctx.useSdk() && inList(name, *getNDKKnownLibs(ctx.Config())) {
|
|
||||||
variantLibs = append(variantLibs, name+ndkLibrarySuffix)
|
|
||||||
} else if ctx.useVndk() {
|
|
||||||
nonvariantLibs = append(nonvariantLibs, rewriteSnapshotLib(entry, getSnapshot().SharedLibs))
|
|
||||||
} else {
|
|
||||||
// put name#version back
|
|
||||||
nonvariantLibs = append(nonvariantLibs, entry)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nonvariantLibs, variantLibs
|
|
||||||
}
|
|
||||||
|
|
||||||
deps.SharedLibs, variantNdkLibs = rewriteLibs(deps.SharedLibs)
|
|
||||||
deps.LateSharedLibs, variantLateNdkLibs = rewriteLibs(deps.LateSharedLibs)
|
|
||||||
deps.ReexportSharedLibHeaders, _ = rewriteLibs(deps.ReexportSharedLibHeaders)
|
|
||||||
|
|
||||||
for idx, lib := range deps.RuntimeLibs {
|
for idx, lib := range deps.RuntimeLibs {
|
||||||
deps.RuntimeLibs[idx] = rewriteSnapshotLib(lib, getSnapshot().SharedLibs)
|
deps.RuntimeLibs[idx] = RewriteSnapshotLib(lib, GetSnapshot(c, &snapshotInfo, actx).SharedLibs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2102,7 +2107,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
depTag.reexportFlags = true
|
depTag.reexportFlags = true
|
||||||
}
|
}
|
||||||
|
|
||||||
lib = rewriteSnapshotLib(lib, getSnapshot().HeaderLibs)
|
lib = RewriteSnapshotLib(lib, GetSnapshot(c, &snapshotInfo, actx).HeaderLibs)
|
||||||
|
|
||||||
if c.IsStubs() {
|
if c.IsStubs() {
|
||||||
actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation()),
|
actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation()),
|
||||||
@@ -2125,7 +2130,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
lib = impl
|
lib = impl
|
||||||
}
|
}
|
||||||
|
|
||||||
lib = rewriteSnapshotLib(lib, getSnapshot().StaticLibs)
|
lib = RewriteSnapshotLib(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs)
|
||||||
|
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
{Mutator: "link", Variation: "static"},
|
{Mutator: "link", Variation: "static"},
|
||||||
@@ -2145,7 +2150,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
lib = impl
|
lib = impl
|
||||||
}
|
}
|
||||||
|
|
||||||
lib = rewriteSnapshotLib(lib, getSnapshot().StaticLibs)
|
lib = RewriteSnapshotLib(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs)
|
||||||
|
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
{Mutator: "link", Variation: "static"},
|
{Mutator: "link", Variation: "static"},
|
||||||
@@ -2159,14 +2164,14 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
depTag := libraryDependencyTag{Kind: staticLibraryDependency, staticUnwinder: true}
|
depTag := libraryDependencyTag{Kind: staticLibraryDependency, staticUnwinder: true}
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
{Mutator: "link", Variation: "static"},
|
{Mutator: "link", Variation: "static"},
|
||||||
}, depTag, rewriteSnapshotLib(staticUnwinder(actx), getSnapshot().StaticLibs))
|
}, depTag, RewriteSnapshotLib(staticUnwinder(actx), GetSnapshot(c, &snapshotInfo, actx).StaticLibs))
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, lib := range deps.LateStaticLibs {
|
for _, lib := range deps.LateStaticLibs {
|
||||||
depTag := libraryDependencyTag{Kind: staticLibraryDependency, Order: lateLibraryDependency}
|
depTag := libraryDependencyTag{Kind: staticLibraryDependency, Order: lateLibraryDependency}
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
{Mutator: "link", Variation: "static"},
|
{Mutator: "link", Variation: "static"},
|
||||||
}, depTag, rewriteSnapshotLib(lib, getSnapshot().StaticLibs))
|
}, depTag, RewriteSnapshotLib(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// shared lib names without the #version suffix
|
// shared lib names without the #version suffix
|
||||||
@@ -2191,7 +2196,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
variations := []blueprint.Variation{
|
variations := []blueprint.Variation{
|
||||||
{Mutator: "link", Variation: "shared"},
|
{Mutator: "link", Variation: "shared"},
|
||||||
}
|
}
|
||||||
c.addSharedLibDependenciesWithVersions(ctx, variations, depTag, name, version, false)
|
AddSharedLibDependenciesWithVersions(ctx, c, variations, depTag, name, version, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, lib := range deps.LateSharedLibs {
|
for _, lib := range deps.LateSharedLibs {
|
||||||
@@ -2205,7 +2210,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
variations := []blueprint.Variation{
|
variations := []blueprint.Variation{
|
||||||
{Mutator: "link", Variation: "shared"},
|
{Mutator: "link", Variation: "shared"},
|
||||||
}
|
}
|
||||||
c.addSharedLibDependenciesWithVersions(ctx, variations, depTag, lib, "", false)
|
AddSharedLibDependenciesWithVersions(ctx, c, variations, depTag, lib, "", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
actx.AddVariationDependencies([]blueprint.Variation{
|
actx.AddVariationDependencies([]blueprint.Variation{
|
||||||
@@ -2230,11 +2235,11 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
|||||||
actx.AddVariationDependencies(crtVariations, objDepTag, deps.ObjFiles...)
|
actx.AddVariationDependencies(crtVariations, objDepTag, deps.ObjFiles...)
|
||||||
if deps.CrtBegin != "" {
|
if deps.CrtBegin != "" {
|
||||||
actx.AddVariationDependencies(crtVariations, CrtBeginDepTag,
|
actx.AddVariationDependencies(crtVariations, CrtBeginDepTag,
|
||||||
rewriteSnapshotLib(deps.CrtBegin, getSnapshot().Objects))
|
RewriteSnapshotLib(deps.CrtBegin, GetSnapshot(c, &snapshotInfo, actx).Objects))
|
||||||
}
|
}
|
||||||
if deps.CrtEnd != "" {
|
if deps.CrtEnd != "" {
|
||||||
actx.AddVariationDependencies(crtVariations, CrtEndDepTag,
|
actx.AddVariationDependencies(crtVariations, CrtEndDepTag,
|
||||||
rewriteSnapshotLib(deps.CrtEnd, getSnapshot().Objects))
|
RewriteSnapshotLib(deps.CrtEnd, GetSnapshot(c, &snapshotInfo, actx).Objects))
|
||||||
}
|
}
|
||||||
if deps.LinkerFlagsFile != "" {
|
if deps.LinkerFlagsFile != "" {
|
||||||
actx.AddDependency(c, linkerFlagsDepTag, deps.LinkerFlagsFile)
|
actx.AddDependency(c, linkerFlagsDepTag, deps.LinkerFlagsFile)
|
||||||
@@ -2837,8 +2842,8 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
// they merely serve as Make dependencies and do not affect this lib itself.
|
// they merely serve as Make dependencies and do not affect this lib itself.
|
||||||
c.Properties.AndroidMkSharedLibs = append(
|
c.Properties.AndroidMkSharedLibs = append(
|
||||||
c.Properties.AndroidMkSharedLibs, makeLibName)
|
c.Properties.AndroidMkSharedLibs, makeLibName)
|
||||||
// Record baseLibName for snapshots.
|
// Record BaseLibName for snapshots.
|
||||||
c.Properties.SnapshotSharedLibs = append(c.Properties.SnapshotSharedLibs, baseLibName(depName))
|
c.Properties.SnapshotSharedLibs = append(c.Properties.SnapshotSharedLibs, BaseLibName(depName))
|
||||||
case libDepTag.static():
|
case libDepTag.static():
|
||||||
if libDepTag.wholeStatic {
|
if libDepTag.wholeStatic {
|
||||||
c.Properties.AndroidMkWholeStaticLibs = append(
|
c.Properties.AndroidMkWholeStaticLibs = append(
|
||||||
@@ -2855,8 +2860,8 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
case runtimeDepTag:
|
case runtimeDepTag:
|
||||||
c.Properties.AndroidMkRuntimeLibs = append(
|
c.Properties.AndroidMkRuntimeLibs = append(
|
||||||
c.Properties.AndroidMkRuntimeLibs, MakeLibName(ctx, c, ccDep, depName)+libDepTag.makeSuffix)
|
c.Properties.AndroidMkRuntimeLibs, MakeLibName(ctx, c, ccDep, depName)+libDepTag.makeSuffix)
|
||||||
// Record baseLibName for snapshots.
|
// Record BaseLibName for snapshots.
|
||||||
c.Properties.SnapshotRuntimeLibs = append(c.Properties.SnapshotRuntimeLibs, baseLibName(depName))
|
c.Properties.SnapshotRuntimeLibs = append(c.Properties.SnapshotRuntimeLibs, BaseLibName(depName))
|
||||||
case objDepTag:
|
case objDepTag:
|
||||||
depPaths.Objs.objFiles = append(depPaths.Objs.objFiles, linkFile.Path())
|
depPaths.Objs.objFiles = append(depPaths.Objs.objFiles, linkFile.Path())
|
||||||
case CrtBeginDepTag:
|
case CrtBeginDepTag:
|
||||||
@@ -2924,8 +2929,8 @@ func orderStaticModuleDeps(staticDeps []StaticLibraryInfo, sharedDeps []SharedLi
|
|||||||
return orderedStaticPaths, transitiveStaticLibs
|
return orderedStaticPaths, transitiveStaticLibs
|
||||||
}
|
}
|
||||||
|
|
||||||
// baseLibName trims known prefixes and suffixes
|
// BaseLibName trims known prefixes and suffixes
|
||||||
func baseLibName(depName string) string {
|
func BaseLibName(depName string) string {
|
||||||
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
|
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
|
||||||
libName = strings.TrimSuffix(libName, vendorPublicLibrarySuffix)
|
libName = strings.TrimSuffix(libName, vendorPublicLibrarySuffix)
|
||||||
libName = android.RemoveOptionalPrebuiltPrefix(libName)
|
libName = android.RemoveOptionalPrebuiltPrefix(libName)
|
||||||
@@ -2933,7 +2938,7 @@ func baseLibName(depName string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func MakeLibName(ctx android.ModuleContext, c LinkableInterface, ccDep LinkableInterface, depName string) string {
|
func MakeLibName(ctx android.ModuleContext, c LinkableInterface, ccDep LinkableInterface, depName string) string {
|
||||||
libName := baseLibName(depName)
|
libName := BaseLibName(depName)
|
||||||
ccDepModule, _ := ccDep.(*Module)
|
ccDepModule, _ := ccDep.(*Module)
|
||||||
isLLndk := ccDepModule != nil && ccDepModule.IsLlndk()
|
isLLndk := ccDepModule != nil && ccDepModule.IsLlndk()
|
||||||
nonSystemVariantsExist := ccDep.HasNonSystemVariants() || isLLndk
|
nonSystemVariantsExist := ccDep.HasNonSystemVariants() || isLLndk
|
||||||
|
@@ -396,50 +396,6 @@ func checkVndkModule(t *testing.T, ctx *android.TestContext, name, subDir string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkSnapshotIncludeExclude(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string, include bool, fake bool) {
|
|
||||||
t.Helper()
|
|
||||||
mod := ctx.ModuleForTests(moduleName, variant)
|
|
||||||
outputFiles := mod.OutputFiles(t, "")
|
|
||||||
if len(outputFiles) != 1 {
|
|
||||||
t.Errorf("%q must have single output\n", moduleName)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
snapshotPath := filepath.Join(subDir, snapshotFilename)
|
|
||||||
|
|
||||||
if include {
|
|
||||||
out := singleton.Output(snapshotPath)
|
|
||||||
if fake {
|
|
||||||
if out.Rule == nil {
|
|
||||||
t.Errorf("Missing rule for module %q output file %q", moduleName, outputFiles[0])
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if out.Input.String() != outputFiles[0].String() {
|
|
||||||
t.Errorf("The input of snapshot %q must be %q, but %q", moduleName, out.Input.String(), outputFiles[0])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out := singleton.MaybeOutput(snapshotPath)
|
|
||||||
if out.Rule != nil {
|
|
||||||
t.Errorf("There must be no rule for module %q output file %q", moduleName, outputFiles[0])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkSnapshot(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string) {
|
|
||||||
t.Helper()
|
|
||||||
checkSnapshotIncludeExclude(t, ctx, singleton, moduleName, snapshotFilename, subDir, variant, true, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkSnapshotExclude(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string) {
|
|
||||||
t.Helper()
|
|
||||||
checkSnapshotIncludeExclude(t, ctx, singleton, moduleName, snapshotFilename, subDir, variant, false, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkSnapshotRule(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string) {
|
|
||||||
t.Helper()
|
|
||||||
checkSnapshotIncludeExclude(t, ctx, singleton, moduleName, snapshotFilename, subDir, variant, true, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkWriteFileOutput(t *testing.T, params android.TestingBuildParams, expected []string) {
|
func checkWriteFileOutput(t *testing.T, params android.TestingBuildParams, expected []string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
content := android.ContentFromFileRuleForTests(t, params)
|
content := android.ContentFromFileRuleForTests(t, params)
|
||||||
@@ -631,21 +587,21 @@ func TestVndk(t *testing.T) {
|
|||||||
|
|
||||||
snapshotSingleton := ctx.SingletonForTests("vndk-snapshot")
|
snapshotSingleton := ctx.SingletonForTests("vndk-snapshot")
|
||||||
|
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", vndkCoreLibPath, variant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", vndkCoreLibPath, variant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", vndkCoreLib2ndPath, variant2nd)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", vndkCoreLib2ndPath, variant2nd)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvndk_product", "libvndk_product.so", vndkCoreLibPath, variant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvndk_product", "libvndk_product.so", vndkCoreLibPath, variant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvndk_product", "libvndk_product.so", vndkCoreLib2ndPath, variant2nd)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvndk_product", "libvndk_product.so", vndkCoreLib2ndPath, variant2nd)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLibPath, variant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLibPath, variant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLib2ndPath, variant2nd)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvndk_sp", "libvndk_sp-x.so", vndkSpLib2ndPath, variant2nd)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libllndk", "libllndk.so", llndkLibPath, variant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libllndk", "libllndk.so", llndkLibPath, variant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libllndk", "libllndk.so", llndkLib2ndPath, variant2nd)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libllndk", "libllndk.so", llndkLib2ndPath, variant2nd)
|
||||||
|
|
||||||
snapshotConfigsPath := filepath.Join(snapshotVariantPath, "configs")
|
snapshotConfigsPath := filepath.Join(snapshotVariantPath, "configs")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "llndk.libraries.txt", "llndk.libraries.txt", snapshotConfigsPath, "")
|
CheckSnapshot(t, ctx, snapshotSingleton, "llndk.libraries.txt", "llndk.libraries.txt", snapshotConfigsPath, "")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "vndkcore.libraries.txt", "vndkcore.libraries.txt", snapshotConfigsPath, "")
|
CheckSnapshot(t, ctx, snapshotSingleton, "vndkcore.libraries.txt", "vndkcore.libraries.txt", snapshotConfigsPath, "")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "vndksp.libraries.txt", "vndksp.libraries.txt", snapshotConfigsPath, "")
|
CheckSnapshot(t, ctx, snapshotSingleton, "vndksp.libraries.txt", "vndksp.libraries.txt", snapshotConfigsPath, "")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "vndkprivate.libraries.txt", "vndkprivate.libraries.txt", snapshotConfigsPath, "")
|
CheckSnapshot(t, ctx, snapshotSingleton, "vndkprivate.libraries.txt", "vndkprivate.libraries.txt", snapshotConfigsPath, "")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "vndkproduct.libraries.txt", "vndkproduct.libraries.txt", snapshotConfigsPath, "")
|
CheckSnapshot(t, ctx, snapshotSingleton, "vndkproduct.libraries.txt", "vndkproduct.libraries.txt", snapshotConfigsPath, "")
|
||||||
|
|
||||||
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
|
||||||
"LLNDK: libc.so",
|
"LLNDK: libc.so",
|
||||||
@@ -2643,15 +2599,6 @@ func parseModuleDeps(text string) (modulesInOrder []android.Path, allDeps map[an
|
|||||||
return modulesInOrder, allDeps
|
return modulesInOrder, allDeps
|
||||||
}
|
}
|
||||||
|
|
||||||
func getOutputPaths(ctx *android.TestContext, variant string, moduleNames []string) (paths android.Paths) {
|
|
||||||
for _, moduleName := range moduleNames {
|
|
||||||
module := ctx.ModuleForTests(moduleName, variant).Module().(*Module)
|
|
||||||
output := module.outputFile.Path().RelativeToTop()
|
|
||||||
paths = append(paths, output)
|
|
||||||
}
|
|
||||||
return paths
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestStaticLibDepReordering(t *testing.T) {
|
func TestStaticLibDepReordering(t *testing.T) {
|
||||||
ctx := testCc(t, `
|
ctx := testCc(t, `
|
||||||
cc_library {
|
cc_library {
|
||||||
@@ -2679,7 +2626,7 @@ func TestStaticLibDepReordering(t *testing.T) {
|
|||||||
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
||||||
actual := ctx.ModuleProvider(moduleA, StaticLibraryInfoProvider).(StaticLibraryInfo).
|
actual := ctx.ModuleProvider(moduleA, StaticLibraryInfoProvider).(StaticLibraryInfo).
|
||||||
TransitiveStaticLibrariesForOrdering.ToList().RelativeToTop()
|
TransitiveStaticLibrariesForOrdering.ToList().RelativeToTop()
|
||||||
expected := getOutputPaths(ctx, variant, []string{"a", "c", "b", "d"})
|
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b", "d"})
|
||||||
|
|
||||||
if !reflect.DeepEqual(actual, expected) {
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
t.Errorf("staticDeps orderings were not propagated correctly"+
|
t.Errorf("staticDeps orderings were not propagated correctly"+
|
||||||
@@ -2714,7 +2661,7 @@ func TestStaticLibDepReorderingWithShared(t *testing.T) {
|
|||||||
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
|
||||||
actual := ctx.ModuleProvider(moduleA, StaticLibraryInfoProvider).(StaticLibraryInfo).
|
actual := ctx.ModuleProvider(moduleA, StaticLibraryInfoProvider).(StaticLibraryInfo).
|
||||||
TransitiveStaticLibrariesForOrdering.ToList().RelativeToTop()
|
TransitiveStaticLibrariesForOrdering.ToList().RelativeToTop()
|
||||||
expected := getOutputPaths(ctx, variant, []string{"a", "c", "b"})
|
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b"})
|
||||||
|
|
||||||
if !reflect.DeepEqual(actual, expected) {
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
t.Errorf("staticDeps orderings did not account for shared libs"+
|
t.Errorf("staticDeps orderings did not account for shared libs"+
|
||||||
@@ -3357,7 +3304,7 @@ func TestStaticDepsOrderWithStubs(t *testing.T) {
|
|||||||
|
|
||||||
mybin := ctx.ModuleForTests("mybin", "android_arm64_armv8-a").Rule("ld")
|
mybin := ctx.ModuleForTests("mybin", "android_arm64_armv8-a").Rule("ld")
|
||||||
actual := mybin.Implicits[:2]
|
actual := mybin.Implicits[:2]
|
||||||
expected := getOutputPaths(ctx, "android_arm64_armv8-a_static", []string{"libfooB", "libfooC"})
|
expected := GetOutputPaths(ctx, "android_arm64_armv8-a_static", []string{"libfooB", "libfooC"})
|
||||||
|
|
||||||
if !reflect.DeepEqual(actual, expected) {
|
if !reflect.DeepEqual(actual, expected) {
|
||||||
t.Errorf("staticDeps orderings were not propagated correctly"+
|
t.Errorf("staticDeps orderings were not propagated correctly"+
|
||||||
|
@@ -103,7 +103,7 @@ func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleCont
|
|||||||
// If not, we assume modules under proprietary paths are compatible for
|
// If not, we assume modules under proprietary paths are compatible for
|
||||||
// BOARD_VNDK_VERSION. The other modules are regarded as AOSP, that is
|
// BOARD_VNDK_VERSION. The other modules are regarded as AOSP, that is
|
||||||
// PLATFORM_VNDK_VERSION.
|
// PLATFORM_VNDK_VERSION.
|
||||||
if vndkVersion == "current" || !isVendorProprietaryModule(ctx) {
|
if vndkVersion == "current" || !IsVendorProprietaryModule(ctx) {
|
||||||
variants = append(variants, VendorVariationPrefix+ctx.DeviceConfig().PlatformVndkVersion())
|
variants = append(variants, VendorVariationPrefix+ctx.DeviceConfig().PlatformVndkVersion())
|
||||||
} else {
|
} else {
|
||||||
variants = append(variants, VendorVariationPrefix+vndkVersion)
|
variants = append(variants, VendorVariationPrefix+vndkVersion)
|
||||||
|
@@ -496,7 +496,7 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
|||||||
// BOARD_VNDK_VERSION. The other modules are regarded as AOSP, or
|
// BOARD_VNDK_VERSION. The other modules are regarded as AOSP, or
|
||||||
// PLATFORM_VNDK_VERSION.
|
// PLATFORM_VNDK_VERSION.
|
||||||
if m.HasVendorVariant() {
|
if m.HasVendorVariant() {
|
||||||
if isVendorProprietaryModule(mctx) {
|
if IsVendorProprietaryModule(mctx) {
|
||||||
vendorVariants = append(vendorVariants, boardVndkVersion)
|
vendorVariants = append(vendorVariants, boardVndkVersion)
|
||||||
} else {
|
} else {
|
||||||
vendorVariants = append(vendorVariants, platformVndkVersion)
|
vendorVariants = append(vendorVariants, platformVndkVersion)
|
||||||
@@ -525,7 +525,7 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
|
|||||||
platformVndkVersion,
|
platformVndkVersion,
|
||||||
boardVndkVersion,
|
boardVndkVersion,
|
||||||
)
|
)
|
||||||
} else if isVendorProprietaryModule(mctx) {
|
} else if IsVendorProprietaryModule(mctx) {
|
||||||
vendorVariants = append(vendorVariants, boardVndkVersion)
|
vendorVariants = append(vendorVariants, boardVndkVersion)
|
||||||
} else {
|
} else {
|
||||||
vendorVariants = append(vendorVariants, platformVndkVersion)
|
vendorVariants = append(vendorVariants, platformVndkVersion)
|
||||||
|
@@ -606,20 +606,14 @@ func (handler *staticLibraryBazelHandler) generateBazelBuildActions(ctx android.
|
|||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// collectHeadersForSnapshot collects all exported headers from library.
|
func GlobHeadersForSnapshot(ctx android.ModuleContext, paths android.Paths) android.Paths {
|
||||||
// It globs header files in the source tree for exported include directories,
|
|
||||||
// and tracks generated header files separately.
|
|
||||||
//
|
|
||||||
// This is to be called from GenerateAndroidBuildActions, and then collected
|
|
||||||
// header files can be retrieved by snapshotHeaders().
|
|
||||||
func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext) {
|
|
||||||
ret := android.Paths{}
|
ret := android.Paths{}
|
||||||
|
|
||||||
// Headers in the source tree should be globbed. On the contrast, generated headers
|
// Headers in the source tree should be globbed. On the contrast, generated headers
|
||||||
// can't be globbed, and they should be manually collected.
|
// can't be globbed, and they should be manually collected.
|
||||||
// So, we first filter out intermediate directories (which contains generated headers)
|
// So, we first filter out intermediate directories (which contains generated headers)
|
||||||
// from exported directories, and then glob headers under remaining directories.
|
// from exported directories, and then glob headers under remaining directories.
|
||||||
for _, path := range append(android.CopyOfPaths(l.flagExporter.dirs), l.flagExporter.systemDirs...) {
|
for _, path := range paths {
|
||||||
dir := path.String()
|
dir := path.String()
|
||||||
// Skip if dir is for generated headers
|
// Skip if dir is for generated headers
|
||||||
if strings.HasPrefix(dir, android.PathForOutput(ctx).String()) {
|
if strings.HasPrefix(dir, android.PathForOutput(ctx).String()) {
|
||||||
@@ -635,7 +629,7 @@ func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext)
|
|||||||
glob, err := ctx.GlobWithDeps("external/eigen/"+subdir+"/**/*", nil)
|
glob, err := ctx.GlobWithDeps("external/eigen/"+subdir+"/**/*", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ModuleErrorf("glob failed: %#v", err)
|
ctx.ModuleErrorf("glob failed: %#v", err)
|
||||||
return
|
return nil
|
||||||
}
|
}
|
||||||
for _, header := range glob {
|
for _, header := range glob {
|
||||||
if strings.HasSuffix(header, "/") {
|
if strings.HasSuffix(header, "/") {
|
||||||
@@ -653,7 +647,7 @@ func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext)
|
|||||||
glob, err := ctx.GlobWithDeps(dir+"/**/*", nil)
|
glob, err := ctx.GlobWithDeps(dir+"/**/*", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ModuleErrorf("glob failed: %#v", err)
|
ctx.ModuleErrorf("glob failed: %#v", err)
|
||||||
return
|
return nil
|
||||||
}
|
}
|
||||||
isLibcxx := strings.HasPrefix(dir, "external/libcxx/include")
|
isLibcxx := strings.HasPrefix(dir, "external/libcxx/include")
|
||||||
for _, header := range glob {
|
for _, header := range glob {
|
||||||
@@ -666,7 +660,7 @@ func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext)
|
|||||||
} else {
|
} else {
|
||||||
// Filter out only the files with extensions that are headers.
|
// Filter out only the files with extensions that are headers.
|
||||||
found := false
|
found := false
|
||||||
for _, ext := range headerExts {
|
for _, ext := range HeaderExts {
|
||||||
if strings.HasSuffix(header, ext) {
|
if strings.HasSuffix(header, ext) {
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
@@ -679,15 +673,38 @@ func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext)
|
|||||||
ret = append(ret, android.PathForSource(ctx, header))
|
ret = append(ret, android.PathForSource(ctx, header))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
// Collect generated headers
|
func GlobGeneratedHeadersForSnapshot(ctx android.ModuleContext, paths android.Paths) android.Paths {
|
||||||
for _, header := range append(android.CopyOfPaths(l.flagExporter.headers), l.flagExporter.deps...) {
|
ret := android.Paths{}
|
||||||
|
for _, header := range paths {
|
||||||
// TODO(b/148123511): remove exportedDeps after cleaning up genrule
|
// TODO(b/148123511): remove exportedDeps after cleaning up genrule
|
||||||
if strings.HasSuffix(header.Base(), "-phony") {
|
if strings.HasSuffix(header.Base(), "-phony") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ret = append(ret, header)
|
ret = append(ret, header)
|
||||||
}
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
// collectHeadersForSnapshot collects all exported headers from library.
|
||||||
|
// It globs header files in the source tree for exported include directories,
|
||||||
|
// and tracks generated header files separately.
|
||||||
|
//
|
||||||
|
// This is to be called from GenerateAndroidBuildActions, and then collected
|
||||||
|
// header files can be retrieved by snapshotHeaders().
|
||||||
|
func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext) {
|
||||||
|
ret := android.Paths{}
|
||||||
|
|
||||||
|
// Headers in the source tree should be globbed. On the contrast, generated headers
|
||||||
|
// can't be globbed, and they should be manually collected.
|
||||||
|
// So, we first filter out intermediate directories (which contains generated headers)
|
||||||
|
// from exported directories, and then glob headers under remaining directories.
|
||||||
|
ret = append(ret, GlobHeadersForSnapshot(ctx, append(android.CopyOfPaths(l.flagExporter.dirs), l.flagExporter.systemDirs...))...)
|
||||||
|
|
||||||
|
// Collect generated headers
|
||||||
|
ret = append(ret, GlobGeneratedHeadersForSnapshot(ctx, append(android.CopyOfPaths(l.flagExporter.headers), l.flagExporter.deps...))...)
|
||||||
|
|
||||||
l.collectedSnapshotHeaders = ret
|
l.collectedSnapshotHeaders = ret
|
||||||
}
|
}
|
||||||
|
@@ -854,7 +854,7 @@ func (m *Module) SanitizableDepTagChecker() SantizableDependencyTagChecker {
|
|||||||
// as vendor snapshot. Such modules must create both cfi and non-cfi variants,
|
// as vendor snapshot. Such modules must create both cfi and non-cfi variants,
|
||||||
// except for ones which explicitly disable cfi.
|
// except for ones which explicitly disable cfi.
|
||||||
func needsCfiForVendorSnapshot(mctx android.TopDownMutatorContext) bool {
|
func needsCfiForVendorSnapshot(mctx android.TopDownMutatorContext) bool {
|
||||||
if isVendorProprietaryModule(mctx) {
|
if IsVendorProprietaryModule(mctx) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1192,7 +1192,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
if c.Device() {
|
if c.Device() {
|
||||||
variations = append(variations, c.ImageVariation())
|
variations = append(variations, c.ImageVariation())
|
||||||
}
|
}
|
||||||
c.addSharedLibDependenciesWithVersions(mctx, variations, depTag, runtimeLibrary, "", true)
|
AddSharedLibDependenciesWithVersions(mctx, c, variations, depTag, runtimeLibrary, "", true)
|
||||||
}
|
}
|
||||||
// static lib does not have dependency to the runtime library. The
|
// static lib does not have dependency to the runtime library. The
|
||||||
// dependency will be added to the executables or shared libs using
|
// dependency will be added to the executables or shared libs using
|
||||||
|
@@ -108,7 +108,7 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (vendorSnapshotImage) init(ctx android.RegistrationContext) {
|
func (vendorSnapshotImage) Init(ctx android.RegistrationContext) {
|
||||||
ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton)
|
ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton)
|
||||||
ctx.RegisterModuleType("vendor_snapshot", vendorSnapshotFactory)
|
ctx.RegisterModuleType("vendor_snapshot", vendorSnapshotFactory)
|
||||||
ctx.RegisterModuleType("vendor_snapshot_shared", VendorSnapshotSharedFactory)
|
ctx.RegisterModuleType("vendor_snapshot_shared", VendorSnapshotSharedFactory)
|
||||||
@@ -254,11 +254,11 @@ func (recoverySnapshotImage) moduleNameSuffix() string {
|
|||||||
return recoverySuffix
|
return recoverySuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
var vendorSnapshotImageSingleton vendorSnapshotImage
|
var VendorSnapshotImageSingleton vendorSnapshotImage
|
||||||
var recoverySnapshotImageSingleton recoverySnapshotImage
|
var recoverySnapshotImageSingleton recoverySnapshotImage
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
vendorSnapshotImageSingleton.init(android.InitRegistrationContext)
|
VendorSnapshotImageSingleton.Init(android.InitRegistrationContext)
|
||||||
recoverySnapshotImageSingleton.init(android.InitRegistrationContext)
|
recoverySnapshotImageSingleton.init(android.InitRegistrationContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ var SnapshotInfoProvider = blueprint.NewMutatorProvider(SnapshotInfo{}, "deps")
|
|||||||
var _ android.ImageInterface = (*snapshot)(nil)
|
var _ android.ImageInterface = (*snapshot)(nil)
|
||||||
|
|
||||||
func vendorSnapshotFactory() android.Module {
|
func vendorSnapshotFactory() android.Module {
|
||||||
return snapshotFactory(vendorSnapshotImageSingleton)
|
return snapshotFactory(VendorSnapshotImageSingleton)
|
||||||
}
|
}
|
||||||
|
|
||||||
func recoverySnapshotFactory() android.Module {
|
func recoverySnapshotFactory() android.Module {
|
||||||
@@ -475,7 +475,7 @@ func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleCon
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
images := []snapshotImage{vendorSnapshotImageSingleton, recoverySnapshotImageSingleton}
|
images := []snapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton}
|
||||||
|
|
||||||
for _, image := range images {
|
for _, image := range images {
|
||||||
if p.image == image {
|
if p.image == image {
|
||||||
@@ -724,7 +724,7 @@ func snapshotLibraryFactory(image snapshotImage, moduleSuffix string) (*Module,
|
|||||||
// overrides the vendor variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
|
// overrides the vendor variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func VendorSnapshotSharedFactory() android.Module {
|
func VendorSnapshotSharedFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(vendorSnapshotImageSingleton, snapshotSharedSuffix)
|
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, snapshotSharedSuffix)
|
||||||
prebuilt.libraryDecorator.BuildOnlyShared()
|
prebuilt.libraryDecorator.BuildOnlyShared()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -744,7 +744,7 @@ func RecoverySnapshotSharedFactory() android.Module {
|
|||||||
// overrides the vendor variant of the cc static library with the same name, if BOARD_VNDK_VERSION
|
// overrides the vendor variant of the cc static library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func VendorSnapshotStaticFactory() android.Module {
|
func VendorSnapshotStaticFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(vendorSnapshotImageSingleton, snapshotStaticSuffix)
|
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, snapshotStaticSuffix)
|
||||||
prebuilt.libraryDecorator.BuildOnlyStatic()
|
prebuilt.libraryDecorator.BuildOnlyStatic()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -764,7 +764,7 @@ func RecoverySnapshotStaticFactory() android.Module {
|
|||||||
// overrides the vendor variant of the cc header library with the same name, if BOARD_VNDK_VERSION
|
// overrides the vendor variant of the cc header library with the same name, if BOARD_VNDK_VERSION
|
||||||
// is set.
|
// is set.
|
||||||
func VendorSnapshotHeaderFactory() android.Module {
|
func VendorSnapshotHeaderFactory() android.Module {
|
||||||
module, prebuilt := snapshotLibraryFactory(vendorSnapshotImageSingleton, snapshotHeaderSuffix)
|
module, prebuilt := snapshotLibraryFactory(VendorSnapshotImageSingleton, snapshotHeaderSuffix)
|
||||||
prebuilt.libraryDecorator.HeaderOnly()
|
prebuilt.libraryDecorator.HeaderOnly()
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
@@ -842,7 +842,7 @@ func (p *snapshotBinaryDecorator) nativeCoverage() bool {
|
|||||||
// development/vendor_snapshot/update.py. As a part of vendor snapshot, vendor_snapshot_binary
|
// development/vendor_snapshot/update.py. As a part of vendor snapshot, vendor_snapshot_binary
|
||||||
// overrides the vendor variant of the cc binary with the same name, if BOARD_VNDK_VERSION is set.
|
// overrides the vendor variant of the cc binary with the same name, if BOARD_VNDK_VERSION is set.
|
||||||
func VendorSnapshotBinaryFactory() android.Module {
|
func VendorSnapshotBinaryFactory() android.Module {
|
||||||
return snapshotBinaryFactory(vendorSnapshotImageSingleton, snapshotBinarySuffix)
|
return snapshotBinaryFactory(VendorSnapshotImageSingleton, snapshotBinarySuffix)
|
||||||
}
|
}
|
||||||
|
|
||||||
// recovery_snapshot_binary is a special prebuilt executable binary which is auto-generated by
|
// recovery_snapshot_binary is a special prebuilt executable binary which is auto-generated by
|
||||||
@@ -933,7 +933,7 @@ func VendorSnapshotObjectFactory() android.Module {
|
|||||||
}
|
}
|
||||||
module.linker = prebuilt
|
module.linker = prebuilt
|
||||||
|
|
||||||
prebuilt.init(module, vendorSnapshotImageSingleton, snapshotObjectSuffix)
|
prebuilt.init(module, VendorSnapshotImageSingleton, snapshotObjectSuffix)
|
||||||
module.AddProperties(&prebuilt.properties)
|
module.AddProperties(&prebuilt.properties)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
headerExts = []string{".h", ".hh", ".hpp", ".hxx", ".h++", ".inl", ".inc", ".ipp", ".h.generic"}
|
HeaderExts = []string{".h", ".hh", ".hpp", ".hxx", ".h++", ".inl", ".inc", ".ipp", ".h.generic"}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *Module) IsSnapshotLibrary() bool {
|
func (m *Module) IsSnapshotLibrary() bool {
|
||||||
@@ -109,7 +109,7 @@ func ShouldCollectHeadersForSnapshot(ctx android.ModuleContext, m LinkableInterf
|
|||||||
return ctx.Config().VndkSnapshotBuildArtifacts()
|
return ctx.Config().VndkSnapshotBuildArtifacts()
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, image := range []snapshotImage{vendorSnapshotImageSingleton, recoverySnapshotImageSingleton} {
|
for _, image := range []snapshotImage{VendorSnapshotImageSingleton, recoverySnapshotImageSingleton} {
|
||||||
if isSnapshotAware(ctx.DeviceConfig(), m, image.isProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()), apexInfo, image) {
|
if isSnapshotAware(ctx.DeviceConfig(), m, image.isProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()), apexInfo, image) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,9 @@
|
|||||||
package cc
|
package cc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"path/filepath"
|
||||||
|
"testing"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/genrule"
|
"android/soong/genrule"
|
||||||
)
|
)
|
||||||
@@ -625,7 +628,7 @@ var PrepareForTestOnFuchsia = android.GroupFixturePreparers(
|
|||||||
var PrepareForTestWithCcIncludeVndk = android.GroupFixturePreparers(
|
var PrepareForTestWithCcIncludeVndk = android.GroupFixturePreparers(
|
||||||
PrepareForIntegrationTestWithCc,
|
PrepareForIntegrationTestWithCc,
|
||||||
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
|
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
|
||||||
vendorSnapshotImageSingleton.init(ctx)
|
VendorSnapshotImageSingleton.Init(ctx)
|
||||||
recoverySnapshotImageSingleton.init(ctx)
|
recoverySnapshotImageSingleton.init(ctx)
|
||||||
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
|
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
|
||||||
}),
|
}),
|
||||||
@@ -674,7 +677,7 @@ func CreateTestContext(config android.Config) *android.TestContext {
|
|||||||
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
||||||
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
||||||
|
|
||||||
vendorSnapshotImageSingleton.init(ctx)
|
VendorSnapshotImageSingleton.Init(ctx)
|
||||||
recoverySnapshotImageSingleton.init(ctx)
|
recoverySnapshotImageSingleton.init(ctx)
|
||||||
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
|
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
|
||||||
RegisterVndkLibraryTxtTypes(ctx)
|
RegisterVndkLibraryTxtTypes(ctx)
|
||||||
@@ -685,3 +688,64 @@ func CreateTestContext(config android.Config) *android.TestContext {
|
|||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkSnapshotIncludeExclude(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string, include bool, fake bool) {
|
||||||
|
t.Helper()
|
||||||
|
mod := ctx.ModuleForTests(moduleName, variant)
|
||||||
|
outputFiles := mod.OutputFiles(t, "")
|
||||||
|
if len(outputFiles) != 1 {
|
||||||
|
t.Errorf("%q must have single output\n", moduleName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
snapshotPath := filepath.Join(subDir, snapshotFilename)
|
||||||
|
|
||||||
|
if include {
|
||||||
|
out := singleton.Output(snapshotPath)
|
||||||
|
if fake {
|
||||||
|
if out.Rule == nil {
|
||||||
|
t.Errorf("Missing rule for module %q output file %q", moduleName, outputFiles[0])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if out.Input.String() != outputFiles[0].String() {
|
||||||
|
t.Errorf("The input of snapshot %q must be %q, but %q", moduleName, out.Input.String(), outputFiles[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out := singleton.MaybeOutput(snapshotPath)
|
||||||
|
if out.Rule != nil {
|
||||||
|
t.Errorf("There must be no rule for module %q output file %q", moduleName, outputFiles[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func CheckSnapshot(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string) {
|
||||||
|
t.Helper()
|
||||||
|
checkSnapshotIncludeExclude(t, ctx, singleton, moduleName, snapshotFilename, subDir, variant, true, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func CheckSnapshotExclude(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string) {
|
||||||
|
t.Helper()
|
||||||
|
checkSnapshotIncludeExclude(t, ctx, singleton, moduleName, snapshotFilename, subDir, variant, false, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func CheckSnapshotRule(t *testing.T, ctx *android.TestContext, singleton android.TestingSingleton, moduleName, snapshotFilename, subDir, variant string) {
|
||||||
|
t.Helper()
|
||||||
|
checkSnapshotIncludeExclude(t, ctx, singleton, moduleName, snapshotFilename, subDir, variant, true, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func AssertExcludeFromVendorSnapshotIs(t *testing.T, ctx *android.TestContext, name string, expected bool, variant string) {
|
||||||
|
t.Helper()
|
||||||
|
m := ctx.ModuleForTests(name, variant).Module().(LinkableInterface)
|
||||||
|
if m.ExcludeFromVendorSnapshot() != expected {
|
||||||
|
t.Errorf("expected %q ExcludeFromVendorSnapshot to be %t", m.String(), expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetOutputPaths(ctx *android.TestContext, variant string, moduleNames []string) (paths android.Paths) {
|
||||||
|
for _, moduleName := range moduleNames {
|
||||||
|
module := ctx.ModuleForTests(moduleName, variant).Module().(*Module)
|
||||||
|
output := module.outputFile.Path().RelativeToTop()
|
||||||
|
paths = append(paths, output)
|
||||||
|
}
|
||||||
|
return paths
|
||||||
|
}
|
||||||
|
@@ -79,7 +79,7 @@ func TestVendorPublicLibraries(t *testing.T) {
|
|||||||
// test if libsystem is linked to the stub
|
// test if libsystem is linked to the stub
|
||||||
ld := ctx.ModuleForTests("libsystem", coreVariant).Rule("ld")
|
ld := ctx.ModuleForTests("libsystem", coreVariant).Rule("ld")
|
||||||
libflags := ld.Args["libFlags"]
|
libflags := ld.Args["libFlags"]
|
||||||
stubPaths := getOutputPaths(ctx, coreVariant, []string{"libvendorpublic"})
|
stubPaths := GetOutputPaths(ctx, coreVariant, []string{"libvendorpublic"})
|
||||||
if !strings.Contains(libflags, stubPaths[0].String()) {
|
if !strings.Contains(libflags, stubPaths[0].String()) {
|
||||||
t.Errorf("libflags for libsystem must contain %#v, but was %#v", stubPaths[0], libflags)
|
t.Errorf("libflags for libsystem must contain %#v, but was %#v", stubPaths[0], libflags)
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ func TestVendorPublicLibraries(t *testing.T) {
|
|||||||
// test if libsystem is linked to the stub
|
// test if libsystem is linked to the stub
|
||||||
ld = ctx.ModuleForTests("libproduct", productVariant).Rule("ld")
|
ld = ctx.ModuleForTests("libproduct", productVariant).Rule("ld")
|
||||||
libflags = ld.Args["libFlags"]
|
libflags = ld.Args["libFlags"]
|
||||||
stubPaths = getOutputPaths(ctx, productVariant, []string{"libvendorpublic"})
|
stubPaths = GetOutputPaths(ctx, productVariant, []string{"libvendorpublic"})
|
||||||
if !strings.Contains(libflags, stubPaths[0].String()) {
|
if !strings.Contains(libflags, stubPaths[0].String()) {
|
||||||
t.Errorf("libflags for libproduct must contain %#v, but was %#v", stubPaths[0], libflags)
|
t.Errorf("libflags for libproduct must contain %#v, but was %#v", stubPaths[0], libflags)
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,8 @@ func TestVendorPublicLibraries(t *testing.T) {
|
|||||||
// test if libvendor is linked to the real shared lib
|
// test if libvendor is linked to the real shared lib
|
||||||
ld = ctx.ModuleForTests("libvendor", vendorVariant).Rule("ld")
|
ld = ctx.ModuleForTests("libvendor", vendorVariant).Rule("ld")
|
||||||
libflags = ld.Args["libFlags"]
|
libflags = ld.Args["libFlags"]
|
||||||
stubPaths = getOutputPaths(ctx, vendorVariant, []string{"libvendorpublic"})
|
stubPaths = GetOutputPaths(ctx, vendorVariant, []string{"libvendorpublic"})
|
||||||
|
|
||||||
if !strings.Contains(libflags, stubPaths[0].String()) {
|
if !strings.Contains(libflags, stubPaths[0].String()) {
|
||||||
t.Errorf("libflags for libvendor must contain %#v, but was %#v", stubPaths[0], libflags)
|
t.Errorf("libflags for libvendor must contain %#v, but was %#v", stubPaths[0], libflags)
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ var vendorSnapshotSingleton = snapshotSingleton{
|
|||||||
"SOONG_VENDOR_SNAPSHOT_ZIP",
|
"SOONG_VENDOR_SNAPSHOT_ZIP",
|
||||||
android.OptionalPath{},
|
android.OptionalPath{},
|
||||||
true,
|
true,
|
||||||
vendorSnapshotImageSingleton,
|
VendorSnapshotImageSingleton,
|
||||||
false, /* fake */
|
false, /* fake */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ var vendorFakeSnapshotSingleton = snapshotSingleton{
|
|||||||
"SOONG_VENDOR_FAKE_SNAPSHOT_ZIP",
|
"SOONG_VENDOR_FAKE_SNAPSHOT_ZIP",
|
||||||
android.OptionalPath{},
|
android.OptionalPath{},
|
||||||
true,
|
true,
|
||||||
vendorSnapshotImageSingleton,
|
VendorSnapshotImageSingleton,
|
||||||
true, /* fake */
|
true, /* fake */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ func isRecoveryProprietaryPath(dir string, deviceConfig android.DeviceConfig) bo
|
|||||||
return RecoverySnapshotSingleton().(*snapshotSingleton).image.isProprietaryPath(dir, deviceConfig)
|
return RecoverySnapshotSingleton().(*snapshotSingleton).image.isProprietaryPath(dir, deviceConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isVendorProprietaryModule(ctx android.BaseModuleContext) bool {
|
func IsVendorProprietaryModule(ctx android.BaseModuleContext) bool {
|
||||||
// Any module in a vendor proprietary path is a vendor proprietary
|
// Any module in a vendor proprietary path is a vendor proprietary
|
||||||
// module.
|
// module.
|
||||||
if isVendorProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()) {
|
if isVendorProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()) {
|
||||||
|
@@ -108,27 +108,27 @@ func TestVendorSnapshotCapture(t *testing.T) {
|
|||||||
// For shared libraries, only non-VNDK vendor_available modules are captured
|
// For shared libraries, only non-VNDK vendor_available modules are captured
|
||||||
sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant)
|
sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant)
|
||||||
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant)
|
||||||
jsonFiles = append(jsonFiles,
|
jsonFiles = append(jsonFiles,
|
||||||
filepath.Join(sharedDir, "libvendor.so.json"),
|
filepath.Join(sharedDir, "libvendor.so.json"),
|
||||||
filepath.Join(sharedDir, "libvendor_available.so.json"))
|
filepath.Join(sharedDir, "libvendor_available.so.json"))
|
||||||
|
|
||||||
// LLNDK modules are not captured
|
// LLNDK modules are not captured
|
||||||
checkSnapshotExclude(t, ctx, snapshotSingleton, "libllndk", "libllndk.so", sharedDir, sharedVariant)
|
CheckSnapshotExclude(t, ctx, snapshotSingleton, "libllndk", "libllndk.so", sharedDir, sharedVariant)
|
||||||
|
|
||||||
// For static libraries, all vendor:true and vendor_available modules (including VNDK) are captured.
|
// For static libraries, all vendor:true and vendor_available modules (including VNDK) are captured.
|
||||||
// Also cfi variants are captured, except for prebuilts like toolchain_library
|
// Also cfi variants are captured, except for prebuilts like toolchain_library
|
||||||
staticVariant := fmt.Sprintf("android_vendor.29_%s_%s_static", archType, archVariant)
|
staticVariant := fmt.Sprintf("android_vendor.29_%s_%s_static", archType, archVariant)
|
||||||
staticCfiVariant := fmt.Sprintf("android_vendor.29_%s_%s_static_cfi", archType, archVariant)
|
staticCfiVariant := fmt.Sprintf("android_vendor.29_%s_%s_static_cfi", archType, archVariant)
|
||||||
staticDir := filepath.Join(snapshotVariantPath, archDir, "static")
|
staticDir := filepath.Join(snapshotVariantPath, archDir, "static")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libb", "libb.a", staticDir, staticVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libb", "libb.a", staticDir, staticVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.a", staticDir, staticVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.a", staticDir, staticVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.cfi.a", staticDir, staticCfiVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.cfi.a", staticDir, staticCfiVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.a", staticDir, staticVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.a", staticDir, staticVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.cfi.a", staticDir, staticCfiVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.cfi.a", staticDir, staticCfiVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.a", staticDir, staticVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.a", staticDir, staticVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.cfi.a", staticDir, staticCfiVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.cfi.a", staticDir, staticCfiVariant)
|
||||||
jsonFiles = append(jsonFiles,
|
jsonFiles = append(jsonFiles,
|
||||||
filepath.Join(staticDir, "libb.a.json"),
|
filepath.Join(staticDir, "libb.a.json"),
|
||||||
filepath.Join(staticDir, "libvndk.a.json"),
|
filepath.Join(staticDir, "libvndk.a.json"),
|
||||||
@@ -142,8 +142,8 @@ func TestVendorSnapshotCapture(t *testing.T) {
|
|||||||
if archType == "arm64" {
|
if archType == "arm64" {
|
||||||
binaryVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant)
|
binaryVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant)
|
||||||
binaryDir := filepath.Join(snapshotVariantPath, archDir, "binary")
|
binaryDir := filepath.Join(snapshotVariantPath, archDir, "binary")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "vendor_bin", "vendor_bin", binaryDir, binaryVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "vendor_bin", "vendor_bin", binaryDir, binaryVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "vendor_available_bin", "vendor_available_bin", binaryDir, binaryVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "vendor_available_bin", "vendor_available_bin", binaryDir, binaryVariant)
|
||||||
jsonFiles = append(jsonFiles,
|
jsonFiles = append(jsonFiles,
|
||||||
filepath.Join(binaryDir, "vendor_bin.json"),
|
filepath.Join(binaryDir, "vendor_bin.json"),
|
||||||
filepath.Join(binaryDir, "vendor_available_bin.json"))
|
filepath.Join(binaryDir, "vendor_available_bin.json"))
|
||||||
@@ -156,7 +156,7 @@ func TestVendorSnapshotCapture(t *testing.T) {
|
|||||||
// For object modules, all vendor:true and vendor_available modules are captured.
|
// For object modules, all vendor:true and vendor_available modules are captured.
|
||||||
objectVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant)
|
objectVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant)
|
||||||
objectDir := filepath.Join(snapshotVariantPath, archDir, "object")
|
objectDir := filepath.Join(snapshotVariantPath, archDir, "object")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "obj", "obj.o", objectDir, objectVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "obj", "obj.o", objectDir, objectVariant)
|
||||||
jsonFiles = append(jsonFiles, filepath.Join(objectDir, "obj.o.json"))
|
jsonFiles = append(jsonFiles, filepath.Join(objectDir, "obj.o.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,15 +239,15 @@ func TestVendorSnapshotDirected(t *testing.T) {
|
|||||||
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
||||||
|
|
||||||
// Included modules
|
// Included modules
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant)
|
||||||
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libvendor.so.json"))
|
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libvendor.so.json"))
|
||||||
// Check that snapshot captures "prefer: true" prebuilt
|
// Check that snapshot captures "prefer: true" prebuilt
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "prebuilt_libfoo", "libfoo.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "prebuilt_libfoo", "libfoo.so", sharedDir, sharedVariant)
|
||||||
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libfoo.so.json"))
|
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libfoo.so.json"))
|
||||||
|
|
||||||
// Excluded modules. Modules not included in the directed vendor snapshot
|
// Excluded modules. Modules not included in the directed vendor snapshot
|
||||||
// are still include as fake modules.
|
// are still include as fake modules.
|
||||||
checkSnapshotRule(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant)
|
CheckSnapshotRule(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant)
|
||||||
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libvendor_available.so.json"))
|
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libvendor_available.so.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,10 +839,11 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
[]string{staticVariant, "libvendor.vendor_static.31.arm64"},
|
[]string{staticVariant, "libvendor.vendor_static.31.arm64"},
|
||||||
[]string{staticVariant, "libvendor_without_snapshot"},
|
[]string{staticVariant, "libvendor_without_snapshot"},
|
||||||
} {
|
} {
|
||||||
outputPaths := getOutputPaths(ctx, input[0] /* variant */, []string{input[1]} /* module name */)
|
outputPaths := GetOutputPaths(ctx, input[0] /* variant */, []string{input[1]} /* module name */)
|
||||||
if !strings.Contains(libclientLdFlags, outputPaths[0].String()) {
|
if !strings.Contains(libclientLdFlags, outputPaths[0].String()) {
|
||||||
t.Errorf("libflags for libclient must contain %#v, but was %#v", outputPaths[0], libclientLdFlags)
|
t.Errorf("libflags for libclient must contain %#v, but was %#v", outputPaths[0], libclientLdFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
libclientAndroidMkSharedLibs := ctx.ModuleForTests("libclient", sharedVariant).Module().(*Module).Properties.AndroidMkSharedLibs
|
libclientAndroidMkSharedLibs := ctx.ModuleForTests("libclient", sharedVariant).Module().(*Module).Properties.AndroidMkSharedLibs
|
||||||
@@ -868,7 +869,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
libclientCfiLdFlags := ctx.ModuleForTests("libclient_cfi", sharedCfiVariant).Rule("ld").Args["libFlags"]
|
libclientCfiLdFlags := ctx.ModuleForTests("libclient_cfi", sharedCfiVariant).Rule("ld").Args["libFlags"]
|
||||||
libvendorCfiOutputPaths := getOutputPaths(ctx, staticCfiVariant, []string{"libvendor.vendor_static.31.arm64"})
|
libvendorCfiOutputPaths := GetOutputPaths(ctx, staticCfiVariant, []string{"libvendor.vendor_static.31.arm64"})
|
||||||
if !strings.Contains(libclientCfiLdFlags, libvendorCfiOutputPaths[0].String()) {
|
if !strings.Contains(libclientCfiLdFlags, libvendorCfiOutputPaths[0].String()) {
|
||||||
t.Errorf("libflags for libclientCfi must contain %#v, but was %#v", libvendorCfiOutputPaths[0], libclientCfiLdFlags)
|
t.Errorf("libflags for libclientCfi must contain %#v, but was %#v", libvendorCfiOutputPaths[0], libclientCfiLdFlags)
|
||||||
}
|
}
|
||||||
@@ -881,7 +882,7 @@ func TestVendorSnapshotUse(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
binWithoutSnapshotLdFlags := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("ld").Args["libFlags"]
|
binWithoutSnapshotLdFlags := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("ld").Args["libFlags"]
|
||||||
libVndkStaticOutputPaths := getOutputPaths(ctx, staticVariant, []string{"libvndk.vendor_static.31.arm64"})
|
libVndkStaticOutputPaths := GetOutputPaths(ctx, staticVariant, []string{"libvndk.vendor_static.31.arm64"})
|
||||||
if !strings.Contains(binWithoutSnapshotLdFlags, libVndkStaticOutputPaths[0].String()) {
|
if !strings.Contains(binWithoutSnapshotLdFlags, libVndkStaticOutputPaths[0].String()) {
|
||||||
t.Errorf("libflags for bin_without_snapshot must contain %#v, but was %#v",
|
t.Errorf("libflags for bin_without_snapshot must contain %#v, but was %#v",
|
||||||
libVndkStaticOutputPaths[0], binWithoutSnapshotLdFlags)
|
libVndkStaticOutputPaths[0], binWithoutSnapshotLdFlags)
|
||||||
@@ -1006,14 +1007,6 @@ func TestVendorSnapshotSanitizer(t *testing.T) {
|
|||||||
assertString(t, staticCfiModule.outputFile.Path().Base(), "libsnapshot.cfi.a")
|
assertString(t, staticCfiModule.outputFile.Path().Base(), "libsnapshot.cfi.a")
|
||||||
}
|
}
|
||||||
|
|
||||||
func assertExcludeFromVendorSnapshotIs(t *testing.T, ctx *android.TestContext, name string, expected bool) {
|
|
||||||
t.Helper()
|
|
||||||
m := ctx.ModuleForTests(name, vendorVariant).Module().(*Module)
|
|
||||||
if m.ExcludeFromVendorSnapshot() != expected {
|
|
||||||
t.Errorf("expected %q ExcludeFromVendorSnapshot to be %t", m.String(), expected)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func assertExcludeFromRecoverySnapshotIs(t *testing.T, ctx *android.TestContext, name string, expected bool) {
|
func assertExcludeFromRecoverySnapshotIs(t *testing.T, ctx *android.TestContext, name string, expected bool) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
m := ctx.ModuleForTests(name, recoveryVariant).Module().(*Module)
|
m := ctx.ModuleForTests(name, recoveryVariant).Module().(*Module)
|
||||||
@@ -1081,13 +1074,13 @@ func TestVendorSnapshotExclude(t *testing.T) {
|
|||||||
android.FailIfErrored(t, errs)
|
android.FailIfErrored(t, errs)
|
||||||
|
|
||||||
// Test an include and exclude framework module.
|
// Test an include and exclude framework module.
|
||||||
assertExcludeFromVendorSnapshotIs(t, ctx, "libinclude", false)
|
AssertExcludeFromVendorSnapshotIs(t, ctx, "libinclude", false, vendorVariant)
|
||||||
assertExcludeFromVendorSnapshotIs(t, ctx, "libexclude", true)
|
AssertExcludeFromVendorSnapshotIs(t, ctx, "libexclude", true, vendorVariant)
|
||||||
assertExcludeFromVendorSnapshotIs(t, ctx, "libavailable_exclude", true)
|
AssertExcludeFromVendorSnapshotIs(t, ctx, "libavailable_exclude", true, vendorVariant)
|
||||||
|
|
||||||
// A vendor module is excluded, but by its path, not the
|
// A vendor module is excluded, but by its path, not the
|
||||||
// exclude_from_vendor_snapshot property.
|
// exclude_from_vendor_snapshot property.
|
||||||
assertExcludeFromVendorSnapshotIs(t, ctx, "libvendor", false)
|
AssertExcludeFromVendorSnapshotIs(t, ctx, "libvendor", false, vendorVariant)
|
||||||
|
|
||||||
// Verify the content of the vendor snapshot.
|
// Verify the content of the vendor snapshot.
|
||||||
|
|
||||||
@@ -1110,15 +1103,15 @@ func TestVendorSnapshotExclude(t *testing.T) {
|
|||||||
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
||||||
|
|
||||||
// Included modules
|
// Included modules
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libinclude", "libinclude.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libinclude", "libinclude.so", sharedDir, sharedVariant)
|
||||||
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libinclude.so.json"))
|
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libinclude.so.json"))
|
||||||
|
|
||||||
// Excluded modules
|
// Excluded modules
|
||||||
checkSnapshotExclude(t, ctx, snapshotSingleton, "libexclude", "libexclude.so", sharedDir, sharedVariant)
|
CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude", "libexclude.so", sharedDir, sharedVariant)
|
||||||
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libexclude.so.json"))
|
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libexclude.so.json"))
|
||||||
checkSnapshotExclude(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant)
|
CheckSnapshotExclude(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant)
|
||||||
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libvendor.so.json"))
|
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libvendor.so.json"))
|
||||||
checkSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude", "libavailable_exclude.so", sharedDir, sharedVariant)
|
CheckSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude", "libavailable_exclude.so", sharedDir, sharedVariant)
|
||||||
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libavailable_exclude.so.json"))
|
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libavailable_exclude.so.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1258,9 +1251,9 @@ func TestRecoverySnapshotCapture(t *testing.T) {
|
|||||||
// For shared libraries, only recovery_available modules are captured.
|
// For shared libraries, only recovery_available modules are captured.
|
||||||
sharedVariant := fmt.Sprintf("android_recovery_%s_%s_shared", archType, archVariant)
|
sharedVariant := fmt.Sprintf("android_recovery_%s_%s_shared", archType, archVariant)
|
||||||
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", sharedDir, sharedVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.so", sharedDir, sharedVariant)
|
||||||
jsonFiles = append(jsonFiles,
|
jsonFiles = append(jsonFiles,
|
||||||
filepath.Join(sharedDir, "libvndk.so.json"),
|
filepath.Join(sharedDir, "libvndk.so.json"),
|
||||||
filepath.Join(sharedDir, "librecovery.so.json"),
|
filepath.Join(sharedDir, "librecovery.so.json"),
|
||||||
@@ -1269,9 +1262,9 @@ func TestRecoverySnapshotCapture(t *testing.T) {
|
|||||||
// For static libraries, all recovery:true and recovery_available modules are captured.
|
// For static libraries, all recovery:true and recovery_available modules are captured.
|
||||||
staticVariant := fmt.Sprintf("android_recovery_%s_%s_static", archType, archVariant)
|
staticVariant := fmt.Sprintf("android_recovery_%s_%s_static", archType, archVariant)
|
||||||
staticDir := filepath.Join(snapshotVariantPath, archDir, "static")
|
staticDir := filepath.Join(snapshotVariantPath, archDir, "static")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libb", "libb.a", staticDir, staticVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libb", "libb.a", staticDir, staticVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.a", staticDir, staticVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.a", staticDir, staticVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.a", staticDir, staticVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.a", staticDir, staticVariant)
|
||||||
jsonFiles = append(jsonFiles,
|
jsonFiles = append(jsonFiles,
|
||||||
filepath.Join(staticDir, "libb.a.json"),
|
filepath.Join(staticDir, "libb.a.json"),
|
||||||
filepath.Join(staticDir, "librecovery.a.json"),
|
filepath.Join(staticDir, "librecovery.a.json"),
|
||||||
@@ -1281,8 +1274,8 @@ func TestRecoverySnapshotCapture(t *testing.T) {
|
|||||||
if archType == "arm64" {
|
if archType == "arm64" {
|
||||||
binaryVariant := fmt.Sprintf("android_recovery_%s_%s", archType, archVariant)
|
binaryVariant := fmt.Sprintf("android_recovery_%s_%s", archType, archVariant)
|
||||||
binaryDir := filepath.Join(snapshotVariantPath, archDir, "binary")
|
binaryDir := filepath.Join(snapshotVariantPath, archDir, "binary")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "recovery_bin", "recovery_bin", binaryDir, binaryVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "recovery_bin", "recovery_bin", binaryDir, binaryVariant)
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "recovery_available_bin", "recovery_available_bin", binaryDir, binaryVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "recovery_available_bin", "recovery_available_bin", binaryDir, binaryVariant)
|
||||||
jsonFiles = append(jsonFiles,
|
jsonFiles = append(jsonFiles,
|
||||||
filepath.Join(binaryDir, "recovery_bin.json"),
|
filepath.Join(binaryDir, "recovery_bin.json"),
|
||||||
filepath.Join(binaryDir, "recovery_available_bin.json"))
|
filepath.Join(binaryDir, "recovery_available_bin.json"))
|
||||||
@@ -1295,7 +1288,7 @@ func TestRecoverySnapshotCapture(t *testing.T) {
|
|||||||
// For object modules, all vendor:true and vendor_available modules are captured.
|
// For object modules, all vendor:true and vendor_available modules are captured.
|
||||||
objectVariant := fmt.Sprintf("android_recovery_%s_%s", archType, archVariant)
|
objectVariant := fmt.Sprintf("android_recovery_%s_%s", archType, archVariant)
|
||||||
objectDir := filepath.Join(snapshotVariantPath, archDir, "object")
|
objectDir := filepath.Join(snapshotVariantPath, archDir, "object")
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "obj", "obj.o", objectDir, objectVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "obj", "obj.o", objectDir, objectVariant)
|
||||||
jsonFiles = append(jsonFiles, filepath.Join(objectDir, "obj.o.json"))
|
jsonFiles = append(jsonFiles, filepath.Join(objectDir, "obj.o.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1393,15 +1386,15 @@ func TestRecoverySnapshotExclude(t *testing.T) {
|
|||||||
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
||||||
|
|
||||||
// Included modules
|
// Included modules
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "libinclude", "libinclude.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "libinclude", "libinclude.so", sharedDir, sharedVariant)
|
||||||
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libinclude.so.json"))
|
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libinclude.so.json"))
|
||||||
|
|
||||||
// Excluded modules
|
// Excluded modules
|
||||||
checkSnapshotExclude(t, ctx, snapshotSingleton, "libexclude", "libexclude.so", sharedDir, sharedVariant)
|
CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude", "libexclude.so", sharedDir, sharedVariant)
|
||||||
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libexclude.so.json"))
|
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libexclude.so.json"))
|
||||||
checkSnapshotExclude(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant)
|
CheckSnapshotExclude(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant)
|
||||||
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "librecovery.so.json"))
|
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "librecovery.so.json"))
|
||||||
checkSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude", "libavailable_exclude.so", sharedDir, sharedVariant)
|
CheckSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude", "libavailable_exclude.so", sharedDir, sharedVariant)
|
||||||
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libavailable_exclude.so.json"))
|
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libavailable_exclude.so.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1482,15 +1475,15 @@ func TestRecoverySnapshotDirected(t *testing.T) {
|
|||||||
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
||||||
|
|
||||||
// Included modules
|
// Included modules
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant)
|
||||||
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "librecovery.so.json"))
|
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "librecovery.so.json"))
|
||||||
// Check that snapshot captures "prefer: true" prebuilt
|
// Check that snapshot captures "prefer: true" prebuilt
|
||||||
checkSnapshot(t, ctx, snapshotSingleton, "prebuilt_libfoo", "libfoo.so", sharedDir, sharedVariant)
|
CheckSnapshot(t, ctx, snapshotSingleton, "prebuilt_libfoo", "libfoo.so", sharedDir, sharedVariant)
|
||||||
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libfoo.so.json"))
|
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libfoo.so.json"))
|
||||||
|
|
||||||
// Excluded modules. Modules not included in the directed recovery snapshot
|
// Excluded modules. Modules not included in the directed recovery snapshot
|
||||||
// are still include as fake modules.
|
// are still include as fake modules.
|
||||||
checkSnapshotRule(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.so", sharedDir, sharedVariant)
|
CheckSnapshotRule(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.so", sharedDir, sharedVariant)
|
||||||
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "librecovery_available.so.json"))
|
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "librecovery_available.so.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user