Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ extension Target.Dependency {
static let grpc: Self = .target(name: grpcTargetName)
static let cgrpcZlib: Self = .target(name: cgrpcZlibTargetName)
static let protocGenGRPCSwift: Self = .target(name: "protoc-gen-grpc-swift")
static let performanceWorker: Self = .target(name: "performance-worker")
static let reflectionService: Self = .target(name: "GRPCReflectionService")
static let grpcCodeGen: Self = .target(name: "GRPCCodeGen")
static let grpcProtobuf: Self = .target(name: "GRPCProtobuf")
Expand Down Expand Up @@ -245,6 +246,14 @@ extension Target {
]
)

static let performanceWorker: Target = .executableTarget(
name: "performance-worker",
dependencies: [
.grpcCore,
.grpcProtobuf
]
)

static let grpcSwiftPlugin: Target = .plugin(
name: "GRPCSwiftPlugin",
capability: .buildTool(),
Expand Down Expand Up @@ -722,6 +731,7 @@ let package = Package(
.grpcProtobuf,
.grpcProtobufCodeGen,
.interoperabilityTestImplementation,
.performanceWorker,

// v2 tests
.grpcCoreTests,
Expand Down
10 changes: 9 additions & 1 deletion Protos/fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,22 @@ rm -rf "$upstream"

# Create new directories to poulate. These are based on proto package name
# rather than source repository name.
mkdir -p "$upstream/grpc"
mkdir -p "$upstream/google"
mkdir -p "$upstream/grpc/testing"
mkdir -p "$upstream/grpc/core"

# Copy over the grpc-proto protos.
cp -rp "$checkouts/grpc-proto/grpc/service_config" "$upstream/grpc/service_config"
cp -rp "$checkouts/grpc-proto/grpc/lookup" "$upstream/grpc/lookup"
cp -rp "$checkouts/grpc-proto/grpc/reflection" "$upstream/grpc/reflection"
cp -rp "$checkouts/grpc-proto/grpc/examples" "$upstream/grpc/examples"
cp -rp "$checkouts/grpc-proto/grpc/testing/benchmark_service.proto" "$upstream/grpc/testing/benchmark_service.proto"
cp -rp "$checkouts/grpc-proto/grpc/testing/messages.proto" "$upstream/grpc/testing/messages.proto"
cp -rp "$checkouts/grpc-proto/grpc/testing/worker_service.proto" "$upstream/grpc/testing/worker_service.proto"
cp -rp "$checkouts/grpc-proto/grpc/testing/control.proto" "$upstream/grpc/testing/control.proto"
cp -rp "$checkouts/grpc-proto/grpc/testing/payloads.proto" "$upstream/grpc/testing/payloads.proto"
cp -rp "$checkouts/grpc-proto/grpc/testing/stats.proto" "$upstream/grpc/testing/stats.proto"
cp -rp "$checkouts/grpc-proto/grpc/core/stats.proto" "$upstream/grpc/core/stats.proto"

# Copy over the googleapis protos.
mkdir -p "$upstream/google/rpc"
Expand Down
26 changes: 26 additions & 0 deletions Protos/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,29 @@ function generate_service_messages_interop_tests {
done
}

function generate_worker_service {
local protos=(
"$here/upstream/grpc/testing/payloads.proto"
"$here/upstream/grpc/testing/control.proto"
"$here/upstream/grpc/testing/messages.proto"
"$here/upstream/grpc/testing/stats.proto"
"$here/upstream/grpc/testing/benchmark_service.proto"
"$here/upstream/grpc/testing/worker_service.proto"
)
local output="$root/Sources/performance-worker/Generated"

generate_message "$here/upstream/grpc/core/stats.proto" "$here/upstream" "$output" "Visibility=Internal" "FileNaming=PathToUnderscores"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we use "FileNaming=PathToUnderscores" but below we use "FileNaming=DropPath" – why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 2 stat.proto file - one in grpc/core and one in grpc/testing. As all the other .proto files are located within 'grpc/testing' I was thinking we can drop the path from their names, and keep the path only for the 'stats.proto' file from the other module, to differentiate the 2 files containing generated code for the 2 'stats.proto' files.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't realise there were two, thanks for explaining. In that case I'd rather we stick to one naming style if possible.


for proto in "${protos[@]}"; do
generate_message "$proto" "$here/upstream" "$output" "Visibility=Internal" "FileNaming=PathToUnderscores"
if [ "$proto" == "$here/upstream/grpc/testing/worker_service.proto" ]; then
generate_grpc "$proto" "$here/upstream" "$output" "Visibility=Internal" "Client=false" "_V2=true" "FileNaming=PathToUnderscores"
else
generate_grpc "$proto" "$here/upstream" "$output" "Visibility=Internal" "_V2=true" "FileNaming=PathToUnderscores"
fi
done
}

#------------------------------------------------------------------------------

# Examples
Expand All @@ -220,3 +243,6 @@ generate_service_messages_interop_tests
# Misc. tests
generate_normalization_for_tests
generate_rpc_code_for_tests

# Performance worker service
generate_worker_service
38 changes: 38 additions & 0 deletions Protos/upstream/grpc/core/stats.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2017 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package grpc.core;

message Bucket {
double start = 1;
uint64 count = 2;
}

message Histogram {
repeated Bucket buckets = 1;
}

message Metric {
string name = 1;
oneof value {
uint64 count = 10;
Histogram histogram = 11;
}
}

message Stats {
repeated Metric metrics = 1;
}
48 changes: 48 additions & 0 deletions Protos/upstream/grpc/testing/benchmark_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
syntax = "proto3";

import "grpc/testing/messages.proto";

package grpc.testing;

option java_multiple_files = true;
option java_package = "io.grpc.testing";
option java_outer_classname = "BenchmarkServiceProto";

service BenchmarkService {
// One request followed by one response.
// The server returns the client payload as-is.
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);

// Repeated sequence of one request followed by one response.
// Should be called streaming ping-pong
// The server returns the client payload as-is on each response
rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse);

// Single-sided unbounded streaming from client to server
// The server returns the client payload as-is once the client does WritesDone
rpc StreamingFromClient(stream SimpleRequest) returns (SimpleResponse);

// Single-sided unbounded streaming from server to client
// The server repeatedly returns the client payload as-is
rpc StreamingFromServer(SimpleRequest) returns (stream SimpleResponse);

// Two-sided unbounded streaming between server to client
// Both sides send the content of their own choice to the other
rpc StreamingBothWays(stream SimpleRequest) returns (stream SimpleResponse);
}
Loading