Merge changes from topic "deprecate-zip-apex" into main

* changes:
  apex: Remove host support
  apex: Remove apexPackagingMutator
  apex: Remove 'zip' apex support
This commit is contained in:
Jooyung Han 2023-08-23 23:48:43 +00:00 committed by Gerrit Code Review
commit 138ee09e28
12 changed files with 424 additions and 779 deletions

View file

@ -42,7 +42,7 @@ func (class apexFileClass) nameInMake() string {
return "ETC"
case nativeSharedLib:
return "SHARED_LIBRARIES"
case nativeExecutable, shBinary, pyBinary, goBinary:
case nativeExecutable, shBinary:
return "EXECUTABLES"
case javaSharedLib:
return "JAVA_LIBRARIES"
@ -67,7 +67,7 @@ func (a *apexBundle) fullModuleName(apexBundleName string, linkToSystemLib bool,
if linkToSystemLib {
return fi.androidMkModuleName
}
return fi.androidMkModuleName + "." + apexBundleName + a.suffix
return fi.androidMkModuleName + "." + apexBundleName
}
// androidMkForFiles generates Make definitions for the contents of an
@ -85,11 +85,6 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, moduleDir st
// conflicts between two apexes with the same apexName.
moduleNames := []string{}
// To avoid creating duplicate build rules, run this function only when primaryApexType is true
// to install symbol files in $(PRODUCT_OUT}/apex.
if !a.primaryApexType {
return moduleNames
}
for _, fi := range a.filesInfo {
linkToSystemLib := a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform()
@ -140,32 +135,9 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, moduleDir st
fmt.Fprintln(w, "LOCAL_MODULE_CLASS :=", fi.class.nameInMake())
if fi.module != nil {
// This apexFile's module comes from Soong
archStr := fi.module.Target().Arch.ArchType.String()
host := false
switch fi.module.Target().Os.Class {
case android.Host:
if fi.module.Target().HostCross {
if fi.module.Target().Arch.ArchType != android.Common {
fmt.Fprintln(w, "LOCAL_MODULE_HOST_CROSS_ARCH :=", archStr)
}
} else {
if fi.module.Target().Arch.ArchType != android.Common {
fmt.Fprintln(w, "LOCAL_MODULE_HOST_ARCH :=", archStr)
}
}
host = true
case android.Device:
if fi.module.Target().Arch.ArchType != android.Common {
fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
}
}
if host {
makeOs := fi.module.Target().Os.String()
if fi.module.Target().Os == android.Linux || fi.module.Target().Os == android.LinuxBionic || fi.module.Target().Os == android.LinuxMusl {
makeOs = "linux"
}
fmt.Fprintln(w, "LOCAL_MODULE_HOST_OS :=", makeOs)
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
if fi.module.Target().Arch.ArchType != android.Common {
archStr := fi.module.Target().Arch.ArchType.String()
fmt.Fprintln(w, "LOCAL_MODULE_TARGET_ARCH :=", archStr)
}
} else if fi.isBazelPrebuilt && fi.arch != "" {
// This apexFile comes from Bazel
@ -237,7 +209,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, moduleDir st
}
// m <module_name> will build <module_name>.<apex_name> as well.
if fi.androidMkModuleName != moduleName && a.primaryApexType {
if fi.androidMkModuleName != moduleName {
fmt.Fprintf(w, ".PHONY: %s\n", fi.androidMkModuleName)
fmt.Fprintf(w, "%s: %s\n", fi.androidMkModuleName, moduleName)
}
@ -266,19 +238,18 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
return android.AndroidMkData{
Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
moduleNames := []string{}
apexType := a.properties.ApexType
if a.installable() {
moduleNames = a.androidMkForFiles(w, name, moduleDir, data)
}
fmt.Fprintln(w, "\ninclude $(CLEAR_VARS) # apex.apexBundle")
fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
fmt.Fprintln(w, "LOCAL_MODULE :=", name+a.suffix)
fmt.Fprintln(w, "LOCAL_MODULE :=", name)
data.Entries.WriteLicenseVariables(w)
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC") // do we need a new class?
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", a.outputFile.String())
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.String())
stemSuffix := apexType.suffix()
stemSuffix := imageApexSuffix
if a.isCompressed {
stemSuffix = imageCapexSuffix
}
@ -307,10 +278,7 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
a.writeRequiredModules(w, moduleNames)
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
if apexType == imageApex {
fmt.Fprintln(w, "ALL_MODULES.$(my_register_name).BUNDLE :=", a.bundleModuleFile.String())
}
fmt.Fprintln(w, "ALL_MODULES.$(my_register_name).BUNDLE :=", a.bundleModuleFile.String())
android.AndroidMkEmitAssignList(w, "ALL_MODULES.$(my_register_name).LINT_REPORTS", a.lintReports.Strings())
if a.installedFilesFile != nil {

View file

@ -26,7 +26,6 @@ import (
"android/soong/bazel/cquery"
"github.com/google/blueprint"
"github.com/google/blueprint/bootstrap"
"github.com/google/blueprint/proptools"
"android/soong/android"
@ -37,7 +36,6 @@ import (
"android/soong/filesystem"
"android/soong/java"
"android/soong/multitree"
"android/soong/python"
"android/soong/rust"
"android/soong/sh"
)
@ -79,7 +77,6 @@ func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("mark_platform_availability", markPlatformAvailability).Parallel()
ctx.BottomUp("apex", apexMutator).Parallel()
ctx.BottomUp("apex_directly_in_any", apexDirectlyInAnyMutator).Parallel()
ctx.BottomUp("apex_packaging", apexPackagingMutator).Parallel()
ctx.BottomUp("apex_dcla_deps", apexDCLADepsMutator).Parallel()
// Register after apex_info mutator so that it can use ApexVariationName
ctx.TopDown("apex_strict_updatability_lint", apexStrictUpdatibilityLintMutator).Parallel()
@ -166,15 +163,7 @@ type apexBundleProperties struct {
// Should be only used in non-system apexes (e.g. vendor: true). Default is false.
Use_vndk_as_stable *bool
// The type of APEX to build. Controls what the APEX payload is. Either 'image', 'zip' or
// 'both'. When set to image, contents are stored in a filesystem image inside a zip
// container. When set to zip, contents are stored in a zip container directly. This type is
// mostly for host-side debugging. When set to both, the two types are both built. Default
// is 'image'.
Payload_type *string
// The type of filesystem to use when the payload_type is 'image'. Either 'ext4', 'f2fs'
// or 'erofs'. Default 'ext4'.
// The type of filesystem to use. Either 'ext4', 'f2fs' or 'erofs'. Default 'ext4'.
Payload_fs_type *string
// For telling the APEX to ignore special handling for system libraries such as bionic.
@ -216,9 +205,6 @@ type apexBundleProperties struct {
HideFromMake bool `blueprint:"mutated"`
// Internal package method for this APEX.
ApexType apexPackaging `blueprint:"mutated"`
// Name that dependencies can specify in their apex_available properties to refer to this module.
// If not specified, this defaults to Soong module name. This must be the name of a Soong module.
Apex_available_name *string
@ -421,13 +407,6 @@ type apexBundle struct {
testApex bool
vndkApex bool
// Tells whether this variant of the APEX bundle is the primary one or not. Only the primary
// one gets installed to the device.
primaryApexType bool
// Suffix of module name in Android.mk ".apex", ".zipapex", or ""
suffix string
// File system type of apex_payload.img
payloadFsType fsType
@ -506,12 +485,10 @@ const (
app apexFileClass = iota
appSet
etc
goBinary
javaSharedLib
nativeExecutable
nativeSharedLib
nativeTest
pyBinary
shBinary
)
@ -520,12 +497,10 @@ var (
"app": app,
"appSet": appSet,
"etc": etc,
"goBinary": goBinary,
"javaSharedLib": javaSharedLib,
"nativeExecutable": nativeExecutable,
"nativeSharedLib": nativeSharedLib,
"nativeTest": nativeTest,
"pyBinary": pyBinary,
"shBinary": shBinary,
}
)
@ -716,11 +691,10 @@ func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext, nativeM
libVariations := append(target.Variations(), blueprint.Variation{Mutator: "link", Variation: "shared"})
rustLibVariations := append(target.Variations(), blueprint.Variation{Mutator: "rust_libraries", Variation: "dylib"})
if ctx.Device() {
binVariations = append(binVariations, blueprint.Variation{Mutator: "image", Variation: imageVariation})
libVariations = append(libVariations, blueprint.Variation{Mutator: "image", Variation: imageVariation})
rustLibVariations = append(rustLibVariations, blueprint.Variation{Mutator: "image", Variation: imageVariation})
}
// Append "image" variation
binVariations = append(binVariations, blueprint.Variation{Mutator: "image", Variation: imageVariation})
libVariations = append(libVariations, blueprint.Variation{Mutator: "image", Variation: imageVariation})
rustLibVariations = append(rustLibVariations, blueprint.Variation{Mutator: "image", Variation: imageVariation})
// Use *FarVariation* to be able to depend on modules having conflicting variations with
// this module. This is required since arch variant of an APEX bundle is 'common' but it is
@ -740,16 +714,7 @@ func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext, nativeM
}
func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {
if ctx.Device() {
proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Android.Multilib, nil)
} else {
proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Host.Multilib, nil)
if ctx.Os().Bionic() {
proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Linux_bionic.Multilib, nil)
} else {
proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Linux_glibc.Multilib, nil)
}
}
proptools.AppendProperties(&a.properties.Multilib, &a.targetProperties.Target.Android.Multilib, nil)
}
// getImageVariationPair returns a pair for the image variation name as its
@ -807,12 +772,6 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
}
}
for i, target := range targets {
// Don't include artifacts for the host cross targets because there is no way for us
// to run those artifacts natively on host
if target.HostCross {
continue
}
var deps ApexNativeDependencies
// Add native modules targeting both ABIs. When multilib.* is omitted for
@ -1249,8 +1208,8 @@ func apexTestForMutator(mctx android.BottomUpMutatorContext) {
// be) available to platform
// TODO(jiyong): move this to android/apex.go?
func markPlatformAvailability(mctx android.BottomUpMutatorContext) {
// Host and recovery are not considered as platform
if mctx.Host() || mctx.Module().InstallInRecovery() {
// Recovery is not considered as platform
if mctx.Module().InstallInRecovery() {
return
}
@ -1353,95 +1312,19 @@ func apexDirectlyInAnyMutator(mctx android.BottomUpMutatorContext) {
}
}
// apexPackaging represents a specific packaging method for an APEX.
type apexPackaging int
const (
// imageApex is a packaging method where contents are included in a filesystem image which
// is then included in a zip container. This is the most typical way of packaging.
imageApex apexPackaging = iota
// zipApex is a packaging method where contents are directly included in the zip container.
// This is used for host-side testing - because the contents are easily accessible by
// unzipping the container.
// TODO(b/279835185) deprecate zipApex
zipApex
)
const (
// File extensions of an APEX for different packaging methods
imageApexSuffix = ".apex"
imageCapexSuffix = ".capex"
zipApexSuffix = ".zipapex"
// variant names each of which is for a packaging method
imageApexType = "image"
zipApexType = "zip"
ext4FsType = "ext4"
f2fsFsType = "f2fs"
erofsFsType = "erofs"
)
// The suffix for the output "file", not the module
func (a apexPackaging) suffix() string {
switch a {
case imageApex:
return imageApexSuffix
case zipApex:
return zipApexSuffix
default:
panic(fmt.Errorf("unknown APEX type %d", a))
}
}
func (a apexPackaging) name() string {
switch a {
case imageApex:
return imageApexType
case zipApex:
return zipApexType
default:
panic(fmt.Errorf("unknown APEX type %d", a))
}
}
// apexPackagingMutator creates one or more variations each of which is for a packaging method.
func apexPackagingMutator(mctx android.BottomUpMutatorContext) {
if !mctx.Module().Enabled() {
return
}
if ab, ok := mctx.Module().(*apexBundle); ok {
var variants []string
switch proptools.StringDefault(ab.properties.Payload_type, "image") {
case "image":
variants = append(variants, imageApexType)
case "zip":
variants = append(variants, zipApexType)
case "both":
variants = append(variants, imageApexType, zipApexType)
default:
mctx.PropertyErrorf("payload_type", "%q is not one of \"image\", \"zip\", or \"both\".", *ab.properties.Payload_type)
return
}
modules := mctx.CreateLocalVariations(variants...)
for i, v := range variants {
switch v {
case imageApexType:
modules[i].(*apexBundle).properties.ApexType = imageApex
case zipApexType:
modules[i].(*apexBundle).properties.ApexType = zipApex
}
}
} else if _, ok := mctx.Module().(*OverrideApex); ok {
// payload_type is forcibly overridden to "image"
// TODO(jiyong): is this the right decision?
mctx.CreateVariations(imageApexType)
}
}
var _ android.DepIsInSameApex = (*apexBundle)(nil)
// Implements android.DepInInSameApex
@ -1486,7 +1369,7 @@ var _ cc.Coverage = (*apexBundle)(nil)
// Implements cc.Coverage
func (a *apexBundle) IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool {
return ctx.Device() && ctx.DeviceConfig().NativeCoverageEnabled()
return ctx.DeviceConfig().NativeCoverageEnabled()
}
// Implements cc.Coverage
@ -1597,13 +1480,9 @@ func (a *apexBundle) IsSanitizerEnabled(config android.Config, sanitizerName str
// Then follow the global setting
var globalSanitizerNames []string
if a.Host() {
globalSanitizerNames = config.SanitizeHost()
} else {
arches := config.SanitizeDeviceArch()
if len(arches) == 0 || android.InList(a.Arch().ArchType.Name, arches) {
globalSanitizerNames = config.SanitizeDevice()
}
arches := config.SanitizeDeviceArch()
if len(arches) == 0 || android.InList(a.Arch().ArchType.Name, arches) {
globalSanitizerNames = config.SanitizeDevice()
}
return android.InList(sanitizerName, globalSanitizerNames)
}
@ -1611,7 +1490,7 @@ func (a *apexBundle) IsSanitizerEnabled(config android.Config, sanitizerName str
func (a *apexBundle) AddSanitizerDependencies(ctx android.BottomUpMutatorContext, sanitizerName string) {
// TODO(jiyong): move this info (the sanitizer name, the lib name, etc.) to cc/sanitize.go
// Keep only the mechanism here.
if ctx.Device() && sanitizerName == "hwaddress" && strings.HasPrefix(a.Name(), "com.android.runtime") {
if sanitizerName == "hwaddress" && strings.HasPrefix(a.Name(), "com.android.runtime") {
imageVariation := a.getImageVariation(ctx)
for _, target := range ctx.MultiTargets() {
if target.Arch.ArchType.Multilib == "lib64" {
@ -1711,22 +1590,6 @@ func apexFileForRustLibrary(ctx android.BaseModuleContext, rustm *rust.Module) a
return newApexFile(ctx, fileToCopy, androidMkModuleName, dirInApex, nativeSharedLib, rustm)
}
func apexFileForPyBinary(ctx android.BaseModuleContext, py *python.PythonBinaryModule) apexFile {
dirInApex := "bin"
fileToCopy := py.HostToolPath().Path()
return newApexFile(ctx, fileToCopy, py.BaseModuleName(), dirInApex, pyBinary, py)
}
func apexFileForGoBinary(ctx android.BaseModuleContext, depName string, gb bootstrap.GoBinaryTool) apexFile {
dirInApex := "bin"
fileToCopy := android.PathForGoBinary(ctx, gb)
// NB: Since go binaries are static we don't need the module for anything here, which is
// good since the go tool is a blueprint.Module not an android.Module like we would
// normally use.
//
return newApexFile(ctx, fileToCopy, depName, dirInApex, goBinary, nil)
}
func apexFileForShBinary(ctx android.BaseModuleContext, sh *sh.ShBinary) apexFile {
dirInApex := filepath.Join("bin", sh.SubDir())
if sh.Target().NativeBridge == android.NativeBridgeEnabled {
@ -1945,7 +1808,7 @@ func (f fsType) string() string {
var _ android.MixedBuildBuildable = (*apexBundle)(nil)
func (a *apexBundle) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
return a.properties.ApexType == imageApex
return true
}
func (a *apexBundle) QueueBazelCall(ctx android.BaseModuleContext) {
@ -1966,13 +1829,9 @@ func (a *apexBundle) ProcessBazelQueryResponse(ctx android.ModuleContext) {
return
}
a.setApexTypeAndSuffix(ctx)
a.setPayloadFsType(ctx)
a.setSystemLibLink(ctx)
if a.properties.ApexType != zipApex {
a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx, a.primaryApexType)
}
a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx)
bazelCtx := ctx.Config().BazelContext
outputs, err := bazelCtx.GetApexInfo(a.GetBazelLabel(ctx, a), android.GetConfigKey(ctx))
@ -2007,24 +1866,18 @@ func (a *apexBundle) ProcessBazelQueryResponse(ctx android.ModuleContext) {
// part of a bundled build.
a.makeModulesToInstall = append(a.makeModulesToInstall, outputs.MakeModulesToInstall...)
apexType := a.properties.ApexType
switch apexType {
case imageApex:
a.bundleModuleFile = android.PathForBazelOut(ctx, outputs.BundleFile)
a.nativeApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.SymbolsUsedByApex))
a.nativeApisBackedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.BackingLibs))
// TODO(b/239084755): Generate the java api using.xml file from Bazel.
a.javaApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.JavaSymbolsUsedByApex))
a.installedFilesFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.InstalledFiles))
installSuffix := imageApexSuffix
if a.isCompressed {
installSuffix = imageCapexSuffix
}
a.installedFile = ctx.InstallFile(a.installDir, a.Name()+installSuffix, a.outputFile,
a.compatSymlinks.Paths()...)
default:
panic(fmt.Errorf("internal error: unexpected apex_type for the ProcessBazelQueryResponse: %v", a.properties.ApexType))
a.bundleModuleFile = android.PathForBazelOut(ctx, outputs.BundleFile)
a.nativeApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.SymbolsUsedByApex))
a.nativeApisBackedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.BackingLibs))
// TODO(b/239084755): Generate the java api using.xml file from Bazel.
a.javaApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.JavaSymbolsUsedByApex))
a.installedFilesFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.InstalledFiles))
installSuffix := imageApexSuffix
if a.isCompressed {
installSuffix = imageCapexSuffix
}
a.installedFile = ctx.InstallFile(a.installDir, a.Name()+installSuffix, a.outputFile,
a.compatSymlinks.Paths()...)
// filesInfo in mixed mode must retrieve all information about the apex's
// contents completely from the Starlark providers. It should never rely on
@ -2065,9 +1918,7 @@ func (a *apexBundle) ProcessBazelQueryResponse(ctx android.ModuleContext) {
}
func (a *apexBundle) setCompression(ctx android.ModuleContext) {
if a.properties.ApexType != imageApex {
a.isCompressed = false
} else if a.testOnlyShouldForceCompression() {
if a.testOnlyShouldForceCompression() {
a.isCompressed = true
} else {
a.isCompressed = ctx.Config().ApexCompressionEnabled() && a.isCompressable()
@ -2093,12 +1944,7 @@ func (a *apexBundle) setSystemLibLink(ctx android.ModuleContext) {
// We don't need the optimization for updatable APEXes, as it might give false signal
// to the system health when the APEXes are still bundled (b/149805758).
if !forced && updatable && a.properties.ApexType == imageApex {
a.linkToSystemLib = false
}
// We also don't want the optimization for host APEXes, because it doesn't make sense.
if ctx.Host() {
if !forced && updatable {
a.linkToSystemLib = false
}
}
@ -2116,22 +1962,6 @@ func (a *apexBundle) setPayloadFsType(ctx android.ModuleContext) {
}
}
func (a *apexBundle) setApexTypeAndSuffix(ctx android.ModuleContext) {
// Set suffix and primaryApexType depending on the ApexType
switch a.properties.ApexType {
case imageApex:
a.suffix = ""
a.primaryApexType = true
case zipApex:
if proptools.String(a.properties.Payload_type) == "zip" {
a.suffix = ""
a.primaryApexType = true
} else {
a.suffix = zipApexSuffix
}
}
}
func (a *apexBundle) isCompressable() bool {
return proptools.BoolDefault(a.overridableProperties.Compressible, false) && !a.testApex
}
@ -2234,14 +2064,6 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
case *cc.Module:
vctx.filesInfo = append(vctx.filesInfo, apexFileForExecutable(ctx, ch))
return true // track transitive dependencies
case *python.PythonBinaryModule:
if ch.HostToolPath().Valid() {
vctx.filesInfo = append(vctx.filesInfo, apexFileForPyBinary(ctx, ch))
}
case bootstrap.GoBinaryTool:
if a.Host() {
vctx.filesInfo = append(vctx.filesInfo, apexFileForGoBinary(ctx, depName, ch))
}
case *rust.Module:
vctx.filesInfo = append(vctx.filesInfo, apexFileForRustExecutable(ctx, ch))
return true // track transitive dependencies
@ -2403,12 +2225,6 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
af := apexFileForNativeLibrary(ctx, ch, vctx.handleSpecialLibs)
af.transitiveDep = true
// Always track transitive dependencies for host.
if a.Host() {
vctx.filesInfo = append(vctx.filesInfo, af)
return true
}
abInfo := ctx.Provider(ApexBundleInfoProvider).(ApexBundleInfo)
if !abInfo.Contents.DirectlyInApex(depName) && (ch.IsStubs() || ch.HasStubsVariants()) {
// If the dependency is a stubs lib, don't include it in this APEX,
@ -2539,11 +2355,7 @@ func (a *apexBundle) shouldCheckDuplicate(ctx android.ModuleContext) bool {
if a.testApex {
return false
}
// TODO(b/263309864) remove this
if a.Host() {
return false
}
if a.Device() && ctx.DeviceConfig().DeviceArch() == "" {
if ctx.DeviceConfig().DeviceArch() == "" {
return false
}
return true
@ -2621,12 +2433,9 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.installDir = android.PathForModuleInstall(ctx, "apex")
a.filesInfo = vctx.filesInfo
a.setApexTypeAndSuffix(ctx)
a.setPayloadFsType(ctx)
a.setSystemLibLink(ctx)
if a.properties.ApexType != zipApex {
a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx, a.primaryApexType)
}
a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx)
////////////////////////////////////////////////////////////////////////////////////////////
// 4) generate the build rules to create the APEX. This is done in builder.go.
@ -2727,7 +2536,7 @@ func newApexBundle() *apexBundle {
module.AddProperties(&module.archProperties)
module.AddProperties(&module.overridableProperties)
android.InitAndroidMultiTargetsArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(module)
android.InitOverridableModule(module, &module.overridableProperties.Overrides)
android.InitBazelModule(module)
@ -2958,7 +2767,7 @@ func minSdkVersionFromValue(ctx android.EarlyModuleContext, value string) androi
// Ensures that a lib providing stub isn't statically linked
func (a *apexBundle) checkStaticLinkingToStubLibraries(ctx android.ModuleContext) {
// Practically, we only care about regular APEXes on the device.
if ctx.Host() || a.testApex || a.vndkApex {
if a.testApex || a.vndkApex {
return
}
@ -3053,7 +2862,7 @@ func (a *apexBundle) checkJavaStableSdkVersion(ctx android.ModuleContext) {
// checkApexAvailability ensures that the all the dependencies are marked as available for this APEX.
func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
// Let's be practical. Availability for test, host, and the VNDK apex isn't important
if ctx.Host() || a.testApex || a.vndkApex {
if a.testApex || a.vndkApex {
return
}
@ -3111,11 +2920,6 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
// checkStaticExecutable ensures that executables in an APEX are not static.
func (a *apexBundle) checkStaticExecutables(ctx android.ModuleContext) {
// No need to run this for host APEXes
if ctx.Host() {
return
}
ctx.VisitDirectDepsBlueprint(func(module blueprint.Module) {
if ctx.OtherModuleDependencyTag(module) != executableTag {
return

View file

@ -518,10 +518,10 @@ func TestBasicApex(t *testing.T) {
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
// Make sure that Android.mk is created
ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
ab := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
@ -533,7 +533,7 @@ func TestBasicApex(t *testing.T) {
optFlags := apexRule.Args["opt_flags"]
ensureContains(t, optFlags, "--pubkey vendor/foo/devkeys/testkey.avbpubkey")
// Ensure that the NOTICE output is being packaged as an asset.
ensureContains(t, optFlags, "--assets_dir out/soong/.intermediates/myapex/android_common_myapex_image/NOTICE")
ensureContains(t, optFlags, "--assets_dir out/soong/.intermediates/myapex/android_common_myapex/NOTICE")
copyCmds := apexRule.Args["copy_commands"]
@ -595,13 +595,13 @@ func TestBasicApex(t *testing.T) {
t.Errorf("Could not find all expected symlinks! foo: %t, foo_link_64: %t. Command was %s", found_foo, found_foo_link_64, copyCmds)
}
fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("depsinfo/fulllist.txt").Args["content"], "\\n")
fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex").Output("depsinfo/fulllist.txt").Args["content"], "\\n")
ensureListContains(t, fullDepsInfo, " myjar(minSdkVersion:(no version)) <- myapex")
ensureListContains(t, fullDepsInfo, " mylib2(minSdkVersion:(no version)) <- mylib")
ensureListContains(t, fullDepsInfo, " myotherjar(minSdkVersion:(no version)) <- myjar")
ensureListContains(t, fullDepsInfo, " mysharedjar(minSdkVersion:(no version)) (external) <- myjar")
flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("depsinfo/flatlist.txt").Args["content"], "\\n")
flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex").Output("depsinfo/flatlist.txt").Args["content"], "\\n")
ensureListContains(t, flatDepsInfo, "myjar(minSdkVersion:(no version))")
ensureListContains(t, flatDepsInfo, "mylib2(minSdkVersion:(no version))")
ensureListContains(t, flatDepsInfo, "myotherjar(minSdkVersion:(no version))")
@ -678,7 +678,7 @@ func TestDefaults(t *testing.T) {
}
`)
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"etc/myetc",
"javalib/myjar.jar",
"lib64/mylib.so",
@ -705,7 +705,7 @@ func TestApexManifest(t *testing.T) {
}
`)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
args := module.Rule("apexRule").Args
if manifest := args["manifest"]; manifest != module.Output("apex_manifest.pb").Output.String() {
t.Error("manifest should be apex_manifest.pb, but " + manifest)
@ -776,7 +776,7 @@ func TestApexManifestMinSdkVersion(t *testing.T) {
},
}
for _, tc := range testCases {
module := ctx.ModuleForTests(tc.module, "android_common_"+tc.module+"_image")
module := ctx.ModuleForTests(tc.module, "android_common_"+tc.module)
args := module.Rule("apexRule").Args
optFlags := args["opt_flags"]
if !strings.Contains(optFlags, "--min_sdk_version "+tc.minSdkVersion) {
@ -806,7 +806,7 @@ func TestFileContexts(t *testing.T) {
}
`)
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("file_contexts")
rule := ctx.ModuleForTests("myapex", "android_common_myapex").Output("file_contexts")
if vendor {
android.AssertStringDoesContain(t, "should force-label as vendor_apex_metadata_file",
rule.RuleParams.Command,
@ -819,57 +819,6 @@ func TestFileContexts(t *testing.T) {
}
}
func TestBasicZipApex(t *testing.T) {
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
payload_type: "zip",
native_shared_libs: ["mylib"],
updatable: false,
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
cc_library {
name: "mylib",
srcs: ["mylib.cpp"],
shared_libs: ["mylib2"],
system_shared_libs: [],
stl: "none",
apex_available: [ "myapex" ],
}
cc_library {
name: "mylib2",
srcs: ["mylib.cpp"],
system_shared_libs: [],
stl: "none",
apex_available: [ "myapex" ],
}
`)
zipApexRule := ctx.ModuleForTests("myapex", "android_common_myapex_zip").Rule("zipApexRule")
copyCmds := zipApexRule.Args["copy_commands"]
// Ensure that main rule creates an output
ensureContains(t, zipApexRule.Output.String(), "myapex.zipapex.unsigned")
// Ensure that APEX variant is created for the direct dep
ensureListContains(t, ctx.ModuleVariantsForTests("mylib"), "android_arm64_armv8-a_shared_apex10000")
// Ensure that APEX variant is created for the indirect dep
ensureListContains(t, ctx.ModuleVariantsForTests("mylib2"), "android_arm64_armv8-a_shared_apex10000")
// Ensure that both direct and indirect deps are copied into apex
ensureContains(t, copyCmds, "image.zipapex/lib64/mylib.so")
ensureContains(t, copyCmds, "image.zipapex/lib64/mylib2.so")
}
func TestApexWithStubs(t *testing.T) {
ctx := testApex(t, `
apex {
@ -946,7 +895,7 @@ func TestApexWithStubs(t *testing.T) {
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@ -987,7 +936,7 @@ func TestApexWithStubs(t *testing.T) {
// Ensure that genstub for apex-provided lib is invoked with --apex
ensureContains(t, ctx.ModuleForTests("mylib3", "android_arm64_armv8-a_shared_12").Rule("genStubSrc").Args["flags"], "--apex")
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"lib64/mylib.so",
"lib64/mylib3.so",
"lib64/mylib4.so",
@ -1003,7 +952,7 @@ func TestApexWithStubs(t *testing.T) {
ensureContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared_current/libfoo.shared_from_rust.so")
ensureNotContains(t, rustDeps, "libfoo.shared_from_rust/android_arm64_armv8-a_shared/libfoo.shared_from_rust.so")
apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo.shared_from_rust.so")
}
@ -1063,7 +1012,7 @@ func TestApexCanUsePrivateApis(t *testing.T) {
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that indirect stubs dep is not included
@ -1141,7 +1090,7 @@ func TestApexWithStubsWithMinSdkVersion(t *testing.T) {
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@ -1172,7 +1121,7 @@ func TestApexWithStubsWithMinSdkVersion(t *testing.T) {
// Ensure that genstub is invoked with --systemapi
ensureContains(t, ctx.ModuleForTests("mylib2", "android_arm64_armv8-a_shared_29").Rule("genStubSrc").Args["flags"], "--systemapi")
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"lib64/mylib.so",
"lib64/mylib3.so",
"lib64/mylib4.so",
@ -1308,7 +1257,7 @@ func TestApexWithExplicitStubsDependency(t *testing.T) {
`)
apexRule := ctx.ModuleForTests("myapex2", "android_common_myapex2_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex2", "android_common_myapex2").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@ -1332,10 +1281,10 @@ func TestApexWithExplicitStubsDependency(t *testing.T) {
// Ensure that libfoo stubs is not linking to libbar (since it is a stubs)
ensureNotContains(t, libFooStubsLdFlags, "libbar.so")
fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2_image").Output("depsinfo/fulllist.txt").Args["content"], "\\n")
fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2").Output("depsinfo/fulllist.txt").Args["content"], "\\n")
ensureListContains(t, fullDepsInfo, " libfoo(minSdkVersion:(no version)) (external) <- mylib")
flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2_image").Output("depsinfo/flatlist.txt").Args["content"], "\\n")
flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2").Output("depsinfo/flatlist.txt").Args["content"], "\\n")
ensureListContains(t, flatDepsInfo, "libfoo(minSdkVersion:(no version)) (external)")
}
@ -1426,7 +1375,7 @@ func TestApexWithRuntimeLibsDependency(t *testing.T) {
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@ -1442,7 +1391,7 @@ func TestApexWithRuntimeLibsDependency(t *testing.T) {
ensureNotContains(t, copyCmds, "image.apex/lib64/libstatic_to_runtime.so")
apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
ensureListEmpty(t, names(apexManifestRule.Args["provideNativeLibs"]))
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo.so")
}
@ -1503,7 +1452,7 @@ func TestRuntimeApexShouldInstallHwasanIfLibcDependsOnIt(t *testing.T) {
} `)
ctx := result.TestContext
ensureExactContents(t, ctx, "com.android.runtime", "android_common_hwasan_com.android.runtime_image", []string{
ensureExactContents(t, ctx, "com.android.runtime", "android_common_hwasan_com.android.runtime", []string{
"lib64/bionic/libc.so",
"lib64/bionic/libclang_rt.hwasan-aarch64-android.so",
})
@ -1556,7 +1505,7 @@ func TestRuntimeApexShouldInstallHwasanIfHwaddressSanitized(t *testing.T) {
`)
ctx := result.TestContext
ensureExactContents(t, ctx, "com.android.runtime", "android_common_hwasan_com.android.runtime_image", []string{
ensureExactContents(t, ctx, "com.android.runtime", "android_common_hwasan_com.android.runtime", []string{
"lib64/bionic/libc.so",
"lib64/bionic/libclang_rt.hwasan-aarch64-android.so",
})
@ -1637,12 +1586,12 @@ func TestApexDependsOnLLNDKTransitively(t *testing.T) {
)
// Ensure that LLNDK dep is not included
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"lib64/mylib.so",
})
// Ensure that LLNDK dep is required
apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
ensureListEmpty(t, names(apexManifestRule.Args["provideNativeLibs"]))
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libbar.so")
@ -1702,7 +1651,7 @@ func TestApexWithSystemLibsStubs(t *testing.T) {
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that mylib, libm, libdl are included.
@ -2076,11 +2025,11 @@ func TestTrackAllowedDeps(t *testing.T) {
depsinfo := ctx.SingletonForTests("apex_depsinfo_singleton")
inputs := depsinfo.Rule("generateApexDepsInfoFilesRule").BuildParams.Inputs.Strings()
android.AssertStringListContains(t, "updatable myapex should generate depsinfo file", inputs,
"out/soong/.intermediates/myapex/android_common_myapex_image/depsinfo/flatlist.txt")
"out/soong/.intermediates/myapex/android_common_myapex/depsinfo/flatlist.txt")
android.AssertStringListDoesNotContain(t, "non-updatable myapex2 should not generate depsinfo file", inputs,
"out/soong/.intermediates/myapex2/android_common_myapex2_image/depsinfo/flatlist.txt")
"out/soong/.intermediates/myapex2/android_common_myapex2/depsinfo/flatlist.txt")
myapex := ctx.ModuleForTests("myapex", "android_common_myapex_image")
myapex := ctx.ModuleForTests("myapex", "android_common_myapex")
flatlist := strings.Split(myapex.Output("depsinfo/flatlist.txt").BuildParams.Args["content"], "\\n")
android.AssertStringListContains(t, "deps with stubs should be tracked in depsinfo as external dep",
flatlist, "libbar(minSdkVersion:(no version)) (external)")
@ -2838,7 +2787,7 @@ func TestFilesInSubDir(t *testing.T) {
}
`)
generateFsRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("generateFsConfig")
generateFsRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("generateFsConfig")
cmd := generateFsRule.RuleParams.Command
// Ensure that the subdirectories are all listed
@ -2903,7 +2852,7 @@ func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {
},
}
`, withNativeBridgeEnabled)
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"bin/foo/bar/mybin",
"bin/foo/bar/mybin64",
"bin/arm/foo/bar/mybin",
@ -2943,14 +2892,14 @@ func TestVendorApex(t *testing.T) {
}
`)
ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex", []string{
"bin/mybin",
"lib64/libfoo.so",
// TODO(b/159195575): Add an option to use VNDK libs from VNDK APEX
"lib64/libc++.so",
})
apexBundle := result.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
apexBundle := result.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, result.TestContext, apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
@ -2960,7 +2909,7 @@ func TestVendorApex(t *testing.T) {
installPath := "out/target/product/test_device/vendor/apex"
ensureContains(t, androidMk, "LOCAL_MODULE_PATH := "+installPath)
apexManifestRule := result.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
apexManifestRule := result.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
requireNativeLibs := names(apexManifestRule.Args["requireNativeLibs"])
ensureListNotContains(t, requireNativeLibs, ":vndk")
}
@ -3103,10 +3052,10 @@ func TestVendorApex_use_vndk_as_stable(t *testing.T) {
ensureListContains(t, libs, lib)
}
// Check apex contents
ensureExactContents(t, ctx, tc.apexName, "android_common_"+tc.apexName+"_image", tc.contents)
ensureExactContents(t, ctx, tc.apexName, "android_common_"+tc.apexName, tc.contents)
// Check "requireNativeLibs"
apexManifestRule := ctx.ModuleForTests(tc.apexName, "android_common_"+tc.apexName+"_image").Rule("apexManifestRule")
apexManifestRule := ctx.ModuleForTests(tc.apexName, "android_common_"+tc.apexName).Rule("apexManifestRule")
requireNativeLibs := names(apexManifestRule.Args["requireNativeLibs"])
if tc.requireVndkNamespace {
ensureListContains(t, requireNativeLibs, ":vndk")
@ -3182,7 +3131,7 @@ func TestApex_withPrebuiltFirmware(t *testing.T) {
`+tc.additionalProp+`
}
`)
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"etc/firmware/myfirmware.bin",
})
})
@ -3211,7 +3160,7 @@ func TestAndroidMk_VendorApexRequired(t *testing.T) {
}
`)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
@ -3240,7 +3189,7 @@ func TestAndroidMkWritesCommonProperties(t *testing.T) {
}
`)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
@ -3343,7 +3292,7 @@ func TestKeys(t *testing.T) {
}
// check the APK certs. It should be overridden to myapex.certificate.override
certs := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest_image").Rule("signapk").Args["certificates"]
certs := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest").Rule("signapk").Args["certificates"]
if certs != "testkey.override.x509.pem testkey.override.pk8" {
t.Errorf("cert and private key %q are not %q", certs,
"testkey.override.509.pem testkey.override.pk8")
@ -3363,7 +3312,7 @@ func TestCertificate(t *testing.T) {
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}`)
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("signapk")
rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk")
expected := "vendor/foo/devkeys/test.x509.pem vendor/foo/devkeys/test.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@ -3386,7 +3335,7 @@ func TestCertificate(t *testing.T) {
name: "myapex.certificate.override",
certificate: "testkey.override",
}`)
rule := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest_image").Rule("signapk")
rule := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest").Rule("signapk")
expected := "testkey.override.x509.pem testkey.override.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@ -3409,7 +3358,7 @@ func TestCertificate(t *testing.T) {
name: "myapex.certificate",
certificate: "testkey",
}`)
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("signapk")
rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk")
expected := "testkey.x509.pem testkey.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@ -3433,7 +3382,7 @@ func TestCertificate(t *testing.T) {
name: "myapex.certificate.override",
certificate: "testkey.override",
}`)
rule := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest_image").Rule("signapk")
rule := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest").Rule("signapk")
expected := "testkey.override.x509.pem testkey.override.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@ -3452,7 +3401,7 @@ func TestCertificate(t *testing.T) {
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}`)
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("signapk")
rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("signapk")
expected := "vendor/foo/devkeys/testkey.x509.pem vendor/foo/devkeys/testkey.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@ -3476,7 +3425,7 @@ func TestCertificate(t *testing.T) {
name: "myapex.certificate.override",
certificate: "testkey.override",
}`)
rule := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest_image").Rule("signapk")
rule := ctx.ModuleForTests("myapex_keytest", "android_common_myapex_keytest").Rule("signapk")
expected := "testkey.override.x509.pem testkey.override.pk8"
if actual := rule.Args["certificates"]; actual != expected {
t.Errorf("certificates should be %q, not %q", expected, actual)
@ -3657,10 +3606,6 @@ func getFiles(t *testing.T, ctx *android.TestContext, moduleName, variant string
module := ctx.ModuleForTests(moduleName, variant)
apexRule := module.MaybeRule("apexRule")
apexDir := "/image.apex/"
if apexRule.Rule == nil {
apexRule = module.Rule("zipApexRule")
apexDir = "/image.zipapex/"
}
copyCmds := apexRule.Args["copy_commands"]
var ret []fileInApex
for _, cmd := range strings.Split(copyCmds, "&&") {
@ -3872,7 +3817,7 @@ func TestVndkApexCurrent(t *testing.T) {
variables.DeviceVndkVersion = proptools.StringPtr(tc.vndkVersion)
variables.KeepVndk = proptools.BoolPtr(true)
}))
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", tc.expectedFiles)
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", tc.expectedFiles)
})
}
}
@ -3927,7 +3872,7 @@ func TestVndkApexWithPrebuilt(t *testing.T) {
"libvndk.so": nil,
"libvndk.arm.so": nil,
}))
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", []string{
"lib/libvndk.so",
"lib/libvndk.arm.so",
"lib64/libvndk.so",
@ -4023,7 +3968,7 @@ func TestVndkApexVersion(t *testing.T) {
"libvndk27_x86_64.so": nil,
}))
ensureExactContents(t, ctx, "com.android.vndk.v27", "android_common_image", []string{
ensureExactContents(t, ctx, "com.android.vndk.v27", "android_common", []string{
"lib/libvndk27_arm.so",
"lib64/libvndk27_arm64.so",
"etc/*",
@ -4052,7 +3997,7 @@ func TestVndkApexNameRule(t *testing.T) {
}`+vndkLibrariesTxtFiles("28", "current"))
assertApexName := func(expected, moduleName string) {
module := ctx.ModuleForTests(moduleName, "android_common_image")
module := ctx.ModuleForTests(moduleName, "android_common")
apexManifestRule := module.Rule("apexManifestRule")
ensureContains(t, apexManifestRule.Args["opt"], "-v name "+expected)
}
@ -4093,7 +4038,7 @@ func TestVndkApexSkipsNativeBridgeSupportedModules(t *testing.T) {
`+vndkLibrariesTxtFiles("current"),
withNativeBridgeEnabled)
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", []string{
"lib/libvndk.so",
"lib64/libvndk.so",
"lib/libc++.so",
@ -4196,7 +4141,7 @@ func TestVndkApexWithBinder32(t *testing.T) {
}),
)
ensureExactContents(t, ctx, "com.android.vndk.v27", "android_common_image", []string{
ensureExactContents(t, ctx, "com.android.vndk.v27", "android_common", []string{
"lib/libvndk27binder32.so",
"etc/*",
})
@ -4233,10 +4178,10 @@ func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) {
"libz.map.txt": nil,
}))
apexManifestRule := ctx.ModuleForTests("com.android.vndk.current", "android_common_image").Rule("apexManifestRule")
apexManifestRule := ctx.ModuleForTests("com.android.vndk.current", "android_common").Rule("apexManifestRule")
provideNativeLibs := names(apexManifestRule.Args["provideNativeLibs"])
ensureListEmpty(t, provideNativeLibs)
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", []string{
"out/soong/.intermediates/libz/android_vendor.29_arm64_armv8-a_shared/libz.so:lib64/libz.so",
"out/soong/.intermediates/libz/android_vendor.29_arm_armv7-a-neon_shared/libz.so:lib/libz.so",
"*/*",
@ -4392,7 +4337,7 @@ func TestVendorApexWithVndkPrebuilts(t *testing.T) {
}))
// Should embed the prebuilt VNDK libraries in the apex
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"bin/foo",
"prebuilts/vndk/libc++.so:lib64/libc++.so",
"prebuilts/vndk/libvndk.so:lib64/libvndk.so",
@ -4406,7 +4351,7 @@ func TestVendorApexWithVndkPrebuilts(t *testing.T) {
android.AssertStringDoesContain(t, "should link to prebuilt libunwind", ldRule.Args["libFlags"], "prebuilts/vndk/libunwind.a")
// Should declare the LLNDK library as a "required" external dependency
manifestRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
manifestRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
requireNativeLibs := names(manifestRule.Args["requireNativeLibs"])
ensureListContains(t, requireNativeLibs, "libllndk.so")
}
@ -4519,25 +4464,25 @@ func TestDependenciesInApexManifest(t *testing.T) {
var apexManifestRule android.TestingBuildParams
var provideNativeLibs, requireNativeLibs []string
apexManifestRule = ctx.ModuleForTests("myapex_nodep", "android_common_myapex_nodep_image").Rule("apexManifestRule")
apexManifestRule = ctx.ModuleForTests("myapex_nodep", "android_common_myapex_nodep").Rule("apexManifestRule")
provideNativeLibs = names(apexManifestRule.Args["provideNativeLibs"])
requireNativeLibs = names(apexManifestRule.Args["requireNativeLibs"])
ensureListEmpty(t, provideNativeLibs)
ensureListEmpty(t, requireNativeLibs)
apexManifestRule = ctx.ModuleForTests("myapex_dep", "android_common_myapex_dep_image").Rule("apexManifestRule")
apexManifestRule = ctx.ModuleForTests("myapex_dep", "android_common_myapex_dep").Rule("apexManifestRule")
provideNativeLibs = names(apexManifestRule.Args["provideNativeLibs"])
requireNativeLibs = names(apexManifestRule.Args["requireNativeLibs"])
ensureListEmpty(t, provideNativeLibs)
ensureListContains(t, requireNativeLibs, "libfoo.so")
apexManifestRule = ctx.ModuleForTests("myapex_provider", "android_common_myapex_provider_image").Rule("apexManifestRule")
apexManifestRule = ctx.ModuleForTests("myapex_provider", "android_common_myapex_provider").Rule("apexManifestRule")
provideNativeLibs = names(apexManifestRule.Args["provideNativeLibs"])
requireNativeLibs = names(apexManifestRule.Args["requireNativeLibs"])
ensureListContains(t, provideNativeLibs, "libfoo.so")
ensureListEmpty(t, requireNativeLibs)
apexManifestRule = ctx.ModuleForTests("myapex_selfcontained", "android_common_myapex_selfcontained_image").Rule("apexManifestRule")
apexManifestRule = ctx.ModuleForTests("myapex_selfcontained", "android_common_myapex_selfcontained").Rule("apexManifestRule")
provideNativeLibs = names(apexManifestRule.Args["provideNativeLibs"])
requireNativeLibs = names(apexManifestRule.Args["requireNativeLibs"])
ensureListContains(t, provideNativeLibs, "libbar.so")
@ -4573,7 +4518,7 @@ func TestOverrideApexManifestDefaultVersion(t *testing.T) {
"OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION": "1234",
}))
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
apexManifestRule := module.Rule("apexManifestRule")
ensureContains(t, apexManifestRule.Args["default_version"], "1234")
}
@ -4636,7 +4581,7 @@ func TestCompileMultilibProp(t *testing.T) {
}
`, testCase.compileMultiLibProp),
)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
for _, containedLib := range testCase.containedLibs {
@ -4675,7 +4620,7 @@ func TestNonTestApex(t *testing.T) {
}
`)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@ -4729,7 +4674,7 @@ func TestTestApex(t *testing.T) {
}
`)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@ -4819,7 +4764,7 @@ func TestApexWithTarget(t *testing.T) {
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that main rule creates an output
@ -4903,7 +4848,7 @@ func TestApexWithArch(t *testing.T) {
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that apex variant is created for the direct dep
@ -4939,7 +4884,7 @@ func TestApexWithShBinary(t *testing.T) {
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
ensureContains(t, copyCmds, "image.apex/bin/script/myscript.sh")
@ -4973,7 +4918,7 @@ func TestApexInVariousPartition(t *testing.T) {
}
`)
apex := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
apex := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
expected := "out/soong/target/product/test_device/" + tc.partition + "/apex"
actual := apex.installDir.RelativeToTop().String()
if actual != expected {
@ -4997,7 +4942,7 @@ func TestFileContexts_FindInDefaultLocationIfNotSet(t *testing.T) {
private_key: "testkey.pem",
}
`)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
rule := module.Output("file_contexts")
ensureContains(t, rule.RuleParams.Command, "cat system/sepolicy/apex/myapex-file_contexts")
}
@ -5055,7 +5000,7 @@ func TestFileContexts_ProductSpecificApexes(t *testing.T) {
`, withFiles(map[string][]byte{
"product_specific_file_contexts": nil,
}))
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
rule := module.Output("file_contexts")
ensureContains(t, rule.RuleParams.Command, "cat product_specific_file_contexts")
}
@ -5083,7 +5028,7 @@ func TestFileContexts_SetViaFileGroup(t *testing.T) {
`, withFiles(map[string][]byte{
"product_specific_file_contexts": nil,
}))
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
rule := module.Output("file_contexts")
ensureContains(t, rule.RuleParams.Command, "cat product_specific_file_contexts")
}
@ -6141,7 +6086,7 @@ func TestApexWithTests(t *testing.T) {
}
`)
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that test dep (and their transitive dependencies) are copied into apex.
@ -6158,7 +6103,7 @@ func TestApexWithTests(t *testing.T) {
ensureContains(t, copyCmds, "image.apex/bin/test/mytest3")
// Ensure the module is correctly translated.
bundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
bundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, bundle)
name := bundle.BaseModuleName()
prefix := "TARGET_"
@ -6241,7 +6186,7 @@ func TestApexWithJavaImport(t *testing.T) {
}
`)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
ensureContains(t, copyCmds, "image.apex/javalib/myjavaimport.jar")
@ -6305,7 +6250,7 @@ func TestApexWithApps(t *testing.T) {
}
`)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@ -6411,7 +6356,7 @@ func TestApexWithAppImports(t *testing.T) {
}
`)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@ -6456,7 +6401,7 @@ func TestApexWithAppImportsPrefer(t *testing.T) {
"AppFooPrebuilt.apk": nil,
}))
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"app/AppFoo@TEST.BUILD_ID/AppFooPrebuilt.apk",
})
}
@ -6486,7 +6431,7 @@ func TestApexWithTestHelperApp(t *testing.T) {
`)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@ -6809,14 +6754,14 @@ func TestApexAvailable_ApexAvailableNameWithVersionCode(t *testing.T) {
}
`)
fooManifestRule := result.ModuleForTests("foo", "android_common_foo_image").Rule("apexManifestRule")
fooManifestRule := result.ModuleForTests("foo", "android_common_foo").Rule("apexManifestRule")
fooExpectedDefaultVersion := android.DefaultUpdatableModuleVersion
fooActualDefaultVersion := fooManifestRule.Args["default_version"]
if fooActualDefaultVersion != fooExpectedDefaultVersion {
t.Errorf("expected to find defaultVersion %q; got %q", fooExpectedDefaultVersion, fooActualDefaultVersion)
}
barManifestRule := result.ModuleForTests("bar", "android_common_bar_image").Rule("apexManifestRule")
barManifestRule := result.ModuleForTests("bar", "android_common_bar").Rule("apexManifestRule")
defaultVersionInt, _ := strconv.Atoi(android.DefaultUpdatableModuleVersion)
barExpectedDefaultVersion := fmt.Sprint(defaultVersionInt + 3)
barActualDefaultVersion := barManifestRule.Args["default_version"]
@ -6824,7 +6769,7 @@ func TestApexAvailable_ApexAvailableNameWithVersionCode(t *testing.T) {
t.Errorf("expected to find defaultVersion %q; got %q", barExpectedDefaultVersion, barActualDefaultVersion)
}
overrideBarManifestRule := result.ModuleForTests("bar", "android_common_myoverrideapex_bar_image").Rule("apexManifestRule")
overrideBarManifestRule := result.ModuleForTests("bar", "android_common_myoverrideapex_bar").Rule("apexManifestRule")
overrideBarActualDefaultVersion := overrideBarManifestRule.Args["default_version"]
if overrideBarActualDefaultVersion != barExpectedDefaultVersion {
t.Errorf("expected to find defaultVersion %q; got %q", barExpectedDefaultVersion, barActualDefaultVersion)
@ -7184,8 +7129,8 @@ func TestOverrideApex(t *testing.T) {
}
`, withManifestPackageNameOverrides([]string{"myapex:com.android.myapex"}))
originalVariant := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(android.OverridableModule)
overriddenVariant := ctx.ModuleForTests("myapex", "android_common_override_myapex_myapex_image").Module().(android.OverridableModule)
originalVariant := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(android.OverridableModule)
overriddenVariant := ctx.ModuleForTests("myapex", "android_common_override_myapex_myapex").Module().(android.OverridableModule)
if originalVariant.GetOverriddenBy() != "" {
t.Errorf("GetOverriddenBy should be empty, but was %q", originalVariant.GetOverriddenBy())
}
@ -7193,7 +7138,7 @@ func TestOverrideApex(t *testing.T) {
t.Errorf("GetOverriddenBy should be \"override_myapex\", but was %q", overriddenVariant.GetOverriddenBy())
}
module := ctx.ModuleForTests("myapex", "android_common_override_myapex_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_override_myapex_myapex")
apexRule := module.Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
@ -7283,7 +7228,7 @@ func TestMinSdkVersionOverride(t *testing.T) {
`, withApexGlobalMinSdkVersionOverride(&minSdkOverride31))
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@ -7342,7 +7287,7 @@ func TestMinSdkVersionOverrideToLowerVersionNoOp(t *testing.T) {
`, withApexGlobalMinSdkVersionOverride(&minSdkOverride29))
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
copyCmds := apexRule.Args["copy_commands"]
// Ensure that direct non-stubs dep is always included
@ -7380,7 +7325,7 @@ func TestLegacyAndroid10Support(t *testing.T) {
}
`, withUnbundledBuild)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
args := module.Rule("apexRule").Args
ensureContains(t, args["opt_flags"], "--manifest_json "+module.Output("apex_manifest.json").Output.String())
ensureNotContains(t, args["opt_flags"], "--no_hashtree")
@ -7444,7 +7389,7 @@ func TestJavaSDKLibrary(t *testing.T) {
`, withFiles(filesForSdkLibrary))
// java_sdk_library installs both impl jar and permission XML
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"javalib/foo.jar",
"etc/permissions/foo.xml",
})
@ -7493,7 +7438,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) {
`, withFiles(filesForSdkLibrary))
// java_sdk_library installs both impl jar and permission XML
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"javalib/bar.jar",
"javalib/foo.jar",
"etc/permissions/foo.xml",
@ -7545,7 +7490,7 @@ func TestJavaSDKLibrary_CrossBoundary(t *testing.T) {
`, withFiles(filesForSdkLibrary))
// java_sdk_library installs both impl jar and permission XML
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"javalib/foo.jar",
"etc/permissions/foo.xml",
})
@ -7634,7 +7579,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) {
)
// java_sdk_library installs both impl jar and permission XML
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"javalib/bar.jar",
"javalib/foo.jar",
"etc/permissions/foo.xml",
@ -7714,7 +7659,7 @@ func TestCompatConfig(t *testing.T) {
}
`)
ctx := result.TestContext
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"etc/compatconfig/myjar-platform-compat-config.xml",
"javalib/myjar.jar",
})
@ -7809,7 +7754,7 @@ func TestCarryRequiredModuleNames(t *testing.T) {
}
`)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
name := apexBundle.BaseModuleName()
prefix := "TARGET_"
@ -7948,13 +7893,13 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
// For unbundled build, symlink shouldn't exist regardless of whether an APEX
// is updatable or not
ctx := testApex(t, bp, withUnbundledBuild)
files := getFiles(t, ctx, "myapex", "android_common_myapex_image")
files := getFiles(t, ctx, "myapex", "android_common_myapex")
ensureRealfileExists(t, files, "javalib/myjar.jar")
ensureRealfileExists(t, files, "lib64/mylib.so")
ensureRealfileExists(t, files, "lib64/myotherlib.so")
ensureRealfileExists(t, files, "lib64/myotherlib_ext.so")
files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable_image")
files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable")
ensureRealfileExists(t, files, "javalib/myjar.jar")
ensureRealfileExists(t, files, "lib64/mylib.so")
ensureRealfileExists(t, files, "lib64/myotherlib.so")
@ -7962,13 +7907,13 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
// For bundled build, symlink to the system for the non-updatable APEXes only
ctx = testApex(t, bp)
files = getFiles(t, ctx, "myapex", "android_common_myapex_image")
files = getFiles(t, ctx, "myapex", "android_common_myapex")
ensureRealfileExists(t, files, "javalib/myjar.jar")
ensureRealfileExists(t, files, "lib64/mylib.so")
ensureSymlinkExists(t, files, "lib64/myotherlib.so", "/system/lib64/myotherlib.so") // this is symlink
ensureSymlinkExists(t, files, "lib64/myotherlib_ext.so", "/system_ext/lib64/myotherlib_ext.so") // this is symlink
files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable_image")
files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable")
ensureRealfileExists(t, files, "javalib/myjar.jar")
ensureRealfileExists(t, files, "lib64/mylib.so")
ensureRealfileExists(t, files, "lib64/myotherlib.so") // this is a real file
@ -8014,7 +7959,7 @@ func TestSymlinksFromApexToSystemRequiredModuleNames(t *testing.T) {
}
`)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
var builder strings.Builder
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
@ -8080,10 +8025,10 @@ func TestApexWithJniLibs(t *testing.T) {
`)
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexManifestRule")
// Notice mylib2.so (transitive dep) is not added as a jni_lib
ensureEquals(t, rule.Args["opt"], "-a jniLibs libfoo.rust.so mylib.so")
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"lib64/mylib.so",
"lib64/mylib2.so",
"lib64/libfoo.rust.so",
@ -8143,7 +8088,7 @@ func TestAppBundle(t *testing.T) {
}
`, withManifestPackageNameOverrides([]string{"AppFoo:com.android.foo"}))
bundleConfigRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("bundle_config.json")
bundleConfigRule := ctx.ModuleForTests("myapex", "android_common_myapex").Output("bundle_config.json")
content := bundleConfigRule.Args["content"]
ensureContains(t, content, `"compression":{"uncompressed_glob":["apex_payload.img","apex_manifest.*"]}`)
@ -8169,7 +8114,7 @@ func TestAppSetBundle(t *testing.T) {
name: "AppSet",
set: "AppSet.apks",
}`)
mod := ctx.ModuleForTests("myapex", "android_common_myapex_image")
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
bundleConfigRule := mod.Output("bundle_config.json")
content := bundleConfigRule.Args["content"]
ensureContains(t, content, `"compression":{"uncompressed_glob":["apex_payload.img","apex_manifest.*"]}`)
@ -9207,12 +9152,12 @@ func TestAllowedFiles(t *testing.T) {
`),
}))
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("diffApexContentRule")
rule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("diffApexContentRule")
if expected, actual := "allowed.txt", rule.Args["allowed_files_file"]; expected != actual {
t.Errorf("allowed_files_file: expected %q but got %q", expected, actual)
}
rule2 := ctx.ModuleForTests("myapex", "android_common_override_myapex_myapex_image").Rule("diffApexContentRule")
rule2 := ctx.ModuleForTests("myapex", "android_common_override_myapex_myapex").Rule("diffApexContentRule")
if expected, actual := "sub/allowed.txt", rule2.Args["allowed_files_file"]; expected != actual {
t.Errorf("allowed_files_file: expected %q but got %q", expected, actual)
}
@ -9273,14 +9218,14 @@ func TestCompressedApex(t *testing.T) {
}),
)
compressRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("compressRule")
compressRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("compressRule")
ensureContains(t, compressRule.Output.String(), "myapex.capex.unsigned")
signApkRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Description("sign compressedApex")
signApkRule := ctx.ModuleForTests("myapex", "android_common_myapex").Description("sign compressedApex")
ensureEquals(t, signApkRule.Input.String(), compressRule.Output.String())
// Make sure output of bundle is .capex
ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
ab := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
ensureContains(t, ab.outputFile.String(), "myapex.capex")
// Verify android.mk rules
@ -9332,7 +9277,7 @@ func TestPreferredPrebuiltSharedLibDep(t *testing.T) {
}
`)
ab := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
ab := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
@ -9389,7 +9334,7 @@ func TestExcludeDependency(t *testing.T) {
ensureNotContains(t, ldFlags, "mylib2/android_arm64_armv8-a_shared_apex10000/mylib2.so")
// It shouldn't appear in the copy cmd as well.
copyCmds := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule").Args["copy_commands"]
copyCmds := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule").Args["copy_commands"]
ensureNotContains(t, copyCmds, "image.apex/lib64/mylib2.so")
}
@ -9554,28 +9499,6 @@ func TestPrebuiltStubLibDep(t *testing.T) {
}
}
func TestHostApexInHostOnlyBuild(t *testing.T) {
testApex(t, `
apex {
name: "myapex",
host_supported: true,
key: "myapex.key",
updatable: false,
payload_type: "zip",
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
`,
android.FixtureModifyConfig(func(config android.Config) {
// We may not have device targets in all builds, e.g. in
// prebuilts/build-tools/build-prebuilts.sh
config.Targets[android.Android] = []android.Target{}
}))
}
func TestApexJavaCoverage(t *testing.T) {
bp := `
apex {
@ -9729,7 +9652,7 @@ func TestAndroidMk_DexpreoptBuiltInstalledForApex(t *testing.T) {
dexpreopt.FixtureSetApexSystemServerJars("myapex:foo"),
)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
var builder strings.Builder
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
@ -9805,7 +9728,7 @@ func TestAndroidMk_RequiredModules(t *testing.T) {
}
`)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, apexBundle)
var builder strings.Builder
data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
@ -9828,7 +9751,7 @@ func TestAndroidMk_RequiredDeps(t *testing.T) {
}
`)
bundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
bundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
bundle.makeModulesToInstall = append(bundle.makeModulesToInstall, "foo")
data := android.AndroidMkDataForTest(t, ctx, bundle)
var builder strings.Builder
@ -9846,12 +9769,12 @@ func TestApexOutputFileProducer(t *testing.T) {
{
name: "test_using_output",
ref: ":myapex",
expected_data: []string{"out/soong/.intermediates/myapex/android_common_myapex_image/myapex.capex:myapex.capex"},
expected_data: []string{"out/soong/.intermediates/myapex/android_common_myapex/myapex.capex:myapex.capex"},
},
{
name: "test_using_apex",
ref: ":myapex{.apex}",
expected_data: []string{"out/soong/.intermediates/myapex/android_common_myapex_image/myapex.apex:myapex.apex"},
expected_data: []string{"out/soong/.intermediates/myapex/android_common_myapex/myapex.apex:myapex.apex"},
},
} {
t.Run(tc.name, func(t *testing.T) {
@ -10587,14 +10510,14 @@ func TestTrimmedApex(t *testing.T) {
}
`
ctx := testApex(t, bp)
module := ctx.ModuleForTests("myapex", "android_common_myapex_image")
module := ctx.ModuleForTests("myapex", "android_common_myapex")
apexRule := module.MaybeRule("apexRule")
if apexRule.Rule == nil {
t.Errorf("Expecting regular apex rule but a non regular apex rule found")
}
ctx = testApex(t, bp, android.FixtureModifyConfig(android.SetTrimmedApexEnabledForTests))
trimmedApexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("TrimmedApexRule")
trimmedApexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("TrimmedApexRule")
libs_to_trim := trimmedApexRule.Args["libs_to_trim"]
android.AssertStringDoesContain(t, "missing lib to trim", libs_to_trim, "libfoo")
android.AssertStringDoesContain(t, "missing lib to trim", libs_to_trim, "libbar")
@ -10614,7 +10537,7 @@ func TestCannedFsConfig(t *testing.T) {
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}`)
mod := ctx.ModuleForTests("myapex", "android_common_myapex_image")
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
generateFsRule := mod.Rule("generateFsConfig")
cmd := generateFsRule.RuleParams.Command
@ -10635,7 +10558,7 @@ func TestCannedFsConfig_HasCustomConfig(t *testing.T) {
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}`)
mod := ctx.ModuleForTests("myapex", "android_common_myapex_image")
mod := ctx.ModuleForTests("myapex", "android_common_myapex")
generateFsRule := mod.Rule("generateFsConfig")
cmd := generateFsRule.RuleParams.Command

View file

@ -302,14 +302,14 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"),
).RunTest(t)
ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{
"etc/boot-image.prof",
"etc/classpaths/bootclasspath.pb",
"javalib/bar.jar",
"javalib/foo.jar",
})
java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{
`art-bootclasspath-fragment`,
`com.android.art.key`,
})
@ -332,7 +332,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
dexpreopt.FixtureDisableDexpreoptBootImages(true),
).RunTest(t)
ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{
"etc/boot-image.prof",
"etc/classpaths/bootclasspath.pb",
"javalib/bar.jar",
@ -351,7 +351,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
dexpreopt.FixtureDisableGenerateProfile(true),
).RunTest(t)
files := getFiles(t, result.TestContext, "com.android.art", "android_common_com.android.art_image")
files := getFiles(t, result.TestContext, "com.android.art", "android_common_com.android.art")
for _, file := range files {
matched, _ := path.Match("etc/boot-image.prof", file.path)
android.AssertBoolEquals(t, "\"etc/boot-image.prof\" should not be in the APEX", matched, false)
@ -380,7 +380,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
"javalib/foo.jar",
})
java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art", []string{
`art-bootclasspath-fragment`,
`com.android.art.key`,
`prebuilt_com.android.art`,
@ -635,7 +635,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) {
}
`)
ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex", []string{
// This does not include art, oat or vdex files as they are only included for the art boot
// image.
"etc/classpaths/bootclasspath.pb",
@ -643,12 +643,12 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) {
"javalib/foo.jar",
})
java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex", []string{
`myapex.key`,
`mybootclasspathfragment`,
})
apex := result.ModuleForTests("myapex", "android_common_myapex_image")
apex := result.ModuleForTests("myapex", "android_common_myapex")
apexRule := apex.Rule("apexRule")
copyCommands := apexRule.Args["copy_commands"]
@ -665,7 +665,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) {
}
android.AssertPathRelativeToTopEquals(t, name+" dex", expectedDexJar, dexJar)
expectedCopyCommand := fmt.Sprintf("&& cp -f %s out/soong/.intermediates/myapex/android_common_myapex_image/image.apex/javalib/%s.jar", expectedDexJar, name)
expectedCopyCommand := fmt.Sprintf("&& cp -f %s out/soong/.intermediates/myapex/android_common_myapex/image.apex/javalib/%s.jar", expectedDexJar, name)
android.AssertStringDoesContain(t, name+" apex copy command", copyCommands, expectedCopyCommand)
}

View file

@ -80,7 +80,7 @@ apex {
}),
).RunTestWithBp(t, bp)
m := result.ModuleForTests("foo", "android_common_foo_image").Module()
m := result.ModuleForTests("foo", "android_common_foo").Module()
ab, ok := m.(*apexBundle)
if !ok {
@ -206,7 +206,7 @@ apex {
}),
).RunTestWithBp(t, bp)
m := result.ModuleForTests("foo", "android_common_foo_image").Module()
m := result.ModuleForTests("foo", "android_common_foo").Module()
ab, ok := m.(*apexBundle)
if !ok {
@ -299,7 +299,7 @@ apex {
}),
).RunTestWithBp(t, bp)
m := result.ModuleForTests("foo", "android_common_foo_image").Module()
m := result.ModuleForTests("foo", "android_common_foo").Module()
ab, ok := m.(*apexBundle)
if !ok {
t.Fatalf("Expected module to be an apexBundle, was not")
@ -483,7 +483,7 @@ override_apex {
}),
).RunTest(t)
m := result.ModuleForTests("foo", "android_common_override_foo_foo_image").Module()
m := result.ModuleForTests("foo", "android_common_override_foo_foo").Module()
ab, ok := m.(*apexBundle)
if !ok {
t.Fatalf("Expected module to be an apexBundle, was not")

View file

@ -179,19 +179,6 @@ var (
}, "tool_path", "image_dir", "copy_commands", "file_contexts", "canned_fs_config", "key",
"opt_flags", "manifest", "libs_to_trim")
zipApexRule = pctx.StaticRule("zipApexRule", blueprint.RuleParams{
Command: `rm -rf ${image_dir} && mkdir -p ${image_dir} && ` +
`(. ${out}.copy_commands) && ` +
`APEXER_TOOL_PATH=${tool_path} ` +
`${apexer} --force --manifest ${manifest} ` +
`--payload_type zip ` +
`${image_dir} ${out} `,
CommandDeps: []string{"${apexer}", "${merge_zips}", "${soong_zip}", "${zipalign}", "${aapt2}"},
Rspfile: "${out}.copy_commands",
RspfileContent: "${copy_commands}",
Description: "ZipAPEX ${image_dir} => ${out}",
}, "tool_path", "image_dir", "copy_commands", "manifest")
apexProtoConvertRule = pctx.AndroidStaticRule("apexProtoConvertRule",
blueprint.RuleParams{
Command: `${aapt2} convert --output-format proto $in -o $out`,
@ -369,21 +356,16 @@ func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.Output
// even though VNDK APEX is supposed to be installed on /system. (See com.android.vndk.current.on_vendor)
forceLabel = "u:object_r:vendor_apex_metadata_file:s0"
}
switch a.properties.ApexType {
case imageApex:
// remove old file
rule.Command().Text("rm").FlagWithOutput("-f ", output)
// copy file_contexts
rule.Command().Text("cat").Input(fileContexts).Text(">>").Output(output)
// new line
rule.Command().Text("echo").Text(">>").Output(output)
if !useFileContextsAsIs {
// force-label /apex_manifest.pb and /
rule.Command().Text("echo").Text("/apex_manifest\\\\.pb").Text(forceLabel).Text(">>").Output(output)
rule.Command().Text("echo").Text("/").Text(forceLabel).Text(">>").Output(output)
}
default:
panic(fmt.Errorf("unsupported type %v", a.properties.ApexType))
// remove old file
rule.Command().Text("rm").FlagWithOutput("-f ", output)
// copy file_contexts
rule.Command().Text("cat").Input(fileContexts).Text(">>").Output(output)
// new line
rule.Command().Text("echo").Text(">>").Output(output)
if !useFileContextsAsIs {
// force-label /apex_manifest.pb and /
rule.Command().Text("echo").Text("/apex_manifest\\\\.pb").Text(forceLabel).Text(">>").Output(output)
rule.Command().Text("echo").Text("/").Text(forceLabel).Text(">>").Output(output)
}
rule.Build("file_contexts."+a.Name(), "Generate file_contexts")
@ -464,8 +446,7 @@ func markManifestTestOnly(ctx android.ModuleContext, androidManifestFile android
// buildApex creates build rules to build an APEX using apexer.
func (a *apexBundle) buildApex(ctx android.ModuleContext) {
apexType := a.properties.ApexType
suffix := apexType.suffix()
suffix := imageApexSuffix
apexName := a.BaseModuleName()
////////////////////////////////////////////////////////////////////////////////////////////
@ -604,263 +585,247 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) {
outHostBinDir := ctx.Config().HostToolPath(ctx, "").String()
prebuiltSdkToolsBinDir := filepath.Join("prebuilts", "sdk", "tools", runtime.GOOS, "bin")
if apexType == imageApex {
////////////////////////////////////////////////////////////////////////////////////
// Step 2: create canned_fs_config which encodes filemode,uid,gid of each files
// in this APEX. The file will be used by apexer in later steps.
cannedFsConfig := a.buildCannedFsConfig(ctx)
implicitInputs = append(implicitInputs, cannedFsConfig)
////////////////////////////////////////////////////////////////////////////////////
// Step 2: create canned_fs_config which encodes filemode,uid,gid of each files
// in this APEX. The file will be used by apexer in later steps.
cannedFsConfig := a.buildCannedFsConfig(ctx)
implicitInputs = append(implicitInputs, cannedFsConfig)
////////////////////////////////////////////////////////////////////////////////////
// Step 3: Prepare option flags for apexer and invoke it to create an unsigned APEX.
// TODO(jiyong): use the RuleBuilder
optFlags := []string{}
////////////////////////////////////////////////////////////////////////////////////
// Step 3: Prepare option flags for apexer and invoke it to create an unsigned APEX.
// TODO(jiyong): use the RuleBuilder
optFlags := []string{}
fileContexts := a.buildFileContexts(ctx)
implicitInputs = append(implicitInputs, fileContexts)
fileContexts := a.buildFileContexts(ctx)
implicitInputs = append(implicitInputs, fileContexts)
implicitInputs = append(implicitInputs, a.privateKeyFile, a.publicKeyFile)
optFlags = append(optFlags, "--pubkey "+a.publicKeyFile.String())
implicitInputs = append(implicitInputs, a.privateKeyFile, a.publicKeyFile)
optFlags = append(optFlags, "--pubkey "+a.publicKeyFile.String())
manifestPackageName := a.getOverrideManifestPackageName(ctx)
if manifestPackageName != "" {
optFlags = append(optFlags, "--override_apk_package_name "+manifestPackageName)
}
manifestPackageName := a.getOverrideManifestPackageName(ctx)
if manifestPackageName != "" {
optFlags = append(optFlags, "--override_apk_package_name "+manifestPackageName)
if a.properties.AndroidManifest != nil {
androidManifestFile := android.PathForModuleSrc(ctx, proptools.String(a.properties.AndroidManifest))
if a.testApex {
androidManifestFile = markManifestTestOnly(ctx, androidManifestFile)
}
if a.properties.AndroidManifest != nil {
androidManifestFile := android.PathForModuleSrc(ctx, proptools.String(a.properties.AndroidManifest))
implicitInputs = append(implicitInputs, androidManifestFile)
optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String())
} else if a.testApex {
optFlags = append(optFlags, "--test_only")
}
if a.testApex {
androidManifestFile = markManifestTestOnly(ctx, androidManifestFile)
}
// Determine target/min sdk version from the context
// TODO(jiyong): make this as a function
moduleMinSdkVersion := a.minSdkVersion(ctx)
minSdkVersion := moduleMinSdkVersion.String()
implicitInputs = append(implicitInputs, androidManifestFile)
optFlags = append(optFlags, "--android_manifest "+androidManifestFile.String())
} else if a.testApex {
optFlags = append(optFlags, "--test_only")
}
// Determine target/min sdk version from the context
// TODO(jiyong): make this as a function
moduleMinSdkVersion := a.minSdkVersion(ctx)
minSdkVersion := moduleMinSdkVersion.String()
// bundletool doesn't understand what "current" is. We need to transform it to
// codename
if moduleMinSdkVersion.IsCurrent() || moduleMinSdkVersion.IsNone() {
minSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
if java.UseApiFingerprint(ctx) {
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
}
}
// apex module doesn't have a concept of target_sdk_version, hence for the time
// being targetSdkVersion == default targetSdkVersion of the branch.
targetSdkVersion := strconv.Itoa(ctx.Config().DefaultAppTargetSdk(ctx).FinalOrFutureInt())
// bundletool doesn't understand what "current" is. We need to transform it to
// codename
if moduleMinSdkVersion.IsCurrent() || moduleMinSdkVersion.IsNone() {
minSdkVersion = ctx.Config().DefaultAppTargetSdk(ctx).String()
if java.UseApiFingerprint(ctx) {
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
}
optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion)
optFlags = append(optFlags, "--min_sdk_version "+minSdkVersion)
}
// apex module doesn't have a concept of target_sdk_version, hence for the time
// being targetSdkVersion == default targetSdkVersion of the branch.
targetSdkVersion := strconv.Itoa(ctx.Config().DefaultAppTargetSdk(ctx).FinalOrFutureInt())
if a.overridableProperties.Logging_parent != "" {
optFlags = append(optFlags, "--logging_parent ", a.overridableProperties.Logging_parent)
}
if java.UseApiFingerprint(ctx) {
targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", java.ApiFingerprintPath(ctx).String())
implicitInputs = append(implicitInputs, java.ApiFingerprintPath(ctx))
}
optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion)
optFlags = append(optFlags, "--min_sdk_version "+minSdkVersion)
// Create a NOTICE file, and embed it as an asset file in the APEX.
htmlGzNotice := android.PathForModuleOut(ctx, "NOTICE.html.gz")
android.BuildNoticeHtmlOutputFromLicenseMetadata(
ctx, htmlGzNotice, "", "",
[]string{
android.PathForModuleInstall(ctx).String() + "/",
android.PathForModuleInPartitionInstall(ctx, "apex").String() + "/",
})
noticeAssetPath := android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
builder := android.NewRuleBuilder(pctx, ctx)
builder.Command().Text("cp").
Input(htmlGzNotice).
Output(noticeAssetPath)
builder.Build("notice_dir", "Building notice dir")
implicitInputs = append(implicitInputs, noticeAssetPath)
optFlags = append(optFlags, "--assets_dir "+filepath.Dir(noticeAssetPath.String()))
if a.overridableProperties.Logging_parent != "" {
optFlags = append(optFlags, "--logging_parent ", a.overridableProperties.Logging_parent)
}
// Apexes which are supposed to be installed in builtin dirs(/system, etc)
// don't need hashtree for activation. Therefore, by removing hashtree from
// apex bundle (filesystem image in it, to be specific), we can save storage.
needHashTree := moduleMinSdkVersion.LessThanOrEqualTo(android.SdkVersion_Android10) ||
a.shouldGenerateHashtree()
if ctx.Config().ApexCompressionEnabled() && a.isCompressable() {
needHashTree = true
}
if !needHashTree {
optFlags = append(optFlags, "--no_hashtree")
}
if a.testOnlyShouldSkipPayloadSign() {
optFlags = append(optFlags, "--unsigned_payload")
}
if moduleMinSdkVersion == android.SdkVersion_Android10 {
implicitInputs = append(implicitInputs, a.manifestJsonOut)
optFlags = append(optFlags, "--manifest_json "+a.manifestJsonOut.String())
}
optFlags = append(optFlags, "--payload_fs_type "+a.payloadFsType.string())
if a.dynamic_common_lib_apex() {
ctx.Build(pctx, android.BuildParams{
Rule: DCLAApexRule,
Implicits: implicitInputs,
Output: unsignedOutputFile,
Description: "apex (" + apexType.name() + ")",
Args: map[string]string{
"tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
"image_dir": imageDir.String(),
"copy_commands": strings.Join(copyCommands, " && "),
"manifest": a.manifestPbOut.String(),
"file_contexts": fileContexts.String(),
"canned_fs_config": cannedFsConfig.String(),
"key": a.privateKeyFile.String(),
"opt_flags": strings.Join(optFlags, " "),
},
})
} else if ctx.Config().ApexTrimEnabled() && len(a.libs_to_trim(ctx)) > 0 {
ctx.Build(pctx, android.BuildParams{
Rule: TrimmedApexRule,
Implicits: implicitInputs,
Output: unsignedOutputFile,
Description: "apex (" + apexType.name() + ")",
Args: map[string]string{
"tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
"image_dir": imageDir.String(),
"copy_commands": strings.Join(copyCommands, " && "),
"manifest": a.manifestPbOut.String(),
"file_contexts": fileContexts.String(),
"canned_fs_config": cannedFsConfig.String(),
"key": a.privateKeyFile.String(),
"opt_flags": strings.Join(optFlags, " "),
"libs_to_trim": strings.Join(a.libs_to_trim(ctx), ","),
},
})
} else {
ctx.Build(pctx, android.BuildParams{
Rule: apexRule,
Implicits: implicitInputs,
Output: unsignedOutputFile,
Description: "apex (" + apexType.name() + ")",
Args: map[string]string{
"tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
"image_dir": imageDir.String(),
"copy_commands": strings.Join(copyCommands, " && "),
"manifest": a.manifestPbOut.String(),
"file_contexts": fileContexts.String(),
"canned_fs_config": cannedFsConfig.String(),
"key": a.privateKeyFile.String(),
"opt_flags": strings.Join(optFlags, " "),
},
})
}
// TODO(jiyong): make the two rules below as separate functions
apexProtoFile := android.PathForModuleOut(ctx, a.Name()+".pb"+suffix)
bundleModuleFile := android.PathForModuleOut(ctx, a.Name()+suffix+"-base.zip")
a.bundleModuleFile = bundleModuleFile
ctx.Build(pctx, android.BuildParams{
Rule: apexProtoConvertRule,
Input: unsignedOutputFile,
Output: apexProtoFile,
Description: "apex proto convert",
// Create a NOTICE file, and embed it as an asset file in the APEX.
htmlGzNotice := android.PathForModuleOut(ctx, "NOTICE.html.gz")
android.BuildNoticeHtmlOutputFromLicenseMetadata(
ctx, htmlGzNotice, "", "",
[]string{
android.PathForModuleInstall(ctx).String() + "/",
android.PathForModuleInPartitionInstall(ctx, "apex").String() + "/",
})
noticeAssetPath := android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
builder := android.NewRuleBuilder(pctx, ctx)
builder.Command().Text("cp").
Input(htmlGzNotice).
Output(noticeAssetPath)
builder.Build("notice_dir", "Building notice dir")
implicitInputs = append(implicitInputs, noticeAssetPath)
optFlags = append(optFlags, "--assets_dir "+filepath.Dir(noticeAssetPath.String()))
implicitInputs = append(implicitInputs, unsignedOutputFile)
// Apexes which are supposed to be installed in builtin dirs(/system, etc)
// don't need hashtree for activation. Therefore, by removing hashtree from
// apex bundle (filesystem image in it, to be specific), we can save storage.
needHashTree := moduleMinSdkVersion.LessThanOrEqualTo(android.SdkVersion_Android10) ||
a.shouldGenerateHashtree()
if ctx.Config().ApexCompressionEnabled() && a.isCompressable() {
needHashTree = true
}
if !needHashTree {
optFlags = append(optFlags, "--no_hashtree")
}
// Run coverage analysis
apisUsedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_using.txt")
if a.testOnlyShouldSkipPayloadSign() {
optFlags = append(optFlags, "--unsigned_payload")
}
if moduleMinSdkVersion == android.SdkVersion_Android10 {
implicitInputs = append(implicitInputs, a.manifestJsonOut)
optFlags = append(optFlags, "--manifest_json "+a.manifestJsonOut.String())
}
optFlags = append(optFlags, "--payload_fs_type "+a.payloadFsType.string())
if a.dynamic_common_lib_apex() {
ctx.Build(pctx, android.BuildParams{
Rule: generateAPIsUsedbyApexRule,
Implicits: implicitInputs,
Description: "coverage",
Output: apisUsedbyOutputFile,
Args: map[string]string{
"image_dir": imageDir.String(),
"readelf": "${config.ClangBin}/llvm-readelf",
},
})
a.nativeApisUsedByModuleFile = apisUsedbyOutputFile
var nativeLibNames []string
for _, f := range a.filesInfo {
if f.class == nativeSharedLib {
nativeLibNames = append(nativeLibNames, f.stem())
}
}
apisBackedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_backing.txt")
rule := android.NewRuleBuilder(pctx, ctx)
rule.Command().
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_ndk_backedby_apex.sh")).
Output(apisBackedbyOutputFile).
Flags(nativeLibNames)
rule.Build("ndk_backedby_list", "Generate API libraries backed by Apex")
a.nativeApisBackedByModuleFile = apisBackedbyOutputFile
var javaLibOrApkPath []android.Path
for _, f := range a.filesInfo {
if f.class == javaSharedLib || f.class == app {
javaLibOrApkPath = append(javaLibOrApkPath, f.builtFile)
}
}
javaApiUsedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_using.xml")
javaUsedByRule := android.NewRuleBuilder(pctx, ctx)
javaUsedByRule.Command().
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_java_usedby_apex.sh")).
BuiltTool("dexdeps").
Output(javaApiUsedbyOutputFile).
Inputs(javaLibOrApkPath)
javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex")
a.javaApisUsedByModuleFile = javaApiUsedbyOutputFile
bundleConfig := a.buildBundleConfig(ctx)
var abis []string
for _, target := range ctx.MultiTargets() {
if len(target.Arch.Abi) > 0 {
abis = append(abis, target.Arch.Abi[0])
}
}
abis = android.FirstUniqueStrings(abis)
ctx.Build(pctx, android.BuildParams{
Rule: apexBundleRule,
Input: apexProtoFile,
Implicit: bundleConfig,
Output: a.bundleModuleFile,
Description: "apex bundle module",
Args: map[string]string{
"abi": strings.Join(abis, "."),
"config": bundleConfig.String(),
},
})
} else { // zipApex
ctx.Build(pctx, android.BuildParams{
Rule: zipApexRule,
Rule: DCLAApexRule,
Implicits: implicitInputs,
Output: unsignedOutputFile,
Description: "apex (" + apexType.name() + ")",
Description: "apex",
Args: map[string]string{
"tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
"image_dir": imageDir.String(),
"copy_commands": strings.Join(copyCommands, " && "),
"manifest": a.manifestPbOut.String(),
"tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
"image_dir": imageDir.String(),
"copy_commands": strings.Join(copyCommands, " && "),
"manifest": a.manifestPbOut.String(),
"file_contexts": fileContexts.String(),
"canned_fs_config": cannedFsConfig.String(),
"key": a.privateKeyFile.String(),
"opt_flags": strings.Join(optFlags, " "),
},
})
} else if ctx.Config().ApexTrimEnabled() && len(a.libs_to_trim(ctx)) > 0 {
ctx.Build(pctx, android.BuildParams{
Rule: TrimmedApexRule,
Implicits: implicitInputs,
Output: unsignedOutputFile,
Description: "apex",
Args: map[string]string{
"tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
"image_dir": imageDir.String(),
"copy_commands": strings.Join(copyCommands, " && "),
"manifest": a.manifestPbOut.String(),
"file_contexts": fileContexts.String(),
"canned_fs_config": cannedFsConfig.String(),
"key": a.privateKeyFile.String(),
"opt_flags": strings.Join(optFlags, " "),
"libs_to_trim": strings.Join(a.libs_to_trim(ctx), ","),
},
})
} else {
ctx.Build(pctx, android.BuildParams{
Rule: apexRule,
Implicits: implicitInputs,
Output: unsignedOutputFile,
Description: "apex",
Args: map[string]string{
"tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
"image_dir": imageDir.String(),
"copy_commands": strings.Join(copyCommands, " && "),
"manifest": a.manifestPbOut.String(),
"file_contexts": fileContexts.String(),
"canned_fs_config": cannedFsConfig.String(),
"key": a.privateKeyFile.String(),
"opt_flags": strings.Join(optFlags, " "),
},
})
}
// TODO(jiyong): make the two rules below as separate functions
apexProtoFile := android.PathForModuleOut(ctx, a.Name()+".pb"+suffix)
bundleModuleFile := android.PathForModuleOut(ctx, a.Name()+suffix+"-base.zip")
a.bundleModuleFile = bundleModuleFile
ctx.Build(pctx, android.BuildParams{
Rule: apexProtoConvertRule,
Input: unsignedOutputFile,
Output: apexProtoFile,
Description: "apex proto convert",
})
implicitInputs = append(implicitInputs, unsignedOutputFile)
// Run coverage analysis
apisUsedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_using.txt")
ctx.Build(pctx, android.BuildParams{
Rule: generateAPIsUsedbyApexRule,
Implicits: implicitInputs,
Description: "coverage",
Output: apisUsedbyOutputFile,
Args: map[string]string{
"image_dir": imageDir.String(),
"readelf": "${config.ClangBin}/llvm-readelf",
},
})
a.nativeApisUsedByModuleFile = apisUsedbyOutputFile
var nativeLibNames []string
for _, f := range a.filesInfo {
if f.class == nativeSharedLib {
nativeLibNames = append(nativeLibNames, f.stem())
}
}
apisBackedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_backing.txt")
rb := android.NewRuleBuilder(pctx, ctx)
rb.Command().
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_ndk_backedby_apex.sh")).
Output(apisBackedbyOutputFile).
Flags(nativeLibNames)
rb.Build("ndk_backedby_list", "Generate API libraries backed by Apex")
a.nativeApisBackedByModuleFile = apisBackedbyOutputFile
var javaLibOrApkPath []android.Path
for _, f := range a.filesInfo {
if f.class == javaSharedLib || f.class == app {
javaLibOrApkPath = append(javaLibOrApkPath, f.builtFile)
}
}
javaApiUsedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_using.xml")
javaUsedByRule := android.NewRuleBuilder(pctx, ctx)
javaUsedByRule.Command().
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_java_usedby_apex.sh")).
BuiltTool("dexdeps").
Output(javaApiUsedbyOutputFile).
Inputs(javaLibOrApkPath)
javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex")
a.javaApisUsedByModuleFile = javaApiUsedbyOutputFile
bundleConfig := a.buildBundleConfig(ctx)
var abis []string
for _, target := range ctx.MultiTargets() {
if len(target.Arch.Abi) > 0 {
abis = append(abis, target.Arch.Abi[0])
}
}
abis = android.FirstUniqueStrings(abis)
ctx.Build(pctx, android.BuildParams{
Rule: apexBundleRule,
Input: apexProtoFile,
Implicit: bundleConfig,
Output: a.bundleModuleFile,
Description: "apex bundle module",
Args: map[string]string{
"abi": strings.Join(abis, "."),
"config": bundleConfig.String(),
},
})
////////////////////////////////////////////////////////////////////////////////////
// Step 4: Sign the APEX using signapk
signedOutputFile := android.PathForModuleOut(ctx, a.Name()+suffix)
@ -987,21 +952,12 @@ func (a *apexBundle) getOverrideManifestPackageName(ctx android.ModuleContext) s
}
func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) {
if !a.primaryApexType {
return
}
if a.properties.IsCoverageVariant {
// Otherwise, we will have duplicated rules for coverage and
// non-coverage variants of the same APEX
return
}
if ctx.Host() {
// No need to generate dependency info for host variant
return
}
depInfos := android.DepNameToDepInfoMap{}
a.WalkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool {
if from.Name() == to.Name() {

View file

@ -60,7 +60,7 @@ type apexKeyProperties struct {
func ApexKeyFactory() android.Module {
module := &apexKey{}
module.AddProperties(&module.properties)
android.InitAndroidArchModule(module, android.HostAndDeviceDefault, android.MultilibCommon)
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
android.InitBazelModule(module)
return module
}

View file

@ -782,10 +782,10 @@ func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
p.initApexFilesForAndroidMk(ctx)
// in case that prebuilt_apex replaces source apex (using prefer: prop)
p.compatSymlinks = makeCompatSymlinks(p.BaseModuleName(), ctx, true)
p.compatSymlinks = makeCompatSymlinks(p.BaseModuleName(), ctx)
// or that prebuilt_apex overrides other apexes (using overrides: prop)
for _, overridden := range p.prebuiltCommonProperties.Overrides {
p.compatSymlinks = append(p.compatSymlinks, makeCompatSymlinks(overridden, ctx, true)...)
p.compatSymlinks = append(p.compatSymlinks, makeCompatSymlinks(overridden, ctx)...)
}
if p.installable() {
@ -877,12 +877,7 @@ func (e *ApexExtractorProperties) prebuiltSrcs(ctx android.BaseModuleContext) []
srcs = append(srcs, *e.Set)
}
var sanitizers []string
if ctx.Host() {
sanitizers = ctx.Config().SanitizeHost()
} else {
sanitizers = ctx.Config().SanitizeDevice()
}
sanitizers := ctx.Config().SanitizeDevice()
if android.InList("address", sanitizers) && e.Sanitized.Address.Set != nil {
srcs = append(srcs, *e.Sanitized.Address.Set)
@ -1007,10 +1002,10 @@ func (a *ApexSet) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
// in case that apex_set replaces source apex (using prefer: prop)
a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx, true)
a.compatSymlinks = makeCompatSymlinks(a.BaseModuleName(), ctx)
// or that apex_set overrides other apexes (using overrides: prop)
for _, overridden := range a.prebuiltCommonProperties.Overrides {
a.compatSymlinks = append(a.compatSymlinks, makeCompatSymlinks(overridden, ctx, true)...)
a.compatSymlinks = append(a.compatSymlinks, makeCompatSymlinks(overridden, ctx)...)
}
}

View file

@ -97,7 +97,7 @@ func TestSystemserverclasspathFragmentContents(t *testing.T) {
ctx := result.TestContext
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"etc/classpaths/systemserverclasspath.pb",
"javalib/foo.jar",
"javalib/bar.jar",
@ -105,7 +105,7 @@ func TestSystemserverclasspathFragmentContents(t *testing.T) {
"javalib/baz.jar",
})
java.CheckModuleDependencies(t, ctx, "myapex", "android_common_myapex_image", []string{
java.CheckModuleDependencies(t, ctx, "myapex", "android_common_myapex", []string{
`myapex.key`,
`mysystemserverclasspathfragment`,
})
@ -157,11 +157,11 @@ func TestSystemserverclasspathFragmentNoGeneratedProto(t *testing.T) {
}
`)
ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex", []string{
"javalib/foo.jar",
})
java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex", []string{
`myapex.key`,
`mysystemserverclasspathfragment`,
})
@ -361,7 +361,7 @@ func TestSystemserverclasspathFragmentStandaloneContents(t *testing.T) {
ctx := result.TestContext
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
ensureExactContents(t, ctx, "myapex", "android_common_myapex", []string{
"etc/classpaths/systemserverclasspath.pb",
"javalib/foo.jar",
"javalib/bar.jar",

View file

@ -112,14 +112,10 @@ func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) {
}
// name is module.BaseModuleName() which is used as LOCAL_MODULE_NAME and also LOCAL_OVERRIDES_*
func makeCompatSymlinks(name string, ctx android.ModuleContext, primaryApex bool) (symlinks android.InstallPaths) {
func makeCompatSymlinks(name string, ctx android.ModuleContext) (symlinks android.InstallPaths) {
// small helper to add symlink commands
addSymlink := func(target string, dir android.InstallPath, linkName string) {
if primaryApex {
symlinks = append(symlinks, ctx.InstallAbsoluteSymlink(dir, linkName, target))
} else {
symlinks = append(symlinks, dir.Join(ctx, linkName))
}
symlinks = append(symlinks, ctx.InstallAbsoluteSymlink(dir, linkName, target))
}
// TODO(b/142911355): [VNDK APEX] Fix hard-coded references to /system/lib/vndk

View file

@ -55,7 +55,7 @@ func TestVndkApexForVndkLite(t *testing.T) {
}),
)
// VNDK-Lite contains only core variants of VNDK-Sp libraries
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common_image", []string{
ensureExactContents(t, ctx, "com.android.vndk.current", "android_common", []string{
"lib/libvndksp.so",
"lib/libc++.so",
"lib64/libvndksp.so",
@ -110,7 +110,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
}
// VNDK APEX doesn't create apex variant
files := getFiles(t, ctx, "com.android.vndk.current", "android_common_image")
files := getFiles(t, ctx, "com.android.vndk.current", "android_common")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared/libfoo.so")
})
@ -122,7 +122,7 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
}),
)
files := getFiles(t, ctx, "com.android.vndk.current", "android_common_image")
files := getFiles(t, ctx, "com.android.vndk.current", "android_common")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared/libfoo.so")
})
@ -134,10 +134,10 @@ func TestVndkApexUsesVendorVariant(t *testing.T) {
}),
)
files := getFiles(t, ctx, "com.android.vndk.current", "android_common_image")
files := getFiles(t, ctx, "com.android.vndk.current", "android_common")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared/libfoo.so")
files = getFiles(t, ctx, "com.android.vndk.current", "android_common_cov_image")
files = getFiles(t, ctx, "com.android.vndk.current", "android_common_cov")
ensureFileSrc(t, files, "lib/libfoo.so", "libfoo/android_vendor.29_arm_armv7-a-neon_shared_cov/libfoo.so")
})
}

View file

@ -47,8 +47,9 @@ apex_key {
}
`,
ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{
"private_key": `"com.android.apogee.pem"`,
"public_key": `"com.android.apogee.avbpubkey"`,
"private_key": `"com.android.apogee.pem"`,
"public_key": `"com.android.apogee.avbpubkey"`,
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
}),
}})
}
@ -69,8 +70,9 @@ apex_key {
}
`,
ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{
"private_key_name": `"com.android.apogee.pem"`,
"public_key_name": `"com.android.apogee.avbpubkey"`,
"private_key_name": `"com.android.apogee.pem"`,
"public_key_name": `"com.android.apogee.avbpubkey"`,
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
}),
}})
}
@ -90,8 +92,9 @@ apex_key {
` + simpleModuleDoNotConvertBp2build("filegroup", "com.android.apogee.avbpubkey") +
simpleModuleDoNotConvertBp2build("filegroup", "com.android.apogee.pem"),
ExpectedBazelTargets: []string{MakeBazelTargetNoRestrictions("apex_key", "com.android.apogee.key", AttrNameToString{
"private_key": `":com.android.apogee.pem"`,
"public_key": `":com.android.apogee.avbpubkey"`,
"private_key": `":com.android.apogee.pem"`,
"public_key": `":com.android.apogee.avbpubkey"`,
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
}),
}})
}