Add support for specifying api provided by bootclasspath_fragment
The hidden API processing needs access to dex stub jars for the API scopes provided by the bootclasspath_fragment so that it can mark the corresponding dex members as being part of that API. This change adds the ability to specify the modules that provide those jars, resolve the modules to dex jar stubs and make them available for other modules and tests to use. While the stubs are only needed for hidden API at the moment these were not added to the hidden_api properties section as there are other parts of the build that may need to access the stubs in future, e.g. api fingerprint and aidl generation. The stubs properties can be affected by coverage as when coverage is enabled the jacoco-stubs needs adding to the list, just like how jacocoagent is added to the contents. Bug: 177892522 Test: m nothing Change-Id: I31097d1ca45c84adeba4cbb38f693698cb289e99
This commit is contained in:
@@ -88,6 +88,9 @@ type BootclasspathFragmentCoverageAffectedProperties struct {
|
||||
//
|
||||
// The order of this list matters as it is the order that is used in the bootclasspath.
|
||||
Contents []string
|
||||
|
||||
// The properties for specifying the API stubs provided by this fragment.
|
||||
BootclasspathAPIProperties
|
||||
}
|
||||
|
||||
type bootclasspathFragmentProperties struct {
|
||||
@@ -316,6 +319,9 @@ func (b *BootclasspathFragmentModule) ComponentDepsMutator(ctx android.BottomUpM
|
||||
}
|
||||
|
||||
func (b *BootclasspathFragmentModule) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
// Add dependencies onto all the modules that provide the API stubs for classes on this
|
||||
// bootclasspath fragment.
|
||||
hiddenAPIAddStubLibDependencies(ctx, b.properties.sdkKindToStubLibs())
|
||||
|
||||
if SkipDexpreoptBootJars(ctx) {
|
||||
return
|
||||
@@ -384,6 +390,13 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.
|
||||
|
||||
// Store the information for use by platform_bootclasspath.
|
||||
ctx.SetProvider(hiddenAPIFlagFileInfoProvider, flagFileInfo)
|
||||
|
||||
// Convert the kind specific lists of modules into kind specific lists of jars.
|
||||
stubJarsByKind := hiddenAPIGatherStubLibDexJarPaths(ctx)
|
||||
|
||||
// Store the information for use by other modules.
|
||||
bootclasspathApiInfo := bootclasspathApiInfo{stubJarsByKind: stubJarsByKind}
|
||||
ctx.SetProvider(bootclasspathApiInfoProvider, bootclasspathApiInfo)
|
||||
}
|
||||
|
||||
type bootclasspathFragmentMemberType struct {
|
||||
|
Reference in New Issue
Block a user