Skip to content

Commit 1701bef

Browse files
committed
Adding #if TOOLS around generated class OnImportEditorPlugin
EditorImportPlugin is only available in Editor builds, so all import plugins will also require #if TOOLS regardless of whether they use OnImport attribute.
1 parent 8dd599e commit 1701bef

6 files changed

Lines changed: 12 additions & 16 deletions

File tree

CustomGeneratorTests/CustomGeneratorTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
77
</PropertyGroup>
88
<ItemGroup>
9-
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.0" />
9+
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.1-231211-0953.Release" />
1010
</ItemGroup>
1111
</Project>

Godot 3 Tests/Godot 3 Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</ItemGroup>
1010
<ItemGroup>
1111
<PackageReference Include="FluentAssertions" Version="6.12.0" />
12-
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.0" />
12+
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.1-231211-0953.Release" />
1313
</ItemGroup>
1414
<ItemGroup>
1515
<ProjectReference Include="..\CustomGeneratorTests\CustomGeneratorTests.csproj" OutputItemType="analyzer" />

Godot 4 Tests/Godot 4 Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212
<ItemGroup>
1313
<PackageReference Include="FluentAssertions" Version="6.12.0" />
14-
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.0" />
14+
<PackageReference Include="GodotSharp.SourceGenerators" Version="2.3.1-231211-0953.Release" />
1515
</ItemGroup>
1616
<ItemGroup>
1717
<ProjectReference Include="..\CustomGeneratorTests\CustomGeneratorTests.csproj" OutputItemType="analyzer" />

Godot 4 Tests/TestScenes/Feature31.OnImportAttribute/OnImportTests.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
using System.ComponentModel;
2-
using System.Linq;
3-
using FluentAssertions;
41
using Godot;
5-
using Godot.Collections;
62
using GodotSharp.BuildingBlocks.TestRunner;
7-
using static GodotTests.TestScenes.OnImportTests;
83

94
namespace GodotTests.TestScenes
105
{
116
[SceneTree]
127
public partial class OnImportTests : Node, ITest
138
{
9+
#if TOOLS
1410
public enum IntEnum : int { a, b, c }
1511
public enum LongEnum : long { a, b, c }
1612

@@ -148,8 +144,9 @@ public static Error SaveTestScene(string savePath)
148144
// ok
149145
return Error.Ok;
150146
}
147+
#endif
151148
}
152-
149+
#if TOOLS
153150
[Tool]
154151
internal partial class OnImportWithAllArgs : OnImportEditorPlugin
155152
{
@@ -280,4 +277,5 @@ private string DefaultDfltStrNull(string path, int preset)
280277
return Error.Ok;
281278
}
282279
}
280+
#endif
283281
}

SourceGenerators/OnImportExtensions/Resources.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public HintAttribute(PropertyHint propertyHint = default, string hintString = de
3131
#endif".Trim();
3232

3333
public static readonly string OnImportEditorPlugin = @"
34-
#if GODOT
34+
#if GODOT && TOOLS
3535
#if NET6_0 || NET7_0 || NET8_0 // Godot 4.0 only
3636
using Godot.Collections;
3737

SourceGenerators/SourceGenerators.csproj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ C# Source Generators for use with the Godot Game Engine (supports Godot 4 and .N
3636
* Includes base classes/helpers to create project specific source generators
3737
</Description>
3838
<PackageReleaseNotes>
39-
v.2.3.0 (prerelease)
39+
v.2.3.1 (prerelease)
4040
- ADDED: Support for .NET 8.0
41-
42-
v.2.2.1
43-
- ADDED: OnImport attribute (GD4 only)
41+
- ADDED: OnImport attribute for editor only builds (GD4 only)
4442

4543
v.2.1.0
4644
- ADDED: CodeComments attribute
@@ -81,8 +79,8 @@ C# Source Generators for use with the Godot Game Engine (supports Godot 4 and .N
8179
<PackageLicenseExpression>MIT</PackageLicenseExpression>
8280
<PackageTags>Godot C# SourceGenerator</PackageTags>
8381
<PackageReadmeFile>README.md</PackageReadmeFile>
84-
<Version>2.3.0</Version>
85-
<!--<Version>2.3.0-$([System.DateTime]::Now.ToString(yyMMdd-HHmm)).$(Configuration)</Version>-->
82+
<!--<Version>2.3.0</Version>-->
83+
<Version>2.3.1-$([System.DateTime]::Now.ToString(yyMMdd-HHmm)).$(Configuration)</Version>
8684
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
8785
</PropertyGroup>
8886
<ItemGroup>

0 commit comments

Comments
 (0)