Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Handley <jeffhandley@users.noreply.github.com>2021-04-20 07:52:12 +0300
committerGitHub <noreply@github.com>2021-04-20 07:52:12 +0300
commitc7e02f3773da25946328eba150a70caa3b0e4c74 (patch)
treebc7b27807b6a9ca562aa0a16bccb44cf4417fa41 /eng/versioning.targets
parenta668de0a1f619947c6fe164d9408d2fdbda86dc8 (diff)
Refactor build to use SupportedOSPlatforms instead of IsWindowsSpecific (#51450)
Diffstat (limited to 'eng/versioning.targets')
-rw-r--r--eng/versioning.targets27
1 files changed, 14 insertions, 13 deletions
diff --git a/eng/versioning.targets b/eng/versioning.targets
index 9c4e3ea8119..9981f73a0be 100644
--- a/eng/versioning.targets
+++ b/eng/versioning.targets
@@ -25,13 +25,6 @@
</AssemblyMetadata>
</ItemGroup>
- <!-- Adds SupportedOSPlatform attribute for Windows Specific libraries -->
- <ItemGroup Condition="'$(IsWindowsSpecific)' == 'true' and '$(IsTestProject)' != 'true' and '$(IncludePlatformAttributes)' != 'false'">
- <AssemblyAttribute Include="System.Runtime.Versioning.SupportedOSPlatform">
- <_Parameter1>windows</_Parameter1>
- </AssemblyAttribute>
- </ItemGroup>
-
<PropertyGroup Condition="'$(TargetsAnyOS)' == 'true' and !$(TargetFrameworks.Contains('$(TargetFramework)-Browser'))">
<CrossPlatformAndHasNoBrowserTarget>true</CrossPlatformAndHasNoBrowserTarget>
</PropertyGroup>
@@ -57,29 +50,37 @@
<SupportedPlatform Condition="'$(TargetsUnix)' == 'true'" Include="Unix"/>
</ItemGroup>
- <ItemGroup>
- <_unsupportedOSPlatforms Include="$(UnsupportedOSPlatforms)" />
- <_supportedOSPlatforms Include="$(SupportedOSPlatforms)" />
- </ItemGroup>
-
<!-- Adds UnsupportedOSPlatform and SupportedOSPlatform attributes to the assembly when:
- * At least one <UnsupportedOSPlatforms /> or <SupportedOSPlatforms /> has been specified
* This isn't a test project
* This is a cross-platform target
* The build isn't targeting .NET Framework
-->
<Target Name="AddOSPlatformAttributes" BeforeTargets="GenerateAssemblyInfo" AfterTargets="PrepareForBuild"
Condition="'$(TargetsAnyOS)' == 'true' and '$(IsTestProject)' != 'true' and '$(TargetFrameworkIdentifier)' != '.NETFramework'">
+ <!-- Defensively de-dupe the values -->
+ <ItemGroup>
+ <_unsupportedOSPlatforms Include="$(UnsupportedOSPlatforms)" />
+ <_supportedOSPlatforms Include="$(SupportedOSPlatforms)" />
+ </ItemGroup>
+
<ItemGroup Condition="'@(_unsupportedOSPlatforms)' != ''">
+ <!-- Add the assembly attribute -->
<AssemblyAttribute Include="System.Runtime.Versioning.UnsupportedOSPlatform">
<_Parameter1>%(_unsupportedOSPlatforms.Identity)</_Parameter1>
</AssemblyAttribute>
+
+ <!-- Ensure this platform is included in the platforms enabled for the CA1416 analyzer -->
+ <SupportedPlatform Include="%(_unsupportedOSPlatforms.Identity)" />
</ItemGroup>
<ItemGroup Condition="'@(_supportedOSPlatforms)' != ''">
+ <!-- Add the assembly attribute -->
<AssemblyAttribute Include="System.Runtime.Versioning.SupportedOSPlatform">
<_Parameter1>%(_supportedOSPlatforms.Identity)</_Parameter1>
</AssemblyAttribute>
+
+ <!-- Ensure this platform is included in the platforms enabled for the CA1416 analyzer -->
+ <SupportedPlatform Include="%(_supportedOSPlatforms.Identity)" />
</ItemGroup>
</Target>