Soong: add -T to nanopb call to suppress timestamp

By default, nanopb outputs a timestamp into the .c and .h files it generates.
This is usually considered bening. However, when using remote execution or
remote caching, this poisons all actions that have these files as inputs, and
also appears to affect transitive actions (actions depending on actions that
have these files as inputs).

This change adds the -T flag to suppress the timestamp, which in turn makes
the output files deterministic, which in turn allows the remote cache to
return previous results rather than requiring a re-execution of the
corresponding actions.

Test: ran the build a few times to check that the output is deterministic

Change-Id: Iecfa143dbf12a9bb7703dd0bc3f1b3e3fd56317c
This commit is contained in:
Ulf Adams
2020-11-25 22:37:22 +01:00
parent 0066864a02
commit 82fd89b8ab

View File

@@ -130,6 +130,8 @@ func protoFlags(ctx ModuleContext, flags Flags, p *android.ProtoProperties) Flag
flags.protoC = true
flags.protoOptionsFile = true
flags.proto.OutTypeFlag = "--nanopb_out"
// Disable nanopb timestamps to support remote caching.
flags.proto.OutParams = append(flags.proto.OutParams, "-T")
plugin = "protoc-gen-nanopb"
case "full":
flags.proto.OutTypeFlag = "--cpp_out"