diff --git a/Share/Analyzer/Analyzer/AddChildTypeAnalyzer.cs b/Share/Analyzer/Analyzer/AddChildTypeAnalyzer.cs index 23b754a5514..e400d088d33 100644 --- a/Share/Analyzer/Analyzer/AddChildTypeAnalyzer.cs +++ b/Share/Analyzer/Analyzer/AddChildTypeAnalyzer.cs @@ -11,7 +11,8 @@ namespace ET.Analyzer [DiagnosticAnalyzer(LanguageNames.CSharp)] public class AddChildTypeAnalyzer: DiagnosticAnalyzer { - public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(AddChildTypeAnalyzerRule.Rule,DisableAccessEntityChildAnalyzerRule.Rule); + public override ImmutableArray SupportedDiagnostics => + ImmutableArray.Create(AddChildTypeAnalyzerRule.Rule, DisableAccessEntityChildAnalyzerRule.Rule); public override void Initialize(AnalysisContext context) { @@ -22,17 +23,13 @@ public override void Initialize(AnalysisContext context) context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.EnableConcurrentExecution(); - //context.RegisterSyntaxNodeAction(this.AnalyzeMemberAccessExpression, SyntaxKind.SimpleMemberAccessExpression); - context.RegisterCompilationStartAction((analysisContext => - { - if (analysisContext.Compilation.AssemblyName==AnalyzeAssembly.UnityCodes) - { - analysisContext.RegisterSyntaxNodeAction(this.AnalyzeMemberAccessExpression, SyntaxKind.SimpleMemberAccessExpression); - }else if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName,AnalyzeAssembly.AllModelHotfix)) - { - analysisContext.RegisterSyntaxNodeAction(this.AnalyzeMemberAccessExpression, SyntaxKind.SimpleMemberAccessExpression); - } - })); + context.RegisterCompilationStartAction(analysisContext => + { + if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName, AnalyzeAssembly.AllModelHotfix)) + { + analysisContext.RegisterSyntaxNodeAction(this.AnalyzeMemberAccessExpression, SyntaxKind.SimpleMemberAccessExpression); + } + }); } private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) @@ -58,12 +55,11 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) // 获取AddChild函数的调用者类型 ITypeSymbol? parentTypeSymbol = memberAccessExpressionSyntax.GetMemberAccessSyntaxParentType(context.SemanticModel); - if (parentTypeSymbol==null) + if (parentTypeSymbol == null) { return; } - - + // 对于Entity基类会报错 除非标记了EnableAccessEntiyChild if (parentTypeSymbol.ToString() is Definition.EntityType or Definition.LSEntityType) { @@ -72,12 +68,11 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) } // 非Entity的子类 跳过 - if (parentTypeSymbol.BaseType?.ToString()!= Definition.EntityType && parentTypeSymbol.BaseType?.ToString()!=Definition.LSEntityType) + if (parentTypeSymbol.BaseType?.ToString() != Definition.EntityType && parentTypeSymbol.BaseType?.ToString() != Definition.LSEntityType) { return; } - - + // 获取 child实体类型 ISymbol? childTypeSymbol = null; // addChild为泛型调用 @@ -87,11 +82,12 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) TypeArgumentListSyntax? typeArgumentList = genericNameSyntax?.GetFirstChild(); - var childTypeSyntax = typeArgumentList?.Arguments.First(); + TypeSyntax? childTypeSyntax = typeArgumentList?.Arguments.First(); if (childTypeSyntax == null) { - Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, memberAccessExpressionSyntax?.Name.Identifier.GetLocation()); + Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, + memberAccessExpressionSyntax?.Name.Identifier.GetLocation()); context.ReportDiagnostic(diagnostic); throw new Exception("childTypeSyntax==null"); } @@ -105,7 +101,8 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) ?.ChildNodes().First(); if (firstArgumentSyntax == null) { - Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, memberAccessExpressionSyntax?.Name.Identifier.GetLocation()); + Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, + memberAccessExpressionSyntax?.Name.Identifier.GetLocation()); context.ReportDiagnostic(diagnostic); return; } @@ -134,14 +131,16 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) } else if (firstArgumentSymbol != null) { - Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, memberAccessExpressionSyntax?.Name.Identifier.GetLocation(), + Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, + memberAccessExpressionSyntax?.Name.Identifier.GetLocation(), firstArgumentSymbol.Name, parentTypeSymbol.Name); context.ReportDiagnostic(diagnostic); return; } else { - Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, memberAccessExpressionSyntax?.Name.Identifier.GetLocation(), + Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, + memberAccessExpressionSyntax?.Name.Identifier.GetLocation(), firstArgumentSyntax.GetText(), parentTypeSymbol.Name); context.ReportDiagnostic(diagnostic); return; @@ -158,7 +157,7 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) { return; } - + // 获取ChildOf标签的约束类型 if (!(childTypeSymbol is ITypeSymbol childType)) @@ -179,11 +178,11 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) } } - if (hasAttribute && availableParentType==null) + if (hasAttribute && availableParentType == null) { return; } - + // 判断父级类型是否属于child约束的父级类型 if (availableParentType?.ToString() == parentTypeSymbol.ToString()) { @@ -191,7 +190,8 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) } { - Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, memberAccessExpressionSyntax?.Name.Identifier.GetLocation(), childTypeSymbol?.Name, + Diagnostic diagnostic = Diagnostic.Create(AddChildTypeAnalyzerRule.Rule, memberAccessExpressionSyntax?.Name.Identifier.GetLocation(), + childTypeSymbol?.Name, parentTypeSymbol?.Name); context.ReportDiagnostic(diagnostic); } @@ -199,36 +199,39 @@ private void AnalyzeMemberAccessExpression(SyntaxNodeAnalysisContext context) private void HandleAcessEntityChild(SyntaxNodeAnalysisContext context) { - var memberAccessExpressionSyntax = context.Node as MemberAccessExpressionSyntax; + MemberAccessExpressionSyntax? memberAccessExpressionSyntax = context.Node as MemberAccessExpressionSyntax; //在方法体内 - var methodDeclarationSyntax = memberAccessExpressionSyntax?.GetNeareastAncestor(); - if (methodDeclarationSyntax!=null) + MethodDeclarationSyntax? methodDeclarationSyntax = memberAccessExpressionSyntax?.GetNeareastAncestor(); + if (methodDeclarationSyntax != null) { - var methodSymbol = context.SemanticModel.GetDeclaredSymbol(methodDeclarationSyntax); + IMethodSymbol? methodSymbol = context.SemanticModel.GetDeclaredSymbol(methodDeclarationSyntax); - bool? enableAccessEntiyChild = methodSymbol?.GetAttributes().Any(x => x.AttributeClass?.ToString() == Definition.EnableAccessEntiyChildAttribute); + bool? enableAccessEntiyChild = methodSymbol?.GetAttributes() + .Any(x => x.AttributeClass?.ToString() == Definition.EnableAccessEntiyChildAttribute); if (enableAccessEntiyChild == null || !enableAccessEntiyChild.Value) { - Diagnostic diagnostic = Diagnostic.Create(DisableAccessEntityChildAnalyzerRule.Rule, memberAccessExpressionSyntax?.Name.Identifier.GetLocation()); + Diagnostic diagnostic = Diagnostic.Create(DisableAccessEntityChildAnalyzerRule.Rule, + memberAccessExpressionSyntax?.Name.Identifier.GetLocation()); context.ReportDiagnostic(diagnostic); } + return; } - + //在属性内 - var propertyDeclarationSyntax = memberAccessExpressionSyntax?.GetNeareastAncestor(); - if (propertyDeclarationSyntax!=null) + PropertyDeclarationSyntax? propertyDeclarationSyntax = memberAccessExpressionSyntax?.GetNeareastAncestor(); + if (propertyDeclarationSyntax != null) { - var propertySymbol = context.SemanticModel.GetDeclaredSymbol(propertyDeclarationSyntax); - - bool? enableAccessEntiyChild = propertySymbol?.GetAttributes().Any(x => x.AttributeClass?.ToString() == Definition.EnableAccessEntiyChildAttribute); + IPropertySymbol? propertySymbol = context.SemanticModel.GetDeclaredSymbol(propertyDeclarationSyntax); + + bool? enableAccessEntiyChild = propertySymbol?.GetAttributes() + .Any(x => x.AttributeClass?.ToString() == Definition.EnableAccessEntiyChildAttribute); if (enableAccessEntiyChild == null || !enableAccessEntiyChild.Value) { - Diagnostic diagnostic = Diagnostic.Create(DisableAccessEntityChildAnalyzerRule.Rule, memberAccessExpressionSyntax?.Name.Identifier.GetLocation()); + Diagnostic diagnostic = Diagnostic.Create(DisableAccessEntityChildAnalyzerRule.Rule, + memberAccessExpressionSyntax?.Name.Identifier.GetLocation()); context.ReportDiagnostic(diagnostic); } - - return; } } } diff --git a/Share/Analyzer/Analyzer/ClassDeclarationInHotfixAnalyzer.cs b/Share/Analyzer/Analyzer/ClassDeclarationInHotfixAnalyzer.cs index 2b0c8c0be74..4076ef29a27 100644 --- a/Share/Analyzer/Analyzer/ClassDeclarationInHotfixAnalyzer.cs +++ b/Share/Analyzer/Analyzer/ClassDeclarationInHotfixAnalyzer.cs @@ -35,19 +35,6 @@ public override void Initialize(AnalysisContext context) context.EnableConcurrentExecution(); context.RegisterCompilationStartAction((analysisContext => { - if (analysisContext.Compilation.AssemblyName==AnalyzeAssembly.UnityCodes) - { - analysisContext.RegisterSemanticModelAction((modelAnalysisContext => - { - if (AnalyzerHelper.IsSemanticModelNeedAnalyze(modelAnalysisContext.SemanticModel,UnityCodesPath.AllHotfix)) - { - AnalyzeSemanticModel(modelAnalysisContext); - } - - } )); - return; - } - if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName,AnalyzeAssembly.AllHotfix)) { analysisContext.RegisterSemanticModelAction((this.AnalyzeSemanticModel)); diff --git a/Share/Analyzer/Analyzer/ETTaskAnalyzer.cs b/Share/Analyzer/Analyzer/ETTaskAnalyzer.cs index 59b91d3fef2..d27526408e1 100644 --- a/Share/Analyzer/Analyzer/ETTaskAnalyzer.cs +++ b/Share/Analyzer/Analyzer/ETTaskAnalyzer.cs @@ -23,19 +23,6 @@ public override void Initialize(AnalysisContext context) context.EnableConcurrentExecution(); context.RegisterCompilationStartAction((analysisContext => { - if (analysisContext.Compilation.AssemblyName==AnalyzeAssembly.UnityCodes) - { - analysisContext.RegisterSemanticModelAction((modelAnalysisContext => - { - if (AnalyzerHelper.IsSemanticModelNeedAnalyze(modelAnalysisContext.SemanticModel,UnityCodesPath.AllModelHotfix)) - { - AnalyzeSemanticModel(modelAnalysisContext); - } - - } )); - return; - } - if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName, AnalyzeAssembly.AllModelHotfix)) { analysisContext.RegisterSemanticModelAction((this.AnalyzeSemanticModel)); diff --git a/Share/Analyzer/Analyzer/EntityComponentAnalyzer.cs b/Share/Analyzer/Analyzer/EntityComponentAnalyzer.cs index 515de64a6ab..426c6a5a9f1 100644 --- a/Share/Analyzer/Analyzer/EntityComponentAnalyzer.cs +++ b/Share/Analyzer/Analyzer/EntityComponentAnalyzer.cs @@ -21,22 +21,8 @@ public override void Initialize(AnalysisContext context) } context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.EnableConcurrentExecution(); - context.RegisterCompilationStartAction((analysisContext => { - if (analysisContext.Compilation.AssemblyName==AnalyzeAssembly.UnityCodes) - { - analysisContext.RegisterSemanticModelAction((modelAnalysisContext => - { - if (AnalyzerHelper.IsSemanticModelNeedAnalyze(modelAnalysisContext.SemanticModel,UnityCodesPath.AllModelHotfix)) - { - AnalyzeSemanticModel(modelAnalysisContext); - } - - } )); - return; - } - if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName, AnalyzeAssembly.AllModelHotfix)) { analysisContext.RegisterSemanticModelAction((this.AnalyzeSemanticModel)); diff --git a/Share/Analyzer/Analyzer/EntityFiledAccessAnalyzer.cs b/Share/Analyzer/Analyzer/EntityFiledAccessAnalyzer.cs index f65e067b905..3c589902c1f 100644 --- a/Share/Analyzer/Analyzer/EntityFiledAccessAnalyzer.cs +++ b/Share/Analyzer/Analyzer/EntityFiledAccessAnalyzer.cs @@ -35,19 +35,6 @@ public override void Initialize(AnalysisContext context) context.EnableConcurrentExecution(); context.RegisterCompilationStartAction((analysisContext => { - if (analysisContext.Compilation.AssemblyName==AnalyzeAssembly.UnityCodes) - { - analysisContext.RegisterSemanticModelAction((modelAnalysisContext => - { - if (AnalyzerHelper.IsSemanticModelNeedAnalyze(modelAnalysisContext.SemanticModel,UnityCodesPath.AllModelHotfix)) - { - AnalyzeSemanticModel(modelAnalysisContext); - } - - } )); - return; - } - if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName, AnalyzeAssembly.AllModelHotfix)) { analysisContext.RegisterSemanticModelAction((this.AnalyzeSemanticModel)); diff --git a/Share/Analyzer/Analyzer/EntityHashCodeAnalyzer.cs b/Share/Analyzer/Analyzer/EntityHashCodeAnalyzer.cs index 6fb58421ce7..ed9334ce477 100644 --- a/Share/Analyzer/Analyzer/EntityHashCodeAnalyzer.cs +++ b/Share/Analyzer/Analyzer/EntityHashCodeAnalyzer.cs @@ -22,15 +22,20 @@ public override void Initialize(AnalysisContext context) context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); context.EnableConcurrentExecution(); - context.RegisterCompilationStartAction((this.CompilationStartAnalysis)); + var entityHashCodeMap = new ConcurrentDictionary(); + + context.RegisterCompilationStartAction((analysisContext => + { + CompilationStartAnalysis(analysisContext, entityHashCodeMap); + } )); } - private void CompilationStartAnalysis(CompilationStartAnalysisContext context) + private void CompilationStartAnalysis(CompilationStartAnalysisContext context,ConcurrentDictionary entityHashCodeMap) { - var entityHashCodeMap = new ConcurrentDictionary(); + context.RegisterSemanticModelAction((analysisContext => { - if (AnalyzerHelper.IsSemanticModelNeedAnalyze(analysisContext.SemanticModel,UnityCodesPath.UnityModel)) + if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.SemanticModel.Compilation.AssemblyName,AnalyzeAssembly.AllModel)) { AnalyzeSemanticModel(analysisContext, entityHashCodeMap); } diff --git a/Share/Analyzer/Analyzer/EntityMemberDeclarationAnalyzer.cs b/Share/Analyzer/Analyzer/EntityMemberDeclarationAnalyzer.cs index f8b913df12c..a190f0fd577 100644 --- a/Share/Analyzer/Analyzer/EntityMemberDeclarationAnalyzer.cs +++ b/Share/Analyzer/Analyzer/EntityMemberDeclarationAnalyzer.cs @@ -25,19 +25,6 @@ public override void Initialize(AnalysisContext context) context.EnableConcurrentExecution(); context.RegisterCompilationStartAction((analysisContext => { - if (analysisContext.Compilation.AssemblyName==AnalyzeAssembly.UnityCodes) - { - analysisContext.RegisterSemanticModelAction((modelAnalysisContext => - { - if (AnalyzerHelper.IsSemanticModelNeedAnalyze(modelAnalysisContext.SemanticModel,UnityCodesPath.AllModel)) - { - AnalyzeSemanticModel(modelAnalysisContext); - } - - } )); - return; - } - if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName,AnalyzeAssembly.AllModel)) { analysisContext.RegisterSemanticModelAction((this.AnalyzeSemanticModel)); diff --git a/Share/Analyzer/Analyzer/EntityMethodDeclarationAnalyzer.cs b/Share/Analyzer/Analyzer/EntityMethodDeclarationAnalyzer.cs index 399bc7753ef..ecedd989623 100644 --- a/Share/Analyzer/Analyzer/EntityMethodDeclarationAnalyzer.cs +++ b/Share/Analyzer/Analyzer/EntityMethodDeclarationAnalyzer.cs @@ -41,19 +41,6 @@ public override void Initialize(AnalysisContext context) context.RegisterCompilationStartAction((analysisContext => { - if (analysisContext.Compilation.AssemblyName==AnalyzeAssembly.UnityCodes) - { - analysisContext.RegisterSemanticModelAction((modelAnalysisContext => - { - if (AnalyzerHelper.IsSemanticModelNeedAnalyze(modelAnalysisContext.SemanticModel,UnityCodesPath.AllModel)) - { - AnalyzeSemanticModel(modelAnalysisContext); - } - - } )); - return; - } - if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName,AnalyzeAssembly.AllModel)) { analysisContext.RegisterSemanticModelAction((this.AnalyzeSemanticModel)); diff --git a/Share/Analyzer/Analyzer/HotfixProjectFieldDeclarationAnalyzer.cs b/Share/Analyzer/Analyzer/HotfixProjectFieldDeclarationAnalyzer.cs index a24c9c6c1f5..064fa59b14d 100644 --- a/Share/Analyzer/Analyzer/HotfixProjectFieldDeclarationAnalyzer.cs +++ b/Share/Analyzer/Analyzer/HotfixProjectFieldDeclarationAnalyzer.cs @@ -34,19 +34,6 @@ public override void Initialize(AnalysisContext context) context.EnableConcurrentExecution(); context.RegisterCompilationStartAction((analysisContext => { - if (analysisContext.Compilation.AssemblyName==AnalyzeAssembly.UnityCodes) - { - analysisContext.RegisterSemanticModelAction((modelAnalysisContext => - { - if (AnalyzerHelper.IsSemanticModelNeedAnalyze(modelAnalysisContext.SemanticModel,UnityCodesPath.AllHotfix)) - { - AnalyzeSemanticModel(modelAnalysisContext); - } - - } )); - return; - } - if (AnalyzerHelper.IsAssemblyNeedAnalyze(analysisContext.Compilation.AssemblyName,AnalyzeAssembly.AllHotfix)) { analysisContext.RegisterSemanticModelAction((this.AnalyzeSemanticModel)); diff --git a/Share/Analyzer/Analyzer/StaticClassCircularDependencyAnalyzer.cs b/Share/Analyzer/Analyzer/StaticClassCircularDependencyAnalyzer.cs index 4c9f01c3304..b863deaa6a5 100644 --- a/Share/Analyzer/Analyzer/StaticClassCircularDependencyAnalyzer.cs +++ b/Share/Analyzer/Analyzer/StaticClassCircularDependencyAnalyzer.cs @@ -46,13 +46,6 @@ private void CompilationStartAnalysis(CompilationStartAnalysisContext context) var dependencyMap = new ConcurrentDictionary>(); var staticClassSet = new HashSet(); - if (context.Compilation.AssemblyName == AnalyzeAssembly.UnityCodes) - { - context.RegisterSyntaxNodeAction(analysisContext => { this.StaticClassDependencyAnalyze(analysisContext, dependencyMap, staticClassSet); }, SyntaxKind.InvocationExpression); - context.RegisterCompilationEndAction(analysisContext => { this.CircularDependencyAnalyze(analysisContext, dependencyMap, staticClassSet); }); - return; - } - if (AnalyzerHelper.IsAssemblyNeedAnalyze(context.Compilation.AssemblyName, AnalyzeAssembly.AllHotfix)) { context.RegisterSyntaxNodeAction(analysisContext => { this.StaticClassDependencyAnalyze(analysisContext, dependencyMap, staticClassSet); }, SyntaxKind.InvocationExpression); @@ -61,7 +54,6 @@ private void CompilationStartAnalysis(CompilationStartAnalysisContext context) } - /// /// 静态类依赖分析 构建depedencyMap /// diff --git a/Share/Analyzer/Config/AnalyzeAssembly.cs b/Share/Analyzer/Config/AnalyzeAssembly.cs index 60803dede34..586ab3a2317 100644 --- a/Share/Analyzer/Config/AnalyzeAssembly.cs +++ b/Share/Analyzer/Config/AnalyzeAssembly.cs @@ -14,34 +14,26 @@ public static class AnalyzeAssembly public const string UnityModelView = "Unity.ModelView"; public const string UnityHotfixView = "Unity.HotfixView"; - public const string UnityCodes = "Unity.Codes"; - public const string UnityAllModel = "Unity.AllModel"; - public const string UnityAllHotfix = "Unity.AllHotfix"; - public static readonly string[] AllHotfix = { DotNetHotfix, UnityHotfix, UnityHotfixView, - UnityAllHotfix, }; public static readonly string[] AllModel = { - DotNetModel, UnityModel, - UnityModelView,UnityAllModel + DotNetModel, UnityModel, UnityModelView }; public static readonly string[] AllModelHotfix = { DotNetModel, DotNetHotfix, UnityModel, UnityHotfix, UnityModelView, UnityHotfixView, - UnityAllModel, UnityAllHotfix, }; public static readonly string[] All = { DotNetCore, DotNetModel, DotNetHotfix, UnityCore, UnityModel, UnityHotfix, UnityModelView, UnityHotfixView, - UnityCodes,UnityAllModel, UnityAllHotfix, }; public static readonly string[] ServerModelHotfix = @@ -51,32 +43,8 @@ public static class AnalyzeAssembly public static readonly string[] AllLogicModel = { - DotNetModel, UnityModel,UnityAllModel - }; - } - - public static class UnityCodesPath - { - public static readonly string UnityModel = @"Unity\Assets\Scripts\Model\".Replace('\\',Path.DirectorySeparatorChar); - public static readonly string UnityModelView = @"Unity\Assets\Scripts\ModelView\".Replace('\\',Path.DirectorySeparatorChar); - public static readonly string UnityHotfix = @"Unity\Assets\Scripts\Hotfix\".Replace('\\',Path.DirectorySeparatorChar); - public static readonly string UnityHotfixView = @"Unity\Assets\Scripts\HotfixView\".Replace('\\',Path.DirectorySeparatorChar); - - public static readonly string[] AllModelHotfix = - { - UnityModel, UnityHotfix, UnityModelView, UnityHotfixView, + DotNetModel, UnityModel }; - - public static readonly string[] AllHotfix = - { - UnityHotfix, UnityHotfixView, - }; - - public static readonly string[] AllModel = - { - UnityModel, UnityModelView - }; - - } + } \ No newline at end of file diff --git a/Share/Share.SourceGenerator/Generator/ETEntitySerializeFormatterGenerator.cs b/Share/Share.SourceGenerator/Generator/ETEntitySerializeFormatterGenerator.cs index 08936839145..72e9bc6a60d 100644 --- a/Share/Share.SourceGenerator/Generator/ETEntitySerializeFormatterGenerator.cs +++ b/Share/Share.SourceGenerator/Generator/ETEntitySerializeFormatterGenerator.cs @@ -173,7 +173,7 @@ internal static ISyntaxContextReceiver Create() public void OnVisitSyntaxNode(GeneratorSyntaxContext context) { - if (!AnalyzerHelper.IsSemanticModelNeedAnalyze(context.SemanticModel, UnityCodesPath.UnityModel)) + if (!AnalyzerHelper.IsAssemblyNeedAnalyze(context.SemanticModel.Compilation.AssemblyName,AnalyzeAssembly.AllLogicModel)) { return; } diff --git a/Unity/Assets/Plugins/Share.SourceGenerator.dll b/Unity/Assets/Plugins/Share.SourceGenerator.dll index 996a2e59a8c..8359ea64acc 100644 Binary files a/Unity/Assets/Plugins/Share.SourceGenerator.dll and b/Unity/Assets/Plugins/Share.SourceGenerator.dll differ