diff options
author | 2021-04-14 08:03:44 +0000 | |
---|---|---|
committer | 2021-04-14 08:03:44 +0000 | |
commit | 35584eeb932f198010b158f0d3922783a480416e (patch) | |
tree | d5b685a384da5217a10a5c64c8d3c7c8d442e072 /java/platform_bootclasspath.go | |
parent | d587ec225a53d91975c9a82845c0d3ca2e94f6f2 (diff) | |
parent | 8f146b99e6a37cce6bedb664ab12bd992ff688ce (diff) |
Merge "prebuilt_apex created ApexInfo must not include prebuilt_ prefix"
Diffstat (limited to 'java/platform_bootclasspath.go')
-rw-r--r-- | java/platform_bootclasspath.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go index d98ce6719..d70098080 100644 --- a/java/platform_bootclasspath.go +++ b/java/platform_bootclasspath.go @@ -208,7 +208,30 @@ func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex st // error, unless missing dependencies are allowed. The simplest way to handle that is to add a // dependency that will not be satisfied and the default behavior will handle it. if !addedDep { - ctx.AddFarVariationDependencies(variations, tag, name) + // Add dependency on the unprefixed (i.e. source or renamed prebuilt) module which we know does + // not exist. The resulting error message will contain useful information about the available + // variants. + reportMissingVariationDependency(ctx, variations, name) + + // Add dependency on the missing prefixed prebuilt variant too if a module with that name exists + // so that information about its available variants will be reported too. + if ctx.OtherModuleExists(prebuiltName) { + reportMissingVariationDependency(ctx, variations, prebuiltName) + } + } +} + +// reportMissingVariationDependency intentionally adds a dependency on a missing variation in order +// to generate an appropriate error message with information about the available variations. +func reportMissingVariationDependency(ctx android.BottomUpMutatorContext, variations []blueprint.Variation, name string) { + modules := ctx.AddFarVariationDependencies(variations, nil, name) + if len(modules) != 1 { + panic(fmt.Errorf("Internal Error: expected one module, found %d", len(modules))) + return + } + if modules[0] != nil { + panic(fmt.Errorf("Internal Error: expected module to be missing but was found: %q", modules[0])) + return } } |