From d6a072b39ddc9216a8a353999c1c09cd53dfac9a Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Tue, 20 Jul 2021 19:04:46 +0100 Subject: [PATCH] Remove fallback to classes jars from bootclasspath_fragment Previously, the hidden API processing performed by the platform_bootclasspath would try and get flag files from the fragments it references but would fall back to the classes jars. This change removes that logic as it is no longer needed as all fragments, both source and prebuilts, provide flag files and the prebuilts no longer provide valid classes jars. Bug: 194063708 Test: m out/soong/hiddenapi/hiddenapi-flags.csv - check that this does not change the contents. Change-Id: Ib867a08508f5a0f8858f6baedebbe99b6a825f80 --- java/hiddenapi_monolithic.go | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/java/hiddenapi_monolithic.go b/java/hiddenapi_monolithic.go index 52f0770f3..9d963d258 100644 --- a/java/hiddenapi_monolithic.go +++ b/java/hiddenapi_monolithic.go @@ -58,30 +58,20 @@ func newMonolithicHiddenAPIInfo(ctx android.ModuleContext, flagFilesByCategory F // Merge all the information from the classpathElements. The fragments form a DAG so it is possible that // this will introduce duplicates so they will be resolved after processing all the classpathElements. for _, element := range classpathElements { - var classesJars android.Paths switch e := element.(type) { case *ClasspathLibraryElement: - classesJars = retrieveClassesJarsFromModule(e.Module()) + classesJars := retrieveClassesJarsFromModule(e.Module()) + monolithicInfo.ClassesJars = append(monolithicInfo.ClassesJars, classesJars...) case *ClasspathFragmentElement: fragment := e.Module() if ctx.OtherModuleHasProvider(fragment, HiddenAPIInfoProvider) { info := ctx.OtherModuleProvider(fragment, HiddenAPIInfoProvider).(HiddenAPIInfo) monolithicInfo.append(&info) - - // If the bootclasspath fragment actually perform hidden API processing itself then use the - // CSV files it provides and do not bother processing the classesJars files. This ensures - // consistent behavior between source and prebuilt as prebuilt modules do not provide - // classesJars. - if info.AllFlagsPath != nil { - continue - } + } else { + ctx.ModuleErrorf("%s does not provide hidden API information", fragment) } - - classesJars = extractClassesJarsFromModules(e.Contents) } - - monolithicInfo.ClassesJars = append(monolithicInfo.ClassesJars, classesJars...) } // Dedup paths.