Skip to content

Commit

Permalink
feat!: rename namespace, add OpenFeature dep (#18)
Browse files Browse the repository at this point in the history
feat!: rename namespace, add OpenFeature dependency and readmes.
  • Loading branch information
toddbaert authored Oct 16, 2022
1 parent ac07a2d commit 3ca3172
Show file tree
Hide file tree
Showing 24 changed files with 153 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"src/OpenFeature.Hooks.Otel": "0.0.2",
"src/OpenFeature.Providers.Flagd": "0.0.2"
"src/OpenFeature.Contrib.Hooks.Otel": "0.0.2",
"src/OpenFeature.Contrib.Providers.Flagd": "0.0.2"
}
63 changes: 63 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Contributing

## System Requirements

Dotnet 6+ is recommended.

## Compilation target(s)

As in the Dotnet-SDK, we target C# LangVersion 7.3. The `Common.props` configures this automatically.

## Adding a project

1. Create a new library project under `src/`: `dotnet new classlib -o src/OpenFeature.Contrib.MyComponent --langVersion 7.3`
2. Create a new test project under `test/`: `dotnet new xunit -o test/OpenFeature.Contrib.MyComponent.Test`
3. Add the library project to the solution: `dotnet sln DotnetSdkContrib.sln add src/OpenFeature.Contrib.MyComponent/OpenFeature.Contrib.MyComponent.csproj`
4. Add the test project to the solution: `dotnet sln DotnetSdkContrib.sln add test/OpenFeature.Contrib.MyComponent.Test/OpenFeature.Contrib.MyComponent.Test.csproj`
5. Add the desired properties to your library's `.csproj` file (see example below).
5. Remove all content besides the root element from your test project's `.csproj` file (all settings will be inherited).
6. Add the new library project to `release-please-config.json`.
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`.
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.

Sample `.csproj` file:

```xml
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageId>OpenFeature.MyComponent</PackageId>
<VersionNumber>0.0.1</VersionNumber> <!--x-release-please-version -->
<Version>$(VersionNumber)</Version>
<AssemblyVersion>$(VersionNumber)</AssemblyVersion>
<FileVersion>$(VersionNumber)</FileVersion>
<Description>A very valuable OpenFeature contribution!</Description>
<PackageProjectUrl>https://openfeature.dev</PackageProjectUrl>
<RepositoryUrl>https://github.com/open-feature/dotnet-sdk-contrib</RepositoryUrl>
<Authors>Me!</Authors>
</PropertyGroup>

</Project>
```

## Documentation

Any published modules must have documentation in their root directory, explaining the basic purpose of the module as well as installation and usage instructions.
Instructions for how to develop a module should also be included (required system dependencies, instructions for testing locally, etc).

## Testing

Any published modules must have reasonable test coverage.
The instructions above will generate a test project for you.

Use `dotnet test` to test the entire project.

## Versioning and releasing

As described in the [README](./README.md), this project uses release-please, and semantic versioning.
Breaking changes should be identified by using a semantic PR title.

## Dependencies

Keep dependencies to a minimum.
Dependencies used only for building and testing should have a `<PrivateAssets>all</PrivateAssets>` element to prevent them from being exposed to consumers.
8 changes: 4 additions & 4 deletions DotnetSdkContribs.sln → DotnetSdkContrib.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0E563821-BD08-4B7F-BF9D-395CAD80F026}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Providers.Flagd", "src\OpenFeature.Providers.Flagd\OpenFeature.Providers.Flagd.csproj", "{6F8FF25A-F22B-4083-B3F9-B4B9BB6FB699}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Contrib.Providers.Flagd", "src\OpenFeature.Contrib.Providers.Flagd\OpenFeature.Contrib.Providers.Flagd.csproj", "{6F8FF25A-F22B-4083-B3F9-B4B9BB6FB699}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Hooks.Otel", "src\OpenFeature.Hooks.Otel\OpenFeature.Hooks.Otel.csproj", "{82D10BAE-F1EE-432A-BD5D-DECAD07A84FE}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Contrib.Hooks.Otel", "src\OpenFeature.Contrib.Hooks.Otel\OpenFeature.Contrib.Hooks.Otel.csproj", "{82D10BAE-F1EE-432A-BD5D-DECAD07A84FE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{B6D3230B-5E4D-4FF1-868E-2F4E325C84FE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Hooks.Otel.Test", "test\OpenFeature.Hooks.Otel.Test\OpenFeature.Hooks.Otel.Test.csproj", "{199FA48A-06EF-4E15-8206-C095D1455A99}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Contrib.Hooks.Otel.Test", "test\OpenFeature.Contrib.Hooks.Otel.Test\OpenFeature.Contrib.Hooks.Otel.Test.csproj", "{199FA48A-06EF-4E15-8206-C095D1455A99}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Providers.Flagd.Test", "test\OpenFeature.Providers.Flagd.Test\OpenFeature.Providers.Flagd.Test.csproj", "{206323A0-7334-4723-8394-C31C150B95DC}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFeature.Contrib.Providers.Flagd.Test", "test\OpenFeature.Contrib.Providers.Flagd.Test\OpenFeature.Contrib.Providers.Flagd.Test.csproj", "{206323A0-7334-4723-8394-C31C150B95DC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# dotnet-sdk-contrib
OpenFeature Providers and Hooks for .NET
# OpenFeature .NET Contributions

![Experimental](https://img.shields.io/badge/experimental-breaking%20changes%20allowed-yellow)
![Alpha](https://img.shields.io/badge/alpha-release-red)

This repository is intended for OpenFeature contributions which are not included in the [OpenFeature SDK](https://github.com/open-feature/dotnet-sdk).

## Releases

This repo uses _Release Please_ to release packages. Release Please sets up a running PR that tracks all changes for the library components, and maintains the versions according to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), generated when [PRs are merged](https://github.com/amannn/action-semantic-pull-request). When Release Please's running PR is merged, any changed artifacts are published.

## Contributing

see: [CONTRIBUTING.md](./CONTRIBUTING.md)

## License

Apache 2.0 - See [LICENSE](./LICENSE) for more information.
9 changes: 7 additions & 2 deletions build/Common.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<Project>

<ItemGroup>
<PackageReference Include="OpenFeature" Version="$(OpenFeatureVer)" />
</ItemGroup>

<PropertyGroup>
<LangVersion>7.3</LangVersion>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Expand All @@ -18,7 +23,7 @@
Please sort alphabetically.
Refer to https://docs.microsoft.com/nuget/concepts/package-versioning for semver syntax.
-->
<MicrosoftExtensionsLoggerVer>[2.0,6.0)</MicrosoftExtensionsLoggerVer>
<MicrosoftSourceLinkGitHubPkgVer>[1.0.0,2.0)</MicrosoftSourceLinkGitHubPkgVer>
<OpenFeatureVer>[0.5,0.6)</OpenFeatureVer>
</PropertyGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion build/Common.tests.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup Condition="$(MSBuildProjectName.EndsWith('.Tests'))">
<Content Include="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'DotnetSdkContribs.sln'))\build\xunit.runner.json">
<Content Include="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'DotnetSdkContrib.sln'))\build\xunit.runner.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"bootstrap-sha": "fd59f2328fd5aba0b7705b2fdbf76e39afa244dd",
"packages": {
"src/OpenFeature.Hooks.Otel": {
"package-name": "OpenFeature.Hooks.Otel",
"src/OpenFeature.Contrib.Hooks.Otel": {
"package-name": "OpenFeature.Contrib.Hooks.Otel",
"release-type": "simple",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"versioning": "default",
"extra-files": [
"OpenFeature.Hooks.Otel.csproj"
"OpenFeature.Contrib.Hooks.Otel.csproj"
]
},
"src/OpenFeature.Providers.Flagd": {
"package-name": "OpenFeature.Providers.Flagd",
"src/OpenFeature.Contrib.Providers.Flagd": {
"package-name": "OpenFeature.Contrib.Providers.Flagd",
"release-type": "simple",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"versioning": "default",
"extra-files": [
"OpenFeature.Providers.Flagd.csproj"
"OpenFeature.Contrib.Providers.Flagd.csproj"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'DotnetSdkContribs.sln'))\build\Common.prod.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'DotnetSdkContrib.sln'))\build\Common.prod.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace OpenFeature.Hooks.Otel
namespace OpenFeature.Contrib.Hooks.Otel
{
/// <summary>
/// Stub.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageId>OpenFeature.Contrib.Hooks.Otel</PackageId>
<VersionNumber>0.0.2</VersionNumber> <!--x-release-please-version -->
<Version>$(VersionNumber)</Version>
<AssemblyVersion>$(VersionNumber)</AssemblyVersion>
Expand Down
3 changes: 3 additions & 0 deletions src/OpenFeature.Contrib.Hooks.Otel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# OpenFeature OpenTelemetry hook for .NET

Coming soon!
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageId>OpenFeature.Contrib.Providers.Flagd</PackageId>
<VersionNumber>0.0.2</VersionNumber> <!--x-release-please-version -->
<Version>$(VersionNumber)</Version>
<AssemblyVersion>$(VersionNumber)</AssemblyVersion>
Expand Down
3 changes: 3 additions & 0 deletions src/OpenFeature.Contrib.Providers.Flagd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# OpenFeature flagd Provider for .NET

Coming soon!
18 changes: 18 additions & 0 deletions src/OpenFeature.Contrib.Providers.Flagd/Stub.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace OpenFeature.Contrib.Providers.Flagd
{
/// <summary>
/// A stub class.
/// </summary>
public class Stub
{
/// <summary>
/// Get the provider name.
/// </summary>
public static string GetProviderName()
{
return Api.Instance.GetProviderMetadata().Name;
}
}
}


File renamed without changes.
12 changes: 0 additions & 12 deletions src/OpenFeature.Providers.Flagd/Class1.cs

This file was deleted.

2 changes: 1 addition & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<Project>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'DotnetSdkContribs.sln'))\build\Common.tests.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'DotnetSdkContrib.sln'))\build\Common.tests.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xunit;

namespace OpenFeature.Hooks.Otel.Test
namespace OpenFeature.Contrib.Hooks.Otel.Test
{
public class UnitTest1
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\OpenFeature.Contrib.Providers.Flagd\OpenFeature.Contrib.Providers.Flagd.csproj" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions test/OpenFeature.Contrib.Providers.Flagd.Test/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

using Xunit;
using OpenFeature.Contrib.Providers.Flagd;

namespace OpenFeature.Contrib.Providers.Flagd.Test
{
public class UnitTest1
{
[Fact]
public void TestMethod1()
{
Assert.Equal("No-op Provider", Stub.GetProviderName());
}
}
}

This file was deleted.

13 changes: 0 additions & 13 deletions test/OpenFeature.Providers.Flagd.Test/UnitTest1.cs

This file was deleted.

0 comments on commit 3ca3172

Please sign in to comment.