Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4591b649 authored by Dan Willemsen's avatar Dan Willemsen
Browse files

Upgrade to golang protobuf api v2

Major operations:
 * Fix the go_package entries to be consistent, as the new tool
   complains when it doesn't have a '/'.
 * Regenerate with the new protoc-gen-go tool.
 * github.com/golang/protobuf -> google.golang.org/protobuf
 * proto.[Un]MarshalText -> prototext.[Un]Marshal

Change-Id: Ie1147bd2457fafb66ba555461b3bf14f0561a25d
parent 00d21ce8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ bootstrap_go_package {
        "soong-response",
        "soong-shared",
        "soong-ui-metrics_proto",
        "golang-protobuf-proto",
        "golang-protobuf-encoding-prototext",
    ],
    srcs: [
        "androidmk.go",
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ import (
	"io/ioutil"
	"runtime"

	"github.com/golang/protobuf/proto"
	"google.golang.org/protobuf/proto"

	soong_metrics_proto "android/soong/ui/metrics/metrics_proto"
)
+8 −3
Original line number Diff line number Diff line
@@ -22,9 +22,10 @@ import (
	"strings"
	"testing"

	"github.com/golang/protobuf/proto"
	"github.com/google/blueprint"
	"github.com/google/blueprint/proptools"
	"google.golang.org/protobuf/encoding/prototext"
	"google.golang.org/protobuf/proto"

	"android/soong/cmd/sbox/sbox_proto"
	"android/soong/remoteexec"
@@ -621,7 +622,11 @@ func (r *RuleBuilder) Build(name string, desc string) {
		}

		// Create a rule to write the manifest as a the textproto.
		WriteFileRule(r.ctx, r.sboxManifestPath, proto.MarshalTextString(&manifest))
		pbText, err := prototext.Marshal(&manifest)
		if err != nil {
			ReportPathErrorf(r.ctx, "sbox manifest failed to marshal: %q", err)
		}
		WriteFileRule(r.ctx, r.sboxManifestPath, string(pbText))

		// Generate a new string to use as the command line of the sbox rule.  This uses
		// a RuleBuilderCommand as a convenience method of building the command line, then
@@ -1266,7 +1271,7 @@ func RuleBuilderSboxProtoForTests(t *testing.T, params TestingBuildParams) *sbox
	t.Helper()
	content := ContentFromFileRuleForTests(t, params)
	manifest := sbox_proto.Manifest{}
	err := proto.UnmarshalText(content, &manifest)
	err := prototext.Unmarshal([]byte(content), &manifest)
	if err != nil {
		t.Fatalf("failed to unmarshal manifest: %s", err.Error())
	}
+5 −1
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ blueprint_go_binary {
    deps: [
        "android-archive-zip",
        "golang-protobuf-proto",
        "golang-protobuf-encoding-prototext",
        "soong-cmd-extract_apks-proto",
    ],
    testSrcs: ["main_test.go"],
@@ -16,7 +17,10 @@ blueprint_go_binary {
bootstrap_go_package {
    name: "soong-cmd-extract_apks-proto",
    pkgPath: "android/soong/cmd/extract_apks/bundle_proto",
    deps: ["golang-protobuf-proto"],
    deps: [
        "golang-protobuf-reflect-protoreflect",
        "golang-protobuf-runtime-protoimpl",
    ],
    srcs: [
        "bundle_proto/commands.pb.go",
        "bundle_proto/config.pb.go",
+1103 −591

File changed.

Preview size limit exceeded, changes collapsed.

Loading