Skip to content

Commit 82764a9

Browse files
committed
WIP
1 parent 3ed26da commit 82764a9

File tree

28 files changed

+1437
-3
lines changed

28 files changed

+1437
-3
lines changed

.github/workflows/pull_request.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ jobs:
2626
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2727
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
2828

29+
plugin-tests:
30+
name: Plugin tests
31+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
32+
with:
33+
name: "Plugin tests"
34+
matrix_linux_5_9_enabled: false
35+
matrix_linux_5_10_enabled: false
36+
matrix_linux_command: "./dev/plugin-tests.sh"
37+
2938
cxx-interop:
3039
name: Cxx interop
3140
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
xcuserdata/
5+
DerivedData/
6+
.swiftpm/configuration/registries.json
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
8+
.netrc
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// swift-tools-version: 6.0
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "grpc-adopter",
8+
platforms: [
9+
.macOS(.v15),
10+
.iOS(.v18),
11+
.tvOS(.v18),
12+
.watchOS(.v11),
13+
.visionOS(.v2),
14+
],
15+
dependencies: [
16+
.package(
17+
path: "../../../../grpc-swift-protobuf"
18+
),
19+
.package(
20+
url: "https://github.com/grpc/grpc-swift.git",
21+
from: "1.28.2"
22+
)
23+
],
24+
targets: [
25+
.executableTarget(
26+
name: "grpc-adopter",
27+
dependencies: [
28+
.product(name: "GRPCCore", package: "grpc-swift"),
29+
.product(name: "GRPCInProcessTransport", package: "grpc-swift"),
30+
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
31+
],
32+
plugins: [
33+
.plugin(name: "GRPCGeneratorPlugin", package: "grpc-swift-protobuf")
34+
]
35+
)
36+
]
37+
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2015 gRPC authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
syntax = "proto3";
15+
16+
option java_multiple_files = true;
17+
option java_package = "io.grpc.examples.helloworld";
18+
option java_outer_classname = "HelloWorldProto";
19+
option objc_class_prefix = "HLW";
20+
21+
package helloworld;
22+
23+
// The greeting service definition.
24+
service Greeter {
25+
// Sends a greeting
26+
rpc SayHello (HelloRequest) returns (HelloReply) {}
27+
}
28+
29+
// The request message containing the user's name.
30+
message HelloRequest {
31+
string name = 1;
32+
}
33+
34+
// The response message containing the greetings
35+
message HelloReply {
36+
string message = 1;
37+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2024, gRPC Authors All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import GRPCCore
18+
import GRPCInProcessTransport
19+
import GRPCProtobuf
20+
21+
@main
22+
struct PluginAdopter {
23+
static func main() async throws {
24+
let inProcess = InProcessTransport()
25+
try await withGRPCServer(transport: inProcess.server, services: [Greeter()]) { server in
26+
try await withGRPCClient(transport: inProcess.client) { client in
27+
try await Self.doRPC(Helloworld_Greeter.Client(wrapping: client))
28+
}
29+
}
30+
}
31+
32+
static func doRPC(_ greeter: Helloworld_Greeter.Client) async throws {
33+
do {
34+
let reply = try await greeter.sayHello(.with { $0.name = "(ignored)" })
35+
print("Reply: \(reply.message)")
36+
} catch {
37+
print("Error: \(error)")
38+
}
39+
}
40+
}
41+
42+
struct Greeter: Helloworld_Greeter.SimpleServiceProtocol {
43+
func sayHello(
44+
request: Helloworld_HelloRequest,
45+
context: ServerContext
46+
) async throws -> Helloworld_HelloReply {
47+
return .with { reply in
48+
reply.message = "Hello, world!"
49+
}
50+
}
51+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"protocPath": "/opt/homebrew/bin/protoc",
3+
"visibility": "internal"
4+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
xcuserdata/
5+
DerivedData/
6+
.swiftpm/configuration/registries.json
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
8+
.netrc
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// swift-tools-version: 6.0
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "grpc-adopter",
8+
platforms: [
9+
.macOS(.v15),
10+
.iOS(.v18),
11+
.tvOS(.v18),
12+
.watchOS(.v11),
13+
.visionOS(.v2),
14+
],
15+
dependencies: [
16+
.package(
17+
path: "../../../../grpc-swift-protobuf"
18+
),
19+
.package(
20+
url: "https://github.com/grpc/grpc-swift.git",
21+
from: "1.28.2"
22+
)
23+
],
24+
targets: [
25+
.executableTarget(
26+
name: "grpc-adopter",
27+
dependencies: [
28+
.product(name: "GRPCCore", package: "grpc-swift"),
29+
.product(name: "GRPCInProcessTransport", package: "grpc-swift"),
30+
.product(name: "GRPCProtobuf", package: "grpc-swift-protobuf"),
31+
],
32+
plugins: [
33+
.plugin(name: "GRPCGeneratorPlugin", package: "grpc-swift-protobuf")
34+
]
35+
)
36+
]
37+
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2015 gRPC authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
syntax = "proto3";
15+
16+
option java_multiple_files = true;
17+
option java_package = "io.grpc.examples.helloworld";
18+
option java_outer_classname = "HelloWorldProto";
19+
option objc_class_prefix = "HLW";
20+
21+
package helloworld;
22+
23+
// The greeting service definition.
24+
service Greeter {
25+
// Sends a greeting
26+
rpc SayHello (HelloRequest) returns (HelloReply) {}
27+
}
28+
29+
// The request message containing the user's name.
30+
message HelloRequest {
31+
string name = 1;
32+
}
33+
34+
// The response message containing the greetings
35+
message HelloReply {
36+
string message = 1;
37+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"protocPath": "/opt/homebrew/bin/protoc",
3+
"visibility": "internal"
4+
}

0 commit comments

Comments
 (0)