diff options
author | 2022-01-27 16:39:06 +0000 | |
---|---|---|
committer | 2022-01-31 12:28:04 +0000 | |
commit | 106a3a4bec44f8d1120f72dc52f6d2c797f3a80e (patch) | |
tree | 4a13f8d451070f1a231c59940fe298119a5c049e /java/sdk_library.go | |
parent | 545c59273de8e741ca8820656d972fbeb03f1ef9 (diff) |
Allow pruning of unsupported fields in structs in maps
Adds support for traversing into a field that is of type:
map[...]*struct{...}
This is needed to allow java_sdk_library to mark scope specific
properties, e.g. public.annotations as being target build release
specific.
It was necessary to change the Scope field from:
Scope map[*apiScope]scopeProperties
to:
Scope map[*apiScope]*scopeProperties
That is because there is no way in go to change the field of a struct
value of a map. i.e. you cannot do the following, not even using
reflection:
Scope[apiScopePublic].AnnotationsZip = nil
Bug: 204763318
Test: m nothing
Change-Id: Id103f70f55d4202971321ef4925cbec4b55f8136
Diffstat (limited to 'java/sdk_library.go')
-rw-r--r-- | java/sdk_library.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/java/sdk_library.go b/java/sdk_library.go index 57ab2686f..98f29990d 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -2755,7 +2755,7 @@ type sdkLibrarySdkMemberProperties struct { android.SdkMemberPropertiesBase // Scope to per scope properties. - Scopes map[*apiScope]scopeProperties + Scopes map[*apiScope]*scopeProperties // The Java stubs source files. Stub_srcs []string @@ -2815,7 +2815,7 @@ type scopeProperties struct { func (s *sdkLibrarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) { sdk := variant.(*SdkLibrary) - s.Scopes = make(map[*apiScope]scopeProperties) + s.Scopes = make(map[*apiScope]*scopeProperties) for _, apiScope := range allApiScopes { paths := sdk.findScopePaths(apiScope) if paths == nil { @@ -2838,7 +2838,7 @@ func (s *sdkLibrarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMembe if paths.annotationsZip.Valid() { properties.AnnotationsZip = paths.annotationsZip.Path() } - s.Scopes[apiScope] = properties + s.Scopes[apiScope] = &properties } } |