From 156b5d3b61848fc7d41c1e94f92e532ae5142d2e Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Thu, 24 Jun 2021 23:06:52 +0100 Subject: [PATCH] Allow hiddenapi list to ignore missing classes/members When generating the stub-flags.csv for a bootclasspath_fragment the hiddenapi list tool is not given a complete set of all classes and members. This change causes it to ignore them by passing the new --fragment option to it. This does not risk changing the flags as the stub-flags.csv files created with the --fragment option are compared with the monolithic out/soong/hiddenapi/hiddenapi-stub-flags.txt file which is not run with this option to ensure that they match. Bug: 179354495 Test: m out/soong/hiddenapi-stub-flags.csv - make sure that this does not change the file. Change-Id: I890c7374c445759cade4d685f51e81261b7ccea2 --- java/hiddenapi_modular.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go index ba53ea6f7..70bfdfb3f 100644 --- a/java/hiddenapi_modular.go +++ b/java/hiddenapi_modular.go @@ -316,6 +316,13 @@ func buildRuleToGenerateHiddenAPIStubFlagsFile(ctx android.BuilderContext, name, FlagForEachInput("--dependency-stub-dex=", dependencyStubDexJars). FlagForEachInput("--boot-dex=", bootDexJars) + // If no module stub flags paths are provided then this must be being called for a + // bootclasspath_fragment and not the whole platform_bootclasspath. + if moduleStubFlagsPaths == nil { + // This is being run on a fragment of the bootclasspath. + command.Flag("--fragment") + } + // Iterate over the api scopes in a fixed order. for _, apiScope := range hiddenAPIFlagScopes { // Merge in the stub dex jar paths for this api scope from the fragments on which it depends.