From 89f570ac44af4bcf5b78fa8dad3d57f24cd3ca0e Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Wed, 16 Jun 2021 01:42:33 +0100 Subject: Use classpath elements in platform_bootclasspath Use classpath elements in newMonolithicHiddenAPIInfo. That means the method can collate information from both fragments and libraries rather than just fragments. So, this change moves the collation of the classesJars into the method. Bug: 177892522 Test: m out/soong/hiddenapi/hiddenapi-flags.csv out/soong/hiddenapi/hiddenapi-index.csv - make sure that this change does not affect the contents. Change-Id: I7c2a229fab60d02bd211438735a8d7303ed83386 --- java/platform_bootclasspath.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'java/platform_bootclasspath.go') diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go index 02343adba..3f5c94067 100644 --- a/java/platform_bootclasspath.go +++ b/java/platform_bootclasspath.go @@ -44,13 +44,9 @@ type platformBootclasspathModule struct { properties platformBootclasspathProperties // The apex:module pairs obtained from the configured modules. - // - // Currently only for testing. configuredModules []android.Module // The apex:module pairs obtained from the fragments. - // - // Currently only for testing. fragments []android.Module // Path to the monolithic hiddenapi-flags.csv file. @@ -280,7 +276,15 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android. return nil } - monolithicInfo := b.createAndProvideMonolithicHiddenAPIInfo(ctx, fragments) + // Construct a list of ClasspathElement objects from the modules and fragments. + classpathElements := CreateClasspathElements(ctx, modules, fragments) + + monolithicInfo := b.createAndProvideMonolithicHiddenAPIInfo(ctx, classpathElements) + + // Extract the classes jars only from those libraries that do not have corresponding fragments as + // the fragments will have already provided the flags that are needed. + classesJars := monolithicInfo.ClassesJars + // Create the input to pass to ruleToGenerateHiddenAPIStubFlagsFile input := newHiddenAPIFlagInput() @@ -297,9 +301,6 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android. rule := ruleToGenerateHiddenAPIStubFlagsFile(ctx, stubFlags, bootDexJarByModule.bootDexJars(), input) rule.Build("platform-bootclasspath-monolithic-hiddenapi-stub-flags", "monolithic hidden API stub flags") - // Extract the classes jars from the contents. - classesJars := extractClassesJarsFromModules(modules) - // Generate the annotation-flags.csv file from all the module annotations. annotationFlags := android.PathForModuleOut(ctx, "hiddenapi-monolithic", "annotation-flags.csv") buildRuleToGenerateAnnotationFlags(ctx, "monolithic hiddenapi flags", classesJars, stubFlags, annotationFlags) @@ -329,7 +330,7 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android. // createAndProvideMonolithicHiddenAPIInfo creates a MonolithicHiddenAPIInfo and provides it for // testing. -func (b *platformBootclasspathModule) createAndProvideMonolithicHiddenAPIInfo(ctx android.ModuleContext, fragments []android.Module) MonolithicHiddenAPIInfo { +func (b *platformBootclasspathModule) createAndProvideMonolithicHiddenAPIInfo(ctx android.ModuleContext, classpathElements ClasspathElements) MonolithicHiddenAPIInfo { // Create a temporary input structure in which to collate information provided directly by this // module, either through properties or direct dependencies. temporaryInput := newHiddenAPIFlagInput() @@ -339,7 +340,7 @@ func (b *platformBootclasspathModule) createAndProvideMonolithicHiddenAPIInfo(ct // Create the monolithic info, by starting with the flag files specified on this and then merging // in information from all the fragment dependencies of this. - monolithicInfo := newMonolithicHiddenAPIInfo(ctx, temporaryInput.FlagFilesByCategory, fragments) + monolithicInfo := newMonolithicHiddenAPIInfo(ctx, temporaryInput.FlagFilesByCategory, classpathElements) // Store the information for testing. ctx.SetProvider(MonolithicHiddenAPIInfoProvider, monolithicInfo) -- cgit v1.2.3-59-g8ed1b