Skip to content

Commit

Permalink
Add NuGet readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrzesniewski committed Jan 12, 2024
1 parent 756da27 commit fdee52d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
[![Build](https://github.com/Abc-Arbitrage/Zebus.MessageDsl/workflows/Build/badge.svg)](https://github.com/Abc-Arbitrage/Zebus.MessageDsl/actions?query=workflow%3ABuild)
[![Zebus.MessageDsl NuGet](https://img.shields.io/nuget/v/Zebus.MessageDsl.svg?label=Zebus.MessageDsl&logo=NuGet)](https://www.nuget.org/packages/Zebus.MessageDsl)
[![Zebus.MessageDsl.Build NuGet](https://img.shields.io/nuget/v/Zebus.MessageDsl.Build.svg?label=Zebus.MessageDsl.Build&logo=NuGet)](https://www.nuget.org/packages/Zebus.MessageDsl.Build)
[![Zebus.MessageDsl.Generator NuGet](https://img.shields.io/nuget/v/Zebus.MessageDsl.Generator.svg?label=Zebus.MessageDsl.Generator&logo=NuGet)](https://www.nuget.org/packages/Zebus.MessageDsl.Generator)

This is a DSL which simplifies the writing of ProtoBuf contracts for [Zebus](https://github.com/Abc-Arbitrage/Zebus).

## NuGet packages

- [`Zebus.MessageDsl`](https://www.nuget.org/packages/Zebus.MessageDsl) provides the DSL parser, C# and proto generators
- [`Zebus.MessageDsl.Build`](https://www.nuget.org/packages/Zebus.MessageDsl.Build) provides a code generator which will translate `.msg` files in your project
- [`Zebus.MessageDsl.Build`](https://www.nuget.org/packages/Zebus.MessageDsl.Build) provides a MSBuild code generator which will translate `.msg` files in your project
- [`Zebus.MessageDsl.Generator`](https://www.nuget.org/packages/Zebus.MessageDsl.Generator) provides a Roslyn source generator which will translate `.msg` files in your project

## Documentation

Expand All @@ -28,8 +30,6 @@ Generated code:

```C#
[ProtoContract]
[System.Diagnostics.DebuggerNonUserCode]
[System.CodeDom.Compiler.GeneratedCode("Abc.Zebus.MessageDsl.Build", "0.3.0.0")]
public sealed partial class SomeMessage : IEvent
{
[ProtoMember(1, IsRequired = true)]
Expand Down
1 change: 1 addition & 0 deletions src/Abc.Zebus.MessageDsl.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{A8144077-4
..\docs\Syntax.md = ..\docs\Syntax.md
..\docs\BuildTimeCodeGen.md = ..\docs\BuildTimeCodeGen.md
..\README.md = ..\README.md
NuGetReadme.md = NuGetReadme.md
EndProjectSection
EndProject
Global
Expand Down
5 changes: 5 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<Copyright>Copyright © ABC arbitrage $([System.DateTime]::Now.ToString('yyyy'))</Copyright>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageOutputPath>$(MSBuildThisFileDirectory)..\output</PackageOutputPath>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<PropertyGroup Condition="'$(NCrunch)' == '1'">
Expand All @@ -39,4 +40,8 @@
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)NuGetReadme.md" Pack="true" PackagePath="/README.md" Visible="false" />
</ItemGroup>

</Project>
38 changes: 38 additions & 0 deletions src/NuGetReadme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Zebus Message DSL

This is a DSL which simplifies the writing of ProtoBuf contracts for [Zebus](https://github.com/Abc-Arbitrage/Zebus).

See the [GitHub repository](https://github.com/Abc-Arbitrage/Zebus.MessageDsl) for more information.

## Example

Input file:

```C#
SomeMessage(int foo, string[] bar)
```

Generated code:

```C#
[ProtoContract]
public sealed partial class SomeMessage : IEvent
{
[ProtoMember(1, IsRequired = true)]
public int Foo { get; private set; }

[ProtoMember(2, IsRequired = false)]
public string[] Bar { get; private set; }

private SomeMessage()
{
Bar = Array.Empty<string>();
}

public SomeMessage(int foo, string[] bar)
{
Foo = foo;
Bar = bar;
}
}
```

0 comments on commit fdee52d

Please sign in to comment.