summaryrefslogtreecommitdiffstats
path: root/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
diff options
context:
space:
mode:
authorAlex de la Mare <alexdlm@alexdlm.org>2023-01-08 12:04:15 +1100
committerAlex de la Mare <alexdlm@alexdlm.org>2023-03-25 13:46:12 +1100
commit8ab3295e57c8cb6c28ef531726b30634ba924a55 (patch)
tree751f226fcc10a563ff53d1e1849720f8faa4bc5c /modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
parent0291fcd7b66bcb315a49c44de8031e5596de4216 (diff)
downloadredot-engine-8ab3295e57c8cb6c28ef531726b30634ba924a55.tar.gz
Add fine-grained disabling of SourceGenerators
This allows manual testing and/or alternate source generators to provide functionality without conflict.
Diffstat (limited to 'modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs')
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
index f0c9043fd5..7f627f0dc4 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
@@ -26,6 +26,12 @@ namespace Godot.SourceGenerators
toggle != null &&
toggle.Equals("true", StringComparison.OrdinalIgnoreCase);
+ public static bool IsGodotSourceGeneratorDisabled(this GeneratorExecutionContext context, string generatorName) =>
+ AreGodotSourceGeneratorsDisabled(context) ||
+ (context.TryGetGlobalAnalyzerProperty("GodotDisabledSourceGenerators", out string? disabledGenerators) &&
+ disabledGenerators != null &&
+ disabledGenerators.Split(';').Contains(generatorName));
+
public static bool InheritsFrom(this INamedTypeSymbol? symbol, string assemblyName, string typeFullName)
{
while (symbol != null)