Skip to content

Update license check and generated code #858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2020
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ all:
plugins: ${PROTOC_GEN_SWIFT} ${PROTOC_GEN_GRPC_SWIFT}
cp $^ .

${PROTOC_GEN_SWIFT}:
${PROTOC_GEN_SWIFT}: Package.resolved
${SWIFT_BUILD_RELEASE} --product protoc-gen-swift

${PROTOC_GEN_GRPC_SWIFT}: Sources/protoc-gen-grpc-swift/*.swift
Expand Down
1 change: 1 addition & 0 deletions Sources/Examples/Echo/Model/echo.pb.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: echo.proto
Expand Down
1 change: 1 addition & 0 deletions Sources/Examples/RouteGuide/Model/route_guide.pb.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: route_guide.proto
Expand Down
32 changes: 32 additions & 0 deletions Sources/GRPCInteroperabilityTestModels/Generated/empty.grpc.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// DO NOT EDIT.
//
// Generated by the protocol buffer compiler.
// Source: src/proto/grpc/testing/empty.proto
//

//
// Copyright 2018, gRPC Authors All rights reserved.
//
// 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.
//
import Foundation
import GRPC
import NIO
import NIOHTTP1
import SwiftProtobuf



// Provides conformance to `GRPCPayload`
extension Grpc_Testing_Empty: GRPCProtobufPayload {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: src/proto/grpc/testing/empty.proto
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// DO NOT EDIT.
//
// Generated by the protocol buffer compiler.
// Source: src/proto/grpc/testing/messages.proto
//

//
// Copyright 2018, gRPC Authors All rights reserved.
//
// 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.
//
import Foundation
import GRPC
import NIO
import NIOHTTP1
import SwiftProtobuf



// Provides conformance to `GRPCPayload`
extension Grpc_Testing_BoolValue: GRPCProtobufPayload {}
extension Grpc_Testing_Payload: GRPCProtobufPayload {}
extension Grpc_Testing_EchoStatus: GRPCProtobufPayload {}
extension Grpc_Testing_SimpleRequest: GRPCProtobufPayload {}
extension Grpc_Testing_SimpleResponse: GRPCProtobufPayload {}
extension Grpc_Testing_StreamingInputCallRequest: GRPCProtobufPayload {}
extension Grpc_Testing_StreamingInputCallResponse: GRPCProtobufPayload {}
extension Grpc_Testing_ResponseParameters: GRPCProtobufPayload {}
extension Grpc_Testing_StreamingOutputCallRequest: GRPCProtobufPayload {}
extension Grpc_Testing_StreamingOutputCallResponse: GRPCProtobufPayload {}
extension Grpc_Testing_ReconnectParams: GRPCProtobufPayload {}
extension Grpc_Testing_ReconnectInfo: GRPCProtobufPayload {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: src/proto/grpc/testing/messages.proto
Expand Down
159 changes: 99 additions & 60 deletions Sources/GRPCInteroperabilityTestModels/Generated/test.grpc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ public final class Grpc_Testing_TestServiceClient: GRPCClient, Grpc_Testing_Test
/// - request: Request to send to EmptyCall.
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func emptyCall(_ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
return self.makeUnaryCall(path: "/grpc.testing.TestService/EmptyCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions)
public func emptyCall(
_ request: Grpc_Testing_Empty,
callOptions: CallOptions? = nil
) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
return self.makeUnaryCall(
path: "/grpc.testing.TestService/EmptyCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions
)
}

/// One request followed by one response.
Expand All @@ -71,10 +76,15 @@ public final class Grpc_Testing_TestServiceClient: GRPCClient, Grpc_Testing_Test
/// - request: Request to send to UnaryCall.
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func unaryCall(_ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
return self.makeUnaryCall(path: "/grpc.testing.TestService/UnaryCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions)
public func unaryCall(
_ request: Grpc_Testing_SimpleRequest,
callOptions: CallOptions? = nil
) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
return self.makeUnaryCall(
path: "/grpc.testing.TestService/UnaryCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions
)
}

/// One request followed by one response. Response has cache control
Expand All @@ -85,10 +95,15 @@ public final class Grpc_Testing_TestServiceClient: GRPCClient, Grpc_Testing_Test
/// - request: Request to send to CacheableUnaryCall.
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func cacheableUnaryCall(_ request: Grpc_Testing_SimpleRequest, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
return self.makeUnaryCall(path: "/grpc.testing.TestService/CacheableUnaryCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions)
public func cacheableUnaryCall(
_ request: Grpc_Testing_SimpleRequest,
callOptions: CallOptions? = nil
) -> UnaryCall<Grpc_Testing_SimpleRequest, Grpc_Testing_SimpleResponse> {
return self.makeUnaryCall(
path: "/grpc.testing.TestService/CacheableUnaryCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions
)
}

/// One request followed by a sequence of responses (streamed download).
Expand All @@ -99,11 +114,17 @@ public final class Grpc_Testing_TestServiceClient: GRPCClient, Grpc_Testing_Test
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ServerStreamingCall` with futures for the metadata and status.
public func streamingOutputCall(_ request: Grpc_Testing_StreamingOutputCallRequest, callOptions: CallOptions? = nil, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void) -> ServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
return self.makeServerStreamingCall(path: "/grpc.testing.TestService/StreamingOutputCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
handler: handler)
public func streamingOutputCall(
_ request: Grpc_Testing_StreamingOutputCallRequest,
callOptions: CallOptions? = nil,
handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
) -> ServerStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
return self.makeServerStreamingCall(
path: "/grpc.testing.TestService/StreamingOutputCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
handler: handler
)
}

/// A sequence of requests followed by one response (streamed upload).
Expand All @@ -115,9 +136,13 @@ public final class Grpc_Testing_TestServiceClient: GRPCClient, Grpc_Testing_Test
/// - Parameters:
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - Returns: A `ClientStreamingCall` with futures for the metadata, status and response.
public func streamingInputCall(callOptions: CallOptions? = nil) -> ClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse> {
return self.makeClientStreamingCall(path: "/grpc.testing.TestService/StreamingInputCall",
callOptions: callOptions ?? self.defaultCallOptions)
public func streamingInputCall(
callOptions: CallOptions? = nil
) -> ClientStreamingCall<Grpc_Testing_StreamingInputCallRequest, Grpc_Testing_StreamingInputCallResponse> {
return self.makeClientStreamingCall(
path: "/grpc.testing.TestService/StreamingInputCall",
callOptions: callOptions ?? self.defaultCallOptions
)
}

/// A sequence of requests with each request served by the server immediately.
Expand All @@ -131,10 +156,15 @@ public final class Grpc_Testing_TestServiceClient: GRPCClient, Grpc_Testing_Test
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
public func fullDuplexCall(callOptions: CallOptions? = nil, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
return self.makeBidirectionalStreamingCall(path: "/grpc.testing.TestService/FullDuplexCall",
callOptions: callOptions ?? self.defaultCallOptions,
handler: handler)
public func fullDuplexCall(
callOptions: CallOptions? = nil,
handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
return self.makeBidirectionalStreamingCall(
path: "/grpc.testing.TestService/FullDuplexCall",
callOptions: callOptions ?? self.defaultCallOptions,
handler: handler
)
}

/// A sequence of requests followed by a sequence of responses.
Expand All @@ -149,10 +179,15 @@ public final class Grpc_Testing_TestServiceClient: GRPCClient, Grpc_Testing_Test
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - handler: A closure called when each response is received from the server.
/// - Returns: A `ClientStreamingCall` with futures for the metadata and status.
public func halfDuplexCall(callOptions: CallOptions? = nil, handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
return self.makeBidirectionalStreamingCall(path: "/grpc.testing.TestService/HalfDuplexCall",
callOptions: callOptions ?? self.defaultCallOptions,
handler: handler)
public func halfDuplexCall(
callOptions: CallOptions? = nil,
handler: @escaping (Grpc_Testing_StreamingOutputCallResponse) -> Void
) -> BidirectionalStreamingCall<Grpc_Testing_StreamingOutputCallRequest, Grpc_Testing_StreamingOutputCallResponse> {
return self.makeBidirectionalStreamingCall(
path: "/grpc.testing.TestService/HalfDuplexCall",
callOptions: callOptions ?? self.defaultCallOptions,
handler: handler
)
}

/// The test server will not implement this method. It will be used
Expand All @@ -162,12 +197,16 @@ public final class Grpc_Testing_TestServiceClient: GRPCClient, Grpc_Testing_Test
/// - request: Request to send to UnimplementedCall.
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func unimplementedCall(_ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
return self.makeUnaryCall(path: "/grpc.testing.TestService/UnimplementedCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions)
public func unimplementedCall(
_ request: Grpc_Testing_Empty,
callOptions: CallOptions? = nil
) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
return self.makeUnaryCall(
path: "/grpc.testing.TestService/UnimplementedCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions
)
}

}

/// Usage: instantiate Grpc_Testing_UnimplementedServiceClient, then call methods of this protocol to make API calls.
Expand Down Expand Up @@ -195,12 +234,16 @@ public final class Grpc_Testing_UnimplementedServiceClient: GRPCClient, Grpc_Tes
/// - request: Request to send to UnimplementedCall.
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func unimplementedCall(_ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
return self.makeUnaryCall(path: "/grpc.testing.UnimplementedService/UnimplementedCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions)
public func unimplementedCall(
_ request: Grpc_Testing_Empty,
callOptions: CallOptions? = nil
) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_Empty> {
return self.makeUnaryCall(
path: "/grpc.testing.UnimplementedService/UnimplementedCall",
request: request,
callOptions: callOptions ?? self.defaultCallOptions
)
}

}

/// Usage: instantiate Grpc_Testing_ReconnectServiceClient, then call methods of this protocol to make API calls.
Expand Down Expand Up @@ -229,10 +272,15 @@ public final class Grpc_Testing_ReconnectServiceClient: GRPCClient, Grpc_Testing
/// - request: Request to send to Start.
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func start(_ request: Grpc_Testing_ReconnectParams, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty> {
return self.makeUnaryCall(path: "/grpc.testing.ReconnectService/Start",
request: request,
callOptions: callOptions ?? self.defaultCallOptions)
public func start(
_ request: Grpc_Testing_ReconnectParams,
callOptions: CallOptions? = nil
) -> UnaryCall<Grpc_Testing_ReconnectParams, Grpc_Testing_Empty> {
return self.makeUnaryCall(
path: "/grpc.testing.ReconnectService/Start",
request: request,
callOptions: callOptions ?? self.defaultCallOptions
)
}

/// Unary call to Stop
Expand All @@ -241,12 +289,16 @@ public final class Grpc_Testing_ReconnectServiceClient: GRPCClient, Grpc_Testing
/// - request: Request to send to Stop.
/// - callOptions: Call options; `self.defaultCallOptions` is used if `nil`.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func stop(_ request: Grpc_Testing_Empty, callOptions: CallOptions? = nil) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo> {
return self.makeUnaryCall(path: "/grpc.testing.ReconnectService/Stop",
request: request,
callOptions: callOptions ?? self.defaultCallOptions)
public func stop(
_ request: Grpc_Testing_Empty,
callOptions: CallOptions? = nil
) -> UnaryCall<Grpc_Testing_Empty, Grpc_Testing_ReconnectInfo> {
return self.makeUnaryCall(
path: "/grpc.testing.ReconnectService/Stop",
request: request,
callOptions: callOptions ?? self.defaultCallOptions
)
}

}

/// To build a server, implement a class that conforms to this protocol.
Expand Down Expand Up @@ -389,16 +441,3 @@ extension Grpc_Testing_ReconnectServiceProvider {
}


// Provides conformance to `GRPCPayload` for request and response messages
extension Grpc_Testing_Empty: GRPCProtobufPayload {}
extension Grpc_Testing_SimpleRequest: GRPCProtobufPayload {}
extension Grpc_Testing_SimpleResponse: GRPCProtobufPayload {}
extension Grpc_Testing_StreamingOutputCallRequest: GRPCProtobufPayload {}
extension Grpc_Testing_StreamingOutputCallResponse: GRPCProtobufPayload {}
extension Grpc_Testing_StreamingInputCallRequest: GRPCProtobufPayload {}
extension Grpc_Testing_StreamingInputCallResponse: GRPCProtobufPayload {}


extension Grpc_Testing_ReconnectParams: GRPCProtobufPayload {}
extension Grpc_Testing_ReconnectInfo: GRPCProtobufPayload {}

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// DO NOT EDIT.
// swift-format-ignore-file
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: src/proto/grpc/testing/test.proto
Expand Down
6 changes: 4 additions & 2 deletions scripts/license-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ check_copyright_headers() {
;;
*.pb.swift)
expected_sha="$SWIFT_GRPC_PB"
drop_first=8
drop_first=9
expected_lines=13
;;
*/Package.swift)
Expand All @@ -131,11 +131,13 @@ check_copyright_headers() {
| shasum \
| awk '{print $1}')

rc=0
if [ "$actual_sha" != "$expected_sha" ]; then
printf "\033[0;31mMissing or invalid copyright headers in '$filename'\033[0m\n"
exit 1
rc=1
fi
done
exit $rc
}

check_copyright_headers