fix: Adjust platform detection logic in Stride.Core.targets file - #3344
fix: Adjust platform detection logic in Stride.Core.targets file#3344Jklawreszuk wants to merge 3 commits into
Conversation
ds5678
left a comment
There was a problem hiding this comment.
fix for Linux
What is broken? Is there a GitHub issue about the problem?
Temporary fix
Why temporary?
| <StridePlatform Condition="'$(StridePlatform)' == '' And '$(TargetPlatformIdentifier)' == 'iOS'">iOS</StridePlatform> | ||
| <StridePlatform Condition="'$(StridePlatform)' == '' And $(RuntimeIdentifier.StartsWith('osx'))">macOS</StridePlatform> | ||
| <StridePlatform Condition="'$(StridePlatform)' == '' And $(RuntimeIdentifier.StartsWith('linux'))">Linux</StridePlatform> | ||
| <StridePlatform></StridePlatform> |
There was a problem hiding this comment.
Why are you clearing StridePlatform?
| <StridePlatform Condition="'$(RuntimeIdentifier.StartsWith(win))'">Windows</StridePlatform> | ||
| <StridePlatform Condition="'$(RuntimeIdentifier.StartsWith(osx))'">macOS</StridePlatform> | ||
| <StridePlatform Condition="'$(RuntimeIdentifier.StartsWith(linux))'">Linux</StridePlatform> | ||
| <StridePlatform Condition="'$(TargetPlatformIdentifier)' == 'Windows'">Windows</StridePlatform> | ||
| <StridePlatform Condition="'$(TargetPlatformIdentifier)' == 'macOS'">macOS</StridePlatform> | ||
| <StridePlatform Condition="'$(TargetPlatformIdentifier)' == 'UAP'">UWP</StridePlatform> | ||
| <StridePlatform Condition="'$(TargetPlatformIdentifier)' == 'Android'">Android</StridePlatform> | ||
| <StridePlatform Condition="'$(TargetPlatformIdentifier)' == 'iOS'">iOS</StridePlatform> |
There was a problem hiding this comment.
Why did you reverse the priority of RuntimeIdentifier and TargetPlatformIdentifier?
It's seems like consistency with Stride.Platform.props.
stride/sources/sdk/Stride.Build.Sdk/Sdk/Stride.Platform.props
Lines 25 to 36 in 7fadc52
There was a problem hiding this comment.
Yes, I've tried to replicate logic from the Stride.Platform.props file
|
What is exactly the bug that this fixes? In addition, not checking that the value hasn't already been set doesn't make it optional, it makes it impossible to set in the command line. edit: ok so after reading the content of |
According to a message in Discord, this pull request is based on #3075. However, I didn't know much about |
|
I am sorry my PR description wasn't specific enough, I should have gone into more detail about the situation. Also, I understand that the @ds5678's fixes were previously located in Stride.Core.props, which I believe was removed in favor of Stride.Platform.props (?), which is part of the currently developing Stride.Build.Sdk. I realize that the SDK is not yet available for use in the projects, which is why I referred to this as a 'temporary' fix." |
| <StridePlatform Condition="'$(StridePlatform)' == '' And '$([MSBuild]::IsOSPlatform(Linux))' ">Linux</StridePlatform> | ||
| <StridePlatform Condition="'$(StridePlatform)' == '' And '$([MSBuild]::IsOSPlatform(OSX))' ">macOS</StridePlatform> |
There was a problem hiding this comment.
I think 3 lines are sufficient to solve your issue: these two and
<StridePlatform Condition="'$(StridePlatform)' == '' And $(RuntimeIdentifier.StartsWith('win'))">Windows</StridePlatform>There was a problem hiding this comment.
However, I agree that TargetPlatformIdentifier and RuntimeIdentifier should be switched for consistency with Stride.Platform.props.
|
@Kryptos-FR Well, maybe you're right. I will close the PR for now and I’ll try to take a closer look at the new SDK and how to integrate it, as it’s something I’ve completely missed and new to me. Sorry for the confusion 😬️ |
|
I don't think this should be closed. |
|
Me neither. It's a good discussion to have. I believe you were on something. Game projects don't use the SDK, only our internal engine projects. So Stride.Core.targets might need some tweaks. I was confused earlier (I edited my comments since then). |
|
Ohhhh I see, I thought the SDK was also designed for the game projects as well. |
|
I didn't test anything, but I think these changes would resolve your issue: |
|
@ds5678 Yes, your changes are completely correct! I can apply that |
|
Why not the changes to Stride.Platform.props too? |
| <StridePlatform Condition=" '$(RuntimeIdentifier.StartsWith(win))' ">Windows</StridePlatform> | ||
| <StridePlatform Condition=" '$(RuntimeIdentifier.StartsWith(osx))' ">macOS</StridePlatform> | ||
| <StridePlatform Condition=" '$(RuntimeIdentifier.StartsWith(linux))' ">Linux</StridePlatform> | ||
| <StridePlatform Condition=" '$(StrideTargetFramework)' == '$(StrideFrameworkWindows)' ">Windows</StridePlatform> |
There was a problem hiding this comment.
If those rules aren't needed anymore, we might need to review Stride.Frameworks.props.
There was a problem hiding this comment.
I took a look at the file you mentioned.
<StrideTargetFramework Condition="$(TargetFramework.StartsWith('$(StrideFrameworkWindows)'))">$(StrideFrameworkWindows)</StrideTargetFramework>
<!-- Written by me for comparision -->
<StrideTargetFramework Condition="'$(TargetPlatformIdentifier)' == 'Windows'">$(StrideFrameworkWindows)</StrideTargetFramework>These two lines are basically the same since TargetPlatformIdentifier is internally calculated by parsing TargetFramework.
So I agree that if StrideTargetFramework isn't used anywhere else, it could be removed since this code now uses the "official" way of extracting the platform from the TargetFramework.


PR Details
Temporary fix for Linux. It brings platform detection logic from Stride.Platform.props, so It makes setting
StridePlatformmsbuild variable fully optional.Types of changes
Checklist