Only write release config files if they've changed

Currently, when you do `m` repeatedly, it does a little bit of
rebuilding to copy release config files around. If we change
release-config to only rewrite the files if they've changed, we
get a proper "ninja: no work to do." message.

Bug: 346757289
Test: m repeatedly
Change-Id: I9c1f6d34ec20d14b684a0183c5ec457ea92440f9
This commit is contained in:
Cole Faust 2024-06-13 16:56:24 -07:00
parent 6c76ad374e
commit 2530b44656
2 changed files with 3 additions and 1 deletions

View file

@ -24,6 +24,7 @@ bootstrap_go_package {
"golang-protobuf-reflect-protoreflect",
"golang-protobuf-runtime-protoimpl",
"soong-cmd-release_config-proto",
"blueprint-pathtools",
],
srcs: [
"flag_artifact.go",

View file

@ -25,6 +25,7 @@ import (
"slices"
"strings"
"github.com/google/blueprint/pathtools"
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto"
)
@ -101,7 +102,7 @@ func WriteFormattedMessage(path, format string, message proto.Message) (err erro
if err != nil {
return err
}
return os.WriteFile(path, data, 0644)
return pathtools.WriteFileIfChanged(path, data, 0644)
}
// Read a message from a file.