Pretty print SBox manifest files to make them easier to read
When debugging problems with, or just modifying a ninja rule that uses
the SBox it is often necessary to read the manifest file. This change
makes them easier to read by pretty printing them onto multiple lines
with a small but clear indent.
This increased the size of the following file by abot 6% from 66K to
70K bytes:
out/soong/.intermediates/packages/modules/Wifi/framework/framework-wifi.stubs.source.system/android_common/metalava.sbox.textproto
Test: m out/soong/.intermediates/packages/modules/Wifi/framework/framework-wifi.stubs.source.system/android_common/metalava.sbox.textproto
less out/soong/.intermediates/packages/modules/Wifi/framework/framework-wifi.stubs.source.system/android_common/metalava.sbox.textproto
Change-Id: Icfadeaad1c6334bd0010128f4437669f35822850
diff --git a/android/rule_builder.go b/android/rule_builder.go
index 1454357..399dfdb 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -629,8 +629,9 @@
name, r.sboxManifestPath.String(), r.outDir.String())
}
- // Create a rule to write the manifest as textproto.
- pbText, err := prototext.Marshal(&manifest)
+ // Create a rule to write the manifest as textproto. Pretty print it by indenting and
+ // splitting across multiple lines.
+ pbText, err := prototext.MarshalOptions{Indent: " "}.Marshal(&manifest)
if err != nil {
ReportPathErrorf(r.ctx, "sbox manifest failed to marshal: %q", err)
}