Merge "Make bootclasspath_fragments always perform hidden API processing" into sc-dev
This commit is contained in:
@@ -576,25 +576,9 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.
|
|||||||
// Create hidden API input structure.
|
// Create hidden API input structure.
|
||||||
input := b.createHiddenAPIFlagInput(ctx, contents, fragments)
|
input := b.createHiddenAPIFlagInput(ctx, contents, fragments)
|
||||||
|
|
||||||
var output *HiddenAPIOutput
|
|
||||||
|
|
||||||
// Hidden API processing is conditional as a temporary workaround as not all
|
|
||||||
// bootclasspath_fragments provide the appropriate information needed for hidden API processing
|
|
||||||
// which leads to breakages of the build.
|
|
||||||
// TODO(b/179354495): Stop hidden API processing being conditional once all bootclasspath_fragment
|
|
||||||
// modules have been updated to support it.
|
|
||||||
if input.canPerformHiddenAPIProcessing(ctx, b.properties) {
|
|
||||||
// Delegate the production of the hidden API all-flags.csv file to a module type specific method.
|
// Delegate the production of the hidden API all-flags.csv file to a module type specific method.
|
||||||
common := ctx.Module().(commonBootclasspathFragment)
|
common := ctx.Module().(commonBootclasspathFragment)
|
||||||
output = common.produceHiddenAPIOutput(ctx, contents, input)
|
output := common.produceHiddenAPIOutput(ctx, contents, input)
|
||||||
} else {
|
|
||||||
// As hidden API processing cannot be performed fall back to trying to retrieve the legacy
|
|
||||||
// encoded boot dex files, i.e. those files encoded by the individual libraries and returned
|
|
||||||
// from the DexJarBuildPath() method.
|
|
||||||
output = &HiddenAPIOutput{
|
|
||||||
EncodedBootDexFilesByModule: retrieveLegacyEncodedBootDexFiles(ctx, contents),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize a HiddenAPIInfo structure.
|
// Initialize a HiddenAPIInfo structure.
|
||||||
hiddenAPIInfo := HiddenAPIInfo{
|
hiddenAPIInfo := HiddenAPIInfo{
|
||||||
|
@@ -20,7 +20,6 @@ import (
|
|||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Contains support for processing hiddenAPI in a modular fashion.
|
// Contains support for processing hiddenAPI in a modular fashion.
|
||||||
@@ -697,42 +696,6 @@ func newHiddenAPIFlagInput() HiddenAPIFlagInput {
|
|||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
|
|
||||||
// canPerformHiddenAPIProcessing determines whether hidden API processing should be performed.
|
|
||||||
//
|
|
||||||
// A temporary workaround to avoid existing bootclasspath_fragments that do not provide the
|
|
||||||
// appropriate information needed for hidden API processing breaking the build.
|
|
||||||
// TODO(b/179354495): Remove this workaround.
|
|
||||||
func (i *HiddenAPIFlagInput) canPerformHiddenAPIProcessing(ctx android.ModuleContext, properties bootclasspathFragmentProperties) bool {
|
|
||||||
// Performing hidden API processing without stubs is not supported and it is unlikely to ever be
|
|
||||||
// required as the whole point of adding something to the bootclasspath fragment is to add it to
|
|
||||||
// the bootclasspath in order to be used by something else in the system. Without any stubs it
|
|
||||||
// cannot do that.
|
|
||||||
if len(i.StubDexJarsByScope) == 0 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hidden API processing is always enabled in tests.
|
|
||||||
if ctx.Config().TestProductVariables != nil {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// A module that has fragments should have access to the information it needs in order to perform
|
|
||||||
// hidden API processing.
|
|
||||||
if len(properties.Fragments) != 0 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// The art bootclasspath fragment does not depend on any other fragments but already supports
|
|
||||||
// hidden API processing.
|
|
||||||
imageName := proptools.String(properties.Image_name)
|
|
||||||
if imageName == "art" {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable it for everything else.
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// gatherStubLibInfo gathers information from the stub libs needed by hidden API processing from the
|
// gatherStubLibInfo gathers information from the stub libs needed by hidden API processing from the
|
||||||
// dependencies added in hiddenAPIAddStubLibDependencies.
|
// dependencies added in hiddenAPIAddStubLibDependencies.
|
||||||
//
|
//
|
||||||
|
@@ -133,6 +133,13 @@ prebuilt_bootclasspath_fragment {
|
|||||||
apex_available: ["com.android.art"],
|
apex_available: ["com.android.art"],
|
||||||
image_name: "art",
|
image_name: "art",
|
||||||
contents: ["mybootlib"],
|
contents: ["mybootlib"],
|
||||||
|
hidden_api: {
|
||||||
|
stub_flags: "hiddenapi/stub-flags.csv",
|
||||||
|
annotation_flags: "hiddenapi/annotation-flags.csv",
|
||||||
|
metadata: "hiddenapi/metadata.csv",
|
||||||
|
index: "hiddenapi/index.csv",
|
||||||
|
all_flags: "hiddenapi/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
@@ -153,6 +160,13 @@ prebuilt_bootclasspath_fragment {
|
|||||||
apex_available: ["com.android.art"],
|
apex_available: ["com.android.art"],
|
||||||
image_name: "art",
|
image_name: "art",
|
||||||
contents: ["mysdk_mybootlib@current"],
|
contents: ["mysdk_mybootlib@current"],
|
||||||
|
hidden_api: {
|
||||||
|
stub_flags: "hiddenapi/stub-flags.csv",
|
||||||
|
annotation_flags: "hiddenapi/annotation-flags.csv",
|
||||||
|
metadata: "hiddenapi/metadata.csv",
|
||||||
|
index: "hiddenapi/index.csv",
|
||||||
|
all_flags: "hiddenapi/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
@@ -171,8 +185,13 @@ sdk_snapshot {
|
|||||||
}
|
}
|
||||||
`),
|
`),
|
||||||
checkAllCopyRules(`
|
checkAllCopyRules(`
|
||||||
|
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/stub-flags.csv -> hiddenapi/stub-flags.csv
|
||||||
|
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/annotation-flags.csv -> hiddenapi/annotation-flags.csv
|
||||||
|
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/metadata.csv -> hiddenapi/metadata.csv
|
||||||
|
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/index.csv -> hiddenapi/index.csv
|
||||||
|
.intermediates/mybootclasspathfragment/android_common/modular-hiddenapi/all-flags.csv -> hiddenapi/all-flags.csv
|
||||||
.intermediates/mybootlib/android_common/javac/mybootlib.jar -> java/mybootlib.jar
|
.intermediates/mybootlib/android_common/javac/mybootlib.jar -> java/mybootlib.jar
|
||||||
`),
|
`),
|
||||||
snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot),
|
snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot),
|
||||||
|
|
||||||
// Check the behavior of the snapshot without the source.
|
// Check the behavior of the snapshot without the source.
|
||||||
|
Reference in New Issue
Block a user