aboutsummaryrefslogtreecommitdiffstats
path: root/bpfix
diff options
context:
space:
mode:
authorJeff Gaston <jeffrygaston@google.com>2017-10-05 18:17:53 -0700
committerJeff Gaston <jeffrygaston@google.com>2017-10-05 18:17:53 -0700
commit3a7822c57193a42ffe0dcb67e77be1dfded2c2a8 (patch)
tree4fc062cfe4d214493cc1e079fb12b4ac0aa685b2 /bpfix
parentc21d11850d6b6edaa461c9e06efa3d005da08ce2 (diff)
downloadbuild_soong-3a7822c57193a42ffe0dcb67e77be1dfded2c2a8.tar.gz
build_soong-3a7822c57193a42ffe0dcb67e77be1dfded2c2a8.tar.bz2
build_soong-3a7822c57193a42ffe0dcb67e77be1dfded2c2a8.zip
Have bpfix not remove empty lists
Since in some cases they're not the default value. Test: echo "cc_defaults{ system_shared_libs:[] }" | bpfix | grep system_shared_libs > /dev/null && echo ok Bug: 66979076 Change-Id: I760b34f980281b955972819676bd62154a6c73f5
Diffstat (limited to 'bpfix')
-rw-r--r--bpfix/bpfix/bpfix.go38
1 files changed, 1 insertions, 37 deletions
diff --git a/bpfix/bpfix/bpfix.go b/bpfix/bpfix/bpfix.go
index 12494943..fcd4fecf 100644
--- a/bpfix/bpfix/bpfix.go
+++ b/bpfix/bpfix/bpfix.go
@@ -19,6 +19,7 @@ package bpfix
import (
"bytes"
"fmt"
+
"github.com/google/blueprint/parser"
)
@@ -26,7 +27,6 @@ import (
// A FixRequest doesn't specify whether to do a dry run or where to write the results; that's in cmd/bpfix.go
type FixRequest struct {
simplifyKnownRedundantVariables bool
- removeEmptyLists bool
}
func NewFixRequest() FixRequest {
@@ -36,7 +36,6 @@ func NewFixRequest() FixRequest {
func (r FixRequest) AddAll() (result FixRequest) {
result = r
result.simplifyKnownRedundantVariables = true
- result.removeEmptyLists = true
return result
}
@@ -89,12 +88,6 @@ func fixTreeOnce(tree *parser.File, config FixRequest) (fixed *parser.File, err
return nil, err
}
}
- if config.removeEmptyLists {
- tree, err = removePropertiesHavingTheirDefaultValues(tree)
- if err != nil {
- return nil, err
- }
- }
return tree, err
}
@@ -154,32 +147,3 @@ func removeMatchingModuleListProperties(tree *parser.File, canonicalName string,
}
return tree, nil
}
-
-func removePropertiesHavingTheirDefaultValues(tree *parser.File) (fixed *parser.File, err error) {
- for _, def := range tree.Defs {
- mod, ok := def.(*parser.Module)
- if !ok {
- continue
- }
- writeIndex := 0
- for _, prop := range mod.Properties {
- val := prop.Value
- keep := true
- switch val := val.(type) {
- case *parser.List:
- if len(val.Values) == 0 {
- keep = false
- }
- break
- default:
- keep = true
- }
- if keep {
- mod.Properties[writeIndex] = prop
- writeIndex++
- }
- }
- mod.Properties = mod.Properties[:writeIndex]
- }
- return tree, nil
-}