Skip to content

Commit 9926415

Browse files
authored
Merge pull request #13086 from sfoslund/renameSupportedTP
Rename SdkSupportedTargetPlatform, add SupportedTargetPlatform
2 parents 26855b5 + 4c6c733 commit 9926415

File tree

6 files changed

+44
-18
lines changed

6 files changed

+44
-18
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Copyright (c) .NET Foundation. All rights reserved.
1616
<ImportGroup Condition="'$(UsingNETSdkDefaults)' != 'true'">
1717
<Import Project="Microsoft.NET.Sdk.DefaultItems.props" />
1818
<Import Project="Microsoft.NET.SupportedTargetFrameworks.props" />
19-
<Import Project="Microsoft.NET.WindowsSupportedTargetPlatforms.props" />
19+
<Import Project="Microsoft.NET.SupportedPlatforms.props" />
20+
<Import Project="Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props" />
2021
</ImportGroup>
2122

2223
<PropertyGroup>
@@ -214,7 +215,7 @@ Copyright (c) .NET Foundation. All rights reserved.
214215
<Target Name="GeneratePlatformCompatibleDefineConstants"
215216
Condition=" '$(DisableImplicitFrameworkDefines)' != 'true' and '$(TargetPlatformIdentifier)' != '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0)) " >
216217
<ItemGroup>
217-
<_SupportedPlatformCompatibleVersions Include="@(SupportedTargetPlatform)" Condition=" %(Identity) != '' and $([MSBuild]::VersionLessThan(%(Identity), $(TargetPlatformVersion))) " />
218+
<_SupportedPlatformCompatibleVersions Include="@(SdkSupportedTargetPlatform)" Condition=" %(Identity) != '' and $([MSBuild]::VersionLessThan(%(Identity), $(TargetPlatformVersion))) " />
218219
<_ImplicitDefineConstant Include="@(_SupportedPlatformCompatibleVersions->'$(TargetPlatformIdentifier.ToUpper())%(Identity)'->Replace('.', '_'))" />
219220
</ItemGroup>
220221
</Target>

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,12 @@ Copyright (c) .NET Foundation. All rights reserved.
119119

120120
<!-- List of supported .NET Core and .NET Standard TFMs -->
121121
<Import Project="Microsoft.NET.SupportedTargetFrameworks.props" />
122+
123+
<!-- List of supported target platforms -->
124+
<Import Project="Microsoft.NET.SupportedPlatforms.props" />
122125

123126
<!-- List of supported .NET windows target platform versions -->
124-
<Import Project="Microsoft.NET.WindowsSupportedTargetPlatforms.props" />
127+
<Import Project="Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props" />
125128

126129
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.CSharp.props" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
127130
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.VisualBasic.props" Condition="'$(MSBuildProjectExtension)' == '.vbproj'" />
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!--
2+
***********************************************************************************************
3+
Microsoft.NET.SupportedPlatforms.props
4+
5+
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6+
created a backup copy. Incorrect changes to this file will make it
7+
impossible to load or build your projects from the command-line or the IDE.
8+
9+
Copyright (c) .NET Foundation. All rights reserved.
10+
***********************************************************************************************
11+
-->
12+
13+
<Project>
14+
<ItemGroup>
15+
<!-- Platforms supported by this SDK for analyzer warnings. Spec: https://github.com/dotnet/designs/blob/master/accepted/2020/platform-exclusion/platform-exclusion.md -->
16+
<SupportedPlatform Include="Android" />
17+
<SupportedPlatform Include="iOS" />
18+
<SupportedPlatform Include="Linux" />
19+
<SupportedPlatform Include="macOS" />
20+
<SupportedPlatform Include="Windows" />
21+
</ItemGroup>
22+
</Project>

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Copyright (c) .NET Foundation. All rights reserved.
202202
BeforeTargets="ProcessFrameworkReferences"
203203
Condition="'$(TargetPlatformVersion)' != '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0))">
204204
<ItemGroup>
205-
<_ValidTargetPlatformVersion Include="@(SupportedTargetPlatform)" Condition="'@(SupportedTargetPlatform)' != '' and $([MSBuild]::VersionEquals(%(Identity), $(TargetPlatformVersion)))" />
205+
<_ValidTargetPlatformVersion Include="@(SdkSupportedTargetPlatform)" Condition="'@(SdkSupportedTargetPlatform)' != '' and $([MSBuild]::VersionEquals(%(Identity), $(TargetPlatformVersion)))" />
206206
</ItemGroup>
207207

208208
<PropertyGroup>
@@ -216,8 +216,8 @@ Copyright (c) .NET Foundation. All rights reserved.
216216
Condition="'$(TargetPlatformVersion)' != '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0))">
217217
<PropertyGroup>
218218
<TargetPlatformVersionSupported Condition="'$(TargetPlatformVersionSupported)' == '' and '@(_ValidTargetPlatformVersion)' != ''" >true</TargetPlatformVersionSupported>
219-
<_ValidTargetPlatformVersions Condition="'@(SupportedTargetPlatform)' != ''" >@(SupportedTargetPlatform, '%0a')</_ValidTargetPlatformVersions>
220-
<_ValidTargetPlatformVersions Condition="'@(SupportedTargetPlatform)' == ''" >None</_ValidTargetPlatformVersions>
219+
<_ValidTargetPlatformVersions Condition="'@(SdkSupportedTargetPlatform)' != ''" >@(SdkSupportedTargetPlatform, '%0a')</_ValidTargetPlatformVersions>
220+
<_ValidTargetPlatformVersions Condition="'@(SdkSupportedTargetPlatform)' == ''" >None</_ValidTargetPlatformVersions>
221221
</PropertyGroup>
222222

223223
<NetSdkError Condition="'$(TargetPlatformVersionSupported)' != 'true'"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
22
***********************************************************************************************
3-
Microsoft.NET.WindowsSupportedTargetPlatforms.props
3+
Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props
44
55
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
66
created a backup copy. Incorrect changes to this file will make it
@@ -10,17 +10,17 @@ Copyright (c) .NET Foundation. All rights reserved.
1010
***********************************************************************************************
1111
-->
1212

13-
<!-- This file contains a list of the windows target platform versions that are supported by this SDK for .NET. -->
13+
<!-- This file contains a list of the windows target platform versions that are supported by this SDK for .NET. Supported versions are processed in _NormalizeTargetPlatformVersion -->
1414
<Project>
1515
<ItemGroup>
16-
<WindowsSupportedTargetPlatform Include="10.0.19041" />
17-
<WindowsSupportedTargetPlatform Include="10.0.18362" />
18-
<WindowsSupportedTargetPlatform Include="10.0.17763" />
19-
<WindowsSupportedTargetPlatform Include="8.0" />
20-
<WindowsSupportedTargetPlatform Include="7.0" />
16+
<WindowsSdkSupportedTargetPlatform Include="10.0.19041" />
17+
<WindowsSdkSupportedTargetPlatform Include="10.0.18362" />
18+
<WindowsSdkSupportedTargetPlatform Include="10.0.17763" />
19+
<WindowsSdkSupportedTargetPlatform Include="8.0" />
20+
<WindowsSdkSupportedTargetPlatform Include="7.0" />
2121
</ItemGroup>
2222

2323
<ItemGroup>
24-
<SupportedTargetPlatform Condition="'$(TargetPlatformIdentifier)' == 'Windows'" Include="@(WindowsSupportedTargetPlatform)" />
24+
<SdkSupportedTargetPlatform Condition="'$(TargetPlatformIdentifier)' == 'Windows'" Include="@(WindowsSdkSupportedTargetPlatform)" />
2525
</ItemGroup>
2626
</Project>

src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildALibrary.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,8 @@ public void It_implicitly_defines_compilation_constants_for_the_target_platform(
454454
[Theory]
455455
[InlineData(new[] { "1.0", "1.1" }, "ios", "1.1", new[] { "IOS", "IOS1_1", "IOS1_0" })]
456456
[InlineData(new[] { "11.11", "12.12", "13.13" }, "android", "12.12", new[] { "ANDROID", "ANDROID11_11", "ANDROID12_12" })]
457-
[InlineData(new string[] { /* Use the built in SupportedTargetPlatform items */}, "windows", "10.0.19041", new[] { "WINDOWS", "WINDOWS7_0", "WINDOWS8_0", "WINDOWS10_0_17763", "WINDOWS10_0_18362", "WINDOWS10_0_19041" })]
458-
public void It_implicitly_defines_compilation_constants_for_the_target_platform_with_backwards_compatibility(string[] supportedTargetPlatform, string targetPlatformIdentifier, string targetPlatformVersion, string[] expectedDefines)
457+
[InlineData(new string[] { /* Use the built in SdkSupportedTargetPlatform items */}, "windows", "10.0.19041", new[] { "WINDOWS", "WINDOWS7_0", "WINDOWS8_0", "WINDOWS10_0_17763", "WINDOWS10_0_18362", "WINDOWS10_0_19041" })]
458+
public void It_implicitly_defines_compilation_constants_for_the_target_platform_with_backwards_compatibility(string[] sdkSupportedTargetPlatform, string targetPlatformIdentifier, string targetPlatformVersion, string[] expectedDefines)
459459
{
460460
var targetFramework = "net5.0";
461461
var testAsset = _testAssetsManager
@@ -480,9 +480,9 @@ public void It_implicitly_defines_compilation_constants_for_the_target_platform_
480480

481481
var itemGroup = new XElement(ns + "ItemGroup");
482482
project.Root.Add(itemGroup);
483-
foreach (var targetPlatform in supportedTargetPlatform)
483+
foreach (var targetPlatform in sdkSupportedTargetPlatform)
484484
{
485-
itemGroup.Add(new XElement(ns + "SupportedTargetPlatform", new XAttribute("Include", targetPlatform)));
485+
itemGroup.Add(new XElement(ns + "SdkSupportedTargetPlatform", new XAttribute("Include", targetPlatform)));
486486
}
487487
});
488488

0 commit comments

Comments
 (0)