-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement generator * Add initial tests
- Loading branch information
1 parent
b2c844c
commit d9887aa
Showing
65 changed files
with
2,167 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<LangVersion>latest</LangVersion> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<PropertyGroup> | ||
<LangVersion>latest</LangVersion> | ||
|
||
<Nullable>enable</Nullable> | ||
<WarningsAsErrors>$(WarningsAsErrors);nullable;</WarningsAsErrors> | ||
<Nullable>enable</Nullable> | ||
<WarningsAsErrors>$(WarningsAsErrors);nullable;</WarningsAsErrors> | ||
|
||
<ImplicitUsings>enable</ImplicitUsings> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
|
||
<AnalysisLevel>latest-all</AnalysisLevel> | ||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> | ||
<AnalysisLevel>latest-all</AnalysisLevel> | ||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> | ||
|
||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="PolySharp" PrivateAssets="All" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="PolySharp" PrivateAssets="All" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'"> | ||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> | ||
<EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
<CollectCoverage>true</CollectCoverage> | ||
<CoverletOutputFormat>opencover</CoverletOutputFormat> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'"> | ||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> | ||
<EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
<CollectCoverage>true</CollectCoverage> | ||
<CoverletOutputFormat>opencover</CoverletOutputFormat> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.4.5" /> | ||
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" /> | ||
<PackageVersion Include="coverlet.collector" Version="6.0.0" /> | ||
<PackageVersion Include="coverlet.msbuild" Version="6.0.0" /> | ||
<PackageVersion Include="GitHubActionsTestLogger" Version="2.3.3" /> | ||
<PackageVersion Include="Immediate.Handlers" Version="1.1.0" /> | ||
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.5.0" /> | ||
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" /> | ||
<PackageVersion Include="coverlet.collector" Version="6.0.2" /> | ||
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" /> | ||
<PackageVersion Include="GitHubActionsTestLogger" Version="2.3.3" /> | ||
<PackageVersion Include="Immediate.Handlers" Version="1.1.0" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.Authorization" Version="8.0.0" /> | ||
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.3" /> | ||
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.1" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" /> | ||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> | ||
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" /> | ||
<PackageVersion Include="MinVer" Version="4.3.0" /> | ||
<PackageVersion Include="PolySharp" Version="1.14.1" /> | ||
<PackageVersion Include="Scriban" Version="5.9.1" /> | ||
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.4.0" /> | ||
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.1.1" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.8.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" /> | ||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" /> | ||
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" /> | ||
<PackageVersion Include="MinVer" Version="5.0.0" /> | ||
<PackageVersion Include="PolySharp" Version="1.14.1" /> | ||
<PackageVersion Include="Scriban" Version="5.9.1" /> | ||
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" /> | ||
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" /> | ||
<PackageVersion Include="Verify.SourceGenerators" Version="2.2.0" /> | ||
<PackageVersion Include="Verify.Xunit" Version="23.1.0" /> | ||
<PackageVersion Include="xunit" Version="2.6.6" /> | ||
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" /> | ||
<PackageVersion Include="Verify.SourceGenerators" Version="2.2.0" /> | ||
<PackageVersion Include="Verify.Xunit" Version="23.5.2" /> | ||
<PackageVersion Include="xunit" Version="2.7.0" /> | ||
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System.Collections; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Immediate.Apis.Generators; | ||
|
||
[ExcludeFromCodeCoverage] | ||
public static class EquatableReadOnlyList | ||
{ | ||
public static EquatableReadOnlyList<T> ToEquatableReadOnlyList<T>(this IEnumerable<T> enumerable) | ||
=> new(enumerable.ToArray()); | ||
} | ||
|
||
/// <summary> | ||
/// A wrapper for IReadOnlyList that provides value equality support for the wrapped list. | ||
/// </summary> | ||
[ExcludeFromCodeCoverage] | ||
public readonly struct EquatableReadOnlyList<T>( | ||
IReadOnlyList<T>? collection | ||
) : IEquatable<EquatableReadOnlyList<T>>, IReadOnlyList<T> | ||
{ | ||
private IReadOnlyList<T> Collection => collection ?? []; | ||
|
||
public bool Equals(EquatableReadOnlyList<T> other) | ||
=> this.SequenceEqual(other); | ||
|
||
public override bool Equals(object? obj) | ||
=> obj is EquatableReadOnlyList<T> other && Equals(other); | ||
|
||
public override int GetHashCode() | ||
{ | ||
var hashCode = new HashCode(); | ||
|
||
foreach (var item in Collection) | ||
hashCode.Add(item); | ||
|
||
return hashCode.ToHashCode(); | ||
} | ||
|
||
IEnumerator<T> IEnumerable<T>.GetEnumerator() | ||
=> Collection.GetEnumerator(); | ||
|
||
IEnumerator IEnumerable.GetEnumerator() | ||
=> Collection.GetEnumerator(); | ||
|
||
public int Count => Collection.Count; | ||
public T this[int index] => Collection[index]; | ||
|
||
public static bool operator ==(EquatableReadOnlyList<T> left, EquatableReadOnlyList<T> right) | ||
=> left.Equals(right); | ||
|
||
public static bool operator !=(EquatableReadOnlyList<T> left, EquatableReadOnlyList<T> right) | ||
=> !left.Equals(right); | ||
} |
43 changes: 43 additions & 0 deletions
43
src/Immediate.Apis.Generators/Immediate.Apis.Generators.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> | ||
<IsRoslynComponent>true</IsRoslynComponent> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="Templates\*.sbntxt" /> | ||
<EmbeddedResource Include="Templates\*.sbntxt" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Bcl.HashCode" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" /> | ||
<PackageReference Include="Scriban" PrivateAssets="all" GeneratePathProperty="true" /> | ||
<PackageReference Include="MinVer" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="../Immediate.Apis.Shared/Immediate.Apis.Shared.csproj" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<GetTargetPathDependsOn>$(GetTargetPathDependsOn);GetDependencyTargetPaths</GetTargetPathDependsOn> | ||
</PropertyGroup> | ||
|
||
<Target Name="GetDependencyTargetPaths"> | ||
<ItemGroup> | ||
<TargetPathWithTargetPlatformMoniker Include="$(PkgScriban)/lib/netstandard2.0/Scriban.dll" IncludeRuntimeDependency="false" /> | ||
<TargetPathWithTargetPlatformMoniker Include="$(MSBuildThisFileDirectory)bin/$(Configuration)/$(TargetFramework)/Immediate.Apis.Shared.dll" IncludeRuntimeDependency="false" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<PropertyGroup Label="MinVer"> | ||
<MinVerAutoIncrement>minor</MinVerAutoIncrement> | ||
<MinVerDefaultPreReleaseIdentifiers>preview.0</MinVerDefaultPreReleaseIdentifiers> | ||
<MinVerTagPrefix>v</MinVerTagPrefix> | ||
</PropertyGroup> | ||
|
||
</Project> |
Oops, something went wrong.