diff options
author | Jason Hunter <invino4@users.noreply.github.com> | 2024-03-18 09:48:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 09:48:52 -0700 |
commit | bdbd9995f8149fe022a02760daba705916ca3038 (patch) | |
tree | e3d0520347f4eb80218e9695182ef73bba12aabf | |
parent | fe01776f05b1787b28b4a270d53037a3c25f4ca2 (diff) | |
download | redot-engine-bdbd9995f8149fe022a02760daba705916ca3038.tar.gz |
Add property UsingGodotNETSdk to Godot.NET.Sdk
The Godot.NET.Sdk (for C# use) should define the property `UsingGodotNETSdk` in its [SDK.props](https://github.com/godotengine/godot/blob/a07dd0d6a520723c4838fb4b65461a16b7a50f90/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props).
## Why
Defining this property allows shared build configuration (e.g. Directory.Build.targets or other imported msbuild files) to detect deterministically when they are operating within the scope of a project controlled by Godot.NET.Sdk. This enables shared build configuration that may span many different projects within a folder to have Godot.NET.Sdk-specific configuration that only applies to Godot projects.
## Why named UsingGodotNETSdk
This naming scheme is common practice in Microsoft Dotnet SDKs. For example, the property `UsingMicrosoftNETSdk` is defined by the default SDK, `UsingMicrosoftTraversalSdk` is defined by [Microsoft.Build.Traversal](https://github.com/microsoft/MSBuildSdks/blob/363532de5b406c9afc6e6ff0f276431c27b11347/src/Traversal/Sdk/Sdk.props#L10), `UsingMicrosoftNoTargetsSdk` by [Microsoft.Build.NoTargets](https://github.com/microsoft/MSBuildSdks/blob/363532de5b406c9afc6e6ff0f276431c27b11347/src/NoTargets/Sdk/Sdk.props#L10), and so on. The property `UsingMicrosoftNETSdk` is even used in the implementation of Godot.NET.Sdk for conditional logic of the type predicted here.
Note that these "Using*" properties are _additive_ in the sense that more than one can be defined for a given project (as SDKs can effectively be built upon other SDKs, using them as components). So, it is normal and appropriate for both `UsingMicrosoftNETSdk` and `UsingGodotNETSdk` to be simultaneously defined within the same project.
-rw-r--r-- | modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props index b6c72bce9d..5c3af17e77 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props @@ -2,6 +2,8 @@ <Import Project="$(MSBuildThisFileDirectory)\SdkPackageVersions.props" /> <PropertyGroup> + <UsingGodotNETSdk>true</UsingGodotNETSdk> + <!-- Determines if we should import Microsoft.NET.Sdk, if it wasn't already imported. --> <GodotSdkImportsMicrosoftNetSdk Condition=" '$(UsingMicrosoftNETSdk)' != 'true' ">true</GodotSdkImportsMicrosoftNetSdk> </PropertyGroup> |