diff --git a/IntegrationTests/PluginTests/Resources/Protos/HelloWorld/HelloWorld_edition2024.proto b/IntegrationTests/PluginTests/Resources/Protos/HelloWorld/HelloWorld_edition2024.proto new file mode 100644 index 0000000..8ead426 --- /dev/null +++ b/IntegrationTests/PluginTests/Resources/Protos/HelloWorld/HelloWorld_edition2024.proto @@ -0,0 +1,32 @@ +// Copyright 2015, 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. +edition = "2024"; + +package helloworld; + +// The greeting service definition. +service Greeter { + // Sends a greeting + rpc SayHello(HelloRequest) returns (HelloReply) {} +} + +// The request message containing the user's name. +message HelloRequest { + string name = 1; +} + +// The response message containing the greetings +message HelloReply { + string message = 1; +} diff --git a/Sources/protoc-gen-grpc-swift-2/GenerateGRPC.swift b/Sources/protoc-gen-grpc-swift-2/GenerateGRPC.swift index 5d55e5f..0873893 100644 --- a/Sources/protoc-gen-grpc-swift-2/GenerateGRPC.swift +++ b/Sources/protoc-gen-grpc-swift-2/GenerateGRPC.swift @@ -41,7 +41,7 @@ final class GenerateGRPC: SwiftProtobufPluginLibrary.CodeGenerator { } var supportedEditionRange: ClosedRange { - Google_Protobuf_Edition.proto2 ... Google_Protobuf_Edition.edition2023 + Google_Protobuf_Edition.proto2 ... Google_Protobuf_Edition.edition2024 } // A count of generated files by desired name (actual name may differ to avoid collisions). diff --git a/dev/setup-plugin-tests.sh b/dev/setup-plugin-tests.sh index 8029b1b..4203cbb 100755 --- a/dev/setup-plugin-tests.sh +++ b/dev/setup-plugin-tests.sh @@ -199,10 +199,28 @@ function test_07_duplicated_proto_file_name { cp "${config}/internal-grpc-swift-proto-generator-config.json" "${test_dir}/Sources/Protos/grpc-swift-proto-generator-config.json" } +function test_08_edition2024 { + # . + # ├── Package.swift + # └── Sources + # ├── HelloWorldAdopter.swift + # ├── Protos + # │ └── HelloWorld_edition2024.proto + # └── grpc-swift-proto-generator-config.json + + local -r test_dir=$(test_dir_name) + mkdir -p "${test_dir}/Sources/Protos" + cp "${package_manifest}" "${test_dir}/" + cp "${sources}/HelloWorldAdopter.swift" "${test_dir}/Sources/" + cp "${protos}/HelloWorld/HelloWorld_edition2024.proto" "${test_dir}/Sources/Protos" + cp "${config}/internal-grpc-swift-proto-generator-config.json" "${test_dir}/Sources/grpc-swift-proto-generator-config.json" +} + test_01_top_level_config_file test_02_peer_config_file test_03_separate_service_message_protos test_04_cross_directory_imports test_05_two_definitions test_06_nested_definitions -test_07_duplicated_proto_file_name \ No newline at end of file +test_07_duplicated_proto_file_name +test_08_edition2024