forked from bazelbuild/remote-apis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Command proto serialization. (bazelbuild#129)
As usual, Go proto files need to be checked in to work with go build. Modeling our pre-commit hooks after the remote-apis repo.
- Loading branch information
Ola Rozenfeld
authored
Mar 19, 2020
1 parent
7476b11
commit 656a0d6
Showing
8 changed files
with
1,131 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
#!/bin/sh | ||
|
||
|
||
######################################################################## | ||
# Check that all Go files have been gofmt'd. | ||
######################################################################## | ||
# Find all change go files. | ||
gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$') | ||
[ -z "$gofiles" ] && exit 0 | ||
|
||
source ./check-gofmt.sh "$gofiles" | ||
./check-gofmt.sh $gofiles | ||
|
||
######################################################################## | ||
# Precommit hook to rebuild generated go code. Fails if building or | ||
# copying the files fails. | ||
######################################################################## | ||
bazel build go/api/command:command_go_proto | ||
GEN_CMD_PATH="go/api/command/command.pb.go" | ||
cp -f "$(find $(bazel info bazel-bin) -path "*/$GEN_CMD_PATH")" "$GEN_CMD_PATH" | ||
git add "$GEN_CMD_PATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
load("@rules_proto//proto:defs.bzl", "proto_library") | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") | ||
|
||
proto_library( | ||
name = "command_proto", | ||
srcs = ["command.proto"], | ||
visibility = ["//visibility:public"], | ||
deps = ["@com_google_protobuf//:timestamp_proto"], | ||
) | ||
|
||
go_proto_library( | ||
name = "command_go_proto", | ||
importpath = "github.com/bazelbuild/remote-apis-sdks/go/api/command", | ||
proto = ":command_proto", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
go_library( | ||
name = "go_default_library", | ||
embed = [":command_go_proto"], | ||
importpath = "github.com/bazelbuild/remote-apis-sdks/go/api/command", | ||
visibility = ["//visibility:public"], | ||
) |
Oops, something went wrong.