Refactor enable Roslyn Analyzers flag

kept the old name, but turns out `-p:RunAnalyzersDuringBuild=true` also works
...good thing the old name wasn't documented
This commit is contained in:
YoshiRulz 2023-03-16 10:42:52 +10:00
parent c816400e54
commit 38b5f16ccc
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
7 changed files with 8 additions and 6 deletions

View File

@ -101,7 +101,7 @@ check_style:
script:
- cd src/BizHawk.Version
- dotnet build -c Release # configuration doesn't really matter as the assembly is empty
- ../../Dist/BuildRelease.sh -p:MachineRunAnalyzersDuringBuild=true
- ../../Dist/BuildRelease.sh -p:RunAnalyzersDuringBuild=true
stage: test
.disabled_job_infersharp:

View File

@ -11,7 +11,7 @@
<NoWarn>SA0001</NoWarn>
<Nullable>enable</Nullable>
<PlatformTarget>AnyCPU</PlatformTarget>
<RunAnalyzersDuringBuild Condition=" '$(MachineRunAnalyzersDuringBuild)' == '' ">false</RunAnalyzersDuringBuild>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">

View File

@ -12,7 +12,7 @@ git --version > NUL
dotnet build ..\BizHawk.sln -c Release --no-incremental
@if not errorlevel 0 goto DOTNETBUILDFAILED
rem -p:Platform="Any CPU"
rem -p:MachineRunAnalyzersDuringBuild=true
rem -p:RunAnalyzersDuringBuild=true
rem we have to do this twice right now
dotnet build ..\BizHawk.sln -c Release

View File

@ -2,7 +2,6 @@
<Import Project="../Common.props" />
<PropertyGroup>
<NoWarn>$(NoWarn);SA1200</NoWarn>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
</PropertyGroup>
<ItemGroup>
<None Remove="*.sh" />

View File

@ -2,7 +2,6 @@
<Import Project="../Common.props" />
<PropertyGroup>
<OutputPath>$(ProjectDir)bin/$(Configuration)/</OutputPath>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
</PropertyGroup>
<ItemGroup>
<None Remove="*.sh" />

View File

@ -114,7 +114,8 @@ On the command-line, from root of the repo run `Dist/BuildRelease.sh` (Unix) or
There are 2 build configurations. Besides `Release` there is `Debug`, which *does not run* bytecode optimisations, *does not remove* debugging symbols, *enables* additional logging and assertions, and *enables* some features. On Windows, a `Debug` executable will spawn a console window for stdout. Note there is also a "stronger" release build in the form of `VersionInfo.DeveloperBuild == false`, which is only used by GitLab CI for preparing a release (during `Dist/UpdateVersionInfoForRelease.sh`).
We have an automated test suite in the solution which runs in CI, though you can and should run it before pushing.
There are also various Analyzers (static code analysis plugins) for detecting common mistakes and checking code style. Not every style rule is currently enabled, so please make sure you use CRLF, tabs, and [Allman braces](https://en.wikipedia.org/wiki/Indentation_style#Allman_style) (but don't try to fix code you're not working on).
There are also [various Analyzers](https://github.com/TASEmulators/BizHawk/wiki/Roslyn-Analyzers-(third-party)) (static code analysis plugins) for detecting common mistakes and checking code style. These are disabled by default for the main solution; pass `-p:RunAnalyzersDuringBuild=true` to the build script, or set the env. var `MachineRunAnalyzersDuringBuild=1`.
In addition, not every style rule is currently enabled, so please make sure you use CRLF, tabs, and [Allman braces](https://en.wikipedia.org/wiki/Indentation_style#Allman_style) (but don't try to fix code you're not working on).
There are additional test suites specifically for regression-testing cores—these are not included in the solution and need to be run manually. See [the base project's readme](https://github.com/TASEmulators/BizHawk/blob/master/src/BizHawk.Tests.Testroms.GB/readme.md) for details.

View File

@ -10,6 +10,9 @@
<OutputPath>$(ProjectDir)../../output/dll</OutputPath>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<PropertyGroup Condition=" '$(MachineRunAnalyzersDuringBuild)' == '' ">
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
</PropertyGroup>
<ItemGroup>
<Analyzer Include="$(ProjectDir)../../References/BizHawk.SrcGen.ReflectionCache.dll" />
</ItemGroup>