From 694237ae46cd1b1b2a1a915e3d69412b8c711110 Mon Sep 17 00:00:00 2001 From: "SangHyeon.Kim" Date: Thu, 16 Nov 2023 21:07:49 +0900 Subject: [PATCH] mark generated objects. --- .../GeneratedByPlasticCommandAttribute.cs | 11 +++++++++++ .../Templates/CommandTemplate/CommandTemplate.cs | 4 +++- .../Templates/CommandTemplate/CommandTemplate.txt | 2 ++ .../CommandTemplate/ValidatableCommandTemplate.cs | 2 ++ .../CommandTemplate/ValidatableCommandTemplate.txt | 2 ++ .../Templates/CommandsTemplate/CommandsTemplate.cs | 1 + .../Templates/CommandsTemplate/CommandsTemplate.txt | 1 + src/PlasticCommand/PlasticCommand.csproj | 2 +- 8 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/PlasticCommand/GeneratedByPlasticCommandAttribute.cs diff --git a/src/PlasticCommand/GeneratedByPlasticCommandAttribute.cs b/src/PlasticCommand/GeneratedByPlasticCommandAttribute.cs new file mode 100644 index 0000000..e18e256 --- /dev/null +++ b/src/PlasticCommand/GeneratedByPlasticCommandAttribute.cs @@ -0,0 +1,11 @@ +using System; + +namespace PlasticCommand; + +[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)] +public class GeneratedByPlasticCommandAttribute : Attribute +{ + public GeneratedByPlasticCommandAttribute() + { + } +} diff --git a/src/PlasticCommand/Generator/Templates/CommandTemplate/CommandTemplate.cs b/src/PlasticCommand/Generator/Templates/CommandTemplate/CommandTemplate.cs index 83232b4..4071765 100644 --- a/src/PlasticCommand/Generator/Templates/CommandTemplate/CommandTemplate.cs +++ b/src/PlasticCommand/Generator/Templates/CommandTemplate/CommandTemplate.cs @@ -13,14 +13,16 @@ namespace Templates // replace: to {{ Namespace }} using TargetCommandSpec = PlasticCommand.Generator.TTFFCommandSpec; // replace: internal to public + [GeneratedByPlasticCommand] internal interface TTFFGeneratedCommandInterface : ICommandSpecification { /// Task ExecuteAsync( Generator.TTFFParameter TTFFParamName, CancellationToken token = default); } - + // replace: internal to public + [GeneratedByPlasticCommand] internal class TTFFCommand : TTFFGeneratedCommandInterface { private readonly IServiceProvider _provider; diff --git a/src/PlasticCommand/Generator/Templates/CommandTemplate/CommandTemplate.txt b/src/PlasticCommand/Generator/Templates/CommandTemplate/CommandTemplate.txt index a0d5af3..9e0023a 100644 --- a/src/PlasticCommand/Generator/Templates/CommandTemplate/CommandTemplate.txt +++ b/src/PlasticCommand/Generator/Templates/CommandTemplate/CommandTemplate.txt @@ -12,6 +12,7 @@ namespace {{ Namespace }} using Generator = PlasticCommand.Generator; using TargetCommandSpec = PlasticCommand.Generator.TTFFCommandSpec; + [GeneratedByPlasticCommand] public interface TTFFGeneratedCommandInterface : ICommandSpecification { /// @@ -19,6 +20,7 @@ namespace {{ Namespace }} Generator.TTFFParameter TTFFParamName, CancellationToken token = default); } + [GeneratedByPlasticCommand] public sealed class TTFFCommand : TTFFGeneratedCommandInterface { private readonly IServiceProvider _provider; diff --git a/src/PlasticCommand/Generator/Templates/CommandTemplate/ValidatableCommandTemplate.cs b/src/PlasticCommand/Generator/Templates/CommandTemplate/ValidatableCommandTemplate.cs index 3c37201..8022a19 100644 --- a/src/PlasticCommand/Generator/Templates/CommandTemplate/ValidatableCommandTemplate.cs +++ b/src/PlasticCommand/Generator/Templates/CommandTemplate/ValidatableCommandTemplate.cs @@ -13,12 +13,14 @@ namespace Templates // replace: to {{ Namespace }} using TargetCommandSpec = PlasticCommand.Generator.TTFFValidatableCommandSpec; // replace: internal to public + [GeneratedByPlasticCommand] internal interface TTFFGeneratedValidatableCommandInterface : ICommandSpecificationWithValidation { } // replace: internal to public + [GeneratedByPlasticCommand] internal class TTFFValidatableCommand : TTFFGeneratedValidatableCommandInterface { private readonly IServiceProvider _provider; diff --git a/src/PlasticCommand/Generator/Templates/CommandTemplate/ValidatableCommandTemplate.txt b/src/PlasticCommand/Generator/Templates/CommandTemplate/ValidatableCommandTemplate.txt index c311587..e64b4a4 100644 --- a/src/PlasticCommand/Generator/Templates/CommandTemplate/ValidatableCommandTemplate.txt +++ b/src/PlasticCommand/Generator/Templates/CommandTemplate/ValidatableCommandTemplate.txt @@ -12,11 +12,13 @@ namespace {{ Namespace }} using Generator = PlasticCommand.Generator; using TargetCommandSpec = PlasticCommand.Generator.TTFFValidatableCommandSpec; + [GeneratedByPlasticCommand] public interface TTFFGeneratedValidatableCommandInterface : ICommandSpecificationWithValidation { } + [GeneratedByPlasticCommand] public class TTFFValidatableCommand : TTFFGeneratedValidatableCommandInterface { private readonly IServiceProvider _provider; diff --git a/src/PlasticCommand/Generator/Templates/CommandsTemplate/CommandsTemplate.cs b/src/PlasticCommand/Generator/Templates/CommandsTemplate/CommandsTemplate.cs index decd279..47a5230 100644 --- a/src/PlasticCommand/Generator/Templates/CommandsTemplate/CommandsTemplate.cs +++ b/src/PlasticCommand/Generator/Templates/CommandsTemplate/CommandsTemplate.cs @@ -3,6 +3,7 @@ namespace PlasticCommand.Generated.Group { // replace: internal to public + [GeneratedByPlasticCommand] internal class TTFFCommands { // {{Members}} diff --git a/src/PlasticCommand/Generator/Templates/CommandsTemplate/CommandsTemplate.txt b/src/PlasticCommand/Generator/Templates/CommandsTemplate/CommandsTemplate.txt index b843502..84a0294 100644 --- a/src/PlasticCommand/Generator/Templates/CommandsTemplate/CommandsTemplate.txt +++ b/src/PlasticCommand/Generator/Templates/CommandsTemplate/CommandsTemplate.txt @@ -2,6 +2,7 @@ #nullable enable namespace PlasticCommand.Generated.Group { + [GeneratedByPlasticCommand] public class TTFFCommands { {{Members}} diff --git a/src/PlasticCommand/PlasticCommand.csproj b/src/PlasticCommand/PlasticCommand.csproj index 6347473..9b675d4 100644 --- a/src/PlasticCommand/PlasticCommand.csproj +++ b/src/PlasticCommand/PlasticCommand.csproj @@ -14,7 +14,7 @@ - 2.5.1 + 2.6.1 en-US true SangHyeon.Kim