summaryrefslogtreecommitdiff
path: root/java/hiddenapi_monolithic.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-06-16 01:42:33 +0100
committer Paul Duffin <paulduffin@google.com> 2021-06-20 19:09:09 +0100
commit89f570ac44af4bcf5b78fa8dad3d57f24cd3ca0e (patch)
tree6a8f50e97cb6306f1aa64e8043bc22d4e54bafcc /java/hiddenapi_monolithic.go
parent0d7f2d30b53c9269a9a0cdaf312b88785c2f222b (diff)
Use classpath elements in platform_bootclasspath
Use classpath elements in newMonolithicHiddenAPIInfo. That means the method can collate information from both fragments and libraries rather than just fragments. So, this change moves the collation of the classesJars into the method. Bug: 177892522 Test: m out/soong/hiddenapi/hiddenapi-flags.csv out/soong/hiddenapi/hiddenapi-index.csv - make sure that this change does not affect the contents. Change-Id: I7c2a229fab60d02bd211438735a8d7303ed83386
Diffstat (limited to 'java/hiddenapi_monolithic.go')
-rw-r--r--java/hiddenapi_monolithic.go29
1 files changed, 22 insertions, 7 deletions
diff --git a/java/hiddenapi_monolithic.go b/java/hiddenapi_monolithic.go
index edf42351f..8a83d1006 100644
--- a/java/hiddenapi_monolithic.go
+++ b/java/hiddenapi_monolithic.go
@@ -43,22 +43,37 @@ type MonolithicHiddenAPIInfo struct {
// The paths to the generated all-flags.csv files.
AllFlagsPaths android.Paths
+
+ // The classes jars from the libraries on the platform bootclasspath.
+ ClassesJars android.Paths
}
// newMonolithicHiddenAPIInfo creates a new MonolithicHiddenAPIInfo from the flagFilesByCategory
// plus information provided by each of the fragments.
-func newMonolithicHiddenAPIInfo(ctx android.ModuleContext, flagFilesByCategory FlagFilesByCategory, fragments []android.Module) MonolithicHiddenAPIInfo {
+func newMonolithicHiddenAPIInfo(ctx android.ModuleContext, flagFilesByCategory FlagFilesByCategory, classpathElements ClasspathElements) MonolithicHiddenAPIInfo {
monolithicInfo := MonolithicHiddenAPIInfo{}
monolithicInfo.FlagsFilesByCategory = flagFilesByCategory
- // Merge all the information from the fragments. The fragments form a DAG so it is possible that
- // this will introduce duplicates so they will be resolved after processing all the fragments.
- for _, fragment := range fragments {
- if ctx.OtherModuleHasProvider(fragment, HiddenAPIInfoProvider) {
- info := ctx.OtherModuleProvider(fragment, HiddenAPIInfoProvider).(HiddenAPIInfo)
- monolithicInfo.append(&info)
+ // Merge all the information from the classpathElements. The fragments form a DAG so it is possible that
+ // this will introduce duplicates so they will be resolved after processing all the classpathElements.
+ for _, element := range classpathElements {
+ var classesJars android.Paths
+ switch e := element.(type) {
+ case *ClasspathLibraryElement:
+ classesJars = retrieveClassesJarsFromModule(e.Module())
+
+ case *ClasspathFragmentElement:
+ fragment := e.Module()
+ if ctx.OtherModuleHasProvider(fragment, HiddenAPIInfoProvider) {
+ info := ctx.OtherModuleProvider(fragment, HiddenAPIInfoProvider).(HiddenAPIInfo)
+ monolithicInfo.append(&info)
+ }
+
+ classesJars = extractClassesJarsFromModules(e.Contents)
}
+
+ monolithicInfo.ClassesJars = append(monolithicInfo.ClassesJars, classesJars...)
}
// Dedup paths.