Loading java/bootclasspath_fragment.go +47 −9 Original line number Diff line number Diff line Loading @@ -112,6 +112,11 @@ type bootclasspathFragmentProperties struct { Coverage BootclasspathFragmentCoverageAffectedProperties Hidden_api HiddenAPIFlagFileProperties // Properties that allow a fragment to depend on other fragments. This is needed for hidden API // processing as it needs access to all the classes used by a fragment including those provided // by other fragments. BootclasspathFragmentsDepsProperties } type BootclasspathFragmentModule struct { Loading Loading @@ -448,12 +453,54 @@ func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleCont return imageConfig } // 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 (b *BootclasspathFragmentModule) canPerformHiddenAPIProcessing(ctx android.ModuleContext) bool { // 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(b.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(b.properties.Image_name) if imageName == "art" { return true } // Disable it for everything else. return false } // generateHiddenAPIBuildActions generates all the hidden API related build rules. func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.ModuleContext, contents []android.Module) { // A temporary workaround to avoid existing bootclasspath_fragments that do not provide the // appropriate information needed for hidden API processing breaking the build. if !b.canPerformHiddenAPIProcessing(ctx) { // Nothing to do. return } // Convert the kind specific lists of modules into kind specific lists of jars. stubJarsByKind := hiddenAPIGatherStubLibDexJarPaths(ctx, contents) // 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(stubJarsByKind) == 0 { return } // Store the information for use by other modules. bootclasspathApiInfo := bootclasspathApiInfo{stubJarsByKind: stubJarsByKind} ctx.SetProvider(bootclasspathApiInfoProvider, bootclasspathApiInfo) Loading @@ -474,15 +521,6 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android. // produceHiddenAPIAllFlagsFile produces the hidden API all-flags.csv file (and supporting files) // for the fragment. func (b *BootclasspathFragmentModule) produceHiddenAPIAllFlagsFile(ctx android.ModuleContext, contents []hiddenAPIModule, stubJarsByKind map[android.SdkKind]android.Paths, flagFileInfo *hiddenAPIFlagFileInfo) { // If no stubs have been provided then don't perform hidden API processing. This is a temporary // workaround to avoid existing bootclasspath_fragments that do not provide stubs breaking the // build. // TODO(b/179354495): Remove this workaround. if len(stubJarsByKind) == 0 { // Nothing to do. return } // Generate the rules to create the hidden API flags and update the supplied flagFileInfo with the // paths to the created files. hiddenAPIGenerateAllFlagsForBootclasspathFragment(ctx, contents, stubJarsByKind, flagFileInfo) Loading Loading
java/bootclasspath_fragment.go +47 −9 Original line number Diff line number Diff line Loading @@ -112,6 +112,11 @@ type bootclasspathFragmentProperties struct { Coverage BootclasspathFragmentCoverageAffectedProperties Hidden_api HiddenAPIFlagFileProperties // Properties that allow a fragment to depend on other fragments. This is needed for hidden API // processing as it needs access to all the classes used by a fragment including those provided // by other fragments. BootclasspathFragmentsDepsProperties } type BootclasspathFragmentModule struct { Loading Loading @@ -448,12 +453,54 @@ func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleCont return imageConfig } // 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 (b *BootclasspathFragmentModule) canPerformHiddenAPIProcessing(ctx android.ModuleContext) bool { // 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(b.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(b.properties.Image_name) if imageName == "art" { return true } // Disable it for everything else. return false } // generateHiddenAPIBuildActions generates all the hidden API related build rules. func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.ModuleContext, contents []android.Module) { // A temporary workaround to avoid existing bootclasspath_fragments that do not provide the // appropriate information needed for hidden API processing breaking the build. if !b.canPerformHiddenAPIProcessing(ctx) { // Nothing to do. return } // Convert the kind specific lists of modules into kind specific lists of jars. stubJarsByKind := hiddenAPIGatherStubLibDexJarPaths(ctx, contents) // 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(stubJarsByKind) == 0 { return } // Store the information for use by other modules. bootclasspathApiInfo := bootclasspathApiInfo{stubJarsByKind: stubJarsByKind} ctx.SetProvider(bootclasspathApiInfoProvider, bootclasspathApiInfo) Loading @@ -474,15 +521,6 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android. // produceHiddenAPIAllFlagsFile produces the hidden API all-flags.csv file (and supporting files) // for the fragment. func (b *BootclasspathFragmentModule) produceHiddenAPIAllFlagsFile(ctx android.ModuleContext, contents []hiddenAPIModule, stubJarsByKind map[android.SdkKind]android.Paths, flagFileInfo *hiddenAPIFlagFileInfo) { // If no stubs have been provided then don't perform hidden API processing. This is a temporary // workaround to avoid existing bootclasspath_fragments that do not provide stubs breaking the // build. // TODO(b/179354495): Remove this workaround. if len(stubJarsByKind) == 0 { // Nothing to do. return } // Generate the rules to create the hidden API flags and update the supplied flagFileInfo with the // paths to the created files. hiddenAPIGenerateAllFlagsForBootclasspathFragment(ctx, contents, stubJarsByKind, flagFileInfo) Loading