Rename sdk field tag "keep" to "ignore"
"ignore" is a better description of the effect that this tag has on the optimization that is done as part of the sdk snapshot generation. "keep" implies that something special is done with the field during the optimization process but actually the optimization process completely ignores the property, just as it does with unexported fields. Bug: 248258460 Test: m nothing Change-Id: Idfdfd87f927d641d4d301cbbde72b463c89155bf
This commit is contained in:
108
sdk/sdk_test.go
108
sdk/sdk_test.go
@@ -218,15 +218,15 @@ type EmbeddedPropertiesStruct struct {
|
||||
}
|
||||
|
||||
type testPropertiesStruct struct {
|
||||
name string
|
||||
private string
|
||||
Public_Kept string `sdk:"keep"`
|
||||
S_Common string
|
||||
S_Different string `android:"arch_variant"`
|
||||
A_Common []string
|
||||
A_Different []string `android:"arch_variant"`
|
||||
F_Common *bool
|
||||
F_Different *bool `android:"arch_variant"`
|
||||
name string
|
||||
private string
|
||||
Public_Ignore string `sdk:"ignore"`
|
||||
S_Common string
|
||||
S_Different string `android:"arch_variant"`
|
||||
A_Common []string
|
||||
A_Different []string `android:"arch_variant"`
|
||||
F_Common *bool
|
||||
F_Different *bool `android:"arch_variant"`
|
||||
EmbeddedPropertiesStruct
|
||||
}
|
||||
|
||||
@@ -244,30 +244,30 @@ func TestCommonValueOptimization(t *testing.T) {
|
||||
common := &testPropertiesStruct{name: "common"}
|
||||
structs := []propertiesContainer{
|
||||
&testPropertiesStruct{
|
||||
name: "struct-0",
|
||||
private: "common",
|
||||
Public_Kept: "common",
|
||||
S_Common: "common",
|
||||
S_Different: "upper",
|
||||
A_Common: []string{"first", "second"},
|
||||
A_Different: []string{"alpha", "beta"},
|
||||
F_Common: proptools.BoolPtr(false),
|
||||
F_Different: proptools.BoolPtr(false),
|
||||
name: "struct-0",
|
||||
private: "common",
|
||||
Public_Ignore: "common",
|
||||
S_Common: "common",
|
||||
S_Different: "upper",
|
||||
A_Common: []string{"first", "second"},
|
||||
A_Different: []string{"alpha", "beta"},
|
||||
F_Common: proptools.BoolPtr(false),
|
||||
F_Different: proptools.BoolPtr(false),
|
||||
EmbeddedPropertiesStruct: EmbeddedPropertiesStruct{
|
||||
S_Embedded_Common: "embedded_common",
|
||||
S_Embedded_Different: "embedded_upper",
|
||||
},
|
||||
},
|
||||
&testPropertiesStruct{
|
||||
name: "struct-1",
|
||||
private: "common",
|
||||
Public_Kept: "common",
|
||||
S_Common: "common",
|
||||
S_Different: "lower",
|
||||
A_Common: []string{"first", "second"},
|
||||
A_Different: []string{"alpha", "delta"},
|
||||
F_Common: proptools.BoolPtr(false),
|
||||
F_Different: proptools.BoolPtr(true),
|
||||
name: "struct-1",
|
||||
private: "common",
|
||||
Public_Ignore: "common",
|
||||
S_Common: "common",
|
||||
S_Different: "lower",
|
||||
A_Common: []string{"first", "second"},
|
||||
A_Different: []string{"alpha", "delta"},
|
||||
F_Common: proptools.BoolPtr(false),
|
||||
F_Different: proptools.BoolPtr(true),
|
||||
EmbeddedPropertiesStruct: EmbeddedPropertiesStruct{
|
||||
S_Embedded_Common: "embedded_common",
|
||||
S_Embedded_Different: "embedded_lower",
|
||||
@@ -282,15 +282,15 @@ func TestCommonValueOptimization(t *testing.T) {
|
||||
|
||||
android.AssertDeepEquals(t, "common properties not correct",
|
||||
&testPropertiesStruct{
|
||||
name: "common",
|
||||
private: "",
|
||||
Public_Kept: "",
|
||||
S_Common: "common",
|
||||
S_Different: "",
|
||||
A_Common: []string{"first", "second"},
|
||||
A_Different: []string(nil),
|
||||
F_Common: proptools.BoolPtr(false),
|
||||
F_Different: nil,
|
||||
name: "common",
|
||||
private: "",
|
||||
Public_Ignore: "",
|
||||
S_Common: "common",
|
||||
S_Different: "",
|
||||
A_Common: []string{"first", "second"},
|
||||
A_Different: []string(nil),
|
||||
F_Common: proptools.BoolPtr(false),
|
||||
F_Different: nil,
|
||||
EmbeddedPropertiesStruct: EmbeddedPropertiesStruct{
|
||||
S_Embedded_Common: "embedded_common",
|
||||
S_Embedded_Different: "",
|
||||
@@ -300,15 +300,15 @@ func TestCommonValueOptimization(t *testing.T) {
|
||||
|
||||
android.AssertDeepEquals(t, "updated properties[0] not correct",
|
||||
&testPropertiesStruct{
|
||||
name: "struct-0",
|
||||
private: "common",
|
||||
Public_Kept: "common",
|
||||
S_Common: "",
|
||||
S_Different: "upper",
|
||||
A_Common: nil,
|
||||
A_Different: []string{"alpha", "beta"},
|
||||
F_Common: nil,
|
||||
F_Different: proptools.BoolPtr(false),
|
||||
name: "struct-0",
|
||||
private: "common",
|
||||
Public_Ignore: "common",
|
||||
S_Common: "",
|
||||
S_Different: "upper",
|
||||
A_Common: nil,
|
||||
A_Different: []string{"alpha", "beta"},
|
||||
F_Common: nil,
|
||||
F_Different: proptools.BoolPtr(false),
|
||||
EmbeddedPropertiesStruct: EmbeddedPropertiesStruct{
|
||||
S_Embedded_Common: "",
|
||||
S_Embedded_Different: "embedded_upper",
|
||||
@@ -318,15 +318,15 @@ func TestCommonValueOptimization(t *testing.T) {
|
||||
|
||||
android.AssertDeepEquals(t, "updated properties[1] not correct",
|
||||
&testPropertiesStruct{
|
||||
name: "struct-1",
|
||||
private: "common",
|
||||
Public_Kept: "common",
|
||||
S_Common: "",
|
||||
S_Different: "lower",
|
||||
A_Common: nil,
|
||||
A_Different: []string{"alpha", "delta"},
|
||||
F_Common: nil,
|
||||
F_Different: proptools.BoolPtr(true),
|
||||
name: "struct-1",
|
||||
private: "common",
|
||||
Public_Ignore: "common",
|
||||
S_Common: "",
|
||||
S_Different: "lower",
|
||||
A_Common: nil,
|
||||
A_Different: []string{"alpha", "delta"},
|
||||
F_Common: nil,
|
||||
F_Different: proptools.BoolPtr(true),
|
||||
EmbeddedPropertiesStruct: EmbeddedPropertiesStruct{
|
||||
S_Embedded_Common: "",
|
||||
S_Embedded_Different: "embedded_lower",
|
||||
|
@@ -2217,8 +2217,8 @@ func (e *commonValueExtractor) gatherFields(structType reflect.Type, containingS
|
||||
continue
|
||||
}
|
||||
|
||||
// Ignore fields whose value should be kept.
|
||||
if proptools.HasTag(field, "sdk", "keep") {
|
||||
// Ignore fields tagged with sdk:"ignore".
|
||||
if proptools.HasTag(field, "sdk", "ignore") {
|
||||
continue
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user