Merge "Only write release config files if they've changed" into main

This commit is contained in:
Treehugger Robot 2024-06-14 17:49:23 +00:00 committed by Gerrit Code Review
commit 7467410787
2 changed files with 3 additions and 1 deletions

View file

@ -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",

View file

@ -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.