diff --git a/.vsts-ci.yml b/.vsts-ci.yml index c2be89097a..59da97b2cf 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -15,7 +15,10 @@ steps: signType: real esrpSigning: true -- script: eng\common\CIBuild.cmd -configuration $(BuildConfiguration) +- script: eng\common\CIBuild.cmd + -configuration $(BuildConfiguration) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) displayName: Build - task: PublishTestResults@1 @@ -34,22 +37,6 @@ steps: connectedServiceName: 'RoslynAnalyzers NuGet feed' nuGetVersion: 4.0.0.2283 -- task: PublishSymbols@1 - displayName: Prepare Symbols - inputs: - SymbolsPath: '$(DropRoot)\$(TeamName)\$(Build.DefinitionName)\$(Build.BuildNumber)\Symbols' - SearchPattern: '**/*.dll;**/*.exe;**/*.pdb' - SymbolsFolder: '$(Build.SourcesDirectory)\artifacts\$(BuildConfiguration)\SymStore' - SkipIndexing: true - -- task: ms-vscs-artifact.build-tasks.artifactSymbolTask-1.artifactSymbolTask@0 - displayName: Publish Symbols - inputs: - symbolServiceURI: 'https://microsoft.artifacts.visualstudio.com/DefaultCollection' - requestName: '$(system.teamProject)/$(Build.DefinitionName)/$(Build.BuildNumber)/$(Build.BuildId)' - sourcePath: '$(DropRoot)\$(TeamName)\$(Build.DefinitionName)\$(Build.BuildNumber)\Symbols' - usePat: false - - task: CopyPublishBuildArtifacts@1 displayName: Publish Artifacts inputs: @@ -59,6 +46,7 @@ steps: artifacts\$(BuildConfiguration)\log artifacts\$(BuildConfiguration)\TestResults artifacts\$(BuildConfiguration)\packages + artifacts\$(BuildConfiguration)\SymStore artifacts\$(BuildConfiguration)\VSSetup ArtifactName: '$(Build.BuildNumber)' ArtifactType: FilePath diff --git a/Directory.Build.props b/Directory.Build.props index ca6653686f..bfa1e681a5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,10 @@ + false $(MSBuildThisFileDirectory)assets\ RoslynDev + + \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000000..a317ac3a54 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/RoslynAnalyzers.sln b/RoslynAnalyzers.sln index b38e8006d6..3e175be00e 100644 --- a/RoslynAnalyzers.sln +++ b/RoslynAnalyzers.sln @@ -138,6 +138,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{C0B86774 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Metrics", "src\Tools\Metrics.csproj", "{EEF553EA-1D3D-44A1-A334-1F9220698FB8}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenerateAnalyzerRulesets", "src\GenerateAnalyzerRulesets\GenerateAnalyzerRulesets.csproj", "{CC0DB31C-87B7-4ABF-A95A-B12526F3056D}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Utilities\Analyzer.Utilities.projitems*{ec946164-1e17-410b-b7d9-7de7e6268d63}*SharedItemsImports = 13 @@ -557,6 +559,14 @@ Global {EEF553EA-1D3D-44A1-A334-1F9220698FB8}.Release|Any CPU.Build.0 = Release|Any CPU {EEF553EA-1D3D-44A1-A334-1F9220698FB8}.Release|x86.ActiveCfg = Release|Any CPU {EEF553EA-1D3D-44A1-A334-1F9220698FB8}.Release|x86.Build.0 = Release|Any CPU + {CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Debug|x86.ActiveCfg = Debug|Any CPU + {CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Debug|x86.Build.0 = Debug|Any CPU + {CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Release|Any CPU.Build.0 = Release|Any CPU + {CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Release|x86.ActiveCfg = Release|Any CPU + {CC0DB31C-87B7-4ABF-A95A-B12526F3056D}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -614,6 +624,7 @@ Global {361CC818-460A-4250-AE67-7A8EFEA1938E} = {BBE0A1C9-3995-4BD1-995E-38DE862BE208} {EFC1EAEF-88A9-41DA-8EC9-0EB6C8A05027} = {BBE0A1C9-3995-4BD1-995E-38DE862BE208} {EEF553EA-1D3D-44A1-A334-1F9220698FB8} = {C0B86774-8307-444F-9EE4-98D62C3424F9} + {CC0DB31C-87B7-4ABF-A95A-B12526F3056D} = {C0B86774-8307-444F-9EE4-98D62C3424F9} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {FC44ACA9-AEA3-4EE6-881C-2E08ED281B5F} diff --git a/eng/GenerateAnalyzerNuspec.targets b/eng/GenerateAnalyzerNuspec.targets index 9129b6d105..5557205d8e 100644 --- a/eng/GenerateAnalyzerNuspec.targets +++ b/eng/GenerateAnalyzerNuspec.targets @@ -7,23 +7,37 @@ $(IntermediateOutputPath)$(NuspecPackageId).nuspec $(ArtifactsBinDir) - "$(ArtifactsBinDir)Rulesets\$(NuspecPackageId)" + $(ArtifactsBinDir)Rulesets\$(NuspecPackageId) + false + + + + + + + + + + - + - + + + Condition="'@(AnalyzerNupkgFile)' != '' or '@(AnalyzerNupkgAssembly)' != '' or '@(AnalyzerNupkgDependency)' != ''"> $(NuspecPackageId) @@ -46,6 +60,13 @@ <_NuspecMetadata Include="repositoryCommit=$(SourceRevisionId)" /> <_NuspecMetadata Include="repositoryUrl=$(PrivateRepositoryUrl)" /> - + + + <_CscToolPath>$(CscToolPath) + <_CscToolPath Condition="'$(_CscToolPath)' == ''">$(MSBuildBinPath)\Roslyn + <_CscToolPath Condition="!HasTrailingSlash('$(_CscToolPath)')">$(_CscToolPath)\ + + + \ No newline at end of file diff --git a/eng/Versions.props b/eng/Versions.props index ffa5db2ba9..705d6a4d15 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,15 +1,14 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - 2.6.2 beta3 true true + true 15.0.26201-alpha diff --git a/eng/common/CIBuild.cmd b/eng/common/CIBuild.cmd index c8b028240c..5ce687447c 100644 --- a/eng/common/CIBuild.cmd +++ b/eng/common/CIBuild.cmd @@ -1,4 +1,3 @@ @echo off -powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -projects """%~dp0..\GenerateAnalyzerRulesets\GenerateAnalyzerRulesets.csproj""" %*" -powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -ci %*" +powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*" exit /b %ErrorLevel% diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index ecddd356fd..f74d1226fd 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -10,8 +10,10 @@ Param( [switch] $deploy, [switch] $test, [switch] $integrationTest, + [switch] $performanceTest, [switch] $sign, [switch] $pack, + [switch] $publish, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -36,9 +38,11 @@ function Print-Usage() { Write-Host " -deploy Deploy built VSIXes" Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)" Write-Host " -test Run all unit tests in the solution" + Write-Host " -pack Package build outputs into NuGet packages and Willow components" Write-Host " -integrationTest Run all integration tests in the solution" + Write-Host " -performanceTest Run all performance tests in the solution" Write-Host " -sign Sign build outputs" - Write-Host " -pack Package build outputs into NuGet packages and Willow components" + Write-Host " -publish Publish artifacts (e.g. symbols)" Write-Host "" Write-Host "Advanced settings:" @@ -147,7 +151,36 @@ function LocateVisualStudio { return $vsInstallDir } -function InitializeToolset { +function GetBuildCommand() { + if ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) { + $dotnetRoot = InitializeDotNetCli + + # by default build with dotnet cli: + $buildDriver = Join-Path $dotnetRoot "dotnet.exe" + $buildArgs = "msbuild" + } + + if ((Get-Member -InputObject $GlobalJson -Name "vswhere") -ne $null) { + $vsInstallDir = InitializeVisualStudioBuild + + # Presence of vswhere.version indicates the repo needs to build using VS msbuild: + $buildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe" + $buildArgs = "/nodeReuse:$(!$ci)" + } + + if ($buildDriver -eq $null) { + Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red + exit 1 + } + + if ($ci) { + Write-Host "Using $buildDriver" + } + + return $buildDriver, $buildArgs +} + +function InitializeToolset([string] $buildDriver, [string]$buildArgs) { $toolsetVersion = $GlobalJson.'msbuild-sdks'.'RoslynTools.RepoToolset' $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" @@ -167,10 +200,10 @@ function InitializeToolset { $proj = Join-Path $ToolsetDir "restore.proj" '' | Set-Content $proj - & $BuildDriver $BuildArgs $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$ToolsetRestoreLog /v:$verbosity /p:__ToolsetLocationOutputFile=$toolsetLocationFile + & $buildDriver $buildArgs $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$ToolsetRestoreLog /v:$verbosity /p:__ToolsetLocationOutputFile=$toolsetLocationFile if ($lastExitCode -ne 0) { - Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -Color Red + Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -ForegroundColor Red Write-Host "Build log: $ToolsetRestoreLog" -ForegroundColor DarkGray exit $lastExitCode } @@ -195,8 +228,28 @@ function InitializeCustomToolset { } } -function Build { - & $BuildDriver $BuildArgs $ToolsetBuildProj /m /nologo /clp:Summary /warnaserror /v:$verbosity /bl:$BuildLog /p:Configuration=$configuration /p:Projects=$projects /p:RepoRoot=$RepoRoot /p:Restore=$restore /p:DeployDeps=$deployDeps /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:IntegrationTest=$integrationTest /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci $properties +function Build([string] $buildDriver, [string]$buildArgs) { + & $buildDriver $buildArgs $ToolsetBuildProj ` + /m /nologo /clp:Summary /warnaserror ` + /v:$verbosity ` + /bl:$BuildLog ` + /p:Configuration=$configuration ` + /p:Projects=$projects ` + /p:RepoRoot=$RepoRoot ` + /p:Restore=$restore ` + /p:DeployDeps=$deployDeps ` + /p:Build=$build ` + /p:Rebuild=$rebuild ` + /p:Deploy=$deploy ` + /p:Test=$test ` + /p:Pack=$pack ` + /p:IntegrationTest=$integrationTest ` + /p:PerformanceTest=$performanceTest ` + /p:Sign=$sign ` + /p:Publish=$publish ` + /p:CIBuild=$ci ` + $properties + if ($lastExitCode -ne 0) { Write-Host "Build log: $BuildLog" -ForegroundColor DarkGray exit $lastExitCode @@ -240,36 +293,11 @@ try { $env:TEMP = $TempDir $env:TMP = $TempDir } - - if ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) { - $dotnetRoot = InitializeDotNetCli - - # by default build with dotnet cli: - $BuildDriver = Join-Path $dotnetRoot "dotnet.exe" - $BuildArgs = "msbuild" - } - - if ((Get-Member -InputObject $GlobalJson -Name "vswhere") -ne $null) { - $vsInstallDir = InitializeVisualStudioBuild - - # Presence of vswhere.version indicates the repo needs to build using VS msbuild: - $BuildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe" - $BuildArgs = "/nodeReuse:$(!$ci)" - } - - if ($BuildDriver -eq $null) { - Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red - exit 1 - } - if ($ci) { - Write-Host "Using $BuildDriver" - } - - InitializeToolset + $driver, $args = GetBuildCommand + InitializeToolset $driver $args InitializeCustomToolset - - Build + Build $driver $args } catch { Write-Host $_ diff --git a/eng/common/build.sh b/eng/common/build.sh index fd0418d8ce..f1b767e412 100644 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -12,17 +12,21 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -build=false -ci=false -configuration='Debug' help=false -pack=false -prepare_machine=false -rebuild=false restore=false +build=false +rebuild=false +test=false +pack=false +integration_test=false +performance_test=false sign=false +public=false +ci=false + projects='' -test=false +configuration='Debug' +prepare_machine=false verbosity='minimal' properties='' @@ -105,6 +109,18 @@ while (($# > 0)); do test=true shift 1 ;; + --integrationtest) + integration_test=true + shift 1 + ;; + --performancetest) + performance_test=true + shift 1 + ;; + --publish) + publish=true + shift 1 + ;; --verbosity) verbosity=$2 shift 2 @@ -249,9 +265,24 @@ function InitializeCustomToolset { } function Build { - "$build_driver" msbuild $toolset_build_proj /m /nologo /clp:Summary /warnaserror \ - /v:$verbosity /bl:$build_log /p:Configuration=$configuration /p:Projects=$projects /p:RepoRoot="$repo_root" \ - /p:Restore=$restore /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci \ + "$build_driver" msbuild $toolset_build_proj \ + /m /nologo /clp:Summary /warnaserror \ + /v:$verbosity \ + /bl:$build_log \ + /p:Configuration=$configuration \ + /p:Projects=$projects \ + /p:RepoRoot="$repo_root" \ + /p:Restore=$restore \ + /p:Build=$build \ + /p:Rebuild=$rebuild \ + /p:Deploy=$deploy \ + /p:Test=$test \ + /p:Pack=$pack \ + /p:IntegrationTest=$integration_test \ + /p:PerformanceTest=$performance_test \ + /p:Sign=$sign \ + /p:Publish=$publish \ + /p:CIBuild=$ci \ $properties local lastexitcode=$? diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh index b5112539e7..1a02c0dec8 100644 --- a/eng/common/cibuild.sh +++ b/eng/common/cibuild.sh @@ -13,4 +13,4 @@ while [[ -h $source ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -. "$scriptroot/build.sh" --restore --build --test --ci $@ \ No newline at end of file +. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@ \ No newline at end of file diff --git a/global.json b/global.json index 442674a978..4386d03974 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "version": "2.1.300-rtm-008866" }, "msbuild-sdks": { - "RoslynTools.RepoToolset": "1.0.0-beta2-62922-02" + "RoslynTools.RepoToolset": "1.0.0-beta2-63011-08" }, "vswhere": { "version": "2.2.7" diff --git a/nuget.config b/nuget.config index 17bcf4387c..1b0fc7e286 100644 --- a/nuget.config +++ b/nuget.config @@ -2,7 +2,7 @@ - + diff --git a/nuget/Directory.Build.props b/nuget/Directory.Build.props deleted file mode 100644 index d6ddba81dc..0000000000 --- a/nuget/Directory.Build.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - - - - - false - - - - \ No newline at end of file diff --git a/nuget/Directory.Build.targets b/nuget/Directory.Build.targets index 9c996be5f6..606960e691 100644 --- a/nuget/Directory.Build.targets +++ b/nuget/Directory.Build.targets @@ -1,16 +1,5 @@ - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - - + - - - - - - - \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 8ab111e407..ea083bae98 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,12 +1,6 @@ - - - false - - - diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 017aaad137..254541f136 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -30,7 +30,7 @@ - + diff --git a/eng/GenerateAnalyzerRulesets/GenerateAnalyzerRulesets.csproj b/src/GenerateAnalyzerRulesets/GenerateAnalyzerRulesets.csproj similarity index 55% rename from eng/GenerateAnalyzerRulesets/GenerateAnalyzerRulesets.csproj rename to src/GenerateAnalyzerRulesets/GenerateAnalyzerRulesets.csproj index 2bd9dc40a8..b0e1870053 100644 --- a/eng/GenerateAnalyzerRulesets/GenerateAnalyzerRulesets.csproj +++ b/src/GenerateAnalyzerRulesets/GenerateAnalyzerRulesets.csproj @@ -1,10 +1,4 @@ - - - false - - - - + Exe netcoreapp2.0 diff --git a/eng/GenerateAnalyzerRulesets/Program.cs b/src/GenerateAnalyzerRulesets/Program.cs similarity index 96% rename from eng/GenerateAnalyzerRulesets/Program.cs rename to src/GenerateAnalyzerRulesets/Program.cs index f9696ffbd6..5f71a74869 100644 --- a/eng/GenerateAnalyzerRulesets/Program.cs +++ b/src/GenerateAnalyzerRulesets/Program.cs @@ -14,11 +14,12 @@ namespace GenerateAnalyzerRulesets { class Program { - public static void Main(string[] args) + public static int Main(string[] args) { if (args.Length != 4) { - throw new ArgumentException($"Excepted 4 arguments, found {args.Length}: {string.Join(';', args)}"); + Console.Error.WriteLine($"Excepted 4 arguments, found {args.Length}: {string.Join(';', args)}"); + return 1; } string analyzerRulesetsDir = args[0]; @@ -34,7 +35,8 @@ public static void Main(string[] args) string path = Path.Combine(analyzerRulesetsDir, @"..\..", assemblyName, tfm, assembly); if (!File.Exists(path)) { - throw new ArgumentException($"{path} does not exist", "assemblyList"); + Console.Error.WriteLine($"'{path}' does not exist"); + return 1; } var analyzerFileReference = new AnalyzerFileReference(path, AnalyzerAssemblyLoader.Instance); @@ -230,6 +232,8 @@ string getRuleActionCore(bool enable) } } } + + return 0; } private enum RulesetKind