File tree Expand file tree Collapse file tree
Source/Porticle.Grpc.GuidMapper Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,8 +13,24 @@ public MethodVisitor(HashSet<PropertyToField> replaceProps)
1313
1414 public HashSet < PropertyToField > ReplaceProps { get ; }
1515
16+ private static string [ ] ReplaceMethods =
17+ [
18+ "Equals" ,
19+ "GetHashCode" ,
20+ "WriteTo" ,
21+ "InternalWriteTo" ,
22+ "CalculateSize" ,
23+ "MergeFrom" ,
24+ "InternalMergeFrom"
25+ ] ;
26+
1627 public override SyntaxNode ? VisitMethodDeclaration ( MethodDeclarationSyntax node )
1728 {
29+ if ( ! ReplaceMethods . Contains ( node . Identifier . ValueText . Trim ( ) ) )
30+ {
31+ return base . VisitMethodDeclaration ( node ) ;
32+ }
33+
1834 var propertyToFieldRewriter = new PropertyToFieldRewriter ( ReplaceProps ) ;
1935
2036 var newBody = ( BlockSyntax ? ) propertyToFieldRewriter . Visit ( node . Body ) ;
Original file line number Diff line number Diff line change 22
33 <PropertyGroup >
44 <OutputType >Exe</OutputType >
5- <TargetFramework >net9.0</TargetFramework >
65 <ImplicitUsings >enable</ImplicitUsings >
76 <Nullable >enable</Nullable >
87 <GeneratePackageOnBuild >true</GeneratePackageOnBuild >
1817 <PackageReleaseNotes >First test version</PackageReleaseNotes >
1918 <IncludeBuildOutput >false</IncludeBuildOutput >
2019 <DevelopmentDependency >true</DevelopmentDependency >
21- <Version >1.0.3 </Version >
20+ <Version >1.0.11 </Version >
2221 <SuppressDependenciesWhenPacking >true</SuppressDependenciesWhenPacking >
22+ <TargetFrameworks >net9.0;net8.0</TargetFrameworks >
2323 </PropertyGroup >
2424
2525 <ItemGroup >
Original file line number Diff line number Diff line change 11<Project >
22 <Target Name =" RunProtoPostProcessing" AfterTargets =" Protobuf_Compile" >
33 <ItemGroup >
4- <_FilesToPostProcess Include =" %(Protobuf_Compile.CSharpFullPath )" />
4+ <_FilesToPostProcess Include =" $(MSBuildProjectDirectory)\ %(Protobuf_Compile.OutputDir)\%(Protobuf_Compile.Filename )" />
55 </ItemGroup >
6-
7- <Exec Command =" dotnet " $(MSBuildThisFileDirectory)..\..\ tools\$(TargetFramework)\Porticle.Grpc.GuidMapper.dll" -- %(_FilesToPostProcess.Identity)" Condition =" '@(_FilesToPostProcess)' != ''" />
6+ < Message Text = " Proto Postprocessing " Importance = " high " />
7+ <Exec Command =" dotnet " $(MSBuildThisFileDirectory)..\tools\$(TargetFramework)\Porticle.Grpc.GuidMapper.dll" -- %(_FilesToPostProcess.Identity)" Condition =" '@(_FilesToPostProcess)' != ''" />
88 </Target >
99</Project >
Original file line number Diff line number Diff line change 11using Microsoft . CodeAnalysis . CSharp ;
22using Porticle . Grpc . GuidMapper ;
33
4+ // filter out "--" arg
5+ args = args . Where ( s => s != "--" ) . ToArray ( ) ;
6+
47// Akzeptiert den Dateipfad als Argument
58if ( args . Length != 1 )
69{
7- Console . WriteLine ( "Error: Extected exactly 1 arg but got " + args . Length ) ;
10+ Console . WriteLine ( "Error: Expected exactly 1 arg but got " + args . Length ) ;
11+ foreach ( var arg in args )
12+ {
13+ Console . WriteLine ( "Error: arg[..] '" + arg + "'" ) ;
14+ }
815 return ;
916}
1017
You can’t perform that action at this time.
0 commit comments