Skip to content

Commit

Permalink
multi: format test proto with generic script
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Jun 21, 2024
1 parent 996f100 commit 17180f2
Show file tree
Hide file tree
Showing 9 changed files with 356 additions and 214 deletions.
7 changes: 7 additions & 0 deletions pricesrpc/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
Language: Proto
BasedOnStyle: Google
IndentWidth: 4
AllowShortFunctionsOnASingleLine: None
SpaceBeforeParens: Always
CompactNamespaces: false
12 changes: 11 additions & 1 deletion pricesrpc/gen_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
function generate() {
echo "Generating root gRPC server protos"

PROTOS="prices.proto"
PROTOS="*.proto"

# For each of the sub-servers, we then generate their protos, but a restricted
# set as they don't yet require REST proxies, or swagger docs.
Expand All @@ -20,6 +20,11 @@ function generate() {
--go-grpc_out . --go-grpc_opt paths=source_relative \
"${file}"

# Stop here if we don't need to generate anything REST.
if [[ "$1" == "skip_rest" ]]; then
return
fi

# Generate the REST reverse proxy.
annotationsFile=${file//proto/yaml}
protoc -I/usr/local/include -I. \
Expand Down Expand Up @@ -73,6 +78,11 @@ format
generate
popd

pushd proxy/testdata
format
generate skip_rest
popd

if [[ "$COMPILE_MOBILE" == "1" ]]; then
pushd mobile
./gen_bindings.sh $FALAFEL_VERSION
Expand Down
12 changes: 8 additions & 4 deletions pricesrpc/prices.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ package pricesrpc;

option go_package = "github.com/lightninglabs/aperture/pricesrpc";

service Prices { rpc GetPrice(GetPriceRequest) returns (GetPriceResponse); }
service Prices {
rpc GetPrice (GetPriceRequest) returns (GetPriceResponse);
}

message GetPriceRequest {
string path = 1;
string path = 1;

string http_request_text = 2;
string http_request_text = 2;
}

message GetPriceResponse { int64 price_sats = 1; }
message GetPriceResponse {
int64 price_sats = 1;
}
4 changes: 3 additions & 1 deletion proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ type testCase struct {
}

// helloServer is a simple server that implements the GreeterServer interface.
type helloServer struct{}
type helloServer struct {
proxytest.UnimplementedGreeterServer
}

// SayHello returns a simple string that also contains a string from the
// request.
Expand Down
7 changes: 7 additions & 0 deletions proxy/testdata/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
Language: Proto
BasedOnStyle: Google
IndentWidth: 4
AllowShortFunctionsOnASingleLine: None
SpaceBeforeParens: Always
CompactNamespaces: false
7 changes: 0 additions & 7 deletions proxy/testdata/gen_protos.sh

This file was deleted.

Loading

0 comments on commit 17180f2

Please sign in to comment.