diff options
author | 2022-12-16 10:56:24 -0800 | |
---|---|---|
committer | 2023-01-03 14:42:23 -0800 | |
commit | a7347491489a8e6b039cf9d74efe407064c8db8f (patch) | |
tree | a2a557bfe86c5196ddbf45176691b2d8b46b0b5b /android/defs.go | |
parent | 2266e02a3a643b138feb6f1ff94d88ec46dfda6d (diff) |
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
Diffstat (limited to 'android/defs.go')
-rw-r--r-- | android/defs.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/android/defs.go b/android/defs.go index 9ae360e36..6e5bb053f 100644 --- a/android/defs.go +++ b/android/defs.go @@ -174,10 +174,15 @@ func buildWriteFileRule(ctx BuilderContext, outputFile WritablePath, content str // 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) { |