From 84d921469ab1ac9be6c470be8c64dc806477f07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Fri, 29 Dec 2023 14:28:35 +0100 Subject: [PATCH] Generate deprecated for services and service methods --- protoc_plugin/lib/src/client_generator.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/protoc_plugin/lib/src/client_generator.dart b/protoc_plugin/lib/src/client_generator.dart index f927a1f9d..390d02eca 100644 --- a/protoc_plugin/lib/src/client_generator.dart +++ b/protoc_plugin/lib/src/client_generator.dart @@ -20,6 +20,10 @@ class ClientApiGenerator { String get _clientType => '$protobufImportPrefix.RpcClient'; void generate(IndentingWriter out) { + if (service._descriptor.options.deprecated) { + out.println( + '@$coreImportPrefix.Deprecated(\'This service is deprecated\')'); + } out.addBlock('class ${className}Api {', '}', () { out.println('$_clientType _client;'); out.println('${className}Api(this._client);'); @@ -41,6 +45,10 @@ class ClientApiGenerator { final inputType = service._getDartClassName(m.inputType, forMainFile: true); final outputType = service._getDartClassName(m.outputType, forMainFile: true); + if (m.options.deprecated) { + out.println( + '@$coreImportPrefix.Deprecated(\'This method is deprecated\')'); + } out.addBlock( '$asyncImportPrefix.Future<$outputType> $methodName(' '$protobufImportPrefix.ClientContext? ctx, $inputType request) =>',