Support extracting common values from embedded structures

This change also added support for excluding properties from common
value extraction by using a struct tag of `sdk:"keep"` That was needed
to prevent the fields in SdkMemberPropertiesBase from having their
values cleared.

The purpose of this change is to make it easier to share functionality
across sdk member types.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ie5160a8f854056920e411801ca20721eab7c8578
Change-Id: Ie5160a8f854056920e411801ca20721eab7c8578
This commit is contained in:
Paul Duffin
2020-03-10 22:17:04 +00:00
parent 89937326ab
commit 49096815fe
4 changed files with 141 additions and 10 deletions

View File

@@ -325,7 +325,8 @@ type SdkMemberType interface {
//
// * The variant property structs are analysed to find exported (capitalized) fields which
// have common values. Those fields are cleared and the common value added to the common
// properties.
// properties. A field annotated with a tag of `sdk:"keep"` will be treated as if it
// was not capitalized, i.e. not optimized for common values.
//
// * The sdk module type populates the BpModule structure, creating the arch specific
// structure and calls AddToPropertySet(...) on the properties struct to add the member
@@ -452,13 +453,13 @@ func RegisterSdkMemberType(memberType SdkMemberType) {
// are not affected by the optimization to extract common values.
type SdkMemberPropertiesBase struct {
// The setting to use for the compile_multilib property.
Compile_multilib string
Compile_multilib string `sdk:"keep"`
// The number of unique os types supported by the member variants.
Os_count int
Os_count int `sdk:"keep"`
// The os type for which these properties refer.
Os OsType
Os OsType `sdk:"keep"`
}
// The os prefix to use for any file paths in the sdk.