Starcounter / Starcounter.ErrorCodes

Errorcodes for all Starcounter versions.
0 stars 0 forks source link

Starcounter.ErrorCodes

Shared project for all Starcounter versions (including BlueStar and unmanaged projects). Contains a set of errorcodes and utilites for creating adorned exceptions, as well as some other helpers around errorcodes.

Includes assemblies for C# and header and source files for c/c++.

Starcounter.ErrorCodes contains of 3 primary parts:

Add new errorcodes

Bugfix (or other change)

Versioning

The projects

Starcounter.ErrorCodes

The main library for errorcodes. Will, as part of building, call the generator to generate sourcecode files for both .Net (C#) and native parts. Also as part of versioning, the number of errorcodes is outputted to be used as patchnumber.

The generated code with c# will be included as a part of the compilation of this project, while the other files are only needed when a nuget package is created.

Build

To build locally call dotnet build from the same folder as where the project file is (Starcounter.ErrorCodes.csproj)

cd src\Starcounter.ErrorCodes
dotnet restore
dotnet build

The generated files can be found under the obj\Generated folder.

Pack

The builtin functionality in dotnet is used to create nuget package.

cd src\Starcounter.ErrorCodes
dotnet restore
dotnet pack

The created package will end up in \artifacts in the root.

Generate

Project that, when built, builds the generator (see below) and produce all files that are in turn consumed by Starcounter.ErrorCodes when that project is built.

Starcounter.ErrorCodes contains a project reference to this project, so whenever you build the former, generate will run.

Starcounter.ErrorCodes.Generator

A runnable program used to generate sourcecode based on the entries in errorcodes.xml.

To see a list of available options simply execute dotnet run in the same folder as the project (src\Starcounter.ErrorCodes.Generator)

cd src\Starcounter.ErrorCodes.Generator
dotnet run
Usage:  [arguments] [options]

Arguments:
  sourcefile  Path to the xml-sourcefile to read errorcodes from.

Options:
  -cs | --csharp <csharpfile>      Path to write generated C# code to.
  -c | --c <cfile>                 Path to write generated C code to.
  -header | --header <headerfile>  Path to write generated header to.
  -v | --verbose                   Verbose mode.
  -cnt | --count <file>            Path to write the number of errorcodes to.
  -? | -h | --help                 Show help information