diff --git a/.gitignore b/.gitignore
index 752be25..2d62239 100644
--- a/.gitignore
+++ b/.gitignore
@@ -339,3 +339,4 @@ ASALocalRun/
# Coverage results folder
coverage/
+*.snupkg
diff --git a/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj b/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj
index e752fdf..8efbafc 100644
--- a/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj
+++ b/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj
@@ -3,14 +3,19 @@
netstandard2.0;netcoreapp2.1
Debug;Release
+ true
+ true
+ true
+ true
+ snupkg
+
-
diff --git a/CapnpC.CSharp.Generator/CodeGen/GeneratorOptions.cs b/CapnpC.CSharp.Generator/CodeGen/GeneratorOptions.cs
index 133cfa4..dc48beb 100644
--- a/CapnpC.CSharp.Generator/CodeGen/GeneratorOptions.cs
+++ b/CapnpC.CSharp.Generator/CodeGen/GeneratorOptions.cs
@@ -1,42 +1,189 @@
namespace CapnpC.CSharp.Generator.CodeGen
{
+ ///
+ /// Provides options properties defining how the generated code will look like.
+ ///
public class GeneratorOptions
{
+ ///
+ /// Default namespace if .capnp file does not specify any.
+ ///
public string TopNamespaceName { get; set; } = "CapnpGen";
+
+ ///
+ /// Type name of generated struct reader
+ ///
public string ReaderStructName { get; set; } = "READER";
+
+ ///
+ /// Type name of generated struct writer
+ ///
public string WriterStructName { get; set; } = "WRITER";
+
+ ///
+ /// Parameter name when struct reader is passed as argument
+ ///
public string ReaderParameterName { get; set; } = "reader";
+
+ ///
+ /// Parameter name when struct writer is passed as argument
+ ///
public string WriterParameterName { get; set; } = "writer";
+
+ ///
+ /// Struct reader creation method name
+ ///
public string ReaderCreateMethodName { get; set; } = "create";
+
+ ///
+ /// Name of struct reader's underlying DeserializerState field
+ ///
public string ReaderContextFieldName { get; set; } = "ctx";
+
+ ///
+ /// Name of struct writer's underlying SerializerState field
+ ///
public string ContextParameterName { get; set; } = "ctx";
+
+ ///
+ /// Name of group reader's underlying DeserializerState field
+ ///
public string GroupReaderContextArgName { get; set; } = "ctx";
+
+ ///
+ /// Name of union discriminator enum
+ ///
public string UnionDiscriminatorEnumName { get; set; } = "WHICH";
+
+ ///
+ /// Name of union discriminator property
+ ///
public string UnionDiscriminatorPropName { get; set; } = "which";
+
+ ///
+ /// Name of private union dicriminator field
+ ///
public string UnionDiscriminatorFieldName { get; set; } = "_which";
+
+ ///
+ /// Literal name for undetermined union discriminators
+ ///
public string UnionDiscriminatorUndefinedName { get; set; } = "undefined";
+
+ ///
+ /// Name of union content field
+ ///
public string UnionContentFieldName { get; set; } = "_content";
+
+ ///
+ /// Domain class method name for serializing its contents to the writer class
+ ///
public string SerializeMethodName { get; set; } = "serialize";
+
+ ///
+ /// Domain class method name for applying default values
+ ///
public string ApplyDefaultsMethodName { get; set; } = "applyDefaults";
+
+ ///
+ /// Default input-arguments parameter name for interface methods
+ ///
public string AnonymousParameterName { get; set; } = "arg_";
+
+ ///
+ /// Parameter name for passing a CancellationToken to interface methods
+ ///
public string CancellationTokenParameterName { get; set; } = "cancellationToken_";
+
+ ///
+ /// Local name for usage in generated proxy/skeleton code.
+ ///
public string ParamsLocalName { get; set; } = "in_";
+
+ ///
+ /// Local name for usage in generated proxy/skeleton code.
+ ///
public string DeserializerLocalName { get; set; } = "d_";
+
+ ///
+ /// Local name for usage in generated proxy/skeleton code.
+ ///
public string SerializerLocalName { get; set; } = "s_";
+
+ ///
+ /// Local name for usage in generated proxy/skeleton code.
+ ///
public string ResultLocalName { get; set; } = "r_";
+
+ ///
+ /// Pattern for generating method input struct name
+ ///
public string ParamsStructFormat { get; set; } = "Params_{0}";
+
+ ///
+ /// Pattern for generating method output struct name
+ ///
public string ResultStructFormat { get; set; } = "Result_{0}";
+
+ ///
+ /// Renaming pattern when a generated property would happen to have the same name like its surrounding type
+ /// (which is illegal in C#)
+ ///
public string PropertyNamedLikeTypeRenameFormat { get; set; } = "The{0}";
+
+ ///
+ /// Pattern for generating generic type parameter names
+ ///
public string GenericTypeParameterFormat { get; set; } = "T{0}";
+
+ ///
+ /// Pattern for generating pipelining-related support classes
+ ///
public string PipeliningExtensionsClassFormat { get; set; } = "PipeliningSupportExtensions_{0}";
+
+ ///
+ /// Pattern for generating proxy class name
+ ///
public string ProxyClassFormat { get; set; } = "{0}_Proxy";
+
+ ///
+ /// Pattern for generating skeleton class name
+ ///
public string SkeletonClassFormat { get; set; } = "{0}_Skeleton";
+
+ ///
+ /// Pattern for generating member access path objects used in pipelining-related support classes
+ ///
public string MemberAccessPathNameFormat { get; set; } = "Path_{0}_{1}_{2}_{3}";
+
+ ///
+ /// Parameter name for passing a Task
+ ///
public string TaskParameterName { get; set; } = "task";
+
+ ///
+ /// Field name for type ID
+ ///
public string TypeIdFieldName { get; set; } = "typeId";
+
+ ///
+ /// Local method name used in generated code.
+ ///
public string AwaitProxyName { get; set; } = "AwaitProxy";
+
+ ///
+ /// Whether to generate nullable reference types if not explicitly specified
+ ///
public bool NullableEnableDefault { get; set; } = false;
+
+ ///
+ /// Generator tool name for GeneratedCodeAttribute
+ ///
public string GeneratorToolName { get; set; } = "capnpc-csharp";
+
+ ///
+ /// Generator tool version for GeneratedCodeAttribute
+ ///
public string GeneratorToolVersion = ThisAssembly.AssemblyVersion;
}
}
diff --git a/CapnpC.CSharp.Generator/Model/IdentifierRenamer.cs b/CapnpC.CSharp.Generator/Model/IdentifierRenamer.cs
index 0c0a6b5..a34ad61 100644
--- a/CapnpC.CSharp.Generator/Model/IdentifierRenamer.cs
+++ b/CapnpC.CSharp.Generator/Model/IdentifierRenamer.cs
@@ -5,7 +5,7 @@ using System.Text;
namespace CapnpC.CSharp.Generator.Model
{
- public class IdentifierRenamer
+ class IdentifierRenamer
{
public static bool IsAnyKeyword(string str)
{
diff --git a/CapnpC.CSharp.Generator/Model/SchemaModel.cs b/CapnpC.CSharp.Generator/Model/SchemaModel.cs
index 3262f8f..9170aba 100644
--- a/CapnpC.CSharp.Generator/Model/SchemaModel.cs
+++ b/CapnpC.CSharp.Generator/Model/SchemaModel.cs
@@ -741,7 +741,7 @@ namespace CapnpC.CSharp.Generator.Model
}
}
- public enum NodeKind
+ enum NodeKind
{
Unknown,
Annotation,
@@ -753,7 +753,7 @@ namespace CapnpC.CSharp.Generator.Model
Group
}
- public static class SchemaExtensions
+ static class SchemaExtensions
{
public static string StrId(this Schema.Node.READER node)
=> $"0x{node.Id:X}";
diff --git a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj
index 92c5f3c..605d405 100644
--- a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj
+++ b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj
@@ -7,7 +7,6 @@
true
true
- true
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
$(MSBuildThisFileDirectory)CapnpC.CSharp.MsBuild.Generation.nuspec
@@ -42,6 +41,7 @@
+
diff --git a/capnpc-csharp/capnpc-csharp.csproj b/capnpc-csharp/capnpc-csharp.csproj
index 090c3d4..7e28879 100644
--- a/capnpc-csharp/capnpc-csharp.csproj
+++ b/capnpc-csharp/capnpc-csharp.csproj
@@ -17,11 +17,16 @@
Git
capnp capnpc RPC serialization cerealization
Debug;Release
+ true
+ true
+ true
+ snupkg
+