summaryrefslogtreecommitdiff
path: root/java/system_modules.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2020-03-20 13:35:40 +0000
committer Paul Duffin <paulduffin@google.com> 2020-03-23 08:48:03 +0000
commit495ffb9ff990a974084a71b2821dd81befd6130e (patch)
tree22fcbf19f43ec5a66d1fdaaaca97b8751987347b /java/system_modules.go
parenta551a1c2f9816838bb25c1b2d5d758682b37bd96 (diff)
Remove old SdkMemberType API for creating snapshot modules
Migrates system modules and droid stubs over to use the new API for creating the snapshot modules and removes the old API. Test: m nothing Change-Id: Ia825767f1f7ee77f68cfe00f53e09e6f6bfa027f
Diffstat (limited to 'java/system_modules.go')
-rw-r--r--java/system_modules.go34
1 files changed, 22 insertions, 12 deletions
diff --git a/java/system_modules.go b/java/system_modules.go
index 40031cb05..7394fd547 100644
--- a/java/system_modules.go
+++ b/java/system_modules.go
@@ -242,18 +242,28 @@ func (mt *systemModulesSdkMemberType) IsInstance(module android.Module) bool {
return false
}
-func (mt *systemModulesSdkMemberType) BuildSnapshot(sdkModuleContext android.ModuleContext, builder android.SnapshotBuilder, member android.SdkMember) {
- variants := member.Variants()
- if len(variants) != 1 {
- sdkModuleContext.ModuleErrorf("sdk contains %d variants of member %q but only one is allowed", len(variants), member.Name())
- for _, variant := range variants {
- sdkModuleContext.ModuleErrorf(" %q", variant)
- }
- }
- variant := variants[0]
+func (mt *systemModulesSdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
+ return ctx.SnapshotBuilder().AddPrebuiltModule(member, "java_system_modules_import")
+}
+
+type systemModulesInfoProperties struct {
+ android.SdkMemberPropertiesBase
+
+ Libs []string
+}
+
+func (mt *systemModulesSdkMemberType) CreateVariantPropertiesStruct() android.SdkMemberProperties {
+ return &systemModulesInfoProperties{}
+}
+
+func (p *systemModulesInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
systemModule := variant.(*SystemModules)
+ p.Libs = systemModule.properties.Libs
+}
- pbm := builder.AddPrebuiltModule(member, "java_system_modules_import")
- // Add the references to the libraries that form the system module.
- pbm.AddPropertyWithTag("libs", systemModule.properties.Libs, builder.SdkMemberReferencePropertyTag(true))
+func (p *systemModulesInfoProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
+ if len(p.Libs) > 0 {
+ // Add the references to the libraries that form the system module.
+ propertySet.AddPropertyWithTag("libs", p.Libs, ctx.SnapshotBuilder().SdkMemberReferencePropertyTag(true))
+ }
}