diff options
author | Paul Duffin <paulduffin@google.com> | 2021-05-21 22:18:49 +0100 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2021-05-24 18:20:08 +0100 |
commit | 5aadef8ab5996d817e5c44b22cf6ad8676dd0487 (patch) | |
tree | 4e89756cc6af0a8e55b32889fcb67d2f01c556cd /java/platform_bootclasspath.go | |
parent | cad63842d29cf3f0cd3c433cd547161713f61f40 (diff) |
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
Merged-In: I53805737dff36a3ae87aca5aad51cf46ae1361fe
Change-Id: I53805737dff36a3ae87aca5aad51cf46ae1361fe
(cherry picked from commit 1352f7c4715d3d311a2644b9337e4b1028d82cb0)
Diffstat (limited to 'java/platform_bootclasspath.go')
-rw-r--r-- | java/platform_bootclasspath.go | 24 |
1 files changed, 20 insertions, 4 deletions
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) |