androidbp: make error handling stricter
Instead of putting errors into the translated Android.mk file where
they are unlikely to be seen and may cause strange build behavior,
make all errors fatal. Also buffer to a byte buffer and then write
to the output file once we are sure there are no errors.
Change-Id: I247f405dd0a7c1d14c2681f86c7ac626e035ac2c
diff --git a/androidbp/cmd/soong.go b/androidbp/cmd/soong.go
index 8afda77..1612a06 100644
--- a/androidbp/cmd/soong.go
+++ b/androidbp/cmd/soong.go
@@ -64,7 +64,7 @@
var rewriteProperties = map[string]struct {
string
- f func(name string, prop *bpparser.Property, suffix *string) (computedProps []string)
+ f func(name string, prop *bpparser.Property, suffix *string) ([]string, error)
}{
"local_include_dirs": {"LOCAL_C_INCLUDES", prependLocalPath},
"export_include_dirs": {"LOCAL_EXPORT_C_INCLUDE_DIRS", prependLocalPath},