未验证 提交 30f42a86 编写于 作者: S Sam Harwell 提交者: GitHub

Merge pull request #43972 from sharwell/restrict-scope

Only run code style analyzers when nullable warnings are enabled
......@@ -25,6 +25,13 @@
to only set in the inner builds, not the outer build where only $(TargetFrameworks) is defined.
-->
<DisableNullableWarnings Condition="'$(DisableNullableWarnings)' == '' AND $(TargetFrameworks.Contains('netcoreapp3.1')) AND '$(TargetFramework)' != '' AND '$(TargetFramework)' != 'netcoreapp3.1'">true</DisableNullableWarnings>
<!--
Disable code style analyzers in "older" targets for a multi-targeted project. These analyzers don't
impact the correctness of the output, so we avoid the performance overhead where it's easy to do so.
-->
<RoslynCheckCodeStyle Condition="'$(RoslynCheckCodeStyle)' == '' AND '$(DisableNullableWarnings)' == 'true'">false</RoslynCheckCodeStyle>
<RoslynCheckCodeStyle Condition="'$(RoslynCheckCodeStyle)' == '' AND ('$(ContinuousIntegrationBuild)' != 'true' OR '$(RoslynEnforceCodeStyle)' == 'true')">true</RoslynCheckCodeStyle>
</PropertyGroup>
<PropertyGroup Condition="'$(DisableNullableWarnings)' == 'true'">
......
......@@ -17,7 +17,6 @@
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<ToolsetPackagesDir>$(RepoRoot)build\ToolsetPackages\</ToolsetPackagesDir>
<RoslynPortableTargetFrameworks>netcoreapp3.1;net472</RoslynPortableTargetFrameworks>
<RoslynCheckCodeStyle Condition="'$(ContinuousIntegrationBuild)' != 'true' or '$(RoslynEnforceCodeStyle)' == 'true'">true</RoslynCheckCodeStyle>
<UseSharedCompilation>true</UseSharedCompilation>
<Features>strict, IOperation</Features>
......@@ -149,14 +148,14 @@
<!-- Language-specific analyzer packages -->
<Choose>
<When Condition="'$(Language)' == 'VB' and '$(RoslynCheckCodeStyle)' == 'true'">
<ItemGroup>
<When Condition="'$(Language)' == 'VB'">
<ItemGroup Condition="'$(RoslynCheckCodeStyle)' == 'true'">
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.CodeStyle" Version="$(MicrosoftCodeAnalysisVisualBasicCodeStyleVersion)" PrivateAssets="all" />
</ItemGroup>
</When>
<When Condition="'$(Language)' == 'C#' and '$(RoslynCheckCodeStyle)' == 'true'">
<ItemGroup>
<When Condition="'$(Language)' == 'C#'">
<ItemGroup Condition="'$(RoslynCheckCodeStyle)' == 'true'">
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="$(MicrosoftCodeAnalysisCSharpCodeStyleVersion)" PrivateAssets="all" />
</ItemGroup>
</When>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册