From 6894fd3cf3438ee1b45c0d548e26709b765409b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9C=A8=E6=A3=AE=20=C2=B7=20=E4=BD=9C=E9=9C=96?= <16236903+NMSAzulX@users.noreply.github.com> Date: Tue, 30 Apr 2024 20:48:27 +0800 Subject: [PATCH 1/3] Rename method and Update dependency --- .github/workflows/pr_test.yml | 2 + CHANGELOG.md | 49 ++++++------------- samples/ExtensionSample/Program.cs | 2 +- .../StringExtension.cs | 14 +++--- .../SystemDelegateExtension.cs | 48 +++++++++--------- .../Natasha.CSharp.Compiler.csproj | 2 +- .../NatashaFunctionUT.csproj | 5 +- .../Core/ConfigRunner.cs | 5 ++ 8 files changed, 58 insertions(+), 69 deletions(-) diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml index 60b83bb4..1e7b51d8 100644 --- a/.github/workflows/pr_test.yml +++ b/.github/workflows/pr_test.yml @@ -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" diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c88ff97..1d40679b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: +- 发布 便捷动态方法编译模板. +- 跟随其他扩展库版本号发布. diff --git a/samples/ExtensionSample/Program.cs b/samples/ExtensionSample/Program.cs index 9a46e1d1..63c6b4f0 100644 --- a/samples/ExtensionSample/Program.cs +++ b/samples/ExtensionSample/Program.cs @@ -8,7 +8,7 @@ static void Main(string[] args) var func = "return arg1+arg2;" .WithAssemblyBuilder(opt=>opt.AddReferenceAndUsingCode()) - .ToFunc(); + .ToFunc()!; Console.WriteLine(func(1,2)); Console.ReadKey(); diff --git a/src/Natasha.CSharp/Extension/Natasha.CSharp.Extension.MethodCreator/StringExtension.cs b/src/Natasha.CSharp/Extension/Natasha.CSharp.Extension.MethodCreator/StringExtension.cs index 7250b139..742856e6 100644 --- a/src/Natasha.CSharp/Extension/Natasha.CSharp.Extension.MethodCreator/StringExtension.cs +++ b/src/Natasha.CSharp/Extension/Natasha.CSharp.Extension.MethodCreator/StringExtension.cs @@ -18,7 +18,7 @@ public static (string script, AssemblyCSharpBuilder builder) WithAssemblyBuilder return (script, builder); } - public static T? CreateMethod(in this (string script, AssemblyCSharpBuilder builder) buildInfo, string? modifier = null) where T: Delegate + public static T? ToDelegate(in this (string script, AssemblyCSharpBuilder builder) buildInfo, string? modifier = null) where T: Delegate { var className = $"N{Guid.NewGuid():N}"; @@ -46,17 +46,17 @@ public static (string script, AssemblyCSharpBuilder builder) WithAssemblyBuilder } return null; } - public static T? CreateAsyncMethod(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate + public static T? ToAsyncDelegate(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate { - return CreateMethod(buildInfo, "async"); + return ToDelegate(buildInfo, "async"); } - public static T? CreateUnsafeMethod(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate + public static T? ToUnsafeDelegate(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate { - return CreateMethod(buildInfo, "unsafe"); + return ToDelegate(buildInfo, "unsafe"); } - public static T? CreateUnsafeAsyncMethod(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate + public static T? ToUnsafeAsyncDelegate(in this (string script, AssemblyCSharpBuilder builder) buildInfo) where T : Delegate { - return CreateMethod(buildInfo, "unsafe async"); + return ToDelegate(buildInfo, "unsafe async"); } } diff --git a/src/Natasha.CSharp/Extension/Natasha.CSharp.Extension.MethodCreator/SystemDelegateExtension.cs b/src/Natasha.CSharp/Extension/Natasha.CSharp.Extension.MethodCreator/SystemDelegateExtension.cs index 912d4578..c7873dfc 100644 --- a/src/Natasha.CSharp/Extension/Natasha.CSharp.Extension.MethodCreator/SystemDelegateExtension.cs +++ b/src/Natasha.CSharp/Extension/Natasha.CSharp.Extension.MethodCreator/SystemDelegateExtension.cs @@ -6,51 +6,51 @@ public static class SystemDelegateExtension #region Action Delegate public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Action? ToAction(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } #endregion @@ -58,51 +58,51 @@ public static class SystemDelegateExtension #region Func Delegate public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } public static Func? ToFunc(in this (string script, AssemblyCSharpBuilder builder) buildInfo) { - return buildInfo.CreateMethod>(); + return buildInfo.ToDelegate>(); } #endregion diff --git a/src/Natasha.CSharp/Natasha.CSharp.Compiler/Natasha.CSharp.Compiler.csproj b/src/Natasha.CSharp/Natasha.CSharp.Compiler/Natasha.CSharp.Compiler.csproj index df0d2e4e..5d3d8468 100644 --- a/src/Natasha.CSharp/Natasha.CSharp.Compiler/Natasha.CSharp.Compiler.csproj +++ b/src/Natasha.CSharp/Natasha.CSharp.Compiler/Natasha.CSharp.Compiler.csproj @@ -14,7 +14,7 @@ - + diff --git a/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj b/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj index 39dd6698..5b681221 100644 --- a/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj +++ b/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj @@ -2,6 +2,7 @@ netcoreapp3.1;net6.0;net8.0; + false enable preview @@ -20,9 +21,9 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/test/workflow/Workflow.Initialization/Core/ConfigRunner.cs b/test/workflow/Workflow.Initialization/Core/ConfigRunner.cs index 3ce9fb2a..60a553ad 100644 --- a/test/workflow/Workflow.Initialization/Core/ConfigRunner.cs +++ b/test/workflow/Workflow.Initialization/Core/ConfigRunner.cs @@ -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)); } } @@ -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) { From 0725b49c1213e4b8ccf7b1101199e144dc618632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9C=A8=E6=A3=AE=20=C2=B7=20=E4=BD=9C=E9=9C=96?= <16236903+NMSAzulX@users.noreply.github.com> Date: Tue, 30 Apr 2024 21:28:07 +0800 Subject: [PATCH 2/3] Update NatashaFunctionUT.csproj --- test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj b/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj index 5b681221..0382dec3 100644 --- a/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj +++ b/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj @@ -2,7 +2,7 @@ netcoreapp3.1;net6.0;net8.0; - + false false enable preview From cf539eab0fcd891c028818e3e6835563ddb6f053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9C=A8=E6=A3=AE=20=C2=B7=20=E4=BD=9C=E9=9C=96?= <16236903+NMSAzulX@users.noreply.github.com> Date: Tue, 30 Apr 2024 21:54:37 +0800 Subject: [PATCH 3/3] use 3.1.32 dotnet for ut --- .github/NMS_TEMPLATE/test.yml.template | 2 +- .github/workflows/pr_test.yml | 2 +- test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/NMS_TEMPLATE/test.yml.template b/.github/NMS_TEMPLATE/test.yml.template index 3555f412..1522247a 100644 --- a/.github/NMS_TEMPLATE/test.yml.template +++ b/.github/NMS_TEMPLATE/test.yml.template @@ -20,7 +20,7 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 3.1.x + 3.1.32 6.0.x 8.0.x diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml index 1e7b51d8..46240e71 100644 --- a/.github/workflows/pr_test.yml +++ b/.github/workflows/pr_test.yml @@ -20,7 +20,7 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 3.1.x + 3.1.32 6.0.x 8.0.x diff --git a/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj b/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj index 0382dec3..52735563 100644 --- a/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj +++ b/test/ut/NatashaFunctionUT/NatashaFunctionUT.csproj @@ -2,7 +2,6 @@ netcoreapp3.1;net6.0;net8.0; - false false enable preview