Merge changes I16389102,I105f4fba am: 12206326d6

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1689752

Change-Id: Ida86926b0fc80b47228ff2975b714cb9af50a4dd
This commit is contained in:
Paul Duffin 2021-04-29 12:36:24 +00:00 committed by Automerger Merge Worker
commit bbc5cbcf0f
4 changed files with 28 additions and 15 deletions

View File

@ -69,13 +69,15 @@ func addDependencyOntoApexVariants(ctx android.BottomUpMutatorContext, propertyN
// addDependencyOntoApexModulePair adds a dependency onto the specified APEX specific variant or the // addDependencyOntoApexModulePair adds a dependency onto the specified APEX specific variant or the
// specified module. // specified module.
// //
// If apex="platform" then this adds a dependency onto the platform variant of the module. This adds // If apex="platform" or "system_ext" then this adds a dependency onto the platform variant of the
// dependencies onto the prebuilt and source modules with the specified name, depending on which // module. This adds dependencies onto the prebuilt and source modules with the specified name,
// ones are available. Visiting must use isActiveModule to select the preferred module when both // depending on which ones are available. Visiting must use isActiveModule to select the preferred
// source and prebuilt modules are available. // module when both source and prebuilt modules are available.
//
// Use gatherApexModulePairDepsWithTag to retrieve the dependencies.
func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex string, name string, tag blueprint.DependencyTag) { func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex string, name string, tag blueprint.DependencyTag) {
var variations []blueprint.Variation var variations []blueprint.Variation
if apex != "platform" { if apex != "platform" && apex != "system_ext" {
// Pick the correct apex variant. // Pick the correct apex variant.
variations = []blueprint.Variation{ variations = []blueprint.Variation{
{Mutator: "apex", Variation: apex}, {Mutator: "apex", Variation: apex},
@ -118,12 +120,28 @@ func reportMissingVariationDependency(ctx android.BottomUpMutatorContext, variat
ctx.AddFarVariationDependencies(variations, nil, name) ctx.AddFarVariationDependencies(variations, nil, name)
} }
// gatherApexModulePairDepsWithTag returns the list of dependencies with the supplied tag that was
// added by addDependencyOntoApexModulePair.
func gatherApexModulePairDepsWithTag(ctx android.BaseModuleContext, tag blueprint.DependencyTag) []android.Module {
var modules []android.Module
ctx.VisitDirectDepsIf(isActiveModule, func(module android.Module) {
t := ctx.OtherModuleDependencyTag(module)
if t == tag {
modules = append(modules, module)
}
})
return modules
}
// ApexVariantReference specifies a particular apex variant of a module. // ApexVariantReference specifies a particular apex variant of a module.
type ApexVariantReference struct { type ApexVariantReference struct {
// The name of the module apex variant, i.e. the apex containing the module variant. // The name of the module apex variant, i.e. the apex containing the module variant.
// //
// If this is not specified then it defaults to "platform" which will cause a dependency to be // If this is not specified then it defaults to "platform" which will cause a dependency to be
// added to the module's platform variant. // added to the module's platform variant.
//
// A value of system_ext should be used for any module that will be part of the system_ext
// partition.
Apex *string Apex *string
// The name of the module. // The name of the module.

View File

@ -186,7 +186,7 @@ func isModuleInConfiguredList(ctx android.BaseModuleContext, module android.Modu
// Now match the apex part of the boot image configuration. // Now match the apex part of the boot image configuration.
requiredApex := configuredBootJars.Apex(index) requiredApex := configuredBootJars.Apex(index)
if requiredApex == "platform" { if requiredApex == "platform" || requiredApex == "system_ext" {
if len(apexInfo.InApexes) != 0 { if len(apexInfo.InApexes) != 0 {
// A platform variant is required but this is for an apex so ignore it. // A platform variant is required but this is for an apex so ignore it.
return false return false

View File

@ -152,14 +152,8 @@ func addDependenciesOntoBootImageModules(ctx android.BottomUpMutatorContext, mod
func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
b.classpathFragmentBase().generateAndroidBuildActions(ctx) b.classpathFragmentBase().generateAndroidBuildActions(ctx)
ctx.VisitDirectDepsIf(isActiveModule, func(module android.Module) { b.configuredModules = gatherApexModulePairDepsWithTag(ctx, platformBootclasspathModuleDepTag)
tag := ctx.OtherModuleDependencyTag(module) b.fragments = gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag)
if tag == platformBootclasspathModuleDepTag {
b.configuredModules = append(b.configuredModules, module)
} else if tag == bootclasspathFragmentDepTag {
b.fragments = append(b.fragments, module)
}
})
b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments) b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments)

View File

@ -33,7 +33,7 @@ var prepareForTestWithPlatformBootclasspath = android.GroupFixturePreparers(
func TestPlatformBootclasspath(t *testing.T) { func TestPlatformBootclasspath(t *testing.T) {
preparer := android.GroupFixturePreparers( preparer := android.GroupFixturePreparers(
prepareForTestWithPlatformBootclasspath, prepareForTestWithPlatformBootclasspath,
FixtureConfigureBootJars("platform:foo", "platform:bar"), FixtureConfigureBootJars("platform:foo", "system_ext:bar"),
android.FixtureWithRootAndroidBp(` android.FixtureWithRootAndroidBp(`
platform_bootclasspath { platform_bootclasspath {
name: "platform-bootclasspath", name: "platform-bootclasspath",
@ -45,6 +45,7 @@ func TestPlatformBootclasspath(t *testing.T) {
system_modules: "none", system_modules: "none",
sdk_version: "none", sdk_version: "none",
compile_dex: true, compile_dex: true,
system_ext_specific: true,
} }
`), `),
) )