Merge "Add the system image test to the bazel sandwich" into main
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 75f2c3f..d7fbb62 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -233,7 +233,7 @@
"frameworks/base/tools/streaming_proto": Bp2BuildDefaultTrueRecursively,
"frameworks/hardware/interfaces/stats/aidl": Bp2BuildDefaultTrue,
"frameworks/libs/modules-utils/build": Bp2BuildDefaultTrueRecursively,
- "frameworks/libs/net/common/native": Bp2BuildDefaultTrueRecursively,
+ "frameworks/libs/net/common/native": Bp2BuildDefaultTrueRecursively, // TODO(b/296014682): Remove this path
"frameworks/native": Bp2BuildDefaultTrue,
"frameworks/native/libs/adbd_auth": Bp2BuildDefaultTrueRecursively,
"frameworks/native/libs/arect": Bp2BuildDefaultTrueRecursively,
@@ -316,6 +316,7 @@
"packages/modules/adb/pairing_connection": Bp2BuildDefaultTrueRecursively,
"packages/modules/adb/proto": Bp2BuildDefaultTrueRecursively,
"packages/modules/adb/tls": Bp2BuildDefaultTrueRecursively,
+ "packages/modules/Connectivity/staticlibs/native": Bp2BuildDefaultTrueRecursively,
"packages/modules/Gki/libkver": Bp2BuildDefaultTrue,
"packages/modules/NetworkStack/common/captiveportal": Bp2BuildDefaultTrue,
"packages/modules/NeuralNetworks/apex": Bp2BuildDefaultTrue,
@@ -1574,6 +1575,9 @@
// same package contains a "r8.jar" file which gets overshadowed by the implicit target.
// We don't need this target as we're not using the Soong wrapper for now
"r8",
+
+ // Depends on the module defined in the directory not bp2build default allowed
+ "ota_from_raw_img",
}
// Bazel prod-mode allowlist. Modules in this list are built by Bazel
diff --git a/android/proto.go b/android/proto.go
index 0ffb9b6..6887900 100644
--- a/android/proto.go
+++ b/android/proto.go
@@ -268,6 +268,13 @@
protoIncludeDirs = append(protoIncludeDirs, dir)
}
}
+
+ // proto.local_include_dirs are similar to proto.include_dirs, except that it is relative to the module directory
+ for _, dir := range props.Proto.Local_include_dirs {
+ relativeToTop := pathForModuleSrc(ctx, dir).String()
+ protoIncludeDirs = append(protoIncludeDirs, relativeToTop)
+ }
+
} else if props.Proto.Type != info.Type && props.Proto.Type != nil {
ctx.ModuleErrorf("Cannot handle arch-variant types for protos at this time.")
}
@@ -292,9 +299,14 @@
// (or a different subpackage), it will not find it.
// The CcProtoGen action itself runs fine because we construct the correct ProtoInfo,
// but the FileDescriptorSet of each proto_library might not be compile-able
- if pkg != ctx.ModuleDir() {
+ //
+ // Add manual tag if either
+ // 1. .proto files are in more than one package
+ // 2. proto.include_dirs is not empty
+ if len(SortedStringKeys(pkgToSrcs)) > 1 || len(protoIncludeDirs) > 0 {
tags.Append(bazel.MakeStringListAttribute([]string{"manual"}))
}
+
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{Rule_class: "proto_library"},
CommonAttributes{Name: name, Dir: proptools.StringPtr(pkg), Tags: tags},
diff --git a/apex/androidmk.go b/apex/androidmk.go
index b0c3918..2f5d8d4 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -42,7 +42,7 @@
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 @@
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 @@
// 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 @@
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 @@
}
// 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 @@
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 @@
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 {
diff --git a/apex/apex.go b/apex/apex.go
index 8c21d3d..52a5e20 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -26,7 +26,6 @@
"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 @@
"android/soong/filesystem"
"android/soong/java"
"android/soong/multitree"
- "android/soong/python"
"android/soong/rust"
"android/soong/sh"
)
@@ -79,7 +77,6 @@
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 @@
// 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 @@
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 @@
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 @@
app apexFileClass = iota
appSet
etc
- goBinary
javaSharedLib
nativeExecutable
nativeSharedLib
nativeTest
- pyBinary
shBinary
)
@@ -520,12 +497,10 @@
"app": app,
"appSet": appSet,
"etc": etc,
- "goBinary": goBinary,
"javaSharedLib": javaSharedLib,
"nativeExecutable": nativeExecutable,
"nativeSharedLib": nativeSharedLib,
"nativeTest": nativeTest,
- "pyBinary": pyBinary,
"shBinary": shBinary,
}
)
@@ -716,11 +691,10 @@
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 (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 @@
}
}
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 @@
// 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 @@
}
}
-// 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 @@
// 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 @@
// 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) 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 @@
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 @@
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 @@
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 @@
// 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) 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 @@
// 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) 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
// 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 @@
// 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
diff --git a/apex/apex_test.go b/apex/apex_test.go
index da059eb..1717f3e 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -518,10 +518,10 @@
}
`)
- 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 @@
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 @@
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 @@
}
`)
- 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 @@
}
`)
- 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 @@
},
}
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 @@
}
`)
- 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 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 @@
`)
- 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 @@
// 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 @@
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 @@
}
`)
- 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 @@
}
`)
- 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 @@
// 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 @@
`)
- 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 @@
// 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 @@
}
`)
- 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 @@
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 @@
} `)
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 @@
`)
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 @@
)
// 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 @@
}
`)
- 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 @@
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 @@
}
`)
- 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 @@
},
}
`, 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 @@
}
`)
- 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 @@
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 @@
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 @@
`+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 @@
}
`)
- 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 @@
}
`)
- 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 @@
}
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
"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 @@
"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 @@
}`+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 @@
`+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 @@
}),
)
- 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 @@
"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 @@
}))
// 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 @@
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 @@
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 @@
"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 @@
}
`, 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 @@
}
`)
- 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 @@
}
`)
- 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 @@
}
`)
- 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 @@
}
`)
- 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 @@
}
`)
- 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 @@
}
`)
- 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 @@
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 @@
`, 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 @@
`, 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 @@
}
`)
- 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 @@
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 @@
}
`)
- 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 @@
}
`)
- 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 @@
}
`)
- 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 @@
"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 @@
`)
- 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 @@
}
`)
- 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 @@
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 @@
}
`, 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 @@
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 @@
`, 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 @@
`, 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 @@
}
`, 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 @@
`, 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 @@
`, 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 @@
`, 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 @@
)
// 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 @@
}
`)
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 @@
}
`)
- 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 @@
// 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 @@
// 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 @@
}
`)
- 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 @@
`)
- 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 @@
}
`, 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 @@
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 @@
`),
}))
- 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 @@
}),
)
- 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 @@
}
`)
- 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 @@
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 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 @@
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 @@
}
`)
- 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 @@
}
`)
- 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 @@
{
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 @@
}
`
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 @@
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 @@
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
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index f30f7f6..89ea004 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -302,14 +302,14 @@
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 @@
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 @@
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 @@
"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 @@
}
`)
- 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 @@
"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 @@
}
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)
}
diff --git a/apex/bp2build_test.go b/apex/bp2build_test.go
index b1b6a75..6bab67d 100644
--- a/apex/bp2build_test.go
+++ b/apex/bp2build_test.go
@@ -80,7 +80,7 @@
}),
).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 @@
}),
).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 @@
}),
).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 @@
}),
).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")
diff --git a/apex/builder.go b/apex/builder.go
index db66a72..4b42b74 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -179,19 +179,6 @@
}, "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 @@
// 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 @@
// 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 @@
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) 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() {
diff --git a/apex/key.go b/apex/key.go
index 3010d76..65e739a 100644
--- a/apex/key.go
+++ b/apex/key.go
@@ -60,7 +60,7 @@
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
}
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index f2e87c8..1a90c3a 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -782,10 +782,10 @@
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 @@
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 @@
}
// 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)...)
}
}
diff --git a/apex/systemserver_classpath_fragment_test.go b/apex/systemserver_classpath_fragment_test.go
index f94e50f..40d0581 100644
--- a/apex/systemserver_classpath_fragment_test.go
+++ b/apex/systemserver_classpath_fragment_test.go
@@ -97,7 +97,7 @@
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 @@
"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 @@
}
`)
- 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 @@
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",
diff --git a/apex/vndk.go b/apex/vndk.go
index 68b3a40..26c60ed 100644
--- a/apex/vndk.go
+++ b/apex/vndk.go
@@ -112,14 +112,10 @@
}
// 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
diff --git a/apex/vndk_test.go b/apex/vndk_test.go
index 4327a61..2b86e53 100644
--- a/apex/vndk_test.go
+++ b/apex/vndk_test.go
@@ -55,7 +55,7 @@
}),
)
// 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 @@
}
// 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 @@
}),
)
- 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 @@
}),
)
- 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")
})
}
diff --git a/bp2build/Android.bp b/bp2build/Android.bp
index 4a3786f..c104833 100644
--- a/bp2build/Android.bp
+++ b/bp2build/Android.bp
@@ -83,6 +83,7 @@
"python_library_conversion_test.go",
"python_test_conversion_test.go",
"sh_conversion_test.go",
+ "sh_test_conversion_test.go",
"soong_config_module_type_conversion_test.go",
],
pluginFor: [
diff --git a/bp2build/apex_key_conversion_test.go b/bp2build/apex_key_conversion_test.go
index f9a68c9..1230a48 100644
--- a/bp2build/apex_key_conversion_test.go
+++ b/bp2build/apex_key_conversion_test.go
@@ -47,8 +47,9 @@
}
`,
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 @@
}
`,
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 @@
` + 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"]`,
}),
}})
}
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 28dbf7e..6501217 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -4965,6 +4965,7 @@
}),
MakeBazelTarget("proto_library", "foo_proto", AttrNameToString{
"srcs": `["foo.proto"]`,
+ "tags": `["manual"]`,
}),
MakeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", AttrNameToString{
"deps": `[
@@ -5033,6 +5034,7 @@
MakeBazelTarget("proto_library", "foo_proto", AttrNameToString{
"srcs": `["foo.proto"]`,
"strip_import_prefix": `""`,
+ "tags": `["manual"]`,
}),
MakeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", AttrNameToString{
"deps": `[
@@ -5103,6 +5105,7 @@
}),
MakeBazelTarget("proto_library", "foo_proto", AttrNameToString{
"srcs": `["foo.proto"]`,
+ "tags": `["manual"]`,
}),
MakeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", AttrNameToString{
"deps": `[":foo_proto"]`,
@@ -5137,3 +5140,58 @@
}
runCcLibraryTestCase(t, tc)
}
+
+func TestProtoLocalIncludeDirs(t *testing.T) {
+ tc := Bp2buildTestCase{
+ Description: "cc_library depends on .proto files using proto.local_include_dirs",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: simpleModuleDoNotConvertBp2build("cc_library", "libprotobuf-cpp-lite"),
+ Filesystem: map[string]string{
+ "foo/Android.bp": `cc_library_static {
+ name: "foo",
+ srcs: [
+ "foo.proto",
+ ],
+ proto: {
+ local_include_dirs: ["foo_subdir"],
+ },
+ bazel_module: { bp2build_available: true },
+}`,
+ "foo/foo.proto": "",
+ "foo/foo_subdir/Android.bp": "",
+ "foo/foo_subdir/foo_subdir.proto": "",
+ },
+ }
+
+ // We will run the test 2 times and check in foo and foo/foo_subdir directories
+ // foo dir
+ tc.Dir = "foo"
+ tc.ExpectedBazelTargets = []string{
+ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
+ "local_includes": `["."]`,
+ "deps": `["//:libprotobuf-cpp-lite"]`,
+ "implementation_whole_archive_deps": `[":foo_cc_proto_lite"]`,
+ }),
+ MakeBazelTarget("proto_library", "foo_proto", AttrNameToString{
+ "srcs": `["foo.proto"]`,
+ "tags": `["manual"]`,
+ }),
+ MakeBazelTarget("cc_lite_proto_library", "foo_cc_proto_lite", AttrNameToString{
+ "deps": `[":foo_proto"]`,
+ "transitive_deps": `["//foo/foo_subdir:foo.foo_subdir.include_dir_bp2build_generated_proto"]`,
+ }),
+ }
+ runCcLibraryTestCase(t, tc)
+
+ // foo/foo_subdir
+ tc.Dir = "foo/foo_subdir"
+ tc.ExpectedBazelTargets = []string{
+ MakeBazelTarget("proto_library", "foo.foo_subdir.include_dir_bp2build_generated_proto", AttrNameToString{
+ "srcs": `["foo_subdir.proto"]`,
+ "strip_import_prefix": `""`,
+ "tags": `["manual"]`,
+ }),
+ }
+ runCcLibraryTestCase(t, tc)
+}
diff --git a/bp2build/conversion.go b/bp2build/conversion.go
index f280924..7791419 100644
--- a/bp2build/conversion.go
+++ b/bp2build/conversion.go
@@ -12,6 +12,7 @@
"android/soong/cc"
cc_config "android/soong/cc/config"
java_config "android/soong/java/config"
+ rust_config "android/soong/rust/config"
"android/soong/starlark_fmt"
"github.com/google/blueprint/proptools"
@@ -37,6 +38,9 @@
files = append(files, newFile("java_toolchain", GeneratedBuildFileName, "")) // Creates a //java_toolchain package.
files = append(files, newFile("java_toolchain", "constants.bzl", java_config.BazelJavaToolchainVars(cfg)))
+ files = append(files, newFile("rust_toolchain", GeneratedBuildFileName, "")) // Creates a //rust_toolchain package.
+ files = append(files, newFile("rust_toolchain", "constants.bzl", rust_config.BazelRustToolchainVars(cfg)))
+
files = append(files, newFile("apex_toolchain", GeneratedBuildFileName, "")) // Creates a //apex_toolchain package.
apexToolchainVars, err := apex.BazelApexToolchainVars()
if err != nil {
diff --git a/bp2build/conversion_test.go b/bp2build/conversion_test.go
index 15284ce..cbffaa0 100644
--- a/bp2build/conversion_test.go
+++ b/bp2build/conversion_test.go
@@ -117,6 +117,14 @@
basename: "constants.bzl",
},
{
+ dir: "rust_toolchain",
+ basename: GeneratedBuildFileName,
+ },
+ {
+ dir: "rust_toolchain",
+ basename: "constants.bzl",
+ },
+ {
dir: "apex_toolchain",
basename: GeneratedBuildFileName,
},
diff --git a/bp2build/sh_test_conversion_test.go b/bp2build/sh_test_conversion_test.go
new file mode 100644
index 0000000..e99d566
--- /dev/null
+++ b/bp2build/sh_test_conversion_test.go
@@ -0,0 +1,186 @@
+// Copyright 2023 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bp2build
+
+import (
+ "testing"
+
+ "android/soong/android"
+ "android/soong/sh"
+)
+
+func TestShTestSimple(t *testing.T) {
+ RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{
+ Description: "sh_test test",
+ ModuleTypeUnderTest: "sh_test",
+ ModuleTypeUnderTestFactory: sh.ShTestFactory,
+ Blueprint: `sh_test{
+ name: "sts-rootcanal-sidebins",
+ src: "empty.sh",
+ test_suites: [
+ "sts",
+ "sts-lite",
+ ],
+ data_bins: [
+ "android.hardware.bluetooth@1.1-service.sim",
+ "android.hardware.bluetooth@1.1-impl-sim"
+ ],
+ data: ["android.hardware.bluetooth@1.1-service.sim.rc"],
+ data_libs: ["libc++","libcrypto"],
+ test_config: "art-gtests-target-install-apex.xml",
+ test_config_template: ":art-run-test-target-template",
+ auto_gen_config: false,
+ test_options:{tags: ["no-remote"],
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("sh_test", "sts-rootcanal-sidebins", AttrNameToString{
+ "srcs": `["empty.sh"]`,
+ "data": `[
+ "android.hardware.bluetooth@1.1-service.sim.rc",
+ "android.hardware.bluetooth@1.1-service.sim",
+ "android.hardware.bluetooth@1.1-impl-sim",
+ "libc++",
+ "libcrypto",
+ ]`,
+ "test_config": `"art-gtests-target-install-apex.xml"`,
+ "test_config_template": `":art-run-test-target-template"`,
+ "auto_gen_config": "False",
+ "tags": `["no-remote"]`,
+ })},
+ })
+}
+
+func TestShTestHostSimple(t *testing.T) {
+ RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{
+ Description: "sh_test_host test",
+ ModuleTypeUnderTest: "sh_test_host",
+ ModuleTypeUnderTestFactory: sh.ShTestHostFactory,
+ Blueprint: `sh_test_host{
+ name: "sts-rootcanal-sidebins",
+ src: "empty.sh",
+ test_suites: [
+ "sts",
+ "sts-lite",
+ ],
+ data_bins: [
+ "android.hardware.bluetooth@1.1-service.sim",
+ "android.hardware.bluetooth@1.1-impl-sim"
+ ],
+ data: ["android.hardware.bluetooth@1.1-service.sim.rc"],
+ data_libs: ["libc++","libcrypto"],
+ test_config: "art-gtests-target-install-apex.xml",
+ test_config_template: ":art-run-test-target-template",
+ auto_gen_config: false,
+ test_options:{tags: ["no-remote"],
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("sh_test", "sts-rootcanal-sidebins", AttrNameToString{
+ "srcs": `["empty.sh"]`,
+ "data": `[
+ "android.hardware.bluetooth@1.1-service.sim.rc",
+ "android.hardware.bluetooth@1.1-service.sim",
+ "android.hardware.bluetooth@1.1-impl-sim",
+ "libc++",
+ "libcrypto",
+ ]`,
+ "tags": `["no-remote"]`,
+ "test_config": `"art-gtests-target-install-apex.xml"`,
+ "test_config_template": `":art-run-test-target-template"`,
+ "auto_gen_config": "False",
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ })},
+ })
+}
+
+func TestShTestSimpleUnset(t *testing.T) {
+ RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{
+ Description: "sh_test test",
+ ModuleTypeUnderTest: "sh_test",
+ ModuleTypeUnderTestFactory: sh.ShTestFactory,
+ Blueprint: `sh_test{
+ name: "sts-rootcanal-sidebins",
+ src: "empty.sh",
+ test_suites: [
+ "sts",
+ "sts-lite",
+ ],
+ data_bins: [
+ "android.hardware.bluetooth@1.1-service.sim",
+ "android.hardware.bluetooth@1.1-impl-sim"
+ ],
+ data: ["android.hardware.bluetooth@1.1-service.sim.rc"],
+ data_libs: ["libc++","libcrypto"],
+ test_options:{tags: ["no-remote"],
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("sh_test", "sts-rootcanal-sidebins", AttrNameToString{
+ "srcs": `["empty.sh"]`,
+ "data": `[
+ "android.hardware.bluetooth@1.1-service.sim.rc",
+ "android.hardware.bluetooth@1.1-service.sim",
+ "android.hardware.bluetooth@1.1-impl-sim",
+ "libc++",
+ "libcrypto",
+ ]`,
+ "tags": `["no-remote"]`,
+ })},
+ })
+}
+
+func TestShTestHostSimpleUnset(t *testing.T) {
+ RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{
+ Description: "sh_test_host test",
+ ModuleTypeUnderTest: "sh_test_host",
+ ModuleTypeUnderTestFactory: sh.ShTestHostFactory,
+ Blueprint: `sh_test_host{
+ name: "sts-rootcanal-sidebins",
+ src: "empty.sh",
+ test_suites: [
+ "sts",
+ "sts-lite",
+ ],
+ data_bins: [
+ "android.hardware.bluetooth@1.1-service.sim",
+ "android.hardware.bluetooth@1.1-impl-sim"
+ ],
+ data: ["android.hardware.bluetooth@1.1-service.sim.rc"],
+ data_libs: ["libc++","libcrypto"],
+ test_options:{tags: ["no-remote"],
+ },
+}`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("sh_test", "sts-rootcanal-sidebins", AttrNameToString{
+ "srcs": `["empty.sh"]`,
+ "data": `[
+ "android.hardware.bluetooth@1.1-service.sim.rc",
+ "android.hardware.bluetooth@1.1-service.sim",
+ "android.hardware.bluetooth@1.1-impl-sim",
+ "libc++",
+ "libcrypto",
+ ]`,
+ "tags": `["no-remote"]`,
+ "target_compatible_with": `select({
+ "//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ })`,
+ })},
+ })
+}
diff --git a/bpf/bpf.go b/bpf/bpf.go
index 45009c1..d135d5f 100644
--- a/bpf/bpf.go
+++ b/bpf/bpf.go
@@ -153,7 +153,9 @@
// The architecture doesn't matter here, but asm/types.h is included by linux/types.h.
"-isystem bionic/libc/kernel/uapi/asm-arm64",
"-isystem bionic/libc/kernel/android/uapi",
+ // TODO(b/296014682): Remove after the bpf_headers is moved to Connectivity
"-I frameworks/libs/net/common/native/bpf_headers/include/bpf",
+ "-I packages/modules/Connectivity/staticlibs/native/bpf_headers/include/bpf",
// TODO(b/149785767): only give access to specific file with AID_* constants
"-I system/core/libcutils/include",
"-I " + ctx.ModuleDir(),
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 30bce9b..8eea7db 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -1650,12 +1650,12 @@
Bool(sanProps.Fuzzer) ||
Bool(sanProps.Undefined) ||
Bool(sanProps.All_undefined) {
- if toolchain.Musl() || (c.staticBinary() && toolchain.Bionic()) {
- // Use a static runtime for static binaries.
- // Also use a static runtime for musl to match
- // what clang does for glibc. Otherwise dlopening
- // libraries that depend on libclang_rt.ubsan_standalone.so
- // fails with:
+ if toolchain.Musl() || c.staticBinary() {
+ // Use a static runtime for static binaries. For sanitized glibc binaries the runtime is
+ // added automatically by clang, but for static glibc binaries that are not sanitized but
+ // have a sanitized dependency the runtime needs to be added manually.
+ // Also manually add a static runtime for musl to match what clang does for glibc.
+ // Otherwise dlopening libraries that depend on libclang_rt.ubsan_standalone.so fails with:
// Error relocating ...: initial-exec TLS resolves to dynamic definition
addStaticDeps(config.UndefinedBehaviorSanitizerRuntimeLibrary(toolchain)+".static", true)
} else {
diff --git a/cc/sanitize_test.go b/cc/sanitize_test.go
index 29b17d4..49117a0 100644
--- a/cc/sanitize_test.go
+++ b/cc/sanitize_test.go
@@ -714,6 +714,15 @@
],
}
+ cc_binary {
+ name: "static_bin_with_ubsan_dep",
+ static_executable: true,
+ host_supported: true,
+ static_libs: [
+ "libubsan_diag",
+ ],
+ }
+
cc_library_shared {
name: "libshared",
host_supported: true,
@@ -742,6 +751,17 @@
}
cc_library_static {
+ name: "libubsan_diag",
+ host_supported: true,
+ sanitize: {
+ undefined: true,
+ diag: {
+ undefined: true,
+ },
+ },
+ }
+
+ cc_library_static {
name: "libstatic",
host_supported: true,
}
@@ -763,6 +783,7 @@
sharedVariant := variant + "_shared"
minimalRuntime := result.ModuleForTests("libclang_rt.ubsan_minimal", staticVariant)
+ standaloneRuntime := result.ModuleForTests("libclang_rt.ubsan_standalone.static", staticVariant)
// The binaries, one with ubsan and one without
binWithUbsan := result.ModuleForTests("bin_with_ubsan", variant)
@@ -770,6 +791,7 @@
libSharedUbsan := result.ModuleForTests("libsharedubsan", sharedVariant)
binDependsUbsanShared := result.ModuleForTests("bin_depends_ubsan_shared", variant)
binNoUbsan := result.ModuleForTests("bin_no_ubsan", variant)
+ staticBin := result.ModuleForTests("static_bin_with_ubsan_dep", variant)
android.AssertStringListContains(t, "missing libclang_rt.ubsan_minimal in bin_with_ubsan static libs",
strings.Split(binWithUbsan.Rule("ld").Args["libFlags"], " "),
@@ -810,6 +832,11 @@
android.AssertStringListDoesNotContain(t, "unexpected -Wl,--exclude-libs for minimal runtime in bin_no_ubsan static libs",
strings.Split(binNoUbsan.Rule("ld").Args["ldFlags"], " "),
"-Wl,--exclude-libs="+minimalRuntime.OutputFiles(t, "")[0].Base())
+
+ android.AssertStringListContains(t, "missing libclang_rt.ubsan_standalone.static in static_bin_with_ubsan_dep static libs",
+ strings.Split(staticBin.Rule("ld").Args["libFlags"], " "),
+ standaloneRuntime.OutputFiles(t, "")[0].String())
+
}
t.Run("host", func(t *testing.T) { check(t, buildOS, preparer) })
diff --git a/cmd/zip2zip/zip2zip_test.go b/cmd/zip2zip/zip2zip_test.go
index c238098..85a69ef 100644
--- a/cmd/zip2zip/zip2zip_test.go
+++ b/cmd/zip2zip/zip2zip_test.go
@@ -471,6 +471,56 @@
}
}
+// TestZip2Zip64 tests that zip2zip on zip file larger than 4GB produces a valid zip file.
+func TestZip2Zip64(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping slow test in short mode")
+ }
+ inputBuf := &bytes.Buffer{}
+ outputBuf := &bytes.Buffer{}
+
+ inputWriter := zip.NewWriter(inputBuf)
+ w, err := inputWriter.CreateHeaderAndroid(&zip.FileHeader{
+ Name: "a",
+ Method: zip.Store,
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ buf := make([]byte, 4*1024*1024)
+ for i := 0; i < 1025; i++ {
+ w.Write(buf)
+ }
+ w, err = inputWriter.CreateHeaderAndroid(&zip.FileHeader{
+ Name: "b",
+ Method: zip.Store,
+ })
+ for i := 0; i < 1025; i++ {
+ w.Write(buf)
+ }
+ inputWriter.Close()
+ inputBytes := inputBuf.Bytes()
+
+ inputReader, err := zip.NewReader(bytes.NewReader(inputBytes), int64(len(inputBytes)))
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ outputWriter := zip.NewWriter(outputBuf)
+ err = zip2zip(inputReader, outputWriter, false, false, false,
+ nil, nil, nil, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ outputWriter.Close()
+ outputBytes := outputBuf.Bytes()
+ _, err = zip.NewReader(bytes.NewReader(outputBytes), int64(len(outputBytes)))
+ if err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestConstantPartOfPattern(t *testing.T) {
testCases := []struct{ in, out string }{
{
diff --git a/python/bp2build.go b/python/bp2build.go
index 41e9f49..8bc3d0a 100644
--- a/python/bp2build.go
+++ b/python/bp2build.go
@@ -33,6 +33,12 @@
type bazelPythonProtoLibraryAttributes struct {
Deps bazel.LabelListAttribute
+
+ // A list of proto_library targets that the proto_library in `deps` depends on
+ // This list is overestimation.
+ // Overestimation is necessary since Soong includes other protos via proto.include_dirs and not
+ // a specific .proto file module explicitly.
+ Transitive_deps bazel.LabelListAttribute
}
type baseAttributes struct {
@@ -81,7 +87,8 @@
}, android.CommonAttributes{
Name: pyProtoLibraryName,
}, &bazelPythonProtoLibraryAttributes{
- Deps: bazel.MakeLabelListAttribute(protoInfo.Proto_libs),
+ Deps: bazel.MakeLabelListAttribute(protoInfo.Proto_libs),
+ Transitive_deps: bazel.MakeLabelListAttribute(protoInfo.Transitive_proto_libs),
})
attrs.Deps.Add(bazel.MakeLabelAttribute(":" + pyProtoLibraryName))
diff --git a/python/python.go b/python/python.go
index 6c837a8..e6bdeee 100644
--- a/python/python.go
+++ b/python/python.go
@@ -454,7 +454,8 @@
// generate the zipfile of all source and data files
p.srcsZip = p.createSrcsZip(ctx, pkgPath)
- p.precompiledSrcsZip = p.precompileSrcs(ctx)
+ // TODO(b/278602456): precompilation temporarily disabled for python3.11 upgrade
+ p.precompiledSrcsZip = p.srcsZip //p.precompileSrcs(ctx)
}
func isValidPythonPath(path string) error {
diff --git a/rust/config/global.go b/rust/config/global.go
index 86eb2d1..ca2c9af 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -21,9 +21,10 @@
_ "android/soong/cc/config"
)
-var pctx = android.NewPackageContext("android/soong/rust/config")
-
var (
+ pctx = android.NewPackageContext("android/soong/rust/config")
+ exportedVars = android.NewExportedVariables(pctx)
+
RustDefaultVersion = "1.71.0"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2021"
@@ -105,6 +106,7 @@
pctx.StaticVariable("DeviceGlobalLinkFlags", strings.Join(deviceGlobalLinkFlags, " "))
+ exportedVars.ExportStringStaticVariable("RUST_DEFAULT_VERSION", RustDefaultVersion)
}
func getRustVersionPctx(ctx android.PackageVarContext) string {
@@ -117,3 +119,8 @@
}
return RustDefaultVersion
}
+
+// BazelRustToolchainVars returns a string with
+func BazelRustToolchainVars(config android.Config) string {
+ return android.BazelToolchainVars(config, exportedVars)
+}
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index d2eede6..5459904 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -502,7 +502,7 @@
// sh_test defines a shell script based test module.
func ShTestFactory() android.Module {
module := &ShTest{}
- initShBinaryModule(&module.ShBinary, false)
+ initShBinaryModule(&module.ShBinary, true)
module.AddProperties(&module.testProperties)
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst)
@@ -512,7 +512,7 @@
// sh_test_host defines a shell script based test module that runs on a host.
func ShTestHostFactory() android.Module {
module := &ShTest{}
- initShBinaryModule(&module.ShBinary, false)
+ initShBinaryModule(&module.ShBinary, true)
module.AddProperties(&module.testProperties)
// Default sh_test_host to unit_tests = true
if module.testProperties.Test_options.Unit_test == nil {
@@ -548,6 +548,15 @@
// visibility
}
+type bazelShTestAttributes struct {
+ Srcs bazel.LabelListAttribute
+ Data bazel.LabelListAttribute
+ Tags bazel.StringListAttribute
+ Test_config *string
+ Test_config_template *string
+ Auto_gen_config *bool
+}
+
func (m *ShBinary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
srcs := bazel.MakeLabelListAttribute(
android.BazelLabelForModuleSrc(ctx, []string{*m.properties.Src}))
@@ -576,6 +585,41 @@
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
}
+func (m *ShTest) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
+ srcs := bazel.MakeLabelListAttribute(
+ android.BazelLabelForModuleSrc(ctx, []string{*m.properties.Src}))
+
+ combinedData := append(m.testProperties.Data, m.testProperties.Data_bins...)
+ combinedData = append(combinedData, m.testProperties.Data_libs...)
+
+ data := bazel.MakeLabelListAttribute(
+ android.BazelLabelForModuleSrc(ctx, combinedData))
+
+ tags := bazel.MakeStringListAttribute(
+ m.testProperties.Test_options.Tags)
+
+ test_config := m.testProperties.Test_config
+
+ test_config_template := m.testProperties.Test_config_template
+
+ auto_gen_config := m.testProperties.Auto_gen_config
+
+ attrs := &bazelShTestAttributes{
+ Srcs: srcs,
+ Data: data,
+ Tags: tags,
+ Test_config: test_config,
+ Test_config_template: test_config_template,
+ Auto_gen_config: auto_gen_config,
+ }
+
+ props := bazel.BazelTargetModuleProperties{
+ Rule_class: "sh_test",
+ Bzl_load_location: "//build/bazel/rules:sh_test.bzl",
+ }
+ ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
+}
+
var Bool = proptools.Bool
var _ snapshot.RelativeInstallPath = (*ShBinary)(nil)
diff --git a/third_party/zip/android.go b/third_party/zip/android.go
index 0f41f62..b972156 100644
--- a/third_party/zip/android.go
+++ b/third_party/zip/android.go
@@ -56,6 +56,11 @@
if err := writeHeader(w.cw, fh); err != nil {
return err
}
+
+ // Strip the extras again in case writeHeader added the local file header extras that are incorrect for the
+ // central directory.
+ fh.Extra = stripExtras(fh.Extra)
+
dataOffset, err := orig.DataOffset()
if err != nil {
return err