Revert "Adds support for 'ignored-on-host'"
Revert submission 1302576
Bug: 156054601
Reason for revert: Presumed root cause of build break.
Reverted Changes:
Ifc8116e11:Detect invalid arch specific properties in snapsho...
I7ebd33307:Adds support for 'ignored-on-host'
I167b47a13:Fix snapshot of a host/device cc_library with stub...
Change-Id: I2a7ac0ef0232177eefc26542c11dc675d6f4cab2
diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go
index ae1a492..898ecea 100644
--- a/sdk/sdk_test.go
+++ b/sdk/sdk_test.go
@@ -289,12 +289,9 @@
}
extractor := newCommonValueExtractor(common)
+ extractor.extractCommonProperties(common, structs)
h := TestHelper{t}
-
- err := extractor.extractCommonProperties(common, structs)
- h.AssertDeepEquals("unexpected error", nil, err)
-
h.AssertDeepEquals("common properties not correct",
&testPropertiesStruct{
name: "common",
diff --git a/sdk/update.go b/sdk/update.go
index 991428e..bcc2c77 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -1215,26 +1215,11 @@
// struct (or one of its embedded structs).
type fieldAccessorFunc func(structValue reflect.Value) reflect.Value
-// Checks the metadata to determine whether the property should be ignored for the
-// purposes of common value extraction or not.
-type extractorMetadataPredicate func(metadata propertiesContainer) bool
-
-// Indicates whether optimizable properties are provided by a host variant or
-// not.
-type isHostVariant interface {
- isHostVariant() bool
-}
-
// A property that can be optimized by the commonValueExtractor.
type extractorProperty struct {
// The name of the field for this property.
name string
- // Filter that can use metadata associated with the properties being optimized
- // to determine whether the field should be ignored during common value
- // optimization.
- filter extractorMetadataPredicate
-
// Retrieves the value on which common value optimization will be performed.
getter fieldAccessorFunc
@@ -1288,20 +1273,6 @@
continue
}
- var filter extractorMetadataPredicate
-
- // Add a filter
- if proptools.HasTag(field, "sdk", "ignored-on-host") {
- filter = func(metadata propertiesContainer) bool {
- if m, ok := metadata.(isHostVariant); ok {
- if m.isHostVariant() {
- return false
- }
- }
- return true
- }
- }
-
// Save a copy of the field index for use in the function.
fieldIndex := f
@@ -1333,7 +1304,6 @@
} else {
property := extractorProperty{
name,
- filter,
fieldGetter,
reflect.Zero(field.Type),
proptools.HasTag(field, "android", "arch_variant"),
@@ -1402,12 +1372,6 @@
for _, property := range e.properties {
fieldGetter := property.getter
- filter := property.filter
- if filter == nil {
- filter = func(metadata propertiesContainer) bool {
- return true
- }
- }
// Check to see if all the structures have the same value for the field. The commonValue
// is nil on entry to the loop and if it is nil on exit then there is no common value or
@@ -1425,15 +1389,6 @@
itemValue := reflect.ValueOf(container.optimizableProperties())
fieldValue := fieldGetter(itemValue)
- if !filter(container) {
- expectedValue := property.emptyValue.Interface()
- actualValue := fieldValue.Interface()
- if !reflect.DeepEqual(expectedValue, actualValue) {
- return fmt.Errorf("field %q is supposed to be ignored for %q but is set to %#v instead of %#v", property, container, actualValue, expectedValue)
- }
- continue
- }
-
if commonValue == nil {
// Use the first value as the commonProperties value.
commonValue = &fieldValue