Skip to content
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
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ stages:
steps:
- template: eng/pipelines/checkout-unix-task.yml

- script: ./eng/build.sh --solution Roslyn.slnx --restore --build --configuration Debug --prepareMachine --ci --binaryLog --runanalyzers --warnaserror /p:RoslynEnforceCodeStyle=true
- script: ./eng/build.sh --solution Roslyn.slnx --restore --build --configuration Debug --prepareMachine --ci --binaryLog --runanalyzers --warnaserror
displayName: Build with analyzers

- template: eng/pipelines/publish-logs.yml
Expand Down
2 changes: 1 addition & 1 deletion eng/make-bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ try {
# MSBuildAdditionalCommandLineArgs=
$args = "/p:TreatWarningsAsErrors=true /warnaserror /nologo /nodeReuse:false /p:Configuration=$configuration /v:m";
$args += " /p:RunAnalyzersDuringBuild=false /bl:$binaryLogFilePath"
$args += " /t:Pack /p:RoslynEnforceCodeStyle=false /p:DotNetUseShippingVersions=true /p:InitialDefineConstants=BOOTSTRAP"
$args += " /t:Pack /p:DotNetUseShippingVersions=true /p:InitialDefineConstants=BOOTSTRAP"
$args += " /p:PackageOutputPath=$output /p:NgenOptimization=false /p:PublishWindowsPdb=false"

if ($ci) {
Expand Down
25 changes: 12 additions & 13 deletions eng/targets/Imports.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
</ItemGroup>
</Target>

<!-- Keep builds fast by default, unless explicitly running the "Run Code Analysis" command. -->
<PropertyGroup Condition="'$(RunAnalyzersDuringBuild)' == ''">
<RunAnalyzersDuringBuild Condition="'$(RunCodeAnalysis)' == 'true'">true</RunAnalyzersDuringBuild>
<RunAnalyzersDuringBuild Condition="'$(RunAnalyzersDuringBuild)' == ''">false</RunAnalyzersDuringBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(RunAnalyzersDuringBuild)' != 'true'">
<!-- Don't treat FormattingAnalyzer as an error unless build analysis is enabled. -->
<WarningsNotAsErrors>$(WarningsNotAsErrors);IDE0055</WarningsNotAsErrors>
</PropertyGroup>

<PropertyGroup>
<FileAlignment>512</FileAlignment>

Expand Down Expand Up @@ -46,23 +57,11 @@
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>
<RoslynCheckCodeStyle Condition="'$(RoslynCheckCodeStyle)' == '' AND ('$(ContinuousIntegrationBuild)' != 'true' OR '$(RunAnalyzersDuringBuild)' == 'true')">true</RoslynCheckCodeStyle>

<EnforceCodeStyleInBuild Condition="'$(EnforceCodeStyleInBuild)' == '' AND '$(RoslynCheckCodeStyle)' == 'true'">true</EnforceCodeStyleInBuild>
</PropertyGroup>

<!--
PERF: Set default value for 'RunAnalyzersDuringBuild' to determine if analyzers should be executed.
Default to 'false' in all non-CI builds to improve local build time (i.e. csc/vbc invocations both inside Visual Studio and from command line prompt), except if:
1. We are enforcing code style, i.e. '$(RoslynEnforceCodeStyle)' == 'true' OR
2. We are explicitly running code analysis via "Run Code Analysis" command, i.e. '$(RunCodeAnalysis)' == 'true'.
Otherwise, default to 'true'.
-->
<PropertyGroup Condition="'$(RunAnalyzersDuringBuild)' == ''">
<RunAnalyzersDuringBuild Condition="'$(RoslynEnforceCodeStyle)' != 'true' AND '$(RunCodeAnalysis)' != 'true'">false</RunAnalyzersDuringBuild>
<RunAnalyzersDuringBuild Condition="'$(RunAnalyzersDuringBuild)' == ''">true</RunAnalyzersDuringBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(DisableNullableWarnings)' == 'true'">
<NoWarn>$(NoWarn);Nullable</NoWarn>
</PropertyGroup>
Expand Down
5 changes: 0 additions & 5 deletions eng/targets/Settings.props
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@
<GeneratePerformanceSensitiveAttribute>false</GeneratePerformanceSensitiveAttribute>
</PropertyGroup>

<PropertyGroup Condition="'$(RoslynEnforceCodeStyle)' != 'true'">
<!-- Don't treat FormattingAnalyzer as an error, even when TreatWarningsAsErrors is specified. -->
<WarningsNotAsErrors>$(WarningsNotAsErrors);IDE0055</WarningsNotAsErrors>
</PropertyGroup>

<!--
Language specific settings
-->
Expand Down
2 changes: 1 addition & 1 deletion eng/test-build-correctness.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ try {
}

Write-Host "Building Roslyn"
& eng/build.ps1 -restore -build -bootstrapDir:$bootstrapDir -ci:$ci -prepareMachine:$prepareMachine -runAnalyzers:$true -configuration:$configuration -pack -binaryLog -useGlobalNuGetCache:$false -warnAsError:$true -properties:"/p:RoslynEnforceCodeStyle=true"
& eng/build.ps1 -restore -build -bootstrapDir:$bootstrapDir -ci:$ci -prepareMachine:$prepareMachine -runAnalyzers:$true -configuration:$configuration -pack -binaryLog -useGlobalNuGetCache:$false -warnAsError:$true
Test-LastExitCode

Subst-TempDir
Expand Down
2 changes: 1 addition & 1 deletion eng/validate-roslyn-sdk-samples.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $buildArgs = @(
"-c", $configuration
"--no-incremental"
"--warnaserror"
"/p:RoslynEnforceCodeStyle=true"
"/p:RunAnalyzersDuringBuild=true"
)

if ($ci) {
Expand Down
2 changes: 1 addition & 1 deletion eng/validate-rules-missing-documentation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ try {
$prepareMachine = $ci

$projectFilePath = Join-Path $RepoRoot "src\Features\Core\Portable\Microsoft.CodeAnalysis.Features.csproj"
Exec-DotNet "build $projectFilePath -t:GenerateRulesMissingDocumentation -p:RoslynEnforceCodeStyle=false -p:RunAnalyzersDuringBuild=false -p:ContinuousIntegrationBuild=$ci -c Release"
Exec-DotNet "build $projectFilePath -t:GenerateRulesMissingDocumentation -p:RunAnalyzersDuringBuild=false -p:ContinuousIntegrationBuild=$ci -c Release"
}
catch {
Write-Host $_
Expand Down
Loading