Add PackageReadme + Package release notes

This commit is contained in:
Stef Heyenrath
2021-08-08 18:52:55 +02:00
parent d23aacde07
commit df4740ccd4
9 changed files with 101 additions and 12 deletions
+7
View File
@@ -0,0 +1,7 @@
rem https://github.com/StefH/GitHubReleaseNotes
SET version=0.0.10
GitHubReleaseNotes --output "ReleaseNotes.md" --skip-empty-releases --exclude-labels question invalid doc --version %version%
GitHubReleaseNotes --output PackageReleaseNotes.txt --skip-empty-releases --exclude-labels question invalid doc --template PackageReleaseNotes.template --version %version%
-3
View File
@@ -1,3 +0,0 @@
https://github.com/StefH/GitHubReleaseNotes
GitHubReleaseNotes --output ReleaseNotes.md --skip-empty-releases --exclude-labels question invalid doc --version 0.0.10
+68
View File
@@ -0,0 +1,68 @@
# Usage
**Given: an external existing class which does not implement an interface**
``` c#
public sealed class Person
{
public string Name { get; set; }
public string HelloWorld(string name)
{
return $"Hello {name} !";
}
}
```
**Create a partial interface**
And annotate this with `ProxyInterfaceGenerator.Proxy[...]` and with the Type which needs to be wrapped:
``` c#
[ProxyInterfaceGenerator.Proxy(typeof(ProxyInterfaceConsumer.Person))]
public partial interface IPerson
{
}
```
When the code is compiled, this source generator creates the following two items:
**1. An additional partial interface**
Which defines the same properties and methods as in the external class.
``` c#
public partial interface IPerson
{
string Name { get; set; }
string HelloWorld(string name);
}
```
**2. A Proxy class**
Which takes the external class in the constructor and wraps all properties and methods.
``` c#
public class PersonProxy : IPerson
{
public Person _Instance { get; }
public PersonProxy(Person instance)
{
_Instance = instance;
}
public string Name { get => _Instance.Name; set => _Instance.Name = value; }
public string HelloWorld(string name)
{
string name_ = name;
var result_19479959 = _Instance.HelloWorld(name_);
return result_19479959;
}
}
```
## Use it
``` c#
IPerson p = new PersonProxy(new Person());
p.Name = "test";
p.HelloWorld("stef");
```
+6
View File
@@ -0,0 +1,6 @@
# {{releaseInfos.0.FriendlyName}} ({{formatDate releaseInfos.0.When "dd MMMM yyyy"}})
{{#each releaseInfos.0.issueInfos}}
- #{{Number}} {{Title}}{{#if Labels}} [{{join Labels ", "}}]{{/if}}
{{/each}}
The full release notes can be found here: https://github.com/StefH/ProxyInterfaceSourceGenerator/blob/main/ReleaseNotes.md
+5
View File
@@ -0,0 +1,5 @@
# 0.0.10 (06 August 2021)
- #25 Fix support for Nullable (language version 8) [bug]
- #14 for projects where #nullable is disabled emitting nullable reftype without preprocessor '#nullable enable' would result in compile time error. [bug]
The full release notes can be found here: https://github.com/StefH/ProxyInterfaceSourceGenerator/blob/main/ReleaseNotes.md
+4 -1
View File
@@ -8,7 +8,10 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2CE637DC-E8F5-4603-8B57-E51A32F631F1}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2CE637DC-E8F5-4603-8B57-E51A32F631F1}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig .editorconfig = .editorconfig
GitHubReleaseNotes.txt = GitHubReleaseNotes.txt Generate-ReleaseNotes.bat = Generate-ReleaseNotes.bat
PackageReadme.md = PackageReadme.md
PackageReleaseNotes.template = PackageReleaseNotes.template
PackageReleaseNotes.txt = PackageReleaseNotes.txt
README.md = README.md README.md = README.md
ReleaseNotes.md = ReleaseNotes.md ReleaseNotes.md = ReleaseNotes.md
EndProjectSection EndProjectSection
+1 -1
View File
@@ -11,7 +11,7 @@ namespace ProxyInterfaceSourceGenerator
// public List<ContextData> GeneratedData { get; } = new List<ContextData>(); // public List<ContextData> GeneratedData { get; } = new List<ContextData>();
public IDictionary<InterfaceDeclarationSyntax, ProxyData> CandidateInterfaces { get; init; } public IDictionary<InterfaceDeclarationSyntax, ProxyData> CandidateInterfaces { get; init; } = default!;
public Dictionary<string, string> ReplacedTypes { get; } = new Dictionary<string, string>(); public Dictionary<string, string> ReplacedTypes { get; } = new Dictionary<string, string>();
} }
@@ -8,6 +8,6 @@ namespace ProxyInterfaceSourceGenerator
public string? ClassName { get; init; } public string? ClassName { get; init; }
public FileData FileData { get; init; } public FileData FileData { get; init; } = default!;
} }
} }
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Version>0.0.10</Version> <Version>0.0.10-preview-01</Version>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<ProjectGuid>{12344228-91F4-4502-9595-39584E5ABB34}</ProjectGuid>
<LangVersion>9</LangVersion> <LangVersion>9</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Authors>Stef Heyenrath</Authors> <Authors>Stef Heyenrath</Authors>
@@ -13,13 +14,11 @@
<PackageTags>class;interface;proxy;SourceGenerator;Analyzer;Generation;Generate;wrap</PackageTags> <PackageTags>class;interface;proxy;SourceGenerator;Analyzer;Generation;Generate;wrap</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReleaseNotes>See ReleaseNotes.md</PackageReleaseNotes> <PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/../../PackageReleaseNotes.txt"))</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/StefH/ProxyInterfaceGenerator</PackageProjectUrl> <PackageProjectUrl>https://github.com/StefH/ProxyInterfaceGenerator</PackageProjectUrl>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/StefH/ProxyInterfaceGenerator</RepositoryUrl> <RepositoryUrl>https://github.com/StefH/ProxyInterfaceGenerator</RepositoryUrl>
<PackageReadmeFile>PackageReadme.md</PackageReadmeFile>
<TargetFramework>netstandard2.0</TargetFramework>
<ProjectGuid>{12344228-91F4-4502-9595-39584E5ABB34}</ProjectGuid>
<IncludeBuildOutput>false</IncludeBuildOutput> <IncludeBuildOutput>false</IncludeBuildOutput>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
@@ -30,6 +29,10 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Include="../../PackageReadme.md" Pack="true" PackagePath=""/>
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" /> <PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2"> <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2">