Replace legacy StyleCop(Plus) with StyleCopAnalyzers

Analyzers are enabled in the Debug configuration
only to avoid unnecessary overheads when compiling
normally.
This commit is contained in:
Paul Chote
2019-05-03 21:25:28 +00:00
committed by reaperrr
parent 353db73381
commit ba282865f1
20 changed files with 159 additions and 582 deletions

View File

@@ -16,6 +16,7 @@
<PlatformTarget>x86</PlatformTarget>
<ExternalConsole>false</ExternalConsole>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<CodeAnalysisRuleSet>..\OpenRA.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<!-- Work around an issue where Rider does not detect files in the project root using the default glob -->
@@ -61,7 +62,15 @@
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<None Include="App.config" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
<AdditionalFiles Include="../stylecop.json" />
</ItemGroup>
<Target Name="DisableAnalyzers" BeforeTargets="CoreCompile" Condition="'$(Configuration)'=='Release'">
<!-- Disable code style analysis on Release builds to improve compile-time performance -->
<ItemGroup Condition="'$(Configuration)'=='Release'">
<Analyzer Remove="@(Analyzer)"/>
</ItemGroup>
</Target>
<Target Name="PostProcess" AfterTargets="Build" Inputs="$(TargetPath)" Outputs="$(IntermediateOutputPath)\$(TargetFileName).processed">
<Exec Command="$(TargetDir)/OpenRA.PostProcess.exe $(TargetPath) -LAA" />
<Touch Files="$(IntermediateOutputPath)\$(TargetFileName).processed" AlwaysCreate="true" />