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:
Paul Duffin
2022-09-22 15:30:58 +01:00
parent 394a12b315
commit 02e25c85eb
3 changed files with 64 additions and 64 deletions

View File

@@ -735,8 +735,8 @@ type SdkMemberType interface {
// have common values. Those fields are cleared and the common value added to the common // 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 // A field annotated with a tag of `sdk:"ignore"` will be treated as if it
// was not capitalized, i.e. not optimized for common values. // was not capitalized, i.e. ignored and not optimized for common values.
// //
// A field annotated with a tag of `android:"arch_variant"` will be allowed to have // A field annotated with a tag of `android:"arch_variant"` will be allowed to have
// values that differ by arch, fields not tagged as such must have common values across // values that differ by arch, fields not tagged as such must have common values across
@@ -923,18 +923,18 @@ type SdkMemberPropertiesBase struct {
// the locations of any of their prebuilt files in the snapshot by os type to prevent them // the locations of any of their prebuilt files in the snapshot by os type to prevent them
// from colliding. See OsPrefix(). // from colliding. See OsPrefix().
// //
// This property is the same for all variants of a member and so would be optimized away // Ignore this property during optimization. This is needed because this property is the same for
// if it was not explicitly kept. // all variants of a member and so would be optimized away if it was not ignored.
Os_count int `sdk:"keep"` Os_count int `sdk:"ignore"`
// The os type for which these properties refer. // The os type for which these properties refer.
// //
// Provided to allow a member to differentiate between os types in the locations of their // Provided to allow a member to differentiate between os types in the locations of their
// prebuilt files when it supports more than one os type. // prebuilt files when it supports more than one os type.
// //
// This property is the same for all os type specific variants of a member and so would be // Ignore this property during optimization. This is needed because this property is the same for
// optimized away if it was not explicitly kept. // all variants of a member and so would be optimized away if it was not ignored.
Os OsType `sdk:"keep"` Os OsType `sdk:"ignore"`
// The setting to use for the compile_multilib property. // The setting to use for the compile_multilib property.
Compile_multilib string `android:"arch_variant"` Compile_multilib string `android:"arch_variant"`

View File

@@ -220,7 +220,7 @@ type EmbeddedPropertiesStruct struct {
type testPropertiesStruct struct { type testPropertiesStruct struct {
name string name string
private string private string
Public_Kept string `sdk:"keep"` Public_Ignore string `sdk:"ignore"`
S_Common string S_Common string
S_Different string `android:"arch_variant"` S_Different string `android:"arch_variant"`
A_Common []string A_Common []string
@@ -246,7 +246,7 @@ func TestCommonValueOptimization(t *testing.T) {
&testPropertiesStruct{ &testPropertiesStruct{
name: "struct-0", name: "struct-0",
private: "common", private: "common",
Public_Kept: "common", Public_Ignore: "common",
S_Common: "common", S_Common: "common",
S_Different: "upper", S_Different: "upper",
A_Common: []string{"first", "second"}, A_Common: []string{"first", "second"},
@@ -261,7 +261,7 @@ func TestCommonValueOptimization(t *testing.T) {
&testPropertiesStruct{ &testPropertiesStruct{
name: "struct-1", name: "struct-1",
private: "common", private: "common",
Public_Kept: "common", Public_Ignore: "common",
S_Common: "common", S_Common: "common",
S_Different: "lower", S_Different: "lower",
A_Common: []string{"first", "second"}, A_Common: []string{"first", "second"},
@@ -284,7 +284,7 @@ func TestCommonValueOptimization(t *testing.T) {
&testPropertiesStruct{ &testPropertiesStruct{
name: "common", name: "common",
private: "", private: "",
Public_Kept: "", Public_Ignore: "",
S_Common: "common", S_Common: "common",
S_Different: "", S_Different: "",
A_Common: []string{"first", "second"}, A_Common: []string{"first", "second"},
@@ -302,7 +302,7 @@ func TestCommonValueOptimization(t *testing.T) {
&testPropertiesStruct{ &testPropertiesStruct{
name: "struct-0", name: "struct-0",
private: "common", private: "common",
Public_Kept: "common", Public_Ignore: "common",
S_Common: "", S_Common: "",
S_Different: "upper", S_Different: "upper",
A_Common: nil, A_Common: nil,
@@ -320,7 +320,7 @@ func TestCommonValueOptimization(t *testing.T) {
&testPropertiesStruct{ &testPropertiesStruct{
name: "struct-1", name: "struct-1",
private: "common", private: "common",
Public_Kept: "common", Public_Ignore: "common",
S_Common: "", S_Common: "",
S_Different: "lower", S_Different: "lower",
A_Common: nil, A_Common: nil,

View File

@@ -2217,8 +2217,8 @@ func (e *commonValueExtractor) gatherFields(structType reflect.Type, containingS
continue continue
} }
// Ignore fields whose value should be kept. // Ignore fields tagged with sdk:"ignore".
if proptools.HasTag(field, "sdk", "keep") { if proptools.HasTag(field, "sdk", "ignore") {
continue continue
} }