Revert "Detect invalid arch specific properties in snapshot"

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: Id7eba0bdde5c579e10e9b42d94a7cfab5f34995f
This commit is contained in:
Greg Kaiser
2020-05-08 19:12:34 +00:00
parent e08e03fa96
commit e509447c93
5 changed files with 15 additions and 70 deletions

View File

@@ -1225,9 +1225,6 @@ type extractorProperty struct {
// The empty value for the field.
emptyValue reflect.Value
// True if the property can support arch variants false otherwise.
archVariant bool
}
func (p extractorProperty) String() string {
@@ -1306,7 +1303,6 @@ func (e *commonValueExtractor) gatherFields(structType reflect.Type, containingS
name,
fieldGetter,
reflect.Zero(field.Type),
proptools.HasTag(field, "android", "arch_variant"),
}
e.properties = append(e.properties, property)
}
@@ -1374,16 +1370,10 @@ func (e *commonValueExtractor) extractCommonProperties(commonProperties interfac
fieldGetter := property.getter
// 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
// all the values have been filtered out, otherwise it points to the common value.
// is nil on entry to the loop and if it is nil on exit then there is no common value,
// otherwise it points to the common value.
var commonValue *reflect.Value
// Assume that all the values will be the same.
//
// While similar to this is not quite the same as commonValue == nil. If all the values
// have been filtered out then this will be false but commonValue == nil will be true.
valuesDiffer := false
for i := 0; i < sliceValue.Len(); i++ {
container := sliceValue.Index(i).Interface().(propertiesContainer)
itemValue := reflect.ValueOf(container.optimizableProperties())
@@ -1397,13 +1387,12 @@ func (e *commonValueExtractor) extractCommonProperties(commonProperties interfac
// no value in common so break out.
if !reflect.DeepEqual(fieldValue.Interface(), commonValue.Interface()) {
commonValue = nil
valuesDiffer = true
break
}
}
}
// If the fields all have common value then store it in the common struct field
// If the fields all have a common value then store it in the common struct field
// and set the input struct's field to the empty value.
if commonValue != nil {
emptyValue := property.emptyValue
@@ -1415,21 +1404,6 @@ func (e *commonValueExtractor) extractCommonProperties(commonProperties interfac
fieldValue.Set(emptyValue)
}
}
if valuesDiffer && !property.archVariant {
// The values differ but the property does not support arch variants so it
// is an error.
var details strings.Builder
for i := 0; i < sliceValue.Len(); i++ {
container := sliceValue.Index(i).Interface().(propertiesContainer)
itemValue := reflect.ValueOf(container.optimizableProperties())
fieldValue := fieldGetter(itemValue)
_, _ = fmt.Fprintf(&details, "\n %q has value %q", container.String(), fieldValue.Interface())
}
return fmt.Errorf("field %q is not tagged as \"arch_variant\" but has arch specific properties:%s", property.String(), details.String())
}
}
return nil