Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename method and Update dependency #286

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
6.0.x
8.0.x

- name: 🚦 Build NatashaFunctionUT
run: dotnet build './test/ut/NatashaFunctionUT' -c Release --nologo
- name: 🚦 NatashaFunctionUT UT Test
run: dotnet test './test/ut/NatashaFunctionUT' --nologo -c Release -l "trx;LogFileName=NatashaFunctionUT.trx" --results-directory "TestResults"

Expand Down
49 changes: 15 additions & 34 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,24 @@ Example:

-->

## [8.0.0.0] - 2024-01-10
## [8.1.2.1] - 2024-05-01

### DotNetCore.Natasha.CSharp.Compiler _ v8.1.2.1:
- 保留热重载相关 API.
- 升级 Roslyn 依赖.
- 修复诊断警告相关 BUG.
- 修复错别字.

### DotNetCore.Natasha.DynamicLoad.Base _ v8.0.0.0:
- INatashaDynamicLoadContextBase 接口来规范域的行为.
- INatashaDynamicLoadContextCreator 接口来规范创建域以及其他 Runtime 方法的实现.

### DotNetCore.Natasha.Domain _ v8.0.0.0:
- 优化域加载时程序集比对的逻辑.
- 相同依赖不会二次加载.
### DotNetCore.Natasha.CSharp.Template.Core _ v8.0.0.1:
- 跟随 Compiler 升级依赖.

### DotNetCore.Natasha.CSharp.Extension.Codecov _ v8.0.0.1:
- 跟随 Compiler 升级依赖.

### DotNetCore.Natasha.CSharp.Compiler.Domain _ v8.0.0.0:
- 实现 `DotNetCore.Natasha.DynamicLoad.Base` 接口,支持 Natasha 域操作.
### DotNetCore.Natasha.CSharp.Extension.Ambiguity _ v8.0.0.1:
- 跟随 Compiler 升级依赖.


### DotNetCore.Natasha.CSharp.Compiler _ v8.0.0.0:
- 新增 智能模式、轻便模式、自定义模式 三种编译方式.
- 新增 NatashaLoadContext 统一管理元数据.
- 支持 实现程序集、引用程序集两种预热方式.
- 支持 动态断点调试.
- 支持 引用程序集输出.
- 支持 隐藏的 Release 模式.
- 全面兼容 Standard2.0.
- 优化预热性能.
- 优化预热内存涨幅.


### DotNetCore.Natasha.CSharp.Template.Core _ v8.0.0.0:
- 全面兼容 Standard2.0.
- 为 `DotNetCore.Natasha.CSharp.Compiler` 提供 .NET Core3.1+ 脚本模板支持.


### DotNetCore.Natasha.CSharp.Extension.Codecov _ v8.0.0.0:
- 全面兼容 Standard2.0.
- 支持动态程序集的方法使用率统计


### DotNetCore.Natasha.CSharp.Extension.Ambiguity _ v8.0.0.0:
- 全面兼容 Standard2.0.
### DotNetCore.Natasha.CSharp.Extension.MethodCreator _ v8.0.0.1:
- 发布 便捷动态方法编译模板.
- 跟随其他扩展库版本号发布.
2 changes: 1 addition & 1 deletion samples/ExtensionSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static void Main(string[] args)

var func = "return arg1+arg2;"
.WithAssemblyBuilder(opt=>opt.AddReferenceAndUsingCode<object>())
.ToFunc<int, int, int>();
.ToFunc<int, int, int>()!;

Console.WriteLine(func(1,2));
Console.ReadKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static (string script, AssemblyCSharpBuilder builder) WithAssemblyBuilder
return (script, builder);
}

public static T? CreateMethod<T>(in this (string script, AssemblyCSharpBuilder builder) buildInfo, string? modifier = null) where T: Delegate
public static T? ToDelegate<T>(in this (string script, AssemblyCSharpBuilder builder) buildInfo, string? modifier = null) where T: Delegate
{

var className = $"N{Guid.NewGuid():N}";
Expand Down Expand Up @@ -46,17 +46,17 @@ public static (string script, AssemblyCSharpBuilder builder) WithAssemblyBuilder
}
return null;
}
public static T? CreateAsyncMethod<T>(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate
public static T? ToAsyncDelegate<T>(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate
{
return CreateMethod<T>(buildInfo, "async");
return ToDelegate<T>(buildInfo, "async");
}
public static T? CreateUnsafeMethod<T>(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate
public static T? ToUnsafeDelegate<T>(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate
{
return CreateMethod<T>(buildInfo, "unsafe");
return ToDelegate<T>(buildInfo, "unsafe");
}
public static T? CreateUnsafeAsyncMethod<T>(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate
public static T? ToUnsafeAsyncDelegate<T>(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate
{
return CreateMethod<T>(buildInfo, "unsafe async");
return ToDelegate<T>(buildInfo, "unsafe async");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,103 +6,103 @@ public static class SystemDelegateExtension
#region Action Delegate
public static Action<T1>? ToAction<T1>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1>>();
return buildInfo.ToDelegate<Action<T1>>();
}
public static Action<T1, T2>? ToAction<T1, T2>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2>>();
return buildInfo.ToDelegate<Action<T1, T2>>();
}
public static Action<T1, T2, T3>? ToAction<T1, T2, T3>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3>>();
return buildInfo.ToDelegate<Action<T1, T2, T3>>();
}
public static Action<T1, T2, T3, T4>? ToAction<T1, T2, T3, T4>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3, T4>>();
return buildInfo.ToDelegate<Action<T1, T2, T3, T4>>();
}
public static Action<T1, T2, T3, T4, T5>? ToAction<T1, T2, T3, T4, T5>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3, T4, T5>>();
return buildInfo.ToDelegate<Action<T1, T2, T3, T4, T5>>();
}
public static Action<T1, T2, T3, T4, T5, T6>? ToAction<T1, T2, T3, T4, T5, T6>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3, T4, T5, T6>>();
return buildInfo.ToDelegate<Action<T1, T2, T3, T4, T5, T6>>();
}
public static Action<T1, T2, T3, T4, T5, T6, T7>? ToAction<T1, T2, T3, T4, T5, T6, T7>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3, T4, T5, T6, T7>>();
return buildInfo.ToDelegate<Action<T1, T2, T3, T4, T5, T6, T7>>();
}
public static Action<T1, T2, T3, T4, T5, T6, T7, T8>? ToAction<T1, T2, T3, T4, T5, T6, T7, T8>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3, T4, T5, T6, T7, T8>>();
return buildInfo.ToDelegate<Action<T1, T2, T3, T4, T5, T6, T7, T8>>();
}
public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>? ToAction<T1, T2, T3, T4, T5, T6, T7, T8, T9>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>>();
return buildInfo.ToDelegate<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>>();
}
public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>? ToAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>>();
return buildInfo.ToDelegate<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>>();
}
public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>? ToAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>>();
return buildInfo.ToDelegate<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>>();
}
public static Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>? ToAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>>();
return buildInfo.ToDelegate<Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>>();
}
#endregion


#region Func Delegate
public static Func<T1>? ToFunc<T1>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1>>();
return buildInfo.ToDelegate<Func<T1>>();
}
public static Func<T1, T2>? ToFunc<T1, T2>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2>>();
return buildInfo.ToDelegate<Func<T1, T2>>();
}
public static Func<T1, T2, T3>? ToFunc<T1, T2, T3>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3>>();
return buildInfo.ToDelegate<Func<T1, T2, T3>>();
}
public static Func<T1, T2, T3, T4>? ToFunc<T1, T2, T3, T4>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3, T4>>();
return buildInfo.ToDelegate<Func<T1, T2, T3, T4>>();
}
public static Func<T1, T2, T3, T4, T5>? ToFunc<T1, T2, T3, T4, T5>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3, T4, T5>>();
return buildInfo.ToDelegate<Func<T1, T2, T3, T4, T5>>();
}
public static Func<T1, T2, T3, T4, T5, T6>? ToFunc<T1, T2, T3, T4, T5, T6>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3, T4, T5, T6>>();
return buildInfo.ToDelegate<Func<T1, T2, T3, T4, T5, T6>>();
}
public static Func<T1, T2, T3, T4, T5, T6, T7>? ToFunc<T1, T2, T3, T4, T5, T6, T7>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3, T4, T5, T6, T7>>();
return buildInfo.ToDelegate<Func<T1, T2, T3, T4, T5, T6, T7>>();
}
public static Func<T1, T2, T3, T4, T5, T6, T7, T8>? ToFunc<T1, T2, T3, T4, T5, T6, T7, T8>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3, T4, T5, T6, T7, T8>>();
return buildInfo.ToDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8>>();
}
public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9>? ToFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9>>();
return buildInfo.ToDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9>>();
}
public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>? ToFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>>();
return buildInfo.ToDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>>();
}
public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>? ToFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>>();
return buildInfo.ToDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>>();
}
public static Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>? ToFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(in this (string script, AssemblyCSharpBuilder builder) buildInfo)
{
return buildInfo.CreateMethod<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>>();
return buildInfo.ToDelegate<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>>();
}
#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0;net8.0;</TargetFrameworks>

<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
Expand All @@ -20,9 +21,9 @@

<ItemGroup>
<PackageReference Include="DotNetCore.Compile.Environment" Version="3.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
5 changes: 5 additions & 0 deletions test/workflow/Workflow.Initialization/Core/ConfigRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ internal static void UpdateUnitTestYML(SolutionConfiguration solutionInfo)
{
if (project.TriggerPullRequestTest)
{
utString.AppendLine(GetBuildTaskString(project.ProjectName, project.ProjectFolder));
utString.AppendLine(GetUTTestTaskString(project.ProjectName, project.ProjectFolder));
}
}
Expand All @@ -112,6 +113,10 @@ internal static void UpdateUnitTestYML(SolutionConfiguration solutionInfo)
File.Delete(ymlFile);
}

static string GetBuildTaskString(string projectName, string projectFolder)
{
return $" - name: 🚦 Build {projectName} \r\n run: dotnet build './{projectFolder}' -c Release --nologo";
}
//UT测试以及报告输出
static string GetUTTestTaskString(string projectName, string projectFolder)
{
Expand Down
Loading