diff options
Diffstat (limited to 'java/bootclasspath_fragment.go')
| -rw-r--r-- | java/bootclasspath_fragment.go | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index 0d61d82c9..db49df8df 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -367,6 +367,11 @@ func (b *BootclasspathFragmentModule) DepsMutator(ctx android.BottomUpMutatorCon dexpreopt.RegisterToolDeps(ctx) } +func (b *BootclasspathFragmentModule) BootclasspathDepsMutator(ctx android.BottomUpMutatorContext) { + // Add dependencies on all the fragments. + b.properties.BootclasspathFragmentsDepsProperties.addDependenciesOntoFragments(ctx) +} + func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Only perform a consistency check if this module is the active module. That will prevent an // unused prebuilt that was created without instrumentation from breaking an instrumentation @@ -387,8 +392,10 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo } }) + fragments := gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag) + // Perform hidden API processing. - hiddenAPIFlagOutput := b.generateHiddenAPIBuildActions(ctx, contents) + hiddenAPIFlagOutput := b.generateHiddenAPIBuildActions(ctx, contents, fragments) // Verify that the image_name specified on a bootclasspath_fragment is valid even if this is a // prebuilt which will not use the image config. @@ -502,10 +509,10 @@ func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleCont } // generateHiddenAPIBuildActions generates all the hidden API related build rules. -func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.ModuleContext, contents []android.Module) *HiddenAPIFlagOutput { +func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.ModuleContext, contents []android.Module, fragments []android.Module) *HiddenAPIFlagOutput { // Create hidden API input structure. - input := b.createHiddenAPIFlagInput(ctx, contents) + input := b.createHiddenAPIFlagInput(ctx, contents, fragments) var output *HiddenAPIFlagOutput @@ -531,8 +538,10 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android. // perform its own flag generation. FlagFilesByCategory: input.FlagFilesByCategory, - // Make these available for tests. - StubDexJarsByKind: input.StubDexJarsByKind, + // Other bootclasspath_fragments that depend on this need the transitive set of stub dex jars + // from this to resolve any references from their code to classes provided by this fragment + // and the fragments this depends upon. + TransitiveStubDexJarsByKind: input.transitiveStubDexJarsByKind(), } if output != nil { @@ -549,7 +558,13 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android. // createHiddenAPIFlagInput creates a HiddenAPIFlagInput struct and initializes it with information derived // from the properties on this module and its dependencies. -func (b *BootclasspathFragmentModule) createHiddenAPIFlagInput(ctx android.ModuleContext, contents []android.Module) HiddenAPIFlagInput { +func (b *BootclasspathFragmentModule) createHiddenAPIFlagInput(ctx android.ModuleContext, contents []android.Module, fragments []android.Module) HiddenAPIFlagInput { + + // Merge the HiddenAPIInfo from all the fragment dependencies. + dependencyHiddenApiInfo := newHiddenAPIInfo() + dependencyHiddenApiInfo.mergeFromFragmentDeps(ctx, fragments) + + // Create hidden API flag input structure. input := newHiddenAPIFlagInput() // Update the input structure with information obtained from the stub libraries. @@ -558,6 +573,9 @@ func (b *BootclasspathFragmentModule) createHiddenAPIFlagInput(ctx android.Modul // Populate with flag file paths from the properties. input.extractFlagFilesFromProperties(ctx, &b.properties.Hidden_api) + // Store the stub dex jars from this module's fragment dependencies. + input.DependencyStubDexJarsByKind = dependencyHiddenApiInfo.TransitiveStubDexJarsByKind + return input } |