diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fbc57fe5..1fc342fa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [2.0.0] + +### BREAKING(断代声明) + +* 版本线归一 2.0.0(C459,GFX-1194,GitHub #958):`Version.props` 由 1.7.3 切至 2.0.0.0,全部 27 个可打包项目(运行时基座 15 包 + `GameFrameX.Capability.*` 12 包)统一随 2.0.0 版本线发布。按 D1 裁决为断代升级:**不保留 1.x 兼容层**,1.x 消费方升级须整体切换 +* `GameFrameX.Capability.*`(Hosting×3 + Online×9)随 2.0.0 首发,此前从未发布过任何版本;`GameFrameX.NetWork.Message` / `GameFrameX.Core.Config` 等已并入包以 2.0.0 续线 +* Server 运行仓(`GameFrameX.Server`)的 `GameFrameX.*` 包引用钉住 1.13.0 不随本次升级,待框架 2.0 发布后按收敛计划 P5 阶段统一切换 + ## [Unreleased] - PostgreSQL-Only 验证分支(verify/pg-only-no-mongo) ### Removed diff --git a/GameFrameX.Architecture.Analyzers/Analyzers/Architecture/CapabilityAssemblyBoundaryAnalyzer.cs b/GameFrameX.Architecture.Analyzers/Analyzers/Architecture/CapabilityAssemblyBoundaryAnalyzer.cs index 727509c2e..41dec7c17 100644 --- a/GameFrameX.Architecture.Analyzers/Analyzers/Architecture/CapabilityAssemblyBoundaryAnalyzer.cs +++ b/GameFrameX.Architecture.Analyzers/Analyzers/Architecture/CapabilityAssemblyBoundaryAnalyzer.cs @@ -44,7 +44,7 @@ namespace GameFrameX.Architecture.Analyzers; /// 只在能力包模块内、持有 CapabilityRegistrationContext 参数的 Register 及其辅助方法中合法; /// Bridges.Publish<> 只在能力包模块内、持有激活期上下文的 ActivateAsync 及其辅助方法中合法; /// CapabilityBridge<>.TryAcquire 只在 Hotfix / Apps 消费侧合法;CapabilityHook<>.Attach 只在 Hotfix 合法; -/// CapabilityCompositionOptions.Override<> / Configure<> / SetAdminApiPlaneFactory 只在宿主组合入口(Launcher)合法。 +/// CapabilityCompositionOptions.Override<> / Configure<> / SetAdminApiPlaneFactory 只在宿主组合入口合法:精确 GameFrameX.Launcher 程序集,或自身为 ConsoleApplication 输出的可执行组合根宿主(gfx-online 模板生成形态)。 /// /// 维护约束:Hosting 机制包是这些 API 的定义方,内部转交不受限;测试工程(精确程序集名)可构造任意阶段夹具。 /// @@ -92,6 +92,9 @@ private static void RegisterChecks(CompilationStartAnalysisContext context) var registrationPhase = new[] { registration }; var activationPhase = new[] { activation, publisher }; + // 宿主组合入口(B1):可执行组合根本身(ConsoleApplication 输出,如 gfx-online 模板生成的宿主) + // 与 Launcher 同为 Override / Configure / SetAdminApiPlaneFactory 的合法调用方;库输出不放宽。 + var compositionHostOutput = compilation.Options.OutputKind == OutputKind.ConsoleApplication; context.RegisterOperationAction(operationContext => { var method = operationContext.Operation is IInvocationOperation invocation @@ -103,7 +106,7 @@ private static void RegisterChecks(CompilationStartAnalysisContext context) } var phase = kind == BoundaryKind.BridgePublish ? activationPhase : registrationPhase; - if (IsAllowed(operationContext.ContainingSymbol, kind, module, phase)) + if (IsAllowed(operationContext.ContainingSymbol, kind, module, phase, compositionHostOutput)) { return; } @@ -114,7 +117,7 @@ private static void RegisterChecks(CompilationStartAnalysisContext context) }, OperationKind.Invocation, OperationKind.MethodReference); } - private static bool IsAllowed(ISymbol caller, BoundaryKind kind, INamedTypeSymbol module, INamedTypeSymbol[] phase) + private static bool IsAllowed(ISymbol caller, BoundaryKind kind, INamedTypeSymbol module, INamedTypeSymbol[] phase, bool compositionHostOutput) { var assembly = caller.ContainingAssembly.Identity.Name; if (CapabilityBoundaryFacts.IsTest(assembly) || CapabilityBoundaryFacts.IsMechanism(assembly)) @@ -129,7 +132,8 @@ private static bool IsAllowed(ISymbol caller, BoundaryKind kind, INamedTypeSymbo case BoundaryKind.HookAttach: return assembly == ArchitectureAnalyzerConstants.HotfixAssembly; case BoundaryKind.HostComposition: - return assembly == CapabilityBoundaryFacts.Launcher; + // 宿主组合入口 = 可执行组合根(ConsoleApplication 输出)或精确 Launcher 程序集;库程序集仍被拒绝。 + return compositionHostOutput || assembly == CapabilityBoundaryFacts.Launcher; default: if (!CapabilityBoundaryFacts.IsImplementation(assembly)) { @@ -181,7 +185,7 @@ private static string Guidance(BoundaryKind kind) case BoundaryKind.HookAttach: return "钩子挂载仅限 Hotfix 程序集经 CapabilityHook.Attach 调用"; case BoundaryKind.HostComposition: - return "Override / Configure / SetAdminApiPlaneFactory 仅限宿主组合入口(Launcher)调用"; + return "Override / Configure / SetAdminApiPlaneFactory 仅限宿主组合入口(可执行组合根,如 GameFrameX.Launcher 或 gfx-online 生成的宿主进程)调用"; default: return "Register 期 API 仅限能力包模块(实现 ICapabilityModule)的 Register 及持有 CapabilityRegistrationContext 参数的模块内辅助方法调用"; } diff --git a/README.ja.md b/README.ja.md index 8d3b7b5ed..24be2467c 100644 --- a/README.ja.md +++ b/README.ja.md @@ -833,6 +833,8 @@ GameFrameX.Server.Source/ | `Swashbuckle.AspNetCore.SwaggerGen` | HTTP API の Swagger ドキュメント | | `xunit` | ユニットテストフレームワーク | +**バージョンガバナンス(2.0.0 ライン):** 本リポジトリのソースバージョンラインは **2.0.0** に統一されました(ブレークイグチャンジ、1.x 互換層なし)。サーバー実行リポジトリ(`GameFrameX.Server`)の `GameFrameX.*` パッケージ参照は **1.13.0** に固定されたままで、フレームワーク 2.0 の公開後(収束計画 P5 段階)に一括アップグレードします。`GameFrameX.Capability.*` 能力パッケージは 2.0.0 ラインで初公開されます。 + --- ## ドキュメントとリソース diff --git a/README.ko.md b/README.ko.md index dd006e52c..609a3ca48 100644 --- a/README.ko.md +++ b/README.ko.md @@ -834,6 +834,8 @@ GameFrameX.Server.Source/ | `Swashbuckle.AspNetCore.SwaggerGen` | HTTP API용 Swagger 문서 | | `xunit` | 단위 테스트 프레임워크 | +**버전 거버넌스(2.0.0 라인):** 본 리포지토리의 소스 버전 라인은 **2.0.0**으로 통일되었습니다(단절 업그레이드, 1.x 호환 계층 없음). 서버 실행 리포지토리(`GameFrameX.Server`)의 `GameFrameX.*` 패키지 참조는 **1.13.0**에 고정된 채로 유지되며, 프레임워크 2.0 출시 후(수렴 계획 P5 단계) 일괄 업그레이드됩니다. `GameFrameX.Capability.*` 역량 패키지는 2.0.0 라인으로 첫 공개됩니다. + --- ## 문서 및 자료 diff --git a/README.md b/README.md index f030caa4c..a6570d373 100644 --- a/README.md +++ b/README.md @@ -878,6 +878,8 @@ other hosts. | `Swashbuckle.AspNetCore.SwaggerGen` | Swagger documentation for the HTTP API | | `xunit` | Unit testing framework | +**Version governance (2.0.0 line):** the source version line of this repository is unified at **2.0.0** (clean break; no 1.x compatibility layer). The server runtime repository (`GameFrameX.Server`) keeps all `GameFrameX.*` package references pinned to **1.13.0** and will move to 2.0.0 only after the framework 2.0 release (convergence stage P5). `GameFrameX.Capability.*` capability packages debut on the 2.0.0 line. + --- ## Documentation & Resources diff --git a/README.zh-CN.md b/README.zh-CN.md index 413c027cc..ac1864ead 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -843,6 +843,8 @@ All-in-One 进程运行,而无需修改 Role 代码。 | `Swashbuckle.AspNetCore.SwaggerGen` | HTTP API 的 Swagger 文档 | | `xunit` | 单元测试框架 | +**版本治理(2.0.0 版本线):** 本仓源码版本线已归一为 **2.0.0**(断代升级,不保留 1.x 兼容层)。Server 运行仓(`GameFrameX.Server`)的 `GameFrameX.*` 包引用钉住 **1.13.0** 不动,待框架 2.0 发布后再统一升级(收敛计划 P5 阶段);`GameFrameX.Capability.*` 能力包随 2.0.0 版本线首发。 + --- ## 文档与资源 diff --git a/README.zh-TW.md b/README.zh-TW.md index 5d8fa633d..1e6175106 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -836,6 +836,8 @@ compose 檔案與各實例配置是否與產生器輸出一致)。未啟用驗 | `Swashbuckle.AspNetCore.SwaggerGen` | HTTP API 的 Swagger 文件 | | `xunit` | 單元測試框架 | +**版本治理(2.0.0 版本線):** 本倉源碼版本線已歸一為 **2.0.0**(斷代升級,不保留 1.x 相容層)。Server 執行倉(`GameFrameX.Server`)的 `GameFrameX.*` 套件引用釘住 **1.13.0** 不動,待框架 2.0 發布後再統一升級(收斂計畫 P5 階段);`GameFrameX.Capability.*` 能力套件隨 2.0.0 版本線首發。 + --- ## 文檔與資源 diff --git a/Tests/GameFrameX.Tests/Architecture/CapabilityBoundaryAnalyzerTests.cs b/Tests/GameFrameX.Tests/Architecture/CapabilityBoundaryAnalyzerTests.cs index c06442f91..956ae3175 100644 --- a/Tests/GameFrameX.Tests/Architecture/CapabilityBoundaryAnalyzerTests.cs +++ b/Tests/GameFrameX.Tests/Architecture/CapabilityBoundaryAnalyzerTests.cs @@ -302,6 +302,33 @@ public sealed class FixtureOptions { } Assert.All(diagnostics, diagnostic => Assert.Contains("Launcher", diagnostic.GetMessage())); } + [Theory] + [InlineData("ThirdParty.OnlineHost")] + [InlineData("GameFrameX.Launcher")] + public async Task Host_composition_overrides_allowed_for_executable_composition_hosts(string consumer) + { + // B1:可执行组合根(ConsoleApplication 输出,如 gfx-online 模板生成的宿主)是自身进程的组合入口, + // Override / Configure / SetAdminApiPlaneFactory 合法;同一程序集名以库输出编译仍被既有负样本拒绝。 + var source = """ + using GameFrameX.Capability.Hosting.Core; + public class CompositionEntry + { + public static void Main() { } + + public void Run(CapabilityCompositionOptions options) + { + options.Configure(configured => { }); + options.Override(resolver => null); + options.SetAdminApiPlaneFactory(null); + } + } + public interface IFixtureContract { } + public sealed class FixtureOptions { } + """; + var compilation = Compile(consumer, source, ContractReferences, OutputKind.ConsoleApplication); + Assert.Empty(await Analyze(compilation, new CapabilityAssemblyBoundaryAnalyzer())); + } + [Theory] [InlineData("GameFrameX.Hotfix")] [InlineData("GameFrameX.Apps")] @@ -572,6 +599,14 @@ private static CSharpCompilation Compile(string name, string source, params Meta return compilation; } + private static CSharpCompilation Compile(string name, string source, MetadataReference[] references, OutputKind outputKind) + { + var compilation = CSharpCompilation.Create(name, new[] { CSharpSyntaxTree.ParseText(source, path: "Fixture.cs") }, + PlatformReferences.Concat(references), new CSharpCompilationOptions(outputKind)); + AssertNoErrors(compilation); + return compilation; + } + private static MetadataReference Emit(string name, string source, params MetadataReference[] references) { using (var stream = new MemoryStream()) diff --git a/Version.props b/Version.props index 4d9e05624..abcccf701 100644 --- a/Version.props +++ b/Version.props @@ -1,5 +1,5 @@ - 1.7.3 + 2.0.0.0 \ No newline at end of file