Skip to content

Commit

Permalink
Don't leak the proto abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatskaari committed Nov 15, 2023
1 parent 14c8b37 commit abe3ed7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ go_library(
pgo_file = "//:pgo",
visibility = ["PUBLIC"],
deps = [
"///third_party/go/github.com_bazelbuild_remote-apis//build/bazel/remote/execution/v2",
"///third_party/go/github.com_cespare_xxhash_v2//:v2",
"///third_party/go/github.com_coreos_go-semver//semver",
"///third_party/go/github.com_google_shlex//:shlex",
Expand All @@ -22,7 +21,6 @@ go_library(
"///third_party/go/github.com_thought-machine_go-flags//:go-flags",
"///third_party/go/github.com_zeebo_blake3//:blake3",
"///third_party/go/golang.org_x_sync//errgroup",
"///third_party/go/google.golang.org_protobuf//proto",
"//src/cli",
"//src/cli/logging",
"//src/cmap",
Expand Down
7 changes: 0 additions & 7 deletions src/core/build_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ import (
"sync/atomic"
"time"

pb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
"golang.org/x/sync/errgroup"
"google.golang.org/protobuf/proto"

"github.com/thought-machine/please/src/fs"
)
Expand Down Expand Up @@ -264,11 +262,6 @@ type BuildMetadata struct {
Cached bool
}

func (m *BuildMetadata) SetRemoteOutputs(tree *pb.Tree) {
data, _ := proto.Marshal(tree)
m.RemoteOutputs = data
}

// A PreBuildFunction is a type that allows hooking a pre-build callback.
type PreBuildFunction interface {
fmt.Stringer
Expand Down
8 changes: 7 additions & 1 deletion src/remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/durationpb"

"github.com/thought-machine/please/src/cli/logging"
Expand Down Expand Up @@ -326,7 +327,12 @@ func (c *Client) Build(target *core.BuildTarget) (*core.BuildMetadata, error) {
if err != nil {
return metadata, c.wrapActionErr(err, digest)
}
metadata.SetRemoteOutputs(tree)

data, err := proto.Marshal(tree)
if err != nil {
return nil, err
}
metadata.RemoteOutputs = data

if c.state.ShouldDownload(target) {
c.state.LogBuildResult(target, core.TargetBuilding, "Downloading")
Expand Down

0 comments on commit abe3ed7

Please sign in to comment.