summaryrefslogtreecommitdiff
path: root/java/base.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2022-07-27 16:27:42 +0000
committer Paul Duffin <paulduffin@google.com> 2022-08-19 16:45:38 +0000
commit3f1ae0b55acd7e727c6227c3ab3e4f34e885e478 (patch)
tree3bc227c101b0939806f9b3a1ffd129b987bdd8a4 /java/base.go
parent1149c2c185a53ef0d0f13dd8bdb52095a8ef4049 (diff)
Add hidden API properties to java_sdk_library modules
Previously, hidden API properties were only allowed on bootclasspath_fragment and platform_bootclasspath module types. This change allows them to be specified on java_sdk_library modules too. It involves the following changes: 1. Add the properties to the java.Module. 2. Populate and provide a HiddenAPIPropertyInfo struct from java_sdk_library modules. 3. Modify bootclasspath_fragment to merge information gathered from its content libraries as if it was specified on the fragment itself. Bug: 240406019 Test: m nothing packages/modules/common/build/mainline_modules_sdks.sh # Ran the previous command with and without this change to make # sure that this change does not change the sdk snapshot # contents. Change-Id: I64eb71c2039ddc14cf380689d0cec7ec221f5b88
Diffstat (limited to 'java/base.go')
-rw-r--r--java/base.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/java/base.go b/java/base.go
index 94daf37fc..fe92b4754 100644
--- a/java/base.go
+++ b/java/base.go
@@ -267,6 +267,9 @@ type DeviceProperties struct {
// Only for libraries created by a sysprop_library module, SyspropPublicStub is the name of the
// public stubs library.
SyspropPublicStub string `blueprint:"mutated"`
+
+ HiddenAPIPackageProperties
+ HiddenAPIFlagFileProperties
}
// Device properties that can be overridden by overriding module (e.g. override_android_app)
@@ -564,6 +567,20 @@ func (j *Module) addHostAndDeviceProperties() {
)
}
+// provideHiddenAPIPropertyInfo populates a HiddenAPIPropertyInfo from hidden API properties and
+// makes it available through the hiddenAPIPropertyInfoProvider.
+func (j *Module) provideHiddenAPIPropertyInfo(ctx android.ModuleContext) {
+ hiddenAPIInfo := newHiddenAPIPropertyInfo()
+
+ // Populate with flag file paths from the properties.
+ hiddenAPIInfo.extractFlagFilesFromProperties(ctx, &j.deviceProperties.HiddenAPIFlagFileProperties)
+
+ // Populate with package rules from the properties.
+ hiddenAPIInfo.extractPackageRulesFromProperties(&j.deviceProperties.HiddenAPIPackageProperties)
+
+ ctx.SetProvider(hiddenAPIPropertyInfoProvider, hiddenAPIInfo)
+}
+
func (j *Module) OutputFiles(tag string) (android.Paths, error) {
switch tag {
case "":