apex: Remove host support
Since we no longer support "zip" APEX, we don't need "host" support.
For example, we don't need go/python binary support.
Bug: 279835185
Test: m
Change-Id: I6e8d2b205e42662f31866dc9ac7507524effd144
diff --git a/apex/apex.go b/apex/apex.go
index e35805f..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"
)
@@ -487,12 +485,10 @@
app apexFileClass = iota
appSet
etc
- goBinary
javaSharedLib
nativeExecutable
nativeSharedLib
nativeTest
- pyBinary
shBinary
)
@@ -501,12 +497,10 @@
"app": app,
"appSet": appSet,
"etc": etc,
- "goBinary": goBinary,
"javaSharedLib": javaSharedLib,
"nativeExecutable": nativeExecutable,
"nativeSharedLib": nativeSharedLib,
"nativeTest": nativeTest,
- "pyBinary": pyBinary,
"shBinary": shBinary,
}
)
@@ -697,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
@@ -721,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
@@ -788,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
@@ -1230,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
}
@@ -1391,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
@@ -1502,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)
}
@@ -1516,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" {
@@ -1616,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 {
@@ -1989,11 +1947,6 @@
if !forced && updatable {
a.linkToSystemLib = false
}
-
- // We also don't want the optimization for host APEXes, because it doesn't make sense.
- if ctx.Host() {
- a.linkToSystemLib = false
- }
}
func (a *apexBundle) setPayloadFsType(ctx android.ModuleContext) {
@@ -2111,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
@@ -2280,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,
@@ -2416,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
@@ -2601,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)
@@ -2832,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
}
@@ -2927,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
}
@@ -2985,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