make tidy attribute tri-state
Bazel boolean attributes can only support true or false states, but the clang-tidy logic changes for modules which don't set a specific value. Therefore, the tidy attribute should really be a tri-state of "true", "false", or "" (unset). Test: b test //build/bazel/rules/... Bug: 268681923 Change-Id: I85fbaa612d175f475757db806cea6c018901fe3e
This commit is contained in:
@@ -71,7 +71,7 @@ type staticOrSharedAttributes struct {
|
||||
}
|
||||
|
||||
type tidyAttributes struct {
|
||||
Tidy *bool
|
||||
Tidy *string
|
||||
Tidy_flags []string
|
||||
Tidy_checks []string
|
||||
Tidy_checks_as_errors []string
|
||||
@@ -82,7 +82,15 @@ type tidyAttributes struct {
|
||||
func (m *Module) convertTidyAttributes(ctx android.BaseMutatorContext, moduleAttrs *tidyAttributes) {
|
||||
for _, f := range m.features {
|
||||
if tidy, ok := f.(*tidyFeature); ok {
|
||||
moduleAttrs.Tidy = tidy.Properties.Tidy
|
||||
var tidyAttr *string
|
||||
if tidy.Properties.Tidy != nil {
|
||||
if *tidy.Properties.Tidy {
|
||||
tidyAttr = proptools.StringPtr("local")
|
||||
} else {
|
||||
tidyAttr = proptools.StringPtr("never")
|
||||
}
|
||||
}
|
||||
moduleAttrs.Tidy = tidyAttr
|
||||
moduleAttrs.Tidy_flags = tidy.Properties.Tidy_flags
|
||||
moduleAttrs.Tidy_checks = tidy.Properties.Tidy_checks
|
||||
moduleAttrs.Tidy_checks_as_errors = tidy.Properties.Tidy_checks_as_errors
|
||||
|
Reference in New Issue
Block a user