Use WriteFileRule instead of custom echo commands
These instances could use WriteFileRule instead of
making their own shell code to write a file.
Test: Presubmits
Change-Id: I9c809b2164a68b4ce1c22fbbd0d7497240110b39
diff --git a/android/defs.go b/android/defs.go
index 9ae360e..6e5bb05 100644
--- a/android/defs.go
+++ b/android/defs.go
@@ -174,10 +174,15 @@
// WriteFileRule creates a ninja rule to write contents to a file. The contents will be escaped
// so that the file contains exactly the contents passed to the function, plus a trailing newline.
func WriteFileRule(ctx BuilderContext, outputFile WritablePath, content string) {
+ WriteFileRuleVerbatim(ctx, outputFile, content+"\n")
+}
+
+// WriteFileRuleVerbatim creates a ninja rule to write contents to a file. The contents will be
+// escaped so that the file contains exactly the contents passed to the function.
+func WriteFileRuleVerbatim(ctx BuilderContext, outputFile WritablePath, content string) {
// This is MAX_ARG_STRLEN subtracted with some safety to account for shell escapes
const SHARD_SIZE = 131072 - 10000
- content += "\n"
if len(content) > SHARD_SIZE {
var chunks WritablePaths
for i, c := range ShardString(content, SHARD_SIZE) {