Merge "Remove IsModuleInVersionedSdk" am: e76fa00998
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2318636 Change-Id: I303545c8e011c667933eae6e05b1924e924a9a67 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -216,16 +216,6 @@ func InitSdkAwareModule(m SdkAware) {
|
|||||||
m.AddProperties(&base.properties)
|
m.AddProperties(&base.properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsModuleInVersionedSdk returns true if the module is an versioned sdk.
|
|
||||||
func IsModuleInVersionedSdk(module Module) bool {
|
|
||||||
if s, ok := module.(SdkAware); ok {
|
|
||||||
if !s.ContainingSdk().Unversioned() {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// SnapshotBuilder provides support for generating the build rules which will build the snapshot.
|
// SnapshotBuilder provides support for generating the build rules which will build the snapshot.
|
||||||
type SnapshotBuilder interface {
|
type SnapshotBuilder interface {
|
||||||
// CopyToSnapshot generates a rule that will copy the src to the dest (which is a snapshot
|
// CopyToSnapshot generates a rule that will copy the src to the dest (which is a snapshot
|
||||||
|
2
cc/cc.go
2
cc/cc.go
@@ -3539,7 +3539,7 @@ func (c *Module) IsInstallableToApex() bool {
|
|||||||
if lib := c.library; lib != nil {
|
if lib := c.library; lib != nil {
|
||||||
// Stub libs and prebuilt libs in a versioned SDK are not
|
// Stub libs and prebuilt libs in a versioned SDK are not
|
||||||
// installable to APEX even though they are shared libs.
|
// installable to APEX even though they are shared libs.
|
||||||
return lib.shared() && !lib.buildStubs() && !android.IsModuleInVersionedSdk(c)
|
return lib.shared() && !lib.buildStubs()
|
||||||
} else if _, ok := c.linker.(testPerSrc); ok {
|
} else if _, ok := c.linker.(testPerSrc); ok {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@@ -209,12 +209,6 @@ func IsValidSharedDependency(dependency android.Module) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard versioned members of SDK snapshots, because they will conflict with
|
|
||||||
// unversioned ones.
|
|
||||||
if android.IsModuleInVersionedSdk(dependency) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -200,11 +200,6 @@ func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries {
|
|||||||
dexpreoptEntries := prebuilt.dexpreopter.AndroidMkEntriesForApex()
|
dexpreoptEntries := prebuilt.dexpreopter.AndroidMkEntriesForApex()
|
||||||
return append(dexpreoptEntries, android.AndroidMkEntries{Disabled: true})
|
return append(dexpreoptEntries, android.AndroidMkEntries{Disabled: true})
|
||||||
}
|
}
|
||||||
if android.IsModuleInVersionedSdk(prebuilt) {
|
|
||||||
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
|
||||||
Disabled: true,
|
|
||||||
}}
|
|
||||||
}
|
|
||||||
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
||||||
Class: "JAVA_LIBRARIES",
|
Class: "JAVA_LIBRARIES",
|
||||||
OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile),
|
OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile),
|
||||||
|
@@ -332,19 +332,6 @@ func bootclasspathFragmentInitContentsFromImage(ctx android.EarlyModuleContext,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(b/177892522): Prebuilts (versioned or not) should not use the image_name property.
|
|
||||||
if android.IsModuleInVersionedSdk(m) {
|
|
||||||
// The module is a versioned prebuilt so ignore it. This is done for a couple of reasons:
|
|
||||||
// 1. There is no way to use this at the moment so ignoring it is safe.
|
|
||||||
// 2. Attempting to initialize the contents property from the configuration will end up having
|
|
||||||
// the versioned prebuilt depending on the unversioned prebuilt. That will cause problems
|
|
||||||
// as the unversioned prebuilt could end up with an APEX variant created for the source
|
|
||||||
// APEX which will prevent it from having an APEX variant for the prebuilt APEX which in
|
|
||||||
// turn will prevent it from accessing the dex implementation jar from that which will
|
|
||||||
// break hidden API processing, amongst others.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the configuration for the art apex jars. Do not use getImageConfig(ctx) here as this is
|
// Get the configuration for the art apex jars. Do not use getImageConfig(ctx) here as this is
|
||||||
// too early in the Soong processing for that to work.
|
// too early in the Soong processing for that to work.
|
||||||
global := dexpreopt.GetGlobalConfig(ctx)
|
global := dexpreopt.GetGlobalConfig(ctx)
|
||||||
@@ -383,19 +370,6 @@ func bootclasspathFragmentInitContentsFromImage(ctx android.EarlyModuleContext,
|
|||||||
func (b *BootclasspathFragmentModule) bootclasspathImageNameContentsConsistencyCheck(ctx android.BaseModuleContext) {
|
func (b *BootclasspathFragmentModule) bootclasspathImageNameContentsConsistencyCheck(ctx android.BaseModuleContext) {
|
||||||
imageName := proptools.String(b.properties.Image_name)
|
imageName := proptools.String(b.properties.Image_name)
|
||||||
if imageName == "art" {
|
if imageName == "art" {
|
||||||
// TODO(b/177892522): Prebuilts (versioned or not) should not use the image_name property.
|
|
||||||
if android.IsModuleInVersionedSdk(b) {
|
|
||||||
// The module is a versioned prebuilt so ignore it. This is done for a couple of reasons:
|
|
||||||
// 1. There is no way to use this at the moment so ignoring it is safe.
|
|
||||||
// 2. Attempting to initialize the contents property from the configuration will end up having
|
|
||||||
// the versioned prebuilt depending on the unversioned prebuilt. That will cause problems
|
|
||||||
// as the unversioned prebuilt could end up with an APEX variant created for the source
|
|
||||||
// APEX which will prevent it from having an APEX variant for the prebuilt APEX which in
|
|
||||||
// turn will prevent it from accessing the dex implementation jar from that which will
|
|
||||||
// break hidden API processing, amongst others.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the configuration for the art apex jars.
|
// Get the configuration for the art apex jars.
|
||||||
modules := b.getImageConfig(ctx).modules
|
modules := b.getImageConfig(ctx).modules
|
||||||
configuredJars := modules.CopyOfJars()
|
configuredJars := modules.CopyOfJars()
|
||||||
@@ -575,57 +549,48 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo
|
|||||||
// prebuilt which will not use the image config.
|
// prebuilt which will not use the image config.
|
||||||
imageConfig := b.getImageConfig(ctx)
|
imageConfig := b.getImageConfig(ctx)
|
||||||
|
|
||||||
// A versioned prebuilt_bootclasspath_fragment cannot and does not need to perform hidden API
|
// Perform hidden API processing.
|
||||||
// processing. It cannot do it because it is not part of a prebuilt_apex and so has no access to
|
hiddenAPIOutput := b.generateHiddenAPIBuildActions(ctx, contents, fragments)
|
||||||
// the correct dex implementation jar. It does not need to because the platform-bootclasspath
|
|
||||||
// always references the latest bootclasspath_fragments.
|
|
||||||
if !android.IsModuleInVersionedSdk(ctx.Module()) {
|
|
||||||
// Perform hidden API processing.
|
|
||||||
hiddenAPIOutput := b.generateHiddenAPIBuildActions(ctx, contents, fragments)
|
|
||||||
|
|
||||||
var bootImageFiles bootImageOutputs
|
var bootImageFiles bootImageOutputs
|
||||||
if imageConfig != nil {
|
if imageConfig != nil {
|
||||||
// Delegate the production of the boot image files to a module type specific method.
|
// Delegate the production of the boot image files to a module type specific method.
|
||||||
common := ctx.Module().(commonBootclasspathFragment)
|
common := ctx.Module().(commonBootclasspathFragment)
|
||||||
bootImageFiles = common.produceBootImageFiles(ctx, imageConfig)
|
bootImageFiles = common.produceBootImageFiles(ctx, imageConfig)
|
||||||
|
|
||||||
if shouldCopyBootFilesToPredefinedLocations(ctx, imageConfig) {
|
if shouldCopyBootFilesToPredefinedLocations(ctx, imageConfig) {
|
||||||
// Zip the boot image files up, if available. This will generate the zip file in a
|
// Zip the boot image files up, if available. This will generate the zip file in a
|
||||||
// predefined location.
|
// predefined location.
|
||||||
buildBootImageZipInPredefinedLocation(ctx, imageConfig, bootImageFiles.byArch)
|
buildBootImageZipInPredefinedLocation(ctx, imageConfig, bootImageFiles.byArch)
|
||||||
|
|
||||||
// Copy the dex jars of this fragment's content modules to their predefined locations.
|
// Copy the dex jars of this fragment's content modules to their predefined locations.
|
||||||
copyBootJarsToPredefinedLocations(ctx, hiddenAPIOutput.EncodedBootDexFilesByModule, imageConfig.dexPathsByModule)
|
copyBootJarsToPredefinedLocations(ctx, hiddenAPIOutput.EncodedBootDexFilesByModule, imageConfig.dexPathsByModule)
|
||||||
}
|
|
||||||
|
|
||||||
for _, variant := range bootImageFiles.variants {
|
|
||||||
archType := variant.config.target.Arch.ArchType
|
|
||||||
arch := archType.String()
|
|
||||||
for _, install := range variant.deviceInstalls {
|
|
||||||
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.
|
|
||||||
installDir := strings.TrimPrefix(filepath.Dir(install.To), "/")
|
|
||||||
installBase := filepath.Base(install.To)
|
|
||||||
installPath := android.PathForModuleInPartitionInstall(ctx, "", installDir)
|
|
||||||
|
|
||||||
b.bootImageDeviceInstalls = append(b.bootImageDeviceInstalls, dexpreopterInstall{
|
|
||||||
name: arch + "-" + installBase,
|
|
||||||
moduleName: b.Name(),
|
|
||||||
outputPathOnHost: install.From,
|
|
||||||
installDirOnDevice: installPath,
|
|
||||||
installFileOnDevice: installBase,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A prebuilt fragment cannot contribute to an apex.
|
for _, variant := range bootImageFiles.variants {
|
||||||
if !android.IsModulePrebuilt(ctx.Module()) {
|
archType := variant.config.target.Arch.ArchType
|
||||||
// Provide the apex content info.
|
arch := archType.String()
|
||||||
b.provideApexContentInfo(ctx, imageConfig, hiddenAPIOutput, bootImageFiles)
|
for _, install := range variant.deviceInstalls {
|
||||||
|
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.
|
||||||
|
installDir := strings.TrimPrefix(filepath.Dir(install.To), "/")
|
||||||
|
installBase := filepath.Base(install.To)
|
||||||
|
installPath := android.PathForModuleInPartitionInstall(ctx, "", installDir)
|
||||||
|
|
||||||
|
b.bootImageDeviceInstalls = append(b.bootImageDeviceInstalls, dexpreopterInstall{
|
||||||
|
name: arch + "-" + installBase,
|
||||||
|
moduleName: b.Name(),
|
||||||
|
outputPathOnHost: install.From,
|
||||||
|
installDirOnDevice: installPath,
|
||||||
|
installFileOnDevice: installBase,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
// Versioned fragments are not needed by make.
|
|
||||||
b.HideFromMake()
|
// A prebuilt fragment cannot contribute to an apex.
|
||||||
|
if !android.IsModulePrebuilt(ctx.Module()) {
|
||||||
|
// Provide the apex content info.
|
||||||
|
b.provideApexContentInfo(ctx, imageConfig, hiddenAPIOutput, bootImageFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
// In order for information about bootclasspath_fragment modules to be added to module-info.json
|
// In order for information about bootclasspath_fragment modules to be added to module-info.json
|
||||||
@@ -719,7 +684,7 @@ func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext)
|
|||||||
jars = jars.Append("com.android.sdkext", "test_framework-sdkextensions")
|
jars = jars.Append("com.android.sdkext", "test_framework-sdkextensions")
|
||||||
} else if android.InList("test_framework-apexd", possibleUpdatableModules) {
|
} else if android.InList("test_framework-apexd", possibleUpdatableModules) {
|
||||||
jars = jars.Append("com.android.apex.test_package", "test_framework-apexd")
|
jars = jars.Append("com.android.apex.test_package", "test_framework-apexd")
|
||||||
} else if global.ApexBootJars.Len() != 0 && !android.IsModuleInVersionedSdk(ctx.Module()) {
|
} else if global.ApexBootJars.Len() != 0 {
|
||||||
unknown = android.RemoveListFromList(unknown, b.properties.Coverage.Contents)
|
unknown = android.RemoveListFromList(unknown, b.properties.Coverage.Contents)
|
||||||
_, unknown = android.RemoveFromList("core-icu4j", unknown)
|
_, unknown = android.RemoveFromList("core-icu4j", unknown)
|
||||||
// This module only exists in car products.
|
// This module only exists in car products.
|
||||||
@@ -961,11 +926,6 @@ func (b *BootclasspathFragmentModule) generateBootImageBuildActions(ctx android.
|
|||||||
return bootImageOutputs{}
|
return bootImageOutputs{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bootclasspath fragment modules that are versioned do not produce a boot image.
|
|
||||||
if android.IsModuleInVersionedSdk(ctx.Module()) {
|
|
||||||
return bootImageOutputs{}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build a profile for the image config and then use that to build the boot image.
|
// Build a profile for the image config and then use that to build the boot image.
|
||||||
profile := bootImageProfileRule(ctx, imageConfig)
|
profile := bootImageProfileRule(ctx, imageConfig)
|
||||||
|
|
||||||
|
@@ -1352,14 +1352,6 @@ func deferReportingMissingBootDexJar(ctx android.ModuleContext, module android.M
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// A bootclasspath module that is part of a versioned sdk never provides a boot dex jar as there
|
|
||||||
// is no equivalently versioned prebuilt APEX file from which it can be obtained. However,
|
|
||||||
// versioned bootclasspath modules are processed by Soong so in order to avoid them causing build
|
|
||||||
// failures missing boot dex jars need to be deferred.
|
|
||||||
if android.IsModuleInVersionedSdk(ctx.Module()) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is called for both platform_bootclasspath and bootclasspath_fragment modules.
|
// This is called for both platform_bootclasspath and bootclasspath_fragment modules.
|
||||||
//
|
//
|
||||||
// A bootclasspath_fragment module should only use the APEX variant of source or prebuilt modules.
|
// A bootclasspath_fragment module should only use the APEX variant of source or prebuilt modules.
|
||||||
|
@@ -223,18 +223,6 @@ type platformCompatConfigSingleton struct {
|
|||||||
metadata android.Path
|
metadata android.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
// isModulePreferredByCompatConfig checks to see whether the module is preferred for use by
|
|
||||||
// platform compat config.
|
|
||||||
func isModulePreferredByCompatConfig(module android.Module) bool {
|
|
||||||
// A versioned prebuilt_platform_compat_config, i.e. foo-platform-compat-config@current should be
|
|
||||||
// ignored.
|
|
||||||
if android.IsModuleInVersionedSdk(module) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return android.IsModulePreferred(module)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||||
|
|
||||||
var compatConfigMetadata android.Paths
|
var compatConfigMetadata android.Paths
|
||||||
@@ -244,7 +232,7 @@ func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.Singlet
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if c, ok := module.(platformCompatConfigMetadataProvider); ok {
|
if c, ok := module.(platformCompatConfigMetadataProvider); ok {
|
||||||
if !isModulePreferredByCompatConfig(module) {
|
if !android.IsModulePreferred(module) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
metadata := c.compatConfigMetadata()
|
metadata := c.compatConfigMetadata()
|
||||||
|
@@ -160,7 +160,7 @@ func (s *SystemServerClasspathModule) configuredJars(ctx android.ModuleContext)
|
|||||||
// This is an exception to support end-to-end test for ApexdUnitTests, until such support exists.
|
// This is an exception to support end-to-end test for ApexdUnitTests, until such support exists.
|
||||||
if android.InList("test_service-apexd", possibleUpdatableModules) {
|
if android.InList("test_service-apexd", possibleUpdatableModules) {
|
||||||
jars = jars.Append("com.android.apex.test_package", "test_service-apexd")
|
jars = jars.Append("com.android.apex.test_package", "test_service-apexd")
|
||||||
} else if global.ApexSystemServerJars.Len() > 0 && len(unknown) > 0 && !android.IsModuleInVersionedSdk(ctx.Module()) {
|
} else if global.ApexSystemServerJars.Len() > 0 && len(unknown) > 0 {
|
||||||
// For non test apexes, make sure that all contents are actually declared in make.
|
// For non test apexes, make sure that all contents are actually declared in make.
|
||||||
ctx.ModuleErrorf("%s in contents must also be declared in PRODUCT_APEX_SYSTEM_SERVER_JARS", unknown)
|
ctx.ModuleErrorf("%s in contents must also be declared in PRODUCT_APEX_SYSTEM_SERVER_JARS", unknown)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user