diff options
author | Paul Duffin <paulduffin@google.com> | 2021-04-21 14:10:42 +0100 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2021-04-22 14:23:28 +0100 |
commit | 74431d57c6bc0a470e974832aa812d88000e3cfa (patch) | |
tree | d2613eaa4b9603d3016b097700a3ec7c0a5f4ce9 /java/platform_bootclasspath.go | |
parent | 3e7fcc3fe788a0b35b12b85e76f559b82a492b18 (diff) |
Move monolithic stub flags generation to platform_bootclasspath
As part of that this change:
* Moves code that will be common to platform_bootclasspath and
bootclasspath_fragment from hiddenapi_singleton.go into
hiddenapi_modular.go.
* Fixes the tests in hiddenapi_singleton_test.go but intentionally
does not rename them or move them into a more appropriate place so
as to make it easier to see the differences. A TODO has been added
and these will be cleaned up in a follow up change.
Bug: 179354495
Test: verified that the monolithic out/soong/hiddenapi/... files are
unchanged by this change
Change-Id: I680e4dab2e6bdf4a655fa9f255c195175904667e
Diffstat (limited to 'java/platform_bootclasspath.go')
-rw-r--r-- | java/platform_bootclasspath.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go index ba758ddfb..568f5e406 100644 --- a/java/platform_bootclasspath.go +++ b/java/platform_bootclasspath.go @@ -140,6 +140,8 @@ func (b *platformBootclasspathModule) OutputFiles(tag string) (android.Paths, er } func (b *platformBootclasspathModule) DepsMutator(ctx android.BottomUpMutatorContext) { + b.hiddenAPIDepsMutator(ctx) + if SkipDexpreoptBootJars(ctx) { return } @@ -149,6 +151,16 @@ func (b *platformBootclasspathModule) DepsMutator(ctx android.BottomUpMutatorCon dexpreopt.RegisterToolDeps(ctx) } +func (b *platformBootclasspathModule) hiddenAPIDepsMutator(ctx android.BottomUpMutatorContext) { + if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { + return + } + + // Add dependencies onto the stub lib modules. + sdkKindToStubLibModules := hiddenAPIComputeMonolithicStubLibModules(ctx.Config()) + hiddenAPIAddStubLibDependencies(ctx, sdkKindToStubLibModules) +} + func platformBootclasspathDepsMutator(ctx android.BottomUpMutatorContext) { m := ctx.Module() if p, ok := m.(*platformBootclasspathModule); ok { @@ -353,10 +365,24 @@ func (b *platformBootclasspathModule) generateHiddenAPIBuildActions(ctx android. baseFlagsPath := hiddenAPISingletonPaths(ctx).stubFlags ruleToGenerateHiddenApiFlags(ctx, outputPath, baseFlagsPath, moduleSpecificFlagsPaths, flagFileInfo) + b.generateHiddenAPIStubFlagsRules(ctx, hiddenAPISupportingModules) b.generateHiddenAPIIndexRules(ctx, hiddenAPISupportingModules) b.generatedHiddenAPIMetadataRules(ctx, hiddenAPISupportingModules) } +func (b *platformBootclasspathModule) generateHiddenAPIStubFlagsRules(ctx android.ModuleContext, modules []hiddenAPISupportingModule) { + bootDexJars := android.Paths{} + for _, module := range modules { + bootDexJars = append(bootDexJars, module.bootDexJar()) + } + + sdkKindToStubPaths := hiddenAPIGatherStubLibDexJarPaths(ctx) + + outputPath := hiddenAPISingletonPaths(ctx).stubFlags + rule := ruleToGenerateHiddenAPIStubFlagsFile(ctx, outputPath, bootDexJars, sdkKindToStubPaths) + rule.Build("platform-bootclasspath-monolithic-hiddenapi-stub-flags", "monolithic hidden API stub flags") +} + func (b *platformBootclasspathModule) generateHiddenAPIIndexRules(ctx android.ModuleContext, modules []hiddenAPISupportingModule) { indexes := android.Paths{} for _, module := range modules { |