Merge "Ensure java_system_modules_import uses prebuilts" am: fc9c218e83 am: 5b58ea07dd am: 999d00098d

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5cb81d9cc34b6cd4e73f49d54cf4f4a86f871ea5
This commit is contained in:
Paul Duffin 2021-03-11 17:38:15 +00:00 committed by Automerger Merge Worker
commit 214dcbbc77
2 changed files with 17 additions and 3 deletions

View File

@ -169,7 +169,13 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte
system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, jars)
}
func (system *SystemModules) DepsMutator(ctx android.BottomUpMutatorContext) {
// ComponentDepsMutator is called before prebuilt modules without a corresponding source module are
// renamed so unless the supplied libs specifically includes the prebuilt_ prefix this is guaranteed
// to only add dependencies on source modules.
//
// The systemModuleLibsTag will prevent the prebuilt mutators from replacing this dependency so it
// will never be changed to depend on a prebuilt either.
func (system *SystemModules) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddVariationDependencies(nil, systemModulesLibsTag, system.properties.Libs...)
}
@ -225,6 +231,15 @@ func (system *systemModulesImport) Prebuilt() *android.Prebuilt {
return &system.prebuilt
}
// ComponentDepsMutator is called before prebuilt modules without a corresponding source module are
// renamed so as this adds a prebuilt_ prefix this is guaranteed to only add dependencies on source
// modules.
func (system *systemModulesImport) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
for _, lib := range system.properties.Libs {
ctx.AddVariationDependencies(nil, systemModulesLibsTag, "prebuilt_"+lib)
}
}
type systemModulesSdkMemberType struct {
android.SdkMemberTypeBase
}

View File

@ -107,7 +107,6 @@ func TestJavaSystemModulesMixSourceAndPrebuilt(t *testing.T) {
prebuiltInputs := prebuiltSystemModules.Rule("jarsTosystemModules").Inputs
// The expected paths are the header jars from the renamed prebuilt input modules.
// TODO(b/182402568) - these should be depending on the prebuilts
expectedPrebuiltPaths := normalizedPathsToHeaderJars(result, "system-module1", "system-module2")
expectedPrebuiltPaths := normalizedPathsToHeaderJars(result, "prebuilt_system-module1", "prebuilt_system-module2")
result.AssertArrayString("prebuilt system modules inputs", expectedPrebuiltPaths, result.NormalizePathsForTesting(prebuiltInputs))
}