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:
@@ -24,6 +24,7 @@ bootstrap_go_package {
|
|||||||
"golang-protobuf-reflect-protoreflect",
|
"golang-protobuf-reflect-protoreflect",
|
||||||
"golang-protobuf-runtime-protoimpl",
|
"golang-protobuf-runtime-protoimpl",
|
||||||
"soong-cmd-release_config-proto",
|
"soong-cmd-release_config-proto",
|
||||||
|
"blueprint-pathtools",
|
||||||
],
|
],
|
||||||
srcs: [
|
srcs: [
|
||||||
"flag_artifact.go",
|
"flag_artifact.go",
|
||||||
|
@@ -25,6 +25,7 @@ import (
|
|||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/google/blueprint/pathtools"
|
||||||
"google.golang.org/protobuf/encoding/prototext"
|
"google.golang.org/protobuf/encoding/prototext"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@@ -101,7 +102,7 @@ func WriteFormattedMessage(path, format string, message proto.Message) (err erro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return os.WriteFile(path, data, 0644)
|
return pathtools.WriteFileIfChanged(path, data, 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read a message from a file.
|
// Read a message from a file.
|
||||||
|
Reference in New Issue
Block a user