diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 78fd76c605acc..b3d3c477fd173 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -396,14 +396,13 @@ stages: - script: eng/validate-rules-missing-documentation.cmd -ci displayName: Validate rules missing documentation - - task: PowerShell@2 + - pwsh: | + ./eng/generate-compiler-code.ps1 -test -configuration Release displayName: Generate Syntax Files - inputs: - filePath: eng/generate-compiler-code.ps1 - arguments: -test -configuration Release condition: or(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['compilerChange'], 'true')) - - script: $(Build.SourcesDirectory)\.dotnet\dotnet.exe tool run dotnet-format whitespace $(Build.SourcesDirectory)\src --folder --include-generated --include $(Build.SourcesDirectory)\src\Compilers\CSharp\Portable\Generated\ $(Build.SourcesDirectory)\src\Compilers\VisualBasic\Portable\Generated\ $(Build.SourcesDirectory)\src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\Generated\ --verify-no-changes + - pwsh: | + ./eng/validate-code-formatting.ps1 -rootDirectory $(Build.SourcesDirectory)\src -includeDirectories Compilers\CSharp\Portable\Generated\, Compilers\VisualBasic\Portable\Generated\, ExpressionEvaluator\VisualBasic\Source\ResultProvider\Generated\ displayName: Validate Generated Syntax Files condition: or(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['compilerChange'], 'true')) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 9d934abbc5d71..bdc21afbd2dc1 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -26,7 +26,7 @@ --> - $(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Roslyn.sln" + $(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)Roslyn.sln" diff --git a/eng/build.ps1 b/eng/build.ps1 index 60ad0f0364aec..7bfdf49d1b4ed 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -739,8 +739,7 @@ try { Setup-IntegrationTestRun } - $global:_DotNetInstallDir = Join-Path $RepoRoot ".dotnet" - InstallDotNetSdk $global:_DotNetInstallDir $GlobalJson.tools.dotnet + $dotnet = (InitializeDotNetCli -install:$true) } if ($restore) { diff --git a/eng/generate-compiler-code.ps1 b/eng/generate-compiler-code.ps1 index 103c871e5203e..7dc68f68088ed 100644 --- a/eng/generate-compiler-code.ps1 +++ b/eng/generate-compiler-code.ps1 @@ -41,7 +41,7 @@ function Run-LanguageCore($language, $languageSuffix, $languageDir, $syntaxProje # in code with the freshly generated code. function Test-GeneratedContent($generatedDir, $scratchDir) { $algo = "MD5" - foreach ($fileName in (Get-ChildItem $scratchDir)) { + foreach ($fileName in (Get-ChildItem $scratchDir | Select-Object -ExpandProperty Name)) { Write-Host "Checking $fileName" $realFilePath = Join-Path $generatedDir $fileName $scratchFilePath = Join-Path $scratchDir $fileName diff --git a/eng/validate-code-formatting.ps1 b/eng/validate-code-formatting.ps1 new file mode 100644 index 0000000000000..203f7c36a4069 --- /dev/null +++ b/eng/validate-code-formatting.ps1 @@ -0,0 +1,23 @@ +param ( + [string]$rootDirectory, + [string[]]$includeDirectories +) +Set-StrictMode -version 2.0 +$ErrorActionPreference="Stop" + +try { + . (Join-Path $PSScriptRoot "build-utils.ps1") + Push-Location $RepoRoot + + $dotnet = Ensure-DotnetSdk + Exec-Console $dotnet "tool run dotnet-format -v detailed whitespace $rootDirectory --folder --include-generated --include $includeDirectories --verify-no-changes" + + exit 0 +} +catch { + Write-Host $_ + exit 1 +} +finally { + Pop-Location +} \ No newline at end of file diff --git a/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj b/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj index 3ceece94551d2..3fc35afcd3c36 100644 --- a/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj +++ b/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj @@ -9,6 +9,7 @@ true Microsoft.CodeAnalysis.Test.Utilities This is an internal package for testing. Not meant for external or production uses. The API can and will break at our discretion. + true diff --git a/src/Compilers/Test/Resources/Core/Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj b/src/Compilers/Test/Resources/Core/Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj index 5251b4c1ca971..2a0b813558582 100644 --- a/src/Compilers/Test/Resources/Core/Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj +++ b/src/Compilers/Test/Resources/Core/Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj @@ -11,6 +11,7 @@ Microsoft.CodeAnalysis.Compiler.Test.Resources This is an internal package for testing. Not meant for external or production uses. The API can and will break at our discretion. $(NoWarn),NU5100,NU5106,CS1591 + true diff --git a/src/Compilers/Test/Utilities/CSharp/Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj b/src/Compilers/Test/Utilities/CSharp/Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj index bf6739b1760e9..aed021b5be1eb 100644 --- a/src/Compilers/Test/Utilities/CSharp/Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj +++ b/src/Compilers/Test/Utilities/CSharp/Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj @@ -10,6 +10,7 @@ true true false + true diff --git a/src/Compilers/Test/Utilities/VisualBasic/Microsoft.CodeAnalysis.VisualBasic.Test.Utilities.vbproj b/src/Compilers/Test/Utilities/VisualBasic/Microsoft.CodeAnalysis.VisualBasic.Test.Utilities.vbproj index 22e513184a000..fed0d0fc53f8b 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/Microsoft.CodeAnalysis.VisualBasic.Test.Utilities.vbproj +++ b/src/Compilers/Test/Utilities/VisualBasic/Microsoft.CodeAnalysis.VisualBasic.Test.Utilities.vbproj @@ -7,6 +7,7 @@ $(NoWarn);42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 $(NetRoslynAll);net472 false + true diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities.csproj b/src/EditorFeatures/DiagnosticsTestUtilities/Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities.csproj index d68c1365366d7..cac2a126593c0 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities.csproj +++ b/src/EditorFeatures/DiagnosticsTestUtilities/Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities.csproj @@ -8,6 +8,7 @@ true true false + true diff --git a/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj b/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj index fdc90eda7c394..92ce200e548e3 100644 --- a/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj +++ b/src/EditorFeatures/TestUtilities/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities.csproj @@ -8,6 +8,7 @@ true true false + true diff --git a/src/EditorFeatures/TestUtilities2/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2.vbproj b/src/EditorFeatures/TestUtilities2/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2.vbproj index e2d5d19866d35..c0ecc50e7ca54 100644 --- a/src/EditorFeatures/TestUtilities2/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2.vbproj +++ b/src/EditorFeatures/TestUtilities2/Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2.vbproj @@ -7,6 +7,7 @@ true false + true diff --git a/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/Microsoft.CodeAnalysis.ExpressionCompiler.Utilities.csproj b/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/Microsoft.CodeAnalysis.ExpressionCompiler.Utilities.csproj index e062360b25301..ef11010523056 100644 --- a/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/Microsoft.CodeAnalysis.ExpressionCompiler.Utilities.csproj +++ b/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/Microsoft.CodeAnalysis.ExpressionCompiler.Utilities.csproj @@ -8,6 +8,7 @@ true net472 false + true diff --git a/src/ExpressionEvaluator/Core/Test/ResultProvider/Microsoft.CodeAnalysis.ResultProvider.Utilities.csproj b/src/ExpressionEvaluator/Core/Test/ResultProvider/Microsoft.CodeAnalysis.ResultProvider.Utilities.csproj index df44ed3bb2df8..adcdaecca3b78 100644 --- a/src/ExpressionEvaluator/Core/Test/ResultProvider/Microsoft.CodeAnalysis.ResultProvider.Utilities.csproj +++ b/src/ExpressionEvaluator/Core/Test/ResultProvider/Microsoft.CodeAnalysis.ResultProvider.Utilities.csproj @@ -8,6 +8,7 @@ true net472 false + true $(NoWarn);CA1825 diff --git a/src/Features/DiagnosticsTestUtilities/Microsoft.CodeAnalysis.Features.DiagnosticsTests.Utilities.csproj b/src/Features/DiagnosticsTestUtilities/Microsoft.CodeAnalysis.Features.DiagnosticsTests.Utilities.csproj index 7b8886d5537fd..bf970ecc5d708 100644 --- a/src/Features/DiagnosticsTestUtilities/Microsoft.CodeAnalysis.Features.DiagnosticsTests.Utilities.csproj +++ b/src/Features/DiagnosticsTestUtilities/Microsoft.CodeAnalysis.Features.DiagnosticsTests.Utilities.csproj @@ -7,6 +7,7 @@ $(NetRoslynAll);net472 true false + true true diff --git a/src/Features/TestUtilities/Microsoft.CodeAnalysis.Features.Test.Utilities.csproj b/src/Features/TestUtilities/Microsoft.CodeAnalysis.Features.Test.Utilities.csproj index 82b1dcf476dfe..97bbe469279d1 100644 --- a/src/Features/TestUtilities/Microsoft.CodeAnalysis.Features.Test.Utilities.csproj +++ b/src/Features/TestUtilities/Microsoft.CodeAnalysis.Features.Test.Utilities.csproj @@ -7,6 +7,7 @@ $(NetRoslynAll);net472 true false + true true diff --git a/src/NuGet/VS.ExternalAPIs.Roslyn.Package/VS.ExternalAPIs.Roslyn.Package.csproj b/src/NuGet/VS.ExternalAPIs.Roslyn.Package/VS.ExternalAPIs.Roslyn.Package.csproj index 49a4b6546224f..26fd9c2b593f4 100644 --- a/src/NuGet/VS.ExternalAPIs.Roslyn.Package/VS.ExternalAPIs.Roslyn.Package.csproj +++ b/src/NuGet/VS.ExternalAPIs.Roslyn.Package/VS.ExternalAPIs.Roslyn.Package.csproj @@ -19,6 +19,10 @@ "The assembly '...' is not inside the 'lib' folder and hence it won't be added as a reference when the package is installed into a project." --> $(NoWarn);NU5100 + + + true diff --git a/src/Scripting/CoreTestUtilities/Microsoft.CodeAnalysis.Scripting.TestUtilities.csproj b/src/Scripting/CoreTestUtilities/Microsoft.CodeAnalysis.Scripting.TestUtilities.csproj index dd81f2e12f2aa..8f4f5897a7906 100644 --- a/src/Scripting/CoreTestUtilities/Microsoft.CodeAnalysis.Scripting.TestUtilities.csproj +++ b/src/Scripting/CoreTestUtilities/Microsoft.CodeAnalysis.Scripting.TestUtilities.csproj @@ -8,6 +8,7 @@ true false true + true diff --git a/src/Setup/DevDivVsix/CompilersPackage/CompilersPackage.targets b/src/Setup/DevDivVsix/CompilersPackage/CompilersPackage.targets index bec9c7c8e1d33..c22e09356a7a3 100644 --- a/src/Setup/DevDivVsix/CompilersPackage/CompilersPackage.targets +++ b/src/Setup/DevDivVsix/CompilersPackage/CompilersPackage.targets @@ -42,12 +42,13 @@ + + Condition="'$(DotNetBuildFromSource)' != 'true' and '$(DotNetBuildVertical)' != 'true'"> <_File Include="@(DesktopCompilerArtifact)"> diff --git a/src/Setup/Directory.Build.props b/src/Setup/Directory.Build.props index 6eef643958f56..626a4bb54df8f 100644 --- a/src/Setup/Directory.Build.props +++ b/src/Setup/Directory.Build.props @@ -2,5 +2,8 @@ true + + true diff --git a/src/Test/PdbUtilities/Roslyn.Test.PdbUtilities.csproj b/src/Test/PdbUtilities/Roslyn.Test.PdbUtilities.csproj index 0df9d36d6826e..cb0d871ff502d 100644 --- a/src/Test/PdbUtilities/Roslyn.Test.PdbUtilities.csproj +++ b/src/Test/PdbUtilities/Roslyn.Test.PdbUtilities.csproj @@ -7,6 +7,7 @@ $(NetRoslynAll);net472 true false + true diff --git a/src/Tools/Directory.Build.props b/src/Tools/Directory.Build.props index 6eef643958f56..7a33369502ccf 100644 --- a/src/Tools/Directory.Build.props +++ b/src/Tools/Directory.Build.props @@ -2,5 +2,8 @@ true + + true diff --git a/src/Tools/ExternalAccess/AspNetCore/Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.csproj b/src/Tools/ExternalAccess/AspNetCore/Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.csproj index e6b26cb87368b..4c192bd16e9a5 100644 --- a/src/Tools/ExternalAccess/AspNetCore/Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.csproj +++ b/src/Tools/ExternalAccess/AspNetCore/Microsoft.CodeAnalysis.ExternalAccess.AspNetCore.csproj @@ -12,8 +12,9 @@ A supporting package for ASP.NET Core: https://github.com/dotnet/aspnetcore - + false + false diff --git a/src/Tools/ExternalAccess/Razor/Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj b/src/Tools/ExternalAccess/Razor/Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj index 54f8e62b5a5f1..87319aa37c61b 100644 --- a/src/Tools/ExternalAccess/Razor/Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj +++ b/src/Tools/ExternalAccess/Razor/Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj @@ -12,6 +12,7 @@ A supporting package for Razor: https://github.com/dotnet/razor + false diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/CSharpSyntaxGenerator.csproj b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/CSharpSyntaxGenerator.csproj index e1794e71faf05..97d750e0ed4b7 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/CSharpSyntaxGenerator.csproj +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/CSharpSyntaxGenerator.csproj @@ -10,6 +10,7 @@ $(RoslynPortableRuntimeIdentifiers) false false + false diff --git a/src/Tools/Source/RunTests/RunTests.csproj b/src/Tools/Source/RunTests/RunTests.csproj index 245e8fcd8cbba..2ef5a300de578 100644 --- a/src/Tools/Source/RunTests/RunTests.csproj +++ b/src/Tools/Source/RunTests/RunTests.csproj @@ -6,6 +6,7 @@ $(NetRoslyn) false false + true diff --git a/src/VisualStudio/Directory.Build.props b/src/VisualStudio/Directory.Build.props index 6eef643958f56..7a33369502ccf 100644 --- a/src/VisualStudio/Directory.Build.props +++ b/src/VisualStudio/Directory.Build.props @@ -2,5 +2,8 @@ true + + true diff --git a/src/VisualStudio/TestUtilities2/Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj b/src/VisualStudio/TestUtilities2/Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj index adc0bb659b430..fe756c77e4fdb 100644 --- a/src/VisualStudio/TestUtilities2/Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj +++ b/src/VisualStudio/TestUtilities2/Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj @@ -7,6 +7,7 @@ true false + true diff --git a/src/Workspaces/CoreTestUtilities/Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj b/src/Workspaces/CoreTestUtilities/Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj index 67e1cf5f9b163..8104ce5c97d0d 100644 --- a/src/Workspaces/CoreTestUtilities/Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj +++ b/src/Workspaces/CoreTestUtilities/Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj @@ -7,6 +7,7 @@ $(NetRoslynAll);net472 false true + true