From 81667c8c11ec6a37f10e893de2ec7fc6eb2ad2ac Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Mon, 26 Apr 2021 13:55:36 +0100 Subject: [PATCH] Remove panics from reportMissingVariationDependency The code that has been removed triggers in many cases when it should not, e.g. an unknown module on the bootclasspath. The code was originally added to try and ensure that if the attempt to add useful error messages failed it would help debug the issue. However, it ended up just creating more failures. If this does become an issue then this will be revisited. Bug: 177892522 Test: Add an unknown module to PRODUCT_BOOT_JARS m SOONG_ALLOW_MISSING_DEPENDENCIES=true Change-Id: I08dbd4b29d301f3f1f78a0fb396687062b47deb8 --- java/bootclasspath.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/java/bootclasspath.go b/java/bootclasspath.go index 6ca0f7533..c16193d73 100644 --- a/java/bootclasspath.go +++ b/java/bootclasspath.go @@ -15,9 +15,8 @@ package java import ( - "fmt" - "android/soong/android" + "github.com/google/blueprint" "github.com/google/blueprint/proptools" ) @@ -116,15 +115,7 @@ func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex st // 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 - } + ctx.AddFarVariationDependencies(variations, nil, name) } // ApexVariantReference specifies a particular apex variant of a module.