From 1352f7c4715d3d311a2644b9337e4b1028d82cb0 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 21 May 2021 22:18:49 +0100 Subject: Separate input to flag generation from hiddenAPIFlagFileInfo Encapsulating the information needed by hidden API processing in a struct makes it easy to add additional information in future and allows the code to populate that struct from various different sources to be grouped together. Bug: 179354495 Test: m com.android.art com.android.ipsec com.android.os.statsd com.android.conscrypt - verify that this does not change the contents of the apex files Change-Id: I53805737dff36a3ae87aca5aad51cf46ae1361fe --- java/platform_bootclasspath.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'java/platform_bootclasspath.go') diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go index df0ba2a42..854179e2c 100644 --- a/java/platform_bootclasspath.go +++ b/java/platform_bootclasspath.go @@ -281,14 +281,22 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android. monolithicInfo := b.createAndProvideMonolithicHiddenAPIInfo(ctx, fragments) - sdkKindToStubPaths := hiddenAPIGatherStubLibDexJarPaths(ctx, nil) + // Create the input to pass to ruleToGenerateHiddenAPIStubFlagsFile + input := newHiddenAPIFlagInput() + + // Gather stub library information from the dependencies on modules provided by + // hiddenAPIComputeMonolithicStubLibModules. + input.gatherStubLibInfo(ctx, nil) + + // Use the flag files from this module and all the fragments. + input.FlagFilesByCategory = monolithicInfo.FlagsFilesByCategory hiddenAPIModules := gatherHiddenAPIModuleFromContents(ctx, modules) // Generate the monolithic stub-flags.csv file. bootDexJars := extractBootDexJarsFromHiddenAPIModules(ctx, hiddenAPIModules) stubFlags := hiddenAPISingletonPaths(ctx).stubFlags - rule := ruleToGenerateHiddenAPIStubFlagsFile(ctx, stubFlags, bootDexJars, sdkKindToStubPaths) + rule := ruleToGenerateHiddenAPIStubFlagsFile(ctx, stubFlags, bootDexJars, input) rule.Build("platform-bootclasspath-monolithic-hiddenapi-stub-flags", "monolithic hidden API stub flags") // Extract the classes jars from the contents. @@ -322,8 +330,16 @@ 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 { - flagFileInfo := b.properties.Hidden_api.hiddenAPIFlagFileInfo(ctx) - monolithicInfo := newMonolithicHiddenAPIInfo(ctx, flagFileInfo.FlagFilesByCategory, fragments) + // Create a temporary input structure in which to collate information provided directly by this + // module, either through properties or direct dependencies. + temporaryInput := newHiddenAPIFlagInput() + + // Create paths to the flag files specified in the properties. + temporaryInput.extractFlagFilesFromProperties(ctx, &b.properties.Hidden_api) + + // 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) // Store the information for testing. ctx.SetProvider(monolithicHiddenAPIInfoProvider, monolithicInfo) -- cgit v1.2.3-59-g8ed1b