Skip to content

Commit 850599c

Browse files
committed
Merge pull request godotengine#98153 from Delsin-Yu/dotnet-warn-missing-tool-preprocessor
[Editor] Prevent `TOOLS` .Net DefineConstants being overriden by the user
2 parents f8ca861 + b2b7c1f commit 850599c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,6 @@
103103
<GodotDefineConstants>$(GodotDefineConstants);$(GodotPlatformConstants);$(GodotVersionConstants)</GodotDefineConstants>
104104
</PropertyGroup>
105105

106-
<PropertyGroup>
107-
<!-- ExportDebug also defines DEBUG like Debug does. -->
108-
<DefineConstants Condition=" '$(Configuration)' == 'ExportDebug' ">$(DefineConstants);DEBUG</DefineConstants>
109-
<!-- Debug defines TOOLS to differentiate between Debug and ExportDebug configurations. -->
110-
<DefineConstants Condition=" '$(Configuration)' == 'Debug' ">$(DefineConstants);TOOLS</DefineConstants>
111-
112-
<DefineConstants>$(GodotDefineConstants);$(DefineConstants)</DefineConstants>
113-
</PropertyGroup>
114-
115106
<Import Project="$(MSBuildThisFileDirectory)\Android.props" Condition=" '$(GodotTargetPlatform)' == 'android' " />
116107
<Import Project="$(MSBuildThisFileDirectory)\iOSNativeAOT.props" Condition=" '$(GodotTargetPlatform)' == 'ios' " />
117108
</Project>

modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@
1010
<DefineConstants Condition=" '$(GodotFloat64)' == 'true' ">GODOT_REAL_T_IS_DOUBLE;$(DefineConstants)</DefineConstants>
1111
</PropertyGroup>
1212

13+
<!--
14+
We are defining ExportDebug and Debug in Sdk.targets to ensure that the user cannot
15+
override the DefineConstants property in their csproj file and break the editor functionality.
16+
-->
17+
<PropertyGroup>
18+
<!-- ExportDebug also defines DEBUG like Debug does. -->
19+
<DefineConstants Condition=" '$(Configuration)' == 'ExportDebug' ">$(DefineConstants);DEBUG</DefineConstants>
20+
<!-- Debug defines TOOLS to differentiate between Debug and ExportDebug configurations. -->
21+
<DefineConstants Condition=" '$(Configuration)' == 'Debug' ">$(DefineConstants);TOOLS</DefineConstants>
22+
23+
<DefineConstants>$(GodotDefineConstants);$(DefineConstants)</DefineConstants>
24+
</PropertyGroup>
25+
1326
<!-- C# source generators -->
1427
<ItemGroup Condition=" '$(DisableImplicitGodotGeneratorReferences)' != 'true' ">
1528
<PackageReference Include="Godot.SourceGenerators" Version="$(PackageVersion_Godot_SourceGenerators)" />

0 commit comments

Comments
 (0)