|
| 1 | +# Contributing |
| 2 | + |
| 3 | +## System Requirements |
| 4 | + |
| 5 | +Dotnet 6+ is recommended. |
| 6 | + |
| 7 | +## Compilation target(s) |
| 8 | + |
| 9 | +As in the Dotnet-SDK, we target C# LangVersion 7.3. The `Common.props` configures this automatically. |
| 10 | + |
| 11 | +## Adding a project |
| 12 | + |
| 13 | +1. Create a new library project under `src/`: `dotnet new classlib -o src/OpenFeature.Contrib.MyComponent --langVersion 7.3` |
| 14 | +2. Create a new test project under `test/`: `dotnet new xunit -o test/OpenFeature.Contrib.MyComponent.Test` |
| 15 | +3. Add the library project to the solution: `dotnet sln DotnetSdkContrib.sln add src/OpenFeature.Contrib.MyComponent/OpenFeature.Contrib.MyComponent.csproj` |
| 16 | +4. Add the test project to the solution: `dotnet sln DotnetSdkContrib.sln add test/OpenFeature.Contrib.MyComponent.Test/OpenFeature.Contrib.MyComponent.Test.csproj` |
| 17 | +5. Add the desired properties to your library's `.csproj` file (see example below). |
| 18 | +5. Remove all content besides the root element from your test project's `.csproj` file (all settings will be inherited). |
| 19 | +6. Add the new library project to `release-please-config.json`. |
| 20 | +7. Add a `version.txt` file to the root of your library with a version matching that in your new `.csproj` file, e.g. `0.0.1`. |
| 21 | +8. If you care to release a pre `1.0.0` version, add the same version above to `.release-please-manifest.json`. Failing to do this will release a `1.0.0` initial release. |
| 22 | + |
| 23 | +Sample `.csproj` file: |
| 24 | + |
| 25 | +```xml |
| 26 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 27 | + |
| 28 | + <PropertyGroup> |
| 29 | + <PackageId>OpenFeature.MyComponent</PackageId> |
| 30 | + <VersionNumber>0.0.1</VersionNumber> <!--x-release-please-version --> |
| 31 | + <Version>$(VersionNumber)</Version> |
| 32 | + <AssemblyVersion>$(VersionNumber)</AssemblyVersion> |
| 33 | + <FileVersion>$(VersionNumber)</FileVersion> |
| 34 | + <Description>A very valuable OpenFeature contribution!</Description> |
| 35 | + <PackageProjectUrl>https://openfeature.dev</PackageProjectUrl> |
| 36 | + <RepositoryUrl>https://github.com/open-feature/dotnet-sdk-contrib</RepositoryUrl> |
| 37 | + <Authors>Me!</Authors> |
| 38 | + </PropertyGroup> |
| 39 | + |
| 40 | +</Project> |
| 41 | +``` |
| 42 | + |
| 43 | +## Documentation |
| 44 | + |
| 45 | +Any published modules must have documentation in their root directory, explaining the basic purpose of the module as well as installation and usage instructions. |
| 46 | +Instructions for how to develop a module should also be included (required system dependencies, instructions for testing locally, etc). |
| 47 | + |
| 48 | +## Testing |
| 49 | + |
| 50 | +Any published modules must have reasonable test coverage. |
| 51 | +The instructions above will generate a test project for you. |
| 52 | + |
| 53 | +Use `dotnet test` to test the entire project. |
| 54 | + |
| 55 | +## Versioning and releasing |
| 56 | + |
| 57 | +As described in the [README](./README.md), this project uses release-please, and semantic versioning. |
| 58 | +Breaking changes should be identified by using a semantic PR title. |
| 59 | + |
| 60 | +## Dependencies |
| 61 | + |
| 62 | +Keep dependencies to a minimum. |
| 63 | +Dependencies used only for building and testing should have a `<PrivateAssets>all</PrivateAssets>` element to prevent them from being exposed to consumers. |
0 commit comments