diff options
Diffstat (limited to 'androidmk')
-rw-r--r-- | androidmk/Android.bp | 1 | ||||
-rw-r--r-- | androidmk/cmd/androidmk/androidmk.go | 14 |
2 files changed, 13 insertions, 2 deletions
diff --git a/androidmk/Android.bp b/androidmk/Android.bp index 67baf0ae..442452f8 100644 --- a/androidmk/Android.bp +++ b/androidmk/Android.bp @@ -29,6 +29,7 @@ blueprint_go_binary { deps: [ "androidmk-parser", "blueprint-parser", + "bpfix-lib", ], } diff --git a/androidmk/cmd/androidmk/androidmk.go b/androidmk/cmd/androidmk/androidmk.go index 1d94b65e..d26643ae 100644 --- a/androidmk/cmd/androidmk/androidmk.go +++ b/androidmk/cmd/androidmk/androidmk.go @@ -8,6 +8,8 @@ import ( "strings" "text/scanner" + "android/soong/bpfix/bpfix" + mkparser "android/soong/androidmk/parser" bpparser "github.com/google/blueprint/parser" @@ -176,10 +178,18 @@ func convertFile(filename string, buffer *bytes.Buffer) (string, []error) { } } - out, err := bpparser.Print(&bpparser.File{ + tree := &bpparser.File{ Defs: file.defs, Comments: file.comments, - }) + } + + // check for common supported but undesirable structures and clean them up + fixed, err := bpfix.FixTree(tree, bpfix.NewFixRequest().AddAll()) + if err != nil { + return "", []error{err} + } + + out, err := bpparser.Print(fixed) if err != nil { return "", []error{err} } |