Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename SdkSupportedTargetPlatform, add SupportedTargetPlatform #12872

Merged
merged 5 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<ImportGroup Condition="'$(UsingNETSdkDefaults)' != 'true'">
<Import Project="Microsoft.NET.Sdk.DefaultItems.props" />
<Import Project="Microsoft.NET.SupportedTargetFrameworks.props" />
<Import Project="Microsoft.NET.WindowsSupportedTargetPlatforms.props" />
<Import Project="Microsoft.NET.SupportedPlatforms.props" />
<Import Project="Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props" />
</ImportGroup>

<PropertyGroup>
Expand Down Expand Up @@ -214,7 +215,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<Target Name="GeneratePlatformCompatibleDefineConstants"
Condition=" '$(DisableImplicitFrameworkDefines)' != 'true' and '$(TargetPlatformIdentifier)' != '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0)) " >
<ItemGroup>
<_SupportedPlatformCompatibleVersions Include="@(SupportedTargetPlatform)" Condition=" %(Identity) != '' and $([MSBuild]::VersionLessThan(%(Identity), $(TargetPlatformVersion))) " />
<_SupportedPlatformCompatibleVersions Include="@(SdkSupportedTargetPlatform)" Condition=" %(Identity) != '' and $([MSBuild]::VersionLessThan(%(Identity), $(TargetPlatformVersion))) " />
<_ImplicitDefineConstant Include="@(_SupportedPlatformCompatibleVersions->'$(TargetPlatformIdentifier.ToUpper())%(Identity)'->Replace('.', '_'))" />
</ItemGroup>
</Target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,12 @@ Copyright (c) .NET Foundation. All rights reserved.

<!-- List of supported .NET Core and .NET Standard TFMs -->
<Import Project="Microsoft.NET.SupportedTargetFrameworks.props" />

<!-- List of supported target platforms -->
<Import Project="Microsoft.NET.SupportedPlatforms.props" />

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

<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.CSharp.props" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
<Import Project="$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.VisualBasic.props" Condition="'$(MSBuildProjectExtension)' == '.vbproj'" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
***********************************************************************************************
Microsoft.NET.SupportedPlatforms.props

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->

<Project>
<ItemGroup>
<!-- Platforms supported by this SDK for analyzer warnings. Spec: https://github.com/dotnet/designs/blob/master/accepted/2020/platform-exclusion/platform-exclusion.md -->
<SupportedPlatform Include="Android" />
<SupportedPlatform Include="iOS" />
<SupportedPlatform Include="Linux" />
<SupportedPlatform Include="macOS" />
<SupportedPlatform Include="Windows" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Copyright (c) .NET Foundation. All rights reserved.
BeforeTargets="ProcessFrameworkReferences"
Condition="'$(TargetPlatformVersion)' != '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0))">
<ItemGroup>
<_ValidTargetPlatformVersion Include="@(SupportedTargetPlatform)" Condition="'@(SupportedTargetPlatform)' != '' and $([MSBuild]::VersionEquals(%(Identity), $(TargetPlatformVersion)))" />
<_ValidTargetPlatformVersion Include="@(SdkSupportedTargetPlatform)" Condition="'@(SdkSupportedTargetPlatform)' != '' and $([MSBuild]::VersionEquals(%(Identity), $(TargetPlatformVersion)))" />
</ItemGroup>

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

<NetSdkError Condition="'$(TargetPlatformVersionSupported)' != 'true'"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
***********************************************************************************************
Microsoft.NET.WindowsSupportedTargetPlatforms.props
Microsoft.NET.WindowsSdkSupportedTargetPlatforms.props

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
Expand All @@ -10,17 +10,17 @@ Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->

<!-- This file contains a list of the windows target platform versions that are supported by this SDK for .NET. -->
<!-- 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 -->
<Project>
<ItemGroup>
<WindowsSupportedTargetPlatform Include="10.0.19041" />
<WindowsSupportedTargetPlatform Include="10.0.18362" />
<WindowsSupportedTargetPlatform Include="10.0.17763" />
<WindowsSupportedTargetPlatform Include="8.0" />
<WindowsSupportedTargetPlatform Include="7.0" />
<WindowsSdkSupportedTargetPlatform Include="10.0.19041" />
<WindowsSdkSupportedTargetPlatform Include="10.0.18362" />
<WindowsSdkSupportedTargetPlatform Include="10.0.17763" />
<WindowsSdkSupportedTargetPlatform Include="8.0" />
<WindowsSdkSupportedTargetPlatform Include="7.0" />
</ItemGroup>

<ItemGroup>
<SupportedTargetPlatform Condition="'$(TargetPlatformIdentifier)' == 'Windows'" Include="@(WindowsSupportedTargetPlatform)" />
<SdkSupportedTargetPlatform Condition="'$(TargetPlatformIdentifier)' == 'Windows'" Include="@(WindowsSdkSupportedTargetPlatform)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ public void It_implicitly_defines_compilation_constants_for_the_target_platform(
[Theory]
[InlineData(new[] { "1.0", "1.1" }, "ios", "1.1", new[] { "IOS", "IOS1_1", "IOS1_0" })]
[InlineData(new[] { "11.11", "12.12", "13.13" }, "android", "12.12", new[] { "ANDROID", "ANDROID11_11", "ANDROID12_12" })]
[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" })]
public void It_implicitly_defines_compilation_constants_for_the_target_platform_with_backwards_compatibility(string[] supportedTargetPlatform, string targetPlatformIdentifier, string targetPlatformVersion, string[] expectedDefines)
[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" })]
public void It_implicitly_defines_compilation_constants_for_the_target_platform_with_backwards_compatibility(string[] sdkSupportedTargetPlatform, string targetPlatformIdentifier, string targetPlatformVersion, string[] expectedDefines)
{
var targetFramework = "net5.0";
var testAsset = _testAssetsManager
Expand All @@ -480,9 +480,9 @@ public void It_implicitly_defines_compilation_constants_for_the_target_platform_

var itemGroup = new XElement(ns + "ItemGroup");
project.Root.Add(itemGroup);
foreach (var targetPlatform in supportedTargetPlatform)
foreach (var targetPlatform in sdkSupportedTargetPlatform)
{
itemGroup.Add(new XElement(ns + "SupportedTargetPlatform", new XAttribute("Include", targetPlatform)));
itemGroup.Add(new XElement(ns + "SdkSupportedTargetPlatform", new XAttribute("Include", targetPlatform)));
}
});

Expand Down