From fd0dffd37893b7ac88e57e9f1f9bb6afda1a78b8 Mon Sep 17 00:00:00 2001 From: Mark Wilkie Date: Tue, 24 Jul 2018 15:54:17 -0700 Subject: [PATCH 0001/2702] Initial commit --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000000..f6b64dc48f6b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 .NET Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 9584dedeec3531f03ed1258c853e7b692e5e6947 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Tue, 24 Jul 2018 17:45:10 -0700 Subject: [PATCH 0002/2702] Initialize repository --- .gitignore | 329 ++++++++++++++++++++++++ Documentation.md | 5 + HelloWorld/HelloWorld.sln | 25 ++ HelloWorld/HelloWorld/HelloWorld.csproj | 8 + HelloWorld/HelloWorld/Program.cs | 16 ++ LICENSE => LICENSE.TXT | 8 +- README.md | 5 + THIRD-PARTY-NOTICES.TXT | 11 + 8 files changed, 404 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 Documentation.md create mode 100644 HelloWorld/HelloWorld.sln create mode 100644 HelloWorld/HelloWorld/HelloWorld.csproj create mode 100644 HelloWorld/HelloWorld/Program.cs rename LICENSE => LICENSE.TXT (91%) create mode 100644 README.md create mode 100644 THIRD-PARTY-NOTICES.TXT diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..f431ddc7cf5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,329 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ diff --git a/Documentation.md b/Documentation.md new file mode 100644 index 000000000000..b01c94019c45 --- /dev/null +++ b/Documentation.md @@ -0,0 +1,5 @@ +# Documentation + +1. Created a new repository on GitHub to test this whole VSTS integrated PR deal. +2. Created the default .NET Core console app project in Visual Studio which runs "Hello World" and committed it to the repository. +3. Since this test repository will not be doing internal builds (only PR and CI), we will not be creating a VSTS mirror of the repository. \ No newline at end of file diff --git a/HelloWorld/HelloWorld.sln b/HelloWorld/HelloWorld.sln new file mode 100644 index 000000000000..8d74c81f422e --- /dev/null +++ b/HelloWorld/HelloWorld.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27912.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{0D23A41B-2626-4703-9E4A-87C07F69B0B2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {56D5F4DA-F710-4026-8F49-4A903BCAA9B5} + EndGlobalSection +EndGlobal diff --git a/HelloWorld/HelloWorld/HelloWorld.csproj b/HelloWorld/HelloWorld/HelloWorld.csproj new file mode 100644 index 000000000000..23df6047ff5e --- /dev/null +++ b/HelloWorld/HelloWorld/HelloWorld.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/HelloWorld/HelloWorld/Program.cs b/HelloWorld/HelloWorld/Program.cs new file mode 100644 index 000000000000..88e13abbbafe --- /dev/null +++ b/HelloWorld/HelloWorld/Program.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace HelloWorld +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/LICENSE b/LICENSE.TXT similarity index 91% rename from LICENSE rename to LICENSE.TXT index f6b64dc48f6b..a616ed188dfc 100644 --- a/LICENSE +++ b/LICENSE.TXT @@ -1,6 +1,8 @@ -MIT License +The MIT License (MIT) -Copyright (c) 2018 .NET Foundation +Copyright (c) .NET Foundation and Contributors + +All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +20,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 000000000000..239d3592021c --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Arcade Minimal CI Sample + +This repository serves as an example of how to link GitHub repositories to VSTS for CI and PR builds. + +For progress updates, check the [Documentation](Documentation.md) page, where [@jonfortescue](https://github.com/jonfortescue) will be documenting his progress. Eventually, that will be merged into this README. \ No newline at end of file diff --git a/THIRD-PARTY-NOTICES.TXT b/THIRD-PARTY-NOTICES.TXT new file mode 100644 index 000000000000..859bd1a6d9cd --- /dev/null +++ b/THIRD-PARTY-NOTICES.TXT @@ -0,0 +1,11 @@ +.NET Core uses third-party libraries or other resources that may be +distributed under licenses different than the .NET Core software. + +In the event that we accidentally failed to list a required notice, please +bring it to our attention. Post an issue or email us: + + dotnet@microsoft.com + +The attached notices are provided for information only. + +No notices are provided at this time. \ No newline at end of file From bdcf50d0a2e425cd2c348e6badc2a8da5fb84a76 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Tue, 24 Jul 2018 20:25:19 -0700 Subject: [PATCH 0003/2702] Add sample CI file --- .vsts-ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .vsts-ci.yml diff --git a/.vsts-ci.yml b/.vsts-ci.yml new file mode 100644 index 000000000000..ecc3541b88e7 --- /dev/null +++ b/.vsts-ci.yml @@ -0,0 +1,29 @@ +# Sample VSTS CI file + +queue: 'Helix' +variables: + buildConfiguration: 'Release' + +steps: + + - task: DotNetCoreCLI@2 + inputs: + command: 'restore' + projects: '**/*.csproj' + displayName: dotnet restore + + - task: DotNetCoreCLI@2 + inputs: + command: 'build' + projects: '**/*.csproj' + arguments: '--configuration $(buildConfiguration)' + displayName: dotnet build + + - task: DotNetCoreCLI@2 + inputs: + command: 'publish' + arguments: '--configuration $(buildConfiguration) --output $(build.artifactStagingDirectory)' + displayName: dotnet publish + + - task: PublishBuildArtifacts@1 + displayName: Publish artifacts \ No newline at end of file From f778176483c35f0cb317eb36ff3e401dcc1c19a2 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Fri, 27 Jul 2018 16:14:09 -0700 Subject: [PATCH 0004/2702] Add roadmap (#2) --- Roadmap.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Roadmap.md diff --git a/Roadmap.md b/Roadmap.md new file mode 100644 index 000000000000..ae1c7869b43e --- /dev/null +++ b/Roadmap.md @@ -0,0 +1,20 @@ +# Roadmap + +This repository will serve as an example for all who wish to migrate to VSTS for their builds. Therefore, we want it to provide clear examples of common use cases. + +## Short Term +In the short term, we want to immediately fill the needs of [CoreCLR](https://github.com/dotnet/coreclr). This means that we will have a `.vsts-ci.yml` file which does the following: + +* Runs CI and PR builds +* Runs debug and release builds +* Runs builds on Windows, Linux, Macs, and in Docker containers +* Have a pretty CI badge link to show build status + +This should take advantage of YAML's templating and build-reason directives and generally should strive to be concise and efficient. + +## The Slightly Less Short Term +Over the next few weeks, the repository should be developed to show a fuller example of Arcade's capabilities: + +* Examples of plug & play telemetry +* Integration with and configuration of Maestro +* Consumption of Darc \ No newline at end of file From 2fe65e7d66c3b3cffe1799ccd030f1215c778b2e Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Thu, 2 Aug 2018 19:52:47 -0700 Subject: [PATCH 0005/2702] Add fully integrated CI and tutorial (#3) --- .vsts-ci.yml | 64 +++++++---- Documentation.md | 13 ++- HelloWorld/HelloWorld.sln => HelloWorld.sln | 0 HelloWorld/{HelloWorld => }/HelloWorld.csproj | 2 +- HelloWorld/{HelloWorld => }/Program.cs | 0 README.md | 103 +++++++++++++++++- eng/build.yml | 29 +++++ 7 files changed, 186 insertions(+), 25 deletions(-) rename HelloWorld/HelloWorld.sln => HelloWorld.sln (100%) rename HelloWorld/{HelloWorld => }/HelloWorld.csproj (68%) rename HelloWorld/{HelloWorld => }/Program.cs (100%) create mode 100644 eng/build.yml diff --git a/.vsts-ci.yml b/.vsts-ci.yml index ecc3541b88e7..bb87e5863aac 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -1,29 +1,49 @@ # Sample VSTS CI file - -queue: 'Helix' variables: - buildConfiguration: 'Release' + Build.Repository.Clean: true + targetFramework: netcoreapp2.0 -steps: +trigger: +- master - - task: DotNetCoreCLI@2 - inputs: - command: 'restore' - projects: '**/*.csproj' - displayName: dotnet restore +# To be added in the future when VSTS supports this feature +# pr: +# - master - - task: DotNetCoreCLI@2 - inputs: - command: 'build' - projects: '**/*.csproj' - arguments: '--configuration $(buildConfiguration)' - displayName: dotnet build +# Three phases for each of the three OSes we want to run on +phases: + - phase: Windows_NT + queue: + name: Helix + parallel: 99 + matrix: + debug_configuration: + _BuildConfig: Debug + release_configuration: + _BuildConfig: Release + steps: + - template: eng/build.yml - - task: DotNetCoreCLI@2 - inputs: - command: 'publish' - arguments: '--configuration $(buildConfiguration) --output $(build.artifactStagingDirectory)' - displayName: dotnet publish + - phase: OSX + queue: + name: Hosted macOS Preview + parallel: 99 + matrix: + debug_configuration: + _BuildConfig: Debug + release_configuration: + _BuildConfig: Release + steps: + - template: eng/build.yml - - task: PublishBuildArtifacts@1 - displayName: Publish artifacts \ No newline at end of file + - phase: Linux + queue: + name: DotNetCore-Linux + parallel: 99 + matrix: + debug_configuration: + _BuildConfig: Debug + release_configuration: + _BuildConfig: Release + steps: + - template: eng/build.yml \ No newline at end of file diff --git a/Documentation.md b/Documentation.md index b01c94019c45..9177ef9491ad 100644 --- a/Documentation.md +++ b/Documentation.md @@ -1,5 +1,16 @@ # Documentation +This documents [@jonfortescue](https://github.com/jonfortescue)'s process in creating this repository. + 1. Created a new repository on GitHub to test this whole VSTS integrated PR deal. 2. Created the default .NET Core console app project in Visual Studio which runs "Hello World" and committed it to the repository. -3. Since this test repository will not be doing internal builds (only PR and CI), we will not be creating a VSTS mirror of the repository. \ No newline at end of file +3. Since this test repository will not be doing internal builds (only PR and CI), we will not be creating a VSTS mirror of the repository. +4. Added a Windows queue with a basic set up for builds (use .NET CLI, run `restore`, `build`, `publish`). As part of troubleshooting this, added `Build.Repository.Clean: true` to the build to ensure binaries were cleaned from the build machine. Also added `targetFramework: netcoreapp2.0` as a build variable and referenced it during the `publish` step to prevent build breaks. +5. Use matrices to run debug and release builds in simultaneous phases +6. Broke out the build steps into a `build.yml` template to prepare for code reuse on step 7 +7. Added Linux and OSX queues. For the OSX queue, initially ran into authorization problem; issue was fixed following the steps detailed in [Arcade's VSTS Onboarding doc](https://github.com/dotnet/arcade/blob/master/Documentation/VSTS/VSTSOnboarding.md#Troubleshooting) under the section **Troubleshooting/Queuing builds** (second bullet point). +8. As part of troubleshooting step 7: added a step for installing the .NET CLI and ensured the most recent version was used (caused segfaults on Mac otherwise). Also added `DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1` and `DOTNET_MULTILEVEL_LOOKUP: 0` as environment variables for the `restore` step to prevent restoring the entire cache to the build machine. +9. Added `{{ if }}` directives for the publish step based on build configuration. As of right now, is not working. *TODO: update with fix when working*. +10. Added `Build.Reason` if-directives to prevent `Release` builds from running on pull requests. +11. Added a CI integration trigger linked to the `master` branch. +12. Added a CI build status badge to the Readme. \ No newline at end of file diff --git a/HelloWorld/HelloWorld.sln b/HelloWorld.sln similarity index 100% rename from HelloWorld/HelloWorld.sln rename to HelloWorld.sln diff --git a/HelloWorld/HelloWorld/HelloWorld.csproj b/HelloWorld/HelloWorld.csproj similarity index 68% rename from HelloWorld/HelloWorld/HelloWorld.csproj rename to HelloWorld/HelloWorld.csproj index 23df6047ff5e..fdda1c0209d7 100644 --- a/HelloWorld/HelloWorld/HelloWorld.csproj +++ b/HelloWorld/HelloWorld.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.1 + netcoreapp2.0 diff --git a/HelloWorld/HelloWorld/Program.cs b/HelloWorld/Program.cs similarity index 100% rename from HelloWorld/HelloWorld/Program.cs rename to HelloWorld/Program.cs diff --git a/README.md b/README.md index 239d3592021c..a8501633f5da 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,106 @@ # Arcade Minimal CI Sample + [![Build status](https://dotnet.visualstudio.com/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_apis/build/status/116?branchName=master)](https://dotnet.visualstudio.com/public/_build/latest?definitionId=116&branch=master) This repository serves as an example of how to link GitHub repositories to VSTS for CI and PR builds. -For progress updates, check the [Documentation](Documentation.md) page, where [@jonfortescue](https://github.com/jonfortescue) will be documenting his progress. Eventually, that will be merged into this README. \ No newline at end of file +## Before You Start +You'll want to start by following the [VSTS Onboarding](https://github.com/dotnet/arcade/blob/master/Documentation/VSTS/VSTSOnboarding.md) instructions, which provide a thorough, step-by-step list of instructions for creating VSTS CI builds for GitHub repos. From there, you'll find the [VSTS YAML documentation](https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted.md), which details the creation of VSTS CI YAML files. + +The purpose of this repository is to provide a jumping off point with an example YAML CI file that already has the basic architecture you'll want for your builds. All examples below are taken from this repository's [.vsts-ci.yml](.vsts-ci.yml). + +## Set build triggers in your YAML +Documentation on setting CI triggers in YAML can be found [here](https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-ci.md). The syntax for pull request triggers is identical, and will trigger whenever a PR is created merging into your specified branches. + +**Note: YAML-based PR triggers are a feature currently being rolled out by VSTS. Until they are completed, you must override the YAML PR trigger settings from the build definition GUI on VSTS.** + +```yaml +trigger: +- master + +# Commenting out until VSTS supports YAML PR triggers +# pr: +# - master +``` + +## Run builds on multiple operating systems with phases +VSTS uses **phases** to parallelize your builds. Each phase definition corresponds to a specific queue. Thus, if you would like to have builds run on Windows, OSX, and Linux, you will need to define three phases (each corresponding to a separate queue) as seen in the following example. + +```yaml +phases: + # Define a Windows phase + - phase: Windows + queue: + name: Helix # the Helix queue is currently the recommended queue for Windows builds + ... + + - phase: OSX + queue: + name: Hosted macOS Preview # as of Aug 2 2018 this is correct; in the future we will switch to a DotNetCore-Mac pool + ... + + - phase: Linux + queue: + name: DotNetCore-Linux + ... +``` + +## Use matrices to quickly create phases for different build configurations +VSTS supports using a **matrix** in a phase definition to quickly create several different phases on the same queue with slightly different build configurations. This is the recommended way to quickly add debug and release configuration builds. + +```yaml +- phase: Windows + queue: + name: Helix + parallel: 99 + matrix: + debug_configuration: + _BuildConfig: Debug + release_configuration: + _BuildConfig: Release +``` + +The variable defined in this matrix (in this case, `_BuildConfig`) can later be referenced in your build steps: + +```yaml +- task: DotNetCoreCLI@2 + inputs: + command: 'build' + projects: '**/*.csproj' + arguments: '--configuration $(_BuildConfig)' +``` + +## Avoid code-duplication through templates +Most builds run nearly identical steps on all configurations. In YAML, **templates** can be used to prevent code duplication and make the build process easier to maintain. + +In this sample, our build process is placed in a [build.yml](eng/build.yml) template file. This template is then referenced in the main CI file: + +```yaml +- phase: Windows + ... + steps: + - template: eng/build.yml + +- phase: OSX + ... + steps: + - template: eng/build.yml + +- phase: Linux + ... + steps: + - template: eng/build.yml +``` + +## Run both CI and PR builds out of the same file +The current recommendation is that all repositories have a single `.vsts-ci.yml` file which defines all of their builds (CI, PR, and internal). To do this, use YAML `{{ if }}` directives and the VSTS built-in `Build.Reason` variable. + +```yaml +- ${{ if notIn(variables['Build.Reason'], 'PullRequest') }}: + - task: DotNetCoreCLI@2 + inputs: + command: 'publish' + projects: 'HelloWorld/HelloWorld.csproj' + publishWebProjects: false + arguments: '--configuration $(_BuildConfig) --output $(build.ArtifactStagingDirectory) --framework $(targetFramework)' + displayName: dotnet publish +``` diff --git a/eng/build.yml b/eng/build.yml new file mode 100644 index 000000000000..3dab8128292b --- /dev/null +++ b/eng/build.yml @@ -0,0 +1,29 @@ +steps: +- task: DotNetCoreInstaller@0 + inputs: + version: 2.1.302 + +- task: DotNetCoreCLI@2 + inputs: + command: 'restore' + projects: '**/*.csproj' + displayName: dotnet restore + env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_MULTILEVEL_LOOKUP: 0 + +- task: DotNetCoreCLI@2 + inputs: + command: 'build' + projects: '**/*.csproj' + arguments: '--configuration $(_BuildConfig)' + displayName: dotnet build + +- ${{ if notIn(variables['Build.Reason'], 'PullRequest') }}: + - task: DotNetCoreCLI@2 + inputs: + command: 'publish' + projects: 'HelloWorld/HelloWorld.csproj' + publishWebProjects: false + arguments: '--configuration $(_BuildConfig) --output $(build.ArtifactStagingDirectory) --framework $(targetFramework)' + displayName: dotnet publish \ No newline at end of file From 989c96ed17887d66b366b546b6ebe11cda43a018 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Wed, 8 Aug 2018 15:35:10 -0700 Subject: [PATCH 0006/2702] Arcadify by adding reference to the base template (#4) --- .vsts-ci.yml | 48 ++++- Directory.Build.props | 8 + Directory.Build.targets | 4 + NuGet.Config | 9 + README.md | 76 ++++--- eng/SignToolData.json | 4 + eng/Versions.props | 7 + eng/build.yml | 29 --- eng/common/CIBuild.cmd | 3 + eng/common/build.ps1 | 314 ++++++++++++++++++++++++++++ eng/common/build.sh | 345 +++++++++++++++++++++++++++++++ eng/common/cibuild.sh | 16 ++ eng/common/init-tools-native.cmd | 3 + eng/common/init-tools-native.ps1 | 126 +++++++++++ eng/common/is-vsts.ps1 | 6 + eng/common/is-vsts.sh | 5 + global.json | 8 + 17 files changed, 936 insertions(+), 75 deletions(-) create mode 100644 Directory.Build.props create mode 100644 Directory.Build.targets create mode 100644 NuGet.Config create mode 100644 eng/SignToolData.json create mode 100644 eng/Versions.props delete mode 100644 eng/build.yml create mode 100644 eng/common/CIBuild.cmd create mode 100644 eng/common/build.ps1 create mode 100755 eng/common/build.sh create mode 100755 eng/common/cibuild.sh create mode 100644 eng/common/init-tools-native.cmd create mode 100644 eng/common/init-tools-native.ps1 create mode 100644 eng/common/is-vsts.ps1 create mode 100755 eng/common/is-vsts.sh create mode 100644 global.json diff --git a/.vsts-ci.yml b/.vsts-ci.yml index bb87e5863aac..c44e3229a863 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -1,4 +1,13 @@ # Sample VSTS CI file +resources: + repositories: + # shared library repository + - repository: arcade + type: github + endpoint: DotNet-Bot GitHub Connection + name: dotnet/arcade + ref: refs/heads/master + variables: Build.Repository.Clean: true targetFramework: netcoreapp2.0 @@ -12,7 +21,11 @@ trigger: # Three phases for each of the three OSes we want to run on phases: - - phase: Windows_NT +- template: /eng/common/templates/phases/base.yml@arcade + parameters: + agentOs: Windows_NT + name: Windows_NT + enableTelemetry: false queue: name: Helix parallel: 99 @@ -22,9 +35,18 @@ phases: release_configuration: _BuildConfig: Release steps: - - template: eng/build.yml + - script: eng\common\cibuild.cmd + -configuration $(_BuildConfig) + -prepareMachine + name: Build + displayName: Build + condition: succeeded() - - phase: OSX +- template: /eng/common/templates/phases/base.yml@arcade + parameters: + agentOs: OSX + name: OSX + enableTelemetry: false queue: name: Hosted macOS Preview parallel: 99 @@ -34,9 +56,18 @@ phases: release_configuration: _BuildConfig: Release steps: - - template: eng/build.yml + - script: eng/common/cibuild.sh + --configuration $(_BuildConfig) + --prepareMachine + name: Build + displayName: Build + condition: succeeded() - - phase: Linux +- template: /eng/common/templates/phases/base.yml@arcade + parameters: + agentOs: Linux + name: Linux + enableTelemetry: false queue: name: DotNetCore-Linux parallel: 99 @@ -46,4 +77,9 @@ phases: release_configuration: _BuildConfig: Release steps: - - template: eng/build.yml \ No newline at end of file + - script: eng/common/cibuild.sh + --configuration $(_BuildConfig) + --prepareMachine + name: Build + displayName: Build + condition: succeeded() \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 000000000000..f81de84ed716 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,8 @@ + + + + false + + + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 000000000000..177d64c47ad1 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,4 @@ + + + + diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 000000000000..c2822d93c7da --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/README.md b/README.md index a8501633f5da..5d7f9580234c 100644 --- a/README.md +++ b/README.md @@ -22,28 +22,46 @@ trigger: # - master ``` -## Run builds on multiple operating systems with phases -VSTS uses **phases** to parallelize your builds. Each phase definition corresponds to a specific queue. Thus, if you would like to have builds run on Windows, OSX, and Linux, you will need to define three phases (each corresponding to a separate queue) as seen in the following example. +## Base your builds on Arcade for ease of use +Arcade is designed to make many of the more complex tasks (such as sending telemetry) simple to do out of the box. While these features are not available yet, they are actively being developed, and it is therefore recommended that all builds base themselves on Arcade's `base.yml` template. This can be done using VSTS's repository resource model: ```yaml +resources: + repositories: + # shared library repository + - repository: arcade + type: github + endpoint: DotNet-Bot GitHub Connection + name: dotnet/arcade + ref: refs/heads/master + phases: - # Define a Windows phase - - phase: Windows - queue: - name: Helix # the Helix queue is currently the recommended queue for Windows builds - ... - - - phase: OSX - queue: - name: Hosted macOS Preview # as of Aug 2 2018 this is correct; in the future we will switch to a DotNetCore-Mac pool - ... - - - phase: Linux - queue: - name: DotNetCore-Linux - ... +- template: /eng/common/templates/phases/base.yml@arcade + parameters: + ... +``` + +In the future, repositories can enroll in Maestro to manage their Arcade template usage instead. + +## Use the Arcade SDK for an easier build process +To quickstart your builds, you can use the Arcade SDK's build scripts. Clone the `eng/*` folder from this repository and copy [`Directory.Build.props`](Directory.Build.props), [`Directory.Build.targets`](Directory.Build.targets), [`global.json`](global.json), and [`NuGet.Config`](NuGet.Config) into your root directory. To use the build scripts, simply use a `script` task to run `eng\common\cibuild.cmd` on Windows or `eng/common/cibuild.sh` on a Unix-based OS. + +```yaml +# for Windows +steps: +- script: eng\common\cibuild.cmd + -configuration $(_BuildConfig) + -prepareMachine + +# for Unix-based +steps: +- script: eng/common/cibuild.sh + --configuration $(_BuildConfig) + --prepareMachine ``` +Note: for the Unix-based scripts to work, make sure you clone rather than copy/paste while on Windows—copying and pasting will remove the `x` chmod parameter from the Unix scripts, which will build breaks when attempting to run them. + ## Use matrices to quickly create phases for different build configurations VSTS supports using a **matrix** in a phase definition to quickly create several different phases on the same queue with slightly different build configurations. This is the recommended way to quickly add debug and release configuration builds. @@ -69,30 +87,8 @@ The variable defined in this matrix (in this case, `_BuildConfig`) can later be arguments: '--configuration $(_BuildConfig)' ``` -## Avoid code-duplication through templates -Most builds run nearly identical steps on all configurations. In YAML, **templates** can be used to prevent code duplication and make the build process easier to maintain. - -In this sample, our build process is placed in a [build.yml](eng/build.yml) template file. This template is then referenced in the main CI file: - -```yaml -- phase: Windows - ... - steps: - - template: eng/build.yml - -- phase: OSX - ... - steps: - - template: eng/build.yml - -- phase: Linux - ... - steps: - - template: eng/build.yml -``` - ## Run both CI and PR builds out of the same file -The current recommendation is that all repositories have a single `.vsts-ci.yml` file which defines all of their builds (CI, PR, and internal). To do this, use YAML `{{ if }}` directives and the VSTS built-in `Build.Reason` variable. +While this sample repository has no need to do so, there are many scenarios in which you may want to differentiate between different build triggers. The current recommendation is that all repositories have a single `.vsts-ci.yml` file which defines all of their builds (CI, PR, and internal). To do this, use YAML `{{ if }}` directives and the VSTS built-in `Build.Reason` variable. ```yaml - ${{ if notIn(variables['Build.Reason'], 'PullRequest') }}: diff --git a/eng/SignToolData.json b/eng/SignToolData.json new file mode 100644 index 000000000000..c830e39e6b90 --- /dev/null +++ b/eng/SignToolData.json @@ -0,0 +1,4 @@ +{ + "sign": [ ], + "exclude": [ ] +} diff --git a/eng/Versions.props b/eng/Versions.props new file mode 100644 index 000000000000..15453b3d8263 --- /dev/null +++ b/eng/Versions.props @@ -0,0 +1,7 @@ + + + + 1.0.0 + prerelease + + \ No newline at end of file diff --git a/eng/build.yml b/eng/build.yml deleted file mode 100644 index 3dab8128292b..000000000000 --- a/eng/build.yml +++ /dev/null @@ -1,29 +0,0 @@ -steps: -- task: DotNetCoreInstaller@0 - inputs: - version: 2.1.302 - -- task: DotNetCoreCLI@2 - inputs: - command: 'restore' - projects: '**/*.csproj' - displayName: dotnet restore - env: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - DOTNET_MULTILEVEL_LOOKUP: 0 - -- task: DotNetCoreCLI@2 - inputs: - command: 'build' - projects: '**/*.csproj' - arguments: '--configuration $(_BuildConfig)' - displayName: dotnet build - -- ${{ if notIn(variables['Build.Reason'], 'PullRequest') }}: - - task: DotNetCoreCLI@2 - inputs: - command: 'publish' - projects: 'HelloWorld/HelloWorld.csproj' - publishWebProjects: false - arguments: '--configuration $(_BuildConfig) --output $(build.ArtifactStagingDirectory) --framework $(targetFramework)' - displayName: dotnet publish \ No newline at end of file diff --git a/eng/common/CIBuild.cmd b/eng/common/CIBuild.cmd new file mode 100644 index 000000000000..6544b0cd54f3 --- /dev/null +++ b/eng/common/CIBuild.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -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 new file mode 100644 index 000000000000..3a563eb59982 --- /dev/null +++ b/eng/common/build.ps1 @@ -0,0 +1,314 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $configuration = "Debug", + [string] $projects = "", + [string] $verbosity = "minimal", + [switch] $restore, + [switch] $deployDeps, + [switch] $build, + [switch] $rebuild, + [switch] $deploy, + [switch] $test, + [switch] $integrationTest, + [switch] $performanceTest, + [switch] $sign, + [switch] $pack, + [switch] $publish, + [switch] $ci, + [switch] $prepareMachine, + [switch] $help, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties +) + +set-strictmode -version 2.0 +$ErrorActionPreference = "Stop" +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + +function Print-Usage() { + Write-Host "Common settings:" + Write-Host " -configuration Build configuration Debug, Release" + Write-Host " -verbosity Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])" + Write-Host " -help Print help and exit" + Write-Host "" + + Write-Host "Actions:" + Write-Host " -restore Restore dependencies" + Write-Host " -build Build solution" + Write-Host " -rebuild Rebuild solution" + 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 " -publish Publish artifacts (e.g. symbols)" + Write-Host "" + + Write-Host "Advanced settings:" + Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" + Write-Host " -ci Set when running on CI server" + Write-Host " -prepareMachine Prepare machine for CI run" + Write-Host "" + Write-Host "Command line arguments not listed above are passed thru to msbuild." + Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." +} + +if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) { + Print-Usage + exit 0 +} + +function Create-Directory([string[]] $path) { + if (!(Test-Path $path)) { + New-Item -path $path -force -itemType "Directory" | Out-Null + } +} + +function InitializeDotNetCli { + # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism + $env:DOTNET_MULTILEVEL_LOOKUP=0 + + # Disable first run since we do not need all ASP.NET packages restored. + $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + + # Source Build uses DotNetCoreSdkDir variable + if ($env:DotNetCoreSdkDir -ne $null) { + $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir + } + + # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, + # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. + if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.sdk.version)"))) { + $dotnetRoot = $env:DOTNET_INSTALL_DIR + } else { + $dotnetRoot = Join-Path $RepoRoot ".dotnet" + $env:DOTNET_INSTALL_DIR = $dotnetRoot + + if ($restore) { + InstallDotNetSdk $dotnetRoot $GlobalJson.sdk.version + } + } + + return $dotnetRoot +} + +function GetDotNetInstallScript([string] $dotnetRoot) { + $installScript = "$dotnetRoot\dotnet-install.ps1" + if (!(Test-Path $installScript)) { + Create-Directory $dotnetRoot + Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript + } + + return $installScript +} + +function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { + $installScript = GetDotNetInstallScript $dotnetRoot + + & $installScript -Version $version -InstallDir $dotnetRoot + if ($lastExitCode -ne 0) { + Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red + exit $lastExitCode + } +} + +function InitializeVisualStudioBuild { + $inVSEnvironment = !($env:VS150COMNTOOLS -eq $null) -and (Test-Path $env:VS150COMNTOOLS) + + if ($inVSEnvironment) { + $vsInstallDir = Join-Path $env:VS150COMNTOOLS "..\.." + } else { + $vsInstallDir = LocateVisualStudio + + $env:VS150COMNTOOLS = Join-Path $vsInstallDir "Common7\Tools\" + $env:VSSDK150Install = Join-Path $vsInstallDir "VSSDK\" + $env:VSSDKInstall = Join-Path $vsInstallDir "VSSDK\" + } + + return $vsInstallDir; +} + +function LocateVisualStudio { + $vswhereVersion = $GlobalJson.vswhere.version + $toolsRoot = Join-Path $RepoRoot ".tools" + $vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion" + $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe" + + if (!(Test-Path $vsWhereExe)) { + Create-Directory $vsWhereDir + Write-Host "Downloading vswhere" + Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe + } + + $vsInstallDir = & $vsWhereExe -latest -prerelease -property installationPath -requires Microsoft.Component.MSBuild -requires Microsoft.VisualStudio.Component.VSSDK -requires Microsoft.Net.Component.4.6.TargetingPack -requires Microsoft.VisualStudio.Component.Roslyn.Compiler -requires Microsoft.VisualStudio.Component.VSSDK + + if ($lastExitCode -ne 0) { + Write-Host "Failed to locate Visual Studio (exit code '$lastExitCode')." -ForegroundColor Red + exit $lastExitCode + } + + return $vsInstallDir +} + +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'.'Microsoft.DotNet.Arcade.Sdk' + $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" + + if (Test-Path $toolsetLocationFile) { + $path = Get-Content $toolsetLocationFile -TotalCount 1 + if (Test-Path $path) { + $global:ToolsetBuildProj = $path + return + } + } + + if (-not $restore) { + Write-Host "Toolset version $toolsetVersion has not been restored." + exit 1 + } + + $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 + + if ($lastExitCode -ne 0) { + Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -ForegroundColor Red + Write-Host "Build log: $ToolsetRestoreLog" -ForegroundColor DarkGray + exit $lastExitCode + } + + $path = Get-Content $toolsetLocationFile -TotalCount 1 + if (!(Test-Path $path)) { + throw "Invalid toolset path: $path" + } + + $global:ToolsetBuildProj = $path +} + +function InitializeCustomToolset { + if (-not $restore) { + return + } + + $script = Join-Path $EngRoot "RestoreToolset.ps1" + + if (Test-Path $script) { + . $script + } +} + +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 + } +} + +function Stop-Processes() { + Write-Host "Killing running build processes..." + Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Stop-Process + Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | Stop-Process + Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process +} + +try { + $RepoRoot = Join-Path $PSScriptRoot "..\.." + $EngRoot = Join-Path $PSScriptRoot ".." + $ArtifactsDir = Join-Path $RepoRoot "artifacts" + $ToolsetDir = Join-Path $ArtifactsDir "toolset" + $LogDir = Join-Path (Join-Path $ArtifactsDir $configuration) "log" + $BuildLog = Join-Path $LogDir "Build.binlog" + $ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog" + $TempDir = Join-Path (Join-Path $ArtifactsDir $configuration) "tmp" + $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json + + if ($projects -eq "") { + $projects = Join-Path $RepoRoot "*.sln" + } + + if ($env:NUGET_PACKAGES -eq $null) { + # Use local cache on CI to ensure deterministic build, + # use global cache in dev builds to avoid cost of downloading packages. + $env:NUGET_PACKAGES = if ($ci) { Join-Path $RepoRoot ".packages" } + else { Join-Path $env:UserProfile ".nuget\packages" } + } + + Create-Directory $ToolsetDir + Create-Directory $LogDir + + if ($ci) { + Create-Directory $TempDir + $env:TEMP = $TempDir + $env:TMP = $TempDir + } + + $driver, $args = GetBuildCommand + InitializeToolset $driver $args + InitializeCustomToolset + Build $driver $args +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 +} +finally { + Pop-Location + if ($ci -and $prepareMachine) { + Stop-Processes + } +} + diff --git a/eng/common/build.sh b/eng/common/build.sh new file mode 100755 index 000000000000..17c1a715f4cc --- /dev/null +++ b/eng/common/build.sh @@ -0,0 +1,345 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +help=false +restore=false +build=false +rebuild=false +test=false +pack=false +integration_test=false +performance_test=false +sign=false +public=false +ci=false + +projects='' +configuration='Debug' +prepare_machine=false +verbosity='minimal' +properties='' + +repo_root="$scriptroot/../.." +eng_root="$scriptroot/.." +artifacts_dir="$repo_root/artifacts" + +global_json_file="$repo_root/global.json" +build_driver="" +toolset_build_proj="" + +while (($# > 0)); do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + --build) + build=true + shift 1 + ;; + --ci) + ci=true + shift 1 + ;; + --configuration) + configuration=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --configuration Build configuration Debug, Release" + echo " --verbosity Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])" + echo " --help Print help and exit" + echo "" + echo "Actions:" + echo " --restore Restore dependencies" + echo " --build Build solution" + echo " --rebuild Rebuild solution" + echo " --test Run all unit tests in the solution" + echo " --sign Sign build outputs" + echo " --pack Package build outputs into NuGet packages and Willow components" + echo "" + echo "Advanced settings:" + echo " --solution Path to solution to build" + echo " --ci Set when running on CI server" + echo " --prepareMachine Prepare machine for CI run" + echo "" + echo "Command line arguments not listed above are passed through to MSBuild." + exit 0 + ;; + --pack) + pack=true + shift 1 + ;; + --preparemachine) + prepare_machine=true + shift 1 + ;; + --rebuild) + rebuild=true + shift 1 + ;; + --restore) + restore=true + shift 1 + ;; + --sign) + sign=true + shift 1 + ;; + --solution) + solution=$2 + shift 2 + ;; + --test) + 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 + ;; + *) + properties="$properties $1" + shift 1 + ;; + esac +done + +artifacts_configuration_dir="$artifacts_dir/$configuration" +toolset_dir="$artifacts_dir/toolset" +log_dir="$artifacts_configuration_dir/log" +build_log="$log_dir/Build.binlog" +toolset_restore_log="$log_dir/ToolsetRestore.binlog" +temp_dir="$artifacts_configuration_dir/tmp" + +# ReadJson [filename] [json key] +# Result: Sets 'readjsonvalue' to the value of the provided json key +# Note: this method may return unexpected results if there are duplicate +# keys in the json +function ReadJson { + local file=$1 + local key=$2 + + local unamestr="$(uname)" + local sedextended='-r' + if [[ "$unamestr" == 'Darwin' ]]; then + sedextended='-E' + fi; + + readjsonvalue="$(grep -m 1 "\"$key\"" $file | sed $sedextended 's/^ *//;s/.*: *"//;s/",?//')" + if [[ ! "$readjsonvalue" ]]; then + echo "Error: Cannot find \"$key\" in $file" >&2; + ExitWithExitCode 1 + fi; +} + +function InitializeDotNetCli { + # Disable first run since we want to control all package sources + export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + + # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism + export DOTNET_MULTILEVEL_LOOKUP=0 + + # Source Build uses DotNetCoreSdkDir variable + if [[ -n "$DotNetCoreSdkDir" ]]; then + export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" + fi + + ReadJson "$global_json_file" "version" + local dotnet_sdk_version="$readjsonvalue" + local dotnet_root="" + + # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, + # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. + if [[ -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then + dotnet_root="$DOTNET_INSTALL_DIR" + else + dotnet_root="$repo_root/.dotnet" + export DOTNET_INSTALL_DIR="$dotnet_root" + + if [[ "$restore" == true ]]; then + InstallDotNetSdk $dotnet_root $dotnet_sdk_version + fi + fi + + build_driver="$dotnet_root/dotnet" +} + +function InstallDotNetSdk { + local root=$1 + local version=$2 + + local install_script=`GetDotNetInstallScript $root` + + bash "$install_script" --version $version --install-dir $root + local lastexitcode=$? + + if [[ $lastexitcode != 0 ]]; then + echo "Failed to install dotnet SDK (exit code '$lastexitcode')." + ExitWithExitCode $lastexitcode + fi +} + +function GetDotNetInstallScript { + local root=$1 + local install_script="$root/dotnet-install.sh" + + if [[ ! -a "$install_script" ]]; then + mkdir -p "$root" + + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + curl "https://dot.net/v1/dotnet-install.sh" -sSL --retry 10 --create-dirs -o "$install_script" + else + wget -q -O "$install_script" "https://dot.net/v1/dotnet-install.sh" + fi + fi + + # return value + echo "$install_script" +} + +function InitializeToolset { + ReadJson $global_json_file "Microsoft.DotNet.Arcade.Sdk" + local toolset_version=$readjsonvalue + local toolset_location_file="$toolset_dir/$toolset_version.txt" + + if [[ -a "$toolset_location_file" ]]; then + local path=`cat $toolset_location_file` + if [[ -a "$path" ]]; then + toolset_build_proj=$path + return + fi + fi + + if [[ "$restore" != true ]]; then + echo "Toolset version $toolsetVersion has not been restored." + ExitWithExitCode 2 + fi + + local proj="$toolset_dir/restore.proj" + + echo '' > $proj + "$build_driver" msbuild $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$toolset_restore_log /v:$verbosity /p:__ToolsetLocationOutputFile=$toolset_location_file + local lastexitcode=$? + + if [[ $lastexitcode != 0 ]]; then + echo "Failed to restore toolset (exit code '$lastexitcode'). See log: $toolset_restore_log" + ExitWithExitCode $lastexitcode + fi + + toolset_build_proj=`cat $toolset_location_file` + + if [[ ! -a "$toolset_build_proj" ]]; then + echo "Invalid toolset path: $toolset_build_proj" + ExitWithExitCode 3 + fi +} + +function InitializeCustomToolset { + local script="$eng_root/RestoreToolset.sh" + + if [[ -a "$script" ]]; then + . "$script" + fi +} + +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:Pack=$pack \ + /p:IntegrationTest=$integration_test \ + /p:PerformanceTest=$performance_test \ + /p:Sign=$sign \ + /p:Publish=$publish \ + /p:CIBuild=$ci \ + $properties + local lastexitcode=$? + + if [[ $lastexitcode != 0 ]]; then + echo "Failed to build $toolset_build_proj" + ExitWithExitCode $lastexitcode + fi +} + +function ExitWithExitCode { + if [[ "$ci" == true && "$prepare_machine" == true ]]; then + StopProcesses + fi + exit $1 +} + +function StopProcesses { + echo "Killing running build processes..." + pkill -9 "dotnet" + pkill -9 "vbcscompiler" +} + +function Main { + # HOME may not be defined in some scenarios, but it is required by NuGet + if [[ -z $HOME ]]; then + export HOME="$repo_root/artifacts/.home/" + mkdir -p "$HOME" + fi + + if [[ -z $projects ]]; then + projects="$repo_root/*.sln" + fi + + if [[ -z $NUGET_PACKAGES ]]; then + if [[ $ci ]]; then + export NUGET_PACKAGES="$repo_root/.packages" + else + export NUGET_PACKAGES="$HOME/.nuget/packages" + fi + fi + + mkdir -p "$toolset_dir" + mkdir -p "$log_dir" + + if [[ $ci ]]; then + mkdir -p "$temp_dir" + export TEMP="$temp_dir" + export TMP="$temp_dir" + fi + + InitializeDotNetCli + InitializeToolset + InitializeCustomToolset + + Build + ExitWithExitCode $? +} + +Main diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh new file mode 100755 index 000000000000..1a02c0dec8fd --- /dev/null +++ b/eng/common/cibuild.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where + # the symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@ \ No newline at end of file diff --git a/eng/common/init-tools-native.cmd b/eng/common/init-tools-native.cmd new file mode 100644 index 000000000000..438cd548c452 --- /dev/null +++ b/eng/common/init-tools-native.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -command "& """%~dp0init-tools-native.ps1""" %*" +exit /b %ErrorLevel% \ No newline at end of file diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 new file mode 100644 index 000000000000..8fceb655c0b5 --- /dev/null +++ b/eng/common/init-tools-native.ps1 @@ -0,0 +1,126 @@ +<# +.SYNOPSIS +Entry point script for installing native tools + +.DESCRIPTION +Reads $RepoRoot\eng\NativeToolsVersion.txt file to determine native assets to install +and executes installers for those tools + +.PARAMETER BaseUri +Base file directory or Url from which to acquire tool archives + +.PARAMETER InstallDirectory +Directory to install native toolset. This is a command-line override for the default +Install directory precedence order: +- InstallDirectory command-line override +- NETCOREENG_INSTALL_DIRECTORY environment variable +- (default) %USERPROFILE%/.netcoreeng/native + +.PARAMETER Clean +Switch specifying to not install anything, but cleanup native asset folders + +.PARAMETER Force +Clean and then install tools + +.PARAMETER DownloadRetries +Total number of retry attempts + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds + +.PARAMETER ToolsVersionsFile +File path to tools versions file + +.NOTES +#> +[CmdletBinding(PositionalBinding=$false)] +Param ( + [string] $BaseUri = "https://dotnetfeed.blob.core.windows.net/netcoreeng/native-assets", + [string] $InstallDirectory, + [switch] $Clean = $False, + [switch] $Force = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30, + [string] $GlobalJsonFile = "$PSScriptRoot\..\..\global.json" +) + +Set-StrictMode -version 2.0 +$ErrorActionPreference="Stop" + +Import-Module -Name (Join-Path $PSScriptRoot "native\CommonLibrary.psm1") + +try { + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $EngCommonBaseDir = Join-Path $PSScriptRoot "native\" + $NativeBaseDir = $InstallDirectory + if (!$NativeBaseDir) { + $NativeBaseDir = CommonLibrary\Get-NativeInstallDirectory + } + $Env:CommonLibrary_NativeInstallDir = $NativeBaseDir + $InstallBin = Join-Path $NativeBaseDir "bin" + + # Process tools list + Write-Host "Processing $GlobalJsonFile" + If (-Not (Test-Path $GlobalJsonFile)) { + Write-Host "Unable to find '$GlobalJsonFile'" + exit 0 + } + $NativeTools = Get-Content($GlobalJsonFile) -Raw | + ConvertFrom-Json | + Select-Object -Expand "native-tools" -ErrorAction SilentlyContinue + if ($NativeTools) { + $NativeTools.PSObject.Properties | ForEach-Object { + $ToolName = $_.Name + $ToolVersion = $_.Value + $InstallerFilename = "install-$ToolName.ps1" + $LocalInstallerCommand = Join-Path $EngCommonBaseDir $InstallerFilename + $LocalInstallerCommand += " -InstallPath $InstallBin" + $LocalInstallerCommand += " -BaseUri $BaseUri" + $LocalInstallerCommand += " -CommonLibraryDirectory $EngCommonBaseDir" + $LocalInstallerCommand += " -Version $ToolVersion" + + if ($Verbose) { + $LocalInstallerCommand += " -Verbose" + } + if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { + if($Force) { + $LocalInstallerCommand += " -Force" + } + } + if ($Clean) { + $LocalInstallerCommand += " -Clean" + } + + Write-Verbose "Installing $ToolName version $ToolVersion" + Write-Verbose "Executing '$LocalInstallerCommand'" + Invoke-Expression "$LocalInstallerCommand" + if ($LASTEXITCODE -Ne "0") { + Write-Error "Execution failed" + exit 1 + } + } + } + else { + Write-Host "No native tools defined in global.json" + exit 0 + } + + if ($Clean) { + exit 0 + } + if (Test-Path $InstallBin) { + Write-Host "Native tools are available from" (Convert-Path -Path $InstallBin) + } + else { + Write-Error "Native tools install directory does not exist, installation failed" + exit 1 + } + exit 0 +} +catch { + Write-Host $_ + Write-Host $_.Exception + exit 1 +} diff --git a/eng/common/is-vsts.ps1 b/eng/common/is-vsts.ps1 new file mode 100644 index 000000000000..f88472955692 --- /dev/null +++ b/eng/common/is-vsts.ps1 @@ -0,0 +1,6 @@ +if ($env:Build_BuildNumber) { + return $true +} +else { + return $false +} diff --git a/eng/common/is-vsts.sh b/eng/common/is-vsts.sh new file mode 100755 index 000000000000..f7086fae0ff0 --- /dev/null +++ b/eng/common/is-vsts.sh @@ -0,0 +1,5 @@ +if [ ! -z $BUILD_BUILDNUMBER ]; then + exit 0 +else + exit 1 +fi diff --git a/global.json b/global.json new file mode 100644 index 000000000000..4f55980a27fb --- /dev/null +++ b/global.json @@ -0,0 +1,8 @@ +{ + "sdk": { + "version": "2.1.300" + }, + "msbuild-sdks": { + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-bootstrap-1" + } +} From 520c82ed461922e689665b3b0cdad8996c4e4cb8 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Mon, 20 Aug 2018 17:51:26 -0700 Subject: [PATCH 0007/2702] Add Code of Conduct (#6) --- CODE_OF_CONDUCT.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..68add256cbc3 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,5 @@ +# Code of Conduct + +This project has adopted the code of conduct defined by the Contributor Covenant +to clarify expected behavior in our community. +For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). \ No newline at end of file From b8ff836f8c2b79089f54ffd8f3210fd65dc40a12 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Tue, 21 Aug 2018 13:06:28 -0700 Subject: [PATCH 0008/2702] Add telemetry sample (#5) * Add telemetry sample * Remove misleading example * PR feedback * Enable docker in CI --- .vsts-ci.yml | 5 ++++- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index c44e3229a863..e77aec9d4cfd 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -82,4 +82,7 @@ phases: --prepareMachine name: Build displayName: Build - condition: succeeded() \ No newline at end of file + condition: succeeded() + variables: + # Run build in docker container + _PREVIEW_VSTS_DOCKER_IMAGE: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20170319080304 \ No newline at end of file diff --git a/README.md b/README.md index 5d7f9580234c..2ef8abb41de4 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ # Arcade Minimal CI Sample + [![Build status](https://dotnet.visualstudio.com/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_apis/build/status/116?branchName=master)](https://dotnet.visualstudio.com/public/_build/latest?definitionId=116&branch=master) This repository serves as an example of how to link GitHub repositories to VSTS for CI and PR builds. ## Before You Start + You'll want to start by following the [VSTS Onboarding](https://github.com/dotnet/arcade/blob/master/Documentation/VSTS/VSTSOnboarding.md) instructions, which provide a thorough, step-by-step list of instructions for creating VSTS CI builds for GitHub repos. From there, you'll find the [VSTS YAML documentation](https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted.md), which details the creation of VSTS CI YAML files. The purpose of this repository is to provide a jumping off point with an example YAML CI file that already has the basic architecture you'll want for your builds. All examples below are taken from this repository's [.vsts-ci.yml](.vsts-ci.yml). ## Set build triggers in your YAML + Documentation on setting CI triggers in YAML can be found [here](https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-ci.md). The syntax for pull request triggers is identical, and will trigger whenever a PR is created merging into your specified branches. **Note: YAML-based PR triggers are a feature currently being rolled out by VSTS. Until they are completed, you must override the YAML PR trigger settings from the build definition GUI on VSTS.** @@ -23,6 +26,7 @@ trigger: ``` ## Base your builds on Arcade for ease of use + Arcade is designed to make many of the more complex tasks (such as sending telemetry) simple to do out of the box. While these features are not available yet, they are actively being developed, and it is therefore recommended that all builds base themselves on Arcade's `base.yml` template. This can be done using VSTS's repository resource model: ```yaml @@ -44,6 +48,7 @@ phases: In the future, repositories can enroll in Maestro to manage their Arcade template usage instead. ## Use the Arcade SDK for an easier build process + To quickstart your builds, you can use the Arcade SDK's build scripts. Clone the `eng/*` folder from this repository and copy [`Directory.Build.props`](Directory.Build.props), [`Directory.Build.targets`](Directory.Build.targets), [`global.json`](global.json), and [`NuGet.Config`](NuGet.Config) into your root directory. To use the build scripts, simply use a `script` task to run `eng\common\cibuild.cmd` on Windows or `eng/common/cibuild.sh` on a Unix-based OS. ```yaml @@ -63,6 +68,7 @@ steps: Note: for the Unix-based scripts to work, make sure you clone rather than copy/paste while on Windows—copying and pasting will remove the `x` chmod parameter from the Unix scripts, which will build breaks when attempting to run them. ## Use matrices to quickly create phases for different build configurations + VSTS supports using a **matrix** in a phase definition to quickly create several different phases on the same queue with slightly different build configurations. This is the recommended way to quickly add debug and release configuration builds. ```yaml @@ -88,6 +94,7 @@ The variable defined in this matrix (in this case, `_BuildConfig`) can later be ``` ## Run both CI and PR builds out of the same file + While this sample repository has no need to do so, there are many scenarios in which you may want to differentiate between different build triggers. The current recommendation is that all repositories have a single `.vsts-ci.yml` file which defines all of their builds (CI, PR, and internal). To do this, use YAML `{{ if }}` directives and the VSTS built-in `Build.Reason` variable. ```yaml @@ -100,3 +107,44 @@ While this sample repository has no need to do so, there are many scenarios in w arguments: '--configuration $(_BuildConfig) --output $(build.ArtifactStagingDirectory) --framework $(targetFramework)' displayName: dotnet publish ``` + +## Enabling telmetry + +[Arcade](#base-your-builds-on-arcade-for-ease-of-use) provides the ability to send telemetry. To enable telemetry you must... + +1. Set `enableTelemetry` to `true` + +2. Define the `_HelixType`, `_HelixSource`, and `_HelixBuildConfig` variables + + - `_HelixType` - This is a string that defines the type of run you are currently performing. Note that a trailing slash is required. e.g. test/functional/cli/, build/product/ + - `_HelixSource` - This defines information about the run in a specific format Type/repo/branch/. Note that a trailing slash is required. e.g. pr/corefx/master/, official/coreclr/master/ + - `_HelixBuildConfig` - The build configuration for your current build ie, Release, Debug, etc + +3. For official builds, add an "AzureKeyVault" task reference to `HelixProdKV` + +```YAML +phases: +- template: /eng/common/templates/phases/base.yml@arcade + parameters: + agentOs: Windows_NT + name: Windows_NT + enableTelemetry: true + + variables: + _HelixType: build/product + _HelixBuildConfig: $(_BuildConfig) + ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: + _HelixSource: official/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) + ${{ if in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: + _HelixSource: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) + + steps: + - ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'HelixProd_KeyVault' + KeyVaultName: HelixProdKV + SecretsFilter: 'HelixApiAccessToken' + # conditions - https://docs.microsoft.com/en-us/vsts/pipelines/process/conditions?view=vsts + condition: always() +``` \ No newline at end of file From 7b6fd690692231b07adaa47b08527c48d60c9d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Divino=20C=C3=A9sar?= Date: Thu, 23 Aug 2018 16:24:53 -0700 Subject: [PATCH 0009/2702] Patch to use refactored SignToolTask (#7) * Related to issue #455 in Arcade repo --- HelloWorld/HelloWorld.csproj | 1 + NuGet.Config | 4 ++-- README.md | 8 +++++++- eng/SignToolData.json | 4 ---- global.json | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 eng/SignToolData.json diff --git a/HelloWorld/HelloWorld.csproj b/HelloWorld/HelloWorld.csproj index fdda1c0209d7..ec44ba4b3c33 100644 --- a/HelloWorld/HelloWorld.csproj +++ b/HelloWorld/HelloWorld.csproj @@ -3,6 +3,7 @@ Exe netcoreapp2.0 + true diff --git a/NuGet.Config b/NuGet.Config index c2822d93c7da..7fa789a1df1d 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -3,7 +3,7 @@ - + - + \ No newline at end of file diff --git a/README.md b/README.md index 2ef8abb41de4..833f22ca1661 100644 --- a/README.md +++ b/README.md @@ -147,4 +147,10 @@ phases: SecretsFilter: 'HelixApiAccessToken' # conditions - https://docs.microsoft.com/en-us/vsts/pipelines/process/conditions?view=vsts condition: always() -``` \ No newline at end of file +``` + +## Using the SignToolTask + +Arcade provides an optimized way to sign files using MicroBuild, it is wrapped in a custom MSBuild task called [SignToolTask](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs). + +The Arcade SDK will automatically [find package](https://github.com/dotnet/arcade/blob/ae38bbbc25d03e1deb49b15ce88e2dd4c683e116/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj) files and forward them to be signed using SignToolTask. Therefore, if the only files that you care to sign are covered by the linked line above you don't have to do anything else. If not, you have options. You can specify explicit files to be signed / excluded from signing or changing the certificate / strong name to be used. For a detailed guide see the [SignTool package documentation](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.SignTool/README.md). \ No newline at end of file diff --git a/eng/SignToolData.json b/eng/SignToolData.json deleted file mode 100644 index c830e39e6b90..000000000000 --- a/eng/SignToolData.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "sign": [ ], - "exclude": [ ] -} diff --git a/global.json b/global.json index 4f55980a27fb..a58a5902f777 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "version": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-bootstrap-1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18421.3" } } From 9b8e25f69f3f9404487bd2a3bdc0e69e9a3c5b22 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Tue, 28 Aug 2018 15:47:39 -0700 Subject: [PATCH 0010/2702] Use local repo for templates (#15) * Use local repo for templates * Actually make the yaml change --- .vsts-ci.yml | 16 +- README.md | 15 +- eng/common/PushBuildAssets.cmd | 3 + eng/common/build.ps1 | 22 +- eng/common/build.sh | 47 ++- eng/common/init-tools-native.ps1 | 7 +- eng/common/is-vsts.ps1 | 6 - eng/common/is-vsts.sh | 5 - eng/common/native/CommonLibrary.psm1 | 351 ++++++++++++++++++ eng/common/native/install-cmake.ps1 | 119 ++++++ eng/common/templates/phases/base.yml | 90 +++++ .../templates/phases/push-build-asset.yml | 26 ++ eng/common/templates/steps/build-reason.yml | 12 + eng/common/templates/steps/run-on-unix.yml | 7 + eng/common/templates/steps/run-on-windows.yml | 7 + .../steps/run-script-ifequalelse.yml | 33 ++ eng/common/templates/steps/telemetry-end.yml | 67 ++++ .../templates/steps/telemetry-start.yml | 154 ++++++++ global.json | 4 +- 19 files changed, 917 insertions(+), 74 deletions(-) create mode 100644 eng/common/PushBuildAssets.cmd delete mode 100644 eng/common/is-vsts.ps1 delete mode 100755 eng/common/is-vsts.sh create mode 100644 eng/common/native/CommonLibrary.psm1 create mode 100644 eng/common/native/install-cmake.ps1 create mode 100644 eng/common/templates/phases/base.yml create mode 100644 eng/common/templates/phases/push-build-asset.yml create mode 100644 eng/common/templates/steps/build-reason.yml create mode 100644 eng/common/templates/steps/run-on-unix.yml create mode 100644 eng/common/templates/steps/run-on-windows.yml create mode 100644 eng/common/templates/steps/run-script-ifequalelse.yml create mode 100644 eng/common/templates/steps/telemetry-end.yml create mode 100644 eng/common/templates/steps/telemetry-start.yml diff --git a/.vsts-ci.yml b/.vsts-ci.yml index e77aec9d4cfd..1f09ac37263d 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -1,13 +1,3 @@ -# Sample VSTS CI file -resources: - repositories: - # shared library repository - - repository: arcade - type: github - endpoint: DotNet-Bot GitHub Connection - name: dotnet/arcade - ref: refs/heads/master - variables: Build.Repository.Clean: true targetFramework: netcoreapp2.0 @@ -21,7 +11,7 @@ trigger: # Three phases for each of the three OSes we want to run on phases: -- template: /eng/common/templates/phases/base.yml@arcade +- template: /eng/common/templates/phases/base.yml parameters: agentOs: Windows_NT name: Windows_NT @@ -42,7 +32,7 @@ phases: displayName: Build condition: succeeded() -- template: /eng/common/templates/phases/base.yml@arcade +- template: /eng/common/templates/phases/base.yml parameters: agentOs: OSX name: OSX @@ -63,7 +53,7 @@ phases: displayName: Build condition: succeeded() -- template: /eng/common/templates/phases/base.yml@arcade +- template: /eng/common/templates/phases/base.yml parameters: agentOs: Linux name: Linux diff --git a/README.md b/README.md index 833f22ca1661..735a7beceac2 100644 --- a/README.md +++ b/README.md @@ -27,26 +27,15 @@ trigger: ## Base your builds on Arcade for ease of use -Arcade is designed to make many of the more complex tasks (such as sending telemetry) simple to do out of the box. While these features are not available yet, they are actively being developed, and it is therefore recommended that all builds base themselves on Arcade's `base.yml` template. This can be done using VSTS's repository resource model: +Arcade is designed to make many of the more complex tasks (such as sending telemetry) simple to do out of the box. While these features are not available yet, they are actively being developed, and it is therefore recommended that all builds base themselves on Arcade's `base.yml` template. Today, this can be done by copying the `eng/common` folder from Arcade into a local `eng/common` folder. In the near future, Engineering services will provide the capability to auto-update this folder via Maestro so that you don't need to manually take updates to common Arcade scripts. ```yaml -resources: - repositories: - # shared library repository - - repository: arcade - type: github - endpoint: DotNet-Bot GitHub Connection - name: dotnet/arcade - ref: refs/heads/master - phases: -- template: /eng/common/templates/phases/base.yml@arcade +- template: /eng/common/templates/phases/base.yml parameters: ... ``` -In the future, repositories can enroll in Maestro to manage their Arcade template usage instead. - ## Use the Arcade SDK for an easier build process To quickstart your builds, you can use the Arcade SDK's build scripts. Clone the `eng/*` folder from this repository and copy [`Directory.Build.props`](Directory.Build.props), [`Directory.Build.targets`](Directory.Build.targets), [`global.json`](global.json), and [`NuGet.Config`](NuGet.Config) into your root directory. To use the build scripts, simply use a `script` task to run `eng\common\cibuild.cmd` on Windows or `eng/common/cibuild.sh` on a Unix-based OS. diff --git a/eng/common/PushBuildAssets.cmd b/eng/common/PushBuildAssets.cmd new file mode 100644 index 000000000000..e0ee8ede7934 --- /dev/null +++ b/eng/common/PushBuildAssets.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -pushBuildAssets %*" +exit /b %ErrorLevel% diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 3a563eb59982..f0b74e919692 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -14,6 +14,7 @@ Param( [switch] $sign, [switch] $pack, [switch] $publish, + [switch] $pushBuildAssets, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -43,6 +44,7 @@ function Print-Usage() { Write-Host " -performanceTest Run all performance tests in the solution" Write-Host " -sign Sign build outputs" Write-Host " -publish Publish artifacts (e.g. symbols)" + Write-Host " -pushBuildAssets Push assets to BAR" Write-Host "" Write-Host "Advanced settings:" @@ -79,14 +81,14 @@ function InitializeDotNetCli { # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. - if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.sdk.version)"))) { + if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.tools.dotnet)"))) { $dotnetRoot = $env:DOTNET_INSTALL_DIR } else { $dotnetRoot = Join-Path $RepoRoot ".dotnet" $env:DOTNET_INSTALL_DIR = $dotnetRoot if ($restore) { - InstallDotNetSdk $dotnetRoot $GlobalJson.sdk.version + InstallDotNetSdk $dotnetRoot $GlobalJson.tools.dotnet } } @@ -130,7 +132,7 @@ function InitializeVisualStudioBuild { } function LocateVisualStudio { - $vswhereVersion = $GlobalJson.vswhere.version + $vswhereVersion = $GlobalJson.tools.vswhere $toolsRoot = Join-Path $RepoRoot ".tools" $vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion" $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe" @@ -152,7 +154,9 @@ function LocateVisualStudio { } function GetBuildCommand() { - if ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) { + $tools = $GlobalJson.tools + + if ((Get-Member -InputObject $tools -Name "dotnet") -ne $null) { $dotnetRoot = InitializeDotNetCli # by default build with dotnet cli: @@ -160,7 +164,7 @@ function GetBuildCommand() { $buildArgs = "msbuild" } - if ((Get-Member -InputObject $GlobalJson -Name "vswhere") -ne $null) { + if ((Get-Member -InputObject $tools -Name "vswhere") -ne $null) { $vsInstallDir = InitializeVisualStudioBuild # Presence of vswhere.version indicates the repo needs to build using VS msbuild: @@ -169,7 +173,7 @@ function GetBuildCommand() { } if ($buildDriver -eq $null) { - Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red + Write-Host "/global.json must either specify 'tools.dotnet' or 'tools.vswhere'." -ForegroundColor Red exit 1 } @@ -247,6 +251,8 @@ function Build([string] $buildDriver, [string]$buildArgs) { /p:PerformanceTest=$performanceTest ` /p:Sign=$sign ` /p:Publish=$publish ` + /p:PushBuildAssets=$pushBuildAssets ` + /p:ContinuousIntegrationBuild=$ci ` /p:CIBuild=$ci ` $properties @@ -268,10 +274,10 @@ try { $EngRoot = Join-Path $PSScriptRoot ".." $ArtifactsDir = Join-Path $RepoRoot "artifacts" $ToolsetDir = Join-Path $ArtifactsDir "toolset" - $LogDir = Join-Path (Join-Path $ArtifactsDir $configuration) "log" + $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration $BuildLog = Join-Path $LogDir "Build.binlog" $ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog" - $TempDir = Join-Path (Join-Path $ArtifactsDir $configuration) "tmp" + $TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json if ($projects -eq "") { diff --git a/eng/common/build.sh b/eng/common/build.sh index 17c1a715f4cc..6ee504bbae8e 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -30,14 +30,6 @@ prepare_machine=false verbosity='minimal' properties='' -repo_root="$scriptroot/../.." -eng_root="$scriptroot/.." -artifacts_dir="$repo_root/artifacts" - -global_json_file="$repo_root/global.json" -build_driver="" -toolset_build_proj="" - while (($# > 0)); do lowerI="$(echo $1 | awk '{print tolower($0)}')" case $lowerI in @@ -126,20 +118,22 @@ while (($# > 0)); do esac done -artifacts_configuration_dir="$artifacts_dir/$configuration" +repo_root="$scriptroot/../.." +eng_root="$scriptroot/.." +artifacts_dir="$repo_root/artifacts" toolset_dir="$artifacts_dir/toolset" -log_dir="$artifacts_configuration_dir/log" +log_dir="$artifacts_dir/log/$configuration" build_log="$log_dir/Build.binlog" toolset_restore_log="$log_dir/ToolsetRestore.binlog" -temp_dir="$artifacts_configuration_dir/tmp" +temp_dir="$artifacts_dir/tmp/$configuration" -# ReadJson [filename] [json key] -# Result: Sets 'readjsonvalue' to the value of the provided json key -# Note: this method may return unexpected results if there are duplicate -# keys in the json -function ReadJson { - local file=$1 - local key=$2 +global_json_file="$repo_root/global.json" +build_driver="" +toolset_build_proj="" + +# ReadVersionFromJson [json key] +function ReadGlobalVersion { + local key=$1 local unamestr="$(uname)" local sedextended='-r' @@ -147,11 +141,14 @@ function ReadJson { sedextended='-E' fi; - readjsonvalue="$(grep -m 1 "\"$key\"" $file | sed $sedextended 's/^ *//;s/.*: *"//;s/",?//')" - if [[ ! "$readjsonvalue" ]]; then - echo "Error: Cannot find \"$key\" in $file" >&2; + local version="$(grep -m 1 "\"$key\"" $global_json_file | sed $sedextended 's/^ *//;s/.*: *"//;s/",?//')" + if [[ ! "$version" ]]; then + echo "Error: Cannot find \"$key\" in $global_json_file" >&2; ExitWithExitCode 1 fi; + + # return value + echo "$version" } function InitializeDotNetCli { @@ -166,8 +163,8 @@ function InitializeDotNetCli { export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" fi - ReadJson "$global_json_file" "version" - local dotnet_sdk_version="$readjsonvalue" + + local dotnet_sdk_version=`ReadGlobalVersion "dotnet"` local dotnet_root="" # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, @@ -221,8 +218,7 @@ function GetDotNetInstallScript { } function InitializeToolset { - ReadJson $global_json_file "Microsoft.DotNet.Arcade.Sdk" - local toolset_version=$readjsonvalue + local toolset_version=`ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk"` local toolset_location_file="$toolset_dir/$toolset_version.txt" if [[ -a "$toolset_location_file" ]]; then @@ -283,6 +279,7 @@ function Build { /p:PerformanceTest=$performance_test \ /p:Sign=$sign \ /p:Publish=$publish \ + /p:ContinuousIntegrationBuild=$ci \ /p:CIBuild=$ci \ $properties local lastexitcode=$? diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index 8fceb655c0b5..9144d4254729 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -67,8 +67,8 @@ try { Write-Host "Unable to find '$GlobalJsonFile'" exit 0 } - $NativeTools = Get-Content($GlobalJsonFile) -Raw | - ConvertFrom-Json | + $NativeTools = Get-Content($GlobalJsonFile) -Raw | + ConvertFrom-Json | Select-Object -Expand "native-tools" -ErrorAction SilentlyContinue if ($NativeTools) { $NativeTools.PSObject.Properties | ForEach-Object { @@ -112,6 +112,9 @@ try { } if (Test-Path $InstallBin) { Write-Host "Native tools are available from" (Convert-Path -Path $InstallBin) + if ($env:BUILD_BUILDNUMBER) { + Write-Host "##vso[task.prependpath]" (Convert-Path -Path $InstallBin) + } } else { Write-Error "Native tools install directory does not exist, installation failed" diff --git a/eng/common/is-vsts.ps1 b/eng/common/is-vsts.ps1 deleted file mode 100644 index f88472955692..000000000000 --- a/eng/common/is-vsts.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -if ($env:Build_BuildNumber) { - return $true -} -else { - return $false -} diff --git a/eng/common/is-vsts.sh b/eng/common/is-vsts.sh deleted file mode 100755 index f7086fae0ff0..000000000000 --- a/eng/common/is-vsts.sh +++ /dev/null @@ -1,5 +0,0 @@ -if [ ! -z $BUILD_BUILDNUMBER ]; then - exit 0 -else - exit 1 -fi diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 new file mode 100644 index 000000000000..f31b558c2d4a --- /dev/null +++ b/eng/common/native/CommonLibrary.psm1 @@ -0,0 +1,351 @@ +<# +.SYNOPSIS +Helper module to install an archive to a directory + +.DESCRIPTION +Helper module to download and extract an archive to a specified directory + +.PARAMETER Uri +Uri of artifact to download + +.PARAMETER InstallDirectory +Directory to extract artifact contents to + +.PARAMETER Force +Force download / extraction if file or contents already exist. Default = False + +.PARAMETER DownloadRetries +Total number of retry attempts. Default = 5 + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds. Default = 30 + +.NOTES +Returns False if download or extraction fail, True otherwise +#> +function DownloadAndExtract { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Uri, + [Parameter(Mandatory=$True)] + [string] $InstallDirectory, + [switch] $Force = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30 + ) + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $TempToolPath = CommonLibrary\Get-TempPathFilename -Path $Uri + + # Download native tool + $DownloadStatus = CommonLibrary\Get-File -Uri $Uri ` + -Path $TempToolPath ` + -DownloadRetries $DownloadRetries ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Force:$Force ` + -Verbose:$Verbose + + if ($DownloadStatus -Eq $False) { + Write-Error "Download failed" + return $False + } + + # Extract native tool + $UnzipStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath ` + -OutputDirectory $InstallDirectory ` + -Force:$Force ` + -Verbose:$Verbose + + if ($UnzipStatus -Eq $False) { + Write-Error "Unzip failed" + return $False + } + return $True +} + +<# +.SYNOPSIS +Download a file, retry on failure + +.DESCRIPTION +Download specified file and retry if attempt fails + +.PARAMETER Uri +Uri of file to download. If Uri is a local path, the file will be copied instead of downloaded + +.PARAMETER Path +Path to download or copy uri file to + +.PARAMETER Force +Overwrite existing file if present. Default = False + +.PARAMETER DownloadRetries +Total number of retry attempts. Default = 5 + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds Default = 30 + +#> +function Get-File { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Uri, + [Parameter(Mandatory=$True)] + [string] $Path, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30, + [switch] $Force = $False + ) + $Attempt = 0 + + if ($Force) { + if (Test-Path $Path) { + Remove-Item $Path -Force + } + } + if (Test-Path $Path) { + Write-Host "File '$Path' already exists, skipping download" + return $True + } + + $DownloadDirectory = Split-Path -ErrorAction Ignore -Path "$Path" -Parent + if (-Not (Test-Path $DownloadDirectory)) { + New-Item -path $DownloadDirectory -force -itemType "Directory" | Out-Null + } + + if (Test-Path -IsValid -Path $Uri) { + Write-Verbose "'$Uri' is a file path, copying file to '$Path'" + Copy-Item -Path $Uri -Destination $Path + return $? + } + else { + Write-Verbose "Downloading $Uri" + while($Attempt -Lt $DownloadRetries) + { + try { + Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $Path + Write-Verbose "Downloaded to '$Path'" + return $True + } + catch { + $Attempt++ + if ($Attempt -Lt $DownloadRetries) { + $AttemptsLeft = $DownloadRetries - $Attempt + Write-Warning "Download failed, $AttemptsLeft attempts remaining, will retry in $RetryWaitTimeInSeconds seconds" + Start-Sleep -Seconds $RetryWaitTimeInSeconds + } + else { + Write-Error $_ + Write-Error $_.Exception + } + } + } + } + + return $False +} + +<# +.SYNOPSIS +Generate a shim for a native tool + +.DESCRIPTION +Creates a wrapper script (shim) that passes arguments forward to native tool assembly + +.PARAMETER ShimPath +Path to shim file + +.PARAMETER ToolFilePath +Path to file that shim forwards to + +.PARAMETER Force +Replace shim if already present. Default = False + +.NOTES +Returns $True if generating shim succeeds, $False otherwise +#> +function New-ScriptShim { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $ShimPath, + [Parameter(Mandatory=$True)] + [string] $ToolFilePath, + [switch] $Force + ) + try { + Write-Verbose "Generating '$ShimPath' shim" + + if ((Test-Path $ShimPath) -And (-Not $Force)) { + Write-Error "$ShimPath already exists" + return $False + } + + if (-Not (Test-Path $ToolFilePath)){ + Write-Error "Specified tool file path '$ToolFilePath' does not exist" + return $False + } + + $ShimContents = "@echo off`n" + $ShimContents += "setlocal enableextensions enabledelayedexpansion`n" + $ShimContents += "set SHIMARGS=`n" + $ShimContents += "for %%x in (%*) do (set SHIMARGS=!SHIMARGS! `"%%~x`")`n" + $ShimContents += "`"$ToolFilePath`" %SHIMARGS%`n" + $ShimContents += "endlocal" + + # Write shim file + $ShimContents | Out-File $ShimPath -Encoding "ASCII" + + if (-Not $?) { + Write-Error "Failed to generate shim" + return $False + } + return $True + } + catch { + Write-Host $_ + Write-Host $_.Exception + return $False + } +} + +<# +.SYNOPSIS +Returns the machine architecture of the host machine + +.NOTES +Returns 'x64' on 64 bit machines + Returns 'x86' on 32 bit machines +#> +function Get-MachineArchitecture { + $ProcessorArchitecture = $Env:PROCESSOR_ARCHITECTURE + $ProcessorArchitectureW6432 = $Env:PROCESSOR_ARCHITEW6432 + if($ProcessorArchitecture -Eq "X86") + { + if(($ProcessorArchitectureW6432 -Eq "") -Or + ($ProcessorArchitectureW6432 -Eq "X86")) { + return "x86" + } + $ProcessorArchitecture = $ProcessorArchitectureW6432 + } + if (($ProcessorArchitecture -Eq "AMD64") -Or + ($ProcessorArchitecture -Eq "IA64") -Or + ($ProcessorArchitecture -Eq "ARM64")) { + return "x64" + } + return "x86" +} + +<# +.SYNOPSIS +Get the name of a temporary folder under the native install directory +#> +function Get-TempDirectory { + return Join-Path (Get-NativeInstallDirectory) "temp/" +} + +function Get-TempPathFilename { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $Path + ) + $TempDir = CommonLibrary\Get-TempDirectory + $TempFilename = Split-Path $Path -leaf + $TempPath = Join-Path $TempDir $TempFilename + return $TempPath +} + +<# +.SYNOPSIS +Returns the base directory to use for native tool installation + +.NOTES +Returns the value of the NETCOREENG_INSTALL_DIRECTORY if that environment variable +is set, or otherwise returns an install directory under the %USERPROFILE% +#> +function Get-NativeInstallDirectory { + $InstallDir = $Env:NETCOREENG_INSTALL_DIRECTORY + if (!$InstallDir) { + $InstallDir = Join-Path $Env:USERPROFILE ".netcoreeng/native/" + } + return $InstallDir +} + +<# +.SYNOPSIS +Unzip an archive + +.DESCRIPTION +Powershell module to unzip an archive to a specified directory + +.PARAMETER ZipPath (Required) +Path to archive to unzip + +.PARAMETER OutputDirectory (Required) +Output directory for archive contents + +.PARAMETER Force +Overwrite output directory contents if they already exist + +.NOTES +- Returns True and does not perform an extraction if output directory already exists but Overwrite is not True. +- Returns True if unzip operation is successful +- Returns False if Overwrite is True and it is unable to remove contents of OutputDirectory +- Returns False if unable to extract zip archive +#> +function Expand-Zip { + [CmdletBinding(PositionalBinding=$false)] + Param ( + [Parameter(Mandatory=$True)] + [string] $ZipPath, + [Parameter(Mandatory=$True)] + [string] $OutputDirectory, + [switch] $Force + ) + + Write-Verbose "Extracting '$ZipPath' to '$OutputDirectory'" + try { + if ((Test-Path $OutputDirectory) -And (-Not $Overwrite)) { + Write-Host "Directory '$OutputDirectory' already exists, skipping extract" + return $True + } + if (Test-Path $OutputDirectory) { + Write-Verbose "'Force' is 'True', but '$OutputDirectory' exists, removing directory" + Remove-Item $OutputDirectory -Force -Recurse + if ($? -Eq $False) { + Write-Error "Unable to remove '$OutputDirectory'" + return $False + } + } + if (-Not (Test-Path $OutputDirectory)) { + New-Item -path $OutputDirectory -Force -itemType "Directory" | Out-Null + } + + Add-Type -assembly "system.io.compression.filesystem" + [io.compression.zipfile]::ExtractToDirectory("$ZipPath", "$OutputDirectory") + if ($? -Eq $False) { + Write-Error "Unable to extract '$ZipPath'" + return $False + } + } + catch { + Write-Host $_ + Write-Host $_.Exception + + return $False + } + return $True +} + +export-modulemember -function DownloadAndExtract +export-modulemember -function Expand-Zip +export-modulemember -function Get-File +export-modulemember -function Get-MachineArchitecture +export-modulemember -function Get-NativeInstallDirectory +export-modulemember -function Get-TempDirectory +export-modulemember -function Get-TempPathFilename +export-modulemember -function New-ScriptShim diff --git a/eng/common/native/install-cmake.ps1 b/eng/common/native/install-cmake.ps1 new file mode 100644 index 000000000000..4ecbe1de3f5d --- /dev/null +++ b/eng/common/native/install-cmake.ps1 @@ -0,0 +1,119 @@ +<# +.SYNOPSIS +Install cmake native tool + +.DESCRIPTION +Install cmake native tool from Azure blob storage + +.PARAMETER InstallPath +Base directory to install native tool to + +.PARAMETER BaseUri +Base file directory or Url from which to acquire tool archives + +.PARAMETER CommonLibraryDirectory +Path to folder containing common library modules + +.PARAMETER Force +Force install of tools even if they previously exist + +.PARAMETER Clean +Don't install the tool, just clean up the current install of the tool + +.PARAMETER DownloadRetries +Total number of retry attempts + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds + +.NOTES +Returns 0 if install succeeds, 1 otherwise +#> +[CmdletBinding(PositionalBinding=$false)] +Param ( + [Parameter(Mandatory=$True)] + [string] $InstallPath, + [Parameter(Mandatory=$True)] + [string] $BaseUri, + [Parameter(Mandatory=$True)] + [string] $Version, + [string] $CommonLibraryDirectory = $PSScriptRoot, + [switch] $Force = $False, + [switch] $Clean = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30 +) + +# Import common library modules +Import-Module -Name (Join-Path $CommonLibraryDirectory "CommonLibrary.psm1") + +try { + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $ToolName = "cmake" + + $Arch = CommonLibrary\Get-MachineArchitecture + $ToolOs = "win64" + if($Arch -Eq "x32") { + $ToolOs = "win32" + } + $ToolNameMoniker = "$ToolName-$Version-$ToolOs-$Arch" + $ToolInstallDirectory = Join-Path $InstallPath "$ToolName\$Version\" + $ToolFilePath = Join-Path $ToolInstallDirectory "$ToolNameMoniker\bin\$ToolName.exe" + $ShimPath = Join-Path $InstallPath "$ToolName.cmd" + $Uri = "$BaseUri/$ToolNameMoniker.zip" + + if ($Clean) { + Write-Host "Cleaning $ToolInstallDirectory" + if (Test-Path $ToolInstallDirectory) { + Remove-Item $ToolInstallDirectory -Force -Recurse + } + Write-Host "Cleaning $ShimPath" + if (Test-Path $ShimPath) { + Remove-Item $ShimPath -Force + } + $ToolTempPath = CommonLibrary\Get-TempPathFilename -Path $Uri + Write-Host "Cleaning $ToolTempPath" + if (Test-Path $ToolTempPath) { + Remove-Item $ToolTempPath -Force + } + exit 0 + } + + # Install tool + if ((Test-Path $ToolFilePath) -And (-Not $Force)) { + Write-Verbose "$ToolName ($Version) already exists, skipping install" + } + else { + $InstallStatus = CommonLibrary\DownloadAndExtract -Uri $Uri ` + -InstallDirectory $ToolInstallDirectory ` + -Force:$Force ` + -DownloadRetries $DownloadRetries ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Verbose:$Verbose + + if ($InstallStatus -Eq $False) { + Write-Error "Installation failed" + exit 1 + } + } + # Generate shim + # Always rewrite shims so that we are referencing the expected version + $GenerateShimStatus = CommonLibrary\New-ScriptShim -ShimPath $ShimPath ` + -ToolFilePath $ToolFilePath ` + -Force ` + -Verbose:$Verbose + + if ($GenerateShimStatus -Eq $False) { + Write-Error "Generate shim failed" + return 1 + } + + exit 0 +} +catch { + Write-Host $_ + Write-Host $_.Exception + exit 1 +} \ No newline at end of file diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml new file mode 100644 index 000000000000..1f3ce80edecb --- /dev/null +++ b/eng/common/templates/phases/base.yml @@ -0,0 +1,90 @@ +parameters: + # Optional: Clean sources before building + clean: true + + # Optional: Git fetch depth + fetchDepth: '' + + # Optional: name of the phase (not specifying phase name may cause name collisions) + name: '' + + # Required: A defined YAML queue + queue: {} + + # Required: build steps + steps: [] + + # Optional: variables + variables: {} + + ## Telemetry variables + + # Optional: enable sending telemetry + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _HelixBuildConfig - differentiate between Debug, Release, other + # _HelixSource - Example: build/product + # _HelixType - Example: official/dotnet/arcade/$(Build.SourceBranch) + enableTelemetry: false + + # Optional: Enable installing Microbuild plugin + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _TeamName - the name of your team + # _SignType - 'test' or 'real' + enableMicrobuild: false + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +phases: +- phase: ${{ parameters.name }} + + queue: ${{ parameters.queue }} + + ${{ if ne(parameters.variables, '') }}: + variables: ${{ parameters.variables }} + + steps: + - checkout: self + clean: ${{ parameters.clean }} + ${{ if ne(parameters.fetchDepth, '') }}: + fetchDepth: ${{ parameters.fetchDepth }} + + - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - template: /eng/common/templates/steps/telemetry-start.yml + parameters: + buildConfig: ${{ parameters.variables._HelixBuildConfig }} + helixSource: ${{ parameters.variables._HelixSource }} + helixType: ${{ parameters.variables._HelixType }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + # Internal only resource, and Microbuild signing shouldn't be applied to PRs. + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildSigningPlugin@1 + displayName: Install MicroBuild plugin + inputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dotnet.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + + env: + TeamName: $(_TeamName) + continueOnError: false + condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + + # Run provided build steps + - ${{ parameters.steps }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + # Internal only resources + - ${{ if ne(variables['System.TeamProject'], 'public') }}: + - task: MicroBuildCleanup@1 + displayName: Execute Microbuild cleanup tasks + condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + env: + TeamName: $(_TeamName) + + - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - template: /eng/common/templates/steps/telemetry-end.yml + parameters: + helixSource: ${{ parameters.variables._HelixSource }} + helixType: ${{ parameters.variables._HelixType }} diff --git a/eng/common/templates/phases/push-build-asset.yml b/eng/common/templates/phases/push-build-asset.yml new file mode 100644 index 000000000000..1aa1203c51e0 --- /dev/null +++ b/eng/common/templates/phases/push-build-asset.yml @@ -0,0 +1,26 @@ +parameters: + dependsOn: '' + queue: {} +phases: + - phase: Push to B.A.R. + dependsOn: ${{ parameters.dependsOn }} + queue: ${{ parameters.queue }} + steps: + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + condition: succeeded() + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'DotNet-Engineering-Services_KeyVault' + KeyVaultName: EngKeyVault + SecretsFilter: 'MaestroAccessToken' + condition: succeeded() + - script: eng\common\pushbuildassets.cmd + /p:ManifestZipFilePath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro-int.westus2.cloudapp.azure.com + displayName: Push Build Assets \ No newline at end of file diff --git a/eng/common/templates/steps/build-reason.yml b/eng/common/templates/steps/build-reason.yml new file mode 100644 index 000000000000..eba58109b52c --- /dev/null +++ b/eng/common/templates/steps/build-reason.yml @@ -0,0 +1,12 @@ +# build-reason.yml +# Description: runs steps if build.reason condition is valid. conditions is a string of valid build reasons +# to include steps (',' separated). +parameters: + conditions: '' + steps: [] + +steps: + - ${{ if and( not(startsWith(parameters.conditions, 'not')), contains(parameters.conditions, variables['build.reason'])) }}: + - ${{ parameters.steps }} + - ${{ if and( startsWith(parameters.conditions, 'not'), not(contains(parameters.conditions, variables['build.reason']))) }}: + - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/run-on-unix.yml b/eng/common/templates/steps/run-on-unix.yml new file mode 100644 index 000000000000..e1733814f65d --- /dev/null +++ b/eng/common/templates/steps/run-on-unix.yml @@ -0,0 +1,7 @@ +parameters: + agentOs: '' + steps: [] + +steps: +- ${{ if ne(parameters.agentOs, 'Windows_NT') }}: + - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/run-on-windows.yml b/eng/common/templates/steps/run-on-windows.yml new file mode 100644 index 000000000000..73e7e9c275a1 --- /dev/null +++ b/eng/common/templates/steps/run-on-windows.yml @@ -0,0 +1,7 @@ +parameters: + agentOs: '' + steps: [] + +steps: +- ${{ if eq(parameters.agentOs, 'Windows_NT') }}: + - ${{ parameters.steps }} diff --git a/eng/common/templates/steps/run-script-ifequalelse.yml b/eng/common/templates/steps/run-script-ifequalelse.yml new file mode 100644 index 000000000000..3d1242f5587c --- /dev/null +++ b/eng/common/templates/steps/run-script-ifequalelse.yml @@ -0,0 +1,33 @@ +parameters: + # if parameter1 equals parameter 2, run 'ifScript' command, else run 'elsescript' command + parameter1: '' + parameter2: '' + ifScript: '' + elseScript: '' + + # name of script step + name: Script + + # display name of script step + displayName: If-Equal-Else Script + + # environment + env: {} + + # conditional expression for step execution + condition: '' + +steps: +- ${{ if and(ne(parameters.ifScript, ''), eq(parameters.parameter1, parameters.parameter2)) }}: + - script: ${{ parameters.ifScript }} + name: ${{ parameters.name }} + displayName: ${{ parameters.displayName }} + env: ${{ parameters.env }} + condition: ${{ parameters.condition }} + +- ${{ if and(ne(parameters.elseScript, ''), ne(parameters.parameter1, parameters.parameter2)) }}: + - script: ${{ parameters.elseScript }} + name: ${{ parameters.name }} + displayName: ${{ parameters.displayName }} + env: ${{ parameters.env }} + condition: ${{ parameters.condition }} \ No newline at end of file diff --git a/eng/common/templates/steps/telemetry-end.yml b/eng/common/templates/steps/telemetry-end.yml new file mode 100644 index 000000000000..9cfe3608b8e8 --- /dev/null +++ b/eng/common/templates/steps/telemetry-end.yml @@ -0,0 +1,67 @@ +parameters: + helixSource: 'undefined_defaulted_in_telemetry.yml' + helixType: 'undefined_defaulted_in_telemetry.yml' + +steps: +- bash: | + if [ "$AGENT_JOBSTATUS" = "Succeeded" ] || [ "$AGENT_JOBSTATUS" = "PartiallySucceeded" ]; then + errorCount=0 + else + errorCount=1 + fi + warningCount=0 + + # create a temporary file for curl output + res=`mktemp` + + curlResult=` + curl --verbose --output $res --write-out "%{http_code}"\ + -H 'Content-Type: application/json' \ + -H "X-Helix-Job-Token: $Helix_JobToken" \ + -H 'Content-Length: 0' \ + -X POST -G "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$Helix_WorkItemId/finish" \ + --data-urlencode "errorCount=$errorCount" \ + --data-urlencode "warningCount=$warningCount"` + curlStatus=$? + + if [ $curlStatus -eq 0 ]; then + if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then + curlStatus=$curlResult + fi + fi + + if [ $curlStatus -ne 0 ]; then + echo "Failed to Send Build Finish information" + vstsLogOutput="vso[task.logissue type=error;sourcepath=templates/steps/telemetry-end.yml;code=1;]Failed to Send Build Finish information: $curlStatus" + echo "##$vstsLogOutput" + exit 1 + fi + displayName: Send Unix Build End Telemetry + env: + # defined via VSTS variables in start-job.sh + Helix_JobToken: $(Helix_JobToken) + Helix_WorkItemId: $(Helix_WorkItemId) + condition: and(always(), ne(variables['Agent.Os'], 'Windows_NT')) +- powershell: | + if (($env:Agent_JobStatus -eq 'Succeeded') -or ($env:Agent_JobStatus -eq 'PartiallySucceeded')) { + $ErrorCount = 0 + } else { + $ErrorCount = 1 + } + $WarningCount = 0 + + try { + Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$env:Helix_WorkItemId/finish?errorCount=$ErrorCount&warningCount=$WarningCount" -Method Post -ContentType "application/json" -Body "" ` + -Headers @{ 'X-Helix-Job-Token'=$env:Helix_JobToken } + } + catch { + Write-Error $_ + Write-Error $_.Exception + exit 1 + } + displayName: Send Windows Build End Telemetry + env: + # defined via VSTS variables in start-job.ps1 + Helix_JobToken: $(Helix_JobToken) + Helix_WorkItemId: $(Helix_WorkItemId) + condition: and(always(),eq(variables['Agent.Os'], 'Windows_NT')) diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml new file mode 100644 index 000000000000..696956af2292 --- /dev/null +++ b/eng/common/templates/steps/telemetry-start.yml @@ -0,0 +1,154 @@ +parameters: + helixSource: 'undefined_defaulted_in_telemetry.yml' + helixType: 'undefined_defaulted_in_telemetry.yml' + buildConfig: '' + +steps: +- ${{ if not(eq(variables['System.TeamProject'], 'public')) }}: + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'HelixProd_KeyVault' + KeyVaultName: HelixProdKV + SecretsFilter: 'HelixApiAccessToken' + condition: always() +- bash: | + # create a temporary file + jobInfo=`mktemp` + + # write job info content to temporary file + cat > $jobInfo < Date: Tue, 28 Aug 2018 17:21:49 -0700 Subject: [PATCH 0011/2702] Create Version.Details.xml --- eng/Version.Details.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 eng/Version.Details.xml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml new file mode 100644 index 000000000000..e03ab293e7fc --- /dev/null +++ b/eng/Version.Details.xml @@ -0,0 +1,11 @@ + + + + + + + https://github.com/dotnet/arcade + + + + From b690aab3b9c2d0c755dc8dd1bbd5a2b0321cefae Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:10 +0000 Subject: [PATCH 0012/2702] Darc update of 'eng/Version.Details.xml' --- eng/Version.Details.xml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e03ab293e7fc..fcc307f9988d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,11 +1,10 @@ - - - - - - https://github.com/dotnet/arcade - - - - + + + + + https://github.com/dotnet/arcade + 5d929d63d7c7e43f79c704deb5e1a4d902208dd5 + + + \ No newline at end of file From cb5e1012d1f10416147fbb2b175281764353579d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:11 +0000 Subject: [PATCH 0013/2702] Darc update of 'eng/Versions.props' --- eng/Versions.props | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 15453b3d8263..f648ff32fe60 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - - - 1.0.0 - prerelease - + + + 1.0.0 + prerelease + \ No newline at end of file From d59ebe2f848ac091c60fa7a5f274e4c66e6de8b6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:12 +0000 Subject: [PATCH 0014/2702] Darc update of 'global.json' --- global.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/global.json b/global.json index 81b1d53a2fb5..9f1095c26f2b 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,8 @@ -{ - "tools": { - "dotnet": "2.1.300" - }, - "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18421.3" - } -} +{ + "tools": { + "dotnet": "2.1.300" + }, + "msbuild-sdks": { + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18428.1" + } +} \ No newline at end of file From 8d4e734a6c822280bbcb62d8850c56eb667395a8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:16 +0000 Subject: [PATCH 0015/2702] Updating contents of file 'eng/common/CIBuild.cmd' From c4881ca90ce2322a21a37423ef5220e58f7a8065 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:17 +0000 Subject: [PATCH 0016/2702] Updating contents of file 'eng/common/PushBuildAssets.cmd' From 766bcef77e1a2645c76615df6250973ae5dc86f0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:18 +0000 Subject: [PATCH 0017/2702] Updating contents of file 'eng/common/build.ps1' From 855bb87e077c93ae75fe7b92cf48e1f787abec06 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:19 +0000 Subject: [PATCH 0018/2702] Updating contents of file 'eng/common/build.sh' From ff00bc4bb76f9e39746340565ca5c8add730f57a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:20 +0000 Subject: [PATCH 0019/2702] Updating contents of file 'eng/common/cibuild.sh' From a8e2aec50b60c5eab748682866646855bbbd5aef Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:21 +0000 Subject: [PATCH 0020/2702] Updating contents of file 'eng/common/init-tools-native.cmd' From 614695821a10076f38272dde9a5eee5e27a089ba Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:22 +0000 Subject: [PATCH 0021/2702] Updating contents of file 'eng/common/init-tools-native.ps1' From 7d093c048aa548b8f0a3cf2e2e77d654a3b27323 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:23 +0000 Subject: [PATCH 0022/2702] Updating contents of file 'eng/common/native/CommonLibrary.psm1' From 55ca28dcee2f861c766570f723cd62872a298bf6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:24 +0000 Subject: [PATCH 0023/2702] Updating contents of file 'eng/common/native/install-cmake.ps1' From 814411d2a283e1cdc37fe26537196fec081618a5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:24 +0000 Subject: [PATCH 0024/2702] Updating contents of file 'eng/common/templates/phases/base.yml' From c8028d1b2eaef8b1c3664f7ae671d55c23ef6971 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:25 +0000 Subject: [PATCH 0025/2702] Updating contents of file 'eng/common/templates/phases/push-build-asset.yml' From 2b7db88acf3abc1bc9bb2b8b49c5a29f35b56df8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:26 +0000 Subject: [PATCH 0026/2702] Updating contents of file 'eng/common/templates/steps/build-reason.yml' From 214d85c7905bb76c6faf95cf0bc496e9b75b6fee Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:27 +0000 Subject: [PATCH 0027/2702] Updating contents of file 'eng/common/templates/steps/run-on-unix.yml' From 395f0c37b1f3ba053085f561dd00b635c1fdefec Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:28 +0000 Subject: [PATCH 0028/2702] Updating contents of file 'eng/common/templates/steps/run-on-windows.yml' From ae93c365098eca189efb1d016e6814f216fc5dc1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:29 +0000 Subject: [PATCH 0029/2702] Updating contents of file 'eng/common/templates/steps/run-script-ifequalelse.yml' From bff2227f8269da34dca8a137f53d6076ac06e878 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:30 +0000 Subject: [PATCH 0030/2702] Updating contents of file 'eng/common/templates/steps/telemetry-end.yml' From ff1b58d334684b4df0c792a8ec04332c5fbb0c51 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 01:16:31 +0000 Subject: [PATCH 0031/2702] Updating contents of file 'eng/common/templates/steps/telemetry-start.yml' From 72545243b84a0053171f18e406b6903761c56624 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:20 +0000 Subject: [PATCH 0032/2702] Darc update of 'eng/Version.Details.xml' --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fcc307f9988d..870791368821 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 5d929d63d7c7e43f79c704deb5e1a4d902208dd5 + 9b08c43c48dab81ab5aeb271f03341554dc81c38 \ No newline at end of file From 616ccf60506884431e8c56707e67f699ec4f3071 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:21 +0000 Subject: [PATCH 0033/2702] Darc update of 'eng/Versions.props' From f088ae22eea5f4e26929b509b39723806cafeaa1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:22 +0000 Subject: [PATCH 0034/2702] Darc update of 'global.json' --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 9f1095c26f2b..0cc2bef6fce4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18428.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18429.1" } } \ No newline at end of file From d7f6b9dc64c349f9a961e9dd67b872d890e06e90 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:27 +0000 Subject: [PATCH 0035/2702] Updating contents of file 'eng/common/CIBuild.cmd' From e7604315cef8e46341627c46d62abcd718ccb6e5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:28 +0000 Subject: [PATCH 0036/2702] Updating contents of file 'eng/common/PushBuildAssets.cmd' From 35633cbf25aefa5928e65a88f4c7c68f922dd37b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:29 +0000 Subject: [PATCH 0037/2702] Updating contents of file 'eng/common/build.ps1' From b5d06c22782b10ee1a0944f5adde3c120ccfd8c9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:30 +0000 Subject: [PATCH 0038/2702] Updating contents of file 'eng/common/build.sh' From cff5371e76fd1264db707b37bffd566c341c1667 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:31 +0000 Subject: [PATCH 0039/2702] Updating contents of file 'eng/common/cibuild.sh' From 5c3f5bb6e069b02708355f55bc947d49f1b2795a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:31 +0000 Subject: [PATCH 0040/2702] Updating contents of file 'eng/common/init-tools-native.cmd' From 4341da0873ffb16294f1f7c603f8260370d0e563 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:32 +0000 Subject: [PATCH 0041/2702] Updating contents of file 'eng/common/init-tools-native.ps1' From f2d4d7111ab642a1dc23b88a8ae27ebea0e647bd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:33 +0000 Subject: [PATCH 0042/2702] Updating contents of file 'eng/common/native/CommonLibrary.psm1' From 6146ba4d37830d6d3b8350b168e6c5ddb843ca59 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:34 +0000 Subject: [PATCH 0043/2702] Updating contents of file 'eng/common/native/install-cmake.ps1' From beec507a2d0dfba9ee72c9cefecb6becbbcac7d6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:35 +0000 Subject: [PATCH 0044/2702] Updating contents of file 'eng/common/templates/phases/base.yml' --- eng/common/templates/phases/base.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml index 1f3ce80edecb..7d5e1bd40efb 100644 --- a/eng/common/templates/phases/base.yml +++ b/eng/common/templates/phases/base.yml @@ -52,9 +52,9 @@ phases: - ${{ if eq(parameters.enableTelemetry, 'true') }}: - template: /eng/common/templates/steps/telemetry-start.yml parameters: - buildConfig: ${{ parameters.variables._HelixBuildConfig }} - helixSource: ${{ parameters.variables._HelixSource }} - helixType: ${{ parameters.variables._HelixType }} + buildConfig: $(_HelixBuildConfig) + helixSource: $(_HelixSource) + helixType: $(_HelixType) - ${{ if eq(parameters.enableMicrobuild, 'true') }}: # Internal only resource, and Microbuild signing shouldn't be applied to PRs. @@ -86,5 +86,5 @@ phases: - ${{ if eq(parameters.enableTelemetry, 'true') }}: - template: /eng/common/templates/steps/telemetry-end.yml parameters: - helixSource: ${{ parameters.variables._HelixSource }} - helixType: ${{ parameters.variables._HelixType }} + helixSource: $(_HelixSource) + helixType: $(_HelixType) From c3091a5f58902105adc1ed529c4a5df2c94aeb37 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:36 +0000 Subject: [PATCH 0045/2702] Updating contents of file 'eng/common/templates/phases/push-build-asset.yml' From b13675ba08ed490c39edbebb7a9ed7474ac977bb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:37 +0000 Subject: [PATCH 0046/2702] Updating contents of file 'eng/common/templates/steps/build-reason.yml' From 5d137e542e959462bc29cb0ea76698a6ef8d4ad9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:38 +0000 Subject: [PATCH 0047/2702] Updating contents of file 'eng/common/templates/steps/run-on-unix.yml' From 70dfd67f91bdd1606a702325c1eb6c44dfc29216 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:39 +0000 Subject: [PATCH 0048/2702] Updating contents of file 'eng/common/templates/steps/run-on-windows.yml' From 195406f8714b7e21345aae533eff903e6c09a13b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:40 +0000 Subject: [PATCH 0049/2702] Updating contents of file 'eng/common/templates/steps/run-script-ifequalelse.yml' From 039efbbb924ad3193638dfec7a848104f911a7c6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:42 +0000 Subject: [PATCH 0050/2702] Updating contents of file 'eng/common/templates/steps/telemetry-end.yml' From bd99554d0f5eb9ad63ee792f426583a66506082c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 17:24:42 +0000 Subject: [PATCH 0051/2702] Updating contents of file 'eng/common/templates/steps/telemetry-start.yml' From 14c9490936616be634593df1fc7294ee48597740 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Wed, 29 Aug 2018 18:21:49 +0000 Subject: [PATCH 0052/2702] [Darc-Update] Update dependencies from build 20180829.2 of https://github.com/dotnet/arcade (#21) * Darc update of 'eng/Version.Details.xml' * Darc update of 'eng/Versions.props' * Darc update of 'global.json' * Updating contents of file 'eng/common/CIBuild.cmd' * Updating contents of file 'eng/common/PushBuildAssets.cmd' * Updating contents of file 'eng/common/build.ps1' * Updating contents of file 'eng/common/build.sh' * Updating contents of file 'eng/common/cibuild.sh' * Updating contents of file 'eng/common/init-tools-native.cmd' * Updating contents of file 'eng/common/init-tools-native.ps1' * Updating contents of file 'eng/common/native/CommonLibrary.psm1' * Updating contents of file 'eng/common/native/install-cmake.ps1' * Updating contents of file 'eng/common/templates/phases/base.yml' * Updating contents of file 'eng/common/templates/phases/push-build-asset.yml' * Updating contents of file 'eng/common/templates/steps/build-reason.yml' * Updating contents of file 'eng/common/templates/steps/run-on-unix.yml' * Updating contents of file 'eng/common/templates/steps/run-on-windows.yml' * Updating contents of file 'eng/common/templates/steps/run-script-ifequalelse.yml' * Updating contents of file 'eng/common/templates/steps/telemetry-end.yml' * Updating contents of file 'eng/common/templates/steps/telemetry-start.yml' --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 870791368821..00ec5d96dd05 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 9b08c43c48dab81ab5aeb271f03341554dc81c38 + 2e3f2a03e9f32e7bf4114a1127759ceb9f779719 \ No newline at end of file diff --git a/global.json b/global.json index 0cc2bef6fce4..aff87d0fd96e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18429.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18429.2" } } \ No newline at end of file From 381c88651bc3be4bb27e2599f1d5651543855b2e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Thu, 30 Aug 2018 17:37:49 +0000 Subject: [PATCH 0053/2702] [Darc-Update] Update dependencies from build 20180829.9 of https://github.com/dotnet/arcade (#22) * Darc update of 'eng/Version.Details.xml' * Darc update of 'eng/Versions.props' * Darc update of 'global.json' * Updating contents of file 'eng/common/CIBuild.cmd' * Updating contents of file 'eng/common/PushBuildAssets.cmd' * Updating contents of file 'eng/common/build.ps1' * Updating contents of file 'eng/common/build.sh' * Updating contents of file 'eng/common/cibuild.sh' * Updating contents of file 'eng/common/init-tools-native.cmd' * Updating contents of file 'eng/common/init-tools-native.ps1' * Updating contents of file 'eng/common/native/CommonLibrary.psm1' * Updating contents of file 'eng/common/native/install-cmake.ps1' * Updating contents of file 'eng/common/templates/phases/base.yml' * Updating contents of file 'eng/common/templates/phases/push-build-asset.yml' * Updating contents of file 'eng/common/templates/steps/build-reason.yml' * Updating contents of file 'eng/common/templates/steps/run-on-unix.yml' * Updating contents of file 'eng/common/templates/steps/run-on-windows.yml' * Updating contents of file 'eng/common/templates/steps/run-script-ifequalelse.yml' * Updating contents of file 'eng/common/templates/steps/telemetry-end.yml' * Updating contents of file 'eng/common/templates/steps/telemetry-start.yml' --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 00ec5d96dd05..ff5c396fa1b4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 2e3f2a03e9f32e7bf4114a1127759ceb9f779719 + 7d15394e75fb4581feb9565b3070869b0e4b7bd8 \ No newline at end of file diff --git a/global.json b/global.json index aff87d0fd96e..0ff8d4e8201c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18429.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18429.9" } } \ No newline at end of file From 232ad6654f7f000523c24426a58e34359b46dd26 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Fri, 31 Aug 2018 10:25:21 -0700 Subject: [PATCH 0054/2702] Update badges for dnceng move --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 735a7beceac2..5d25470a0760 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Arcade Minimal CI Sample - [![Build status](https://dotnet.visualstudio.com/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_apis/build/status/116?branchName=master)](https://dotnet.visualstudio.com/public/_build/latest?definitionId=116&branch=master) + [![Build status](https://dnceng.visualstudio.com/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_apis/build/status/116?branchName=master)](https://dnceng.visualstudio.com/public/_build/latest?definitionId=116&branch=master) This repository serves as an example of how to link GitHub repositories to VSTS for CI and PR builds. @@ -142,4 +142,4 @@ phases: Arcade provides an optimized way to sign files using MicroBuild, it is wrapped in a custom MSBuild task called [SignToolTask](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs). -The Arcade SDK will automatically [find package](https://github.com/dotnet/arcade/blob/ae38bbbc25d03e1deb49b15ce88e2dd4c683e116/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj) files and forward them to be signed using SignToolTask. Therefore, if the only files that you care to sign are covered by the linked line above you don't have to do anything else. If not, you have options. You can specify explicit files to be signed / excluded from signing or changing the certificate / strong name to be used. For a detailed guide see the [SignTool package documentation](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.SignTool/README.md). \ No newline at end of file +The Arcade SDK will automatically [find package](https://github.com/dotnet/arcade/blob/ae38bbbc25d03e1deb49b15ce88e2dd4c683e116/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj) files and forward them to be signed using SignToolTask. Therefore, if the only files that you care to sign are covered by the linked line above you don't have to do anything else. If not, you have options. You can specify explicit files to be signed / excluded from signing or changing the certificate / strong name to be used. For a detailed guide see the [SignTool package documentation](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.SignTool/README.md). From 75906c986c52424d48fdb335c1a0fcf35dac2878 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Fri, 31 Aug 2018 10:26:22 -0700 Subject: [PATCH 0055/2702] Enable public telemetry for sample (#16) * Enable public telemetry for sample * Set true for osx and linux * Fix formatting * Fix how telemetry vars are referenced (I'll backport) --- .vsts-ci.yml | 13 ++++++++++--- README.md | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 1f09ac37263d..cbe4b7f9b5e2 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -1,6 +1,8 @@ variables: Build.Repository.Clean: true targetFramework: netcoreapp2.0 + _HelixType: build/product + _HelixSource: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) trigger: - master @@ -15,7 +17,7 @@ phases: parameters: agentOs: Windows_NT name: Windows_NT - enableTelemetry: false + enableTelemetry: true queue: name: Helix parallel: 99 @@ -31,12 +33,14 @@ phases: name: Build displayName: Build condition: succeeded() + variables: + _HelixBuildConfig: $(_BuildConfig) - template: /eng/common/templates/phases/base.yml parameters: agentOs: OSX name: OSX - enableTelemetry: false + enableTelemetry: true queue: name: Hosted macOS Preview parallel: 99 @@ -52,12 +56,14 @@ phases: name: Build displayName: Build condition: succeeded() + variables: + _HelixBuildConfig: $(_BuildConfig) - template: /eng/common/templates/phases/base.yml parameters: agentOs: Linux name: Linux - enableTelemetry: false + enableTelemetry: true queue: name: DotNetCore-Linux parallel: 99 @@ -74,5 +80,6 @@ phases: displayName: Build condition: succeeded() variables: + _HelixBuildConfig: $(_BuildConfig) # Run build in docker container _PREVIEW_VSTS_DOCKER_IMAGE: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20170319080304 \ No newline at end of file diff --git a/README.md b/README.md index 5d25470a0760..1e73f9ee3449 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ trigger: ## Base your builds on Arcade for ease of use -Arcade is designed to make many of the more complex tasks (such as sending telemetry) simple to do out of the box. While these features are not available yet, they are actively being developed, and it is therefore recommended that all builds base themselves on Arcade's `base.yml` template. Today, this can be done by copying the `eng/common` folder from Arcade into a local `eng/common` folder. In the near future, Engineering services will provide the capability to auto-update this folder via Maestro so that you don't need to manually take updates to common Arcade scripts. +Arcade is designed to make many of the more complex tasks (such as sending telemetry) simple to do out of the box. It is therefore recommended that all builds base themselves on Arcade's `base.yml` template. Today, this can be done by copying the `eng/common` folder from Arcade into a local `eng/common` folder. In the near future, Engineering services will provide the capability to auto-update this folder via Maestro so that you don't need to manually take updates to common Arcade scripts. ```yaml phases: From ac2e7d7b6d86d53409eadeedc53fd4d55c1c6852 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Fri, 31 Aug 2018 22:15:58 +0000 Subject: [PATCH 0056/2702] [Darc-Update] Update dependencies from build 20180831.7 of https://github.com/dotnet/arcade (#23) * Darc update of 'eng/Version.Details.xml' * Darc update of 'eng/Versions.props' * Darc update of 'global.json' * Updating contents of file 'eng/common/CIBuild.cmd' * Updating contents of file 'eng/common/PublishBuildAssets.cmd' * Updating contents of file 'eng/common/build.ps1' * Updating contents of file 'eng/common/build.sh' * Updating contents of file 'eng/common/cibuild.sh' * Updating contents of file 'eng/common/init-tools-native.cmd' * Updating contents of file 'eng/common/init-tools-native.ps1' * Updating contents of file 'eng/common/native/CommonLibrary.psm1' * Updating contents of file 'eng/common/native/install-cmake.ps1' * Updating contents of file 'eng/common/templates/phases/base.yml' * Updating contents of file 'eng/common/templates/phases/publish-build-asset.yml' * Updating contents of file 'eng/common/templates/steps/build-reason.yml' * Updating contents of file 'eng/common/templates/steps/run-on-unix.yml' * Updating contents of file 'eng/common/templates/steps/run-on-windows.yml' * Updating contents of file 'eng/common/templates/steps/run-script-ifequalelse.yml' * Updating contents of file 'eng/common/templates/steps/telemetry-end.yml' * Updating contents of file 'eng/common/templates/steps/telemetry-start.yml' --- eng/Version.Details.xml | 4 +-- eng/common/PublishBuildAssets.cmd | 3 +++ eng/common/build.ps1 | 6 ++--- eng/common/templates/phases/base.yml | 2 +- .../templates/phases/publish-build-asset.yml | 26 +++++++++++++++++++ global.json | 2 +- 6 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 eng/common/PublishBuildAssets.cmd create mode 100644 eng/common/templates/phases/publish-build-asset.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ff5c396fa1b4..5de955544d83 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 7d15394e75fb4581feb9565b3070869b0e4b7bd8 + 6e0bc093074cf22dd9c8eae5394279371e0f35ae \ No newline at end of file diff --git a/eng/common/PublishBuildAssets.cmd b/eng/common/PublishBuildAssets.cmd new file mode 100644 index 000000000000..4f9d54d028a5 --- /dev/null +++ b/eng/common/PublishBuildAssets.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -publishBuildAssets %*" +exit /b %ErrorLevel% diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index f0b74e919692..575ff47e7d1e 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -14,7 +14,7 @@ Param( [switch] $sign, [switch] $pack, [switch] $publish, - [switch] $pushBuildAssets, + [switch] $publishBuildAssets, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -44,7 +44,7 @@ function Print-Usage() { Write-Host " -performanceTest Run all performance tests in the solution" Write-Host " -sign Sign build outputs" Write-Host " -publish Publish artifacts (e.g. symbols)" - Write-Host " -pushBuildAssets Push assets to BAR" + Write-Host " -publishBuildAssets Push assets to BAR" Write-Host "" Write-Host "Advanced settings:" @@ -251,7 +251,7 @@ function Build([string] $buildDriver, [string]$buildArgs) { /p:PerformanceTest=$performanceTest ` /p:Sign=$sign ` /p:Publish=$publish ` - /p:PushBuildAssets=$pushBuildAssets ` + /p:PublishBuildAssets=$publishBuildAssets ` /p:ContinuousIntegrationBuild=$ci ` /p:CIBuild=$ci ` $properties diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml index 7d5e1bd40efb..2ccebf235e26 100644 --- a/eng/common/templates/phases/base.yml +++ b/eng/common/templates/phases/base.yml @@ -64,7 +64,7 @@ phases: inputs: signType: $(_SignType) zipSources: false - feedSource: https://dotnet.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json env: TeamName: $(_TeamName) diff --git a/eng/common/templates/phases/publish-build-asset.yml b/eng/common/templates/phases/publish-build-asset.yml new file mode 100644 index 000000000000..d7739dc73da3 --- /dev/null +++ b/eng/common/templates/phases/publish-build-asset.yml @@ -0,0 +1,26 @@ +parameters: + dependsOn: '' + queue: {} +phases: + - phase: Push to B.A.R. + dependsOn: ${{ parameters.dependsOn }} + queue: ${{ parameters.queue }} + steps: + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + condition: succeeded() + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'DotNet-Engineering-Services_KeyVault' + KeyVaultName: EngKeyVault + SecretsFilter: 'MaestroAccessToken' + condition: succeeded() + - script: eng\common\publishbuildassets.cmd + /p:ManifestZipFilePath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro-int.westus2.cloudapp.azure.com + displayName: Push Build Assets \ No newline at end of file diff --git a/global.json b/global.json index 0ff8d4e8201c..d555624900c2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18429.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18431.7" } } \ No newline at end of file From 0c1cc6c948567ffbcdc138e2859e0e1aa195ef5c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Thu, 6 Sep 2018 20:40:29 +0000 Subject: [PATCH 0057/2702] Updating version files (#25) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5de955544d83..a9c4f00e30a4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6e0bc093074cf22dd9c8eae5394279371e0f35ae + 866a22afdad2fd106163e7597c65660305e87345 \ No newline at end of file diff --git a/global.json b/global.json index d555624900c2..6f8f4bfe4d8e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18431.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18455.13" } } \ No newline at end of file From 3549284378ff4aea3adb9a9850eaac2e30e012c9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro-int[bot]" Date: Fri, 7 Sep 2018 23:32:57 +0000 Subject: [PATCH 0058/2702] Updating version files (#27) --- eng/Version.Details.xml | 4 +-- eng/common/templates/phases/base.yml | 17 ++++++++++++ .../templates/phases/publish-build-assets.yml | 27 +++++++++++++++++++ global.json | 2 +- 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 eng/common/templates/phases/publish-build-assets.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a9c4f00e30a4..6a3b845c15d1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 866a22afdad2fd106163e7597c65660305e87345 + d785f23c298c227e5dd3fb4e0676a5d6197899b4 \ No newline at end of file diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml index 2ccebf235e26..79b42b18354b 100644 --- a/eng/common/templates/phases/base.yml +++ b/eng/common/templates/phases/base.yml @@ -88,3 +88,20 @@ phases: parameters: helixSource: $(_HelixSource) helixType: $(_HelixType) + + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.StagingDirectory)/AssetManifests' + continueOnError: false + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + - task: PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: false + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) \ No newline at end of file diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml new file mode 100644 index 000000000000..00072fe0de0a --- /dev/null +++ b/eng/common/templates/phases/publish-build-assets.yml @@ -0,0 +1,27 @@ +parameters: + dependsOn: '' + queue: {} +phases: + - phase: Asset_Registry_Publish + displayName: Publish to Build Asset Registry + dependsOn: ${{ parameters.dependsOn }} + queue: ${{ parameters.queue }} + steps: + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + condition: succeeded() + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'DotNet-Engineering-Services_KeyVault' + KeyVaultName: EngKeyVault + SecretsFilter: 'MaestroAccessToken' + condition: succeeded() + - script: eng\common\publishbuildassets.cmd + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + displayName: Publish Build Assets \ No newline at end of file diff --git a/global.json b/global.json index 6f8f4bfe4d8e..80cd28070e3b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18455.13" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18457.2" } } \ No newline at end of file From 331d41b70057f484016cd2063a963b67668aa4c0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 10 Sep 2018 21:03:04 +0000 Subject: [PATCH 0059/2702] [Darc-Update] Update dependencies from build 20180910.2 of https://github.com/dotnet/arcade (#29) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6a3b845c15d1..5400abeae015 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d785f23c298c227e5dd3fb4e0676a5d6197899b4 + 81d9b6d9749b921c9f11ee78f45624214a8f7a95 \ No newline at end of file diff --git a/global.json b/global.json index 80cd28070e3b..46d11690c7c4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18457.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18460.2" } } \ No newline at end of file From ddc4c181467d7c10a58531c8ea13f9843cd3a5a9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 12 Sep 2018 00:20:41 +0000 Subject: [PATCH 0060/2702] Updating version files (#31) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5400abeae015..43f6df614977 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 81d9b6d9749b921c9f11ee78f45624214a8f7a95 + 18bccd564c01863cf36e79b5d1d6cc885f8bbe8c \ No newline at end of file diff --git a/global.json b/global.json index 46d11690c7c4..07f4437193f4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18460.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18461.1" } } \ No newline at end of file From 69cb06f6bbfc13e5acf6ab50c40e487b320a530b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 12 Sep 2018 01:01:13 +0000 Subject: [PATCH 0061/2702] Updating version files (#32) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 43f6df614977..86a94ce7f338 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 18bccd564c01863cf36e79b5d1d6cc885f8bbe8c + 6be833dd4695db84fb472c7d3bd2eb1e3bf3c689 \ No newline at end of file diff --git a/global.json b/global.json index 07f4437193f4..46935aedde26 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18461.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18461.2" } } \ No newline at end of file From 8bb8f93389d78307c6b563df53c12bd54f4ca63c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Sep 2018 18:21:46 +0000 Subject: [PATCH 0062/2702] [Darc-Update] Update dependencies from build 20180913.2 of https://github.com/dotnet/arcade (#33) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 86a94ce7f338..82000ca4fa13 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6be833dd4695db84fb472c7d3bd2eb1e3bf3c689 + 14f0a3f7b34ab5a96dfafd121f4b7cbe42f70e2f \ No newline at end of file diff --git a/global.json b/global.json index 46935aedde26..67f62b4ae2e9 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18461.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18463.2" } } \ No newline at end of file From f75c099dbda1ad289916b7c9befc6e71ddf3d7da Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Sep 2018 22:28:52 +0000 Subject: [PATCH 0063/2702] Updating version files (#34) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 82000ca4fa13..659c8837efb4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 14f0a3f7b34ab5a96dfafd121f4b7cbe42f70e2f + 25a37b4f764d3feb66cebc985451490a435bfe8a \ No newline at end of file diff --git a/global.json b/global.json index 67f62b4ae2e9..c2bdaffc77cc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18463.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18463.3" } } \ No newline at end of file From 1041edc922b92017aa54b04503267d1c292154c9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Sep 2018 02:07:50 +0000 Subject: [PATCH 0064/2702] [Darc-Update] Update dependencies from build 20180913.6 of https://github.com/dotnet/arcade (#35) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 659c8837efb4..07129a323160 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 25a37b4f764d3feb66cebc985451490a435bfe8a + 5232f2acecbc7555817ebb03b6f86432dca4c74f \ No newline at end of file diff --git a/global.json b/global.json index c2bdaffc77cc..0e2ed38d5f85 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18463.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18463.6" } } \ No newline at end of file From 312b52d76b22aa87a28e5dd2325d749376510908 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Sep 2018 13:01:58 +0000 Subject: [PATCH 0065/2702] Updating version files (#36) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 07129a323160..c210f99989b7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 5232f2acecbc7555817ebb03b6f86432dca4c74f + 6a4412549bd79d2cdb729770f5d8c6bd9a0e6535 \ No newline at end of file diff --git a/global.json b/global.json index 0e2ed38d5f85..0f3ce9ae858f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18463.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18464.1" } } \ No newline at end of file From 22e4e8f062439a021a0dbc2f2fdbcb19906886f7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Sep 2018 16:43:52 +0000 Subject: [PATCH 0066/2702] Updating version files (#37) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c210f99989b7..92ceab99614f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6a4412549bd79d2cdb729770f5d8c6bd9a0e6535 + e847a3beca0e2a7c34f482270c9616d14fdad031 \ No newline at end of file diff --git a/global.json b/global.json index 0f3ce9ae858f..a5396ff729e1 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18464.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18464.2" } } \ No newline at end of file From 76fb9f5f97b8acfd4be89d76da536408d3059233 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Sep 2018 17:59:56 +0000 Subject: [PATCH 0067/2702] Updating version files (#38) --- eng/Version.Details.xml | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 92ceab99614f..61d46a21aa5c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,7 +2,7 @@ - + https://github.com/dotnet/arcade e847a3beca0e2a7c34f482270c9616d14fdad031 diff --git a/global.json b/global.json index a5396ff729e1..25b833996344 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18464.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18464.3" } } \ No newline at end of file From f9a7966edde0dcd1ca3dbf29c435312522a4619b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Sep 2018 22:12:53 +0000 Subject: [PATCH 0068/2702] Updating version files (#39) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 61d46a21aa5c..4b402e7aa958 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e847a3beca0e2a7c34f482270c9616d14fdad031 + aaec5445aad441199711a043f075060136925f5f \ No newline at end of file diff --git a/global.json b/global.json index 25b833996344..d8c3550cf33c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18464.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18464.4" } } \ No newline at end of file From 58edf1c934dea7ff91460ec16cc827743dec93ce Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 15 Sep 2018 12:56:52 +0000 Subject: [PATCH 0069/2702] Updating version files (#40) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4b402e7aa958..5be92b88bb32 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - aaec5445aad441199711a043f075060136925f5f + 31b842d2d961e48b778e4250c79268e8b6309221 \ No newline at end of file diff --git a/global.json b/global.json index d8c3550cf33c..d8500a320e2f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18464.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18465.1" } } \ No newline at end of file From 6e351e672baf7fe21f83d0cbc53e404a27e12734 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 16 Sep 2018 23:28:31 +0000 Subject: [PATCH 0070/2702] [Darc-Update] Update dependencies from build 20180916.2 of https://github.com/dotnet/arcade (#41) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5be92b88bb32..04e6fa5cc14b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 31b842d2d961e48b778e4250c79268e8b6309221 + d95243de4880ad5148cff82b66b2a5c7356f9859 \ No newline at end of file diff --git a/global.json b/global.json index d8500a320e2f..9bf9a7515558 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18465.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18466.2" } } \ No newline at end of file From 423cb5a264080d1eb61dc66a9d3a143d4dbc5094 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 17 Sep 2018 13:06:38 +0000 Subject: [PATCH 0071/2702] Updating version files (#42) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 04e6fa5cc14b..1fe71a12933c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d95243de4880ad5148cff82b66b2a5c7356f9859 + 2af4e5c75fa1bc3f1a752924f5b4f14e8e1dad1b \ No newline at end of file diff --git a/global.json b/global.json index 9bf9a7515558..2325e0a46c0f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18466.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18467.1" } } \ No newline at end of file From ba4d94de12a782d119eb2506fe22f9a7c7d93e2c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 17 Sep 2018 18:08:58 +0000 Subject: [PATCH 0072/2702] Updating version files (#43) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1fe71a12933c..7d7187f13727 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 2af4e5c75fa1bc3f1a752924f5b4f14e8e1dad1b + 90ceefe840a07d25bd78f3996e7ba963a26ba76d \ No newline at end of file diff --git a/global.json b/global.json index 2325e0a46c0f..aba2adca2bf0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18467.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18467.2" } } \ No newline at end of file From bc4a820d9bd35215bfdbacc001083b87baff1ce1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 18 Sep 2018 00:19:28 +0000 Subject: [PATCH 0073/2702] Updating version files (#44) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7d7187f13727..904f382c16ca 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 90ceefe840a07d25bd78f3996e7ba963a26ba76d + d5094760aed92bc349b4f4b639aa206c945dc641 \ No newline at end of file diff --git a/global.json b/global.json index aba2adca2bf0..2727849ddd83 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18467.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18467.3" } } \ No newline at end of file From 60683f76504c295db4b4359f3e0833b21ac5ceff Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 18 Sep 2018 00:58:18 +0000 Subject: [PATCH 0074/2702] Updating version files (#45) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 904f382c16ca..851f8dc238c5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d5094760aed92bc349b4f4b639aa206c945dc641 + 536edeceac6296a82ea7e22788b60c117f4f42ba \ No newline at end of file diff --git a/global.json b/global.json index 2727849ddd83..e535d6d070fd 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18467.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18467.4" } } \ No newline at end of file From 25f2846401b49b39073e79c96d4ea8a3a88289d3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 18 Sep 2018 15:45:24 +0000 Subject: [PATCH 0075/2702] [Darc-Update] Update dependencies from build 20180918.1 of https://github.com/dotnet/arcade (#46) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 851f8dc238c5..bbda31a7d9a9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 536edeceac6296a82ea7e22788b60c117f4f42ba + 45e7c5fcd4a26e22ebc578b2e697362ff31baef6 \ No newline at end of file diff --git a/global.json b/global.json index e535d6d070fd..5c5efc17a3b9 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18467.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18468.1" } } \ No newline at end of file From 8b29de185f325a08edbb843af1c462a3a941d05c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 18 Sep 2018 20:58:46 +0000 Subject: [PATCH 0076/2702] [Darc-Update] Update dependencies from build 20180918.3 of https://github.com/dotnet/arcade (#47) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bbda31a7d9a9..8a11f3267bd2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 45e7c5fcd4a26e22ebc578b2e697362ff31baef6 + da37f69a7357dc2f0988d9f70282b9ffb9d2a34e \ No newline at end of file diff --git a/global.json b/global.json index 5c5efc17a3b9..aabb3b212f31 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18468.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18468.3" } } \ No newline at end of file From f258b234780988d26c9fc96d0fe51fe5f2f4789f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Sep 2018 02:24:26 +0000 Subject: [PATCH 0077/2702] Updating version files (#48) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8a11f3267bd2..d0dbbe3bba91 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - da37f69a7357dc2f0988d9f70282b9ffb9d2a34e + 2e57c35ce78a62cb71a7ad69ee41963e20b8bf48 \ No newline at end of file diff --git a/global.json b/global.json index aabb3b212f31..2a0837b427de 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18468.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18468.6" } } \ No newline at end of file From d9d65afe8b2065a5665532d690b85fa3756bf6d1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Sep 2018 13:03:21 +0000 Subject: [PATCH 0078/2702] Updating version files (#49) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d0dbbe3bba91..7398bb528a85 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 2e57c35ce78a62cb71a7ad69ee41963e20b8bf48 + cf0b4c0c4d3f5cceb4a49f38315caaee7df2c1b3 \ No newline at end of file diff --git a/global.json b/global.json index 2a0837b427de..f245c02b62cd 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18468.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18469.1" } } \ No newline at end of file From 58f282dce4382147af56456fafb5ff67f271d0be Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Sep 2018 19:02:08 +0000 Subject: [PATCH 0079/2702] Updating version files (#50) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7398bb528a85..2772f02a6eee 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - cf0b4c0c4d3f5cceb4a49f38315caaee7df2c1b3 + 3d83b4f45d73eb77875a501fd631f593ce8901d0 \ No newline at end of file diff --git a/global.json b/global.json index f245c02b62cd..00fc4754c69f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18469.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18469.2" } } \ No newline at end of file From b5524573f7800ff78d2d49c83d54d15d43a0e260 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Sep 2018 21:06:29 +0000 Subject: [PATCH 0080/2702] Updating version files (#51) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2772f02a6eee..0b140f6cbd67 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3d83b4f45d73eb77875a501fd631f593ce8901d0 + 87ed226286e082ead5516be3f5a4f4cd975bfe54 \ No newline at end of file diff --git a/global.json b/global.json index 00fc4754c69f..1afb47263a55 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18469.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18469.3" } } \ No newline at end of file From 90a14090df7ff2a62f1a4c2413a656246ee131d4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 20 Sep 2018 13:12:44 +0000 Subject: [PATCH 0081/2702] Updating version files (#52) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 10 +++++----- global.json | 14 +++++++------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0b140f6cbd67..b63d8e81165d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,10 +1,10 @@ - - - - - https://github.com/dotnet/arcade - 87ed226286e082ead5516be3f5a4f4cd975bfe54 - - + + + + + https://github.com/dotnet/arcade + f5b2d081501b28ae1e71366ad694e173bd39ee5b + + \ No newline at end of file diff --git a/eng/Versions.props b/eng/Versions.props index f648ff32fe60..8df0a2de8911 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - - - 1.0.0 - prerelease - + + + 1.0.0 + prerelease + \ No newline at end of file diff --git a/global.json b/global.json index 1afb47263a55..8a97b32a7812 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,8 @@ -{ - "tools": { - "dotnet": "2.1.300" - }, - "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18469.3" - } +{ + "tools": { + "dotnet": "2.1.300" + }, + "msbuild-sdks": { + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.1" + } } \ No newline at end of file From 90dbe0bef0e4e190dae14f5ace7064e6408b153d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 20 Sep 2018 15:38:33 +0000 Subject: [PATCH 0082/2702] Updating version files (#53) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b63d8e81165d..262a0dac8d80 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - f5b2d081501b28ae1e71366ad694e173bd39ee5b + 40f7a2e40f980511267ac583042fcf949f907187 \ No newline at end of file diff --git a/global.json b/global.json index 8a97b32a7812..9a04ae6d973c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.2" } } \ No newline at end of file From 799842e2c88c8dbd6a4863840455f80b4ff71578 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 20 Sep 2018 18:17:28 +0000 Subject: [PATCH 0083/2702] Updating version files (#54) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 262a0dac8d80..00da6d1655bc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 40f7a2e40f980511267ac583042fcf949f907187 + fbd7346841bbaac8ce73a001354cb23eab54e217 \ No newline at end of file diff --git a/global.json b/global.json index 9a04ae6d973c..12f7af74f5f3 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.10" } } \ No newline at end of file From 48041a17d5c89c5f57a1d1b890c6c5ed6dac7790 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Sep 2018 00:14:56 +0000 Subject: [PATCH 0084/2702] Updating version files (#55) --- eng/Version.Details.xml | 4 ++-- eng/common/init-tools-native.ps1 | 8 ++++---- eng/common/native/install-cmake.ps1 | 2 +- global.json | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 00da6d1655bc..76509d87feab 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - fbd7346841bbaac8ce73a001354cb23eab54e217 + d7008a0399a393bd03bb3f3bcf3e1705afad355c \ No newline at end of file diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index 9144d4254729..45f4082bb103 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -3,7 +3,7 @@ Entry point script for installing native tools .DESCRIPTION -Reads $RepoRoot\eng\NativeToolsVersion.txt file to determine native assets to install +Reads $RepoRoot\global.json file to determine native assets to install and executes installers for those tools .PARAMETER BaseUri @@ -28,14 +28,14 @@ Total number of retry attempts .PARAMETER RetryWaitTimeInSeconds Wait time between retry attempts in seconds -.PARAMETER ToolsVersionsFile -File path to tools versions file +.PARAMETER GlobalJsonFile +File path to global.json file .NOTES #> [CmdletBinding(PositionalBinding=$false)] Param ( - [string] $BaseUri = "https://dotnetfeed.blob.core.windows.net/netcoreeng/native-assets", + [string] $BaseUri = "https://netcorenativeassets.blob.core.windows.net/resource-packages/external", [string] $InstallDirectory, [switch] $Clean = $False, [switch] $Force = $False, diff --git a/eng/common/native/install-cmake.ps1 b/eng/common/native/install-cmake.ps1 index 4ecbe1de3f5d..40fc9ac5591c 100644 --- a/eng/common/native/install-cmake.ps1 +++ b/eng/common/native/install-cmake.ps1 @@ -62,7 +62,7 @@ try { $ToolInstallDirectory = Join-Path $InstallPath "$ToolName\$Version\" $ToolFilePath = Join-Path $ToolInstallDirectory "$ToolNameMoniker\bin\$ToolName.exe" $ShimPath = Join-Path $InstallPath "$ToolName.cmd" - $Uri = "$BaseUri/$ToolNameMoniker.zip" + $Uri = "$BaseUri/windows/$Toolname/$ToolNameMoniker.zip" if ($Clean) { Write-Host "Cleaning $ToolInstallDirectory" diff --git a/global.json b/global.json index 12f7af74f5f3..fe84732472ab 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.24" } } \ No newline at end of file From e336a4bab9b1218d71dce3fb742fc975c29d5756 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Sep 2018 01:24:15 +0000 Subject: [PATCH 0085/2702] Updating version files (#56) --- eng/Version.Details.xml | 4 +- eng/common/init-tools-native.sh | 145 +++++++++++++++++++++++ eng/common/native/CommonLibrary.psm1 | 2 +- eng/common/native/common-library.sh | 168 +++++++++++++++++++++++++++ eng/common/native/install-cmake.sh | 117 +++++++++++++++++++ global.json | 2 +- 6 files changed, 434 insertions(+), 4 deletions(-) create mode 100644 eng/common/init-tools-native.sh create mode 100644 eng/common/native/common-library.sh create mode 100644 eng/common/native/install-cmake.sh diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 76509d87feab..1a860a2a1266 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d7008a0399a393bd03bb3f3bcf3e1705afad355c + ef4778e17127e468877e941214b63ed83653cb57 \ No newline at end of file diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh new file mode 100644 index 000000000000..54b70f678ba3 --- /dev/null +++ b/eng/common/init-tools-native.sh @@ -0,0 +1,145 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +base_uri='https://netcorenativeassets.blob.core.windows.net/resource-packages/external' +install_directory='' +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 +global_json_file="${scriptroot}/../../global.json" +declare -A native_assets + +. $scriptroot/native/common-library.sh + +while (($# > 0)); do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installdirectory) + install_directory=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --installdirectory Directory to install native toolset." + echo " This is a command-line override for the default" + echo " Install directory precedence order:" + echo " - InstallDirectory command-line override" + echo " - NETCOREENG_INSTALL_DIRECTORY environment variable" + echo " - (default) %USERPROFILE%/.netcoreeng/native" + echo "" + echo " --clean Switch specifying not to install anything, but cleanup native asset folders" + echo " --force Clean and then install tools" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --baseuri Base URI for where to download native tools from" + echo " --downloadretries Number of times a download should be attempted" + echo " --retrywaittimeseconds Wait time between download attempts" + echo "" + exit 0 + ;; + esac +done + +function ReadGlobalJsonNativeTools { + # Get the native-tools section from the global.json. + local native_tools_section=$(cat $global_json_file | awk '/"native-tools"/,/}/') + # Only extract the contents of the object. + local native_tools_list=$(echo $native_tools_section | awk -F"[{}]" '{print $2}') + native_tools_list=${native_tools_list//[\" ]/} + native_tools_list=${native_tools_list//,/$'\n'} + + local old_IFS=$IFS + while read -r line; do + # Lines are of the form: 'tool:version' + IFS=: + while read -r key value; do + native_assets[$key]=$value + done <<< "$line" + done <<< "$native_tools_list" + IFS=$old_IFS + + return 0; +} + +native_base_dir=$install_directory +if [[ -z $install_directory ]]; then + native_base_dir=$(GetNativeInstallDirectory) +fi + +install_bin="${native_base_dir}/bin" + +ReadGlobalJsonNativeTools + +if [[ ${#native_assets[@]} -eq 0 ]]; then + echo "No native tools defined in global.json" + exit 0; +else + native_installer_dir="$scriptroot/native" + for tool in "${!native_assets[@]}" + do + tool_version=${native_assets[$tool]} + installer_name="install-$tool.sh" + installer_command="$native_installer_dir/$installer_name" + installer_command+=" --baseuri $base_uri" + installer_command+=" --installpath $install_bin" + installer_command+=" --version $tool_version" + + if [[ $force = true ]]; then + installer_command+=" --force" + fi + + if [[ $clean = true ]]; then + installer_command+=" --clean" + fi + + echo "Installing $tool version $tool_version" + echo "Executing '$installer_command'" + $installer_command + + if [[ $? != 0 ]]; then + echo "Execution Failed" >&2 + exit 1 + fi + done +fi + +if [[ ! -z $clean ]]; then + exit 0 +fi + +if [[ -d $install_bin ]]; then + echo "Native tools are available from $install_bin" + if [[ !-z BUILD_BUILDNUMBER ]]; then + echo "##vso[task.prependpath]$install_bin" + fi +else + echo "Native tools install directory does not exist, installation failed" >&2 + exit 1 +fi + +exit 0 + diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index f31b558c2d4a..18fd261f103d 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -309,7 +309,7 @@ function Expand-Zip { Write-Verbose "Extracting '$ZipPath' to '$OutputDirectory'" try { - if ((Test-Path $OutputDirectory) -And (-Not $Overwrite)) { + if ((Test-Path $OutputDirectory) -And (-Not $Force)) { Write-Host "Directory '$OutputDirectory' already exists, skipping extract" return $True } diff --git a/eng/common/native/common-library.sh b/eng/common/native/common-library.sh new file mode 100644 index 000000000000..271bddfac5a9 --- /dev/null +++ b/eng/common/native/common-library.sh @@ -0,0 +1,168 @@ +#!/usr/bin/env bash + +function GetNativeInstallDirectory { + local install_dir + + if [[ -z $NETCOREENG_INSTALL_DIRECTORY ]]; then + install_dir=$HOME/.netcoreeng/native/ + else + install_dir=$NETCOREENG_INSTALL_DIRECTORY + fi + + echo $install_dir + return 0 +} + +function GetTempDirectory { + + echo $(GetNativeInstallDirectory)temp/ + return 0 +} + +function ExpandZip { + local zip_path=$1 + local output_directory=$2 + local force=${3:-false} + + echo "Extracting $zip_path to $output_directory" + if [[ -d $output_directory ]] && [[ $force = false ]]; then + echo "Directory '$output_directory' already exists, skipping extract" + return 0 + fi + + if [[ -d $output_directory ]]; then + echo "'Force flag enabled, but '$output_directory' exists. Removing directory" + rm -rf $output_directory + if [[ $? != 0 ]]; then + echo Unable to remove '$output_directory'>&2 + return 1 + fi + fi + + echo "Creating directory: '$output_directory'" + mkdir -p $output_directory + + echo "Extracting archive" + tar -xf $zip_path -C $output_directory + if [[ $? != 0 ]]; then + echo "Unable to extract '$zip_path'" >&2 + return 1 + fi + + return 0 +} + +function GetCurrentOS { + local unameOut="$(uname -s)" + case $unameOut in + Linux*) echo "Linux";; + Darwin*) echo "MacOS";; + esac + return 0 +} + +function GetFile { + local uri=$1 + local path=$2 + local force=${3:-false} + local download_retries=${4:-5} + local retry_wait_time_seconds=${5:-30} + + if [[ -f $path ]]; then + if [[ $force = false ]]; then + echo "File '$path' already exists. Skipping download" + return 0 + else + rm -rf $path + fi + fi + + if [[ -f $uri ]]; then + echo "'$uri' is a file path, copying file to '$path'" + cp $uri $path + return $? + fi + + echo "Downloading $uri" + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + curl "$uri" -sSL --retry $download_retries --retry-delay $retry_wait_time_seconds --create-dirs -o "$path" --fail + else + wget -q -O "$path" "$uri" --tries="$download_retries" + fi + + return $? +} + +function GetTempPathFileName { + local path=$1 + + local temp_dir=$(GetTempDirectory) + local temp_file_name=$(basename $path) + echo $temp_dir$temp_file_name + return 0 +} + +function DownloadAndExtract { + local uri=$1 + local installDir=$2 + local force=${3:-false} + local download_retries=${4:-5} + local retry_wait_time_seconds=${5:-30} + + local temp_tool_path=$(GetTempPathFileName $uri) + + echo "downloading to: $temp_tool_path" + + # Download file + GetFile "$uri" "$temp_tool_path" $force $download_retries $retry_wait_time_seconds + if [[ $? != 0 ]]; then + echo "Failed to download '$uri' to '$temp_tool_path'." >&2 + return 1 + fi + + # Extract File + echo "extracting from $temp_tool_path to $installDir" + ExpandZip "$temp_tool_path" "$installDir" $force $download_retries $retry_wait_time_seconds + if [[ $? != 0 ]]; then + echo "Failed to extract '$temp_tool_path' to '$installDir'." >&2 + return 1 + fi + + return 0 +} + +function NewScriptShim { + local shimpath=$1 + local tool_file_path=$2 + local force=${3:-false} + + echo "Generating '$shimpath' shim" + if [[ -f $shimpath ]]; then + if [[ $force = false ]]; then + echo "File '$shimpath' already exists." >&2 + return 1 + else + rm -rf $shimpath + fi + fi + + if [[ ! -f $tool_file_path ]]; then + echo "Specified tool file path:'$tool_file_path' does not exist" >&2 + return 1 + fi + + local shim_contents=$'#!/usr/bin/env bash\n' + shim_contents+="SHIMARGS="$'$1\n' + shim_contents+="$tool_file_path"$' $SHIMARGS\n' + + # Write shim file + echo "$shim_contents" > $shimpath + + chmod +x $shimpath + + echo "Finished generating shim '$shimpath'" + + return $? +} + diff --git a/eng/common/native/install-cmake.sh b/eng/common/native/install-cmake.sh new file mode 100644 index 000000000000..293af6017df1 --- /dev/null +++ b/eng/common/native/install-cmake.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. $scriptroot/common-library.sh + +base_uri= +install_path= +version= +clean=false +force=false +download_retries=5 +retry_wait_time_seconds=30 + +while (($# > 0)); do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + --baseuri) + base_uri=$2 + shift 2 + ;; + --installpath) + install_path=$2 + shift 2 + ;; + --version) + version=$2 + shift 2 + ;; + --clean) + clean=true + shift 1 + ;; + --force) + force=true + shift 1 + ;; + --downloadretries) + download_retries=$2 + shift 2 + ;; + --retrywaittimeseconds) + retry_wait_time_seconds=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --baseuri Base file directory or Url wrom which to acquire tool archives" + echo " --installpath Base directory to install native tool to" + echo " --clean Don't install the tool, just clean up the current install of the tool" + echo " --force Force install of tools even if they previously exist" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --downloadretries Total number of retry attempts" + echo " --retrywaittimeseconds Wait time between retry attempts in seconds" + echo "" + exit 0 + ;; + esac +done + +tool_name="cmake" +tool_os=$(GetCurrentOS) +tool_folder=$(echo $tool_os | awk '{print tolower($0)}') +tool_arch="x86_64" +tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" +tool_install_directory="$install_path/$tool_name/$version" +tool_file_path="$tool_install_directory/$tool_name_moniker/bin/$tool_name" +shim_path="$install_path/$tool_name.sh" +uri="${base_uri}/$tool_folder/cmake/$tool_name_moniker.tar.gz" + +# Clean up tool and installers +if [[ $clean = true ]]; then + echo "Cleaning $tool_install_directory" + if [[ -d $tool_install_directory ]]; then + rm -rf $tool_install_directory + fi + + echo "Cleaning $shim_path" + if [[ -f $shim_path ]]; then + rm -rf $shim_path + fi + + tool_temp_path=$(GetTempPathFileName $uri) + echo "Cleaning $tool_temp_path" + if [[ -f $tool_temp_path ]]; then + rm -rf $tool_temp_path + fi + + exit 0 +fi + +# Install tool +if [[ -f $tool_file_path ]] && [[ $force = false ]]; then + echo "$tool_name ($version) already exists, skipping install" + exit 0 +fi + +DownloadAndExtract $uri $tool_install_directory $force $download_retries $retry_wait_time_seconds + +if [[ $? != 0 ]]; then + echo "Installation failed" >&2 + exit 1 +fi + +# Generate Shim +# Always rewrite shims so that we are referencing the expected version +NewScriptShim $shim_path $tool_file_path true + +if [[ $? != 0 ]]; then + echo "Shim generation failed" >&2 + exit 1 +fi + +exit 0 \ No newline at end of file diff --git a/global.json b/global.json index fe84732472ab..7da905570712 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.24" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.25" } } \ No newline at end of file From d1ecf5428eb2c6935ca0d6767c3707afffb39979 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Sep 2018 12:55:09 +0000 Subject: [PATCH 0086/2702] [Darc-Update] Update dependencies from build 20180921.1 of https://github.com/dotnet/arcade (#57) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1a860a2a1266..3707615b9cf3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ef4778e17127e468877e941214b63ed83653cb57 + 523031929c1cc35dc7710feaaede004cca5d2a31 \ No newline at end of file diff --git a/global.json b/global.json index 7da905570712..ef993de670c0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18470.25" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.1" } } \ No newline at end of file From b5192478640768fe01be63630eb9c3f097234a75 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Sep 2018 16:02:09 +0000 Subject: [PATCH 0087/2702] Updating version files (#58) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3707615b9cf3..8f9e2ad1053d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 523031929c1cc35dc7710feaaede004cca5d2a31 + 095ff3a71e25c82fe1013f01ca087e9ecb778a8a \ No newline at end of file diff --git a/global.json b/global.json index ef993de670c0..2bcc9ab6b374 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.2" } } \ No newline at end of file From 04a0d51de7f02a357086a7f90074c239bfb52397 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Sep 2018 17:35:40 +0000 Subject: [PATCH 0088/2702] [Darc-Update] Update dependencies from build 20180921.4 of https://github.com/dotnet/arcade (#59) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8f9e2ad1053d..78d611021e2e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 095ff3a71e25c82fe1013f01ca087e9ecb778a8a + d4122a4ce956fc8459cdb3d311de3a39243cee36 \ No newline at end of file diff --git a/global.json b/global.json index 2bcc9ab6b374..e250e8badb58 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.4" } } \ No newline at end of file From e23915cfebd54ca38017168e24cd20427eeae01b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Sep 2018 22:41:15 +0000 Subject: [PATCH 0089/2702] [Darc-Update] Update dependencies from build 20180921.7 of https://github.com/dotnet/arcade (#60) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 +-- eng/common/helixpublish.proj | 9 ++++++ eng/common/templates/steps/helix-publish.yml | 33 ++++++++++++++++++++ global.json | 2 +- 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 eng/common/helixpublish.proj create mode 100644 eng/common/templates/steps/helix-publish.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 78d611021e2e..5eb33f31dac2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d4122a4ce956fc8459cdb3d311de3a39243cee36 + 1e6741bd810103bf1bb1bf248377c43889f7239b \ No newline at end of file diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj new file mode 100644 index 000000000000..4496c23f8dc9 --- /dev/null +++ b/eng/common/helixpublish.proj @@ -0,0 +1,9 @@ + + + + + $(WorkItemDirectory) + $(WorkItemCommand) + + + diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml new file mode 100644 index 000000000000..53c8a717fd2c --- /dev/null +++ b/eng/common/templates/steps/helix-publish.yml @@ -0,0 +1,33 @@ +parameters: + HelixSource: 'pr/dotnet-github-anon-kaonashi-bot' + HelixType: ̓'tests/default' + HelixBuild: $(Build.BuildNumber) + HelixTargetQueues: '' + HelixAccessToken: '' + HelixPreCommands: '' + HelixPostCommands: '' + WorkItemDirectory: '' + WorkItemCommand: '' + EnableXUnitReporter: false + WaitForWorkItemCompletion: true + +steps: + - task: DotNetCoreCLI@2 + inputs: + command: custom + projects: eng/common/helixpublish.proj + custom: msbuild + arguments: '/t:test' + displayName: Send tests job to Helix + env: + HelixSource: $(HelixSource) + HelixType: $(HelixType) + HelixBuild: $(HelixBuild) + HelixTargetQueues: $(HelixTargetQueues) + HelixAccessToken: $(HelixAccessToken) + HelixPreCommands: $(HelixPreCommands) + HelixPostCommands: $(HelixPostCommands) + EnableXUnitReporter: $(EnableXUnitReporter) + WaitForWorkItemCompletion: $(WaitForWorkItemCompletion) + WorkItemDirectory: $(WorkItemDirectory) + WorkItemCommand: $(WorkItemCommand) diff --git a/global.json b/global.json index e250e8badb58..2208c6d1d9b8 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.7" } } \ No newline at end of file From 80140ddf950da140afc008201323b4fd86d8298e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Sep 2018 23:21:20 +0000 Subject: [PATCH 0090/2702] Updating version files (#61) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5eb33f31dac2..f9b6e967690d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 1e6741bd810103bf1bb1bf248377c43889f7239b + 884636a202a9fe849c6c24141f9320c4f89c2c14 \ No newline at end of file diff --git a/global.json b/global.json index 2208c6d1d9b8..e8d33dcdc9d2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.8" } } \ No newline at end of file From 973a4e845ab61e9b3629aa4b4bd69a70b43d92d3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Sep 2018 23:45:48 +0000 Subject: [PATCH 0091/2702] Updating version files (#62) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f9b6e967690d..18abd874adad 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 884636a202a9fe849c6c24141f9320c4f89c2c14 + e229415119a8cb4b470b9f04336d6fa5c336e8eb \ No newline at end of file diff --git a/global.json b/global.json index e8d33dcdc9d2..2666aae00e06 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.9" } } \ No newline at end of file From 55a85e860062b92d8c5c3700cb69f96d0b29ffee Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 22 Sep 2018 01:02:44 +0000 Subject: [PATCH 0092/2702] Updating version files (#63) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 18abd874adad..7ff71818dc49 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e229415119a8cb4b470b9f04336d6fa5c336e8eb + 0145e85dc72798afa7eba12344735d81851f35a0 \ No newline at end of file diff --git a/global.json b/global.json index 2666aae00e06..9ba67abf9b75 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.10" } } \ No newline at end of file From 5964438e8483633ad6dc3b7b500f7d5e0a57e3a2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 22 Sep 2018 13:03:28 +0000 Subject: [PATCH 0093/2702] Updating version files (#64) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7ff71818dc49..37232a095a6d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 0145e85dc72798afa7eba12344735d81851f35a0 + c62cb9850aee557aacaeb10148c7822cf4c838b3 \ No newline at end of file diff --git a/global.json b/global.json index 9ba67abf9b75..800cffc9b05d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18471.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18472.1" } } \ No newline at end of file From 472d2e101e00af4cd0f80bee1c12cfd975d4f732 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 23 Sep 2018 12:56:56 +0000 Subject: [PATCH 0094/2702] Updating version files (#65) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 37232a095a6d..2e9fd41f8cb8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - c62cb9850aee557aacaeb10148c7822cf4c838b3 + e7a6ff136180514056043992cad9226269d9809d \ No newline at end of file diff --git a/global.json b/global.json index 800cffc9b05d..8e9d65f46f92 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18472.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18473.1" } } \ No newline at end of file From 717f079bea11a53cc49be5d6c65ec6e6274f5213 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 24 Sep 2018 03:29:32 +0000 Subject: [PATCH 0095/2702] Updating version files (#66) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2e9fd41f8cb8..58b65f65a6e5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e7a6ff136180514056043992cad9226269d9809d + aaf8700f48cd410171ca9f64562f33ff60c3368d \ No newline at end of file diff --git a/global.json b/global.json index 8e9d65f46f92..6375184f9cac 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18473.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18473.8" } } \ No newline at end of file From 9ff85887da334351c497e500e2926f8bf727264a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 24 Sep 2018 08:21:28 +0000 Subject: [PATCH 0096/2702] Updating version files (#67) --- eng/Version.Details.xml | 4 ++-- eng/common/templates/steps/helix-publish.yml | 24 ++++++++++---------- global.json | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 58b65f65a6e5..c8394fbd100c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - aaf8700f48cd410171ca9f64562f33ff60c3368d + 41f4ef99009e99e32c6e815aedade344636e3f29 \ No newline at end of file diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml index 53c8a717fd2c..6e89d07e414d 100644 --- a/eng/common/templates/steps/helix-publish.yml +++ b/eng/common/templates/steps/helix-publish.yml @@ -17,17 +17,17 @@ steps: command: custom projects: eng/common/helixpublish.proj custom: msbuild - arguments: '/t:test' + arguments: '/t:test /p:Language=msbuild' displayName: Send tests job to Helix env: - HelixSource: $(HelixSource) - HelixType: $(HelixType) - HelixBuild: $(HelixBuild) - HelixTargetQueues: $(HelixTargetQueues) - HelixAccessToken: $(HelixAccessToken) - HelixPreCommands: $(HelixPreCommands) - HelixPostCommands: $(HelixPostCommands) - EnableXUnitReporter: $(EnableXUnitReporter) - WaitForWorkItemCompletion: $(WaitForWorkItemCompletion) - WorkItemDirectory: $(WorkItemDirectory) - WorkItemCommand: $(WorkItemCommand) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} diff --git a/global.json b/global.json index 6375184f9cac..01b46334ef4a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18473.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.2" } } \ No newline at end of file From a410fb6a5f843d0dc043828f457b1f8caef64254 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 24 Sep 2018 13:03:21 +0000 Subject: [PATCH 0097/2702] Updating version files (#68) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c8394fbd100c..f9b2a059d97e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 41f4ef99009e99e32c6e815aedade344636e3f29 + aa81dc4c4f37812c0f2b2ef039713561ce4e506c \ No newline at end of file diff --git a/global.json b/global.json index 01b46334ef4a..805bf69a556d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.3" } } \ No newline at end of file From b6089cad6e6bf7a2660d9e6a04b1dda0d3316a0f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 24 Sep 2018 18:21:44 +0000 Subject: [PATCH 0098/2702] Updating version files (#69) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f9b2a059d97e..113b09da545a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - aa81dc4c4f37812c0f2b2ef039713561ce4e506c + f526c82b96c603510034c7942ef34e82b8dffd1c \ No newline at end of file diff --git a/global.json b/global.json index 805bf69a556d..95bfbd319ad1 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.6" } } \ No newline at end of file From 7f1d79711276d7f9e5480e9201f32f52dd0693fe Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 24 Sep 2018 21:46:44 +0000 Subject: [PATCH 0099/2702] Updating version files (#70) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 113b09da545a..a4e609d4f230 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - f526c82b96c603510034c7942ef34e82b8dffd1c + 1ebfcbd2c0878ab523faa5d8281775c1bf5ef5f7 \ No newline at end of file diff --git a/global.json b/global.json index 95bfbd319ad1..bce4683943ae 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.9" } } \ No newline at end of file From aebe3b837e3f6599323e39c88a40d1879cb8ed3b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 24 Sep 2018 22:42:14 +0000 Subject: [PATCH 0100/2702] Updating version files (#71) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a4e609d4f230..f7c5e3383e5f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 1ebfcbd2c0878ab523faa5d8281775c1bf5ef5f7 + 5c8c6ae76f59f7d414df9331fdd693aafcdec678 \ No newline at end of file diff --git a/global.json b/global.json index bce4683943ae..1daa69ae3dfe 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.10" } } \ No newline at end of file From 72728057b27767610d6fd59849c322a52ab4c286 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 25 Sep 2018 01:04:01 +0000 Subject: [PATCH 0101/2702] Updating version files (#72) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f7c5e3383e5f..ad96fdd24cf6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 5c8c6ae76f59f7d414df9331fdd693aafcdec678 + de8eebcd50970b72bb60aefecfcaa4941bc036f1 \ No newline at end of file diff --git a/global.json b/global.json index 1daa69ae3dfe..dc3ee759618e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.17" } } \ No newline at end of file From fdcf0efb25ae4670c3cff5cb1daf8bbf8477e2ba Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 25 Sep 2018 22:01:33 +0000 Subject: [PATCH 0102/2702] [Darc-Update] Update dependencies from build 20180925.12 of https://github.com/dotnet/arcade (#73) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ad96fdd24cf6..d4dc5d6b23d4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - de8eebcd50970b72bb60aefecfcaa4941bc036f1 + 46932777b68b7cbcd99b9f48267fc62152761bc1 \ No newline at end of file diff --git a/global.json b/global.json index dc3ee759618e..69fc25a680e4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18474.17" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18475.12" } } \ No newline at end of file From 957f3bb93873f5d1eace7c73dd7ffb3351474d3d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 26 Sep 2018 03:07:44 +0000 Subject: [PATCH 0103/2702] [Darc-Update] Update dependencies from build 20180925.16 of https://github.com/dotnet/arcade (#74) * Updating version files * Updating version files * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d4dc5d6b23d4..c269b8ed882e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 46932777b68b7cbcd99b9f48267fc62152761bc1 + e311f270fe4c1db39ef5b0afb4083ebbde1ed60c \ No newline at end of file diff --git a/global.json b/global.json index 69fc25a680e4..1e4f1218e150 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18475.12" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18475.16" } } \ No newline at end of file From 00f5ec019479de3baf68e3a5ed81bfca4f5fcd45 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 26 Sep 2018 15:06:35 +0000 Subject: [PATCH 0104/2702] [Darc-Update] Update dependencies from build 20180926.2 of https://github.com/dotnet/arcade (#75) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c269b8ed882e..9d7e8b67b415 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e311f270fe4c1db39ef5b0afb4083ebbde1ed60c + 3846598ad199cb98ab153f5d4662147decb16e81 \ No newline at end of file diff --git a/global.json b/global.json index 1e4f1218e150..140a9003a374 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18475.16" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.2" } } \ No newline at end of file From 9b4939368dfedb8442b327fcdbaa82fcd6c83091 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 26 Sep 2018 15:29:26 +0000 Subject: [PATCH 0105/2702] Updating version files (#76) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9d7e8b67b415..f8cbdc636a48 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3846598ad199cb98ab153f5d4662147decb16e81 + 09fca786e0d893ab81f9d4fe056b4ab15c0bcc10 \ No newline at end of file diff --git a/global.json b/global.json index 140a9003a374..db550bdc5582 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.3" } } \ No newline at end of file From f5db20596ddcad32589ebe4abd7bf7798c0ba8cf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 26 Sep 2018 17:00:35 +0000 Subject: [PATCH 0106/2702] Updating version files (#77) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f8cbdc636a48..80037935967e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 09fca786e0d893ab81f9d4fe056b4ab15c0bcc10 + 8ca020aa46097508ae8834bf0510bc40831678d4 \ No newline at end of file diff --git a/global.json b/global.json index db550bdc5582..2ab06ae5c607 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.5" } } \ No newline at end of file From 51b60b59736902a3bafe524a73f27e0afa52ade7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 26 Sep 2018 19:03:10 +0000 Subject: [PATCH 0107/2702] Updating version files (#78) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 80037935967e..a09a47828a41 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 8ca020aa46097508ae8834bf0510bc40831678d4 + a76fa2f615e57884f4a4c6b9cf4c81c1ae82e5b1 \ No newline at end of file diff --git a/global.json b/global.json index 2ab06ae5c607..eabe74eea174 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.6" } } \ No newline at end of file From 7fdeab1366562658ad771490142d37e934dec748 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 26 Sep 2018 20:53:08 +0000 Subject: [PATCH 0108/2702] Updating version files (#79) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a09a47828a41..07fb3ad9d073 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - a76fa2f615e57884f4a4c6b9cf4c81c1ae82e5b1 + 93c266ed3f599a4c083068c0e798f22c5a39f874 \ No newline at end of file diff --git a/global.json b/global.json index eabe74eea174..c1160beb5383 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.9" } } \ No newline at end of file From 66578c2886b09e183f97af70e7c803b2eacd634e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 1 Oct 2018 23:06:28 +0000 Subject: [PATCH 0109/2702] Updating version files (#80) --- eng/Version.Details.xml | 4 +- eng/common/build.ps1 | 242 ++---------------------- eng/common/build.sh | 267 +++++---------------------- eng/common/init-tools.ps1 | 244 ++++++++++++++++++++++++ eng/common/init-tools.sh | 210 +++++++++++++++++++++ eng/common/msbuild.ps1 | 22 +++ eng/common/msbuild.sh | 51 +++++ eng/common/templates/phases/base.yml | 5 +- global.json | 2 +- 9 files changed, 592 insertions(+), 455 deletions(-) create mode 100644 eng/common/init-tools.ps1 create mode 100755 eng/common/init-tools.sh create mode 100644 eng/common/msbuild.ps1 create mode 100755 eng/common/msbuild.sh diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 07fb3ad9d073..32467570163f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 93c266ed3f599a4c083068c0e798f22c5a39f874 + 878b6f0434a2ed0aa4ff10644425abe61bbe3ad5 \ No newline at end of file diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 575ff47e7d1e..ba866c5801df 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -3,6 +3,8 @@ Param( [string] $configuration = "Debug", [string] $projects = "", [string] $verbosity = "minimal", + [bool] $warnaserror = $true, + [bool] $nodereuse = $true, [switch] $restore, [switch] $deployDeps, [switch] $build, @@ -21,9 +23,7 @@ Param( [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties ) -set-strictmode -version 2.0 -$ErrorActionPreference = "Stop" -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +. $PSScriptRoot\init-tools.ps1 function Print-Usage() { Write-Host "Common settings:" @@ -61,181 +61,14 @@ if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $ exit 0 } -function Create-Directory([string[]] $path) { - if (!(Test-Path $path)) { - New-Item -path $path -force -itemType "Directory" | Out-Null - } -} - -function InitializeDotNetCli { - # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism - $env:DOTNET_MULTILEVEL_LOOKUP=0 - - # Disable first run since we do not need all ASP.NET packages restored. - $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - - # Source Build uses DotNetCoreSdkDir variable - if ($env:DotNetCoreSdkDir -ne $null) { - $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir - } - - # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, - # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. - if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.tools.dotnet)"))) { - $dotnetRoot = $env:DOTNET_INSTALL_DIR - } else { - $dotnetRoot = Join-Path $RepoRoot ".dotnet" - $env:DOTNET_INSTALL_DIR = $dotnetRoot - - if ($restore) { - InstallDotNetSdk $dotnetRoot $GlobalJson.tools.dotnet - } - } - - return $dotnetRoot -} - -function GetDotNetInstallScript([string] $dotnetRoot) { - $installScript = "$dotnetRoot\dotnet-install.ps1" - if (!(Test-Path $installScript)) { - Create-Directory $dotnetRoot - Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript - } - - return $installScript -} - -function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { - $installScript = GetDotNetInstallScript $dotnetRoot - - & $installScript -Version $version -InstallDir $dotnetRoot - if ($lastExitCode -ne 0) { - Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red - exit $lastExitCode - } -} - -function InitializeVisualStudioBuild { - $inVSEnvironment = !($env:VS150COMNTOOLS -eq $null) -and (Test-Path $env:VS150COMNTOOLS) - - if ($inVSEnvironment) { - $vsInstallDir = Join-Path $env:VS150COMNTOOLS "..\.." - } else { - $vsInstallDir = LocateVisualStudio - - $env:VS150COMNTOOLS = Join-Path $vsInstallDir "Common7\Tools\" - $env:VSSDK150Install = Join-Path $vsInstallDir "VSSDK\" - $env:VSSDKInstall = Join-Path $vsInstallDir "VSSDK\" - } - - return $vsInstallDir; -} - -function LocateVisualStudio { - $vswhereVersion = $GlobalJson.tools.vswhere - $toolsRoot = Join-Path $RepoRoot ".tools" - $vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion" - $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe" - - if (!(Test-Path $vsWhereExe)) { - Create-Directory $vsWhereDir - Write-Host "Downloading vswhere" - Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe - } - - $vsInstallDir = & $vsWhereExe -latest -prerelease -property installationPath -requires Microsoft.Component.MSBuild -requires Microsoft.VisualStudio.Component.VSSDK -requires Microsoft.Net.Component.4.6.TargetingPack -requires Microsoft.VisualStudio.Component.Roslyn.Compiler -requires Microsoft.VisualStudio.Component.VSSDK - - if ($lastExitCode -ne 0) { - Write-Host "Failed to locate Visual Studio (exit code '$lastExitCode')." -ForegroundColor Red - exit $lastExitCode - } - - return $vsInstallDir -} - -function GetBuildCommand() { - $tools = $GlobalJson.tools - - if ((Get-Member -InputObject $tools -Name "dotnet") -ne $null) { - $dotnetRoot = InitializeDotNetCli - - # by default build with dotnet cli: - $buildDriver = Join-Path $dotnetRoot "dotnet.exe" - $buildArgs = "msbuild" - } - - if ((Get-Member -InputObject $tools -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 'tools.dotnet' or 'tools.vswhere'." -ForegroundColor Red - exit 1 - } - - if ($ci) { - Write-Host "Using $buildDriver" - } - - return $buildDriver, $buildArgs -} - -function InitializeToolset([string] $buildDriver, [string]$buildArgs) { - $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' - $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" - - if (Test-Path $toolsetLocationFile) { - $path = Get-Content $toolsetLocationFile -TotalCount 1 - if (Test-Path $path) { - $global:ToolsetBuildProj = $path - return - } - } - - if (-not $restore) { - Write-Host "Toolset version $toolsetVersion has not been restored." - exit 1 - } - - $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 - - if ($lastExitCode -ne 0) { - Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -ForegroundColor Red - Write-Host "Build log: $ToolsetRestoreLog" -ForegroundColor DarkGray - exit $lastExitCode - } - - $path = Get-Content $toolsetLocationFile -TotalCount 1 - if (!(Test-Path $path)) { - throw "Invalid toolset path: $path" - } - - $global:ToolsetBuildProj = $path -} - -function InitializeCustomToolset { - if (-not $restore) { - return +try { + if ($projects -eq "") { + $projects = Join-Path $RepoRoot "*.sln" } - $script = Join-Path $EngRoot "RestoreToolset.ps1" - - if (Test-Path $script) { - . $script - } -} + $BuildLog = Join-Path $LogDir "Build.binlog" -function Build([string] $buildDriver, [string]$buildArgs) { - & $buildDriver $buildArgs $ToolsetBuildProj ` - /m /nologo /clp:Summary /warnaserror ` - /v:$verbosity ` + MSBuild $ToolsetBuildProj ` /bl:$BuildLog ` /p:Configuration=$configuration ` /p:Projects=$projects ` @@ -254,67 +87,18 @@ function Build([string] $buildDriver, [string]$buildArgs) { /p:PublishBuildAssets=$publishBuildAssets ` /p:ContinuousIntegrationBuild=$ci ` /p:CIBuild=$ci ` - $properties + @properties if ($lastExitCode -ne 0) { - Write-Host "Build log: $BuildLog" -ForegroundColor DarkGray - exit $lastExitCode + Write-Host "Build Failed (exit code '$lastExitCode'). See log: $BuildLog" -ForegroundColor Red + ExitWithExitCode $lastExitCode } -} -function Stop-Processes() { - Write-Host "Killing running build processes..." - Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Stop-Process - Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | Stop-Process - Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process -} - -try { - $RepoRoot = Join-Path $PSScriptRoot "..\.." - $EngRoot = Join-Path $PSScriptRoot ".." - $ArtifactsDir = Join-Path $RepoRoot "artifacts" - $ToolsetDir = Join-Path $ArtifactsDir "toolset" - $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration - $BuildLog = Join-Path $LogDir "Build.binlog" - $ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog" - $TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration - $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json - - if ($projects -eq "") { - $projects = Join-Path $RepoRoot "*.sln" - } - - if ($env:NUGET_PACKAGES -eq $null) { - # Use local cache on CI to ensure deterministic build, - # use global cache in dev builds to avoid cost of downloading packages. - $env:NUGET_PACKAGES = if ($ci) { Join-Path $RepoRoot ".packages" } - else { Join-Path $env:UserProfile ".nuget\packages" } - } - - Create-Directory $ToolsetDir - Create-Directory $LogDir - - if ($ci) { - Create-Directory $TempDir - $env:TEMP = $TempDir - $env:TMP = $TempDir - } - - $driver, $args = GetBuildCommand - InitializeToolset $driver $args - InitializeCustomToolset - Build $driver $args + ExitWithExitCode $lastExitCode } catch { Write-Host $_ Write-Host $_.Exception Write-Host $_.ScriptStackTrace - exit 1 -} -finally { - Pop-Location - if ($ci -and $prepareMachine) { - Stop-Processes - } + ExitWithExitCode 1 } - diff --git a/eng/common/build.sh b/eng/common/build.sh index 6ee504bbae8e..a216f8fd7b3e 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -28,7 +28,8 @@ projects='' configuration='Debug' prepare_machine=false verbosity='minimal' -properties='' +msbuildArgs='' +extraargs='' while (($# > 0)); do lowerI="$(echo $1 | awk '{print tolower($0)}')" @@ -91,6 +92,10 @@ while (($# > 0)); do solution=$2 shift 2 ;; + --projects) + projects=$2 + shift 2 + ;; --test) test=true shift 1 @@ -111,232 +116,52 @@ while (($# > 0)); do verbosity=$2 shift 2 ;; - *) + --warnaserror) + warnaserror=$2 + shift 2 + ;; + --nodereuse) + nodereuse=$2 + shift 2 + ;; + *) properties="$properties $1" shift 1 ;; esac done -repo_root="$scriptroot/../.." -eng_root="$scriptroot/.." -artifacts_dir="$repo_root/artifacts" -toolset_dir="$artifacts_dir/toolset" -log_dir="$artifacts_dir/log/$configuration" -build_log="$log_dir/Build.binlog" -toolset_restore_log="$log_dir/ToolsetRestore.binlog" -temp_dir="$artifacts_dir/tmp/$configuration" - -global_json_file="$repo_root/global.json" -build_driver="" -toolset_build_proj="" - -# ReadVersionFromJson [json key] -function ReadGlobalVersion { - local key=$1 - - local unamestr="$(uname)" - local sedextended='-r' - if [[ "$unamestr" == 'Darwin' ]]; then - sedextended='-E' - fi; - - local version="$(grep -m 1 "\"$key\"" $global_json_file | sed $sedextended 's/^ *//;s/.*: *"//;s/",?//')" - if [[ ! "$version" ]]; then - echo "Error: Cannot find \"$key\" in $global_json_file" >&2; - ExitWithExitCode 1 - fi; - - # return value - echo "$version" -} - -function InitializeDotNetCli { - # Disable first run since we want to control all package sources - export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - - # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism - export DOTNET_MULTILEVEL_LOOKUP=0 - - # Source Build uses DotNetCoreSdkDir variable - if [[ -n "$DotNetCoreSdkDir" ]]; then - export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" - fi - - - local dotnet_sdk_version=`ReadGlobalVersion "dotnet"` - local dotnet_root="" - - # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, - # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. - if [[ -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then - dotnet_root="$DOTNET_INSTALL_DIR" - else - dotnet_root="$repo_root/.dotnet" - export DOTNET_INSTALL_DIR="$dotnet_root" - - if [[ "$restore" == true ]]; then - InstallDotNetSdk $dotnet_root $dotnet_sdk_version - fi - fi - - build_driver="$dotnet_root/dotnet" -} - -function InstallDotNetSdk { - local root=$1 - local version=$2 - - local install_script=`GetDotNetInstallScript $root` - - bash "$install_script" --version $version --install-dir $root - local lastexitcode=$? - - if [[ $lastexitcode != 0 ]]; then - echo "Failed to install dotnet SDK (exit code '$lastexitcode')." - ExitWithExitCode $lastexitcode - fi -} +. $scriptroot/init-tools.sh -function GetDotNetInstallScript { - local root=$1 - local install_script="$root/dotnet-install.sh" +if [[ -z $projects ]]; then + projects="$repo_root/*.sln" +fi - if [[ ! -a "$install_script" ]]; then - mkdir -p "$root" - - # Use curl if available, otherwise use wget - if command -v curl > /dev/null; then - curl "https://dot.net/v1/dotnet-install.sh" -sSL --retry 10 --create-dirs -o "$install_script" - else - wget -q -O "$install_script" "https://dot.net/v1/dotnet-install.sh" - fi - fi - - # return value - echo "$install_script" -} - -function InitializeToolset { - local toolset_version=`ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk"` - local toolset_location_file="$toolset_dir/$toolset_version.txt" - - if [[ -a "$toolset_location_file" ]]; then - local path=`cat $toolset_location_file` - if [[ -a "$path" ]]; then - toolset_build_proj=$path - return - fi - fi - - if [[ "$restore" != true ]]; then - echo "Toolset version $toolsetVersion has not been restored." - ExitWithExitCode 2 - fi - - local proj="$toolset_dir/restore.proj" - - echo '' > $proj - "$build_driver" msbuild $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$toolset_restore_log /v:$verbosity /p:__ToolsetLocationOutputFile=$toolset_location_file - local lastexitcode=$? - - if [[ $lastexitcode != 0 ]]; then - echo "Failed to restore toolset (exit code '$lastexitcode'). See log: $toolset_restore_log" - ExitWithExitCode $lastexitcode - fi - - toolset_build_proj=`cat $toolset_location_file` - - if [[ ! -a "$toolset_build_proj" ]]; then - echo "Invalid toolset path: $toolset_build_proj" - ExitWithExitCode 3 - fi -} - -function InitializeCustomToolset { - local script="$eng_root/RestoreToolset.sh" - - if [[ -a "$script" ]]; then - . "$script" - fi -} - -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:Pack=$pack \ - /p:IntegrationTest=$integration_test \ - /p:PerformanceTest=$performance_test \ - /p:Sign=$sign \ - /p:Publish=$publish \ - /p:ContinuousIntegrationBuild=$ci \ - /p:CIBuild=$ci \ - $properties - local lastexitcode=$? - - if [[ $lastexitcode != 0 ]]; then - echo "Failed to build $toolset_build_proj" - ExitWithExitCode $lastexitcode - fi -} - -function ExitWithExitCode { - if [[ "$ci" == true && "$prepare_machine" == true ]]; then - StopProcesses - fi - exit $1 -} - -function StopProcesses { - echo "Killing running build processes..." - pkill -9 "dotnet" - pkill -9 "vbcscompiler" -} - -function Main { - # HOME may not be defined in some scenarios, but it is required by NuGet - if [[ -z $HOME ]]; then - export HOME="$repo_root/artifacts/.home/" - mkdir -p "$HOME" - fi - - if [[ -z $projects ]]; then - projects="$repo_root/*.sln" - fi - - if [[ -z $NUGET_PACKAGES ]]; then - if [[ $ci ]]; then - export NUGET_PACKAGES="$repo_root/.packages" - else - export NUGET_PACKAGES="$HOME/.nuget/packages" - fi - fi - - mkdir -p "$toolset_dir" - mkdir -p "$log_dir" - - if [[ $ci ]]; then - mkdir -p "$temp_dir" - export TEMP="$temp_dir" - export TMP="$temp_dir" - fi - - InitializeDotNetCli - InitializeToolset - InitializeCustomToolset - - Build - ExitWithExitCode $? -} +build_log="$log_dir/Build.binlog" -Main +MSBuild $toolset_build_proj \ + /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:ContinuousIntegrationBuild=$ci \ + /p:CIBuild=$ci \ + $properties + +lastexitcode=$? + +if [[ $lastexitcode != 0 ]]; then + echo "Build Failed (exit code '$lastexitcode'). See log: $build_log" +fi + +ExitWithExitCode $lastexitcode \ No newline at end of file diff --git a/eng/common/init-tools.ps1 b/eng/common/init-tools.ps1 new file mode 100644 index 000000000000..c0861e46a2c9 --- /dev/null +++ b/eng/common/init-tools.ps1 @@ -0,0 +1,244 @@ +# Initialize variables if they aren't already defined + +$ci = if (Test-Path variable:ci) { $ci } else { $false } +$configuration = if (Test-Path variable:configuration) { $configuration } else { "Debug" } +$nodereuse = if (Test-Path variable:nodereuse) { $nodereuse } else { $true } +$prepareMachine = if (Test-Path variable:prepareMachine) { $prepareMachine } else { $false } +$restore = if (Test-Path variable:restore) { $restore } else { $true } +$warnaserror = if (Test-Path variable:warnaserror) { $warnaserror } else { $true } + +set-strictmode -version 2.0 +$ErrorActionPreference = "Stop" +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + +function Create-Directory([string[]] $path) { + if (!(Test-Path $path)) { + New-Item -path $path -force -itemType "Directory" | Out-Null + } +} + +function InitializeDotNetCli { + # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism + $env:DOTNET_MULTILEVEL_LOOKUP=0 + + # Disable first run since we do not need all ASP.NET packages restored. + $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + + # Source Build uses DotNetCoreSdkDir variable + if ($env:DotNetCoreSdkDir -ne $null) { + $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir + } + + # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, + # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. + if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.tools.dotnet)"))) { + $dotnetRoot = $env:DOTNET_INSTALL_DIR + } else { + $dotnetRoot = Join-Path $RepoRoot ".dotnet" + $env:DOTNET_INSTALL_DIR = $dotnetRoot + + if ($restore) { + InstallDotNetSdk $dotnetRoot $GlobalJson.tools.dotnet + } + } + + return $dotnetRoot +} + +function GetDotNetInstallScript([string] $dotnetRoot) { + $installScript = "$dotnetRoot\dotnet-install.ps1" + if (!(Test-Path $installScript)) { + Create-Directory $dotnetRoot + Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript + } + + return $installScript +} + +function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { + $installScript = GetDotNetInstallScript $dotnetRoot + + & $installScript -Version $version -InstallDir $dotnetRoot + if ($lastExitCode -ne 0) { + Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red + ExitWithExitCode $lastExitCode + } +} + +function InitializeVisualStudioBuild { + $inVSEnvironment = !($env:VS150COMNTOOLS -eq $null) -and (Test-Path $env:VS150COMNTOOLS) + + if ($inVSEnvironment) { + $vsInstallDir = Join-Path $env:VS150COMNTOOLS "..\.." + } else { + $vsInstallDir = LocateVisualStudio + + $env:VS150COMNTOOLS = Join-Path $vsInstallDir "Common7\Tools\" + $env:VSSDK150Install = Join-Path $vsInstallDir "VSSDK\" + $env:VSSDKInstall = Join-Path $vsInstallDir "VSSDK\" + } + + return $vsInstallDir; +} + +function LocateVisualStudio { + $vswhereVersion = $GlobalJson.tools.vswhere + $toolsRoot = Join-Path $RepoRoot ".tools" + $vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion" + $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe" + + if (!(Test-Path $vsWhereExe)) { + Create-Directory $vsWhereDir + Write-Host "Downloading vswhere" + Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe + } + + $vsInstallDir = & $vsWhereExe -latest -prerelease -property installationPath -requires Microsoft.Component.MSBuild -requires Microsoft.VisualStudio.Component.VSSDK -requires Microsoft.Net.Component.4.6.TargetingPack -requires Microsoft.VisualStudio.Component.Roslyn.Compiler -requires Microsoft.VisualStudio.Component.VSSDK + + if ($lastExitCode -ne 0) { + Write-Host "Failed to locate Visual Studio (exit code '$lastExitCode')." -ForegroundColor Red + ExitWithExitCode $lastExitCode + } + + return $vsInstallDir +} + +function InitializeTools() { + $tools = $GlobalJson.tools + + if ((Get-Member -InputObject $tools -Name "dotnet") -ne $null) { + $dotnetRoot = InitializeDotNetCli + + # by default build with dotnet cli: + $script:buildDriver = Join-Path $dotnetRoot "dotnet.exe" + $script:buildArgs = "msbuild" + } + + if ((Get-Member -InputObject $tools -Name "vswhere") -ne $null) { + $vsInstallDir = InitializeVisualStudioBuild + + # Presence of vswhere.version indicates the repo needs to build using VS msbuild: + $script:buildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe" + if ($ci) { $nodereuse = $false } + } + + if ($buildDriver -eq $null) { + Write-Host "/global.json must either specify 'tools.dotnet' or 'tools.vswhere'." -ForegroundColor Red + ExitWithExitCode 1 + } + + InitializeToolSet $script:buildDriver $script:buildArgs + InitializeCustomToolset +} + +function InitializeToolset([string] $buildDriver, [string]$buildArgs) { + $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' + $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" + + if (Test-Path $toolsetLocationFile) { + $path = Get-Content $toolsetLocationFile -TotalCount 1 + if (Test-Path $path) { + $script:ToolsetBuildProj = $path + return + } + } + + if (-not $restore) { + Write-Host "Toolset version $toolsetVersion has not been restored." + ExitWithExitCode 1 + } + + $ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog" + $proj = Join-Path $ToolsetDir "restore.proj" + + '' | Set-Content $proj + MSBuild $proj /t:__WriteToolsetLocation /clp:None /bl:$ToolsetRestoreLog /p:__ToolsetLocationOutputFile=$toolsetLocationFile + + if ($lastExitCode -ne 0) { + Write-Host "Failed to restore toolset (exit code '$lastExitCode'). See log: $ToolsetRestoreLog" -ForegroundColor Red + ExitWithExitCode $lastExitCode + } + + $path = Get-Content $toolsetLocationFile -TotalCount 1 + if (!(Test-Path $path)) { + throw "Invalid toolset path: $path" + } + + $script:ToolsetBuildProj = $path +} + +function InitializeCustomToolset { + if (-not $restore) { + return + } + + $script = Join-Path $EngRoot "RestoreToolset.ps1" + + if (Test-Path $script) { + . $script + } +} + +function ExitWithExitCode([int] $exitCode) { + if ($ci -and $prepareMachine) { + Stop-Processes + } + exit $exitCode +} + +function Stop-Processes() { + Write-Host "Killing running build processes..." + Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Stop-Process + Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | Stop-Process + Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process +} + +function MsBuild() { + $msbuildArgs = "$buildArgs /m /nologo /clp:Summary /v:$verbosity" + $extraArgs = "$args" + + if ($warnaserror) { + $msbuildArgs += " /warnaserror" + } + + $msbuildArgs += " /nr:$nodereuse" + + Write-Host "`"$buildDriver`" $msbuildArgs $extraArgs" + Invoke-Expression "& `"$buildDriver`" $msbuildArgs $extraArgs" + + return $lastExitCode +} + +try { + $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") + $EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") + $ArtifactsDir = Join-Path $RepoRoot "artifacts" + $ToolsetDir = Join-Path $ArtifactsDir "toolset" + $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration + $TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration + $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json + + if ($env:NUGET_PACKAGES -eq $null) { + # Use local cache on CI to ensure deterministic build, + # use global cache in dev builds to avoid cost of downloading packages. + $env:NUGET_PACKAGES = if ($ci) { Join-Path $RepoRoot ".packages" } + else { Join-Path $env:UserProfile ".nuget\packages" } + } + + Create-Directory $ToolsetDir + Create-Directory $LogDir + + if ($ci) { + Create-Directory $TempDir + $env:TEMP = $TempDir + $env:TMP = $TempDir + } + + InitializeTools +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} \ No newline at end of file diff --git a/eng/common/init-tools.sh b/eng/common/init-tools.sh new file mode 100755 index 000000000000..944311277253 --- /dev/null +++ b/eng/common/init-tools.sh @@ -0,0 +1,210 @@ +#!/usr/bin/env bash + +ci=${ci:-false} +configuration=${configuration:-'Debug'} +nodereuse=${nodereuse:-true} +prepare_machine=${prepare_machine:-false} +restore=${restore:-true} +warnaserror=${warnaserror:-true} + +repo_root="$scriptroot/../.." +eng_root="$scriptroot/.." +artifacts_dir="$repo_root/artifacts" +toolset_dir="$artifacts_dir/toolset" +log_dir="$artifacts_dir/log/$configuration" +temp_dir="$artifacts_dir/tmp/$configuration" + +global_json_file="$repo_root/global.json" +build_driver="" +toolset_build_proj="" + +# ReadVersionFromJson [json key] +function ReadGlobalVersion { + local key=$1 + + local unamestr="$(uname)" + local sedextended='-r' + if [[ "$unamestr" == 'Darwin' ]]; then + sedextended='-E' + fi; + + local version="$(grep -m 1 "\"$key\"" $global_json_file | sed $sedextended 's/^ *//;s/.*: *"//;s/",?//')" + if [[ ! "$version" ]]; then + echo "Error: Cannot find \"$key\" in $global_json_file" >&2; + ExitWithExitCode 1 + fi; + # return value + echo "$version" +} + +function InitializeDotNetCli { + # Disable first run since we want to control all package sources + export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + + # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism + export DOTNET_MULTILEVEL_LOOKUP=0 + + # Source Build uses DotNetCoreSdkDir variable + if [[ -n "$DotNetCoreSdkDir" ]]; then + export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" + fi + + + local dotnet_sdk_version=`ReadGlobalVersion "dotnet"` + local dotnet_root="" + + # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, + # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. + if [[ -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then + dotnet_root="$DOTNET_INSTALL_DIR" + else + dotnet_root="$repo_root/.dotnet" + export DOTNET_INSTALL_DIR="$dotnet_root" + + if [[ "$restore" == true ]]; then + InstallDotNetSdk $dotnet_root $dotnet_sdk_version + fi + fi + + build_driver="$dotnet_root/dotnet" +} + +function InstallDotNetSdk { + local root=$1 + local version=$2 + + local install_script=`GetDotNetInstallScript $root` + + bash "$install_script" --version $version --install-dir $root + local lastexitcode=$? + + if [[ $lastexitcode != 0 ]]; then + echo "Failed to install dotnet SDK (exit code '$lastexitcode')." + ExitWithExitCode $lastexitcode + fi +} + +function GetDotNetInstallScript { + local root=$1 + local install_script="$root/dotnet-install.sh" + + if [[ ! -a "$install_script" ]]; then + mkdir -p "$root" + + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + curl "https://dot.net/v1/dotnet-install.sh" -sSL --retry 10 --create-dirs -o "$install_script" + else + wget -q -O "$install_script" "https://dot.net/v1/dotnet-install.sh" + fi + fi + + # return value + echo "$install_script" +} + +function InitializeToolset { + local toolset_version=`ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk"` + local toolset_location_file="$toolset_dir/$toolset_version.txt" + + if [[ -a "$toolset_location_file" ]]; then + local path=`cat $toolset_location_file` + if [[ -a "$path" ]]; then + toolset_build_proj=$path + return + fi + fi + + if [[ "$restore" != true ]]; then + echo "Toolset version $toolsetVersion has not been restored." + ExitWithExitCode 2 + fi + + local toolset_restore_log="$log_dir/ToolsetRestore.binlog" + local proj="$toolset_dir/restore.proj" + + echo '' > $proj + + MSBuild "$proj /t:__WriteToolsetLocation /clp:None /bl:$toolset_restore_log /p:__ToolsetLocationOutputFile=$toolset_location_file" + local lastexitcode=$? + + if [[ $lastexitcode != 0 ]]; then + echo "Failed to restore toolset (exit code '$lastexitcode'). See log: $toolset_restore_log" + ExitWithExitCode $lastexitcode + fi + + toolset_build_proj=`cat $toolset_location_file` + + if [[ ! -a "$toolset_build_proj" ]]; then + echo "Invalid toolset path: $toolset_build_proj" + ExitWithExitCode 3 + fi +} + +function InitializeCustomToolset { + local script="$eng_root/RestoreToolset.sh" + + if [[ -a "$script" ]]; then + . "$script" + fi +} + +function InitializeTools { + InitializeDotNetCli + InitializeToolset + InitializeCustomToolset +} + +function ExitWithExitCode { + if [[ "$ci" == true && "$prepare_machine" == true ]]; then + StopProcesses + fi + exit $1 +} + +function StopProcesses { + echo "Killing running build processes..." + pkill -9 "dotnet" + pkill -9 "vbcscompiler" +} + +function MSBuild { + local msbuildArgs="msbuild /m /nologo /clp:Summary /v:$verbosity" + local extraArgs="$@" + + if [[ $warnaserror == true ]]; then + msbuildArgs="$msbuildArgs /warnaserror" + fi + + msbuildArgs="$msbuildArgs /nr:$nodereuse" + + echo "$build_driver $msbuildArgs $extraArgs" + "$build_driver" $msbuildArgs $extraArgs + + return $? +} + +# HOME may not be defined in some scenarios, but it is required by NuGet +if [[ -z $HOME ]]; then + export HOME="$repo_root/artifacts/.home/" + mkdir -p "$HOME" +fi + +if [[ -z $NUGET_PACKAGES ]]; then + if [[ $ci == true ]]; then + export NUGET_PACKAGES="$repo_root/.packages" + else + export NUGET_PACKAGES="$HOME/.nuget/packages" + fi +fi + +mkdir -p "$toolset_dir" +mkdir -p "$log_dir" + +if [[ $ci == true ]]; then + mkdir -p "$temp_dir" + export TEMP="$temp_dir" + export TMP="$temp_dir" +fi + +InitializeTools diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 new file mode 100644 index 000000000000..ca34734239bd --- /dev/null +++ b/eng/common/msbuild.ps1 @@ -0,0 +1,22 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $verbosity = "minimal", + [bool] $warnaserror = $true, + [bool] $nodereuse = $true, + [switch] $ci, + [switch] $prepareMachine, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs +) + +. $PSScriptRoot\init-tools.ps1 + +try { + MSBuild @extraArgs + ExitWithExitCode $lastExitCode +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh new file mode 100755 index 000000000000..72ebc88014d2 --- /dev/null +++ b/eng/common/msbuild.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +verbosity='minimal' +extraargs='' + +while (($# > 0)); do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + --verbosity) + verbosity=$2 + shift 2 + ;; + --warnaserror) + warnaserror=$2 + shift 2 + ;; + --nodereuse) + nodereuse=$2 + shift 2 + ;; + --ci) + ci=true + shift 1 + ;; + --preparemachine) + prepare_machine=true + shift 1 + ;; + *) + extraargs="$extraargs $1" + shift 1 + ;; + esac +done + +. $scriptroot/init-tools.sh + +MSBuild $extraargs +ExitWithExitCode $? \ No newline at end of file diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml index 79b42b18354b..c7933eafa56b 100644 --- a/eng/common/templates/phases/base.yml +++ b/eng/common/templates/phases/base.yml @@ -41,7 +41,8 @@ phases: queue: ${{ parameters.queue }} ${{ if ne(parameters.variables, '') }}: - variables: ${{ parameters.variables }} + variables: + ${{ insert }}: ${{ parameters.variables }} steps: - checkout: self @@ -104,4 +105,4 @@ phases: PublishLocation: Container ArtifactName: AssetManifests continueOnError: false - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) \ No newline at end of file + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) diff --git a/global.json b/global.json index c1160beb5383..c6be5e7516c4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18476.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18501.10" } } \ No newline at end of file From ef939101e29e9f6009366767b60ba0801820d2fb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 2 Oct 2018 21:14:45 +0000 Subject: [PATCH 0110/2702] [Darc-Update] Update dependencies from build 20181002.3 of https://github.com/dotnet/arcade (#81) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 32467570163f..0bb9577d3297 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 878b6f0434a2ed0aa4ff10644425abe61bbe3ad5 + 6a19908a297c3fc64772389c3e2852c08d2d2860 \ No newline at end of file diff --git a/global.json b/global.json index c6be5e7516c4..8074d5e89ca0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18501.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18502.3" } } \ No newline at end of file From de3b3a91ba2955b066d7c44b9ab2ea949b5e036a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 3 Oct 2018 01:55:45 +0000 Subject: [PATCH 0111/2702] Updating version files (#82) --- eng/Version.Details.xml | 4 ++-- eng/common/darc-init.ps1 | 3 +++ eng/common/darc-init.sh | 17 +++++++++++++++++ eng/common/init-tools.ps1 | 18 +++++++++++++++--- eng/common/init-tools.sh | 17 +++++++++++++++-- global.json | 2 +- 6 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 eng/common/darc-init.ps1 create mode 100644 eng/common/darc-init.sh diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0bb9577d3297..cfd025150f33 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6a19908a297c3fc64772389c3e2852c08d2d2860 + e6adb14fc35463f2903c11f1a32a3fa692c30966 \ No newline at end of file diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 new file mode 100644 index 000000000000..e774b483852d --- /dev/null +++ b/eng/common/darc-init.ps1 @@ -0,0 +1,3 @@ +. $PSScriptRoot\init-tools.ps1 + +InstallDarcCli \ No newline at end of file diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh new file mode 100644 index 000000000000..bee14bd4011e --- /dev/null +++ b/eng/common/darc-init.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $source until the file is no longer a symlink +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. $scriptroot/init-tools.sh + +InstallDarcCli \ No newline at end of file diff --git a/eng/common/init-tools.ps1 b/eng/common/init-tools.ps1 index c0861e46a2c9..286f58c951ce 100644 --- a/eng/common/init-tools.ps1 +++ b/eng/common/init-tools.ps1 @@ -132,8 +132,7 @@ function InitializeTools() { } function InitializeToolset([string] $buildDriver, [string]$buildArgs) { - $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' - $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" + $toolsetLocationFile = Join-Path $ToolsetDir "$ToolsetVersion.txt" if (Test-Path $toolsetLocationFile) { $path = Get-Content $toolsetLocationFile -TotalCount 1 @@ -144,7 +143,7 @@ function InitializeToolset([string] $buildDriver, [string]$buildArgs) { } if (-not $restore) { - Write-Host "Toolset version $toolsetVersion has not been restored." + Write-Host "Toolset version $ToolsetVersion has not been restored." ExitWithExitCode 1 } @@ -209,6 +208,18 @@ function MsBuild() { return $lastExitCode } +function InstallDarcCli { + $DarcCliPackageName = "microsoft.dotnet.darc" + $ToolList = Invoke-Expression "$buildDriver tool list -g" + + if ($ToolList -like "*$DarcCliPackageName*") { + Invoke-Expression "$buildDriver tool uninstall $DarcCliPackageName -g" + } + + Write-Host "Installing Darc CLI version $toolsetVersion..." + Invoke-Expression "$buildDriver tool install $DarcCliPackageName --version $toolsetVersion -v $verbosity -g" +} + try { $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") $EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") @@ -217,6 +228,7 @@ try { $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration $TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json + $ToolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' if ($env:NUGET_PACKAGES -eq $null) { # Use local cache on CI to ensure deterministic build, diff --git a/eng/common/init-tools.sh b/eng/common/init-tools.sh index 944311277253..b5a3542ad9f0 100755 --- a/eng/common/init-tools.sh +++ b/eng/common/init-tools.sh @@ -37,6 +37,8 @@ function ReadGlobalVersion { echo "$version" } +toolset_version=`ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk"` + function InitializeDotNetCli { # Disable first run since we want to control all package sources export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 @@ -104,7 +106,6 @@ function GetDotNetInstallScript { } function InitializeToolset { - local toolset_version=`ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk"` local toolset_location_file="$toolset_dir/$toolset_version.txt" if [[ -a "$toolset_location_file" ]]; then @@ -184,6 +185,18 @@ function MSBuild { return $? } +function InstallDarcCli { + local darc_cli_package_name="microsoft.dotnet.darc" + local uninstall_command=`dotnet tool uninstall $darc_cli_package_name -g` + local tool_list=$(dotnet tool list -g) + if [[ $tool_list = *$darc_cli_package_name* ]]; then + echo $(dotnet tool uninstall $darc_cli_package_name -g) + fi + + echo "Installing Darc CLI version $toolset_version..." + echo $(dotnet tool install $darc_cli_package_name --version $toolset_version -v $verbosity -g) +} + # HOME may not be defined in some scenarios, but it is required by NuGet if [[ -z $HOME ]]; then export HOME="$repo_root/artifacts/.home/" @@ -207,4 +220,4 @@ if [[ $ci == true ]]; then export TMP="$temp_dir" fi -InitializeTools +InitializeTools \ No newline at end of file diff --git a/global.json b/global.json index 8074d5e89ca0..87dce18e3265 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18502.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18502.4" } } \ No newline at end of file From 20a3f514ca05f8773983e7f9d3ce8d5b5ee97db7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 3 Oct 2018 13:07:40 +0000 Subject: [PATCH 0112/2702] Updating version files (#83) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cfd025150f33..5d81bb484e0a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e6adb14fc35463f2903c11f1a32a3fa692c30966 + 3bec195e5ca2223735324fc13eba6c87e7334cda \ No newline at end of file diff --git a/global.json b/global.json index 87dce18e3265..b61efa2286e2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18502.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18503.1" } } \ No newline at end of file From cf3537ce2325a56d126839d3ca281d5534d35e97 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 3 Oct 2018 15:58:30 +0000 Subject: [PATCH 0113/2702] Updating version files (#84) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5d81bb484e0a..fa8a8c4cbcd8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3bec195e5ca2223735324fc13eba6c87e7334cda + 3471242f00936f5ff4c52e72ab31916640bc42a7 \ No newline at end of file diff --git a/global.json b/global.json index b61efa2286e2..55f8b0596cc5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18503.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18503.2" } } \ No newline at end of file From 3a85da9f7165cabd967e8922144a2ff055df1ee5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 3 Oct 2018 16:03:50 +0000 Subject: [PATCH 0114/2702] Updating version files (#85) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fa8a8c4cbcd8..238b420cdf3c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3471242f00936f5ff4c52e72ab31916640bc42a7 + cfe82847d5d936ef8e4600538abd3b670be18e85 \ No newline at end of file diff --git a/global.json b/global.json index 55f8b0596cc5..44220103a603 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18503.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18503.3" } } \ No newline at end of file From 45ad44ce96a1ce81066b1b14c6a7b1b7537565d3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 3 Oct 2018 23:47:52 +0000 Subject: [PATCH 0115/2702] Updating version files (#86) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 238b420cdf3c..f41328e4a69a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - cfe82847d5d936ef8e4600538abd3b670be18e85 + d4b7868486c52c0fc8eb8dd72002c9a9883a0274 \ No newline at end of file diff --git a/global.json b/global.json index 44220103a603..8ff0664d62b0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18503.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18503.4" } } \ No newline at end of file From 864fe604c24d9059c901d16fa83d53e462c28824 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 4 Oct 2018 13:10:45 +0000 Subject: [PATCH 0116/2702] Updating version files (#87) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f41328e4a69a..2da19a9eec3f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d4b7868486c52c0fc8eb8dd72002c9a9883a0274 + dec29a870445afa44e735e98a958782c57ac43b7 \ No newline at end of file diff --git a/global.json b/global.json index 8ff0664d62b0..3ddf424733ed 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18503.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.1" } } \ No newline at end of file From c55abfb1449cbd876ffe16a2299cb3f300e0040c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 4 Oct 2018 15:52:05 +0000 Subject: [PATCH 0117/2702] Updating version files (#88) --- eng/Version.Details.xml | 4 ++-- eng/common/init-tools.ps1 | 2 +- eng/common/init-tools.sh | 2 +- global.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2da19a9eec3f..6e04539109a3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - dec29a870445afa44e735e98a958782c57ac43b7 + ce1e5d896d695ac63ca5bca8bd49423a632df17b \ No newline at end of file diff --git a/eng/common/init-tools.ps1 b/eng/common/init-tools.ps1 index 286f58c951ce..0ce695a854a9 100644 --- a/eng/common/init-tools.ps1 +++ b/eng/common/init-tools.ps1 @@ -217,7 +217,7 @@ function InstallDarcCli { } Write-Host "Installing Darc CLI version $toolsetVersion..." - Invoke-Expression "$buildDriver tool install $DarcCliPackageName --version $toolsetVersion -v $verbosity -g" + Invoke-Expression "$buildDriver tool install $DarcCliPackageName --version $toolsetVersion -v m -g" } try { diff --git a/eng/common/init-tools.sh b/eng/common/init-tools.sh index b5a3542ad9f0..a4c6e9f04d70 100755 --- a/eng/common/init-tools.sh +++ b/eng/common/init-tools.sh @@ -194,7 +194,7 @@ function InstallDarcCli { fi echo "Installing Darc CLI version $toolset_version..." - echo $(dotnet tool install $darc_cli_package_name --version $toolset_version -v $verbosity -g) + echo $(dotnet tool install $darc_cli_package_name --version $toolset_version -v m -g) } # HOME may not be defined in some scenarios, but it is required by NuGet diff --git a/global.json b/global.json index 3ddf424733ed..4ef1319bb82c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.2" } } \ No newline at end of file From db1bea25d80d7360babb2003e91e28e4eea3f9c2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 4 Oct 2018 19:54:16 +0000 Subject: [PATCH 0118/2702] [Darc-Update] Update dependencies from build 20181004.4 of https://github.com/dotnet/arcade (#89) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6e04539109a3..1cf2eed84872 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ce1e5d896d695ac63ca5bca8bd49423a632df17b + 160907da5d70a8dbeb2bc8f79f564e34060e7075 \ No newline at end of file diff --git a/global.json b/global.json index 4ef1319bb82c..01a32c612076 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.4" } } \ No newline at end of file From 21ed9e101577ef3a2f36117ebc28f974c4f4cd55 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 4 Oct 2018 21:45:25 +0000 Subject: [PATCH 0119/2702] Updating version files (#90) --- eng/Version.Details.xml | 4 ++-- eng/common/darc-init.ps1 | 3 ++- eng/common/darc-init.sh | 1 + eng/common/init-tools.ps1 | 3 ++- eng/common/init-tools.sh | 9 +++++---- global.json | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) mode change 100644 => 100755 eng/common/darc-init.sh diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1cf2eed84872..fcd6accb11dd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 160907da5d70a8dbeb2bc8f79f564e34060e7075 + 5556d097fb18fcdf3568ec0aec3b0dac256ba752 \ No newline at end of file diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index e774b483852d..e64ae053e786 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,3 +1,4 @@ -. $PSScriptRoot\init-tools.ps1 +$verbosity = "m" +. $PSScriptRoot\init-tools.ps1 InstallDarcCli \ No newline at end of file diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh old mode 100644 new mode 100755 index bee14bd4011e..97476fe0b91f --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -11,6 +11,7 @@ while [[ -h "$source" ]]; do [[ $source != /* ]] && source="$scriptroot/$source" done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +verbosity=m . $scriptroot/init-tools.sh diff --git a/eng/common/init-tools.ps1 b/eng/common/init-tools.ps1 index 0ce695a854a9..3a6811e51c07 100644 --- a/eng/common/init-tools.ps1 +++ b/eng/common/init-tools.ps1 @@ -217,7 +217,8 @@ function InstallDarcCli { } Write-Host "Installing Darc CLI version $toolsetVersion..." - Invoke-Expression "$buildDriver tool install $DarcCliPackageName --version $toolsetVersion -v m -g" + Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." + Invoke-Expression "$buildDriver tool install $DarcCliPackageName --version $toolsetVersion -v $verbosity -g" } try { diff --git a/eng/common/init-tools.sh b/eng/common/init-tools.sh index a4c6e9f04d70..bc7c77ed059b 100755 --- a/eng/common/init-tools.sh +++ b/eng/common/init-tools.sh @@ -187,14 +187,15 @@ function MSBuild { function InstallDarcCli { local darc_cli_package_name="microsoft.dotnet.darc" - local uninstall_command=`dotnet tool uninstall $darc_cli_package_name -g` - local tool_list=$(dotnet tool list -g) + local uninstall_command=`$DOTNET_INSTALL_DIR/dotnet tool uninstall $darc_cli_package_name -g` + local tool_list=$($DOTNET_INSTALL_DIR/dotnet tool list -g) if [[ $tool_list = *$darc_cli_package_name* ]]; then - echo $(dotnet tool uninstall $darc_cli_package_name -g) + echo $($DOTNET_INSTALL_DIR/dotnet tool uninstall $darc_cli_package_name -g) fi echo "Installing Darc CLI version $toolset_version..." - echo $(dotnet tool install $darc_cli_package_name --version $toolset_version -v m -g) + echo "You may need to restart your command shell if this is the first dotnet tool you have installed." + echo $($DOTNET_INSTALL_DIR/dotnet tool install $darc_cli_package_name --version $toolset_version -v $verbosity -g) } # HOME may not be defined in some scenarios, but it is required by NuGet diff --git a/global.json b/global.json index 01a32c612076..664b1775dfd0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.5" } } \ No newline at end of file From dfd7fb52fd46c9b2acd7695961860f4dbc2d97ac Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 5 Oct 2018 01:00:58 +0000 Subject: [PATCH 0120/2702] Updating version files (#91) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fcd6accb11dd..a84b38dbb41a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 5556d097fb18fcdf3568ec0aec3b0dac256ba752 + 64d4bafc397c2bb573b79758ada5497a1c574eed \ No newline at end of file diff --git a/global.json b/global.json index 664b1775dfd0..bd7f4c03d634 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.6" } } \ No newline at end of file From c3ffdd15b83ab4628b650d81681a82973ddb038d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 5 Oct 2018 13:04:06 +0000 Subject: [PATCH 0121/2702] Updating version files (#92) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a84b38dbb41a..feb31ad42d87 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 64d4bafc397c2bb573b79758ada5497a1c574eed + 9c69ac917c5cffa1042e1da4968938218c60d02a \ No newline at end of file diff --git a/global.json b/global.json index bd7f4c03d634..3e0a565eeeb0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18504.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.1" } } \ No newline at end of file From 778baef8905f3a4f1f266888c66014e325bf7d4a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 5 Oct 2018 16:11:54 +0000 Subject: [PATCH 0122/2702] Updating version files (#93) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index feb31ad42d87..0ac4916e6bec 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 9c69ac917c5cffa1042e1da4968938218c60d02a + ad7261a6d8016c99b6975a45c66c032bd4650817 \ No newline at end of file diff --git a/global.json b/global.json index 3e0a565eeeb0..b7bc8f95b219 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.2" } } \ No newline at end of file From 72a13b7f6436129f8a48f774b657a58407aee57e Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Fri, 5 Oct 2018 11:10:59 -0700 Subject: [PATCH 0123/2702] Minor samples repo cleanup (#94) --- .gitignore | 1 + .vsts-ci.yml | 20 ++++++++++++-------- Build.cmd | 3 +++ HelloWorld/HelloWorld.csproj | 2 +- build.sh | 16 ++++++++++++++++ 5 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 Build.cmd create mode 100644 build.sh diff --git a/.gitignore b/.gitignore index f431ddc7cf5f..e81ae007ae7b 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ BenchmarkDotNet.Artifacts/ project.lock.json project.fragment.lock.json artifacts/ +.dotnet/ # StyleCop StyleCopReport.xml diff --git a/.vsts-ci.yml b/.vsts-ci.yml index cbe4b7f9b5e2..ca6dc225855b 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -1,8 +1,13 @@ variables: Build.Repository.Clean: true - targetFramework: netcoreapp2.0 _HelixType: build/product _HelixSource: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) + _enableTelemetry: true + +resources: + containers: + - container: LinuxContainer + image: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20170319080304 trigger: - master @@ -17,9 +22,9 @@ phases: parameters: agentOs: Windows_NT name: Windows_NT - enableTelemetry: true + enableTelemetry: $(_enableTelemetry) queue: - name: Helix + name: dotnet-external-temp parallel: 99 matrix: debug_configuration: @@ -40,7 +45,7 @@ phases: parameters: agentOs: OSX name: OSX - enableTelemetry: true + enableTelemetry: $(_enableTelemetry) queue: name: Hosted macOS Preview parallel: 99 @@ -63,10 +68,11 @@ phases: parameters: agentOs: Linux name: Linux - enableTelemetry: true + enableTelemetry: $(_enableTelemetry) queue: - name: DotNetCore-Linux + name: Hosted Ubuntu 1604 parallel: 99 + container: LinuxContainer matrix: debug_configuration: _BuildConfig: Debug @@ -81,5 +87,3 @@ phases: condition: succeeded() variables: _HelixBuildConfig: $(_BuildConfig) - # Run build in docker container - _PREVIEW_VSTS_DOCKER_IMAGE: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20170319080304 \ No newline at end of file diff --git a/Build.cmd b/Build.cmd new file mode 100644 index 000000000000..4afad047142a --- /dev/null +++ b/Build.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*" +exit /b %ErrorLevel% diff --git a/HelloWorld/HelloWorld.csproj b/HelloWorld/HelloWorld.csproj index ec44ba4b3c33..fdcf1895530e 100644 --- a/HelloWorld/HelloWorld.csproj +++ b/HelloWorld/HelloWorld.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.0 + netcoreapp2.0 true diff --git a/build.sh b/build.sh new file mode 100644 index 000000000000..8477d5af8817 --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done + +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +"$scriptroot/eng/common/build.sh" --build --restore $@ From b5ad2222344f29749b0c58541381aa88055963e6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 5 Oct 2018 18:16:06 +0000 Subject: [PATCH 0124/2702] Updating version files (#95) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0ac4916e6bec..319fbe1267e9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ad7261a6d8016c99b6975a45c66c032bd4650817 + 504a862aa4e98755eb4c5bff93f06579de891104 \ No newline at end of file diff --git a/global.json b/global.json index b7bc8f95b219..5ff86687a4c8 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.3" } } \ No newline at end of file From ba6ef8e6aa5774c51a66d99a8cf1cac0f46de8ff Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 5 Oct 2018 21:52:05 +0000 Subject: [PATCH 0125/2702] Updating version files (#96) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 319fbe1267e9..695ad002ad75 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 504a862aa4e98755eb4c5bff93f06579de891104 + 669eac993ee4f4db5693ac04692477c8ec3cb3d3 \ No newline at end of file diff --git a/global.json b/global.json index 5ff86687a4c8..03c004881b1b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.4" } } \ No newline at end of file From a427d435d1a9b0c23256659a32265374693675ee Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 5 Oct 2018 23:46:36 +0000 Subject: [PATCH 0126/2702] [Darc-Update] Update dependencies from build 20181005.6 of https://github.com/dotnet/arcade (#97) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 695ad002ad75..a06204adfb16 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 669eac993ee4f4db5693ac04692477c8ec3cb3d3 + 77156837ab4b92c62aa23f69bab30a336de29f41 \ No newline at end of file diff --git a/global.json b/global.json index 03c004881b1b..61d270c6f539 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.6" } } \ No newline at end of file From fc3848b606c8c7620c3e827ba90d716873e2b622 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 6 Oct 2018 01:00:44 +0000 Subject: [PATCH 0127/2702] Updating version files (#98) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a06204adfb16..91f3ff984ad6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 77156837ab4b92c62aa23f69bab30a336de29f41 + 4618f644a7ed1f9cebc776569d1fbe14237e4a93 \ No newline at end of file diff --git a/global.json b/global.json index 61d270c6f539..199c5d202879 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.7" } } \ No newline at end of file From 5adfda2a0cacbb218f644c574c3317b73c3c5db3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 6 Oct 2018 12:42:05 +0000 Subject: [PATCH 0128/2702] Updating version files (#99) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 91f3ff984ad6..1740622ef617 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 4618f644a7ed1f9cebc776569d1fbe14237e4a93 + 7d0933a732a7156decd1f03cefe0d875a5a9954d \ No newline at end of file diff --git a/global.json b/global.json index 199c5d202879..986243cabe26 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18505.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18506.1" } } \ No newline at end of file From dcc4a45a525a034f80b177bfd7df82c46e02abb9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 7 Oct 2018 12:47:29 +0000 Subject: [PATCH 0129/2702] Updating version files (#100) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1740622ef617..f5ded86f48c9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 7d0933a732a7156decd1f03cefe0d875a5a9954d + 44a0f58d1f465f9c35a24768cf44ba14811c8bfb \ No newline at end of file diff --git a/global.json b/global.json index 986243cabe26..d5fffb56ba3b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18506.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18507.1" } } \ No newline at end of file From 1c6a7f10bf4c514e52ec71e7a98a3050a8e9a349 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 11 Oct 2018 21:13:23 +0000 Subject: [PATCH 0130/2702] [Darc-Update] Update dependencies from build 20181011.4 of https://github.com/dotnet/arcade (#105) * Updating version files * Updating version files * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- eng/common/init-tools.ps1 | 3 ++- eng/common/init-tools.sh | 3 ++- global.json | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f5ded86f48c9..aadf92029a22 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 44a0f58d1f465f9c35a24768cf44ba14811c8bfb + b16f10d78a845725dd81500c0791fdf5b69370e2 \ No newline at end of file diff --git a/eng/common/init-tools.ps1 b/eng/common/init-tools.ps1 index 3a6811e51c07..9bc3384a3869 100644 --- a/eng/common/init-tools.ps1 +++ b/eng/common/init-tools.ps1 @@ -5,6 +5,7 @@ $configuration = if (Test-Path variable:configuration) { $configuration } else { $nodereuse = if (Test-Path variable:nodereuse) { $nodereuse } else { $true } $prepareMachine = if (Test-Path variable:prepareMachine) { $prepareMachine } else { $false } $restore = if (Test-Path variable:restore) { $restore } else { $true } +$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { "minimal" } $warnaserror = if (Test-Path variable:warnaserror) { $warnaserror } else { $true } set-strictmode -version 2.0 @@ -202,7 +203,7 @@ function MsBuild() { $msbuildArgs += " /nr:$nodereuse" - Write-Host "`"$buildDriver`" $msbuildArgs $extraArgs" + Write-Debug "`"$buildDriver`" $msbuildArgs $extraArgs" Invoke-Expression "& `"$buildDriver`" $msbuildArgs $extraArgs" return $lastExitCode diff --git a/eng/common/init-tools.sh b/eng/common/init-tools.sh index bc7c77ed059b..0e66498facae 100755 --- a/eng/common/init-tools.sh +++ b/eng/common/init-tools.sh @@ -5,6 +5,7 @@ configuration=${configuration:-'Debug'} nodereuse=${nodereuse:-true} prepare_machine=${prepare_machine:-false} restore=${restore:-true} +verbosity=${verbosity:-'minimal'} warnaserror=${warnaserror:-true} repo_root="$scriptroot/../.." @@ -179,7 +180,7 @@ function MSBuild { msbuildArgs="$msbuildArgs /nr:$nodereuse" - echo "$build_driver $msbuildArgs $extraArgs" + #echo "$build_driver $msbuildArgs $extraArgs" "$build_driver" $msbuildArgs $extraArgs return $? diff --git a/global.json b/global.json index d5fffb56ba3b..064d3e83e1ef 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18507.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18511.4" } } \ No newline at end of file From 8ecd6858029952d7e5d3ba0bf2dd0ae6758c7f35 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 11 Oct 2018 21:44:23 +0000 Subject: [PATCH 0131/2702] Updating version files (#107) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index aadf92029a22..6d63b27403c3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b16f10d78a845725dd81500c0791fdf5b69370e2 + bc1a0a7e269d5a534f444deafdfd4644acb7e179 \ No newline at end of file diff --git a/global.json b/global.json index 064d3e83e1ef..d0bcdf87366e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18511.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18511.5" } } \ No newline at end of file From 42eb8ba9dc58f53764f8bbb6776bcb63ad34101c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 11 Oct 2018 22:38:05 +0000 Subject: [PATCH 0132/2702] Updating version files (#108) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6d63b27403c3..2a6d08fb25dc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - bc1a0a7e269d5a534f444deafdfd4644acb7e179 + 0f209fc718e920446ac1c85ab8b8d9fab68258d6 \ No newline at end of file diff --git a/global.json b/global.json index d0bcdf87366e..39c9c9b03073 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18511.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18511.6" } } \ No newline at end of file From 2d5dc924c7dfb29665c3e7147d788bd337c7a11c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 12 Oct 2018 16:37:13 +0000 Subject: [PATCH 0133/2702] Updating version files (#109) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2a6d08fb25dc..ea41d03a32f1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 0f209fc718e920446ac1c85ab8b8d9fab68258d6 + 9f4721e1bf709fb0803756e1ab9940a06c881dcd \ No newline at end of file diff --git a/global.json b/global.json index 39c9c9b03073..4b6c1688d6e4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18511.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.2" } } \ No newline at end of file From 7725d417e7e2cffed0e4b0563f1e43c7a39fc7cc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 12 Oct 2018 17:04:20 +0000 Subject: [PATCH 0134/2702] Updating version files (#110) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ea41d03a32f1..20af333e593b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 9f4721e1bf709fb0803756e1ab9940a06c881dcd + 947a233f84ca6f3f1518993b0ea20b37e71dd11d \ No newline at end of file diff --git a/global.json b/global.json index 4b6c1688d6e4..11118573d8ae 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.3" } } \ No newline at end of file From 1aa9655ba6e8a624bdd036d721ffa5218f61c1b6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 12 Oct 2018 19:05:22 +0000 Subject: [PATCH 0135/2702] Updating version files (#111) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 20af333e593b..79ab3ff708cb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 947a233f84ca6f3f1518993b0ea20b37e71dd11d + 7a6c4ddd3242ccfdd8fcbfe25f5461b774f4a228 \ No newline at end of file diff --git a/global.json b/global.json index 11118573d8ae..c868ab2085b5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.4" } } \ No newline at end of file From 8e86f4adeb624ad7ac47237f0fc95b6b1aeb9e38 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 12 Oct 2018 22:04:12 +0000 Subject: [PATCH 0136/2702] Updating version files (#112) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 79ab3ff708cb..124bb5785626 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 7a6c4ddd3242ccfdd8fcbfe25f5461b774f4a228 + e74505a1b24515531b08bb448ba71a4f3798caee \ No newline at end of file diff --git a/global.json b/global.json index c868ab2085b5..cb40fd02a9de 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.5" } } \ No newline at end of file From 07b4460dbe1cc06f707f2dff061e1d7f545fe08d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 12 Oct 2018 23:27:07 +0000 Subject: [PATCH 0137/2702] [Darc-Update] Update dependencies from build 20181012.7 of https://github.com/dotnet/arcade (#113) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 124bb5785626..3ca70159b475 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e74505a1b24515531b08bb448ba71a4f3798caee + b6b9dfa1778de0f3094c3ae42abd83a23f4cd81a \ No newline at end of file diff --git a/global.json b/global.json index cb40fd02a9de..63cfc4a16a8f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.7" } } \ No newline at end of file From c567c0227c0e86cb85e2921e80c082b9b4171116 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 12 Oct 2018 23:54:48 +0000 Subject: [PATCH 0138/2702] Updating version files (#114) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3ca70159b475..363b2987af3b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b6b9dfa1778de0f3094c3ae42abd83a23f4cd81a + 676c37bbe5932cbea5c101242bee689b17337aa5 \ No newline at end of file diff --git a/global.json b/global.json index 63cfc4a16a8f..55f654442db2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.8" } } \ No newline at end of file From efa87958bc8c273df151a9c8f1205033e52d5971 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 13 Oct 2018 13:06:17 +0000 Subject: [PATCH 0139/2702] [Darc-Update] Update dependencies from build 20181013.1 of https://github.com/dotnet/arcade (#115) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 363b2987af3b..2372fef25ac5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 676c37bbe5932cbea5c101242bee689b17337aa5 + 75a3e9c85f9e24c76cdf6d55d9de0764c532243c \ No newline at end of file diff --git a/global.json b/global.json index 55f654442db2..67016779baef 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18512.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18513.1" } } \ No newline at end of file From c2f6937733c74e3e7a01aab93320e6a2c881a83b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 15 Oct 2018 18:29:24 +0000 Subject: [PATCH 0140/2702] Updating version files (#116) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2372fef25ac5..ad2eae3e1b67 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 75a3e9c85f9e24c76cdf6d55d9de0764c532243c + e81c9e518e610e26e431b63eafbeb33994adddb8 \ No newline at end of file diff --git a/global.json b/global.json index 67016779baef..85ec1abe893a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18513.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18515.1" } } \ No newline at end of file From fd6cd371e592df125aaa1b0967ed8b83ffd7c682 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 15 Oct 2018 22:46:08 +0000 Subject: [PATCH 0141/2702] Updating version files (#117) --- eng/Version.Details.xml | 4 +- eng/common/init-tools-native.ps1 | 9 +- eng/common/native/CommonLibrary.psm1 | 53 ++++++----- eng/common/native/install-tool.ps1 | 128 +++++++++++++++++++++++++++ global.json | 2 +- 5 files changed, 165 insertions(+), 31 deletions(-) create mode 100644 eng/common/native/install-tool.ps1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ad2eae3e1b67..014d476e84d1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e81c9e518e610e26e431b63eafbeb33994adddb8 + 7829ae8cb957c196677f81ff3ab805122fbc986b \ No newline at end of file diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index 45f4082bb103..e25c60fed423 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -60,6 +60,7 @@ try { } $Env:CommonLibrary_NativeInstallDir = $NativeBaseDir $InstallBin = Join-Path $NativeBaseDir "bin" + $InstallerPath = Join-Path $EngCommonBaseDir "install-tool.ps1" # Process tools list Write-Host "Processing $GlobalJsonFile" @@ -74,8 +75,8 @@ try { $NativeTools.PSObject.Properties | ForEach-Object { $ToolName = $_.Name $ToolVersion = $_.Value - $InstallerFilename = "install-$ToolName.ps1" - $LocalInstallerCommand = Join-Path $EngCommonBaseDir $InstallerFilename + $LocalInstallerCommand = $InstallerPath + $LocalInstallerCommand += " -ToolName $ToolName" $LocalInstallerCommand += " -InstallPath $InstallBin" $LocalInstallerCommand += " -BaseUri $BaseUri" $LocalInstallerCommand += " -CommonLibraryDirectory $EngCommonBaseDir" @@ -112,9 +113,7 @@ try { } if (Test-Path $InstallBin) { Write-Host "Native tools are available from" (Convert-Path -Path $InstallBin) - if ($env:BUILD_BUILDNUMBER) { - Write-Host "##vso[task.prependpath]" (Convert-Path -Path $InstallBin) - } + Write-Host "##vso[task.prependpath]$(Convert-Path -Path $InstallBin)" } else { Write-Error "Native tools install directory does not exist, installation failed" diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index 18fd261f103d..800cda473a30 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -36,7 +36,7 @@ function DownloadAndExtract { ) # Define verbose switch if undefined $Verbose = $VerbosePreference -Eq "Continue" - + $TempToolPath = CommonLibrary\Get-TempPathFilename -Path $Uri # Download native tool @@ -57,7 +57,7 @@ function DownloadAndExtract { -OutputDirectory $InstallDirectory ` -Force:$Force ` -Verbose:$Verbose - + if ($UnzipStatus -Eq $False) { Write-Error "Unzip failed" return $False @@ -155,8 +155,11 @@ Generate a shim for a native tool .DESCRIPTION Creates a wrapper script (shim) that passes arguments forward to native tool assembly -.PARAMETER ShimPath -Path to shim file +.PARAMETER ShimName +The name of the shim + +.PARAMETER ShimDirectory +The directory where shims are stored .PARAMETER ToolFilePath Path to file that shim forwards to @@ -171,38 +174,42 @@ function New-ScriptShim { [CmdletBinding(PositionalBinding=$false)] Param ( [Parameter(Mandatory=$True)] - [string] $ShimPath, + [string] $ShimName, + [Parameter(Mandatory=$True)] + [string] $ShimDirectory, [Parameter(Mandatory=$True)] [string] $ToolFilePath, + [Parameter(Mandatory=$True)] + [string] $BaseUri, [switch] $Force ) try { - Write-Verbose "Generating '$ShimPath' shim" - - if ((Test-Path $ShimPath) -And (-Not $Force)) { - Write-Error "$ShimPath already exists" - return $False - } + Write-Verbose "Generating '$ShimName' shim" if (-Not (Test-Path $ToolFilePath)){ Write-Error "Specified tool file path '$ToolFilePath' does not exist" return $False } - $ShimContents = "@echo off`n" - $ShimContents += "setlocal enableextensions enabledelayedexpansion`n" - $ShimContents += "set SHIMARGS=`n" - $ShimContents += "for %%x in (%*) do (set SHIMARGS=!SHIMARGS! `"%%~x`")`n" - $ShimContents += "`"$ToolFilePath`" %SHIMARGS%`n" - $ShimContents += "endlocal" - - # Write shim file - $ShimContents | Out-File $ShimPath -Encoding "ASCII" + # WinShimmer is a small .NET Framework program that creates .exe shims to bootstrapped programs + # Many of the checks for installed programs expect a .exe extension for Windows tools, rather + # than a .bat or .cmd file. + # Source: https://github.com/dotnet/arcade/tree/master/src/WinShimmer + if (-Not (Test-Path "$ShimDirectory\WinShimmer\winshimmer.exe")) { + $InstallStatus = DownloadAndExtract -Uri "$BaseUri/windows/winshimmer/WinShimmer.zip" ` + -InstallDirectory $ShimDirectory\WinShimmer ` + -Force:$Force ` + -DownloadRetries 2 ` + -RetryWaitTimeInSeconds 5 ` + -Verbose:$Verbose + } - if (-Not $?) { - Write-Error "Failed to generate shim" - return $False + if ((Test-Path (Join-Path $ShimDirectory $ShimName.exe))) { + Write-Host "$ShimName.exe already exists; replacing..." + Remove-Item (Join-Path $ShimDirectory $ShimName.exe) } + + Invoke-Expression "$ShimDirectory\WinShimmer\winshimmer.exe $ShimName $ToolFilePath $ShimDirectory" return $True } catch { diff --git a/eng/common/native/install-tool.ps1 b/eng/common/native/install-tool.ps1 new file mode 100644 index 000000000000..45138e6413c9 --- /dev/null +++ b/eng/common/native/install-tool.ps1 @@ -0,0 +1,128 @@ +<# +.SYNOPSIS +Install native tool + +.DESCRIPTION +Install cmake native tool from Azure blob storage + +.PARAMETER InstallPath +Base directory to install native tool to + +.PARAMETER BaseUri +Base file directory or Url from which to acquire tool archives + +.PARAMETER CommonLibraryDirectory +Path to folder containing common library modules + +.PARAMETER Force +Force install of tools even if they previously exist + +.PARAMETER Clean +Don't install the tool, just clean up the current install of the tool + +.PARAMETER DownloadRetries +Total number of retry attempts + +.PARAMETER RetryWaitTimeInSeconds +Wait time between retry attempts in seconds + +.NOTES +Returns 0 if install succeeds, 1 otherwise +#> +[CmdletBinding(PositionalBinding=$false)] +Param ( + [Parameter(Mandatory=$True)] + [string] $ToolName, + [Parameter(Mandatory=$True)] + [string] $InstallPath, + [Parameter(Mandatory=$True)] + [string] $BaseUri, + [Parameter(Mandatory=$True)] + [string] $Version, + [string] $CommonLibraryDirectory = $PSScriptRoot, + [switch] $Force = $False, + [switch] $Clean = $False, + [int] $DownloadRetries = 5, + [int] $RetryWaitTimeInSeconds = 30 +) + +# Import common library modules +Import-Module -Name (Join-Path $CommonLibraryDirectory "CommonLibrary.psm1") + +try { + # Define verbose switch if undefined + $Verbose = $VerbosePreference -Eq "Continue" + + $Arch = CommonLibrary\Get-MachineArchitecture + $ToolOs = "win64" + if($Arch -Eq "x32") { + $ToolOs = "win32" + } + $ToolNameMoniker = "$ToolName-$Version-$ToolOs-$Arch" + $ToolInstallDirectory = Join-Path $InstallPath "$ToolName\$Version\" + $ToolFilePath = Get-ChildItem $ToolInstallDirectory -Recurse -Filter "$ToolName.exe" | % { $_.FullName } + if (@($ToolFilePath).Length -Gt 1) { + Write-Error "There are too many $($ToolName)s in $ToolFilePath!" + exit 1 + } elseif (@($ToolFilePath).Length -Lt 1) { + Write-Error "There are not enough $($ToolName)s in $ToolFilePath!" + exit 1 + } + $ShimPath = Join-Path $InstallPath "$ToolName.exe" + $Uri = "$BaseUri/windows/$Toolname/$ToolNameMoniker.zip" + + if ($Clean) { + Write-Host "Cleaning $ToolInstallDirectory" + if (Test-Path $ToolInstallDirectory) { + Remove-Item $ToolInstallDirectory -Force -Recurse + } + Write-Host "Cleaning $ShimPath" + if (Test-Path $ShimPath) { + Remove-Item $ShimPath -Force + } + $ToolTempPath = CommonLibrary\Get-TempPathFilename -Path $Uri + Write-Host "Cleaning $ToolTempPath" + if (Test-Path $ToolTempPath) { + Remove-Item $ToolTempPath -Force + } + exit 0 + } + + # Install tool + if ((Test-Path $ToolFilePath) -And (-Not $Force)) { + Write-Verbose "$ToolName ($Version) already exists, skipping install" + } + else { + $InstallStatus = CommonLibrary\DownloadAndExtract -Uri $Uri ` + -InstallDirectory $ToolInstallDirectory ` + -Force:$Force ` + -DownloadRetries $DownloadRetries ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Verbose:$Verbose + + if ($InstallStatus -Eq $False) { + Write-Error "Installation failed" + exit 1 + } + } + # Generate shim + # Always rewrite shims so that we are referencing the expected version + $GenerateShimStatus = CommonLibrary\New-ScriptShim -ShimName $ToolName ` + -ShimDirectory $InstallPath ` + -ToolFilePath "$ToolFilePath" ` + -BaseUri $BaseUri ` + -Force:$Force ` + -Verbose:$Verbose + + if ($GenerateShimStatus -Eq $False) { + Write-Error "Generate shim failed" + return 1 + } + + exit 0 +} +catch { + Write-Host $_ + Write-Host $_.Exception + exit 1 +} diff --git a/global.json b/global.json index 85ec1abe893a..25a6539643db 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18515.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18515.2" } } \ No newline at end of file From 863718513dcf402e1665dc2c55e573eddba5f6a9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 16 Oct 2018 13:09:31 +0000 Subject: [PATCH 0142/2702] Updating version files (#118) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 014d476e84d1..07f936b5a657 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 7829ae8cb957c196677f81ff3ab805122fbc986b + e7d444fdc184cc74d35bb6be316d45209175e543 \ No newline at end of file diff --git a/global.json b/global.json index 25a6539643db..56f848e51972 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18515.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.1" } } \ No newline at end of file From 067b985ee1e44475bb0b2f0561035680a198572d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 16 Oct 2018 19:04:40 +0000 Subject: [PATCH 0143/2702] Updating version files (#120) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 07f936b5a657..64ae7e076aa6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e7d444fdc184cc74d35bb6be316d45209175e543 + 2d24989736329824f6b91f7e63923f849071c85d \ No newline at end of file diff --git a/global.json b/global.json index 56f848e51972..928174a5a878 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.2" } } \ No newline at end of file From 181765ad169dbee0ec1c9e510827f33981ca97a7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 16 Oct 2018 21:11:12 +0000 Subject: [PATCH 0144/2702] Updating version files (#121) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 64ae7e076aa6..028b4a006ae9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 2d24989736329824f6b91f7e63923f849071c85d + 9bc491eacd610401a33f64e6d03388f6f872e7d9 \ No newline at end of file diff --git a/global.json b/global.json index 928174a5a878..dc86ffd85e7c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.3" } } \ No newline at end of file From 3df06f71426da4abd98f497745c881cabaf4ff41 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 16 Oct 2018 22:09:39 +0000 Subject: [PATCH 0145/2702] [Darc-Update] Update dependencies from build 20181016.5 of https://github.com/dotnet/arcade (#122) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- eng/common/native/CommonLibrary.psm1 | 4 ++-- eng/common/native/install-tool.ps1 | 22 ++++++++++++---------- global.json | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 028b4a006ae9..2e0f16103cc6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 9bc491eacd610401a33f64e6d03388f6f872e7d9 + 3f6ded0d4d606ed995f275a47c154ca6a22e8c7b \ No newline at end of file diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index 800cda473a30..f286ae0cde2a 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -204,9 +204,9 @@ function New-ScriptShim { -Verbose:$Verbose } - if ((Test-Path (Join-Path $ShimDirectory $ShimName.exe))) { + if ((Test-Path (Join-Path $ShimDirectory "$ShimName.exe"))) { Write-Host "$ShimName.exe already exists; replacing..." - Remove-Item (Join-Path $ShimDirectory $ShimName.exe) + Remove-Item (Join-Path $ShimDirectory "$ShimName.exe") } Invoke-Expression "$ShimDirectory\WinShimmer\winshimmer.exe $ShimName $ToolFilePath $ShimDirectory" diff --git a/eng/common/native/install-tool.ps1 b/eng/common/native/install-tool.ps1 index 45138e6413c9..635ab3fd414b 100644 --- a/eng/common/native/install-tool.ps1 +++ b/eng/common/native/install-tool.ps1 @@ -60,16 +60,8 @@ try { } $ToolNameMoniker = "$ToolName-$Version-$ToolOs-$Arch" $ToolInstallDirectory = Join-Path $InstallPath "$ToolName\$Version\" - $ToolFilePath = Get-ChildItem $ToolInstallDirectory -Recurse -Filter "$ToolName.exe" | % { $_.FullName } - if (@($ToolFilePath).Length -Gt 1) { - Write-Error "There are too many $($ToolName)s in $ToolFilePath!" - exit 1 - } elseif (@($ToolFilePath).Length -Lt 1) { - Write-Error "There are not enough $($ToolName)s in $ToolFilePath!" - exit 1 - } + $Uri = "$BaseUri/windows/$ToolName/$ToolNameMoniker.zip" $ShimPath = Join-Path $InstallPath "$ToolName.exe" - $Uri = "$BaseUri/windows/$Toolname/$ToolNameMoniker.zip" if ($Clean) { Write-Host "Cleaning $ToolInstallDirectory" @@ -89,7 +81,7 @@ try { } # Install tool - if ((Test-Path $ToolFilePath) -And (-Not $Force)) { + if ((Test-Path $ToolInstallDirectory) -And (-Not $Force)) { Write-Verbose "$ToolName ($Version) already exists, skipping install" } else { @@ -105,6 +97,16 @@ try { exit 1 } } + + $ToolFilePath = Get-ChildItem $ToolInstallDirectory -Recurse -Filter "$ToolName.exe" | % { $_.FullName } + if (@($ToolFilePath).Length -Gt 1) { + Write-Error "There are multiple copies of $ToolName in $($ToolInstallDirectory): `n$(@($ToolFilePath | out-string))" + exit 1 + } elseif (@($ToolFilePath).Length -Lt 1) { + Write-Error "$ToolName was not found in $ToolFilePath." + exit 1 + } + # Generate shim # Always rewrite shims so that we are referencing the expected version $GenerateShimStatus = CommonLibrary\New-ScriptShim -ShimName $ToolName ` diff --git a/global.json b/global.json index dc86ffd85e7c..1b429a219e1b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.5" } } \ No newline at end of file From 114fdb9da7c7491a2739904f79a3754f6c2fc985 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Tue, 16 Oct 2018 15:53:08 -0700 Subject: [PATCH 0146/2702] Add .packages folder to git ignore list (#119) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e81ae007ae7b..e8a58417ca77 100644 --- a/.gitignore +++ b/.gitignore @@ -179,6 +179,7 @@ PublishScripts/ # NuGet Packages *.nupkg +.packages/ # The packages folder can be ignored because of Package Restore **/[Pp]ackages/* # except build/, which is used as an MSBuild target. From 461e6bca0f7d2093a7ace13915daa389d108c7f2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 16 Oct 2018 23:06:59 +0000 Subject: [PATCH 0147/2702] Updating version files (#123) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2e0f16103cc6..8d6d6666fee6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3f6ded0d4d606ed995f275a47c154ca6a22e8c7b + 20d25227ac3fe3a88ef3278299b4b69fddcc6375 \ No newline at end of file diff --git a/global.json b/global.json index 1b429a219e1b..a63b4746a633 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.6" } } \ No newline at end of file From 66c9dd77fd14910521b49d22defb303ac26ee311 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 16 Oct 2018 23:47:08 +0000 Subject: [PATCH 0148/2702] Updating version files (#124) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8d6d6666fee6..cea0059e8b05 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 20d25227ac3fe3a88ef3278299b4b69fddcc6375 + ed016d5d82e345f5031f358cb5628ed740956ca6 \ No newline at end of file diff --git a/global.json b/global.json index a63b4746a633..28ba7cc7b4b6 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.7" } } \ No newline at end of file From 0137515dc200b7e1fea2f0ced387f21f51b3c2e7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 17 Oct 2018 00:13:43 +0000 Subject: [PATCH 0149/2702] Updating version files (#125) --- eng/Version.Details.xml | 4 +- eng/common/build.ps1 | 7 +- eng/common/build.sh | 24 ++-- eng/common/darc-init.ps1 | 21 ++- eng/common/darc-init.sh | 21 ++- eng/common/msbuild.ps1 | 3 +- eng/common/msbuild.sh | 8 +- eng/common/tools.ps1 | 283 +++++++++++++++++++++++++++++++++++++++ eng/common/tools.sh | 258 +++++++++++++++++++++++++++++++++++ global.json | 2 +- 10 files changed, 609 insertions(+), 22 deletions(-) create mode 100644 eng/common/tools.ps1 create mode 100644 eng/common/tools.sh diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cea0059e8b05..de251828695b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ed016d5d82e345f5031f358cb5628ed740956ca6 + 2d27f969d21be61a75bd9e3d031ae137b0b2c346 \ No newline at end of file diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index ba866c5801df..ca45b3db719b 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -3,6 +3,7 @@ Param( [string] $configuration = "Debug", [string] $projects = "", [string] $verbosity = "minimal", + [string] $msbuildEngine = $null, [bool] $warnaserror = $true, [bool] $nodereuse = $true, [switch] $restore, @@ -23,7 +24,7 @@ Param( [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties ) -. $PSScriptRoot\init-tools.ps1 +. $PSScriptRoot\tools.ps1 function Print-Usage() { Write-Host "Common settings:" @@ -51,6 +52,7 @@ function Print-Usage() { Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" Write-Host " -ci Set when running on CI server" Write-Host " -prepareMachine Prepare machine for CI run" + Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." Write-Host "" Write-Host "Command line arguments not listed above are passed thru to msbuild." Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." @@ -66,6 +68,8 @@ try { $projects = Join-Path $RepoRoot "*.sln" } + InitializeTools + $BuildLog = Join-Path $LogDir "Build.binlog" MSBuild $ToolsetBuildProj ` @@ -86,7 +90,6 @@ try { /p:Publish=$publish ` /p:PublishBuildAssets=$publishBuildAssets ` /p:ContinuousIntegrationBuild=$ci ` - /p:CIBuild=$ci ` @properties if ($lastExitCode -ne 0) { diff --git a/eng/common/build.sh b/eng/common/build.sh index a216f8fd7b3e..941db3bd5703 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -18,18 +18,21 @@ build=false rebuild=false test=false pack=false +publish=false integration_test=false performance_test=false sign=false public=false ci=false +warnaserror=true +nodereuse=true + projects='' configuration='Debug' prepare_machine=false verbosity='minimal' -msbuildArgs='' -extraargs='' +properties='' while (($# > 0)); do lowerI="$(echo $1 | awk '{print tolower($0)}')" @@ -58,6 +61,7 @@ while (($# > 0)); do echo " --rebuild Rebuild solution" echo " --test Run all unit tests in the solution" echo " --sign Sign build outputs" + echo " --publish Publish artifacts (e.g. symbols)" echo " --pack Package build outputs into NuGet packages and Willow components" echo "" echo "Advanced settings:" @@ -131,23 +135,24 @@ while (($# > 0)); do esac done -. $scriptroot/init-tools.sh +. "$scriptroot/tools.sh" if [[ -z $projects ]]; then projects="$repo_root/*.sln" fi +InitializeTools + build_log="$log_dir/Build.binlog" -MSBuild $toolset_build_proj \ - /bl:$build_log \ +MSBuild "$toolset_build_proj" \ + /bl:"$build_log" \ /p:Configuration=$configuration \ - /p:Projects=$projects \ + /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 \ @@ -155,13 +160,12 @@ MSBuild $toolset_build_proj \ /p:Sign=$sign \ /p:Publish=$publish \ /p:ContinuousIntegrationBuild=$ci \ - /p:CIBuild=$ci \ $properties lastexitcode=$? if [[ $lastexitcode != 0 ]]; then - echo "Build Failed (exit code '$lastexitcode'). See log: $build_log" + echo "Build failed (exit code '$lastexitcode'). See log: $build_log" fi -ExitWithExitCode $lastexitcode \ No newline at end of file +ExitWithExitCode $lastexitcode diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index e64ae053e786..8d7b143f2efe 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,4 +1,21 @@ $verbosity = "m" -. $PSScriptRoot\init-tools.ps1 +. $PSScriptRoot\tools.ps1 -InstallDarcCli \ No newline at end of file +function InstallDarcCli { + $darcCliPackageName = "microsoft.dotnet.darc" + $dotnet = $env:DOTNET_INSTALL_DIR + $toolList = Invoke-Expression "$dotnet tool list -g" + + if ($toolList -like "*$darcCliPackageName*") { + Invoke-Expression "$dotnet tool uninstall $darcCliPackageName -g" + } + + $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' + + Write-Host "Installing Darc CLI version $toolsetVersion..." + Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." + Invoke-Expression "$dotnet tool install $darcCliPackageName --version $toolsetVersion -v $verbosity -g" +} + +InitializeTools +InstallDarcCli diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index 97476fe0b91f..a0c733a15d40 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -13,6 +13,23 @@ done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" verbosity=m -. $scriptroot/init-tools.sh +. "$scriptroot/tools.sh" -InstallDarcCli \ No newline at end of file +function InstallDarcCli { + local darc_cli_package_name="microsoft.dotnet.darc" + local uninstall_command=`$DOTNET_INSTALL_DIR/dotnet tool uninstall $darc_cli_package_name -g` + local tool_list=$($DOTNET_INSTALL_DIR/dotnet tool list -g) + if [[ $tool_list = *$darc_cli_package_name* ]]; then + echo $($DOTNET_INSTALL_DIR/dotnet tool uninstall $darc_cli_package_name -g) + fi + + ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk" + local toolset_version=$_ReadGlobalVersion + + echo "Installing Darc CLI version $toolset_version..." + echo "You may need to restart your command shell if this is the first dotnet tool you have installed." + echo $($DOTNET_INSTALL_DIR/dotnet tool install $darc_cli_package_name --version $toolset_version -v $verbosity -g) +} + +InitializeTools +InstallDarcCli diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 index ca34734239bd..43b837f4df7d 100644 --- a/eng/common/msbuild.ps1 +++ b/eng/common/msbuild.ps1 @@ -8,9 +8,10 @@ Param( [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs ) -. $PSScriptRoot\init-tools.ps1 +. $PSScriptRoot\tools.ps1 try { + InitializeTools MSBuild @extraArgs ExitWithExitCode $lastExitCode } diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh index 72ebc88014d2..b1024487f732 100755 --- a/eng/common/msbuild.sh +++ b/eng/common/msbuild.sh @@ -13,6 +13,9 @@ done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" verbosity='minimal' +warnaserror=true +nodereuse=true +prepare_machine=false extraargs='' while (($# > 0)); do @@ -45,7 +48,8 @@ while (($# > 0)); do esac done -. $scriptroot/init-tools.sh +. "$scriptroot/tools.sh" +InitializeTools MSBuild $extraargs -ExitWithExitCode $? \ No newline at end of file +ExitWithExitCode $? diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 new file mode 100644 index 000000000000..40554a5ae5e4 --- /dev/null +++ b/eng/common/tools.ps1 @@ -0,0 +1,283 @@ +# Initialize variables if they aren't already defined + +$ci = if (Test-Path variable:ci) { $ci } else { $false } +$configuration = if (Test-Path variable:configuration) { $configuration } else { "Debug" } +$nodereuse = if (Test-Path variable:nodereuse) { $nodereuse } else { !$ci } +$prepareMachine = if (Test-Path variable:prepareMachine) { $prepareMachine } else { $false } +$restore = if (Test-Path variable:restore) { $restore } else { $true } +$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { "minimal" } +$warnaserror = if (Test-Path variable:warnaserror) { $warnaserror } else { $true } +$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } +$useInstalledDotNetCli = if (Test-Path variable:useInstalledCli) { $useInstalledCli } else { $true } + +set-strictmode -version 2.0 +$ErrorActionPreference = "Stop" +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + +function Create-Directory([string[]] $path) { + if (!(Test-Path $path)) { + New-Item -path $path -force -itemType "Directory" | Out-Null + } +} + +function InitializeDotNetCli([bool]$install) { + # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism + $env:DOTNET_MULTILEVEL_LOOKUP=0 + + # Disable first run since we do not need all ASP.NET packages restored. + $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + + # Source Build uses DotNetCoreSdkDir variable + if ($env:DotNetCoreSdkDir -ne $null) { + $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir + } + + # Find the first path on %PATH% that contains the dotnet.exe + if ($useInstalledDotNetCli -and ($env:DOTNET_INSTALL_DIR -eq $null)) { + $env:DOTNET_INSTALL_DIR = ${env:PATH}.Split(';') | where { ($_ -ne "") -and (Test-Path (Join-Path $_ "dotnet.exe")) } + } + + $dotnetSdkVersion = $GlobalJson.tools.dotnet + + # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, + # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. + if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { + $dotnetRoot = $env:DOTNET_INSTALL_DIR + } else { + $dotnetRoot = Join-Path $RepoRoot ".dotnet" + $env:DOTNET_INSTALL_DIR = $dotnetRoot + + if (-not (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { + if ($install) { + InstallDotNetSdk $dotnetRoot $dotnetSdkVersion + } else { + Write-Host "Unable to find dotnet with SDK version '$dotnetSdkVersion'" -ForegroundColor Red + ExitWithExitCode 1 + } + } + } + + return $dotnetRoot +} + +function GetDotNetInstallScript([string] $dotnetRoot) { + $installScript = "$dotnetRoot\dotnet-install.ps1" + if (!(Test-Path $installScript)) { + Create-Directory $dotnetRoot + Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript + } + + return $installScript +} + +function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { + $installScript = GetDotNetInstallScript $dotnetRoot + & $installScript -Version $version -InstallDir $dotnetRoot + if ($lastExitCode -ne 0) { + Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red + ExitWithExitCode $lastExitCode + } +} + +function InitializeVisualStudioBuild { + $vsToolsPath = $env:VS150COMNTOOLS + if ($vsToolsPath -eq $null) { + $vsToolsPath = $env:VS160COMNTOOLS + } + + if (($vsToolsPath -ne $null) -and (Test-Path $vsToolsPath)) { + $vsInstallDir = [System.IO.Path]::GetFullPath((Join-Path $vsToolsPath "..\..")) + } else { + $vsInfo = LocateVisualStudio + + $vsInstallDir = $vsInfo.installationPath + $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\" + $vsVersion = $vsInfo.installationVersion.Split('.')[0] + "0" + + Set-Item "env:VS$($vsVersion)COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\") + Set-Item "env:VSSDK$($vsVersion)Install" $vsSdkInstallDir + $env:VSSDKInstall = $vsSdkInstallDir + } + + return $vsInstallDir +} + +function LocateVisualStudio { + $vswhereVersion = $GlobalJson.tools.vswhere + + if (!$vsWhereVersion) { + Write-Host "vswhere version must be specified in /global.json." -ForegroundColor Red + ExitWithExitCode 1 + } + + $toolsRoot = Join-Path $RepoRoot ".tools" + $vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion" + $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe" + + if (!(Test-Path $vsWhereExe)) { + Create-Directory $vsWhereDir + Write-Host "Downloading vswhere" + Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe + } + + $vsInfo = & $vsWhereExe ` + -latest ` + -prerelease ` + -format json ` + -requires Microsoft.Component.MSBuild ` + -requires Microsoft.VisualStudio.Component.VSSDK ` + -requires Microsoft.VisualStudio.Component.Roslyn.Compiler | ConvertFrom-Json + + if ($lastExitCode -ne 0) { + Write-Host "Failed to locate Visual Studio (exit code '$lastExitCode')." -ForegroundColor Red + ExitWithExitCode $lastExitCode + } + + # use first matching instance + return $vsInfo[0] +} + +function ConfigureTools { + # Include custom tools configuration + $script = Join-Path $EngRoot "configure-toolset.ps1" + + if (Test-Path $script) { + . $script + } +} + +function InitializeTools() { + ConfigureTools + + $tools = $GlobalJson.tools + + # Initialize dotnet cli if listed in 'tools' + $dotnetRoot = $null + if ((Get-Member -InputObject $tools -Name "dotnet") -ne $null) { + $dotnetRoot = InitializeDotNetCli -install:$restore + } + + if (-not $msbuildEngine) { + # Presence of vswhere.version indicates the repo needs to build using VS msbuild. + if ((Get-Member -InputObject $tools -Name "vswhere") -ne $null) { + $msbuildEngine = "vs" + } elseif ($dotnetRoot -ne $null) { + $msbuildEngine = "dotnet" + } else { + Write-Host "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vswhere'." -ForegroundColor Red + ExitWithExitCode 1 + } + } + + if ($msbuildEngine -eq "dotnet") { + if (!$dotnetRoot) { + Write-Host "/global.json must specify 'tools.dotnet'." -ForegroundColor Red + ExitWithExitCode 1 + } + + $script:buildDriver = Join-Path $dotnetRoot "dotnet.exe" + $script:buildArgs = "msbuild" + } elseif ($msbuildEngine -eq "vs") { + $vsInstallDir = InitializeVisualStudioBuild + + $script:buildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe" + $script:buildArgs = "" + } else { + Write-Host "Unexpected value of -msbuildEngine: '$msbuildEngine'." -ForegroundColor Red + ExitWithExitCode 1 + } + + InitializeToolSet $script:buildDriver $script:buildArgs + InitializeCustomToolset +} + +function InitializeToolset([string] $buildDriver, [string]$buildArgs) { + $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' + $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" + + if (Test-Path $toolsetLocationFile) { + $path = Get-Content $toolsetLocationFile -TotalCount 1 + if (Test-Path $path) { + $script:ToolsetBuildProj = $path + return + } + } + + if (-not $restore) { + Write-Host "Toolset version $toolsetVersion has not been restored." + ExitWithExitCode 1 + } + + $ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog" + $proj = Join-Path $ToolsetDir "restore.proj" + + '' | Set-Content $proj + MSBuild $proj /t:__WriteToolsetLocation /clp:None /bl:$ToolsetRestoreLog /p:__ToolsetLocationOutputFile=$toolsetLocationFile + + if ($lastExitCode -ne 0) { + Write-Host "Failed to restore toolset (exit code '$lastExitCode'). See log: $ToolsetRestoreLog" -ForegroundColor Red + ExitWithExitCode $lastExitCode + } + + $path = Get-Content $toolsetLocationFile -TotalCount 1 + if (!(Test-Path $path)) { + throw "Invalid toolset path: $path" + } + + $script:ToolsetBuildProj = $path +} + +function InitializeCustomToolset { + if (-not $restore) { + return + } + + $script = Join-Path $EngRoot "restore-toolset.ps1" + + if (Test-Path $script) { + . $script + } +} + +function ExitWithExitCode([int] $exitCode) { + if ($ci -and $prepareMachine) { + Stop-Processes + } + exit $exitCode +} + +function Stop-Processes() { + Write-Host "Killing running build processes..." + Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Stop-Process + Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | Stop-Process + Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process +} + +function MsBuild() { + $warnaserrorSwitch = if ($warnaserror) { "/warnaserror" } else { "" } + & $buildDriver $buildArgs $warnaserrorSwitch /m /nologo /clp:Summary /v:$verbosity /nr:$nodereuse $args +} + +$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") +$EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") +$ArtifactsDir = Join-Path $RepoRoot "artifacts" +$ToolsetDir = Join-Path $ArtifactsDir "toolset" +$LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration +$TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration +$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json + +if ($env:NUGET_PACKAGES -eq $null) { + # Use local cache on CI to ensure deterministic build, + # use global cache in dev builds to avoid cost of downloading packages. + $env:NUGET_PACKAGES = if ($ci) { Join-Path $RepoRoot ".packages" } + else { Join-Path $env:UserProfile ".nuget\packages" } +} + +Create-Directory $ToolsetDir +Create-Directory $LogDir + +if ($ci) { + Create-Directory $TempDir + $env:TEMP = $TempDir + $env:TMP = $TempDir +} diff --git a/eng/common/tools.sh b/eng/common/tools.sh new file mode 100644 index 000000000000..c7d03ee028bd --- /dev/null +++ b/eng/common/tools.sh @@ -0,0 +1,258 @@ +#!/usr/bin/env bash + +# Stop script if unbound variable found (use ${var:-} if intentional) +set -u + +ci=${ci:-false} +configuration=${configuration:-'Debug'} +nodereuse=${nodereuse:-true} +prepare_machine=${prepare_machine:-false} +restore=${restore:-true} +verbosity=${verbosity:-'minimal'} +warnaserror=${warnaserror:-true} +useInstalledDotNetCli=${useInstalledDotNetCli:-true} + +repo_root="$scriptroot/../.." +eng_root="$scriptroot/.." +artifacts_dir="$repo_root/artifacts" +toolset_dir="$artifacts_dir/toolset" +log_dir="$artifacts_dir/log/$configuration" +temp_dir="$artifacts_dir/tmp/$configuration" + +global_json_file="$repo_root/global.json" +build_driver="" +toolset_build_proj="" + +function ResolvePath { + local path=$1 + + # resolve $path until the file is no longer a symlink + while [[ -h $path ]]; do + local dir="$( cd -P "$( dirname "$path" )" && pwd )" + path="$(readlink "$path")" + + # if $path was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $path != /* ]] && path="$dir/$path" + done + + # return value + _ResolvePath="$path" +} + +# ReadVersionFromJson [json key] +function ReadGlobalVersion { + local key=$1 + + local line=`grep -m 1 "$key" "$global_json_file"` + local pattern="\"$key\" *: *\"(.*)\"" + + if [[ ! $line =~ $pattern ]]; then + echo "Error: Cannot find \"$key\" in $global_json_file" >&2 + ExitWithExitCode 1 + fi + + # return value + _ReadGlobalVersion=${BASH_REMATCH[1]} +} + +function InitializeDotNetCli { + local install=$1 + + # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism + export DOTNET_MULTILEVEL_LOOKUP=0 + + # Disable first run since we want to control all package sources + export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + + # Source Build uses DotNetCoreSdkDir variable + if [[ -n "${DotNetCoreSdkDir:-}" ]]; then + export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" + fi + + # Find the first path on $PATH that contains the dotnet.exe + if [[ "$useInstalledDotNetCli" == true && -z "${DOTNET_INSTALL_DIR:-}" ]]; then + local dotnet_path=`command -v dotnet` + if [[ -n "$dotnet_path" ]]; then + ResolvePath "$dotnet_path" + export DOTNET_INSTALL_DIR=`dirname "$_ResolvePath"` + fi + fi + + ReadGlobalVersion "dotnet" + local dotnet_sdk_version=$_ReadGlobalVersion + local dotnet_root="" + + # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, + # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. + if [[ -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then + dotnet_root="$DOTNET_INSTALL_DIR" + else + dotnet_root="$repo_root/.dotnet" + export DOTNET_INSTALL_DIR="$dotnet_root" + + if [[ ! -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then + if [[ "$install" == true ]]; then + InstallDotNetSdk "$dotnet_root" "$dotnet_sdk_version" + else + echo "Unable to find dotnet with SDK version '$dotnet_sdk_version'" >&2 + ExitWithExitCode 1 + fi + fi + fi + + # return value + _InitializeDotNetCli="$dotnet_root" +} + +function InstallDotNetSdk { + local root=$1 + local version=$2 + + GetDotNetInstallScript "$root" + local install_script=$_GetDotNetInstallScript + + bash "$install_script" --version $version --install-dir "$root" + local lastexitcode=$? + + if [[ $lastexitcode != 0 ]]; then + echo "Failed to install dotnet SDK (exit code '$lastexitcode')." >&2 + ExitWithExitCode $lastexitcode + fi +} + +function GetDotNetInstallScript { + local root=$1 + local install_script="$root/dotnet-install.sh" + local install_script_url="https://dot.net/v1/dotnet-install.sh" + + if [[ ! -a "$install_script" ]]; then + mkdir -p "$root" + + echo "Downloading '$install_script_url'" + + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" + else + wget -q -O "$install_script" "$install_script_url" + fi + fi + + # return value + _GetDotNetInstallScript="$install_script" +} + +function InitializeToolset { + ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk" + + local toolset_version=$_ReadGlobalVersion + local toolset_location_file="$toolset_dir/$toolset_version.txt" + + if [[ -a "$toolset_location_file" ]]; then + local path=`cat "$toolset_location_file"` + if [[ -a "$path" ]]; then + toolset_build_proj="$path" + return + fi + fi + + if [[ "$restore" != true ]]; then + echo "Toolset version $toolsetVersion has not been restored." >&2 + ExitWithExitCode 2 + fi + + local toolset_restore_log="$log_dir/ToolsetRestore.binlog" + local proj="$toolset_dir/restore.proj" + + echo '' > "$proj" + + MSBuild "$proj" /t:__WriteToolsetLocation /clp:None /bl:"$toolset_restore_log" /p:__ToolsetLocationOutputFile="$toolset_location_file" + local lastexitcode=$? + + if [[ $lastexitcode != 0 ]]; then + echo "Failed to restore toolset (exit code '$lastexitcode'). See log: $toolset_restore_log" >&2 + ExitWithExitCode $lastexitcode + fi + + toolset_build_proj=`cat "$toolset_location_file"` + + if [[ ! -a "$toolset_build_proj" ]]; then + echo "Invalid toolset path: $toolset_build_proj" >&2 + ExitWithExitCode 3 + fi +} + +function InitializeCustomToolset { + local script="$eng_root/restore-toolset.sh" + + if [[ -a "$script" ]]; then + . "$script" + fi +} + +function ConfigureTools { + local script="$eng_root/configure-toolset.sh" + + if [[ -a "$script" ]]; then + . "$script" + fi +} + +function InitializeTools { + ConfigureTools + + InitializeDotNetCli $restore + build_driver="$_InitializeDotNetCli/dotnet" + + InitializeToolset + InitializeCustomToolset +} + +function ExitWithExitCode { + if [[ "$ci" == true && "$prepare_machine" == true ]]; then + StopProcesses + fi + exit $1 +} + +function StopProcesses { + echo "Killing running build processes..." + pkill -9 "dotnet" + pkill -9 "vbcscompiler" + return 0 +} + +function MSBuild { + local warnaserror_switch="" + if [[ $warnaserror == true ]]; then + warnaserror_switch="/warnaserror" + fi + + "$build_driver" msbuild /m /nologo /clp:Summary /v:$verbosity /nr:$nodereuse $warnaserror_switch "$@" + + return $? +} + +# HOME may not be defined in some scenarios, but it is required by NuGet +if [[ -z $HOME ]]; then + export HOME="$repo_root/artifacts/.home/" + mkdir -p "$HOME" +fi + +if [[ -z ${NUGET_PACKAGES:-} ]]; then + if [[ $ci == true ]]; then + export NUGET_PACKAGES="$repo_root/.packages" + else + export NUGET_PACKAGES="$HOME/.nuget/packages" + fi +fi + +mkdir -p "$toolset_dir" +mkdir -p "$log_dir" + +if [[ $ci == true ]]; then + mkdir -p "$temp_dir" + export TEMP="$temp_dir" + export TMP="$temp_dir" +fi diff --git a/global.json b/global.json index 28ba7cc7b4b6..75a675aa87f0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.8" } } \ No newline at end of file From 034ad11961a316ad51ed2b682079d1a2004a6e8b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 17 Oct 2018 02:16:54 +0000 Subject: [PATCH 0150/2702] Updating version files (#126) --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index de251828695b..4add2f029a6c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 2d27f969d21be61a75bd9e3d031ae137b0b2c346 + 286bb9ff39130ef296b9d67924fc4af9268120e1 \ No newline at end of file diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 40554a5ae5e4..734576e72041 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -8,7 +8,7 @@ $restore = if (Test-Path variable:restore) { $restore } else { $true } $verbosity = if (Test-Path variable:verbosity) { $verbosity } else { "minimal" } $warnaserror = if (Test-Path variable:warnaserror) { $warnaserror } else { $true } $msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } -$useInstalledDotNetCli = if (Test-Path variable:useInstalledCli) { $useInstalledCli } else { $true } +$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } set-strictmode -version 2.0 $ErrorActionPreference = "Stop" diff --git a/global.json b/global.json index 75a675aa87f0..0b37ee4fbea4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.10" } } \ No newline at end of file From 7783a9c1ad6e63be1eefad9644b8e4386ba16f1d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 17 Oct 2018 14:56:27 +0000 Subject: [PATCH 0151/2702] Updating version files (#127) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4add2f029a6c..fef482122f63 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 286bb9ff39130ef296b9d67924fc4af9268120e1 + 4c98b6a8754b091fbe2ee0042196f7650a0ecd4d \ No newline at end of file diff --git a/global.json b/global.json index 0b37ee4fbea4..156d4606bed7 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18517.1" } } \ No newline at end of file From 48d224beab1da6baaaa4ae6498d0aa81fe4edf0c Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Wed, 17 Oct 2018 08:59:00 -0700 Subject: [PATCH 0152/2702] Remove unused parameter - agentOs (#128) --- .vsts-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index ca6dc225855b..db76f0515d3c 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -20,7 +20,6 @@ trigger: phases: - template: /eng/common/templates/phases/base.yml parameters: - agentOs: Windows_NT name: Windows_NT enableTelemetry: $(_enableTelemetry) queue: @@ -43,7 +42,6 @@ phases: - template: /eng/common/templates/phases/base.yml parameters: - agentOs: OSX name: OSX enableTelemetry: $(_enableTelemetry) queue: @@ -66,7 +64,6 @@ phases: - template: /eng/common/templates/phases/base.yml parameters: - agentOs: Linux name: Linux enableTelemetry: $(_enableTelemetry) queue: From 45c09192b9be983b4beb4defe1d85224e7e13f67 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Wed, 17 Oct 2018 09:49:43 -0700 Subject: [PATCH 0153/2702] Rename .vsts-ci.yml to azure-pipelines.yml (#130) --- .vsts-ci.yml => azure-pipelines.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .vsts-ci.yml => azure-pipelines.yml (100%) diff --git a/.vsts-ci.yml b/azure-pipelines.yml similarity index 100% rename from .vsts-ci.yml rename to azure-pipelines.yml From 5a5224a8db5103caa407ad5722a38dee254897fa Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Thu, 18 Oct 2018 20:44:08 -0700 Subject: [PATCH 0154/2702] publish artifacts for ci builds (#132) --- azure-pipelines.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index db76f0515d3c..18c02c90d621 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -37,6 +37,14 @@ phases: name: Build displayName: Build condition: succeeded() + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_$(Agent.JobName) + continueOnError: true + condition: always() variables: _HelixBuildConfig: $(_BuildConfig) @@ -59,6 +67,14 @@ phases: name: Build displayName: Build condition: succeeded() + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_$(Agent.JobName) + continueOnError: true + condition: always() variables: _HelixBuildConfig: $(_BuildConfig) @@ -82,5 +98,13 @@ phases: name: Build displayName: Build condition: succeeded() + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_$(Agent.JobName) + continueOnError: true + condition: always() variables: _HelixBuildConfig: $(_BuildConfig) From a690078097e1aaeee52a764b50dbafd5beb724ca Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Fri, 19 Oct 2018 08:49:07 -0700 Subject: [PATCH 0155/2702] Update darc-init.ps1 --- eng/common/darc-init.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 8d7b143f2efe..b48b9940120d 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -3,7 +3,7 @@ $verbosity = "m" function InstallDarcCli { $darcCliPackageName = "microsoft.dotnet.darc" - $dotnet = $env:DOTNET_INSTALL_DIR + $dotnet = $env:DOTNET_INSTALL_DIR\dotnet.exe $toolList = Invoke-Expression "$dotnet tool list -g" if ($toolList -like "*$darcCliPackageName*") { From 697d6dd73594e916bbec1f360bb728e8c9b5b348 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Fri, 19 Oct 2018 08:51:41 -0700 Subject: [PATCH 0156/2702] Update darc-init.ps1 --- eng/common/darc-init.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index b48b9940120d..d50dbbe02494 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -3,7 +3,7 @@ $verbosity = "m" function InstallDarcCli { $darcCliPackageName = "microsoft.dotnet.darc" - $dotnet = $env:DOTNET_INSTALL_DIR\dotnet.exe + $dotnet = "$env:DOTNET_INSTALL_DIR\dotnet.exe" $toolList = Invoke-Expression "$dotnet tool list -g" if ($toolList -like "*$darcCliPackageName*") { From 6a0dc0865ffe7242ece8c4cb98d578ba7f7267ac Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Fri, 19 Oct 2018 13:24:06 -0700 Subject: [PATCH 0157/2702] Rename NuGet.Config to NuGet.config (#133) --- NuGet.Config => NuGet.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename NuGet.Config => NuGet.config (95%) diff --git a/NuGet.Config b/NuGet.config similarity index 95% rename from NuGet.Config rename to NuGet.config index 7fa789a1df1d..147ecfda1f0f 100644 --- a/NuGet.Config +++ b/NuGet.config @@ -6,4 +6,4 @@ - \ No newline at end of file + From a311db0939df9331830c82486c10218ffc974a13 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 19 Oct 2018 21:46:48 +0000 Subject: [PATCH 0158/2702] [Darc-Update] Update dependencies from build 20181019.7 of https://github.com/dotnet/arcade (#129) * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- eng/common/templates/phases/publish-build-assets.yml | 2 +- eng/common/templates/steps/helix-publish.yml | 4 +++- global.json | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fef482122f63..d8c41498c2e5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 4c98b6a8754b091fbe2ee0042196f7650a0ecd4d + 850bc9fe3cf335eb54c1fe57ed20b54d2ba46d09 \ No newline at end of file diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml index 00072fe0de0a..194b91aad719 100644 --- a/eng/common/templates/phases/publish-build-assets.yml +++ b/eng/common/templates/phases/publish-build-assets.yml @@ -11,7 +11,7 @@ phases: - task: DownloadBuildArtifacts@0 displayName: Download artifact inputs: - artifactName: AssetManifests + artifactName: AssetManifests downloadPath: '$(Build.StagingDirectory)/Download' condition: succeeded() - task: AzureKeyVault@1 diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml index 6e89d07e414d..3a046c05d83b 100644 --- a/eng/common/templates/steps/helix-publish.yml +++ b/eng/common/templates/steps/helix-publish.yml @@ -8,6 +8,7 @@ parameters: HelixPostCommands: '' WorkItemDirectory: '' WorkItemCommand: '' + IncludeDotNetSdk: false EnableXUnitReporter: false WaitForWorkItemCompletion: true @@ -18,7 +19,7 @@ steps: projects: eng/common/helixpublish.proj custom: msbuild arguments: '/t:test /p:Language=msbuild' - displayName: Send tests job to Helix + displayName: Send job to Helix env: HelixSource: ${{ parameters.HelixSource }} HelixType: ${{ parameters.HelixType }} @@ -27,6 +28,7 @@ steps: HelixAccessToken: ${{ parameters.HelixAccessToken }} HelixPreCommands: ${{ parameters.HelixPreCommands }} HelixPostCommands: ${{ parameters.HelixPostCommands }} + IncludeDotNetSdk: ${{ parameters.IncludeDotNetSdk }} EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} WorkItemDirectory: ${{ parameters.WorkItemDirectory }} diff --git a/global.json b/global.json index 156d4606bed7..c233376e63ee 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18517.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18519.7" } } \ No newline at end of file From 23cdbf8d1b8b5a406ceb491c91c6effc99b761b3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 20 Oct 2018 02:33:52 +0000 Subject: [PATCH 0159/2702] Updating version files (#134) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d8c41498c2e5..73bf6225a09e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 850bc9fe3cf335eb54c1fe57ed20b54d2ba46d09 + 79bb729e1447a75e5b59bf7184e324db41b3f02e \ No newline at end of file diff --git a/global.json b/global.json index c233376e63ee..ef6ecf8ed64e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18519.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18519.9" } } \ No newline at end of file From 45335d14db4bd34af4eeab7dd05541a4c6c60b9c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 20 Oct 2018 13:09:38 +0000 Subject: [PATCH 0160/2702] Updating version files (#135) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 73bf6225a09e..8985d6ca5f59 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 79bb729e1447a75e5b59bf7184e324db41b3f02e + 518da700456e1766c69bbfeb24ae104b8fe2cd62 \ No newline at end of file diff --git a/global.json b/global.json index ef6ecf8ed64e..930df4881e40 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18519.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18520.1" } } \ No newline at end of file From e18c5f703ba499cc22cecaab2cf05fa5bf186eb5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 20 Oct 2018 18:19:31 +0000 Subject: [PATCH 0161/2702] Updating version files (#136) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8985d6ca5f59..06d6489a4d0b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 518da700456e1766c69bbfeb24ae104b8fe2cd62 + e9a3746700b37823b76f6ea15667c3a7254406ef \ No newline at end of file diff --git a/global.json b/global.json index 930df4881e40..b59618130ada 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18520.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18520.2" } } \ No newline at end of file From a674e063c4a92beb8399f4e1851d1c27df08580a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 20 Oct 2018 18:48:35 +0000 Subject: [PATCH 0162/2702] Updating version files (#137) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 06d6489a4d0b..9f3f1b336eaa 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e9a3746700b37823b76f6ea15667c3a7254406ef + 28ab2831caea5cf95ab43e7f4ec76aeac081ac9f \ No newline at end of file diff --git a/global.json b/global.json index b59618130ada..018d1f4e0335 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18520.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18520.3" } } \ No newline at end of file From ecec67bf460aa793f53329f6c5cf729c844be661 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 21 Oct 2018 13:00:59 +0000 Subject: [PATCH 0163/2702] Updating version files (#138) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9f3f1b336eaa..eb9329a76565 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 28ab2831caea5cf95ab43e7f4ec76aeac081ac9f + 311a3dd39ffda7f394aac7be32f6d3ffa2646086 \ No newline at end of file diff --git a/global.json b/global.json index 018d1f4e0335..f2c6193cb3b9 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18520.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18521.1" } } \ No newline at end of file From 2b152641d88a971fcc6a24919fef2a3f03a40389 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 22 Oct 2018 22:04:58 +0000 Subject: [PATCH 0164/2702] [Darc-Update] Update dependencies from build 20181022.4 of https://github.com/dotnet/arcade (#139) * Updating version files * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- .../templates/phases/publish-build-assets.yml | 16 +++++++++++++--- global.json | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index eb9329a76565..d04fc4059ad3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 311a3dd39ffda7f394aac7be32f6d3ffa2646086 + ad4e7d02c4d2a20fbb5d3e79e33d24381412aa94 \ No newline at end of file diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml index 194b91aad719..08f4949cb135 100644 --- a/eng/common/templates/phases/publish-build-assets.yml +++ b/eng/common/templates/phases/publish-build-assets.yml @@ -1,11 +1,16 @@ parameters: dependsOn: '' queue: {} + configuration: 'Debug' + condition: succeeded() + continueOnError: false phases: - phase: Asset_Registry_Publish displayName: Publish to Build Asset Registry dependsOn: ${{ parameters.dependsOn }} queue: ${{ parameters.queue }} + variables: + config: ${{ parameters.configuration }} steps: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: DownloadBuildArtifacts@0 @@ -13,15 +18,20 @@ phases: inputs: artifactName: AssetManifests downloadPath: '$(Build.StagingDirectory)/Download' - condition: succeeded() + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} - task: AzureKeyVault@1 inputs: azureSubscription: 'DotNet-Engineering-Services_KeyVault' KeyVaultName: EngKeyVault SecretsFilter: 'MaestroAccessToken' - condition: succeeded() + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} - script: eng\common\publishbuildassets.cmd /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com - displayName: Publish Build Assets \ No newline at end of file + /p:Configuration=$(config) + displayName: Publish Build Assets + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} diff --git a/global.json b/global.json index f2c6193cb3b9..c47adb7177f0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18521.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18522.4" } } \ No newline at end of file From 65fcefdb33c9ab21defdb713c60cd5ddd09e2460 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 23 Oct 2018 00:26:59 +0000 Subject: [PATCH 0165/2702] [Darc-Update] Update dependencies from build 20181022.6 of https://github.com/dotnet/arcade (#140) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- eng/common/templates/steps/helix-publish.yml | 12 ++++++++---- global.json | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d04fc4059ad3..c0e38c1295b5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ad4e7d02c4d2a20fbb5d3e79e33d24381412aa94 + dd701110d79bb60c84a141ab9017320ed2df0b41 \ No newline at end of file diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml index 3a046c05d83b..d09cac238f3b 100644 --- a/eng/common/templates/steps/helix-publish.yml +++ b/eng/common/templates/steps/helix-publish.yml @@ -8,7 +8,9 @@ parameters: HelixPostCommands: '' WorkItemDirectory: '' WorkItemCommand: '' - IncludeDotNetSdk: false + IncludeDotNetCli: false + DotNetCliPackageType: '' + DotNetCliVersion: '' EnableXUnitReporter: false WaitForWorkItemCompletion: true @@ -28,8 +30,10 @@ steps: HelixAccessToken: ${{ parameters.HelixAccessToken }} HelixPreCommands: ${{ parameters.HelixPreCommands }} HelixPostCommands: ${{ parameters.HelixPostCommands }} - IncludeDotNetSdk: ${{ parameters.IncludeDotNetSdk }} - EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} WorkItemDirectory: ${{ parameters.WorkItemDirectory }} WorkItemCommand: ${{ parameters.WorkItemCommand }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} diff --git a/global.json b/global.json index c47adb7177f0..afa291aa75c8 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18522.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18522.6" } } \ No newline at end of file From a5bbf18c99fbc9fa046c9424ffc9acad5302c55d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 23 Oct 2018 17:33:18 +0000 Subject: [PATCH 0166/2702] [Darc-Update] Update dependencies from build 20181023.3 of https://github.com/dotnet/arcade (#141) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c0e38c1295b5..64c25d4e212a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - dd701110d79bb60c84a141ab9017320ed2df0b41 + 303ce96504a1659dcdad5f9a667de18ead9a1a79 \ No newline at end of file diff --git a/global.json b/global.json index afa291aa75c8..0cc06983a97d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18522.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.3" } } \ No newline at end of file From edfacf724761597fcb988e7936d1f678dbaff2ff Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 23 Oct 2018 21:52:39 +0000 Subject: [PATCH 0167/2702] [Darc-Update] Update dependencies from build 20181023.8 of https://github.com/dotnet/arcade (#142) * Updating version files * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- eng/common/darc-init.ps1 | 6 +++--- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 64c25d4e212a..c7b724eeaffd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 303ce96504a1659dcdad5f9a667de18ead9a1a79 + ced04b5bb12a34067fd9b138de8240f4a08a6cb3 \ No newline at end of file diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index d50dbbe02494..af182d8f8410 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -4,17 +4,17 @@ $verbosity = "m" function InstallDarcCli { $darcCliPackageName = "microsoft.dotnet.darc" $dotnet = "$env:DOTNET_INSTALL_DIR\dotnet.exe" - $toolList = Invoke-Expression "$dotnet tool list -g" + $toolList = Invoke-Expression "& `"$dotnet`" tool list -g" if ($toolList -like "*$darcCliPackageName*") { - Invoke-Expression "$dotnet tool uninstall $darcCliPackageName -g" + Invoke-Expression "& `"$dotnet`" tool uninstall $darcCliPackageName -g" } $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' Write-Host "Installing Darc CLI version $toolsetVersion..." Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - Invoke-Expression "$dotnet tool install $darcCliPackageName --version $toolsetVersion -v $verbosity -g" + Invoke-Expression "& `"$dotnet`" tool install $darcCliPackageName --version $toolsetVersion -v $verbosity -g" } InitializeTools diff --git a/global.json b/global.json index 0cc06983a97d..1a1baab9b35f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.8" } } \ No newline at end of file From c4a9106eb3fe0612b27606746ecac269f8e17fc7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 23 Oct 2018 22:26:51 +0000 Subject: [PATCH 0168/2702] Updating version files (#146) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c7b724eeaffd..92d1034ca8fe 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ced04b5bb12a34067fd9b138de8240f4a08a6cb3 + 7b133b70203d6047192bdfc5c89e172920a890b0 \ No newline at end of file diff --git a/global.json b/global.json index 1a1baab9b35f..d7cc909f3354 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.9" } } \ No newline at end of file From 3baec53a31cf9ef0d4bb135713d6fe84f8404e30 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 23 Oct 2018 23:01:03 +0000 Subject: [PATCH 0169/2702] Updating version files (#147) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 92d1034ca8fe..b736bba224ad 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 7b133b70203d6047192bdfc5c89e172920a890b0 + 30492b38b22ed7199f40a9322c85ee35ad667396 \ No newline at end of file diff --git a/global.json b/global.json index d7cc909f3354..4a7da4e3eab0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.10" } } \ No newline at end of file From 70db7bde1c5d423afc184b04fb5b1a7b0b6ca041 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 23 Oct 2018 23:54:13 +0000 Subject: [PATCH 0170/2702] Updating version files (#148) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b736bba224ad..a25636598f46 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 30492b38b22ed7199f40a9322c85ee35ad667396 + 331664ed38d3cacefb1c57d250b21ada2b1e1004 \ No newline at end of file diff --git a/global.json b/global.json index 4a7da4e3eab0..039bfb9e9d12 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.11" } } \ No newline at end of file From 7610282a4453a28e58ba0a668e84dd1619d7965a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 24 Oct 2018 00:22:31 +0000 Subject: [PATCH 0171/2702] Updating version files (#149) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a25636598f46..c669588da44b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 331664ed38d3cacefb1c57d250b21ada2b1e1004 + ab60f3745e84b9e8813e386c079af2e0535a0d0a \ No newline at end of file diff --git a/global.json b/global.json index 039bfb9e9d12..4055af29433d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.11" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.12" } } \ No newline at end of file From af70fe28def11f2726bd8871084c7de8215ddbd1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 24 Oct 2018 01:22:31 +0000 Subject: [PATCH 0172/2702] Updating version files (#151) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c669588da44b..db899f9030e5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ab60f3745e84b9e8813e386c079af2e0535a0d0a + beb04fa9474ba68d0ce0cb309d7a3cf7572a5f9d \ No newline at end of file diff --git a/global.json b/global.json index 4055af29433d..267fa990e105 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.12" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.13" } } \ No newline at end of file From 3a85e8b355da19b2966f03392aa9af2bd35db12a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 24 Oct 2018 13:11:27 +0000 Subject: [PATCH 0173/2702] Updating version files (#152) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index db899f9030e5..1927efcb32cd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - beb04fa9474ba68d0ce0cb309d7a3cf7572a5f9d + d2bdeefea5e012742b4f9f232bfa8cfffa12a0c5 \ No newline at end of file diff --git a/global.json b/global.json index 267fa990e105..c8e96a0289cb 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18523.13" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.1" } } \ No newline at end of file From 7c56df71b7a90fed6405cc08fb39170d50f5a868 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 24 Oct 2018 18:42:52 +0000 Subject: [PATCH 0174/2702] Updating version files (#154) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1927efcb32cd..bd32019b5f22 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d2bdeefea5e012742b4f9f232bfa8cfffa12a0c5 + 3a7fcc13dfa3b3a34f55b9bd4356f9825a0009e4 \ No newline at end of file diff --git a/global.json b/global.json index c8e96a0289cb..ee83fc0af717 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.2" } } \ No newline at end of file From 4bf72b0785f82b1405d7e7496244a8bee2c4fbac Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 24 Oct 2018 22:00:48 +0000 Subject: [PATCH 0175/2702] Updating version files (#155) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bd32019b5f22..a3e412423d2e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3a7fcc13dfa3b3a34f55b9bd4356f9825a0009e4 + a9d36d38c376aaf8f8255377bae228301b1aa1e2 \ No newline at end of file diff --git a/global.json b/global.json index ee83fc0af717..d4718223fb1b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.3" } } \ No newline at end of file From 092274be36a86cf6c157152ceeaacd24983c9455 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 24 Oct 2018 22:34:19 +0000 Subject: [PATCH 0176/2702] Updating version files (#156) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a3e412423d2e..0aa905227e3c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - a9d36d38c376aaf8f8255377bae228301b1aa1e2 + b8661a75aa0c2309c2f264df21e0c4edbb5d851a \ No newline at end of file diff --git a/global.json b/global.json index d4718223fb1b..4bb79598bef9 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.4" } } \ No newline at end of file From d37eafc466ee5c85a96c16c0ee270ce3aecbfd85 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 25 Oct 2018 01:09:14 +0000 Subject: [PATCH 0177/2702] Updating version files (#157) --- eng/Version.Details.xml | 4 +- eng/common/cross/.gitmirrorall | 1 + eng/common/cross/android/arm/toolchain.cmake | 41 ++++ .../cross/android/arm64/toolchain.cmake | 42 ++++ eng/common/cross/arm/sources.list.bionic | 11 + eng/common/cross/arm/sources.list.jessie | 3 + eng/common/cross/arm/sources.list.trusty | 11 + eng/common/cross/arm/sources.list.vivid | 11 + eng/common/cross/arm/sources.list.wily | 11 + eng/common/cross/arm/sources.list.xenial | 11 + eng/common/cross/arm/sources.list.zesty | 11 + eng/common/cross/arm/trusty-lttng-2.4.patch | 71 ++++++ eng/common/cross/arm/trusty.patch | 97 ++++++++ eng/common/cross/arm64/sources.list.bionic | 11 + eng/common/cross/arm64/sources.list.trusty | 11 + eng/common/cross/arm64/sources.list.vivid | 11 + eng/common/cross/arm64/sources.list.wily | 11 + eng/common/cross/arm64/sources.list.xenial | 11 + eng/common/cross/arm64/sources.list.zesty | 11 + eng/common/cross/armel/sources.list.jessie | 3 + eng/common/cross/armel/tizen-build-rootfs.sh | 44 ++++ eng/common/cross/armel/tizen-fetch.sh | 171 ++++++++++++++ eng/common/cross/armel/tizen/tizen-dotnet.ks | 50 +++++ eng/common/cross/armel/tizen/tizen.patch | 18 ++ eng/common/cross/build-android-rootfs.sh | 137 ++++++++++++ eng/common/cross/build-rootfs.sh | 210 ++++++++++++++++++ eng/common/cross/toolchain.cmake | 138 ++++++++++++ global.json | 2 +- 28 files changed, 1161 insertions(+), 3 deletions(-) create mode 100644 eng/common/cross/.gitmirrorall create mode 100644 eng/common/cross/android/arm/toolchain.cmake create mode 100644 eng/common/cross/android/arm64/toolchain.cmake create mode 100644 eng/common/cross/arm/sources.list.bionic create mode 100644 eng/common/cross/arm/sources.list.jessie create mode 100644 eng/common/cross/arm/sources.list.trusty create mode 100644 eng/common/cross/arm/sources.list.vivid create mode 100644 eng/common/cross/arm/sources.list.wily create mode 100644 eng/common/cross/arm/sources.list.xenial create mode 100644 eng/common/cross/arm/sources.list.zesty create mode 100644 eng/common/cross/arm/trusty-lttng-2.4.patch create mode 100644 eng/common/cross/arm/trusty.patch create mode 100644 eng/common/cross/arm64/sources.list.bionic create mode 100644 eng/common/cross/arm64/sources.list.trusty create mode 100644 eng/common/cross/arm64/sources.list.vivid create mode 100644 eng/common/cross/arm64/sources.list.wily create mode 100644 eng/common/cross/arm64/sources.list.xenial create mode 100644 eng/common/cross/arm64/sources.list.zesty create mode 100644 eng/common/cross/armel/sources.list.jessie create mode 100644 eng/common/cross/armel/tizen-build-rootfs.sh create mode 100644 eng/common/cross/armel/tizen-fetch.sh create mode 100644 eng/common/cross/armel/tizen/tizen-dotnet.ks create mode 100644 eng/common/cross/armel/tizen/tizen.patch create mode 100644 eng/common/cross/build-android-rootfs.sh create mode 100644 eng/common/cross/build-rootfs.sh create mode 100644 eng/common/cross/toolchain.cmake diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0aa905227e3c..a4b291a57c7d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b8661a75aa0c2309c2f264df21e0c4edbb5d851a + bc0acaacd5d6c18e4b28cb3cf1754626be4a8c71 \ No newline at end of file diff --git a/eng/common/cross/.gitmirrorall b/eng/common/cross/.gitmirrorall new file mode 100644 index 000000000000..9ee5c57b9917 --- /dev/null +++ b/eng/common/cross/.gitmirrorall @@ -0,0 +1 @@ +This folder will be mirrored by the Git-TFS Mirror recursively. \ No newline at end of file diff --git a/eng/common/cross/android/arm/toolchain.cmake b/eng/common/cross/android/arm/toolchain.cmake new file mode 100644 index 000000000000..a7e1c73501b3 --- /dev/null +++ b/eng/common/cross/android/arm/toolchain.cmake @@ -0,0 +1,41 @@ +set(CROSS_NDK_TOOLCHAIN $ENV{ROOTFS_DIR}/../) +set(CROSS_ROOTFS ${CROSS_NDK_TOOLCHAIN}/sysroot) +set(CLR_CMAKE_PLATFORM_ANDROID "Android") + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR arm) + +## Specify the toolchain +set(TOOLCHAIN "arm-linux-androideabi") +set(CMAKE_PREFIX_PATH ${CROSS_NDK_TOOLCHAIN}) +set(TOOLCHAIN_PREFIX ${TOOLCHAIN}-) + +find_program(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}clang) +find_program(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}clang++) +find_program(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}clang) +find_program(CMAKE_AR ${TOOLCHAIN_PREFIX}ar) +find_program(CMAKE_LD ${TOOLCHAIN_PREFIX}ar) +find_program(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy) +find_program(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}objdump) + +add_compile_options(--sysroot=${CROSS_ROOTFS}) +add_compile_options(-fPIE) +add_compile_options(-mfloat-abi=soft) +include_directories(SYSTEM ${CROSS_NDK_TOOLCHAIN}/include/c++/4.9.x/) +include_directories(SYSTEM ${CROSS_NDK_TOOLCHAIN}/include/c++/4.9.x/arm-linux-androideabi/) + +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/${TOOLCHAIN}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -fPIE -pie") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) + +set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/eng/common/cross/android/arm64/toolchain.cmake b/eng/common/cross/android/arm64/toolchain.cmake new file mode 100644 index 000000000000..29415899c1c6 --- /dev/null +++ b/eng/common/cross/android/arm64/toolchain.cmake @@ -0,0 +1,42 @@ +set(CROSS_NDK_TOOLCHAIN $ENV{ROOTFS_DIR}/../) +set(CROSS_ROOTFS ${CROSS_NDK_TOOLCHAIN}/sysroot) +set(CLR_CMAKE_PLATFORM_ANDROID "Android") + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +## Specify the toolchain +set(TOOLCHAIN "aarch64-linux-android") +set(CMAKE_PREFIX_PATH ${CROSS_NDK_TOOLCHAIN}) +set(TOOLCHAIN_PREFIX ${TOOLCHAIN}-) + +find_program(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}clang) +find_program(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}clang++) +find_program(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}clang) +find_program(CMAKE_AR ${TOOLCHAIN_PREFIX}ar) +find_program(CMAKE_LD ${TOOLCHAIN_PREFIX}ar) +find_program(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy) +find_program(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}objdump) + +add_compile_options(--sysroot=${CROSS_ROOTFS}) +add_compile_options(-fPIE) + +## Needed for Android or bionic specific conditionals +add_compile_options(-D__ANDROID__) +add_compile_options(-D__BIONIC__) + +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/${TOOLCHAIN}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}") +set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -fPIE -pie") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE) + +set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/eng/common/cross/arm/sources.list.bionic b/eng/common/cross/arm/sources.list.bionic new file mode 100644 index 000000000000..210955740957 --- /dev/null +++ b/eng/common/cross/arm/sources.list.bionic @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.jessie b/eng/common/cross/arm/sources.list.jessie new file mode 100644 index 000000000000..4d142ac9b108 --- /dev/null +++ b/eng/common/cross/arm/sources.list.jessie @@ -0,0 +1,3 @@ +# Debian (sid) # UNSTABLE +deb http://ftp.debian.org/debian/ sid main contrib non-free +deb-src http://ftp.debian.org/debian/ sid main contrib non-free diff --git a/eng/common/cross/arm/sources.list.trusty b/eng/common/cross/arm/sources.list.trusty new file mode 100644 index 000000000000..07d8f88d82e8 --- /dev/null +++ b/eng/common/cross/arm/sources.list.trusty @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.vivid b/eng/common/cross/arm/sources.list.vivid new file mode 100644 index 000000000000..0b1215e475ac --- /dev/null +++ b/eng/common/cross/arm/sources.list.vivid @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ vivid main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.wily b/eng/common/cross/arm/sources.list.wily new file mode 100644 index 000000000000..e23d1e02a05d --- /dev/null +++ b/eng/common/cross/arm/sources.list.wily @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ wily main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.xenial b/eng/common/cross/arm/sources.list.xenial new file mode 100644 index 000000000000..eacd86b7df3c --- /dev/null +++ b/eng/common/cross/arm/sources.list.xenial @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/sources.list.zesty b/eng/common/cross/arm/sources.list.zesty new file mode 100644 index 000000000000..ea2c14a78747 --- /dev/null +++ b/eng/common/cross/arm/sources.list.zesty @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/arm/trusty-lttng-2.4.patch b/eng/common/cross/arm/trusty-lttng-2.4.patch new file mode 100644 index 000000000000..8e4dd7ae7191 --- /dev/null +++ b/eng/common/cross/arm/trusty-lttng-2.4.patch @@ -0,0 +1,71 @@ +From e72c9d7ead60e3317bd6d1fade995c07021c947b Mon Sep 17 00:00:00 2001 +From: Mathieu Desnoyers +Date: Thu, 7 May 2015 13:25:04 -0400 +Subject: [PATCH] Fix: building probe providers with C++ compiler + +Robert Daniels wrote: +> > I'm attempting to use lttng userspace tracing with a C++ application +> > on an ARM platform. I'm using GCC 4.8.4 on Linux 3.14 with the 2.6 +> > release of lttng. I've compiled lttng-modules, lttng-ust, and +> > lttng-tools and have been able to get a simple test working with C +> > code. When I attempt to run the hello.cxx test on my target it will +> > segfault. +> +> +> I spent a little time digging into this issue and finally discovered the +> cause of my segfault with ARM C++ tracepoints. +> +> There is a struct called 'lttng_event' in ust-events.h which contains an +> empty union 'u'. This was the cause of my issue. Under C, this empty union +> compiles to a zero byte member while under C++ it compiles to a one byte +> member, and in my case was four-byte aligned which caused my C++ code to +> have the 'cds_list_head node' offset incorrectly by four bytes. This lead +> to an incorrect linked list structure which caused my issue. +> +> Since this union is empty, I simply removed it from the struct and everything +> worked correctly. +> +> I don't know the history or purpose behind this empty union so I'd like to +> know if this is a safe fix. If it is I can submit a patch with the union +> removed. + +That's a very nice catch! + +We do not support building tracepoint probe provider with +g++ yet, as stated in lttng-ust(3): + +"- Note for C++ support: although an application instrumented with + tracepoints can be compiled with g++, tracepoint probes should be + compiled with gcc (only tested with gcc so far)." + +However, if it works fine with this fix, then I'm tempted to take it, +especially because removing the empty union does not appear to affect +the layout of struct lttng_event as seen from liblttng-ust, which must +be compiled with a C compiler, and from probe providers compiled with +a C compiler. So all we are changing is the layout of a probe provider +compiled with a C++ compiler, which is anyway buggy at the moment, +because it is not compatible with the layout expected by liblttng-ust +compiled with a C compiler. + +Reported-by: Robert Daniels +Signed-off-by: Mathieu Desnoyers +--- + include/lttng/ust-events.h | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/usr/include/lttng/ust-events.h b/usr/include/lttng/ust-events.h +index 328a875..3d7a274 100644 +--- a/usr/include/lttng/ust-events.h ++++ b/usr/include/lttng/ust-events.h +@@ -407,8 +407,6 @@ struct lttng_event { + void *_deprecated1; + struct lttng_ctx *ctx; + enum lttng_ust_instrumentation instrumentation; +- union { +- } u; + struct cds_list_head node; /* Event list in session */ + struct cds_list_head _deprecated2; + void *_deprecated3; +-- +2.7.4 + diff --git a/eng/common/cross/arm/trusty.patch b/eng/common/cross/arm/trusty.patch new file mode 100644 index 000000000000..2f2972f8eb59 --- /dev/null +++ b/eng/common/cross/arm/trusty.patch @@ -0,0 +1,97 @@ +diff -u -r a/usr/include/urcu/uatomic/generic.h b/usr/include/urcu/uatomic/generic.h +--- a/usr/include/urcu/uatomic/generic.h 2014-03-28 06:04:42.000000000 +0900 ++++ b/usr/include/urcu/uatomic/generic.h 2017-02-13 10:35:21.189927116 +0900 +@@ -65,17 +65,17 @@ + switch (len) { + #ifdef UATOMIC_HAS_ATOMIC_BYTE + case 1: +- return __sync_val_compare_and_swap_1(addr, old, _new); ++ return __sync_val_compare_and_swap_1((uint8_t *) addr, old, _new); + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- return __sync_val_compare_and_swap_2(addr, old, _new); ++ return __sync_val_compare_and_swap_2((uint16_t *) addr, old, _new); + #endif + case 4: +- return __sync_val_compare_and_swap_4(addr, old, _new); ++ return __sync_val_compare_and_swap_4((uint32_t *) addr, old, _new); + #if (CAA_BITS_PER_LONG == 64) + case 8: +- return __sync_val_compare_and_swap_8(addr, old, _new); ++ return __sync_val_compare_and_swap_8((uint64_t *) addr, old, _new); + #endif + } + _uatomic_link_error(); +@@ -100,20 +100,20 @@ + switch (len) { + #ifdef UATOMIC_HAS_ATOMIC_BYTE + case 1: +- __sync_and_and_fetch_1(addr, val); ++ __sync_and_and_fetch_1((uint8_t *) addr, val); + return; + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- __sync_and_and_fetch_2(addr, val); ++ __sync_and_and_fetch_2((uint16_t *) addr, val); + return; + #endif + case 4: +- __sync_and_and_fetch_4(addr, val); ++ __sync_and_and_fetch_4((uint32_t *) addr, val); + return; + #if (CAA_BITS_PER_LONG == 64) + case 8: +- __sync_and_and_fetch_8(addr, val); ++ __sync_and_and_fetch_8((uint64_t *) addr, val); + return; + #endif + } +@@ -139,20 +139,20 @@ + switch (len) { + #ifdef UATOMIC_HAS_ATOMIC_BYTE + case 1: +- __sync_or_and_fetch_1(addr, val); ++ __sync_or_and_fetch_1((uint8_t *) addr, val); + return; + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- __sync_or_and_fetch_2(addr, val); ++ __sync_or_and_fetch_2((uint16_t *) addr, val); + return; + #endif + case 4: +- __sync_or_and_fetch_4(addr, val); ++ __sync_or_and_fetch_4((uint32_t *) addr, val); + return; + #if (CAA_BITS_PER_LONG == 64) + case 8: +- __sync_or_and_fetch_8(addr, val); ++ __sync_or_and_fetch_8((uint64_t *) addr, val); + return; + #endif + } +@@ -180,17 +180,17 @@ + switch (len) { + #ifdef UATOMIC_HAS_ATOMIC_BYTE + case 1: +- return __sync_add_and_fetch_1(addr, val); ++ return __sync_add_and_fetch_1((uint8_t *) addr, val); + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- return __sync_add_and_fetch_2(addr, val); ++ return __sync_add_and_fetch_2((uint16_t *) addr, val); + #endif + case 4: +- return __sync_add_and_fetch_4(addr, val); ++ return __sync_add_and_fetch_4((uint32_t *) addr, val); + #if (CAA_BITS_PER_LONG == 64) + case 8: +- return __sync_add_and_fetch_8(addr, val); ++ return __sync_add_and_fetch_8((uint64_t *) addr, val); + #endif + } + _uatomic_link_error(); diff --git a/eng/common/cross/arm64/sources.list.bionic b/eng/common/cross/arm64/sources.list.bionic new file mode 100644 index 000000000000..210955740957 --- /dev/null +++ b/eng/common/cross/arm64/sources.list.bionic @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.trusty b/eng/common/cross/arm64/sources.list.trusty new file mode 100644 index 000000000000..07d8f88d82e8 --- /dev/null +++ b/eng/common/cross/arm64/sources.list.trusty @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.vivid b/eng/common/cross/arm64/sources.list.vivid new file mode 100644 index 000000000000..0b1215e475ac --- /dev/null +++ b/eng/common/cross/arm64/sources.list.vivid @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ vivid main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ vivid-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ vivid-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.wily b/eng/common/cross/arm64/sources.list.wily new file mode 100644 index 000000000000..e23d1e02a05d --- /dev/null +++ b/eng/common/cross/arm64/sources.list.wily @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ wily main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ wily-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ wily-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.xenial b/eng/common/cross/arm64/sources.list.xenial new file mode 100644 index 000000000000..eacd86b7df3c --- /dev/null +++ b/eng/common/cross/arm64/sources.list.xenial @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm64/sources.list.zesty b/eng/common/cross/arm64/sources.list.zesty new file mode 100644 index 000000000000..ea2c14a78747 --- /dev/null +++ b/eng/common/cross/arm64/sources.list.zesty @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/armel/sources.list.jessie b/eng/common/cross/armel/sources.list.jessie new file mode 100644 index 000000000000..3d9c3059d897 --- /dev/null +++ b/eng/common/cross/armel/sources.list.jessie @@ -0,0 +1,3 @@ +# Debian (jessie) # Stable +deb http://ftp.debian.org/debian/ jessie main contrib non-free +deb-src http://ftp.debian.org/debian/ jessie main contrib non-free diff --git a/eng/common/cross/armel/tizen-build-rootfs.sh b/eng/common/cross/armel/tizen-build-rootfs.sh new file mode 100644 index 000000000000..87c48e78fbb4 --- /dev/null +++ b/eng/common/cross/armel/tizen-build-rootfs.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -e + +__ARM_SOFTFP_CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +__TIZEN_CROSSDIR="$__ARM_SOFTFP_CrossDir/tizen" + +if [[ -z "$ROOTFS_DIR" ]]; then + echo "ROOTFS_DIR is not defined." + exit 1; +fi + +# Clean-up (TODO-Cleanup: We may already delete $ROOTFS_DIR at ./cross/build-rootfs.sh.) +# hk0110 +if [ -d "$ROOTFS_DIR" ]; then + umount $ROOTFS_DIR/* + rm -rf $ROOTFS_DIR +fi + +TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp +mkdir -p $TIZEN_TMP_DIR + +# Download files +echo ">>Start downloading files" +VERBOSE=1 $__ARM_SOFTFP_CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR +echo "<>Start constructing Tizen rootfs" +TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm` +cd $ROOTFS_DIR +for f in $TIZEN_RPM_FILES; do + rpm2cpio $f | cpio -idm --quiet +done +echo "<>Start configuring Tizen rootfs" +rm ./usr/lib/libunwind.so +ln -s libunwind.so.8 ./usr/lib/libunwind.so +ln -sfn asm-arm ./usr/include/asm +patch -p1 < $__TIZEN_CROSSDIR/tizen.patch +echo "</dev/null; then + VERBOSE=0 +fi + +Log() +{ + if [ $VERBOSE -ge $1 ]; then + echo ${@:2} + fi +} + +Inform() +{ + Log 1 -e "\x1B[0;34m$@\x1B[m" +} + +Debug() +{ + Log 2 -e "\x1B[0;32m$@\x1B[m" +} + +Error() +{ + >&2 Log 0 -e "\x1B[0;31m$@\x1B[m" +} + +Fetch() +{ + URL=$1 + FILE=$2 + PROGRESS=$3 + if [ $VERBOSE -ge 1 ] && [ $PROGRESS ]; then + CURL_OPT="--progress-bar" + else + CURL_OPT="--silent" + fi + curl $CURL_OPT $URL > $FILE +} + +hash curl 2> /dev/null || { Error "Require 'curl' Aborting."; exit 1; } +hash xmllint 2> /dev/null || { Error "Require 'xmllint' Aborting."; exit 1; } +hash sha256sum 2> /dev/null || { Error "Require 'sha256sum' Aborting."; exit 1; } + +TMPDIR=$1 +if [ ! -d $TMPDIR ]; then + TMPDIR=./tizen_tmp + Debug "Create temporary directory : $TMPDIR" + mkdir -p $TMPDIR +fi + +TIZEN_URL=http://download.tizen.org/releases/milestone/tizen +BUILD_XML=build.xml +REPOMD_XML=repomd.xml +PRIMARY_XML=primary.xml +TARGET_URL="http://__not_initialized" + +Xpath_get() +{ + XPATH_RESULT='' + XPATH=$1 + XML_FILE=$2 + RESULT=$(xmllint --xpath $XPATH $XML_FILE) + if [[ -z ${RESULT// } ]]; then + Error "Can not find target from $XML_FILE" + Debug "Xpath = $XPATH" + exit 1 + fi + XPATH_RESULT=$RESULT +} + +fetch_tizen_pkgs_init() +{ + TARGET=$1 + PROFILE=$2 + Debug "Initialize TARGET=$TARGET, PROFILE=$PROFILE" + + TMP_PKG_DIR=$TMPDIR/tizen_${PROFILE}_pkgs + if [ -d $TMP_PKG_DIR ]; then rm -rf $TMP_PKG_DIR; fi + mkdir -p $TMP_PKG_DIR + + PKG_URL=$TIZEN_URL/$PROFILE/latest + + BUILD_XML_URL=$PKG_URL/$BUILD_XML + TMP_BUILD=$TMP_PKG_DIR/$BUILD_XML + TMP_REPOMD=$TMP_PKG_DIR/$REPOMD_XML + TMP_PRIMARY=$TMP_PKG_DIR/$PRIMARY_XML + TMP_PRIMARYGZ=${TMP_PRIMARY}.gz + + Fetch $BUILD_XML_URL $TMP_BUILD + + Debug "fetch $BUILD_XML_URL to $TMP_BUILD" + + TARGET_XPATH="//build/buildtargets/buildtarget[@name=\"$TARGET\"]/repo[@type=\"binary\"]/text()" + Xpath_get $TARGET_XPATH $TMP_BUILD + TARGET_PATH=$XPATH_RESULT + TARGET_URL=$PKG_URL/$TARGET_PATH + + REPOMD_URL=$TARGET_URL/repodata/repomd.xml + PRIMARY_XPATH='string(//*[local-name()="data"][@type="primary"]/*[local-name()="location"]/@href)' + + Fetch $REPOMD_URL $TMP_REPOMD + + Debug "fetch $REPOMD_URL to $TMP_REPOMD" + + Xpath_get $PRIMARY_XPATH $TMP_REPOMD + PRIMARY_XML_PATH=$XPATH_RESULT + PRIMARY_URL=$TARGET_URL/$PRIMARY_XML_PATH + + Fetch $PRIMARY_URL $TMP_PRIMARYGZ + + Debug "fetch $PRIMARY_URL to $TMP_PRIMARYGZ" + + gunzip $TMP_PRIMARYGZ + + Debug "unzip $TMP_PRIMARYGZ to $TMP_PRIMARY" +} + +fetch_tizen_pkgs() +{ + ARCH=$1 + PACKAGE_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="location"]/@href)' + + PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())' + + for pkg in ${@:2} + do + Inform "Fetching... $pkg" + XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + PKG_PATH=$XPATH_RESULT + + XPATH=${PACKAGE_CHECKSUM_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + CHECKSUM=$XPATH_RESULT + + PKG_URL=$TARGET_URL/$PKG_PATH + PKG_FILE=$(basename $PKG_PATH) + PKG_PATH=$TMPDIR/$PKG_FILE + + Debug "Download $PKG_URL to $PKG_PATH" + Fetch $PKG_URL $PKG_PATH true + + echo "$CHECKSUM $PKG_PATH" | sha256sum -c - > /dev/null + if [ $? -ne 0 ]; then + Error "Fail to fetch $PKG_URL to $PKG_PATH" + Debug "Checksum = $CHECKSUM" + exit 1 + fi + done +} + +Inform "Initialize arm base" +fetch_tizen_pkgs_init standard base +Inform "fetch common packages" +fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel +fetch_tizen_pkgs noarch linux-glibc-devel +Inform "fetch coreclr packages" +fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel tizen-release lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu +Inform "fetch corefx packages" +fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl libopenssl-devel krb5 krb5-devel libcurl libcurl-devel + +Inform "Initialize standard unified" +fetch_tizen_pkgs_init standard unified +Inform "fetch corefx packages" +fetch_tizen_pkgs armv7l gssdp gssdp-devel + diff --git a/eng/common/cross/armel/tizen/tizen-dotnet.ks b/eng/common/cross/armel/tizen/tizen-dotnet.ks new file mode 100644 index 000000000000..506d455bd4ff --- /dev/null +++ b/eng/common/cross/armel/tizen/tizen-dotnet.ks @@ -0,0 +1,50 @@ +lang en_US.UTF-8 +keyboard us +timezone --utc Asia/Seoul + +part / --fstype="ext4" --size=3500 --ondisk=mmcblk0 --label rootfs --fsoptions=defaults,noatime + +rootpw tizen +desktop --autologinuser=root +user --name root --groups audio,video --password 'tizen' + +repo --name=standard --baseurl=http://download.tizen.org/releases/milestone/tizen/unified/latest/repos/standard/packages/ --ssl_verify=no +repo --name=base --baseurl=http://download.tizen.org/releases/milestone/tizen/base/latest/repos/standard/packages/ --ssl_verify=no + +%packages +tar +gzip + +sed +grep +gawk +perl + +binutils +findutils +util-linux +lttng-ust +userspace-rcu +procps-ng +tzdata +ca-certificates + + +### Core FX +libicu +libunwind +iputils +zlib +krb5 +libcurl +libopenssl + +%end + +%post + +### Update /tmp privilege +chmod 777 /tmp +#################################### + +%end diff --git a/eng/common/cross/armel/tizen/tizen.patch b/eng/common/cross/armel/tizen/tizen.patch new file mode 100644 index 000000000000..d223427c9788 --- /dev/null +++ b/eng/common/cross/armel/tizen/tizen.patch @@ -0,0 +1,18 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-littlearm) +-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.3 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.3 ) ) +diff -u -r a/usr/lib/libpthread.so b/usr/lib/libpthread.so +--- a/usr/lib/libpthread.so 2016-12-30 23:00:19.408951841 +0900 ++++ b/usr/lib/libpthread.so 2016-12-30 23:00:39.068951801 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf32-littlearm) +-GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a ) ++GROUP ( libpthread.so.0 libpthread_nonshared.a ) diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh new file mode 100644 index 000000000000..adceda877add --- /dev/null +++ b/eng/common/cross/build-android-rootfs.sh @@ -0,0 +1,137 @@ +#!/usr/bin/env bash +set -e +__NDK_Version=r14 + +usage() +{ + echo "Creates a toolchain and sysroot used for cross-compiling for Android." + echo. + echo "Usage: $0 [BuildArch] [ApiLevel]" + echo. + echo "BuildArch is the target architecture of Android. Currently only arm64 is supported." + echo "ApiLevel is the target Android API level. API levels usually match to Android releases. See https://source.android.com/source/build-numbers.html" + echo. + echo "By default, the toolchain and sysroot will be generated in cross/android-rootfs/toolchain/[BuildArch]. You can change this behavior" + echo "by setting the TOOLCHAIN_DIR environment variable" + echo. + echo "By default, the NDK will be downloaded into the cross/android-rootfs/android-ndk-$__NDK_Version directory. If you already have an NDK installation," + echo "you can set the NDK_DIR environment variable to have this script use that installation of the NDK." + echo "By default, this script will generate a file, android_platform, in the root of the ROOTFS_DIR directory that contains the RID for the supported and tested Android build: android.21-arm64. This file is to replace '/etc/os-release', which is not available for Android." + exit 1 +} + +__ApiLevel=21 # The minimum platform for arm64 is API level 21 +__BuildArch=arm64 +__AndroidArch=aarch64 +__AndroidToolchain=aarch64-linux-android + +for i in "$@" + do + lowerI="$(echo $i | awk '{print tolower($0)}')" + case $lowerI in + -?|-h|--help) + usage + exit 1 + ;; + arm64) + __BuildArch=arm64 + __AndroidArch=aarch64 + __AndroidToolchain=aarch64-linux-android + ;; + arm) + __BuildArch=arm + __AndroidArch=arm + __AndroidToolchain=arm-linux-androideabi + ;; + *[0-9]) + __ApiLevel=$i + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" + ;; + esac +done + +# Obtain the location of the bash script to figure out where the root of the repo is. +__CrossDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +__Android_Cross_Dir="$__CrossDir/android-rootfs" +__NDK_Dir="$__Android_Cross_Dir/android-ndk-$__NDK_Version" +__libunwind_Dir="$__Android_Cross_Dir/libunwind" +__lldb_Dir="$__Android_Cross_Dir/lldb" +__ToolchainDir="$__Android_Cross_Dir/toolchain/$__BuildArch" + +if [[ -n "$TOOLCHAIN_DIR" ]]; then + __ToolchainDir=$TOOLCHAIN_DIR +fi + +if [[ -n "$NDK_DIR" ]]; then + __NDK_Dir=$NDK_DIR +fi + +echo "Target API level: $__ApiLevel" +echo "Target architecture: $__BuildArch" +echo "NDK location: $__NDK_Dir" +echo "Target Toolchain location: $__ToolchainDir" + +# Download the NDK if required +if [ ! -d $__NDK_Dir ]; then + echo Downloading the NDK into $__NDK_Dir + mkdir -p $__NDK_Dir + wget -nv -nc --show-progress https://dl.google.com/android/repository/android-ndk-$__NDK_Version-linux-x86_64.zip -O $__Android_Cross_Dir/android-ndk-$__NDK_Version-linux-x86_64.zip + unzip -q $__Android_Cross_Dir/android-ndk-$__NDK_Version-linux-x86_64.zip -d $__Android_Cross_Dir +fi + +if [ ! -d $__lldb_Dir ]; then + mkdir -p $__lldb_Dir + echo Downloading LLDB into $__lldb_Dir + wget -nv -nc --show-progress https://dl.google.com/android/repository/lldb-2.3.3614996-linux-x86_64.zip -O $__Android_Cross_Dir/lldb-2.3.3614996-linux-x86_64.zip + unzip -q $__Android_Cross_Dir/lldb-2.3.3614996-linux-x86_64.zip -d $__lldb_Dir +fi + +# Create the RootFS for both arm64 as well as aarch +rm -rf $__Android_Cross_Dir/toolchain + +echo Generating the $__BuildArch toolchain +$__NDK_Dir/build/tools/make_standalone_toolchain.py --arch $__BuildArch --api $__ApiLevel --install-dir $__ToolchainDir + +# Install the required packages into the toolchain +# TODO: Add logic to get latest pkg version instead of specific version number +rm -rf $__Android_Cross_Dir/deb/ +rm -rf $__Android_Cross_Dir/tmp + +mkdir -p $__Android_Cross_Dir/deb/ +mkdir -p $__Android_Cross_Dir/tmp/$arch/ +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libicu_60.2_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libicu_60.2_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libicu-dev_60.2_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libicu-dev_60.2_$__AndroidArch.deb + +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libandroid-glob-dev_0.4_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libandroid-glob-dev_0.4_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libandroid-glob_0.4_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libandroid-glob_0.4_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libandroid-support-dev_22_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libandroid-support-dev_22_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libandroid-support_22_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libandroid-support_22_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/liblzma-dev_5.2.3_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/liblzma-dev_5.2.3_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/liblzma_5.2.3_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/liblzma_5.2.3_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libunwind-dev_1.2.20170304_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libunwind-dev_1.2.20170304_$__AndroidArch.deb +wget -nv -nc http://termux.net/dists/stable/main/binary-$__AndroidArch/libunwind_1.2.20170304_$__AndroidArch.deb -O $__Android_Cross_Dir/deb/libunwind_1.2.20170304_$__AndroidArch.deb + +echo Unpacking Termux packages +dpkg -x $__Android_Cross_Dir/deb/libicu_60.2_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libicu-dev_60.2_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libandroid-glob-dev_0.4_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libandroid-glob_0.4_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libandroid-support-dev_22_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libandroid-support_22_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/liblzma-dev_5.2.3_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/liblzma_5.2.3_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libunwind-dev_1.2.20170304_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ +dpkg -x $__Android_Cross_Dir/deb/libunwind_1.2.20170304_$__AndroidArch.deb $__Android_Cross_Dir/tmp/$__AndroidArch/ + +cp -R $__Android_Cross_Dir/tmp/$__AndroidArch/data/data/com.termux/files/usr/* $__ToolchainDir/sysroot/usr/ + +# Generate platform file for build.sh script to assign to __DistroRid +echo "Generating platform file..." + +echo "RID=android.21-arm64" > $__ToolchainDir/sysroot/android_platform +echo Now run: +echo CONFIG_DIR=\`realpath cross/android/$__BuildArch\` ROOTFS_DIR=\`realpath $__ToolchainDir/sysroot\` ./build.sh cross $__BuildArch skipgenerateversion skipnuget cmakeargs -DENABLE_LLDBPLUGIN=0 + diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh new file mode 100644 index 000000000000..805948ca83c7 --- /dev/null +++ b/eng/common/cross/build-rootfs.sh @@ -0,0 +1,210 @@ +#!/usr/bin/env bash + +usage() +{ + echo "Usage: $0 [BuildArch] [LinuxCodeName] [lldbx.y] [--skipunmount]" + echo "BuildArch can be: arm(default), armel, arm64, x86" + echo "LinuxCodeName - optional, Code name for Linux, can be: trusty(default), vivid, wily, xenial, zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." + echo "lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8, lldb3.9, lldb4.0, no-lldb. Ignored for alpine" + echo "--skipunmount - optional, will skip the unmount of rootfs folder." + exit 1 +} + +__LinuxCodeName=trusty +__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +__InitialDir=$PWD +__BuildArch=arm +__UbuntuArch=armhf +__UbuntuRepo="http://ports.ubuntu.com/" +__LLDB_Package="lldb-3.6-dev" +__SkipUnmount=0 + +# base development support +__UbuntuPackages="build-essential" + +__AlpinePackages="alpine-base" +__AlpinePackages+=" build-base" +__AlpinePackages+=" linux-headers" +__AlpinePackages+=" lldb-dev" +__AlpinePackages+=" llvm-dev" + +# symlinks fixer +__UbuntuPackages+=" symlinks" + +# CoreCLR and CoreFX dependencies +__UbuntuPackages+=" libicu-dev" +__UbuntuPackages+=" liblttng-ust-dev" +__UbuntuPackages+=" libunwind8-dev" + +__AlpinePackages+=" gettext-dev" +__AlpinePackages+=" icu-dev" +__AlpinePackages+=" libunwind-dev" +__AlpinePackages+=" lttng-ust-dev" + +# CoreFX dependencies +__UbuntuPackages+=" libcurl4-openssl-dev" +__UbuntuPackages+=" libkrb5-dev" +__UbuntuPackages+=" libssl-dev" +__UbuntuPackages+=" zlib1g-dev" + +__AlpinePackages+=" curl-dev" +__AlpinePackages+=" krb5-dev" +__AlpinePackages+=" openssl-dev" +__AlpinePackages+=" zlib-dev" + +__UnprocessedBuildArgs= +for i in "$@" ; do + lowerI="$(echo $i | awk '{print tolower($0)}')" + case $lowerI in + -?|-h|--help) + usage + exit 1 + ;; + arm) + __BuildArch=arm + __UbuntuArch=armhf + __AlpineArch=armhf + __QEMUArch=arm + ;; + arm64) + __BuildArch=arm64 + __UbuntuArch=arm64 + __AlpineArch=aarch64 + __QEMUArch=aarch64 + ;; + armel) + __BuildArch=armel + __UbuntuArch=armel + __UbuntuRepo="http://ftp.debian.org/debian/" + __LinuxCodeName=jessie + ;; + x86) + __BuildArch=x86 + __UbuntuArch=i386 + __UbuntuRepo="http://archive.ubuntu.com/ubuntu/" + ;; + lldb3.6) + __LLDB_Package="lldb-3.6-dev" + ;; + lldb3.8) + __LLDB_Package="lldb-3.8-dev" + ;; + lldb3.9) + __LLDB_Package="liblldb-3.9-dev" + ;; + lldb4.0) + __LLDB_Package="liblldb-4.0-dev" + ;; + no-lldb) + unset __LLDB_Package + ;; + vivid) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=vivid + fi + ;; + wily) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=wily + fi + ;; + xenial) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=xenial + fi + ;; + zesty) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=zesty + fi + ;; + bionic) + if [ "$__LinuxCodeName" != "jessie" ]; then + __LinuxCodeName=bionic + fi + ;; + jessie) + __LinuxCodeName=jessie + __UbuntuRepo="http://ftp.debian.org/debian/" + ;; + tizen) + if [ "$__BuildArch" != "armel" ]; then + echo "Tizen is available only for armel." + usage; + exit 1; + fi + __LinuxCodeName= + __UbuntuRepo= + __Tizen=tizen + ;; + alpine) + __LinuxCodeName=alpine + __UbuntuRepo= + ;; + --skipunmount) + __SkipUnmount=1 + ;; + *) + __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" + ;; + esac +done + +if [ "$__BuildArch" == "armel" ]; then + __LLDB_Package="lldb-3.5-dev" +fi +__UbuntuPackages+=" ${__LLDB_Package:-}" + +__RootfsDir="$__CrossDir/rootfs/$__BuildArch" + +if [[ -n "$ROOTFS_DIR" ]]; then + __RootfsDir=$ROOTFS_DIR +fi + +if [ -d "$__RootfsDir" ]; then + if [ $__SkipUnmount == 0 ]; then + umount $__RootfsDir/* + fi + rm -rf $__RootfsDir +fi + +if [[ "$__LinuxCodeName" == "alpine" ]]; then + __ApkToolsVersion=2.9.1 + __AlpineVersion=3.7 + __ApkToolsDir=$(mktemp -d) + wget https://github.com/alpinelinux/apk-tools/releases/download/v$__ApkToolsVersion/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -P $__ApkToolsDir + tar -xf $__ApkToolsDir/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -C $__ApkToolsDir + mkdir -p $__RootfsDir/usr/bin + cp -v /usr/bin/qemu-$__QEMUArch-static $__RootfsDir/usr/bin + $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ + -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/main \ + -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/community \ + -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ + add $__AlpinePackages + rm -r $__ApkToolsDir +elif [[ -n $__LinuxCodeName ]]; then + qemu-debootstrap --arch $__UbuntuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo + cp $__CrossDir/$__BuildArch/sources.list.$__LinuxCodeName $__RootfsDir/etc/apt/sources.list + chroot $__RootfsDir apt-get update + chroot $__RootfsDir apt-get -f -y install + chroot $__RootfsDir apt-get -y install $__UbuntuPackages + chroot $__RootfsDir symlinks -cr /usr + + if [ $__SkipUnmount == 0 ]; then + umount $__RootfsDir/* + fi + + if [[ "$__BuildArch" == "arm" && "$__LinuxCodeName" == "trusty" ]]; then + pushd $__RootfsDir + patch -p1 < $__CrossDir/$__BuildArch/trusty.patch + patch -p1 < $__CrossDir/$__BuildArch/trusty-lttng-2.4.patch + popd + fi +elif [ "$__Tizen" == "tizen" ]; then + ROOTFS_DIR=$__RootfsDir $__CrossDir/$__BuildArch/tizen-build-rootfs.sh +else + echo "Unsupported target platform." + usage; + exit 1 +fi diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake new file mode 100644 index 000000000000..071d4112419b --- /dev/null +++ b/eng/common/cross/toolchain.cmake @@ -0,0 +1,138 @@ +set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) + +set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) + +if(TARGET_ARCH_NAME STREQUAL "armel") + set(CMAKE_SYSTEM_PROCESSOR armv7l) + set(TOOLCHAIN "arm-linux-gnueabi") + if("$ENV{__DistroRid}" MATCHES "tizen.*") + set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi/6.2.1") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "arm") + set(CMAKE_SYSTEM_PROCESSOR armv7l) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf) + set(TOOLCHAIN "armv6-alpine-linux-musleabihf") + else() + set(TOOLCHAIN "arm-linux-gnueabihf") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "arm64") + set(CMAKE_SYSTEM_PROCESSOR aarch64) + if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl) + set(TOOLCHAIN "aarch64-alpine-linux-musl") + else() + set(TOOLCHAIN "aarch64-linux-gnu") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x86") + set(CMAKE_SYSTEM_PROCESSOR i686) + set(TOOLCHAIN "i686-linux-gnu") +else() + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64 and x86 are supported!") +endif() + +# Specify include paths +if(TARGET_ARCH_NAME STREQUAL "armel") + if(DEFINED TIZEN_TOOLCHAIN) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi) + endif() +endif() + +# add_compile_param - adds only new options without duplicates. +# arg0 - list with result options, arg1 - list with new options. +# arg2 - optional argument, quick summary string for optional using CACHE FORCE mode. +macro(add_compile_param) + if(NOT ${ARGC} MATCHES "^(2|3)$") + message(FATAL_ERROR "Wrong using add_compile_param! Two or three parameters must be given! See add_compile_param description.") + endif() + foreach(OPTION ${ARGV1}) + if(NOT ${ARGV0} MATCHES "${OPTION}($| )") + set(${ARGV0} "${${ARGV0}} ${OPTION}") + if(${ARGC} EQUAL "3") # CACHE FORCE mode + set(${ARGV0} "${${ARGV0}}" CACHE STRING "${ARGV2}" FORCE) + endif() + endif() + endforeach() +endmacro() + +# Specify link flags +add_compile_param(CROSS_LINK_FLAGS "--sysroot=${CROSS_ROOTFS}") +add_compile_param(CROSS_LINK_FLAGS "--gcc-toolchain=${CROSS_ROOTFS}/usr") +add_compile_param(CROSS_LINK_FLAGS "--target=${TOOLCHAIN}") +add_compile_param(CROSS_LINK_FLAGS "-fuse-ld=gold") + +if(TARGET_ARCH_NAME STREQUAL "armel") + if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only + add_compile_param(CROSS_LINK_FLAGS "-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/lib") + add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib") + add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x86") + add_compile_param(CROSS_LINK_FLAGS "-m32") +endif() + +add_compile_param(CMAKE_EXE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS") +add_compile_param(CMAKE_SHARED_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS") +add_compile_param(CMAKE_MODULE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS") + +# Specify compile options +add_compile_options("--sysroot=${CROSS_ROOTFS}") +add_compile_options("--target=${TOOLCHAIN}") +add_compile_options("--gcc-toolchain=${CROSS_ROOTFS}/usr") + +if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$") + set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) + set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) + set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) +endif() + +if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") + add_compile_options(-mthumb) + add_compile_options(-mfpu=vfpv3) + if(TARGET_ARCH_NAME STREQUAL "armel") + add_compile_options(-mfloat-abi=softfp) + if(DEFINED TIZEN_TOOLCHAIN) + add_compile_options(-Wno-deprecated-declarations) # compile-time option + add_compile_options(-D__extern_always_inline=inline) # compile-time option + endif() + endif() +elseif(TARGET_ARCH_NAME STREQUAL "x86") + add_compile_options(-m32) + add_compile_options(-Wno-error=unused-command-line-argument) +endif() + +# Set LLDB include and library paths +if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") + if(TARGET_ARCH_NAME STREQUAL "x86") + set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}") + else() # arm/armel case + set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}") + endif() + if(LLVM_CROSS_DIR) + set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "") + set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "") + set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "") + else() + if(TARGET_ARCH_NAME STREQUAL "x86") + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "") + set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include") + if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}") + set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}") + else() + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include") + endif() + else() # arm/armel case + set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "") + set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "") + endif() + endif() +endif() + +set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/global.json b/global.json index 4bb79598bef9..cd3008d99afc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.5" } } \ No newline at end of file From 6a082a903c0974310817bb9d6a447fed6ffdae95 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 25 Oct 2018 17:23:08 +0000 Subject: [PATCH 0178/2702] [Darc-Update] Update dependencies from build 20181025.3 of https://github.com/dotnet/arcade (#158) * Updating version files * Updating version files * Updating version files * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a4b291a57c7d..775936046db7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - bc0acaacd5d6c18e4b28cb3cf1754626be4a8c71 + b37043aa2f11b1f7b43693fad97b1032bb15344e \ No newline at end of file diff --git a/global.json b/global.json index cd3008d99afc..4a4fb4d89996 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18524.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18525.3" } } \ No newline at end of file From 43dfa07eb3c3e0142a6b6fb57ecae022be023298 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 25 Oct 2018 19:01:52 +0000 Subject: [PATCH 0179/2702] Updating version files (#159) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 775936046db7..3b5f0da6f6c3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b37043aa2f11b1f7b43693fad97b1032bb15344e + a278e547725770644f126e608b6b760dffa9d24c \ No newline at end of file diff --git a/global.json b/global.json index 4a4fb4d89996..26251e864406 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18525.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18525.4" } } \ No newline at end of file From 6d19aef1095cde03a49549394b811a61f0022728 Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Thu, 25 Oct 2018 15:04:14 -0700 Subject: [PATCH 0180/2702] Enable telemetry (#161) * Enable telemetry FYI @jonfortescue * Update the linux and osx legs --- azure-pipelines.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 18c02c90d621..acce161a25b7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,8 +2,7 @@ variables: Build.Repository.Clean: true _HelixType: build/product _HelixSource: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) - _enableTelemetry: true - + resources: containers: - container: LinuxContainer @@ -21,7 +20,7 @@ phases: - template: /eng/common/templates/phases/base.yml parameters: name: Windows_NT - enableTelemetry: $(_enableTelemetry) + enableTelemetry: true queue: name: dotnet-external-temp parallel: 99 @@ -51,7 +50,7 @@ phases: - template: /eng/common/templates/phases/base.yml parameters: name: OSX - enableTelemetry: $(_enableTelemetry) + enableTelemetry: true queue: name: Hosted macOS Preview parallel: 99 @@ -81,7 +80,7 @@ phases: - template: /eng/common/templates/phases/base.yml parameters: name: Linux - enableTelemetry: $(_enableTelemetry) + enableTelemetry: true queue: name: Hosted Ubuntu 1604 parallel: 99 From 1288e93379a0890255c68e01e78dac100ec889fe Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 25 Oct 2018 22:06:04 +0000 Subject: [PATCH 0181/2702] [Darc-Update] Update dependencies from build 20181025.6 of https://github.com/dotnet/arcade (#160) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- eng/common/cross/x86/sources.list.bionic | 11 +++++++++++ eng/common/cross/x86/sources.list.trusty | 11 +++++++++++ eng/common/cross/x86/sources.list.vivid | 11 +++++++++++ eng/common/cross/x86/sources.list.wily | 11 +++++++++++ eng/common/cross/x86/sources.list.xenial | 11 +++++++++++ eng/common/templates/phases/base.yml | 2 +- global.json | 2 +- 8 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 eng/common/cross/x86/sources.list.bionic create mode 100644 eng/common/cross/x86/sources.list.trusty create mode 100644 eng/common/cross/x86/sources.list.vivid create mode 100644 eng/common/cross/x86/sources.list.wily create mode 100644 eng/common/cross/x86/sources.list.xenial diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3b5f0da6f6c3..a60ac334a9cd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - a278e547725770644f126e608b6b760dffa9d24c + 92a8b7cbec247342d198859020d8a8fc6929aaeb \ No newline at end of file diff --git a/eng/common/cross/x86/sources.list.bionic b/eng/common/cross/x86/sources.list.bionic new file mode 100644 index 000000000000..a71ccadcffaf --- /dev/null +++ b/eng/common/cross/x86/sources.list.bionic @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.trusty b/eng/common/cross/x86/sources.list.trusty new file mode 100644 index 000000000000..9b3085436e9a --- /dev/null +++ b/eng/common/cross/x86/sources.list.trusty @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.vivid b/eng/common/cross/x86/sources.list.vivid new file mode 100644 index 000000000000..26d37b20fc37 --- /dev/null +++ b/eng/common/cross/x86/sources.list.vivid @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ vivid main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ vivid main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.wily b/eng/common/cross/x86/sources.list.wily new file mode 100644 index 000000000000..c4b0b442ab6b --- /dev/null +++ b/eng/common/cross/x86/sources.list.wily @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ wily main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ wily main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ wily-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ wily-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ wily-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ wily-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ wily-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ wily-security main restricted universe multiverse diff --git a/eng/common/cross/x86/sources.list.xenial b/eng/common/cross/x86/sources.list.xenial new file mode 100644 index 000000000000..ad9c5a0144ef --- /dev/null +++ b/eng/common/cross/x86/sources.list.xenial @@ -0,0 +1,11 @@ +deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe +deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe + +deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted +deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted + +deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse +deb-src http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml index c7933eafa56b..f5b3fa13e52a 100644 --- a/eng/common/templates/phases/base.yml +++ b/eng/common/templates/phases/base.yml @@ -60,7 +60,7 @@ phases: - ${{ if eq(parameters.enableMicrobuild, 'true') }}: # Internal only resource, and Microbuild signing shouldn't be applied to PRs. - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: MicroBuildSigningPlugin@1 + - task: MicroBuildSigningPlugin@2 displayName: Install MicroBuild plugin inputs: signType: $(_SignType) diff --git a/global.json b/global.json index 26251e864406..83ddb97a5b20 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18525.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18525.6" } } \ No newline at end of file From 9f190cdf25ca9cdd0ca6189aad12cd9ae0817cf5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 26 Oct 2018 00:57:25 +0000 Subject: [PATCH 0182/2702] Updating version files (#162) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a60ac334a9cd..24f7972161ad 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 92a8b7cbec247342d198859020d8a8fc6929aaeb + 186524e97769ebf3ab9a5acd9bf5dfdfe732f1fd \ No newline at end of file diff --git a/global.json b/global.json index 83ddb97a5b20..56935fe8abe1 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18525.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18525.7" } } \ No newline at end of file From 47aba8b8697cdceb7effddcb73db7669fb5e8980 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 26 Oct 2018 12:46:30 +0000 Subject: [PATCH 0183/2702] [Darc-Update] Update dependencies from build 20181026.1 of https://github.com/dotnet/arcade (#163) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 24f7972161ad..594f2401d1ce 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 186524e97769ebf3ab9a5acd9bf5dfdfe732f1fd + de24ad7b4b35dc26beed7de24ba52a3d6685a9f3 \ No newline at end of file diff --git a/global.json b/global.json index 56935fe8abe1..3dfd24a59190 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18525.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.1" } } \ No newline at end of file From d35d040b6987ab6ac531a4c3e4c16f69be73cc4a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 26 Oct 2018 16:30:37 +0000 Subject: [PATCH 0184/2702] Updating version files (#164) --- eng/Version.Details.xml | 4 ++-- eng/common/templates/steps/helix-publish.yml | 4 ++++ global.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 594f2401d1ce..9d92f1de7ada 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - de24ad7b4b35dc26beed7de24ba52a3d6685a9f3 + 49348c8a644c880aa3ec88a847482ae445175a6a \ No newline at end of file diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml index d09cac238f3b..1eb4e9f4ac04 100644 --- a/eng/common/templates/steps/helix-publish.yml +++ b/eng/common/templates/steps/helix-publish.yml @@ -13,6 +13,8 @@ parameters: DotNetCliVersion: '' EnableXUnitReporter: false WaitForWorkItemCompletion: true + condition: succeeded() + continueOnError: false steps: - task: DotNetCoreCLI@2 @@ -37,3 +39,5 @@ steps: DotNetCliVersion: ${{ parameters.DotNetCliVersion }} EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} diff --git a/global.json b/global.json index 3dfd24a59190..0e6fd2ee466a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.2" } } \ No newline at end of file From dc377687e1af3d4847c44d50598b216dcc358d99 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 26 Oct 2018 18:37:16 +0000 Subject: [PATCH 0185/2702] Updating version files (#165) --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9d92f1de7ada..aa4f6e0da8f7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 49348c8a644c880aa3ec88a847482ae445175a6a + 946bdc7e51961d64a22a00d1d3613816630f4386 \ No newline at end of file diff --git a/global.json b/global.json index 0e6fd2ee466a..82c738338091 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.3" } } \ No newline at end of file From 7920fb286e6c81798f48e3200ad4d86c1318903b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 26 Oct 2018 19:44:24 +0000 Subject: [PATCH 0186/2702] [Darc-Update] Update dependencies from build 20181026.5 of https://github.com/dotnet/arcade (#166) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index aa4f6e0da8f7..8bbf31937c98 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 946bdc7e51961d64a22a00d1d3613816630f4386 + 5cb9294dc9eda591132f487e65a2b1bb9d4a4ee4 \ No newline at end of file diff --git a/global.json b/global.json index 82c738338091..6ae04d7df075 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.5" } } \ No newline at end of file From 52d8b98811fe0e460b231c67057ac09b64da4262 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 26 Oct 2018 14:21:27 -0700 Subject: [PATCH 0187/2702] [Darc-Update] Update dependencies from build 20181026.8 of https://github.com/dotnet/arcade (#167) * Updating version files * Updating version files --- eng/Version.Details.xml | 4 ++-- eng/common/helixpublish.proj | 6 ++++++ eng/common/templates/steps/helix-publish.yml | 1 + global.json | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8bbf31937c98..0496d4a33c33 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 5cb9294dc9eda591132f487e65a2b1bb9d4a4ee4 + ef208f75c0494f47bf79a317773adcb398c35f92 \ No newline at end of file diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj index 4496c23f8dc9..df2ad59f70c5 100644 --- a/eng/common/helixpublish.proj +++ b/eng/common/helixpublish.proj @@ -1,5 +1,11 @@ + + + %(Identity) + + + $(WorkItemDirectory) diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml index 1eb4e9f4ac04..f14546730e31 100644 --- a/eng/common/templates/steps/helix-publish.yml +++ b/eng/common/templates/steps/helix-publish.yml @@ -8,6 +8,7 @@ parameters: HelixPostCommands: '' WorkItemDirectory: '' WorkItemCommand: '' + CorrelationPayloadDirectory: '' IncludeDotNetCli: false DotNetCliPackageType: '' DotNetCliVersion: '' diff --git a/global.json b/global.json index 6ae04d7df075..7ebfe0137669 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.8" } } \ No newline at end of file From a249ce8e79a9b71d5367d7bc59132121a7490d5b Mon Sep 17 00:00:00 2001 From: Davis Goodin Date: Mon, 29 Oct 2018 12:22:49 -0500 Subject: [PATCH 0188/2702] Fix build.sh execute permission (#169) --- build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 From 718e97b8ba941ea4df089e372807819cdf8ea371 Mon Sep 17 00:00:00 2001 From: Ricardo Arenas Date: Tue, 6 Nov 2018 07:24:17 -0800 Subject: [PATCH 0189/2702] update docs and broken links --- Documentation.md | 2 +- README.md | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation.md b/Documentation.md index 9177ef9491ad..e516759574b3 100644 --- a/Documentation.md +++ b/Documentation.md @@ -8,7 +8,7 @@ This documents [@jonfortescue](https://github.com/jonfortescue)'s process in cre 4. Added a Windows queue with a basic set up for builds (use .NET CLI, run `restore`, `build`, `publish`). As part of troubleshooting this, added `Build.Repository.Clean: true` to the build to ensure binaries were cleaned from the build machine. Also added `targetFramework: netcoreapp2.0` as a build variable and referenced it during the `publish` step to prevent build breaks. 5. Use matrices to run debug and release builds in simultaneous phases 6. Broke out the build steps into a `build.yml` template to prepare for code reuse on step 7 -7. Added Linux and OSX queues. For the OSX queue, initially ran into authorization problem; issue was fixed following the steps detailed in [Arcade's VSTS Onboarding doc](https://github.com/dotnet/arcade/blob/master/Documentation/VSTS/VSTSOnboarding.md#Troubleshooting) under the section **Troubleshooting/Queuing builds** (second bullet point). +7. Added Linux and OSX queues. For the OSX queue, initially ran into authorization problem; issue was fixed following the steps detailed in [Arcade's Azure DevOps Onboarding doc](https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/AzureDevOpsOnboarding.md#Troubleshooting) under the section **Troubleshooting/Queuing builds** (second bullet point). 8. As part of troubleshooting step 7: added a step for installing the .NET CLI and ensured the most recent version was used (caused segfaults on Mac otherwise). Also added `DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1` and `DOTNET_MULTILEVEL_LOOKUP: 0` as environment variables for the `restore` step to prevent restoring the entire cache to the build machine. 9. Added `{{ if }}` directives for the publish step based on build configuration. As of right now, is not working. *TODO: update with fix when working*. 10. Added `Build.Reason` if-directives to prevent `Release` builds from running on pull requests. diff --git a/README.md b/README.md index 1e73f9ee3449..fe4a8277c4df 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,25 @@ [![Build status](https://dnceng.visualstudio.com/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_apis/build/status/116?branchName=master)](https://dnceng.visualstudio.com/public/_build/latest?definitionId=116&branch=master) -This repository serves as an example of how to link GitHub repositories to VSTS for CI and PR builds. +This repository serves as an example of how to link GitHub repositories to Azure DevOps for CI and PR builds. ## Before You Start -You'll want to start by following the [VSTS Onboarding](https://github.com/dotnet/arcade/blob/master/Documentation/VSTS/VSTSOnboarding.md) instructions, which provide a thorough, step-by-step list of instructions for creating VSTS CI builds for GitHub repos. From there, you'll find the [VSTS YAML documentation](https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted.md), which details the creation of VSTS CI YAML files. +You'll want to start by following the [Azure DevOps Onboarding](https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/AzureDevOpsOnboarding.md) instructions, which provide a thorough, step-by-step list of instructions for creating Azure DevOps CI builds for GitHub repos. From there, you'll find the [Azure DevOps YAML documentation](https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started-yaml?view=vsts), which details the creation of Azure DevOps CI YAML files. -The purpose of this repository is to provide a jumping off point with an example YAML CI file that already has the basic architecture you'll want for your builds. All examples below are taken from this repository's [.vsts-ci.yml](.vsts-ci.yml). +The purpose of this repository is to provide a jumping off point with an example YAML CI file that already has the basic architecture you'll want for your builds. All examples below are taken from this repository's [azure-pipelines.yml](azure-pipelines.yml). ## Set build triggers in your YAML -Documentation on setting CI triggers in YAML can be found [here](https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-ci.md). The syntax for pull request triggers is identical, and will trigger whenever a PR is created merging into your specified branches. +Documentation on setting CI triggers in YAML can be found [here](https://docs.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=vsts&tabs=yaml#set-up-a-ci-trigger-for-a-topic-branch). The syntax for pull request triggers is identical, and will trigger whenever a PR is created merging into your specified branches. -**Note: YAML-based PR triggers are a feature currently being rolled out by VSTS. Until they are completed, you must override the YAML PR trigger settings from the build definition GUI on VSTS.** +**Note: YAML-based PR triggers are a feature currently being rolled out by Azure DevOps. Until they are completed, you must override the YAML PR trigger settings from the build definition GUI on Azure DevOps.** ```yaml trigger: - master -# Commenting out until VSTS supports YAML PR triggers +# Commenting out until Azure DevOps supports YAML PR triggers # pr: # - master ``` @@ -58,7 +58,7 @@ Note: for the Unix-based scripts to work, make sure you clone rather than copy/p ## Use matrices to quickly create phases for different build configurations -VSTS supports using a **matrix** in a phase definition to quickly create several different phases on the same queue with slightly different build configurations. This is the recommended way to quickly add debug and release configuration builds. +Azure DevOps supports using a **matrix** in a phase definition to quickly create several different phases on the same queue with slightly different build configurations. This is the recommended way to quickly add debug and release configuration builds. ```yaml - phase: Windows @@ -84,7 +84,7 @@ The variable defined in this matrix (in this case, `_BuildConfig`) can later be ## Run both CI and PR builds out of the same file -While this sample repository has no need to do so, there are many scenarios in which you may want to differentiate between different build triggers. The current recommendation is that all repositories have a single `.vsts-ci.yml` file which defines all of their builds (CI, PR, and internal). To do this, use YAML `{{ if }}` directives and the VSTS built-in `Build.Reason` variable. +While this sample repository has no need to do so, there are many scenarios in which you may want to differentiate between different build triggers. The current recommendation is that all repositories have a single `azure-pipelines.yml` file which defines all of their builds (CI, PR, and internal). To do this, use YAML `{{ if }}` directives and the Azure DevOps built-in `Build.Reason` variable. ```yaml - ${{ if notIn(variables['Build.Reason'], 'PullRequest') }}: @@ -134,7 +134,7 @@ phases: azureSubscription: 'HelixProd_KeyVault' KeyVaultName: HelixProdKV SecretsFilter: 'HelixApiAccessToken' - # conditions - https://docs.microsoft.com/en-us/vsts/pipelines/process/conditions?view=vsts + # conditions - https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=vsts condition: always() ``` From 5994507cb11ee84377b43521ae4df489058a20a5 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Thu, 8 Nov 2018 08:29:16 -0800 Subject: [PATCH 0190/2702] Update triggers to use YAML specification --- azure-pipelines.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index acce161a25b7..10578eaeb4c5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,12 +8,11 @@ resources: - container: LinuxContainer image: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20170319080304 +# CI and PR triggers trigger: - master - -# To be added in the future when VSTS supports this feature -# pr: -# - master +pr: +- master # Three phases for each of the three OSes we want to run on phases: From 468e16a82ae09fccea38d05b2c8f71c21869e7fa Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Thu, 8 Nov 2018 08:51:20 -0800 Subject: [PATCH 0191/2702] Add test pool branch --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 10578eaeb4c5..7367dd9215b6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,6 +11,7 @@ resources: # CI and PR triggers trigger: - master +- switch-to-test-pool pr: - master From b1e4b69e1f4d7f68ba430e9766edd2c692649db3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 14 Nov 2018 04:15:16 +0000 Subject: [PATCH 0192/2702] Update dependencies from https://github.com/dotnet/arcade build 327 (#181) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18563.21 --- eng/Version.Details.xml | 6 +- eng/Versions.props | 2 +- eng/common/PushBuildAssets.cmd | 3 - eng/common/cross/.gitmirrorall | 1 - eng/common/helixpublish.proj | 2 +- eng/common/init-tools.ps1 | 258 ------------------ eng/common/init-tools.sh | 225 --------------- eng/common/native/install-cmake.ps1 | 119 -------- eng/common/templates/phases/base.yml | 31 ++- .../templates/phases/publish-build-asset.yml | 26 -- .../templates/phases/publish-build-assets.yml | 15 +- .../templates/phases/push-build-asset.yml | 26 -- eng/common/templates/steps/helix-publish.yml | 8 +- .../templates/steps/telemetry-start.yml | 3 +- global.json | 4 +- 15 files changed, 55 insertions(+), 674 deletions(-) delete mode 100644 eng/common/PushBuildAssets.cmd delete mode 100644 eng/common/cross/.gitmirrorall delete mode 100644 eng/common/init-tools.ps1 delete mode 100755 eng/common/init-tools.sh delete mode 100644 eng/common/native/install-cmake.ps1 delete mode 100644 eng/common/templates/phases/publish-build-asset.yml delete mode 100644 eng/common/templates/phases/push-build-asset.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0496d4a33c33..f0d8006c0264 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ef208f75c0494f47bf79a317773adcb398c35f92 + 179f64a9add52c37b4d441f12285da4b17389a82 - \ No newline at end of file + diff --git a/eng/Versions.props b/eng/Versions.props index 8df0a2de8911..04b66403caaf 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -4,4 +4,4 @@ 1.0.0 prerelease - \ No newline at end of file + diff --git a/eng/common/PushBuildAssets.cmd b/eng/common/PushBuildAssets.cmd deleted file mode 100644 index e0ee8ede7934..000000000000 --- a/eng/common/PushBuildAssets.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -pushBuildAssets %*" -exit /b %ErrorLevel% diff --git a/eng/common/cross/.gitmirrorall b/eng/common/cross/.gitmirrorall deleted file mode 100644 index 9ee5c57b9917..000000000000 --- a/eng/common/cross/.gitmirrorall +++ /dev/null @@ -1 +0,0 @@ -This folder will be mirrored by the Git-TFS Mirror recursively. \ No newline at end of file diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj index df2ad59f70c5..364af7766865 100644 --- a/eng/common/helixpublish.proj +++ b/eng/common/helixpublish.proj @@ -7,7 +7,7 @@ - + $(WorkItemDirectory) $(WorkItemCommand) diff --git a/eng/common/init-tools.ps1 b/eng/common/init-tools.ps1 deleted file mode 100644 index 9bc3384a3869..000000000000 --- a/eng/common/init-tools.ps1 +++ /dev/null @@ -1,258 +0,0 @@ -# Initialize variables if they aren't already defined - -$ci = if (Test-Path variable:ci) { $ci } else { $false } -$configuration = if (Test-Path variable:configuration) { $configuration } else { "Debug" } -$nodereuse = if (Test-Path variable:nodereuse) { $nodereuse } else { $true } -$prepareMachine = if (Test-Path variable:prepareMachine) { $prepareMachine } else { $false } -$restore = if (Test-Path variable:restore) { $restore } else { $true } -$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { "minimal" } -$warnaserror = if (Test-Path variable:warnaserror) { $warnaserror } else { $true } - -set-strictmode -version 2.0 -$ErrorActionPreference = "Stop" -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - -function Create-Directory([string[]] $path) { - if (!(Test-Path $path)) { - New-Item -path $path -force -itemType "Directory" | Out-Null - } -} - -function InitializeDotNetCli { - # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism - $env:DOTNET_MULTILEVEL_LOOKUP=0 - - # Disable first run since we do not need all ASP.NET packages restored. - $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - - # Source Build uses DotNetCoreSdkDir variable - if ($env:DotNetCoreSdkDir -ne $null) { - $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir - } - - # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, - # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. - if (($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$($GlobalJson.tools.dotnet)"))) { - $dotnetRoot = $env:DOTNET_INSTALL_DIR - } else { - $dotnetRoot = Join-Path $RepoRoot ".dotnet" - $env:DOTNET_INSTALL_DIR = $dotnetRoot - - if ($restore) { - InstallDotNetSdk $dotnetRoot $GlobalJson.tools.dotnet - } - } - - return $dotnetRoot -} - -function GetDotNetInstallScript([string] $dotnetRoot) { - $installScript = "$dotnetRoot\dotnet-install.ps1" - if (!(Test-Path $installScript)) { - Create-Directory $dotnetRoot - Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript - } - - return $installScript -} - -function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { - $installScript = GetDotNetInstallScript $dotnetRoot - - & $installScript -Version $version -InstallDir $dotnetRoot - if ($lastExitCode -ne 0) { - Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red - ExitWithExitCode $lastExitCode - } -} - -function InitializeVisualStudioBuild { - $inVSEnvironment = !($env:VS150COMNTOOLS -eq $null) -and (Test-Path $env:VS150COMNTOOLS) - - if ($inVSEnvironment) { - $vsInstallDir = Join-Path $env:VS150COMNTOOLS "..\.." - } else { - $vsInstallDir = LocateVisualStudio - - $env:VS150COMNTOOLS = Join-Path $vsInstallDir "Common7\Tools\" - $env:VSSDK150Install = Join-Path $vsInstallDir "VSSDK\" - $env:VSSDKInstall = Join-Path $vsInstallDir "VSSDK\" - } - - return $vsInstallDir; -} - -function LocateVisualStudio { - $vswhereVersion = $GlobalJson.tools.vswhere - $toolsRoot = Join-Path $RepoRoot ".tools" - $vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion" - $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe" - - if (!(Test-Path $vsWhereExe)) { - Create-Directory $vsWhereDir - Write-Host "Downloading vswhere" - Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe - } - - $vsInstallDir = & $vsWhereExe -latest -prerelease -property installationPath -requires Microsoft.Component.MSBuild -requires Microsoft.VisualStudio.Component.VSSDK -requires Microsoft.Net.Component.4.6.TargetingPack -requires Microsoft.VisualStudio.Component.Roslyn.Compiler -requires Microsoft.VisualStudio.Component.VSSDK - - if ($lastExitCode -ne 0) { - Write-Host "Failed to locate Visual Studio (exit code '$lastExitCode')." -ForegroundColor Red - ExitWithExitCode $lastExitCode - } - - return $vsInstallDir -} - -function InitializeTools() { - $tools = $GlobalJson.tools - - if ((Get-Member -InputObject $tools -Name "dotnet") -ne $null) { - $dotnetRoot = InitializeDotNetCli - - # by default build with dotnet cli: - $script:buildDriver = Join-Path $dotnetRoot "dotnet.exe" - $script:buildArgs = "msbuild" - } - - if ((Get-Member -InputObject $tools -Name "vswhere") -ne $null) { - $vsInstallDir = InitializeVisualStudioBuild - - # Presence of vswhere.version indicates the repo needs to build using VS msbuild: - $script:buildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe" - if ($ci) { $nodereuse = $false } - } - - if ($buildDriver -eq $null) { - Write-Host "/global.json must either specify 'tools.dotnet' or 'tools.vswhere'." -ForegroundColor Red - ExitWithExitCode 1 - } - - InitializeToolSet $script:buildDriver $script:buildArgs - InitializeCustomToolset -} - -function InitializeToolset([string] $buildDriver, [string]$buildArgs) { - $toolsetLocationFile = Join-Path $ToolsetDir "$ToolsetVersion.txt" - - if (Test-Path $toolsetLocationFile) { - $path = Get-Content $toolsetLocationFile -TotalCount 1 - if (Test-Path $path) { - $script:ToolsetBuildProj = $path - return - } - } - - if (-not $restore) { - Write-Host "Toolset version $ToolsetVersion has not been restored." - ExitWithExitCode 1 - } - - $ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog" - $proj = Join-Path $ToolsetDir "restore.proj" - - '' | Set-Content $proj - MSBuild $proj /t:__WriteToolsetLocation /clp:None /bl:$ToolsetRestoreLog /p:__ToolsetLocationOutputFile=$toolsetLocationFile - - if ($lastExitCode -ne 0) { - Write-Host "Failed to restore toolset (exit code '$lastExitCode'). See log: $ToolsetRestoreLog" -ForegroundColor Red - ExitWithExitCode $lastExitCode - } - - $path = Get-Content $toolsetLocationFile -TotalCount 1 - if (!(Test-Path $path)) { - throw "Invalid toolset path: $path" - } - - $script:ToolsetBuildProj = $path -} - -function InitializeCustomToolset { - if (-not $restore) { - return - } - - $script = Join-Path $EngRoot "RestoreToolset.ps1" - - if (Test-Path $script) { - . $script - } -} - -function ExitWithExitCode([int] $exitCode) { - if ($ci -and $prepareMachine) { - Stop-Processes - } - exit $exitCode -} - -function Stop-Processes() { - Write-Host "Killing running build processes..." - Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Stop-Process - Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | Stop-Process - Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process -} - -function MsBuild() { - $msbuildArgs = "$buildArgs /m /nologo /clp:Summary /v:$verbosity" - $extraArgs = "$args" - - if ($warnaserror) { - $msbuildArgs += " /warnaserror" - } - - $msbuildArgs += " /nr:$nodereuse" - - Write-Debug "`"$buildDriver`" $msbuildArgs $extraArgs" - Invoke-Expression "& `"$buildDriver`" $msbuildArgs $extraArgs" - - return $lastExitCode -} - -function InstallDarcCli { - $DarcCliPackageName = "microsoft.dotnet.darc" - $ToolList = Invoke-Expression "$buildDriver tool list -g" - - if ($ToolList -like "*$DarcCliPackageName*") { - Invoke-Expression "$buildDriver tool uninstall $DarcCliPackageName -g" - } - - Write-Host "Installing Darc CLI version $toolsetVersion..." - Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - Invoke-Expression "$buildDriver tool install $DarcCliPackageName --version $toolsetVersion -v $verbosity -g" -} - -try { - $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") - $EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") - $ArtifactsDir = Join-Path $RepoRoot "artifacts" - $ToolsetDir = Join-Path $ArtifactsDir "toolset" - $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration - $TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration - $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json - $ToolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' - - if ($env:NUGET_PACKAGES -eq $null) { - # Use local cache on CI to ensure deterministic build, - # use global cache in dev builds to avoid cost of downloading packages. - $env:NUGET_PACKAGES = if ($ci) { Join-Path $RepoRoot ".packages" } - else { Join-Path $env:UserProfile ".nuget\packages" } - } - - Create-Directory $ToolsetDir - Create-Directory $LogDir - - if ($ci) { - Create-Directory $TempDir - $env:TEMP = $TempDir - $env:TMP = $TempDir - } - - InitializeTools -} -catch { - Write-Host $_ - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - ExitWithExitCode 1 -} \ No newline at end of file diff --git a/eng/common/init-tools.sh b/eng/common/init-tools.sh deleted file mode 100755 index 0e66498facae..000000000000 --- a/eng/common/init-tools.sh +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/env bash - -ci=${ci:-false} -configuration=${configuration:-'Debug'} -nodereuse=${nodereuse:-true} -prepare_machine=${prepare_machine:-false} -restore=${restore:-true} -verbosity=${verbosity:-'minimal'} -warnaserror=${warnaserror:-true} - -repo_root="$scriptroot/../.." -eng_root="$scriptroot/.." -artifacts_dir="$repo_root/artifacts" -toolset_dir="$artifacts_dir/toolset" -log_dir="$artifacts_dir/log/$configuration" -temp_dir="$artifacts_dir/tmp/$configuration" - -global_json_file="$repo_root/global.json" -build_driver="" -toolset_build_proj="" - -# ReadVersionFromJson [json key] -function ReadGlobalVersion { - local key=$1 - - local unamestr="$(uname)" - local sedextended='-r' - if [[ "$unamestr" == 'Darwin' ]]; then - sedextended='-E' - fi; - - local version="$(grep -m 1 "\"$key\"" $global_json_file | sed $sedextended 's/^ *//;s/.*: *"//;s/",?//')" - if [[ ! "$version" ]]; then - echo "Error: Cannot find \"$key\" in $global_json_file" >&2; - ExitWithExitCode 1 - fi; - # return value - echo "$version" -} - -toolset_version=`ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk"` - -function InitializeDotNetCli { - # Disable first run since we want to control all package sources - export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - - # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism - export DOTNET_MULTILEVEL_LOOKUP=0 - - # Source Build uses DotNetCoreSdkDir variable - if [[ -n "$DotNetCoreSdkDir" ]]; then - export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" - fi - - - local dotnet_sdk_version=`ReadGlobalVersion "dotnet"` - local dotnet_root="" - - # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, - # otherwise install the dotnet CLI and SDK to repo local .dotnet directory to avoid potential permission issues. - if [[ -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then - dotnet_root="$DOTNET_INSTALL_DIR" - else - dotnet_root="$repo_root/.dotnet" - export DOTNET_INSTALL_DIR="$dotnet_root" - - if [[ "$restore" == true ]]; then - InstallDotNetSdk $dotnet_root $dotnet_sdk_version - fi - fi - - build_driver="$dotnet_root/dotnet" -} - -function InstallDotNetSdk { - local root=$1 - local version=$2 - - local install_script=`GetDotNetInstallScript $root` - - bash "$install_script" --version $version --install-dir $root - local lastexitcode=$? - - if [[ $lastexitcode != 0 ]]; then - echo "Failed to install dotnet SDK (exit code '$lastexitcode')." - ExitWithExitCode $lastexitcode - fi -} - -function GetDotNetInstallScript { - local root=$1 - local install_script="$root/dotnet-install.sh" - - if [[ ! -a "$install_script" ]]; then - mkdir -p "$root" - - # Use curl if available, otherwise use wget - if command -v curl > /dev/null; then - curl "https://dot.net/v1/dotnet-install.sh" -sSL --retry 10 --create-dirs -o "$install_script" - else - wget -q -O "$install_script" "https://dot.net/v1/dotnet-install.sh" - fi - fi - - # return value - echo "$install_script" -} - -function InitializeToolset { - local toolset_location_file="$toolset_dir/$toolset_version.txt" - - if [[ -a "$toolset_location_file" ]]; then - local path=`cat $toolset_location_file` - if [[ -a "$path" ]]; then - toolset_build_proj=$path - return - fi - fi - - if [[ "$restore" != true ]]; then - echo "Toolset version $toolsetVersion has not been restored." - ExitWithExitCode 2 - fi - - local toolset_restore_log="$log_dir/ToolsetRestore.binlog" - local proj="$toolset_dir/restore.proj" - - echo '' > $proj - - MSBuild "$proj /t:__WriteToolsetLocation /clp:None /bl:$toolset_restore_log /p:__ToolsetLocationOutputFile=$toolset_location_file" - local lastexitcode=$? - - if [[ $lastexitcode != 0 ]]; then - echo "Failed to restore toolset (exit code '$lastexitcode'). See log: $toolset_restore_log" - ExitWithExitCode $lastexitcode - fi - - toolset_build_proj=`cat $toolset_location_file` - - if [[ ! -a "$toolset_build_proj" ]]; then - echo "Invalid toolset path: $toolset_build_proj" - ExitWithExitCode 3 - fi -} - -function InitializeCustomToolset { - local script="$eng_root/RestoreToolset.sh" - - if [[ -a "$script" ]]; then - . "$script" - fi -} - -function InitializeTools { - InitializeDotNetCli - InitializeToolset - InitializeCustomToolset -} - -function ExitWithExitCode { - if [[ "$ci" == true && "$prepare_machine" == true ]]; then - StopProcesses - fi - exit $1 -} - -function StopProcesses { - echo "Killing running build processes..." - pkill -9 "dotnet" - pkill -9 "vbcscompiler" -} - -function MSBuild { - local msbuildArgs="msbuild /m /nologo /clp:Summary /v:$verbosity" - local extraArgs="$@" - - if [[ $warnaserror == true ]]; then - msbuildArgs="$msbuildArgs /warnaserror" - fi - - msbuildArgs="$msbuildArgs /nr:$nodereuse" - - #echo "$build_driver $msbuildArgs $extraArgs" - "$build_driver" $msbuildArgs $extraArgs - - return $? -} - -function InstallDarcCli { - local darc_cli_package_name="microsoft.dotnet.darc" - local uninstall_command=`$DOTNET_INSTALL_DIR/dotnet tool uninstall $darc_cli_package_name -g` - local tool_list=$($DOTNET_INSTALL_DIR/dotnet tool list -g) - if [[ $tool_list = *$darc_cli_package_name* ]]; then - echo $($DOTNET_INSTALL_DIR/dotnet tool uninstall $darc_cli_package_name -g) - fi - - echo "Installing Darc CLI version $toolset_version..." - echo "You may need to restart your command shell if this is the first dotnet tool you have installed." - echo $($DOTNET_INSTALL_DIR/dotnet tool install $darc_cli_package_name --version $toolset_version -v $verbosity -g) -} - -# HOME may not be defined in some scenarios, but it is required by NuGet -if [[ -z $HOME ]]; then - export HOME="$repo_root/artifacts/.home/" - mkdir -p "$HOME" -fi - -if [[ -z $NUGET_PACKAGES ]]; then - if [[ $ci == true ]]; then - export NUGET_PACKAGES="$repo_root/.packages" - else - export NUGET_PACKAGES="$HOME/.nuget/packages" - fi -fi - -mkdir -p "$toolset_dir" -mkdir -p "$log_dir" - -if [[ $ci == true ]]; then - mkdir -p "$temp_dir" - export TEMP="$temp_dir" - export TMP="$temp_dir" -fi - -InitializeTools \ No newline at end of file diff --git a/eng/common/native/install-cmake.ps1 b/eng/common/native/install-cmake.ps1 deleted file mode 100644 index 40fc9ac5591c..000000000000 --- a/eng/common/native/install-cmake.ps1 +++ /dev/null @@ -1,119 +0,0 @@ -<# -.SYNOPSIS -Install cmake native tool - -.DESCRIPTION -Install cmake native tool from Azure blob storage - -.PARAMETER InstallPath -Base directory to install native tool to - -.PARAMETER BaseUri -Base file directory or Url from which to acquire tool archives - -.PARAMETER CommonLibraryDirectory -Path to folder containing common library modules - -.PARAMETER Force -Force install of tools even if they previously exist - -.PARAMETER Clean -Don't install the tool, just clean up the current install of the tool - -.PARAMETER DownloadRetries -Total number of retry attempts - -.PARAMETER RetryWaitTimeInSeconds -Wait time between retry attempts in seconds - -.NOTES -Returns 0 if install succeeds, 1 otherwise -#> -[CmdletBinding(PositionalBinding=$false)] -Param ( - [Parameter(Mandatory=$True)] - [string] $InstallPath, - [Parameter(Mandatory=$True)] - [string] $BaseUri, - [Parameter(Mandatory=$True)] - [string] $Version, - [string] $CommonLibraryDirectory = $PSScriptRoot, - [switch] $Force = $False, - [switch] $Clean = $False, - [int] $DownloadRetries = 5, - [int] $RetryWaitTimeInSeconds = 30 -) - -# Import common library modules -Import-Module -Name (Join-Path $CommonLibraryDirectory "CommonLibrary.psm1") - -try { - # Define verbose switch if undefined - $Verbose = $VerbosePreference -Eq "Continue" - - $ToolName = "cmake" - - $Arch = CommonLibrary\Get-MachineArchitecture - $ToolOs = "win64" - if($Arch -Eq "x32") { - $ToolOs = "win32" - } - $ToolNameMoniker = "$ToolName-$Version-$ToolOs-$Arch" - $ToolInstallDirectory = Join-Path $InstallPath "$ToolName\$Version\" - $ToolFilePath = Join-Path $ToolInstallDirectory "$ToolNameMoniker\bin\$ToolName.exe" - $ShimPath = Join-Path $InstallPath "$ToolName.cmd" - $Uri = "$BaseUri/windows/$Toolname/$ToolNameMoniker.zip" - - if ($Clean) { - Write-Host "Cleaning $ToolInstallDirectory" - if (Test-Path $ToolInstallDirectory) { - Remove-Item $ToolInstallDirectory -Force -Recurse - } - Write-Host "Cleaning $ShimPath" - if (Test-Path $ShimPath) { - Remove-Item $ShimPath -Force - } - $ToolTempPath = CommonLibrary\Get-TempPathFilename -Path $Uri - Write-Host "Cleaning $ToolTempPath" - if (Test-Path $ToolTempPath) { - Remove-Item $ToolTempPath -Force - } - exit 0 - } - - # Install tool - if ((Test-Path $ToolFilePath) -And (-Not $Force)) { - Write-Verbose "$ToolName ($Version) already exists, skipping install" - } - else { - $InstallStatus = CommonLibrary\DownloadAndExtract -Uri $Uri ` - -InstallDirectory $ToolInstallDirectory ` - -Force:$Force ` - -DownloadRetries $DownloadRetries ` - -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` - -Verbose:$Verbose - - if ($InstallStatus -Eq $False) { - Write-Error "Installation failed" - exit 1 - } - } - # Generate shim - # Always rewrite shims so that we are referencing the expected version - $GenerateShimStatus = CommonLibrary\New-ScriptShim -ShimPath $ShimPath ` - -ToolFilePath $ToolFilePath ` - -Force ` - -Verbose:$Verbose - - if ($GenerateShimStatus -Eq $False) { - Write-Error "Generate shim failed" - return 1 - } - - exit 0 -} -catch { - Write-Host $_ - Write-Host $_.Exception - exit 1 -} \ No newline at end of file diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml index f5b3fa13e52a..e075e8b78bf5 100644 --- a/eng/common/templates/phases/base.yml +++ b/eng/common/templates/phases/base.yml @@ -7,6 +7,14 @@ parameters: # Optional: name of the phase (not specifying phase name may cause name collisions) name: '' + # Optional: display name of the phase + displayName: '' + + # Optional: condition for the job to run + condition: '' + + # Optional: dependencies of the phase + dependsOn: '' # Required: A defined YAML queue queue: {} @@ -17,6 +25,10 @@ parameters: # Optional: variables variables: {} + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + ## Telemetry variables # Optional: enable sending telemetry @@ -38,10 +50,19 @@ parameters: phases: - phase: ${{ parameters.name }} + ${{ if ne(parameters.displayName, '') }}: + displayName: ${{ parameters.displayName }} + + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + + ${{ if ne(parameters.dependsOn, '') }}: + dependsOn: ${{ parameters.dependsOn }} + queue: ${{ parameters.queue }} ${{ if ne(parameters.variables, '') }}: - variables: + variables: ${{ insert }}: ${{ parameters.variables }} steps: @@ -56,13 +77,15 @@ phases: buildConfig: $(_HelixBuildConfig) helixSource: $(_HelixSource) helixType: $(_HelixType) + runAsPublic: ${{ parameters.runAsPublic }} - ${{ if eq(parameters.enableMicrobuild, 'true') }}: # Internal only resource, and Microbuild signing shouldn't be applied to PRs. - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: MicroBuildSigningPlugin@2 displayName: Install MicroBuild plugin inputs: + version: 1.1.35 signType: $(_SignType) zipSources: false feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json @@ -77,7 +100,7 @@ phases: - ${{ if eq(parameters.enableMicrobuild, 'true') }}: # Internal only resources - - ${{ if ne(variables['System.TeamProject'], 'public') }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: MicroBuildCleanup@1 displayName: Execute Microbuild cleanup tasks condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) @@ -90,7 +113,7 @@ phases: helixSource: $(_HelixSource) helixType: $(_HelixType) - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: CopyFiles@2 displayName: Gather Asset Manifests inputs: diff --git a/eng/common/templates/phases/publish-build-asset.yml b/eng/common/templates/phases/publish-build-asset.yml deleted file mode 100644 index d7739dc73da3..000000000000 --- a/eng/common/templates/phases/publish-build-asset.yml +++ /dev/null @@ -1,26 +0,0 @@ -parameters: - dependsOn: '' - queue: {} -phases: - - phase: Push to B.A.R. - dependsOn: ${{ parameters.dependsOn }} - queue: ${{ parameters.queue }} - steps: - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download artifact - inputs: - artifactName: AssetManifests - downloadPath: '$(Build.StagingDirectory)/Download' - condition: succeeded() - - task: AzureKeyVault@1 - inputs: - azureSubscription: 'DotNet-Engineering-Services_KeyVault' - KeyVaultName: EngKeyVault - SecretsFilter: 'MaestroAccessToken' - condition: succeeded() - - script: eng\common\publishbuildassets.cmd - /p:ManifestZipFilePath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-int.westus2.cloudapp.azure.com - displayName: Push Build Assets \ No newline at end of file diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml index 08f4949cb135..0df6203b506f 100644 --- a/eng/common/templates/phases/publish-build-assets.yml +++ b/eng/common/templates/phases/publish-build-assets.yml @@ -4,15 +4,16 @@ parameters: configuration: 'Debug' condition: succeeded() continueOnError: false + runAsPublic: false phases: - phase: Asset_Registry_Publish displayName: Publish to Build Asset Registry dependsOn: ${{ parameters.dependsOn }} queue: ${{ parameters.queue }} variables: - config: ${{ parameters.configuration }} + _BuildConfig: ${{ parameters.configuration }} steps: - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: DownloadBuildArtifacts@0 displayName: Download artifact inputs: @@ -28,10 +29,18 @@ phases: condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - script: eng\common\publishbuildassets.cmd + -configuration $(_BuildConfig) /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com - /p:Configuration=$(config) displayName: Publish Build Assets condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_Asset_Registry_Publish + continueOnError: true + condition: always() diff --git a/eng/common/templates/phases/push-build-asset.yml b/eng/common/templates/phases/push-build-asset.yml deleted file mode 100644 index 1aa1203c51e0..000000000000 --- a/eng/common/templates/phases/push-build-asset.yml +++ /dev/null @@ -1,26 +0,0 @@ -parameters: - dependsOn: '' - queue: {} -phases: - - phase: Push to B.A.R. - dependsOn: ${{ parameters.dependsOn }} - queue: ${{ parameters.queue }} - steps: - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download artifact - inputs: - artifactName: AssetManifests - downloadPath: '$(Build.StagingDirectory)/Download' - condition: succeeded() - - task: AzureKeyVault@1 - inputs: - azureSubscription: 'DotNet-Engineering-Services_KeyVault' - KeyVaultName: EngKeyVault - SecretsFilter: 'MaestroAccessToken' - condition: succeeded() - - script: eng\common\pushbuildassets.cmd - /p:ManifestZipFilePath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-int.westus2.cloudapp.azure.com - displayName: Push Build Assets \ No newline at end of file diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml index f14546730e31..6bbebd30cbb6 100644 --- a/eng/common/templates/steps/helix-publish.yml +++ b/eng/common/templates/steps/helix-publish.yml @@ -9,6 +9,9 @@ parameters: WorkItemDirectory: '' WorkItemCommand: '' CorrelationPayloadDirectory: '' + XUnitProjects: '' + XUnitTargetFramework: '' + XUnitRunnerVersion: '' IncludeDotNetCli: false DotNetCliPackageType: '' DotNetCliVersion: '' @@ -23,7 +26,7 @@ steps: command: custom projects: eng/common/helixpublish.proj custom: msbuild - arguments: '/t:test /p:Language=msbuild' + arguments: '/t:test /p:Language=msbuild /bl:$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\SendToHelix.binlog' displayName: Send job to Helix env: HelixSource: ${{ parameters.HelixSource }} @@ -35,6 +38,9 @@ steps: HelixPostCommands: ${{ parameters.HelixPostCommands }} WorkItemDirectory: ${{ parameters.WorkItemDirectory }} WorkItemCommand: ${{ parameters.WorkItemCommand }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitTargetFramework: ${{ parameters.XUnitTargetFramework }} IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} DotNetCliVersion: ${{ parameters.DotNetCliVersion }} diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml index 696956af2292..07f1185d17e5 100644 --- a/eng/common/templates/steps/telemetry-start.yml +++ b/eng/common/templates/steps/telemetry-start.yml @@ -2,9 +2,10 @@ parameters: helixSource: 'undefined_defaulted_in_telemetry.yml' helixType: 'undefined_defaulted_in_telemetry.yml' buildConfig: '' + runAsPublic: false steps: -- ${{ if not(eq(variables['System.TeamProject'], 'public')) }}: +- ${{ if and(eq(parameters.runAsPublic, 'false'), not(eq(variables['System.TeamProject'], 'public'))) }}: - task: AzureKeyVault@1 inputs: azureSubscription: 'HelixProd_KeyVault' diff --git a/global.json b/global.json index 7ebfe0137669..fc34ab73451f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18526.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18563.21" } -} \ No newline at end of file +} From f562168640909c740e72c100575530f8fdf929af Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 14 Nov 2018 13:55:32 +0000 Subject: [PATCH 0193/2702] Update dependencies from https://github.com/dotnet/arcade build 341 (#182) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18564.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f0d8006c0264..80d3a24cda14 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 179f64a9add52c37b4d441f12285da4b17389a82 + c8973913c1299c9e1be5e6f94411d6bfdd9617b2 diff --git a/global.json b/global.json index fc34ab73451f..1d90db6b93e6 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18563.21" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18564.4" } } From 8f877fedf12288a4dbcdb63396321d54f61f3a6d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 15 Nov 2018 02:21:04 +0000 Subject: [PATCH 0194/2702] Update dependencies from https://github.com/dotnet/arcade build 347 (#183) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18564.20 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 80d3a24cda14..ad06d8c7fd0e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - c8973913c1299c9e1be5e6f94411d6bfdd9617b2 + 069237d9a7e83bed62c9f664228125b95ddf91f6 diff --git a/global.json b/global.json index 1d90db6b93e6..463bb1ef7413 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18564.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18564.20" } } From 11f4b744edc15fe4904a73f1fe1944989c4e65af Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 15 Nov 2018 13:58:07 +0000 Subject: [PATCH 0195/2702] Update dependencies from https://github.com/dotnet/arcade build 351 (#184) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18565.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ad06d8c7fd0e..3f8a19edaa1d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 069237d9a7e83bed62c9f664228125b95ddf91f6 + 49f79a8b177d7aa506ae878d502a3de63662a528 diff --git a/global.json b/global.json index 463bb1ef7413..453b40426c22 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18564.20" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18565.1" } } From 13d76e1472030f0ea42c37960101bcd7fd0a2b15 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 15 Nov 2018 17:45:54 +0000 Subject: [PATCH 0196/2702] Update dependencies from https://github.com/dotnet/arcade build 354 (#185) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18565.4 --- eng/Version.Details.xml | 4 ++-- eng/common/PublishBuildAssets.cmd | 2 +- eng/common/build.ps1 | 3 ++- global.json | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3f8a19edaa1d..aa6fd2896a05 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 49f79a8b177d7aa506ae878d502a3de63662a528 + 440b2dae3a206b28f6aba727b7818873358fcc0a diff --git a/eng/common/PublishBuildAssets.cmd b/eng/common/PublishBuildAssets.cmd index 4f9d54d028a5..399ca0bd32f1 100644 --- a/eng/common/PublishBuildAssets.cmd +++ b/eng/common/PublishBuildAssets.cmd @@ -1,3 +1,3 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -publishBuildAssets %*" +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -msbuildEngine dotnet -restore -execute /p:PublishBuildAssets=true /p:SdkTaskProjects=PublishBuildAssets.proj %*" exit /b %ErrorLevel% diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index ca45b3db719b..76f108fd5d84 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -6,6 +6,7 @@ Param( [string] $msbuildEngine = $null, [bool] $warnaserror = $true, [bool] $nodereuse = $true, + [switch] $execute, [switch] $restore, [switch] $deployDeps, [switch] $build, @@ -88,7 +89,7 @@ try { /p:PerformanceTest=$performanceTest ` /p:Sign=$sign ` /p:Publish=$publish ` - /p:PublishBuildAssets=$publishBuildAssets ` + /p:Execute=$execute ` /p:ContinuousIntegrationBuild=$ci ` @properties diff --git a/global.json b/global.json index 453b40426c22..e0e9f8ed0d5f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18565.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18565.4" } } From d71d90ab89df2d17876c50a3a85fd0a8aebb48bf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 15 Nov 2018 20:29:10 +0000 Subject: [PATCH 0197/2702] Update dependencies from https://github.com/dotnet/arcade build 355 (#186) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18565.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index aa6fd2896a05..93de4a0ab733 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 440b2dae3a206b28f6aba727b7818873358fcc0a + e5122d1d6f4f32ae987a16607e29bf048eb4312e diff --git a/global.json b/global.json index e0e9f8ed0d5f..26810474b688 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18565.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18565.5" } } From 8d4777ef2a45441e7804a7872f7cdf746c27f60b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 15 Nov 2018 23:37:45 +0000 Subject: [PATCH 0198/2702] Update dependencies from https://github.com/dotnet/arcade build 364 (#187) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18565.8 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 93de4a0ab733..0fb7ebfe1c29 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e5122d1d6f4f32ae987a16607e29bf048eb4312e + 429a1386c59749da52ed94737f67228ec5843516 diff --git a/global.json b/global.json index 26810474b688..951ee1e9b2d2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18565.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18565.8" } } From 7376c1d170cdfbb86da48869d982f0966613ec82 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 16 Nov 2018 14:18:24 +0000 Subject: [PATCH 0199/2702] Update dependency files (#188) * Update dependencies from https://github.com/dotnet/arcade build 365 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18565.9 * Update dependencies from https://github.com/dotnet/arcade build 369 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18566.1 --- eng/Version.Details.xml | 4 ++-- eng/common/templates/steps/helix-publish.yml | 3 ++- global.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0fb7ebfe1c29..6eb4e53de412 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 429a1386c59749da52ed94737f67228ec5843516 + 8808ed129a2acb9450dc04c55b8991b2618bd357 diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml index 6bbebd30cbb6..f261d0ad0eac 100644 --- a/eng/common/templates/steps/helix-publish.yml +++ b/eng/common/templates/steps/helix-publish.yml @@ -26,7 +26,7 @@ steps: command: custom projects: eng/common/helixpublish.proj custom: msbuild - arguments: '/t:test /p:Language=msbuild /bl:$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\SendToHelix.binlog' + arguments: '/t:test /p:Language=msbuild /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog' displayName: Send job to Helix env: HelixSource: ${{ parameters.HelixSource }} @@ -41,6 +41,7 @@ steps: CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} XUnitProjects: ${{ parameters.XUnitProjects }} XUnitTargetFramework: ${{ parameters.XUnitTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} DotNetCliVersion: ${{ parameters.DotNetCliVersion }} diff --git a/global.json b/global.json index 951ee1e9b2d2..2ab2eaf24c88 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18565.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18566.1" } } From 2a522a26a84362470575d7d0950649b7e8614721 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 16 Nov 2018 18:05:13 +0000 Subject: [PATCH 0200/2702] Update dependencies from https://github.com/dotnet/arcade build 373 (#189) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18566.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6eb4e53de412..de10f0e6a7c2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 8808ed129a2acb9450dc04c55b8991b2618bd357 + 995d5bc5507f25475368368ecd6fef4252e8232d diff --git a/global.json b/global.json index 2ab2eaf24c88..69f63702fede 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18566.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18566.2" } } From 6b5e0000db2c2792af3f970bf2937a5696b12008 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 16 Nov 2018 21:47:41 +0000 Subject: [PATCH 0201/2702] Update dependencies from https://github.com/dotnet/arcade build 376 (#190) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18566.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index de10f0e6a7c2..d5c00e1b1d19 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 995d5bc5507f25475368368ecd6fef4252e8232d + efbd34919d660784e0626a28edb96c4637e9ae3c diff --git a/global.json b/global.json index 69f63702fede..a79bfbe7d4e3 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18566.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18566.4" } } From 60ebfab6539a744256f98dd835fffa311818835c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 16 Nov 2018 22:48:36 +0000 Subject: [PATCH 0202/2702] Update dependency files (#191) * Update dependencies from https://github.com/dotnet/arcade build 378 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18566.5 * Update dependencies from https://github.com/dotnet/arcade build 379 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18566.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d5c00e1b1d19..03f264002182 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - efbd34919d660784e0626a28edb96c4637e9ae3c + b2252875c3d04fa0daae84a7c5a4929d45baaf4a diff --git a/global.json b/global.json index a79bfbe7d4e3..bee7e3659ac2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18566.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18566.6" } } From 5919c9b32d6e7c3ef6479bde2a55be8a90d4adc4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 17 Nov 2018 13:47:35 +0000 Subject: [PATCH 0203/2702] Update dependencies from https://github.com/dotnet/arcade build 382 (#192) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18567.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 03f264002182..d01608a81b06 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b2252875c3d04fa0daae84a7c5a4929d45baaf4a + 786e4a4fadcd9f6d9291eaac455b8718ee7dc5c5 diff --git a/global.json b/global.json index bee7e3659ac2..8baa78a2be61 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18566.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18567.1" } } From e16dd8f57b1347119b13ddb641a8b992540be947 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 18 Nov 2018 14:19:42 +0000 Subject: [PATCH 0204/2702] Update dependencies from https://github.com/dotnet/arcade build 385 (#193) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18568.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d01608a81b06..62cc217448e8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 786e4a4fadcd9f6d9291eaac455b8718ee7dc5c5 + d6456030b7a70d464f523355fe68918c99c7c57d diff --git a/global.json b/global.json index 8baa78a2be61..82a350f27574 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18567.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18568.1" } } From 813bb9ad241d3476337cad795dec81f5ed2321f7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 19 Nov 2018 14:15:46 +0000 Subject: [PATCH 0205/2702] Update dependencies from https://github.com/dotnet/arcade build 387 (#194) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18569.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 62cc217448e8..54af6ea5a5d4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d6456030b7a70d464f523355fe68918c99c7c57d + a94a817e6d50e5ba15cfcb32b30b35bf90078251 diff --git a/global.json b/global.json index 82a350f27574..ea933fc4a46f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18568.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18569.1" } } From 5a6f73db5d1e67e8f016a70242493c1696e227bd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 19 Nov 2018 18:53:54 +0000 Subject: [PATCH 0206/2702] Update dependency files (#195) * Update dependencies from https://github.com/dotnet/arcade build 390 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18569.2 * Update dependencies from https://github.com/dotnet/arcade build 391 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18569.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 54af6ea5a5d4..efa6c8f928dc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - a94a817e6d50e5ba15cfcb32b30b35bf90078251 + f350a8f8eca62dfd0243dc6fb2fac0a9b124a757 diff --git a/global.json b/global.json index ea933fc4a46f..8ff3d0a961ee 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18569.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18569.3" } } From 273e804226dbb13fdacc78787a8562e4c5d58ffd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 20 Nov 2018 00:37:32 +0000 Subject: [PATCH 0207/2702] Update dependencies from https://github.com/dotnet/arcade build 402 (#196) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18569.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index efa6c8f928dc..aec3dbd1d597 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - f350a8f8eca62dfd0243dc6fb2fac0a9b124a757 + 578524df5ce9f5785745727d406d4b7731a507cb diff --git a/global.json b/global.json index 8ff3d0a961ee..19530efe299b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18569.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18569.4" } } From 4d20148600b9cea45cf1608c37818e7cda4e8d3a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 20 Nov 2018 16:45:47 +0000 Subject: [PATCH 0208/2702] Update dependencies from https://github.com/dotnet/arcade build 408 (#197) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18570.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index aec3dbd1d597..f56d8a13dd51 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 578524df5ce9f5785745727d406d4b7731a507cb + 991182ca723410c7f4898368a67744943e7891fb diff --git a/global.json b/global.json index 19530efe299b..c7f38a73f1d7 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18569.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.2" } } From 1a8d0571085e1b6e330e18d295472644ffa551d0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 20 Nov 2018 18:37:51 +0000 Subject: [PATCH 0209/2702] Update dependencies from https://github.com/dotnet/arcade build 411 (#198) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18570.8 --- eng/Version.Details.xml | 4 +- eng/common/templates/job/job.yml | 194 ++++++++++++++++++ .../templates/job/publish-build-assets.yml | 51 +++++ eng/common/templates/jobs/jobs.yml | 107 ++++++++++ global.json | 2 +- 5 files changed, 355 insertions(+), 3 deletions(-) create mode 100644 eng/common/templates/job/job.yml create mode 100644 eng/common/templates/job/publish-build-assets.yml create mode 100644 eng/common/templates/jobs/jobs.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f56d8a13dd51..8577d4235679 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 991182ca723410c7f4898368a67744943e7891fb + 3ce5be7f4309861b21036de6546822cbbbb389c3 diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml new file mode 100644 index 000000000000..e4c5b344fade --- /dev/null +++ b/eng/common/templates/job/job.yml @@ -0,0 +1,194 @@ +parameters: +# Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + cancelTimeoutInMinutes: '' + + condition: '' + + continueOnError: false + + container: '' + + dependsOn: '' + + displayName: '' + + steps: [] + + pool: '' + + strategy: '' + + timeoutInMinutes: '' + + variables: '' + + workspace: '' + +# Job base template specific parameters + # Optional: Enable installing Microbuild plugin + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _TeamName - the name of your team + # _SignType - 'test' or 'real' + enableMicrobuild: false + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: Enable publishing to the build asset registry + enablePublishBuildAssets: false + + # Optional: Include PublishTestResults task + enablePublishTestResults: false + + # Optional: enable sending telemetry + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _HelixBuildConfig - differentiate between Debug, Release, other + # _HelixSource - Example: build/product + # _HelixType - Example: official/dotnet/arcade/$(Build.SourceBranch) + enableTelemetry: false + + # Optional: If specified, then automatically derive "_HelixSource" variable for telemetry + helixRepo: '' + + # Optional: Define the type for helix telemetry (must end in '/') + helixType: build/product/ + + # Required: name of the job + name: '' + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +jobs: +- job: ${{ parameters.name }} + + ${{ if ne(parameters.cancelTimeoutInMinutes, '') }}: + cancelTimeoutInMinutes: ${{ parameters.cancelTimeoutInMinutes }} + + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + + ${{ if ne(parameters.container, '') }}: + container: ${{ parameters.container }} + + ${{ if ne(parameters.continueOnError, '') }}: + continueOnError: ${{ parameters.continueOnError }} + + ${{ if ne(parameters.dependsOn, '') }}: + dependsOn: ${{ parameters.dependsOn }} + + ${{ if ne(parameters.displayName, '') }}: + displayName: ${{ parameters.displayName }} + + ${{ if ne(parameters.pool, '') }}: + pool: ${{ parameters.pool }} + + ${{ if ne(parameters.strategy, '') }}: + strategy: ${{ parameters.strategy }} + + ${{ if ne(parameters.timeoutInMinutes, '') }}: + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + ${{ if ne(parameters.variables, '') }}: + variables: + - ${{ each variable in parameters.variables }}: + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + # Add additional variables + - ${{ if and(ne(parameters.helixRepo, ''), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notIn(variables['Build.Reason'], 'PullRequest')) }}: + - name: _HelixSource + value: official/${{ parameters.helixRepo }}/$(Build.SourceBranch) + - ${{ if and(ne(parameters.helixRepo, ''), or(ne(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest'))) }}: + - name: _HelixSource + value: pr/${{ parameters.helixRepo }}/$(Build.SourceBranch) + - name: _HelixType + value: ${{ parameters.helixType }} + - name: _HelixBuildConfig + value: $(_BuildConfig) + + ${{ if ne(parameters.workspace, '') }}: + workspace: ${{ parameters.workspace }} + + steps: + - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - template: /eng/common/templates/steps/telemetry-start.yml + parameters: + buildConfig: $(_HelixBuildConfig) + helixSource: $(_HelixSource) + helixType: $(_HelixType) + runAsPublic: ${{ parameters.runAsPublic }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildSigningPlugin@2 + displayName: Install MicroBuild plugin + inputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + env: + TeamName: $(_TeamName) + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + + - ${{ each step in parameters.steps }}: + - ${{ step }} + + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: MicroBuildCleanup@1 + displayName: Execute Microbuild cleanup tasks + condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + env: + TeamName: $(_TeamName) + + - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - template: /eng/common/templates/steps/telemetry-end.yml + parameters: + helixSource: $(_HelixSource) + helixType: $(_HelixType) + + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_$(Agent.JobName) + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enablePublishTestResults, 'true') }}: + - task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + continueOnError: true + condition: always() + + - ${{ if and(eq(parameters.enablePublishBuildAssets, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.StagingDirectory)/AssetManifests' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + - task: PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) \ No newline at end of file diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml new file mode 100644 index 000000000000..b40016f6fc1c --- /dev/null +++ b/eng/common/templates/job/publish-build-assets.yml @@ -0,0 +1,51 @@ +parameters: + # Optional: dependencies of the job + dependsOn: '' + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: {} + + configuration: 'Debug' + + # Optional: condition for the job to run + condition: '' + + # Optional: 'true' if future jobs should run even if this job fails + continueOnError: false + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + +jobs: +- job: Asset_Registry_Publish + + dependsOn: ${{ parameters.dependsOn }} + + displayName: Publish to Build Asset Registry + + pool: ${{ parameters.pool }} + + variables: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - name: _BuildConfig + value: ${{ parameters.configuration }} + - group: Publish-Build-Assets + + steps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download artifact + inputs: + artifactName: AssetManifests + downloadPath: '$(Build.StagingDirectory)/Download' + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} + - script: eng\common\publishbuildassets.cmd + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + /p:Configuration=$(_BuildConfig) + displayName: Publish Build Assets + condition: ${{ parameters.condition }} + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml new file mode 100644 index 000000000000..e93febb4c7c6 --- /dev/null +++ b/eng/common/templates/jobs/jobs.yml @@ -0,0 +1,107 @@ +parameters: + # Optional: 'true' if failures in job.yml job should not fail the job + continueOnError: false + + # Optional: Enable installing Microbuild plugin + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _TeamName - the name of your team + # _SignType - 'test' or 'real' + enableMicrobuild: false + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: Enable publishing to the build asset registry + enablePublishBuildAssets: false + + # Optional: Include PublishTestResults task + enablePublishTestResults: false + + # Optional: enable sending telemetry + # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix + # _HelixBuildConfig - differentiate between Debug, Release, other + # _HelixSource - Example: build/product/ + # _HelixType - Example: official/dotnet/arcade/$(Build.SourceBranch) + enableTelemetry: false + + # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job + jobs: [] + + # Optional: If specified, then automatically derive "_HelixSource" variable for telemetry + helixRepo: '' + + # Optional: Define the type for helix telemetry (must end in '/') + helixType: build/product/ + + # Optional: Override automatically derived dependsOn value for "publish build assets" job + publishBuildAssetsDependsOn: '' + + # Optional: should run as a public build even in the internal project + # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + runAsPublic: false + +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + +jobs: +- ${{ each job in parameters.jobs }}: + - template: ../job/job.yml + parameters: + # pass along parameters + continueOnError: ${{ parameters.continueOnError }} + + enableMicrobuild: ${{ parameters.enableMicrobuild }} + + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} + + enablePublishBuildAssets: ${{ parameters.enablePublishBuildAssets }} + + enablePublishTestResults: ${{ parameters.enablePublishTestResults }} + + enableTelemetry: ${{ parameters.enableTelemetry }} + + runAsPublic: ${{ parameters.runAsPublic }} + + # pass along job properties + cancelTimeoutInMinutes: ${{ job.cancelTimeoutInMinutes }} + + condition: ${{ job.condition }} + + container: ${{ job.container }} + + dependsOn: ${{ job.dependsOn }} + + displayName: ${{ job.displayName }} + + helixRepo: ${{ parameters.helixRepo }} + + helixType: ${{ parameters.helixType }} + + name: ${{ job.job }} + + pool: ${{ job.pool }} + + strategy: ${{ job.strategy }} + + timeoutInMinutes: ${{ job.timeoutInMinutes }} + + variables: ${{ job.variables }} + + workspace: ${{ job.workspace }} + + steps: ${{ job.steps }} + +- ${{ if and(eq(parameters.enablePublishBuildAssets, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - template: ../job/publish-build-assets.yml + parameters: + continueOnError: ${{ parameters.continueOnError }} + dependsOn: + - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.publishBuildAssetsDependsOn }}: + - ${{ job.job }} + - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.jobs }}: + - ${{ job.job }} + pool: + vmImage: vs2017-win2016 + runAsPublic: ${{ parameters.runAsPublic }} diff --git a/global.json b/global.json index c7f38a73f1d7..318ab9308457 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.8" } } From 3ad33b331d9557a48c8747128e8906657675a3f7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 20 Nov 2018 20:01:07 +0000 Subject: [PATCH 0210/2702] Update dependencies from https://github.com/dotnet/arcade build 414 (#199) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18570.9 --- eng/Version.Details.xml | 4 ++-- eng/common/helixpublish.proj | 11 +++++++++++ eng/common/templates/steps/helix-publish.yml | 2 +- global.json | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8577d4235679..8ee719eabcc9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3ce5be7f4309861b21036de6546822cbbbb389c3 + d0d4619c658dd39555282fffcc9bb8a17117bc37 diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj index 364af7766865..b64646fbf2aa 100644 --- a/eng/common/helixpublish.proj +++ b/eng/common/helixpublish.proj @@ -1,5 +1,10 @@ + + msbuild + Test + + %(Identity) @@ -12,4 +17,10 @@ $(WorkItemCommand) + + + + + + diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml index f261d0ad0eac..6dada380ceac 100644 --- a/eng/common/templates/steps/helix-publish.yml +++ b/eng/common/templates/steps/helix-publish.yml @@ -26,7 +26,7 @@ steps: command: custom projects: eng/common/helixpublish.proj custom: msbuild - arguments: '/t:test /p:Language=msbuild /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog' + arguments: '/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog' displayName: Send job to Helix env: HelixSource: ${{ parameters.HelixSource }} diff --git a/global.json b/global.json index 318ab9308457..43f7c75668b8 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.9" } } From 6c89f6c5157c80e0234946a93f9fee151a56461a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 20 Nov 2018 20:40:42 +0000 Subject: [PATCH 0211/2702] Update dependencies from https://github.com/dotnet/arcade build 415 (#200) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18570.10 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8ee719eabcc9..31a43edac15c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d0d4619c658dd39555282fffcc9bb8a17117bc37 + d7e189c6182ec601a086e70ba5a88f1b837f12c3 diff --git a/global.json b/global.json index 43f7c75668b8..cfcd252f25b1 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.10" } } From 7ba630a04f1c8f07621b0ec757fdec51211ff42a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 20 Nov 2018 23:31:43 +0000 Subject: [PATCH 0212/2702] Update dependencies from https://github.com/dotnet/arcade build 420 (#202) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18570.17 --- eng/Version.Details.xml | 4 +- eng/common/helixpublish.proj | 3 +- eng/common/templates/job/job.yml | 42 ++++++++---------- eng/common/templates/jobs/jobs.yml | 44 +++---------------- eng/common/templates/steps/telemetry-end.yml | 4 -- .../templates/steps/telemetry-start.yml | 9 ++-- global.json | 2 +- 7 files changed, 33 insertions(+), 75 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 31a43edac15c..703ee4d7ea98 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d7e189c6182ec601a086e70ba5a88f1b837f12c3 + 93b39c3209a5929662190c7e85b43b4f2a32bab1 diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj index b64646fbf2aa..72668a13374f 100644 --- a/eng/common/helixpublish.proj +++ b/eng/common/helixpublish.proj @@ -1,8 +1,7 @@ - + msbuild - Test diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index e4c5b344fade..9f3e9389c8ef 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -20,7 +20,7 @@ parameters: timeoutInMinutes: '' - variables: '' + variables: [] workspace: '' @@ -93,25 +93,24 @@ jobs: ${{ if ne(parameters.timeoutInMinutes, '') }}: timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - ${{ if ne(parameters.variables, '') }}: - variables: - - ${{ each variable in parameters.variables }}: - - ${{ if ne(variable.name, '') }}: - - name: ${{ variable.name }} - value: ${{ variable.value }} - - ${{ if ne(variable.group, '') }}: - - group: ${{ variable.group }} - # Add additional variables - - ${{ if and(ne(parameters.helixRepo, ''), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notIn(variables['Build.Reason'], 'PullRequest')) }}: - - name: _HelixSource - value: official/${{ parameters.helixRepo }}/$(Build.SourceBranch) - - ${{ if and(ne(parameters.helixRepo, ''), or(ne(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest'))) }}: - - name: _HelixSource - value: pr/${{ parameters.helixRepo }}/$(Build.SourceBranch) - - name: _HelixType - value: ${{ parameters.helixType }} - - name: _HelixBuildConfig - value: $(_BuildConfig) + variables: + - ${{ each variable in parameters.variables }}: + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + # Add additional variables + - ${{ if and(ne(parameters.helixRepo, ''), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notIn(variables['Build.Reason'], 'PullRequest')) }}: + - name: _HelixSource + value: official/${{ parameters.helixRepo }}/$(Build.SourceBranch) + - ${{ if and(ne(parameters.helixRepo, ''), or(ne(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest'))) }}: + - name: _HelixSource + value: pr/${{ parameters.helixRepo }}/$(Build.SourceBranch) + - name: _HelixType + value: ${{ parameters.helixType }} + - name: _HelixBuildConfig + value: $(_BuildConfig) ${{ if ne(parameters.workspace, '') }}: workspace: ${{ parameters.workspace }} @@ -152,9 +151,6 @@ jobs: - ${{ if eq(parameters.enableTelemetry, 'true') }}: - template: /eng/common/templates/steps/telemetry-end.yml - parameters: - helixSource: $(_HelixSource) - helixType: $(_HelixType) - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - task: PublishBuildArtifacts@1 diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index e93febb4c7c6..6aa55e3afc3b 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -48,49 +48,17 @@ jobs: - template: ../job/job.yml parameters: # pass along parameters - continueOnError: ${{ parameters.continueOnError }} - - enableMicrobuild: ${{ parameters.enableMicrobuild }} - - enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} - - enablePublishBuildAssets: ${{ parameters.enablePublishBuildAssets }} - - enablePublishTestResults: ${{ parameters.enablePublishTestResults }} - - enableTelemetry: ${{ parameters.enableTelemetry }} - - runAsPublic: ${{ parameters.runAsPublic }} + ${{ each parameter in parameters }}: + ${{ if ne(parameter.key, 'jobs') }}: + ${{ parameter.key }}: ${{ parameter.value }} # pass along job properties - cancelTimeoutInMinutes: ${{ job.cancelTimeoutInMinutes }} - - condition: ${{ job.condition }} - - container: ${{ job.container }} - - dependsOn: ${{ job.dependsOn }} - - displayName: ${{ job.displayName }} - - helixRepo: ${{ parameters.helixRepo }} - - helixType: ${{ parameters.helixType }} + ${{ each property in job }}: + ${{ if ne(property.key, 'job') }}: + ${{ property.key }}: ${{ property.value }} name: ${{ job.job }} - pool: ${{ job.pool }} - - strategy: ${{ job.strategy }} - - timeoutInMinutes: ${{ job.timeoutInMinutes }} - - variables: ${{ job.variables }} - - workspace: ${{ job.workspace }} - - steps: ${{ job.steps }} - - ${{ if and(eq(parameters.enablePublishBuildAssets, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - template: ../job/publish-build-assets.yml parameters: diff --git a/eng/common/templates/steps/telemetry-end.yml b/eng/common/templates/steps/telemetry-end.yml index 9cfe3608b8e8..9b61481e7e19 100644 --- a/eng/common/templates/steps/telemetry-end.yml +++ b/eng/common/templates/steps/telemetry-end.yml @@ -1,7 +1,3 @@ -parameters: - helixSource: 'undefined_defaulted_in_telemetry.yml' - helixType: 'undefined_defaulted_in_telemetry.yml' - steps: - bash: | if [ "$AGENT_JOBSTATUS" = "Succeeded" ] || [ "$AGENT_JOBSTATUS" = "PartiallySucceeded" ]; then diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml index 07f1185d17e5..79c128c5de87 100644 --- a/eng/common/templates/steps/telemetry-start.yml +++ b/eng/common/templates/steps/telemetry-start.yml @@ -31,17 +31,16 @@ steps: } JobListStuff + cat $jobInfo + # create a temporary file for curl output res=`mktemp` - accessTokenParameter='' - if [[ ! "$HelixApiAccessToken" == "" ]]; then - accessTokenParameter="?access_token=$HelixApiAccessToken" - fi + accessTokenParameter="?access_token=$HelixApiAccessToken" curlResult=` cat $jobInfo |\ - curl --verbose --output $res --write-out "%{http_code}" \ + curl --trace - --verbose --output $res --write-out "%{http_code}" \ -H 'Content-Type: application/json' \ -X POST "https://helix.dot.net/api/2018-03-14/telemetry/job$accessTokenParameter" -d @-` curlStatus=$? diff --git a/global.json b/global.json index cfcd252f25b1..b244b8640b05 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.17" } } From 81c0e0c48e014552696cfc99796177813ea9deaf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 26 Nov 2018 00:34:37 +0000 Subject: [PATCH 0213/2702] Update dependency files (#203) * Update dependencies from https://github.com/dotnet/arcade build 428 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18571.2 * Update dependencies from https://github.com/dotnet/arcade build 433 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18571.5 * Update dependencies from https://github.com/dotnet/arcade build 434 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18571.7 * Update dependencies from https://github.com/dotnet/arcade build 447 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18575.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 703ee4d7ea98..46e6ee95cf9c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 93b39c3209a5929662190c7e85b43b4f2a32bab1 + da64d4121e96e05ced8e3166fad74f0650f4ccef diff --git a/global.json b/global.json index b244b8640b05..f93906ac0f75 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18570.17" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18575.1" } } From d29188e6a78825a7c6978e90665359493e6eedb3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 26 Nov 2018 17:23:20 +0000 Subject: [PATCH 0214/2702] Update dependencies from https://github.com/dotnet/arcade build 450 (#204) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18576.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 46e6ee95cf9c..eff249b98be5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - da64d4121e96e05ced8e3166fad74f0650f4ccef + c2c1f2602cf7d9d9dcb119487ee201aba4f426b6 diff --git a/global.json b/global.json index f93906ac0f75..e03ed28e9327 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18575.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18576.2" } } From 0bc7855b0bc44da66e4f0f70572561c28e2e5613 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 26 Nov 2018 19:59:36 +0000 Subject: [PATCH 0215/2702] Update dependencies from https://github.com/dotnet/arcade build 452 (#205) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18576.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index eff249b98be5..376003c16eeb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - c2c1f2602cf7d9d9dcb119487ee201aba4f426b6 + 05587e0976d84d00dce2710824e3bffd5a647814 diff --git a/global.json b/global.json index e03ed28e9327..d320b63cd8a2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18576.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18576.4" } } From d560ee7698625357f784c722586d3a35ade668ab Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 26 Nov 2018 23:59:12 +0000 Subject: [PATCH 0216/2702] Update dependencies from https://github.com/dotnet/arcade build 459 (#206) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18576.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 376003c16eeb..11df12cef63c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 05587e0976d84d00dce2710824e3bffd5a647814 + 5b019cda4f53a3380ec7405628e9fa0a3b17a0d9 diff --git a/global.json b/global.json index d320b63cd8a2..57ae6fac290f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18576.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18576.5" } } From 33317cb685858e8087d2e89477086f2fda06e465 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 27 Nov 2018 18:44:00 +0000 Subject: [PATCH 0217/2702] Update dependencies from https://github.com/dotnet/arcade build 467 (#207) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18577.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 11df12cef63c..83abaccdb80a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 5b019cda4f53a3380ec7405628e9fa0a3b17a0d9 + 6de00c7ef72599d9658e5d8155ff625952875bf7 diff --git a/global.json b/global.json index 57ae6fac290f..ed8b37f0486f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18576.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18577.2" } } From 7c844cb7ea68d12712eb06a2a086061d9d8cec9d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 27 Nov 2018 19:25:05 +0000 Subject: [PATCH 0218/2702] Update dependencies from https://github.com/dotnet/arcade build 468 (#208) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18577.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 83abaccdb80a..818657edebaa 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6de00c7ef72599d9658e5d8155ff625952875bf7 + 21cea9cd115a1efa1955d44ebbc5248a318de00f diff --git a/global.json b/global.json index ed8b37f0486f..771537dc91e4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18577.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18577.3" } } From 180469faab8ae67c51bcf045b04984a8d1c2d860 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 27 Nov 2018 20:52:56 +0000 Subject: [PATCH 0219/2702] Update dependencies from https://github.com/dotnet/arcade build 471 (#209) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18577.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 818657edebaa..a1f6727cb7ce 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 21cea9cd115a1efa1955d44ebbc5248a318de00f + 4679bdafd51da03a466d45c6b82679191780bd0e diff --git a/global.json b/global.json index 771537dc91e4..b8c8ebafa14b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18577.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18577.5" } } From 83fa80337810620d19124d3a22bbf72d18ab3365 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 28 Nov 2018 16:05:09 +0000 Subject: [PATCH 0220/2702] Update dependency files (#210) * Update dependencies from https://github.com/dotnet/arcade build 475 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18577.9 * Update dependencies from https://github.com/dotnet/arcade build 480 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18578.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a1f6727cb7ce..113609d28a96 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 4679bdafd51da03a466d45c6b82679191780bd0e + 04ee3b77a39302513ece3a950554d6c0ee6d0951 diff --git a/global.json b/global.json index b8c8ebafa14b..ea4176a43ab5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18577.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18578.2" } } From 91c7983327997aa05d4cd05780242b4e55c2c12f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 28 Nov 2018 21:04:12 +0000 Subject: [PATCH 0221/2702] Update dependencies from https://github.com/dotnet/arcade build 484 (#211) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18578.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 113609d28a96..6671b3aec5a6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 04ee3b77a39302513ece3a950554d6c0ee6d0951 + 35631fc69d139133dbb4ad194d39a3b474d2900f diff --git a/global.json b/global.json index ea4176a43ab5..e52568aaec5b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18578.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18578.5" } } From bf18854cc683d7eeae54c240ca24526f318e4ccc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 28 Nov 2018 23:19:16 +0000 Subject: [PATCH 0222/2702] Update dependencies from https://github.com/dotnet/arcade build 489 (#212) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18578.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6671b3aec5a6..246ee3a49453 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 35631fc69d139133dbb4ad194d39a3b474d2900f + b42aba7b5664792e19a38af2b2cfacb217dc8163 diff --git a/global.json b/global.json index e52568aaec5b..73aab167c45d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18578.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18578.7" } } From ef62df089f859c35aa3b88184eaca5fa2c29bfbd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 29 Nov 2018 01:02:47 +0000 Subject: [PATCH 0223/2702] Update dependencies from https://github.com/dotnet/arcade build 491 (#213) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18578.9 --- eng/Version.Details.xml | 4 +- eng/common/tools.ps1 | 156 ++++++++++++++++++++++++++++++---------- global.json | 2 +- 3 files changed, 122 insertions(+), 40 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 246ee3a49453..064f375f5799 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b42aba7b5664792e19a38af2b2cfacb217dc8163 + 36310812bfac90c202486ea70b4617e9ce7aec04 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 734576e72041..29b54a16a63d 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -20,6 +20,11 @@ function Create-Directory([string[]] $path) { } } +function Unzip([string]$zipfile, [string]$outpath) { + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) +} + function InitializeDotNetCli([bool]$install) { # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism $env:DOTNET_MULTILEVEL_LOOKUP=0 @@ -79,39 +84,104 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { } } -function InitializeVisualStudioBuild { - $vsToolsPath = $env:VS150COMNTOOLS - if ($vsToolsPath -eq $null) { - $vsToolsPath = $env:VS160COMNTOOLS +# +# Locates Visual Studio MSBuild installation. +# The preference order for MSBuild to use is as follows: +# +# 1. MSBuild from an active VS command prompt +# 2. MSBuild from a compatible VS installation +# 3. MSBuild from the xcopy tool package +# +# Returns full path to msbuild.exe. +# Throws on failure. +# +function InitializeVisualStudioMSBuild { + $vsMinVersionStr = if (!$GlobalJson.tools.vs.version) { $GlobalJson.tools.vs.version } else { "15.9" } + $vsMinVersion = [Version]::new($vsMinVersionStr) + + # Try msbuild command available in the environment. + if ($env:VSINSTALLDIR -ne $null) { + $msbuildCmd = Get-Command "msbuild.exe" -ErrorAction SilentlyContinue + if ($msbuildCmd -ne $null) { + if ($msbuildCmd.Version -ge $vsMinVersion) { + return $msbuildCmd.Path + } + + # Report error - the developer environment is initialized with incompatible VS version. + throw "Developer Command Prompt for VS $($env:VisualStudioVersion) is not recent enough. Please upgrade to $vsMinVersionStr or build from a plain CMD window" + } } - if (($vsToolsPath -ne $null) -and (Test-Path $vsToolsPath)) { - $vsInstallDir = [System.IO.Path]::GetFullPath((Join-Path $vsToolsPath "..\..")) + # Locate Visual Studio installation or download x-copy msbuild. + $vsInfo = LocateVisualStudio + if ($vsInfo -ne $null) { + $vsInstallDir = $vsInfo.installationPath + $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] + + InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion } else { - $vsInfo = LocateVisualStudio - $vsInstallDir = $vsInfo.installationPath - $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\" - $vsVersion = $vsInfo.installationVersion.Split('.')[0] + "0" + if (Get-Member -InputObject $GlobalJson.tools -Name "xcopy-msbuild") { + $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' + $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] + } else { + $vsMajorVersion = $vsMinVersion.Major + $xcopyMSBuildVersion = "$vsMajorVersion.$($vsMinVersion.Minor).0-alpha" + } + + $vsInstallDir = InstallXCopyMSBuild $xcopyMSBuildVersion + } + + $msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" } + return Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin\msbuild.exe" +} - Set-Item "env:VS$($vsVersion)COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\") - Set-Item "env:VSSDK$($vsVersion)Install" $vsSdkInstallDir +function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) { + $env:VSINSTALLDIR = $vsInstallDir + Set-Item "env:VS$($vsMajorVersion)0COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\") + + $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\" + if (Test-Path $vsSdkInstallDir) { + Set-Item "env:VSSDK$($vsMajorVersion)0Install" $vsSdkInstallDir $env:VSSDKInstall = $vsSdkInstallDir } +} + +function InstallXCopyMSBuild([string] $packageVersion) { + $packageName = "RoslynTools.MSBuild" + $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion" + $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg" + + if (!(Test-Path $packageDir)) { + Create-Directory $packageDir + Write-Host "Downloading $packageName $packageVersion" + Invoke-WebRequest "https://dotnet.myget.org/F/roslyn-tools/api/v2/package/$packageName/$packageVersion/" -OutFile $packagePath + Unzip $packagePath $packageDir + } - return $vsInstallDir + return Join-Path $packageDir "tools" } +# +# Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json. +# +# The following properties of tools.vs are recognized: +# "version": "{major}.{minor}" +# Two part minimal VS version, e.g. "15.9", "16.0", etc. +# "components": ["componentId1", "componentId2", ...] +# Array of ids of workload components that must be available in the VS instance. +# See e.g. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-enterprise?view=vs-2017 +# +# Returns JSON describing the located VS instance (same format as returned by vswhere), +# or $null if no instance meeting the requirements is found on the machine. +# function LocateVisualStudio { - $vswhereVersion = $GlobalJson.tools.vswhere - - if (!$vsWhereVersion) { - Write-Host "vswhere version must be specified in /global.json." -ForegroundColor Red - ExitWithExitCode 1 + $vswhereVersion = Get-Member -InputObject $GlobalJson.tools -Name "vswhere" + if ($vsWhereVersion -eq $null) { + $vswhereVersion = "2.5.2" } - $toolsRoot = Join-Path $RepoRoot ".tools" - $vsWhereDir = Join-Path $toolsRoot "vswhere\$vswhereVersion" + $vsWhereDir = Join-Path $ToolsDir "vswhere\$vswhereVersion" $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe" if (!(Test-Path $vsWhereExe)) { @@ -120,17 +190,25 @@ function LocateVisualStudio { Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe } - $vsInfo = & $vsWhereExe ` - -latest ` - -prerelease ` - -format json ` - -requires Microsoft.Component.MSBuild ` - -requires Microsoft.VisualStudio.Component.VSSDK ` - -requires Microsoft.VisualStudio.Component.Roslyn.Compiler | ConvertFrom-Json + $vs = $GlobalJson.tools.vs + $args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild") + + if (Get-Member -InputObject $vs -Name "version") { + $args += "-version" + $args += $vs.version + } + + if (Get-Member -InputObject $vs -Name "components") { + foreach ($component in $vs.components) { + $args += "-requires" + $args += $component + } + } + + $vsInfo =& $vsWhereExe $args | ConvertFrom-Json if ($lastExitCode -ne 0) { - Write-Host "Failed to locate Visual Studio (exit code '$lastExitCode')." -ForegroundColor Red - ExitWithExitCode $lastExitCode + return $null } # use first matching instance @@ -153,18 +231,18 @@ function InitializeTools() { # Initialize dotnet cli if listed in 'tools' $dotnetRoot = $null - if ((Get-Member -InputObject $tools -Name "dotnet") -ne $null) { + if (Get-Member -InputObject $tools -Name "dotnet") { $dotnetRoot = InitializeDotNetCli -install:$restore } if (-not $msbuildEngine) { - # Presence of vswhere.version indicates the repo needs to build using VS msbuild. - if ((Get-Member -InputObject $tools -Name "vswhere") -ne $null) { + # Presence of tools.vs indicates the repo needs to build using VS msbuild on Windows. + if (Get-Member -InputObject $tools -Name "vs") { $msbuildEngine = "vs" } elseif ($dotnetRoot -ne $null) { $msbuildEngine = "dotnet" } else { - Write-Host "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vswhere'." -ForegroundColor Red + Write-Host "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." -ForegroundColor Red ExitWithExitCode 1 } } @@ -178,10 +256,13 @@ function InitializeTools() { $script:buildDriver = Join-Path $dotnetRoot "dotnet.exe" $script:buildArgs = "msbuild" } elseif ($msbuildEngine -eq "vs") { - $vsInstallDir = InitializeVisualStudioBuild - - $script:buildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe" - $script:buildArgs = "" + try { + $script:buildDriver = InitializeVisualStudioMSBuild + $script:buildArgs = "" + } catch { + Write-Host $_ -ForegroundColor Red + ExitWithExitCode 1 + } } else { Write-Host "Unexpected value of -msbuildEngine: '$msbuildEngine'." -ForegroundColor Red ExitWithExitCode 1 @@ -262,6 +343,7 @@ $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") $EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") $ArtifactsDir = Join-Path $RepoRoot "artifacts" $ToolsetDir = Join-Path $ArtifactsDir "toolset" +$ToolsDir = Join-Path $RepoRoot ".tools" $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration $TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json diff --git a/global.json b/global.json index 73aab167c45d..3a51f51da38d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18578.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18578.9" } } From beaebd811115674729eb25512e6281ff173ffb96 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 30 Nov 2018 00:34:22 +0000 Subject: [PATCH 0224/2702] Update dependencies from https://github.com/dotnet/arcade build 505 (#214) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18579.6 --- eng/Version.Details.xml | 4 ++-- eng/common/templates/job/job.yml | 4 ++-- global.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 064f375f5799..3af232e67124 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 36310812bfac90c202486ea70b4617e9ce7aec04 + 89a0ab0e5cd48b4e0d7911d844b8bc65fdc23be9 diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 9f3e9389c8ef..9fb858e48714 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -43,8 +43,8 @@ parameters: # Optional: enable sending telemetry # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix # _HelixBuildConfig - differentiate between Debug, Release, other - # _HelixSource - Example: build/product - # _HelixType - Example: official/dotnet/arcade/$(Build.SourceBranch) + # _HelixType - Example: build/product/ + # _HelixSource - Example: official/dotnet/arcade/$(Build.SourceBranch) enableTelemetry: false # Optional: If specified, then automatically derive "_HelixSource" variable for telemetry diff --git a/global.json b/global.json index 3a51f51da38d..e4e4b94df442 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18578.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18579.6" } } From 821ed6ae2e29e51c2d8796a4961b39104f3f79c9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 30 Nov 2018 03:39:08 +0000 Subject: [PATCH 0225/2702] Update dependencies from https://github.com/dotnet/arcade build 508 (#215) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18579.9 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3af232e67124..907a26131819 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 89a0ab0e5cd48b4e0d7911d844b8bc65fdc23be9 + 02819ffa69637bb21706db6dd39f8758a68efa57 diff --git a/global.json b/global.json index e4e4b94df442..3da5a1394229 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18579.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18579.9" } } From 42b8c82665aae18fbd0948066317e88f87891ff2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 30 Nov 2018 14:25:27 +0000 Subject: [PATCH 0226/2702] Update dependencies from https://github.com/dotnet/arcade build 511 (#216) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18580.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 907a26131819..220718b8893d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 02819ffa69637bb21706db6dd39f8758a68efa57 + 76241a8c6af4558ddf24ff818702fdba8e6aed9a diff --git a/global.json b/global.json index 3da5a1394229..4f26c7706ff8 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18579.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18580.1" } } From 0217107424f42ce80960202823ee5498f7d54db1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 30 Nov 2018 23:17:54 +0000 Subject: [PATCH 0227/2702] Update dependencies from https://github.com/dotnet/arcade build 520 (#217) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18580.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 220718b8893d..18d74aaefb30 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 76241a8c6af4558ddf24ff818702fdba8e6aed9a + 1049cdfe59a58addbdf4a5bbf840d08c29ff633f diff --git a/global.json b/global.json index 4f26c7706ff8..cc402a2988a5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18580.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18580.7" } } From 418bf733fdb56232d7acec2bc282cd94873a8134 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 1 Dec 2018 00:01:02 +0000 Subject: [PATCH 0228/2702] Update dependencies from https://github.com/dotnet/arcade build 522 (#218) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18580.8 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 18d74aaefb30..7e1f6f8adc8b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 1049cdfe59a58addbdf4a5bbf840d08c29ff633f + 78bab941f27ffdf774c4d6bebf0c35ec14f0a16e diff --git a/global.json b/global.json index cc402a2988a5..25ca54cf2c3f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18580.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18580.8" } } From 1dc2f61db0e4702dfbef38cd7407d693feed4531 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 1 Dec 2018 02:24:54 +0000 Subject: [PATCH 0229/2702] Update dependencies from https://github.com/dotnet/arcade build 526 (#219) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18580.13 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7e1f6f8adc8b..080321cace1d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 78bab941f27ffdf774c4d6bebf0c35ec14f0a16e + 1fc98978414e7c51405ef8fbd42a49cb352d792a diff --git a/global.json b/global.json index 25ca54cf2c3f..cf9bb98f9b63 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18580.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18580.13" } } From 3aa93ea8b14fb88091acb76f533a04847f933d02 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 3 Dec 2018 19:56:54 +0000 Subject: [PATCH 0230/2702] Update dependencies from https://github.com/dotnet/arcade build 531 (#220) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18603.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 080321cace1d..32859fe98e56 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 1fc98978414e7c51405ef8fbd42a49cb352d792a + d60e6023bce3ba3d228ddc7486a3e794e9b6b1d4 diff --git a/global.json b/global.json index cf9bb98f9b63..c2a8513dae02 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18580.13" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18603.2" } } From d077114707b01c64f7e69234168935c16a539428 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 3 Dec 2018 23:57:23 +0000 Subject: [PATCH 0231/2702] Update dependency files (#221) * Update dependencies from https://github.com/dotnet/arcade build 538 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18603.4 * Update dependencies from https://github.com/dotnet/arcade build 543 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18603.5 * Update dependencies from https://github.com/dotnet/arcade build 546 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18603.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 32859fe98e56..cbe372f9727c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d60e6023bce3ba3d228ddc7486a3e794e9b6b1d4 + 41bbcc67948144021b5cd1c126812af995310bd3 diff --git a/global.json b/global.json index c2a8513dae02..dd09e3fda80f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18603.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18603.6" } } From ed030dd86ec6663340ec2831d16bd64c444cfc64 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 4 Dec 2018 01:16:13 +0000 Subject: [PATCH 0232/2702] Update dependency files (#222) * Update dependencies from https://github.com/dotnet/arcade build 550 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18603.8 * Update dependencies from https://github.com/dotnet/arcade build 551 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18603.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cbe372f9727c..9bf2e095e043 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 41bbcc67948144021b5cd1c126812af995310bd3 + fa247a5766d89abf19e466a5c36bc4cd1576f65b diff --git a/global.json b/global.json index dd09e3fda80f..c4835e832443 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18603.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18603.7" } } From e61f982c2ec9a3a35ab9fee08006a2d6d84bb0b0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 4 Dec 2018 14:14:14 +0000 Subject: [PATCH 0233/2702] Update dependencies from https://github.com/dotnet/arcade build 567 (#223) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9bf2e095e043..1cec316567ba 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - fa247a5766d89abf19e466a5c36bc4cd1576f65b + 6780ae4de28a1a15cf9e6c52b5f80f4cce9d3d90 diff --git a/global.json b/global.json index c4835e832443..f387184a8b19 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18603.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18604.1" } } From 5fd584bc5d22ecc1efdeeed1ba4b66d74ce175ce Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 4 Dec 2018 18:24:52 +0000 Subject: [PATCH 0234/2702] Update dependencies from https://github.com/dotnet/arcade build 572 (#224) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1cec316567ba..20611d631fc4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6780ae4de28a1a15cf9e6c52b5f80f4cce9d3d90 + c8a25114504f55955aa731d47f8c370a21126ef8 diff --git a/global.json b/global.json index f387184a8b19..0eaaee2ba26a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18604.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18604.3" } } From 8628c8a4da4424c6f33806c0d6cd9b2d46d85137 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 4 Dec 2018 13:18:22 -0800 Subject: [PATCH 0235/2702] Switch to BYOC (#225) * Switch to BYOC --- azure-pipelines.yml | 72 +++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 48 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7367dd9215b6..989b66f344b7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,6 @@ variables: - Build.Repository.Clean: true - _HelixType: build/product - _HelixSource: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) +- name: Build.Repository.Clean + value: true resources: containers: @@ -11,19 +10,21 @@ resources: # CI and PR triggers trigger: - master -- switch-to-test-pool + pr: - master -# Three phases for each of the three OSes we want to run on -phases: -- template: /eng/common/templates/phases/base.yml +jobs: +- template: /eng/common/templates/job/job.yml parameters: name: Windows_NT enableTelemetry: true - queue: - name: dotnet-external-temp - parallel: 99 + enablePublishBuildArtifacts: true + helixRepo: dotnet/arcade-minimalci-sample + pool: + name: NetCorePublic-Int-Pool + queue: Windows.10.Amd64.Open + strategy: matrix: debug_configuration: _BuildConfig: Debug @@ -36,24 +37,17 @@ phases: name: Build displayName: Build condition: succeeded() - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: $(Agent.Os)_$(Agent.JobName) - continueOnError: true - condition: always() - variables: - _HelixBuildConfig: $(_BuildConfig) -- template: /eng/common/templates/phases/base.yml +- template: /eng/common/templates/job/job.yml parameters: name: OSX enableTelemetry: true - queue: - name: Hosted macOS Preview - parallel: 99 + enablePublishBuildArtifacts: true + helixRepo: dotnet/arcade-minimalci-sample + pool: + name: NetCorePublic-Int-Pool + queue: OSX.1012.Amd64.Open + strategy: matrix: debug_configuration: _BuildConfig: Debug @@ -66,25 +60,17 @@ phases: name: Build displayName: Build condition: succeeded() - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: $(Agent.Os)_$(Agent.JobName) - continueOnError: true - condition: always() - variables: - _HelixBuildConfig: $(_BuildConfig) -- template: /eng/common/templates/phases/base.yml +- template: /eng/common/templates/job/job.yml parameters: name: Linux enableTelemetry: true - queue: + enablePublishBuildArtifacts: true + helixRepo: dotnet/arcade-minimalci-sample + pool: name: Hosted Ubuntu 1604 - parallel: 99 - container: LinuxContainer + container: LinuxContainer + strategy: matrix: debug_configuration: _BuildConfig: Debug @@ -97,13 +83,3 @@ phases: name: Build displayName: Build condition: succeeded() - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: $(Agent.Os)_$(Agent.JobName) - continueOnError: true - condition: always() - variables: - _HelixBuildConfig: $(_BuildConfig) From 168b1aa3245378f10331dd48b7964afdda4f01a8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 7 Dec 2018 03:18:03 +0000 Subject: [PATCH 0236/2702] Update dependency files (#226) * Update dependencies from https://github.com/dotnet/arcade build 576 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.5 * Update dependencies from https://github.com/dotnet/arcade build 577 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.6 * Update dependencies from https://github.com/dotnet/arcade build 579 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.7 * Update dependencies from https://github.com/dotnet/arcade build 586 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.10 * Update dependencies from https://github.com/dotnet/arcade build 588 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.11 * Update dependencies from https://github.com/dotnet/arcade build 590 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.12 * Update dependencies from https://github.com/dotnet/arcade build 591 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.13 * Update dependencies from https://github.com/dotnet/arcade build 593 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.14 * Update dependencies from https://github.com/dotnet/arcade build 598 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18604.15 * Update dependencies from https://github.com/dotnet/arcade build 604 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.4 * Update dependencies from https://github.com/dotnet/arcade build 613 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.5 * Update dependencies from https://github.com/dotnet/arcade build 618 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.8 * Update dependencies from https://github.com/dotnet/arcade build 619 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.7 * Update dependencies from https://github.com/dotnet/arcade build 620 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.11 * Update dependencies from https://github.com/dotnet/arcade build 621 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.12 * Update dependencies from https://github.com/dotnet/arcade build 626 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.14 * Update dependencies from https://github.com/dotnet/arcade build 621 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.12 * Update dependencies from https://github.com/dotnet/arcade build 626 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.14 --- eng/Version.Details.xml | 4 +- eng/common/templates/steps/send-to-helix.yml | 71 ++++++++++++++++++++ global.json | 2 +- 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 eng/common/templates/steps/send-to-helix.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 20611d631fc4..e59f969742e6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - c8a25114504f55955aa731d47f8c370a21126ef8 + b7a162f79834214026301b22d59242a5ae0e75e9 diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml new file mode 100644 index 000000000000..ec9e21f2d18a --- /dev/null +++ b/eng/common/templates/steps/send-to-helix.yml @@ -0,0 +1,71 @@ +parameters: + HelixSource: 'pr/default' # required + HelixType: ̓'tests/default/' # required + HelixBuild: $(Build.BuildNumber) # required + HelixTargetQueues: '' # required + HelixAccessToken: '' # required + HelixPreCommands: '' + HelixPostCommands: '' + WorkItemDirectory: '' + WorkItemCommand: '' + CorrelationPayloadDirectory: '' + XUnitProjects: '' + XUnitTargetFramework: '' + XUnitRunnerVersion: '' + IncludeDotNetCli: false + DotNetCliPackageType: '' + DotNetCliVersion: '' + EnableXUnitReporter: false + WaitForWorkItemCompletion: true + condition: succeeded() + continueOnError: false + +steps: + - script: '%BUILD_SOURCESDIRECTORY%\eng\common\msbuild.ps1 %BUILD_SOURCESDIRECTORY%\eng\common\helixpublish.proj /bl:%BUILD_SOURCESDIRECTORY%\artifacts\log\%BuildConfig%\SendToHelix.binlog' + displayName: Send job to Helix (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitTargetFramework: ${{ parameters.XUnitTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + displayName: Send job to Helix (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + WorkItemCommand: ${{ parameters.WorkItemCommand }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitTargetFramework: ${{ parameters.XUnitTargetFramework }} + XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/global.json b/global.json index 0eaaee2ba26a..08a9789072e1 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18604.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18605.14" } } From 0d44cafd29d03c82bb8ce2554a72ea90b4902a7e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 7 Dec 2018 03:38:00 +0000 Subject: [PATCH 0237/2702] Update dependency files (#227) * Update dependencies from https://github.com/dotnet/arcade build 621 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.12 * Update dependencies from https://github.com/dotnet/arcade build 626 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.14 * Update dependencies from https://github.com/dotnet/arcade build 629 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18605.15 * Update dependencies from https://github.com/dotnet/arcade build 631 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18606.1 * Update dependencies from https://github.com/dotnet/arcade build 642 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18606.4 * Update dependencies from https://github.com/dotnet/arcade build 643 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18606.5 * Update dependencies from https://github.com/dotnet/arcade build 650 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18606.9 --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 5 +++-- global.json | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e59f969742e6..82b4b2b13aea 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b7a162f79834214026301b22d59242a5ae0e75e9 + fe25f076bdd44568aa6334d4266e6553719cf91d diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 29b54a16a63d..290637c5fab3 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -176,8 +176,9 @@ function InstallXCopyMSBuild([string] $packageVersion) { # or $null if no instance meeting the requirements is found on the machine. # function LocateVisualStudio { - $vswhereVersion = Get-Member -InputObject $GlobalJson.tools -Name "vswhere" - if ($vsWhereVersion -eq $null) { + if (Get-Member -InputObject $GlobalJson.tools -Name "vswhere") { + $vswhereVersion = $GlobalJson.tools.vswhere + } else { $vswhereVersion = "2.5.2" } diff --git a/global.json b/global.json index 08a9789072e1..585471e15701 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18605.14" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18606.9" } } From b9fd612e362935a3e4e0c8b044cfbae463eb33e0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 7 Dec 2018 22:11:46 +0000 Subject: [PATCH 0238/2702] Update dependency files (#228) * Update dependencies from https://github.com/dotnet/arcade build 660 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18607.1 * Update dependencies from https://github.com/dotnet/arcade build 670 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18607.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 82b4b2b13aea..7c19f73a1cd9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - fe25f076bdd44568aa6334d4266e6553719cf91d + 41d3b4d2eb4434880089e5f97017aa4b19d0a1c7 diff --git a/global.json b/global.json index 585471e15701..32abdd1907d5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18606.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18607.3" } } From 18d5b4d127c632b3de11010b0d2d97a7a0874608 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 7 Dec 2018 23:36:19 +0000 Subject: [PATCH 0239/2702] Update dependencies from https://github.com/dotnet/arcade build 676 (#229) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18607.5 --- eng/Version.Details.xml | 4 ++-- eng/common/templates/steps/send-to-helix.yml | 8 +++++++- global.json | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7c19f73a1cd9..d41f1c72b901 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 41d3b4d2eb4434880089e5f97017aa4b19d0a1c7 + 34d0574f60c933a9a204bfa2ec981542340c2372 diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index ec9e21f2d18a..d0622f3caf4d 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -1,6 +1,6 @@ parameters: HelixSource: 'pr/default' # required - HelixType: ̓'tests/default/' # required + HelixType: 'tests/default/' # required HelixBuild: $(Build.BuildNumber) # required HelixTargetQueues: '' # required HelixAccessToken: '' # required @@ -17,6 +17,8 @@ parameters: DotNetCliVersion: '' EnableXUnitReporter: false WaitForWorkItemCompletion: true + IsExternal: false + Creator: '' condition: succeeded() continueOnError: false @@ -43,6 +45,8 @@ steps: DotNetCliVersion: ${{ parameters.DotNetCliVersion }} EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + IsExternal: ${{ parameters.IsExternal }} + Creator: ${{ parameters.Creator }} condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog @@ -67,5 +71,7 @@ steps: DotNetCliVersion: ${{ parameters.DotNetCliVersion }} EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + IsExternal: ${{ parameters.IsExternal }} + Creator: ${{ parameters.Creator }} condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} diff --git a/global.json b/global.json index 32abdd1907d5..3b76d2b4143a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18607.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18607.5" } } From 60fb0850165090342537b6bc616ab21421eaf8a7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 8 Dec 2018 14:18:06 +0000 Subject: [PATCH 0240/2702] Update dependency files (#230) * Update dependencies from https://github.com/dotnet/arcade build 677 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18607.6 * Update dependencies from https://github.com/dotnet/arcade build 679 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18608.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d41f1c72b901..7a787c17409c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 34d0574f60c933a9a204bfa2ec981542340c2372 + c3be73644108181b6c951c3ef8febd220a2a79f3 diff --git a/global.json b/global.json index 3b76d2b4143a..fa66982036f4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18607.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18608.1" } } From b686db35b05447ca9ec154b1cde7ac26750d9401 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 10 Dec 2018 22:57:07 +0000 Subject: [PATCH 0241/2702] Update dependency files (#231) * Update dependencies from https://github.com/dotnet/arcade build 703 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18610.2 * Update dependencies from https://github.com/dotnet/arcade build 705 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18610.3 * Update dependencies from https://github.com/dotnet/arcade build 708 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18610.4 --- eng/Version.Details.xml | 4 +- eng/common/build.ps1 | 78 ++++++---- eng/common/build.sh | 235 ++++++++++++++++------------- eng/common/darc-init.ps1 | 5 +- eng/common/darc-init.sh | 13 +- eng/common/msbuild.ps1 | 10 +- eng/common/msbuild.sh | 17 +-- eng/common/tools.ps1 | 309 +++++++++++++++++++++++++++------------ eng/common/tools.sh | 180 +++++++++++++++-------- global.json | 2 +- 10 files changed, 551 insertions(+), 302 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7a787c17409c..feb957aea660 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - c3be73644108181b6c951c3ef8febd220a2a79f3 + 6f6f4e5b974772c9949ed0f0baaf521a8c7991e4 diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 76f108fd5d84..5241f42e3583 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -1,15 +1,15 @@ [CmdletBinding(PositionalBinding=$false)] Param( - [string] $configuration = "Debug", + [string][Alias('c')]$configuration = "Debug", [string] $projects = "", - [string] $verbosity = "minimal", + [string][Alias('v')]$verbosity = "minimal", [string] $msbuildEngine = $null, - [bool] $warnaserror = $true, - [bool] $nodereuse = $true, + [bool] $warnAsError = $true, + [bool] $nodeReuse = $true, [switch] $execute, - [switch] $restore, + [switch][Alias('r')]$restore, [switch] $deployDeps, - [switch] $build, + [switch][Alias('b')]$build, [switch] $rebuild, [switch] $deploy, [switch] $test, @@ -19,6 +19,7 @@ Param( [switch] $pack, [switch] $publish, [switch] $publishBuildAssets, + [switch][Alias('bl')]$binaryLog, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -29,14 +30,15 @@ Param( function Print-Usage() { Write-Host "Common settings:" - Write-Host " -configuration Build configuration Debug, Release" - Write-Host " -verbosity Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])" + Write-Host " -configuration Build configuration: 'Debug' or 'Release' (short: -c)" + Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + Write-Host " -binaryLog Output binary log (short: -bl)" Write-Host " -help Print help and exit" Write-Host "" Write-Host "Actions:" - Write-Host " -restore Restore dependencies" - Write-Host " -build Build solution" + Write-Host " -restore Restore dependencies (short: -r)" + Write-Host " -build Build solution (short: -b)" Write-Host " -rebuild Rebuild solution" Write-Host " -deploy Deploy built VSIXes" Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)" @@ -46,7 +48,7 @@ function Print-Usage() { Write-Host " -performanceTest Run all performance tests in the solution" Write-Host " -sign Sign build outputs" Write-Host " -publish Publish artifacts (e.g. symbols)" - Write-Host " -publishBuildAssets Push assets to BAR" + Write-Host " -publishBuildAssets Push assets to BAR" Write-Host "" Write-Host "Advanced settings:" @@ -59,22 +61,26 @@ function Print-Usage() { Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." } -if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) { - Print-Usage - exit 0 -} -try { - if ($projects -eq "") { - $projects = Join-Path $RepoRoot "*.sln" +function InitializeCustomToolset { + if (-not $restore) { + return } - InitializeTools + $script = Join-Path $EngRoot "restore-toolset.ps1" - $BuildLog = Join-Path $LogDir "Build.binlog" + if (Test-Path $script) { + . $script + } +} + +function Build { + $toolsetBuildProj = InitializeToolset + InitializeCustomToolset + $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" } - MSBuild $ToolsetBuildProj ` - /bl:$BuildLog ` + MSBuild $toolsetBuildProj ` + $bl ` /p:Configuration=$configuration ` /p:Projects=$projects ` /p:RepoRoot=$RepoRoot ` @@ -92,13 +98,31 @@ try { /p:Execute=$execute ` /p:ContinuousIntegrationBuild=$ci ` @properties +} + +try { + if ($help -or (($properties -ne $null) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) { + Print-Usage + exit 0 + } - if ($lastExitCode -ne 0) { - Write-Host "Build Failed (exit code '$lastExitCode'). See log: $BuildLog" -ForegroundColor Red - ExitWithExitCode $lastExitCode + if ($projects -eq "") { + $projects = Join-Path $RepoRoot "*.sln" } - ExitWithExitCode $lastExitCode + if ($ci) { + $binaryLog = $true + $nodeReuse = $false + } + + # Import custom tools configuration, if present in the repo. + # Note: Import in global scope so that the script set top-level variables without qualification. + $configureToolsetScript = Join-Path $EngRoot "configure-toolset.ps1" + if (Test-Path $configureToolsetScript) { + . $configureToolsetScript + } + + Build } catch { Write-Host $_ @@ -106,3 +130,5 @@ catch { Write-Host $_.ScriptStackTrace ExitWithExitCode 1 } + +ExitWithExitCode 0 diff --git a/eng/common/build.sh b/eng/common/build.sh index 941db3bd5703..03b4436e1b9e 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -1,5 +1,35 @@ #!/usr/bin/env bash +# Stop script if unbound variable found (use ${var:-} if intentional) +set -u + +usage() +{ + echo "Common settings:" + echo " --configuration Build configuration: 'Debug' or 'Release' (short: --c)" + echo " --verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" + echo " --binaryLog Create MSBuild binary log (short: -bl)" + echo "" + echo "Actions:" + echo " --restore Restore dependencies (short: -r)" + echo " --build Build all projects (short: -b)" + echo " --rebuild Rebuild all projects" + echo " --test Run all unit tests (short: -t)" + echo " --sign Sign build outputs" + echo " --publish Publish artifacts (e.g. symbols)" + echo " --pack Package build outputs into NuGet packages and Willow components" + echo " --help Print help and exit (short: -h)" + echo "" + echo "Advanced settings:" + echo " --projects Project or solution file(s) to build" + echo " --ci Set when running on CI server" + echo " --prepareMachine Prepare machine for CI run, clean up processes after build" + echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" + echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + echo "" + echo "Command line arguments starting with '/p:' are passed through to MSBuild." +} + source="${BASH_SOURCE[0]}" # resolve $source until the file is no longer a symlink @@ -12,7 +42,6 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -help=false restore=false build=false rebuild=false @@ -25,8 +54,9 @@ sign=false public=false ci=false -warnaserror=true -nodereuse=true +warn_as_error=true +node_reuse=true +binary_log=false projects='' configuration='Debug' @@ -34,138 +64,141 @@ prepare_machine=false verbosity='minimal' properties='' -while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" - case $lowerI in - --build) - build=true - shift 1 - ;; - --ci) - ci=true - shift 1 - ;; - --configuration) - configuration=$2 - shift 2 - ;; - --help) - echo "Common settings:" - echo " --configuration Build configuration Debug, Release" - echo " --verbosity Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])" - echo " --help Print help and exit" - echo "" - echo "Actions:" - echo " --restore Restore dependencies" - echo " --build Build solution" - echo " --rebuild Rebuild solution" - echo " --test Run all unit tests in the solution" - echo " --sign Sign build outputs" - echo " --publish Publish artifacts (e.g. symbols)" - echo " --pack Package build outputs into NuGet packages and Willow components" - echo "" - echo "Advanced settings:" - echo " --solution Path to solution to build" - echo " --ci Set when running on CI server" - echo " --prepareMachine Prepare machine for CI run" - echo "" - echo "Command line arguments not listed above are passed through to MSBuild." +while [[ $# > 0 ]]; do + opt="$(echo "$1" | awk '{print tolower($0)}')" + case "$opt" in + --help|-h) + usage exit 0 ;; - --pack) - pack=true - shift 1 + --configuration|-c) + configuration=$2 + shift ;; - --preparemachine) - prepare_machine=true - shift 1 + --verbosity|-v) + verbosity=$2 + shift ;; - --rebuild) - rebuild=true - shift 1 + --binarylog|-bl) + binary_log=true ;; - --restore) + --restore|-r) restore=true - shift 1 ;; - --sign) - sign=true - shift 1 + --build|-b) + build=true ;; - --solution) - solution=$2 - shift 2 + --rebuild) + rebuild=true ;; - --projects) - projects=$2 - shift 2 + --pack) + pack=true ;; - --test) + --test|-t) test=true - shift 1 ;; --integrationtest) integration_test=true - shift 1 ;; --performancetest) performance_test=true - shift 1 + ;; + --sign) + sign=true ;; --publish) publish=true - shift 1 ;; - --verbosity) - verbosity=$2 - shift 2 + --preparemachine) + prepare_machine=true + ;; + --projects) + projects=$2 + shift + ;; + --ci) + ci=true ;; --warnaserror) - warnaserror=$2 - shift 2 + warn_as_error=$2 + shift ;; --nodereuse) - nodereuse=$2 - shift 2 + node_reuse=$2 + shift ;; - *) + /p:*) properties="$properties $1" - shift 1 + ;; + *) + echo "Invalid argument: $1" + usage + exit 1 ;; esac + + shift done +if [[ "$ci" == true ]]; then + binary_log=true + node_reuse=false +fi + . "$scriptroot/tools.sh" -if [[ -z $projects ]]; then - projects="$repo_root/*.sln" +function InitializeCustomToolset { + local script="$eng_root/restore-toolset.sh" + + if [[ -a "$script" ]]; then + . "$script" + fi +} + +function Build { + InitializeToolset + InitializeCustomToolset + + if [[ -z $projects ]]; then + projects="$repo_root/*.sln" + fi + + local bl="" + if [[ "$binary_log" == true ]]; then + bl="/bl:\"$log_dir/Build.binlog\"" + fi + + MSBuild $_InitializeToolset \ + $bl \ + /p:Configuration=$configuration \ + /p:Projects="$projects" \ + /p:RepoRoot="$repo_root" \ + /p:Restore=$restore \ + /p:Build=$build \ + /p:Rebuild=$rebuild \ + /p:Test=$test \ + /p:Pack=$pack \ + /p:IntegrationTest=$integration_test \ + /p:PerformanceTest=$performance_test \ + /p:Sign=$sign \ + /p:Publish=$publish \ + /p:ContinuousIntegrationBuild=$ci \ + $properties + + ExitWithExitCode 0 +} + +# Import custom tools configuration, if present in the repo. +configure_toolset_script="$eng_root/configure-toolset.sh" +if [[ -a "$configure_toolset_script" ]]; then + . "$configure_toolset_script" fi -InitializeTools - -build_log="$log_dir/Build.binlog" - -MSBuild "$toolset_build_proj" \ - /bl:"$build_log" \ - /p:Configuration=$configuration \ - /p:Projects="$projects" \ - /p:RepoRoot="$repo_root" \ - /p:Restore=$restore \ - /p:Build=$build \ - /p:Rebuild=$rebuild \ - /p:Test=$test \ - /p:Pack=$pack \ - /p:IntegrationTest=$integration_test \ - /p:PerformanceTest=$performance_test \ - /p:Sign=$sign \ - /p:Publish=$publish \ - /p:ContinuousIntegrationBuild=$ci \ - $properties - -lastexitcode=$? - -if [[ $lastexitcode != 0 ]]; then - echo "Build failed (exit code '$lastexitcode'). See log: $build_log" +# TODO: https://github.com/dotnet/arcade/issues/1468 +# Temporary workaround to avoid breaking change. +# Remove once repos are updated. +if [[ -n "${useInstalledDotNetCli:-}" ]]; then + use_installed_dotnet_cli="$useInstalledDotNetCli" fi -ExitWithExitCode $lastexitcode +Build diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index af182d8f8410..9ca150be8600 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -3,7 +3,9 @@ $verbosity = "m" function InstallDarcCli { $darcCliPackageName = "microsoft.dotnet.darc" - $dotnet = "$env:DOTNET_INSTALL_DIR\dotnet.exe" + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" $toolList = Invoke-Expression "& `"$dotnet`" tool list -g" if ($toolList -like "*$darcCliPackageName*") { @@ -17,5 +19,4 @@ function InstallDarcCli { Invoke-Expression "& `"$dotnet`" tool install $darcCliPackageName --version $toolsetVersion -v $verbosity -g" } -InitializeTools InstallDarcCli diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index a0c733a15d40..bad07c3ae618 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -17,10 +17,14 @@ verbosity=m function InstallDarcCli { local darc_cli_package_name="microsoft.dotnet.darc" - local uninstall_command=`$DOTNET_INSTALL_DIR/dotnet tool uninstall $darc_cli_package_name -g` - local tool_list=$($DOTNET_INSTALL_DIR/dotnet tool list -g) + + InitializeDotNetCli + local dotnet_root=$_InitializeDotNetCli + + local uninstall_command=`$dotnet_root/dotnet tool uninstall $darc_cli_package_name -g` + local tool_list=$($dotnet_root/dotnet tool list -g) if [[ $tool_list = *$darc_cli_package_name* ]]; then - echo $($DOTNET_INSTALL_DIR/dotnet tool uninstall $darc_cli_package_name -g) + echo $($dotnet_root/dotnet tool uninstall $darc_cli_package_name -g) fi ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk" @@ -28,8 +32,7 @@ function InstallDarcCli { echo "Installing Darc CLI version $toolset_version..." echo "You may need to restart your command shell if this is the first dotnet tool you have installed." - echo $($DOTNET_INSTALL_DIR/dotnet tool install $darc_cli_package_name --version $toolset_version -v $verbosity -g) + echo $($dotnet_root/dotnet tool install $darc_cli_package_name --version $toolset_version -v $verbosity -g) } -InitializeTools InstallDarcCli diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 index 43b837f4df7d..3cd667219a63 100644 --- a/eng/common/msbuild.ps1 +++ b/eng/common/msbuild.ps1 @@ -1,8 +1,8 @@ [CmdletBinding(PositionalBinding=$false)] Param( [string] $verbosity = "minimal", - [bool] $warnaserror = $true, - [bool] $nodereuse = $true, + [bool] $warnAsError = $true, + [bool] $nodeReuse = $true, [switch] $ci, [switch] $prepareMachine, [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs @@ -11,13 +11,13 @@ Param( . $PSScriptRoot\tools.ps1 try { - InitializeTools MSBuild @extraArgs - ExitWithExitCode $lastExitCode -} +} catch { Write-Host $_ Write-Host $_.Exception Write-Host $_.ScriptStackTrace ExitWithExitCode 1 } + +ExitWithExitCode 0 \ No newline at end of file diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh index b1024487f732..6fe07cb7981a 100755 --- a/eng/common/msbuild.sh +++ b/eng/common/msbuild.sh @@ -13,10 +13,10 @@ done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" verbosity='minimal' -warnaserror=true -nodereuse=true +warn_as_error=true +node_reuse=true prepare_machine=false -extraargs='' +extra_args='' while (($# > 0)); do lowerI="$(echo $1 | awk '{print tolower($0)}')" @@ -26,11 +26,11 @@ while (($# > 0)); do shift 2 ;; --warnaserror) - warnaserror=$2 + warn_as_error=$2 shift 2 ;; --nodereuse) - nodereuse=$2 + node_reuse=$2 shift 2 ;; --ci) @@ -42,7 +42,7 @@ while (($# > 0)); do shift 1 ;; *) - extraargs="$extraargs $1" + extra_args="$extra_args $1" shift 1 ;; esac @@ -50,6 +50,5 @@ done . "$scriptroot/tools.sh" -InitializeTools -MSBuild $extraargs -ExitWithExitCode $? +MSBuild $extra_args +ExitWithExitCode 0 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 290637c5fab3..0d0ebdc1456a 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -1,14 +1,43 @@ -# Initialize variables if they aren't already defined - -$ci = if (Test-Path variable:ci) { $ci } else { $false } -$configuration = if (Test-Path variable:configuration) { $configuration } else { "Debug" } -$nodereuse = if (Test-Path variable:nodereuse) { $nodereuse } else { !$ci } -$prepareMachine = if (Test-Path variable:prepareMachine) { $prepareMachine } else { $false } -$restore = if (Test-Path variable:restore) { $restore } else { $true } -$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { "minimal" } -$warnaserror = if (Test-Path variable:warnaserror) { $warnaserror } else { $true } -$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } -$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } +# Initialize variables if they aren't already defined. +# These may be defined as parameters of the importing script, or set after importing this script. + +# CI mode - set to true on CI server for PR validation build or official build. +[bool]$ci = if (Test-Path variable:ci) { $ci } else { $false } + +# Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. +[string]$configuration = if (Test-Path variable:configuration) { $configuration } else { "Debug" } + +# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. +# Binary log must be enabled on CI. +[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci } + +# Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). +[bool]$prepareMachine = if (Test-Path variable:prepareMachine) { $prepareMachine } else { $false } + +# True to restore toolsets and dependencies. +[bool]$restore = if (Test-Path variable:restore) { $restore } else { $true } + +# Adjusts msbuild verbosity level. +[string]$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { "minimal" } + +# Set to true to reuse msbuild nodes. Recommended to not reuse on CI. +[bool]$nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { !$ci } + +# Configures warning treatment in msbuild. +[bool]$warnAsError = if (Test-Path variable:warnAsError) { $warnAsError } else { $true } + +# Specifies which msbuild engine to use for build: 'vs', 'dotnet' or unspecified (determined based on presence of tools.vs in global.json). +[string]$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } + +# True to attempt using .NET Core already that meets requirements specified in global.json +# installed on the machine instead of downloading one. +[bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } + +# True to use global NuGet cache instead of restoring packages to repository-local directory. +[bool]$useGlobalNuGetCache = if (Test-Path variable:useGlobalNuGetCache) { $useGlobalNuGetCache } else { !$ci } + +# An array of names of processes to stop on script exit if prepareMachine is true. +$processesToStopOnExit = if (Test-Path variable:processesToStopOnExit) { $processesToStopOnExit } else { @("msbuild", "dotnet", "vbcscompiler") } set-strictmode -version 2.0 $ErrorActionPreference = "Stop" @@ -25,13 +54,54 @@ function Unzip([string]$zipfile, [string]$outpath) { [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) } +# This will exec a process using the console and return it's exit code. +# This will not throw when the process fails. +# Returns process exit code. +function Exec-Process([string]$command, [string]$commandArgs) { + $startInfo = New-Object System.Diagnostics.ProcessStartInfo + $startInfo.FileName = $command + $startInfo.Arguments = $commandArgs + $startInfo.UseShellExecute = $false + $startInfo.WorkingDirectory = Get-Location + + $process = New-Object System.Diagnostics.Process + $process.StartInfo = $startInfo + $process.Start() | Out-Null + + $finished = $false + try { + while (-not $process.WaitForExit(100)) { + # Non-blocking loop done to allow ctr-c interrupts + } + + $finished = $true + return $global:LASTEXITCODE = $process.ExitCode + } + finally { + # If we didn't finish then an error occured or the user hit ctrl-c. Either + # way kill the process + if (-not $finished) { + $process.Kill() + } + } +} + function InitializeDotNetCli([bool]$install) { + if (Test-Path global:_DotNetInstallDir) { + return $global:_DotNetInstallDir + } + # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism $env:DOTNET_MULTILEVEL_LOOKUP=0 # Disable first run since we do not need all ASP.NET packages restored. $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + # Disable telemetry on CI. + if ($ci) { + $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 + } + # Source Build uses DotNetCoreSdkDir variable if ($env:DotNetCoreSdkDir -ne $null) { $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir @@ -39,7 +109,10 @@ function InitializeDotNetCli([bool]$install) { # Find the first path on %PATH% that contains the dotnet.exe if ($useInstalledDotNetCli -and ($env:DOTNET_INSTALL_DIR -eq $null)) { - $env:DOTNET_INSTALL_DIR = ${env:PATH}.Split(';') | where { ($_ -ne "") -and (Test-Path (Join-Path $_ "dotnet.exe")) } + $dotnetCmd = Get-Command "dotnet.exe" -ErrorAction SilentlyContinue + if ($dotnetCmd -ne $null) { + $env:DOTNET_INSTALL_DIR = Split-Path $dotnetCmd.Path -Parent + } } $dotnetSdkVersion = $GlobalJson.tools.dotnet @@ -50,9 +123,8 @@ function InitializeDotNetCli([bool]$install) { $dotnetRoot = $env:DOTNET_INSTALL_DIR } else { $dotnetRoot = Join-Path $RepoRoot ".dotnet" - $env:DOTNET_INSTALL_DIR = $dotnetRoot - if (-not (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { + if (-not (Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) { if ($install) { InstallDotNetSdk $dotnetRoot $dotnetSdkVersion } else { @@ -60,9 +132,11 @@ function InitializeDotNetCli([bool]$install) { ExitWithExitCode 1 } } + + $env:DOTNET_INSTALL_DIR = $dotnetRoot } - return $dotnetRoot + return $global:_DotNetInstallDir = $dotnetRoot } function GetDotNetInstallScript([string] $dotnetRoot) { @@ -95,7 +169,11 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { # Returns full path to msbuild.exe. # Throws on failure. # -function InitializeVisualStudioMSBuild { +function InitializeVisualStudioMSBuild([bool]$install) { + if (Test-Path global:_MSBuildExe) { + return $global:_MSBuildExe + } + $vsMinVersionStr = if (!$GlobalJson.tools.vs.version) { $GlobalJson.tools.vs.version } else { "15.9" } $vsMinVersion = [Version]::new($vsMinVersionStr) @@ -104,7 +182,7 @@ function InitializeVisualStudioMSBuild { $msbuildCmd = Get-Command "msbuild.exe" -ErrorAction SilentlyContinue if ($msbuildCmd -ne $null) { if ($msbuildCmd.Version -ge $vsMinVersion) { - return $msbuildCmd.Path + return $global:_MSBuildExe = $msbuildCmd.Path } # Report error - the developer environment is initialized with incompatible VS version. @@ -119,7 +197,7 @@ function InitializeVisualStudioMSBuild { $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion - } else { + } elseif ($install) { if (Get-Member -InputObject $GlobalJson.tools -Name "xcopy-msbuild") { $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' @@ -130,10 +208,12 @@ function InitializeVisualStudioMSBuild { } $vsInstallDir = InstallXCopyMSBuild $xcopyMSBuildVersion + } else { + throw "Unable to find Visual Studio that has required version and components installed" } $msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" } - return Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin\msbuild.exe" + return $global:_MSBuildExe = Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin\msbuild.exe" } function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) { @@ -216,72 +296,87 @@ function LocateVisualStudio { return $vsInfo[0] } -function ConfigureTools { - # Include custom tools configuration - $script = Join-Path $EngRoot "configure-toolset.ps1" - - if (Test-Path $script) { - . $script +function InitializeBuildTool() { + if (Test-Path global:_BuildTool) { + return $global:_BuildTool } -} -function InitializeTools() { - ConfigureTools - - $tools = $GlobalJson.tools + if (-not $msbuildEngine) { + $msbuildEngine = GetDefaultMSBuildEngine + } # Initialize dotnet cli if listed in 'tools' $dotnetRoot = $null - if (Get-Member -InputObject $tools -Name "dotnet") { + if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { $dotnetRoot = InitializeDotNetCli -install:$restore } - if (-not $msbuildEngine) { - # Presence of tools.vs indicates the repo needs to build using VS msbuild on Windows. - if (Get-Member -InputObject $tools -Name "vs") { - $msbuildEngine = "vs" - } elseif ($dotnetRoot -ne $null) { - $msbuildEngine = "dotnet" - } else { - Write-Host "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." -ForegroundColor Red - ExitWithExitCode 1 - } - } - if ($msbuildEngine -eq "dotnet") { if (!$dotnetRoot) { Write-Host "/global.json must specify 'tools.dotnet'." -ForegroundColor Red ExitWithExitCode 1 } - $script:buildDriver = Join-Path $dotnetRoot "dotnet.exe" - $script:buildArgs = "msbuild" + $buildTool = @{ Path = Join-Path $dotnetRoot "dotnet.exe"; Command = "msbuild" } } elseif ($msbuildEngine -eq "vs") { try { - $script:buildDriver = InitializeVisualStudioMSBuild - $script:buildArgs = "" - } catch { + $msbuildPath = InitializeVisualStudioMSBuild -install:$restore + } catch { Write-Host $_ -ForegroundColor Red ExitWithExitCode 1 } + + $buildTool = @{ Path = $msbuildPath; Command = "" } } else { Write-Host "Unexpected value of -msbuildEngine: '$msbuildEngine'." -ForegroundColor Red ExitWithExitCode 1 } - InitializeToolSet $script:buildDriver $script:buildArgs - InitializeCustomToolset + return $global:_BuildTool = $buildTool +} + +function GetDefaultMSBuildEngine() { + # Presence of tools.vs indicates the repo needs to build using VS msbuild on Windows. + if (Get-Member -InputObject $GlobalJson.tools -Name "vs") { + return "vs" + } + + if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { + return "dotnet" + } + + Write-Host "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." -ForegroundColor Red + ExitWithExitCode 1 +} + +function GetNuGetPackageCachePath() { + if ($env:NUGET_PACKAGES -eq $null) { + # Use local cache on CI to ensure deterministic build, + # use global cache in dev builds to avoid cost of downloading packages. + if ($useGlobalNuGetCache) { + $env:NUGET_PACKAGES = Join-Path $env:UserProfile ".nuget\packages" + } else { + $env:NUGET_PACKAGES = Join-Path $RepoRoot ".packages" + } + } + + return $env:NUGET_PACKAGES } -function InitializeToolset([string] $buildDriver, [string]$buildArgs) { +function InitializeToolset() { + if (Test-Path global:_ToolsetBuildProj) { + return $global:_ToolsetBuildProj + } + + $nugetCache = GetNuGetPackageCachePath + $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" if (Test-Path $toolsetLocationFile) { $path = Get-Content $toolsetLocationFile -TotalCount 1 if (Test-Path $path) { - $script:ToolsetBuildProj = $path - return + return $global:_ToolsetBuildProj = $path } } @@ -290,35 +385,20 @@ function InitializeToolset([string] $buildDriver, [string]$buildArgs) { ExitWithExitCode 1 } - $ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog" - $proj = Join-Path $ToolsetDir "restore.proj" + $buildTool = InitializeBuildTool + $proj = Join-Path $ToolsetDir "restore.proj" + $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "ToolsetRestore.binlog") } else { "" } + '' | Set-Content $proj - MSBuild $proj /t:__WriteToolsetLocation /clp:None /bl:$ToolsetRestoreLog /p:__ToolsetLocationOutputFile=$toolsetLocationFile - - if ($lastExitCode -ne 0) { - Write-Host "Failed to restore toolset (exit code '$lastExitCode'). See log: $ToolsetRestoreLog" -ForegroundColor Red - ExitWithExitCode $lastExitCode - } - + MSBuild $proj $bl /t:__WriteToolsetLocation /noconsolelogger /p:__ToolsetLocationOutputFile=$toolsetLocationFile + $path = Get-Content $toolsetLocationFile -TotalCount 1 if (!(Test-Path $path)) { throw "Invalid toolset path: $path" } - - $script:ToolsetBuildProj = $path -} - -function InitializeCustomToolset { - if (-not $restore) { - return - } - - $script = Join-Path $EngRoot "restore-toolset.ps1" - - if (Test-Path $script) { - . $script - } + + return $global:_ToolsetBuildProj = $path } function ExitWithExitCode([int] $exitCode) { @@ -330,14 +410,70 @@ function ExitWithExitCode([int] $exitCode) { function Stop-Processes() { Write-Host "Killing running build processes..." - Get-Process -Name "msbuild" -ErrorAction SilentlyContinue | Stop-Process - Get-Process -Name "dotnet" -ErrorAction SilentlyContinue | Stop-Process - Get-Process -Name "vbcscompiler" -ErrorAction SilentlyContinue | Stop-Process + foreach ($processName in $processesToStopOnExit) { + Get-Process -Name $processName -ErrorAction SilentlyContinue | Stop-Process + } +} + +# +# Executes msbuild (or 'dotnet msbuild') with arguments passed to the function. +# The arguments are automatically quoted. +# Terminates the script if the build fails. +# +function MSBuild() { + if ($ci) { + if (!$binaryLog) { + throw "Binary log must be enabled in CI build." + } + + if ($nodeReuse) { + throw "Node reuse must be disabled in CI build." + } + } + + $buildTool = InitializeBuildTool + + $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse" + + if ($warnAsError) { + $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" + } + + foreach ($arg in $args) { + if ($arg -ne $null -and $arg.Trim() -ne "") { + $cmdArgs += " `"$arg`"" + } + } + + $exitCode = Exec-Process $buildTool.Path $cmdArgs + + if ($exitCode -ne 0) { + Write-Host "Build failed." -ForegroundColor Red + + $buildLog = GetMSBuildBinaryLogCommandLineArgument $args + if ($buildLog -ne $null) { + Write-Host "See log: $buildLog" -ForegroundColor DarkGray + } + + ExitWithExitCode $exitCode + } } -function MsBuild() { - $warnaserrorSwitch = if ($warnaserror) { "/warnaserror" } else { "" } - & $buildDriver $buildArgs $warnaserrorSwitch /m /nologo /clp:Summary /v:$verbosity /nr:$nodereuse $args +function GetMSBuildBinaryLogCommandLineArgument($arguments) { + foreach ($argument in $arguments) { + if ($argument -ne $null) { + $arg = $argument.Trim() + if ($arg.StartsWith("/bl:", "OrdinalIgnoreCase")) { + return $arg.Substring("/bl:".Length) + } + + if ($arg.StartsWith("/binaryLogger:", "OrdinalIgnoreCase")) { + return $arg.Substring("/binaryLogger:".Length) + } + } + } + + return $null } $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") @@ -349,18 +485,11 @@ $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration $TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json -if ($env:NUGET_PACKAGES -eq $null) { - # Use local cache on CI to ensure deterministic build, - # use global cache in dev builds to avoid cost of downloading packages. - $env:NUGET_PACKAGES = if ($ci) { Join-Path $RepoRoot ".packages" } - else { Join-Path $env:UserProfile ".nuget\packages" } -} - Create-Directory $ToolsetDir +Create-Directory $TempDir Create-Directory $LogDir if ($ci) { - Create-Directory $TempDir $env:TEMP = $TempDir $env:TMP = $TempDir } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index c7d03ee028bd..4d7e304f13d7 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -3,30 +3,52 @@ # Stop script if unbound variable found (use ${var:-} if intentional) set -u +# Initialize variables if they aren't already defined. + +# CI mode - set to true on CI server for PR validation build or official build. ci=${ci:-false} + +# Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. configuration=${configuration:-'Debug'} -nodereuse=${nodereuse:-true} + +# Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. +# Binary log must be enabled on CI. +binary_log=${binary_log:-$ci} + +# Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). prepare_machine=${prepare_machine:-false} + +# True to restore toolsets and dependencies. restore=${restore:-true} + +# Adjusts msbuild verbosity level. verbosity=${verbosity:-'minimal'} -warnaserror=${warnaserror:-true} -useInstalledDotNetCli=${useInstalledDotNetCli:-true} -repo_root="$scriptroot/../.." -eng_root="$scriptroot/.." -artifacts_dir="$repo_root/artifacts" -toolset_dir="$artifacts_dir/toolset" -log_dir="$artifacts_dir/log/$configuration" -temp_dir="$artifacts_dir/tmp/$configuration" +# Set to true to reuse msbuild nodes. Recommended to not reuse on CI. +if [[ "$ci" == true ]]; then + node_reuse=${node_reuse:-false} +else + node_reuse=${node_reuse:-true} +fi -global_json_file="$repo_root/global.json" -build_driver="" -toolset_build_proj="" +# Configures warning treatment in msbuild. +warn_as_error=${warn_as_error:-true} + +# True to attempt using .NET Core already that meets requirements specified in global.json +# installed on the machine instead of downloading one. +use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} + +# True to use global NuGet cache instead of restoring packages to repository-local directory. +if [[ "$ci" == true ]]; then + use_global_nuget_cache=${use_global_nuget_cache:-false} +else + use_global_nuget_cache=${use_global_nuget_cache:-true} +fi +# Resolve any symlinks in the given path. function ResolvePath { local path=$1 - # resolve $path until the file is no longer a symlink while [[ -h $path ]]; do local dir="$( cd -P "$( dirname "$path" )" && pwd )" path="$(readlink "$path")" @@ -57,6 +79,10 @@ function ReadGlobalVersion { } function InitializeDotNetCli { + if [[ -n "${_InitializeDotNetCli:-}" ]]; then + return + fi + local install=$1 # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism @@ -65,13 +91,22 @@ function InitializeDotNetCli { # Disable first run since we want to control all package sources export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 + # Disable telemetry on CI + if [[ $ci == true ]]; then + export DOTNET_CLI_TELEMETRY_OPTOUT=1 + fi + + # LTTNG is the logging infrastructure used by Core CLR. Need this variable set + # so it doesn't output warnings to the console. + export LTTNG_HOME="$HOME" + # Source Build uses DotNetCoreSdkDir variable if [[ -n "${DotNetCoreSdkDir:-}" ]]; then export DOTNET_INSTALL_DIR="$DotNetCoreSdkDir" fi # Find the first path on $PATH that contains the dotnet.exe - if [[ "$useInstalledDotNetCli" == true && -z "${DOTNET_INSTALL_DIR:-}" ]]; then + if [[ "$use_installed_dotnet_cli" == true && -z "${DOTNET_INSTALL_DIR:-}" ]]; then local dotnet_path=`command -v dotnet` if [[ -n "$dotnet_path" ]]; then ResolvePath "$dotnet_path" @@ -143,7 +178,37 @@ function GetDotNetInstallScript { _GetDotNetInstallScript="$install_script" } +function InitializeBuildTool { + if [[ -n "${_InitializeBuildTool:-}" ]]; then + return + fi + + InitializeDotNetCli $restore + + # return value + _InitializeBuildTool="$_InitializeDotNetCli/dotnet" +} + +function GetNuGetPackageCachePath { + if [[ -z ${NUGET_PACKAGES:-} ]]; then + if [[ "$use_global_nuget_cache" == true ]]; then + export NUGET_PACKAGES="$HOME/.nuget/packages" + else + export NUGET_PACKAGES="$repo_root/.packages" + fi + fi + + # return value + _GetNuGetPackageCachePath=$NUGET_PACKAGES +} + function InitializeToolset { + if [[ -n "${_InitializeToolset:-}" ]]; then + return + fi + + GetNuGetPackageCachePath + ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk" local toolset_version=$_ReadGlobalVersion @@ -152,7 +217,8 @@ function InitializeToolset { if [[ -a "$toolset_location_file" ]]; then local path=`cat "$toolset_location_file"` if [[ -a "$path" ]]; then - toolset_build_proj="$path" + # return value + _InitializeToolset="$path" return fi fi @@ -166,47 +232,17 @@ function InitializeToolset { local proj="$toolset_dir/restore.proj" echo '' > "$proj" + MSBuild "$proj" /t:__WriteToolsetLocation /noconsolelogger /bl:"$toolset_restore_log" /p:__ToolsetLocationOutputFile="$toolset_location_file" - MSBuild "$proj" /t:__WriteToolsetLocation /clp:None /bl:"$toolset_restore_log" /p:__ToolsetLocationOutputFile="$toolset_location_file" - local lastexitcode=$? - - if [[ $lastexitcode != 0 ]]; then - echo "Failed to restore toolset (exit code '$lastexitcode'). See log: $toolset_restore_log" >&2 - ExitWithExitCode $lastexitcode - fi - - toolset_build_proj=`cat "$toolset_location_file"` + local toolset_build_proj=`cat "$toolset_location_file"` if [[ ! -a "$toolset_build_proj" ]]; then echo "Invalid toolset path: $toolset_build_proj" >&2 ExitWithExitCode 3 fi -} - -function InitializeCustomToolset { - local script="$eng_root/restore-toolset.sh" - - if [[ -a "$script" ]]; then - . "$script" - fi -} - -function ConfigureTools { - local script="$eng_root/configure-toolset.sh" - - if [[ -a "$script" ]]; then - . "$script" - fi -} - -function InitializeTools { - ConfigureTools - - InitializeDotNetCli $restore - build_driver="$_InitializeDotNetCli/dotnet" - InitializeToolset - InitializeCustomToolset + # return value + _InitializeToolset="$toolset_build_proj" } function ExitWithExitCode { @@ -224,35 +260,57 @@ function StopProcesses { } function MSBuild { + if [[ "$ci" == true ]]; then + if [[ "$binary_log" != true ]]; then + echo "Binary log must be enabled in CI build." >&2 + ExitWithExitCode 1 + fi + + if [[ "$node_reuse" == true ]]; then + echo "Node reuse must be disabled in CI build." >&2 + ExitWithExitCode 1 + fi + fi + + InitializeBuildTool + local warnaserror_switch="" - if [[ $warnaserror == true ]]; then + if [[ $warn_as_error == true ]]; then warnaserror_switch="/warnaserror" fi - "$build_driver" msbuild /m /nologo /clp:Summary /v:$verbosity /nr:$nodereuse $warnaserror_switch "$@" + "$_InitializeBuildTool" msbuild /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error "$@" + lastexitcode=$? - return $? + if [[ $lastexitcode != 0 ]]; then + echo "Build failed (exit code '$lastexitcode')." >&2 + ExitWithExitCode $lastexitcode + fi } +ResolvePath "${BASH_SOURCE[0]}" +_script_dir=`dirname "$_ResolvePath"` + +eng_root=`cd -P "$_script_dir/.." && pwd` +repo_root=`cd -P "$_script_dir/../.." && pwd` +artifacts_dir="$repo_root/artifacts" +toolset_dir="$artifacts_dir/toolset" +log_dir="$artifacts_dir/log/$configuration" +temp_dir="$artifacts_dir/tmp/$configuration" + +global_json_file="$repo_root/global.json" + # HOME may not be defined in some scenarios, but it is required by NuGet if [[ -z $HOME ]]; then export HOME="$repo_root/artifacts/.home/" mkdir -p "$HOME" fi -if [[ -z ${NUGET_PACKAGES:-} ]]; then - if [[ $ci == true ]]; then - export NUGET_PACKAGES="$repo_root/.packages" - else - export NUGET_PACKAGES="$HOME/.nuget/packages" - fi -fi - mkdir -p "$toolset_dir" +mkdir -p "$temp_dir" mkdir -p "$log_dir" if [[ $ci == true ]]; then - mkdir -p "$temp_dir" export TEMP="$temp_dir" export TMP="$temp_dir" fi diff --git a/global.json b/global.json index fa66982036f4..225d336bbc0a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18608.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18610.4" } } From 8f9e03b83d9423dc1a8712b8931dd03ef0530278 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 12 Dec 2018 01:25:31 +0000 Subject: [PATCH 0242/2702] Update dependencies from https://github.com/dotnet/arcade build 717 (#232) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18611.9 --- eng/Version.Details.xml | 4 +- eng/common/CIBuild.cmd | 3 +- eng/common/README.md | 28 +++++++++++ eng/common/templates/jobs/jobs.yml | 4 +- eng/common/templates/steps/helix-publish.yml | 2 +- eng/common/templates/steps/send-to-helix.yml | 53 +++++++++++--------- global.json | 2 +- 7 files changed, 63 insertions(+), 33 deletions(-) create mode 100644 eng/common/README.md diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index feb957aea660..97db82a78bf9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6f6f4e5b974772c9949ed0f0baaf521a8c7991e4 + 2a5224589c802df6f76400bfef1df3918a817cb4 diff --git a/eng/common/CIBuild.cmd b/eng/common/CIBuild.cmd index 6544b0cd54f3..56c2f25ac22f 100644 --- a/eng/common/CIBuild.cmd +++ b/eng/common/CIBuild.cmd @@ -1,3 +1,2 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*" -exit /b %ErrorLevel% +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*" \ No newline at end of file diff --git a/eng/common/README.md b/eng/common/README.md new file mode 100644 index 000000000000..ff49c371527a --- /dev/null +++ b/eng/common/README.md @@ -0,0 +1,28 @@ +# Don't touch this folder + + uuuuuuuuuuuuuuuuuuuu + u" uuuuuuuuuuuuuuuuuu "u + u" u$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + $ $$$" ... "$... ...$" ... "$$$ ... "$$$ $ + $ $$$u `"$$$$$$$ $$$ $$$$$ $$ $$$ $$$ $ + $ $$$$$$uu "$$$$ $$$ $$$$$ $$ """ u$$$ $ + $ $$$""$$$ $$$$ $$$u "$$$" u$$ $$$$$$$$ $ + $ $$$$....,$$$$$..$$$$$....,$$$$..$$$$$$$$ $ + $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$$$$$" u" + "u "$$$$$$$$$$$$$$$$$$$$" u" + "u """""""""""""""""" u" + """""""""""""""""""" + +!!! Changes made in this directory are subject to being overwritten by automation !!! + +The files in this directory are shared by all Arcade repos and managed by automation. If you need to make changes to these files, open an issue or submit a pull request to https://github.com/dotnet/arcade first. diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 6aa55e3afc3b..8ab0f8248b07 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -20,8 +20,8 @@ parameters: # Optional: enable sending telemetry # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix # _HelixBuildConfig - differentiate between Debug, Release, other - # _HelixSource - Example: build/product/ - # _HelixType - Example: official/dotnet/arcade/$(Build.SourceBranch) + # _HelixType - Example: build/product/ + # _HelixSource - Example: official/dotnet/arcade/$(Build.SourceBranch) enableTelemetry: false # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job diff --git a/eng/common/templates/steps/helix-publish.yml b/eng/common/templates/steps/helix-publish.yml index 6dada380ceac..470ab65da0c6 100644 --- a/eng/common/templates/steps/helix-publish.yml +++ b/eng/common/templates/steps/helix-publish.yml @@ -40,7 +40,7 @@ steps: WorkItemCommand: ${{ parameters.WorkItemCommand }} CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitTargetFramework: ${{ parameters.XUnitTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitTargetFramework }} XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index d0622f3caf4d..03f0e3866298 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -1,29 +1,30 @@ parameters: - HelixSource: 'pr/default' # required - HelixType: 'tests/default/' # required - HelixBuild: $(Build.BuildNumber) # required - HelixTargetQueues: '' # required - HelixAccessToken: '' # required - HelixPreCommands: '' - HelixPostCommands: '' - WorkItemDirectory: '' - WorkItemCommand: '' - CorrelationPayloadDirectory: '' - XUnitProjects: '' - XUnitTargetFramework: '' - XUnitRunnerVersion: '' - IncludeDotNetCli: false - DotNetCliPackageType: '' - DotNetCliVersion: '' - EnableXUnitReporter: false - WaitForWorkItemCompletion: true - IsExternal: false - Creator: '' - condition: succeeded() - continueOnError: false + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/api/2018-03-14/info/queues for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true + XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects + XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner + XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + IsExternal: false # optional -- true requires Creator and will make the Mission Control results visible to folks outside the Microsoft Org + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false steps: - - script: '%BUILD_SOURCESDIRECTORY%\eng\common\msbuild.ps1 %BUILD_SOURCESDIRECTORY%\eng\common\helixpublish.proj /bl:%BUILD_SOURCESDIRECTORY%\artifacts\log\%BuildConfig%\SendToHelix.binlog' + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' displayName: Send job to Helix (Windows) env: BuildConfig: $(_BuildConfig) @@ -38,7 +39,8 @@ steps: WorkItemCommand: ${{ parameters.WorkItemCommand }} CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitTargetFramework: ${{ parameters.XUnitTargetFramework }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} @@ -64,7 +66,8 @@ steps: WorkItemCommand: ${{ parameters.WorkItemCommand }} CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} XUnitProjects: ${{ parameters.XUnitProjects }} - XUnitTargetFramework: ${{ parameters.XUnitTargetFramework }} + XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} + XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} diff --git a/global.json b/global.json index 225d336bbc0a..b390a11770f4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18610.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18611.9" } } From c3d0854b978ca31ab8a6b1675b2ec9c92db56b36 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 12 Dec 2018 07:34:31 +0000 Subject: [PATCH 0243/2702] Update dependency files (#233) * Update dependencies from https://github.com/dotnet/arcade build 720 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18611.11 * Update dependencies from https://github.com/dotnet/arcade build 721 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18611.13 * Update dependencies from https://github.com/dotnet/arcade build 723 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18611.14 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 97db82a78bf9..a862e177b62b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 2a5224589c802df6f76400bfef1df3918a817cb4 + 52b74227c1de4f20acb288bcece76e5a73acbe8b diff --git a/global.json b/global.json index b390a11770f4..21b8b309a7f0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18611.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18611.14" } } From 70944db04e09f19798a1d966c41d9c78a50bb884 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 12 Dec 2018 19:48:53 +0000 Subject: [PATCH 0244/2702] Update dependency files (#234) * Update dependencies from https://github.com/dotnet/arcade build 730 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18612.1 * Update dependencies from https://github.com/dotnet/arcade build 733 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18612.3 * Update dependencies from https://github.com/dotnet/arcade build 734 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18612.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a862e177b62b..c1dec994752e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 52b74227c1de4f20acb288bcece76e5a73acbe8b + 745100c063cbaf993b536e8f93a5ba8c7fb4d0ca diff --git a/global.json b/global.json index 21b8b309a7f0..86ce03331d61 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18611.14" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.4" } } From 354a6dadf6a15209d125253af405365a62c9695f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 12 Dec 2018 23:07:42 +0000 Subject: [PATCH 0245/2702] Update dependencies from https://github.com/dotnet/arcade build 738 (#235) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18612.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c1dec994752e..dc57ae6b9867 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 745100c063cbaf993b536e8f93a5ba8c7fb4d0ca + 8eb48f9a37296804609c1df854a07820610c557c diff --git a/global.json b/global.json index 86ce03331d61..ae609f805c44 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.6" } } From f75c1414487a23173dfc28e8eddba798334207a9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Dec 2018 00:40:31 +0000 Subject: [PATCH 0246/2702] Update dependencies from https://github.com/dotnet/arcade build 744 (#236) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18612.8 --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 8 ++++---- global.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dc57ae6b9867..5a771d2f4a96 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 8eb48f9a37296804609c1df854a07820610c557c + d7c9d455f3de1edd96618a1e5ab6a668ad138e02 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 0d0ebdc1456a..416eb30c8c81 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -87,7 +87,7 @@ function Exec-Process([string]$command, [string]$commandArgs) { } function InitializeDotNetCli([bool]$install) { - if (Test-Path global:_DotNetInstallDir) { + if (Test-Path variable:global:_DotNetInstallDir) { return $global:_DotNetInstallDir } @@ -170,7 +170,7 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { # Throws on failure. # function InitializeVisualStudioMSBuild([bool]$install) { - if (Test-Path global:_MSBuildExe) { + if (Test-Path variable:global:_MSBuildExe) { return $global:_MSBuildExe } @@ -297,7 +297,7 @@ function LocateVisualStudio { } function InitializeBuildTool() { - if (Test-Path global:_BuildTool) { + if (Test-Path variable:global:_BuildTool) { return $global:_BuildTool } @@ -364,7 +364,7 @@ function GetNuGetPackageCachePath() { } function InitializeToolset() { - if (Test-Path global:_ToolsetBuildProj) { + if (Test-Path variable:global:_ToolsetBuildProj) { return $global:_ToolsetBuildProj } diff --git a/global.json b/global.json index ae609f805c44..3cb00e245c91 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.8" } } From fdf5fed96ad19c5b2f5de69af937563829dd094c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Dec 2018 01:52:33 +0000 Subject: [PATCH 0247/2702] Update dependency files (#237) * Update dependencies from https://github.com/dotnet/arcade build 746 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18612.9 * Update dependencies from https://github.com/dotnet/arcade build 748 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18612.10 --- eng/Version.Details.xml | 4 ++-- eng/common/PublishBuildAssets.cmd | 2 +- eng/common/msbuild.ps1 | 4 ++++ eng/common/msbuild.sh | 4 ++++ .../templates/job/publish-build-assets.yml | 24 ++++++++++++++----- eng/common/templates/jobs/jobs.yml | 2 ++ global.json | 2 +- 7 files changed, 32 insertions(+), 10 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5a771d2f4a96..d7187f49ab25 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d7c9d455f3de1edd96618a1e5ab6a668ad138e02 + 662be09b3568220ff810a557bbdc8b7d349b4c6a diff --git a/eng/common/PublishBuildAssets.cmd b/eng/common/PublishBuildAssets.cmd index 399ca0bd32f1..ac629f00e12a 100644 --- a/eng/common/PublishBuildAssets.cmd +++ b/eng/common/PublishBuildAssets.cmd @@ -1,3 +1,3 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -msbuildEngine dotnet -restore -execute /p:PublishBuildAssets=true /p:SdkTaskProjects=PublishBuildAssets.proj %*" +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -msbuildEngine dotnet -restore -execute -binaryLog /p:PublishBuildAssets=true /p:SdkTaskProjects=PublishBuildAssets.proj %*" exit /b %ErrorLevel% diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 index 3cd667219a63..b37fd3d5e977 100644 --- a/eng/common/msbuild.ps1 +++ b/eng/common/msbuild.ps1 @@ -11,6 +11,10 @@ Param( . $PSScriptRoot\tools.ps1 try { + if ($ci) { + $nodeReuse = $false + } + MSBuild @extraArgs } catch { diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh index 6fe07cb7981a..8160cd5a59d1 100755 --- a/eng/common/msbuild.sh +++ b/eng/common/msbuild.sh @@ -50,5 +50,9 @@ done . "$scriptroot/tools.sh" +if [[ "$ci" == true ]]; then + node_reuse=false +fi + MSBuild $extra_args ExitWithExitCode 0 diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index b40016f6fc1c..c094658fefc7 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -1,10 +1,4 @@ parameters: - # Optional: dependencies of the job - dependsOn: '' - - # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool - pool: {} - configuration: 'Debug' # Optional: condition for the job to run @@ -13,6 +7,15 @@ parameters: # Optional: 'true' if future jobs should run even if this job fails continueOnError: false + # Optional: dependencies of the job + dependsOn: '' + + # Optional: Include PublishBuildArtifacts task + enablePublishBuildArtifacts: false + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: {} + # Optional: should run as a public build even in the internal project # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. runAsPublic: false @@ -49,3 +52,12 @@ jobs: displayName: Publish Build Assets condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_PublishBuildAssets + continueOnError: true + condition: always() diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 8ab0f8248b07..c7226b12ed28 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -73,3 +73,5 @@ jobs: pool: vmImage: vs2017-win2016 runAsPublic: ${{ parameters.runAsPublic }} + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} + diff --git a/global.json b/global.json index 3cb00e245c91..e1d858e9a635 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.10" } } From 319a881a2bd54670e0b4cfe5ece6571fa5590c83 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Dec 2018 03:54:00 +0000 Subject: [PATCH 0248/2702] Update dependencies from https://github.com/dotnet/arcade build 749 (#238) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18612.11 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d7187f49ab25..8015eea6b6fe 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 662be09b3568220ff810a557bbdc8b7d349b4c6a + 436aed81a806afdcc26aca0b40f1d0a7474a8451 diff --git a/global.json b/global.json index e1d858e9a635..e24cb2843867 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.11" } } From 207e0f5be2bdc5be70652b2b107414357239dd4a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Dec 2018 05:25:53 +0000 Subject: [PATCH 0249/2702] Update dependencies from https://github.com/dotnet/arcade build 751 (#239) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18612.12 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8015eea6b6fe..d8dda5d81a1d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 436aed81a806afdcc26aca0b40f1d0a7474a8451 + ffc7a871add67b229c7fd41ad1cdff41da926312 diff --git a/global.json b/global.json index e24cb2843867..4b54e0bf0289 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.11" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.12" } } From 45f04e44bbb1cbe52a7c1a92afb8d313c1c204fb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Dec 2018 20:07:16 +0000 Subject: [PATCH 0250/2702] Update dependencies from https://github.com/dotnet/arcade build 760 (#240) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.2 --- eng/Version.Details.xml | 4 ++-- eng/common/templates/job/job.yml | 15 +++++++++++++++ global.json | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d8dda5d81a1d..15b4cb920b56 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ffc7a871add67b229c7fd41ad1cdff41da926312 + d90d0f17c4b53cbd80e1b96c731abda2c7230092 diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 9fb858e48714..5e293db35d7e 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -95,11 +95,26 @@ jobs: variables: - ${{ each variable in parameters.variables }}: + # handle name-value variable syntax + # example: + # - name: [key] + # value: [value] - ${{ if ne(variable.name, '') }}: - name: ${{ variable.name }} value: ${{ variable.value }} + + # handle variable groups - ${{ if ne(variable.group, '') }}: - group: ${{ variable.group }} + + # handle key-value variable syntax. + # example: + # - [key]: [value] + - ${{ if and(eq(variable.name, ''), eq(variable.group, '')) }}: + - ${{ each pair in variable }}: + - name: ${{ pair.key }} + value: ${{ pair.value }} + # Add additional variables - ${{ if and(ne(parameters.helixRepo, ''), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notIn(variables['Build.Reason'], 'PullRequest')) }}: - name: _HelixSource diff --git a/global.json b/global.json index 4b54e0bf0289..a02c71d35a9a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18612.12" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.2" } } From 1617d20738bf5771a8aecdddfa5bf664e54b6660 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Dec 2018 22:00:28 +0000 Subject: [PATCH 0251/2702] Update dependency files (#241) * Update dependencies from https://github.com/dotnet/arcade build 761 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.3 * Update dependencies from https://github.com/dotnet/arcade build 763 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 15b4cb920b56..03200cda7489 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d90d0f17c4b53cbd80e1b96c731abda2c7230092 + 24bca3cacd7c43e9525096aad7bf4d0775e3b5ca diff --git a/global.json b/global.json index a02c71d35a9a..79ad01a5c870 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.4" } } From 41f20b762f8cf9fa588086aa23db713f012fffd8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Dec 2018 22:50:32 +0000 Subject: [PATCH 0252/2702] Update dependency files (#242) * Update dependencies from https://github.com/dotnet/arcade build 766 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.5 * Update dependencies from https://github.com/dotnet/arcade build 768 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 03200cda7489..ac71b480fc5e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 24bca3cacd7c43e9525096aad7bf4d0775e3b5ca + 824227c92d0bb3ca25df1eca901572d780f5795e diff --git a/global.json b/global.json index 79ad01a5c870..f2dff52a73b5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.6" } } From 9f2a4586e8a83c4af525350b1fca814e730cf6ca Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 13 Dec 2018 23:11:02 +0000 Subject: [PATCH 0253/2702] Update dependencies from https://github.com/dotnet/arcade build 771 (#244) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ac71b480fc5e..68ec19754042 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 824227c92d0bb3ca25df1eca901572d780f5795e + b4d6c24e8d99fb27d0415307292d3f2db7e78445 diff --git a/global.json b/global.json index f2dff52a73b5..4ee33f08f7bc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.7" } } From be9a6354abb3ce8b5ff97c42a39b3206e955ed4e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Dec 2018 00:54:27 +0000 Subject: [PATCH 0254/2702] Update dependency files (#245) * Update dependencies from https://github.com/dotnet/arcade build 772 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.10 * Update dependencies from https://github.com/dotnet/arcade build 775 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.15 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 68ec19754042..563fb296a7ef 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b4d6c24e8d99fb27d0415307292d3f2db7e78445 + c68a0daa463d337b0297eba2d28a9ab06b40a8cb diff --git a/global.json b/global.json index 4ee33f08f7bc..16848ffe5236 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.15" } } From fef8da89d449a3507ae5d3d40c3e6971a08ccd90 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Dec 2018 03:48:52 +0000 Subject: [PATCH 0255/2702] Update dependencies from https://github.com/dotnet/arcade build 778 (#246) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.19 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 563fb296a7ef..36efee10bca3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - c68a0daa463d337b0297eba2d28a9ab06b40a8cb + 51db89556e676085aa06dbe1ae930ed4a3dd5f6a diff --git a/global.json b/global.json index 16848ffe5236..10a1d53843f8 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.15" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.19" } } From 4ecc96806fdd38b3ee88ce24b6256bf30f4b717b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Dec 2018 06:50:59 +0000 Subject: [PATCH 0256/2702] Update dependencies from https://github.com/dotnet/arcade build 779 (#247) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18613.20 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 36efee10bca3..4ec56bdecb79 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 51db89556e676085aa06dbe1ae930ed4a3dd5f6a + 76eb87c3f3de6954a2523490688e3a93e1763256 diff --git a/global.json b/global.json index 10a1d53843f8..06ef2d83294a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.19" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.20" } } From eadf77b027138cf05ab15c7d16b569f525431583 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Dec 2018 14:36:27 +0000 Subject: [PATCH 0257/2702] Update dependencies from https://github.com/dotnet/arcade build 783 (#248) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18614.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4ec56bdecb79..f55e56eb85d8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 76eb87c3f3de6954a2523490688e3a93e1763256 + 61e838eea6bfd59af78a3598362ff0f59d014664 diff --git a/global.json b/global.json index 06ef2d83294a..61e250723153 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18613.20" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18614.1" } } From 38104ee6c8a8df1865fa21b133f3889d65575bfa Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Dec 2018 19:45:58 +0000 Subject: [PATCH 0258/2702] Update dependencies from https://github.com/dotnet/arcade build 787 (#249) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18614.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f55e56eb85d8..280619372b27 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 61e838eea6bfd59af78a3598362ff0f59d014664 + c202d2ec3a4e0d1f75c23083aba78bbf2a0d4a6a diff --git a/global.json b/global.json index 61e250723153..faa167246a53 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18614.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18614.2" } } From ab04e13f3a1b2a2222ea0bd2f0e9aeb2dcf79407 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 14 Dec 2018 21:55:10 +0000 Subject: [PATCH 0259/2702] Update dependencies from https://github.com/dotnet/arcade build 791 (#250) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18614.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 280619372b27..09c2896635b4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - c202d2ec3a4e0d1f75c23083aba78bbf2a0d4a6a + f30a96104c5be5720c74934d37d76b91959ec60d diff --git a/global.json b/global.json index faa167246a53..cd1c96804a1f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18614.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18614.3" } } From c6d2efd8d12c0542e7d51bb63ab97589113586f5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 15 Dec 2018 14:35:46 +0000 Subject: [PATCH 0260/2702] Update dependencies from https://github.com/dotnet/arcade build 802 (#252) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18615.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 09c2896635b4..f69cc5b392cb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - f30a96104c5be5720c74934d37d76b91959ec60d + 3befdb62fd0e1c2c5750f3548f19cc0e7c8ff2cb diff --git a/global.json b/global.json index cd1c96804a1f..d2eae687c90a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18614.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18615.1" } } From 9b45d519f15cea48996de1559a8939db555b8f04 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 16 Dec 2018 21:37:49 +0000 Subject: [PATCH 0261/2702] Update dependency files (#253) * Update dependencies from https://github.com/dotnet/arcade build 807 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18616.1 * Update dependencies from https://github.com/dotnet/arcade build 810 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18616.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f69cc5b392cb..9b9fc896076e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3befdb62fd0e1c2c5750f3548f19cc0e7c8ff2cb + 54de3401ba26d4d77c0883960f9b819446c780b6 diff --git a/global.json b/global.json index d2eae687c90a..a8a8214caee9 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18615.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18616.2" } } From de603d4dcfbd3420065f6c8d0aed143b18ca3ca6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 16 Dec 2018 21:44:39 +0000 Subject: [PATCH 0262/2702] Update dependencies from https://github.com/dotnet/arcade build 812 (#254) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18616.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9b9fc896076e..6e25545696ed 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 54de3401ba26d4d77c0883960f9b819446c780b6 + 0c8e82a2231846179e8ed2dc513989b05ef52ad0 diff --git a/global.json b/global.json index a8a8214caee9..e23fbbd597fd 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18616.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18616.3" } } From 691e4d84dc415c8b71dd39397dfe3439a1119d61 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 16 Dec 2018 22:48:15 +0000 Subject: [PATCH 0263/2702] Update dependencies from https://github.com/dotnet/arcade build 814 (#255) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18616.4 --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 24 +++++++++++++++--------- eng/common/tools.sh | 4 ++++ global.json | 2 +- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6e25545696ed..f00ea0288d5b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 0c8e82a2231846179e8ed2dc513989b05ef52ad0 + bb85f76f9a85f5e3c84b0587023a11d2cee1470d diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 416eb30c8c81..a607ec608085 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -136,6 +136,11 @@ function InitializeDotNetCli([bool]$install) { $env:DOTNET_INSTALL_DIR = $dotnetRoot } + # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom + # build steps from using anything other than what we've downloaded. + # It also ensures that VS msbuild will use the downloaded sdk targets. + $env:PATH = "$dotnetRoot;$env:PATH" + return $global:_DotNetInstallDir = $dotnetRoot } @@ -169,12 +174,13 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { # Returns full path to msbuild.exe. # Throws on failure. # -function InitializeVisualStudioMSBuild([bool]$install) { +function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $null) { if (Test-Path variable:global:_MSBuildExe) { return $global:_MSBuildExe } - $vsMinVersionStr = if (!$GlobalJson.tools.vs.version) { $GlobalJson.tools.vs.version } else { "15.9" } + if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } + $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { "15.9" } $vsMinVersion = [Version]::new($vsMinVersionStr) # Try msbuild command available in the environment. @@ -191,7 +197,7 @@ function InitializeVisualStudioMSBuild([bool]$install) { } # Locate Visual Studio installation or download x-copy msbuild. - $vsInfo = LocateVisualStudio + $vsInfo = LocateVisualStudio $vsRequirements if ($vsInfo -ne $null) { $vsInstallDir = $vsInfo.installationPath $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] @@ -255,7 +261,7 @@ function InstallXCopyMSBuild([string] $packageVersion) { # Returns JSON describing the located VS instance (same format as returned by vswhere), # or $null if no instance meeting the requirements is found on the machine. # -function LocateVisualStudio { +function LocateVisualStudio([object]$vsRequirements = $null){ if (Get-Member -InputObject $GlobalJson.tools -Name "vswhere") { $vswhereVersion = $GlobalJson.tools.vswhere } else { @@ -271,16 +277,16 @@ function LocateVisualStudio { Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe } - $vs = $GlobalJson.tools.vs + if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } $args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild") - if (Get-Member -InputObject $vs -Name "version") { + if (Get-Member -InputObject $vsRequirements -Name "version") { $args += "-version" - $args += $vs.version + $args += $vsRequirements.version } - if (Get-Member -InputObject $vs -Name "components") { - foreach ($component in $vs.components) { + if (Get-Member -InputObject $vsRequirements -Name "components") { + foreach ($component in $vsRequirements.components) { $args += "-requires" $args += $component } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 4d7e304f13d7..65f689775cbc 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -136,6 +136,10 @@ function InitializeDotNetCli { fi fi + # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom + # build steps from using anything other than what we've downloaded. + export PATH="$dotnet_root:$PATH" + # return value _InitializeDotNetCli="$dotnet_root" } diff --git a/global.json b/global.json index e23fbbd597fd..1639db3f0e6f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18616.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18616.4" } } From c3b3aac9d16f5d0b388dece27e6c565b74e940ea Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 17 Dec 2018 01:49:59 +0000 Subject: [PATCH 0264/2702] Update dependencies from https://github.com/dotnet/arcade build 817 (#256) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18616.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f00ea0288d5b..b80a5e0df014 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - bb85f76f9a85f5e3c84b0587023a11d2cee1470d + 8694eb83a2c13057a8da3c80f829363de4dc8c9c diff --git a/global.json b/global.json index 1639db3f0e6f..f28c994e1315 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18616.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18616.5" } } From e373a2b9851c4d2fe37f5d708dc0591d78e9e855 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 17 Dec 2018 14:33:39 +0000 Subject: [PATCH 0265/2702] Update dependencies from https://github.com/dotnet/arcade build 819 (#257) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18617.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b80a5e0df014..0b7211f50211 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 8694eb83a2c13057a8da3c80f829363de4dc8c9c + 7d9348658fcd59770ca5949934accf1d7353e24e diff --git a/global.json b/global.json index f28c994e1315..563367530649 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18616.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.1" } } From 7d0c7cdb079447ccf36c93fac21dc02913e251bf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 17 Dec 2018 18:08:29 +0000 Subject: [PATCH 0266/2702] Update dependencies from https://github.com/dotnet/arcade build 825 (#258) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18617.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0b7211f50211..d51053c37ce5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 7d9348658fcd59770ca5949934accf1d7353e24e + 10ec5d3f233dbd73174742222c77f9b32a4da6b0 diff --git a/global.json b/global.json index 563367530649..f239efb45d6c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.2" } } From a4ac8136244e30350612673fc0568f978a2bf2f0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 17 Dec 2018 23:04:51 +0000 Subject: [PATCH 0267/2702] Update dependencies from https://github.com/dotnet/arcade build 835 (#259) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18617.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d51053c37ce5..1a1394ea9e0c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 10ec5d3f233dbd73174742222c77f9b32a4da6b0 + 19f9e0068f34676c2efa17038109170882433fa0 diff --git a/global.json b/global.json index f239efb45d6c..49a691253cbf 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.3" } } From e321fc8bdff98c39f2731a90bc50442369053b61 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 17 Dec 2018 23:15:06 +0000 Subject: [PATCH 0268/2702] Update dependencies from https://github.com/dotnet/arcade build 836 (#260) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18617.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1a1394ea9e0c..a6d79eea5f38 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 19f9e0068f34676c2efa17038109170882433fa0 + 21cb5a3c7d461b86529267ecd5e9473f56095b65 diff --git a/global.json b/global.json index 49a691253cbf..eadae370d656 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.4" } } From a62035e1121ccdd72bd641e37e43650521f0f7b6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 18 Dec 2018 01:24:10 +0000 Subject: [PATCH 0269/2702] Update dependency files (#261) * Update dependencies from https://github.com/dotnet/arcade build 839 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18617.5 * Update dependencies from https://github.com/dotnet/arcade build 841 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18617.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a6d79eea5f38..a3429bba48be 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 21cb5a3c7d461b86529267ecd5e9473f56095b65 + ff4d04871c8156d4f4c34335d78a3df35f91b7e1 diff --git a/global.json b/global.json index eadae370d656..40d5822979d7 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.6" } } From 99706219c4bcfab3996a98ea5b1fa9828cc16632 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 18 Dec 2018 19:16:28 +0000 Subject: [PATCH 0270/2702] Update dependency files (#262) * Update dependencies from https://github.com/dotnet/arcade build 844 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18617.7 * Update dependencies from https://github.com/dotnet/arcade build 858 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18618.1 --- eng/Version.Details.xml | 4 ++-- eng/common/build.ps1 | 11 +++++------ eng/common/build.sh | 5 ++--- global.json | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a3429bba48be..33d19d61bf7c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ff4d04871c8156d4f4c34335d78a3df35f91b7e1 + 53458688ee917e348a3f0be45a1ec8b1964fa5a0 diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 5241f42e3583..d282c71cf8f8 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -1,7 +1,7 @@ [CmdletBinding(PositionalBinding=$false)] Param( [string][Alias('c')]$configuration = "Debug", - [string] $projects = "", + [string] $projects, [string][Alias('v')]$verbosity = "minimal", [string] $msbuildEngine = $null, [bool] $warnAsError = $true, @@ -79,10 +79,13 @@ function Build { InitializeCustomToolset $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" } + if ($projects) { + $properties += "/p:Projects=$projects" + } + MSBuild $toolsetBuildProj ` $bl ` /p:Configuration=$configuration ` - /p:Projects=$projects ` /p:RepoRoot=$RepoRoot ` /p:Restore=$restore ` /p:DeployDeps=$deployDeps ` @@ -106,10 +109,6 @@ try { exit 0 } - if ($projects -eq "") { - $projects = Join-Path $RepoRoot "*.sln" - } - if ($ci) { $binaryLog = $true $nodeReuse = $false diff --git a/eng/common/build.sh b/eng/common/build.sh index 03b4436e1b9e..47af926d4d42 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -159,8 +159,8 @@ function Build { InitializeToolset InitializeCustomToolset - if [[ -z $projects ]]; then - projects="$repo_root/*.sln" + if [[ ! -z "$projects" ]]; then + properties="$properties /p:Projects=$projects" fi local bl="" @@ -171,7 +171,6 @@ function Build { MSBuild $_InitializeToolset \ $bl \ /p:Configuration=$configuration \ - /p:Projects="$projects" \ /p:RepoRoot="$repo_root" \ /p:Restore=$restore \ /p:Build=$build \ diff --git a/global.json b/global.json index 40d5822979d7..f0a498107007 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18617.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.1" } } From a90022649bea062ee61c5d1c80724cc5ca7b3b09 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 18 Dec 2018 19:31:39 +0000 Subject: [PATCH 0271/2702] Update dependencies from https://github.com/dotnet/arcade build 861 (#263) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18618.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 33d19d61bf7c..461ccb62dcf0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 53458688ee917e348a3f0be45a1ec8b1964fa5a0 + 32bf7bdd66be4349566d2b87951a10315c2f2996 diff --git a/global.json b/global.json index f0a498107007..9b6a17814b23 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.2" } } From 6a6f1dbdaa37c2f484973b46a62dd4b98288b20d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 18 Dec 2018 22:31:38 +0000 Subject: [PATCH 0272/2702] Update dependencies from https://github.com/dotnet/arcade build 872 (#264) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18618.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 461ccb62dcf0..b11747232c7a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 32bf7bdd66be4349566d2b87951a10315c2f2996 + 6f4c9d6427829807ad1fc4432f6f7d544e982c67 diff --git a/global.json b/global.json index 9b6a17814b23..b0c549a1a8cb 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.3" } } From a8a6b48c4b6afae3568618a747c5e89f47734f9c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 18 Dec 2018 23:54:31 +0000 Subject: [PATCH 0273/2702] Update dependencies from https://github.com/dotnet/arcade build 875 (#265) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18618.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b11747232c7a..d7c4cf8ec9d4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6f4c9d6427829807ad1fc4432f6f7d544e982c67 + 3d9032bf7664abf99e8da86cdeb02f32d6cf4153 diff --git a/global.json b/global.json index b0c549a1a8cb..e09e7b2d208f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.4" } } From 8bfc0158f9a480ff9531b8fa361b4e92f6c5219b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Dec 2018 00:10:08 +0000 Subject: [PATCH 0274/2702] Update dependencies from https://github.com/dotnet/arcade build 877 (#266) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18618.5 --- eng/Version.Details.xml | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d7c4cf8ec9d4..139415421364 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,7 +2,7 @@ - + https://github.com/dotnet/arcade 3d9032bf7664abf99e8da86cdeb02f32d6cf4153 diff --git a/global.json b/global.json index e09e7b2d208f..2634b6712aab 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.5" } } From ef8bf86d7becb047319524e2c5d38f3a51b2fb48 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Dec 2018 01:25:51 +0000 Subject: [PATCH 0275/2702] Update dependencies from https://github.com/dotnet/arcade build 885 (#267) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18618.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 139415421364..03f54be1d1ea 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3d9032bf7664abf99e8da86cdeb02f32d6cf4153 + 090315e5d933cba3798abbfaa43e49e2245d6b35 diff --git a/global.json b/global.json index 2634b6712aab..46b8c5175d69 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.7" } } From 0560580e17a9586c0bdce164dc161efe97ad07c0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Dec 2018 14:51:24 +0000 Subject: [PATCH 0276/2702] Update dependencies from https://github.com/dotnet/arcade build 893 (#268) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18619.1 --- eng/Version.Details.xml | 4 +-- eng/common/PublishToPackageFeed.proj | 37 ++++++++++++++++++++++++++++ global.json | 2 +- 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 eng/common/PublishToPackageFeed.proj diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 03f54be1d1ea..19a5cc8e0281 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 090315e5d933cba3798abbfaa43e49e2245d6b35 + b6aed72b1d4ec3c006c465ec16f14e6908fef1ea diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj new file mode 100644 index 000000000000..7dc478d981f6 --- /dev/null +++ b/eng/common/PublishToPackageFeed.proj @@ -0,0 +1,37 @@ + + + + netcoreapp2.1 + + + + + + + + + + + + + + + + + + diff --git a/global.json b/global.json index 46b8c5175d69..aafbf7f4703f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18618.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18619.1" } } From 8086f21626696fc0d32f0f03dfd74ac7d3f6d194 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Dec 2018 19:19:25 +0000 Subject: [PATCH 0277/2702] Update dependencies from https://github.com/dotnet/arcade build 899 (#269) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18619.2 --- eng/Version.Details.xml | 4 ++-- eng/common/build.ps1 | 6 +++++- global.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 19a5cc8e0281..8c3aa8eecd4b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b6aed72b1d4ec3c006c465ec16f14e6908fef1ea + 80d6a84b09315c1b29ff49c2e46784704e04d587 diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index d282c71cf8f8..2f5e6052a85f 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -80,7 +80,11 @@ function Build { $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" } if ($projects) { - $properties += "/p:Projects=$projects" + # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons. + # Explicitly set the type as string[] because otherwise PowerShell would make this char[] if $properties is empty. + [string[]] $msbuildArgs = $properties + $msbuildArgs += "/p:Projects=$projects" + $properties = $msbuildArgs } MSBuild $toolsetBuildProj ` diff --git a/global.json b/global.json index aafbf7f4703f..f46a58589eb1 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18619.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18619.2" } } From 8512a165b2e4ee8e3f8d283fdae39d4e94393926 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 20 Dec 2018 00:17:50 +0000 Subject: [PATCH 0278/2702] Update dependencies from https://github.com/dotnet/arcade build 908 (#270) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18619.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8c3aa8eecd4b..cb7c9908908d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 80d6a84b09315c1b29ff49c2e46784704e04d587 + 7d79a676328f2bdd8b14bfee7fac6dad23123fad diff --git a/global.json b/global.json index f46a58589eb1..9396b0301409 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18619.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18619.4" } } From 368fc7a8d1f3da5b85e32be4e227c2f06ef1e8ed Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 20 Dec 2018 15:38:02 +0000 Subject: [PATCH 0279/2702] Update dependencies from https://github.com/dotnet/arcade build 916 (#271) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18619.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cb7c9908908d..cf12eef2df0d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 7d79a676328f2bdd8b14bfee7fac6dad23123fad + 8efaf6948e772a5754d3e6759dfe6dce86bc19f2 diff --git a/global.json b/global.json index 9396b0301409..0a2bb610ca74 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18619.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18619.7" } } From 98dc8e8d3481398d717ae6b4f35c1ab5a9cb9bd1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 20 Dec 2018 20:10:52 +0000 Subject: [PATCH 0280/2702] Update dependencies from https://github.com/dotnet/arcade build 929 (#272) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18620.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cf12eef2df0d..1c25de0cc98e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 8efaf6948e772a5754d3e6759dfe6dce86bc19f2 + 39ef8c3ae4a22c131dac911ce53df66c6db4ff3b diff --git a/global.json b/global.json index 0a2bb610ca74..c0e252967c0b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18619.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18620.2" } } From 26b94f73d5cf46f2f57c2543e2659288b46704f6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Dec 2018 00:42:43 +0000 Subject: [PATCH 0281/2702] Update dependencies from https://github.com/dotnet/arcade build 933 (#273) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18620.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1c25de0cc98e..2c89b0e1faf2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 39ef8c3ae4a22c131dac911ce53df66c6db4ff3b + 0506da59ec897df939ed4a4c4c10c0cdba13f26e diff --git a/global.json b/global.json index c0e252967c0b..6244aef029bc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18620.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18620.4" } } From f2b6b9eb222bca7917d7a36a394b1c5bca913b7e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Dec 2018 02:16:32 +0000 Subject: [PATCH 0282/2702] Update dependencies from https://github.com/dotnet/arcade build 943 (#274) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18620.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2c89b0e1faf2..afde29015b4f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 0506da59ec897df939ed4a4c4c10c0cdba13f26e + f3336ecb1009ee5c6f68142c0d05a68bc5609a60 diff --git a/global.json b/global.json index 6244aef029bc..879e9136cdb8 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18620.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18620.6" } } From 80925fcf4c19b364d8d91fb6bfb2608c19af8ce8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 21 Dec 2018 17:39:51 +0000 Subject: [PATCH 0283/2702] Update dependencies from https://github.com/dotnet/arcade build 946 (#275) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18620.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index afde29015b4f..42711122416c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - f3336ecb1009ee5c6f68142c0d05a68bc5609a60 + e42dd37d2338bc4c0d8c5a9a6070ff17f2574e32 diff --git a/global.json b/global.json index 879e9136cdb8..d7f3d95a4afc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18620.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18620.7" } } From 997c2b4df23aa0cdc145112ae4b5bac1b06451b5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 26 Dec 2018 15:25:38 +0000 Subject: [PATCH 0284/2702] Update dependencies from https://github.com/dotnet/arcade build 950 (#276) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18621.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 42711122416c..cade9b33a1d2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e42dd37d2338bc4c0d8c5a9a6070ff17f2574e32 + e3938d0b7813b69757e638e5e0d11667ea65f9f5 diff --git a/global.json b/global.json index d7f3d95a4afc..e7b01a9c32bf 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18620.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18621.1" } } From f645157219646120860a647b0828aaa2272ff464 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 26 Dec 2018 15:32:31 +0000 Subject: [PATCH 0285/2702] Update dependencies from https://github.com/dotnet/arcade build 970 (#277) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18621.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cade9b33a1d2..07b71d39e81a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e3938d0b7813b69757e638e5e0d11667ea65f9f5 + 565dad7c7b14378d2fd084c324e5db28b311fd60 diff --git a/global.json b/global.json index e7b01a9c32bf..c923ca834c37 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18621.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18621.6" } } From 0046ccb834c01a7a5672de9d3cf6268531c83695 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 28 Dec 2018 16:46:16 +0000 Subject: [PATCH 0286/2702] Update dependencies from https://github.com/dotnet/arcade build 1026 (#278) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18627.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 07b71d39e81a..c3ba4b16028d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 565dad7c7b14378d2fd084c324e5db28b311fd60 + d740b8928595e1ceec4404f39c3ce22ccdf9efde diff --git a/global.json b/global.json index c923ca834c37..6ec4893cac65 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18621.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18627.1" } } From 55e5dc12d3127bd54c61479f78f493d24fc37065 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 29 Dec 2018 14:43:44 +0000 Subject: [PATCH 0287/2702] Update dependencies from https://github.com/dotnet/arcade build 1039 (#279) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18629.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c3ba4b16028d..e1bb44a9236a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - d740b8928595e1ceec4404f39c3ce22ccdf9efde + aa2b09ca90482c1f05bcac21596b67b2a4079171 diff --git a/global.json b/global.json index 6ec4893cac65..f7c462a947b9 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18627.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18629.1" } } From f4231885c70a8a08e02a894972bffacc0bcb4e20 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 30 Dec 2018 15:10:26 +0000 Subject: [PATCH 0288/2702] Update dependencies from https://github.com/dotnet/arcade build 1049 (#280) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18630.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e1bb44a9236a..f9b9d12fbcb1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - aa2b09ca90482c1f05bcac21596b67b2a4079171 + e2cb8819f35f3375d84b231aeda5627361cda7bf diff --git a/global.json b/global.json index f7c462a947b9..99aac6c3876d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18629.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18630.1" } } From 991c9db8fbaf00d291505ace3cab66c58d1e1f4e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 31 Dec 2018 07:40:36 +0000 Subject: [PATCH 0289/2702] Update dependencies from https://github.com/dotnet/arcade build 1060 (#281) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18630.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f9b9d12fbcb1..94d656f10839 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - e2cb8819f35f3375d84b231aeda5627361cda7bf + 96c87ddd97d9c562ef77f1e4606a0dbb000ab644 diff --git a/global.json b/global.json index 99aac6c3876d..49abbeb75c5a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18630.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18630.2" } } From 81aa55ac00468cefe71a66938a8f8eb47c309875 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 31 Dec 2018 20:50:45 +0000 Subject: [PATCH 0290/2702] Update dependencies from https://github.com/dotnet/arcade build 1073 (#282) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.18631.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 94d656f10839..2ec2b6a5ece8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 96c87ddd97d9c562ef77f1e4606a0dbb000ab644 + 5703ece98894652387456b2d68248e8a9ecf0db1 diff --git a/global.json b/global.json index 49abbeb75c5a..102d9885098f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18630.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18631.2" } } From e92d9776e23756221c3a0d5589f81ee10bdee7bc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 1 Jan 2019 15:12:06 +0000 Subject: [PATCH 0291/2702] Update dependencies from https://github.com/dotnet/arcade build 1081 (#283) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19051.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2ec2b6a5ece8..252906ae5eec 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 5703ece98894652387456b2d68248e8a9ecf0db1 + 812e1ecae150669e93d3305b103b27701dd697b8 diff --git a/global.json b/global.json index 102d9885098f..8705fdef4e92 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18631.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19051.1" } } From f3de90f100e14a3475b3510f82682c716b26660f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 2 Jan 2019 16:48:08 +0000 Subject: [PATCH 0292/2702] Update dependencies from https://github.com/dotnet/arcade build 1094 (#284) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19052.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 252906ae5eec..b8464bc566b4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 812e1ecae150669e93d3305b103b27701dd697b8 + cbd7387984f7209237a7f63506c63e639a15b377 diff --git a/global.json b/global.json index 8705fdef4e92..d19ac798ae36 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.300" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19051.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19052.1" } } From db3bf5c234e27816c2347f59aeba16690f5106b8 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Wed, 2 Jan 2019 13:32:25 -0800 Subject: [PATCH 0293/2702] Add Helix job sending (#201) --- Documentation.md | 16 ------ HelloTests/HelloTests.cs | 14 +++++ HelloTests/HelloTests.csproj | 13 +++++ HelloWorld.sln | 13 ++++- README.md | 60 ++++++++++++++++++-- Roadmap.md | 20 ------- azure-pipelines.yml | 103 ++++++++++++++++++++++++++++++++++- global.json | 5 +- 8 files changed, 198 insertions(+), 46 deletions(-) delete mode 100644 Documentation.md create mode 100644 HelloTests/HelloTests.cs create mode 100644 HelloTests/HelloTests.csproj delete mode 100644 Roadmap.md diff --git a/Documentation.md b/Documentation.md deleted file mode 100644 index e516759574b3..000000000000 --- a/Documentation.md +++ /dev/null @@ -1,16 +0,0 @@ -# Documentation - -This documents [@jonfortescue](https://github.com/jonfortescue)'s process in creating this repository. - -1. Created a new repository on GitHub to test this whole VSTS integrated PR deal. -2. Created the default .NET Core console app project in Visual Studio which runs "Hello World" and committed it to the repository. -3. Since this test repository will not be doing internal builds (only PR and CI), we will not be creating a VSTS mirror of the repository. -4. Added a Windows queue with a basic set up for builds (use .NET CLI, run `restore`, `build`, `publish`). As part of troubleshooting this, added `Build.Repository.Clean: true` to the build to ensure binaries were cleaned from the build machine. Also added `targetFramework: netcoreapp2.0` as a build variable and referenced it during the `publish` step to prevent build breaks. -5. Use matrices to run debug and release builds in simultaneous phases -6. Broke out the build steps into a `build.yml` template to prepare for code reuse on step 7 -7. Added Linux and OSX queues. For the OSX queue, initially ran into authorization problem; issue was fixed following the steps detailed in [Arcade's Azure DevOps Onboarding doc](https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/AzureDevOpsOnboarding.md#Troubleshooting) under the section **Troubleshooting/Queuing builds** (second bullet point). -8. As part of troubleshooting step 7: added a step for installing the .NET CLI and ensured the most recent version was used (caused segfaults on Mac otherwise). Also added `DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1` and `DOTNET_MULTILEVEL_LOOKUP: 0` as environment variables for the `restore` step to prevent restoring the entire cache to the build machine. -9. Added `{{ if }}` directives for the publish step based on build configuration. As of right now, is not working. *TODO: update with fix when working*. -10. Added `Build.Reason` if-directives to prevent `Release` builds from running on pull requests. -11. Added a CI integration trigger linked to the `master` branch. -12. Added a CI build status badge to the Readme. \ No newline at end of file diff --git a/HelloTests/HelloTests.cs b/HelloTests/HelloTests.cs new file mode 100644 index 000000000000..6b5462ed6d51 --- /dev/null +++ b/HelloTests/HelloTests.cs @@ -0,0 +1,14 @@ +using System; +using Xunit; + +namespace HelloTests +{ + public class HelloTests + { + [Fact] + public void SuccessfulTest() + { + Assert.True(true); + } + } +} diff --git a/HelloTests/HelloTests.csproj b/HelloTests/HelloTests.csproj new file mode 100644 index 000000000000..c908c1b74b37 --- /dev/null +++ b/HelloTests/HelloTests.csproj @@ -0,0 +1,13 @@ + + + + netcoreapp2.0;netcoreapp2.1 + false + + + + + + + + diff --git a/HelloWorld.sln b/HelloWorld.sln index 8d74c81f422e..a04ca15e2e0a 100644 --- a/HelloWorld.sln +++ b/HelloWorld.sln @@ -3,7 +3,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27912.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{0D23A41B-2626-4703-9E4A-87C07F69B0B2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{0D23A41B-2626-4703-9E4A-87C07F69B0B2}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A275E4CF-6AF3-439A-B72B-A2EDAE49A5C6}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloTests", "HelloTests\HelloTests.csproj", "{6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +22,10 @@ Global {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Debug|Any CPU.Build.0 = Debug|Any CPU {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Release|Any CPU.ActiveCfg = Release|Any CPU {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Release|Any CPU.Build.0 = Release|Any CPU + {6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index fe4a8277c4df..3a803ad914ce 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ trigger: Arcade is designed to make many of the more complex tasks (such as sending telemetry) simple to do out of the box. It is therefore recommended that all builds base themselves on Arcade's `base.yml` template. Today, this can be done by copying the `eng/common` folder from Arcade into a local `eng/common` folder. In the near future, Engineering services will provide the capability to auto-update this folder via Maestro so that you don't need to manually take updates to common Arcade scripts. ```yaml -phases: -- template: /eng/common/templates/phases/base.yml +jobs: +- template: /eng/common/templates/job/job.yml parameters: ... ``` @@ -112,8 +112,8 @@ While this sample repository has no need to do so, there are many scenarios in w 3. For official builds, add an "AzureKeyVault" task reference to `HelixProdKV` ```YAML -phases: -- template: /eng/common/templates/phases/base.yml@arcade +jobs: +- template: /eng/common/templates/job/job.yml parameters: agentOs: Windows_NT name: Windows_NT @@ -138,6 +138,58 @@ phases: condition: always() ``` +## Use Helix for cross-platform testing + +Arcade integrates with Helix, making it easy to do cross-platform testing at scale. To get started, you'll need to reference the Helix SDK in your [`global.json`](global.json): + +```json +"msbuild-sdks": { + "Microsoft.DotNet.Helix.Sdk": "" +} +``` + +Finally, reference the `send-to-helix.yml` template after your build step. Make sure to do it for each phase. + +```yaml +# defining your variables first makes them easy to reuse between queues +variables: + - name: _HelixType + value: build/product + - name: _HelixSource + value: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) + - name: _HelixTestType + value: test/product/ + - name: _XUnitProject # the reference(s) to the XUnit project(s) you wish to test, semicolon delimited + value: $(Build.SourcesDirectory)/HelloTests/HelloTests.csproj + - name: _XUnitTargetFramework # the xUnit framework you want to test on + value: netcoreapp2.0 + - name: _XUnitRunnerVersion # the version of the xUnit runner you wish to use + value: 2.4.1 + - name: _DotNetCliPackageType # either 'runtime' or 'sdk', depending on which you want to bootstrap onto the Helix machine + value: sdk + - name: _DotNetCliVersion # the version of the dotnet cli you want to bootstrap (probably the same as the one in your global.json!) + value: 2.1.403 +# ... +# steps: +# build step here +- template: /eng/common/templates/steps/send-to-helix.yml + parameters: + HelixSource: $(_HelixSource) + HelixType: $(_HelixTestType) + HelixTargetQueues: Windows.10.Amd64.Open;Windows.7.Amd64.Open # set queues appropriately for the machine you're building on + XUnitProjects: $(Build.SourcesDirectory)/HelloTests/HelloTests.csproj + XUnitTargetFramework: $(_XUnitTargetFramework) + XUnitRunnerVersion: $(_XUnitRunnerVersion) + IncludeDotNetCli: true + DotNetCliPackageType: $(_DotNetCliPackageType) + DotNetCliVersion: $(_DotNetCliVersion) + EnableXUnitReporter: true + WaitForWorkItemCompletion: true + condition: eq(variables['_BuildConfig'], 'Debug') +``` + +For more information, see the main documentation on sending jobs to Helix [here](https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/SendingJobsToHelix.md). + ## Using the SignToolTask Arcade provides an optimized way to sign files using MicroBuild, it is wrapped in a custom MSBuild task called [SignToolTask](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs). diff --git a/Roadmap.md b/Roadmap.md deleted file mode 100644 index ae1c7869b43e..000000000000 --- a/Roadmap.md +++ /dev/null @@ -1,20 +0,0 @@ -# Roadmap - -This repository will serve as an example for all who wish to migrate to VSTS for their builds. Therefore, we want it to provide clear examples of common use cases. - -## Short Term -In the short term, we want to immediately fill the needs of [CoreCLR](https://github.com/dotnet/coreclr). This means that we will have a `.vsts-ci.yml` file which does the following: - -* Runs CI and PR builds -* Runs debug and release builds -* Runs builds on Windows, Linux, Macs, and in Docker containers -* Have a pretty CI badge link to show build status - -This should take advantage of YAML's templating and build-reason directives and generally should strive to be concise and efficient. - -## The Slightly Less Short Term -Over the next few weeks, the repository should be developed to show a fuller example of Arcade's capabilities: - -* Examples of plug & play telemetry -* Integration with and configuration of Maestro -* Consumption of Darc \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 989b66f344b7..ae924e47d524 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,23 @@ variables: -- name: Build.Repository.Clean - value: true - + - name: Build.Repository.Clean + value: true + - name: _HelixType + value: build/product + - name: _HelixSource + value: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) + - name: _HelixTestType + value: test/product/ + - name: _XUnitProject + value: $(Build.SourcesDirectory)/HelloTests/HelloTests.csproj + - name: _XUnitTargetFramework + value: netcoreapp2.0 + - name: _XUnitRunnerVersion + value: 2.4.1 + - name: _DotNetCliPackageType + value: sdk + - name: _DotNetCliVersion + value: 2.1.403 + resources: containers: - container: LinuxContainer @@ -37,6 +53,33 @@ jobs: name: Build displayName: Build condition: succeeded() + - template: /eng/common/templates/steps/send-to-helix.yml + parameters: + HelixSource: $(_HelixSource) + HelixType: $(_HelixTestType) + HelixTargetQueues: Windows.10.Amd64.Open;Windows.81.Amd64.Open;Windows.7.Amd64.Open + XUnitProjects: $(_XUnitProject) + XUnitPublishTargetFramework: $(_XUnitTargetFramework) + XUnitRuntimeTargetFramework: $(_XUnitTargetFramework) + XUnitRunnerVersion: $(_XUnitRunnerVersion) + IncludeDotNetCli: true + DotNetCliPackageType: $(_DotNetCliPackageType) + DotNetCliVersion: $(_DotNetCliVersion) + EnableXUnitReporter: true + WaitForWorkItemCompletion: true + IsExternal: true + Creator: arcade-minimalci-sample + condition: eq(variables['_BuildConfig'], 'Debug') + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_$(Agent.JobName) + continueOnError: true + condition: always() + variables: + _HelixBuildConfig: $(_BuildConfig) - template: /eng/common/templates/job/job.yml parameters: @@ -60,6 +103,33 @@ jobs: name: Build displayName: Build condition: succeeded() + - template: /eng/common/templates/steps/send-to-helix.yml + parameters: + HelixSource: $(_HelixSource) + HelixType: $(_HelixTestType) + HelixTargetQueues: OSX.1012.Amd64.Open;OSX.1013.Amd64.Open + XUnitProjects: $(_XUnitProject) + XUnitPublishTargetFramework: $(_XUnitTargetFramework) + XUnitRuntimeTargetFramework: $(_XUnitTargetFramework) + XUnitRunnerVersion: $(_XUnitRunnerVersion) + IncludeDotNetCli: true + DotNetCliPackageType: $(_DotNetCliPackageType) + DotNetCliVersion: $(_DotNetCliVersion) + EnableXUnitReporter: true + WaitForWorkItemCompletion: true + IsExternal: true + Creator: arcade-minimalci-sample + condition: eq(variables['_BuildConfig'], 'Debug') + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_$(Agent.JobName) + continueOnError: true + condition: always() + variables: + _HelixBuildConfig: $(_BuildConfig) - template: /eng/common/templates/job/job.yml parameters: @@ -83,3 +153,30 @@ jobs: name: Build displayName: Build condition: succeeded() + - template: /eng/common/templates/steps/send-to-helix.yml + parameters: + HelixSource: $(_HelixSource) + HelixType: $(_HelixTestType) + HelixTargetQueues: Debian.9.Amd64.Open;Fedora.27.Amd64.Open;RedHat.7.Amd64.Open;Ubuntu.1604.Amd64.Open + XUnitProjects: $(_XUnitProject) + XUnitPublishTargetFramework: $(_XUnitTargetFramework) + XUnitRuntimeTargetFramework: $(_XUnitTargetFramework) + XUnitRunnerVersion: $(_XUnitRunnerVersion) + IncludeDotNetCli: true + DotNetCliPackageType: $(_DotNetCliPackageType) + DotNetCliVersion: $(_DotNetCliVersion) + EnableXUnitReporter: true + WaitForWorkItemCompletion: true + IsExternal: true + Creator: arcade-minimalci-sample + condition: eq(variables['_BuildConfig'], 'Debug') + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_$(Agent.JobName) + continueOnError: true + condition: always() + variables: + _HelixBuildConfig: $(_BuildConfig) diff --git a/global.json b/global.json index d19ac798ae36..f0ce2cc0c721 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,9 @@ { "tools": { - "dotnet": "2.1.300" + "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19052.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19052.1", + "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From b6650f18519dcfc26cb9dcd3e85e02092d038efe Mon Sep 17 00:00:00 2001 From: Ricardo Arenas Date: Thu, 3 Jan 2019 09:52:30 -0800 Subject: [PATCH 0294/2702] fix status badge link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fe4a8277c4df..7c8d2c9362dc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Arcade Minimal CI Sample - [![Build status](https://dnceng.visualstudio.com/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_apis/build/status/116?branchName=master)](https://dnceng.visualstudio.com/public/_build/latest?definitionId=116&branch=master) +[![Build Status](https://dnceng.visualstudio.com/public/_apis/build/status/dotnet/arcade-minimalci-sample/arcade-minimalci-sample-ci?branchName=master)](https://dnceng.visualstudio.com/public/_build/latest?definitionId=209?branchName=master) This repository serves as an example of how to link GitHub repositories to Azure DevOps for CI and PR builds. From 284aa7a39f427ae2f739b771f82f01ff61b03a95 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 3 Jan 2019 19:02:46 +0000 Subject: [PATCH 0295/2702] Update dependencies from https://github.com/dotnet/arcade build 1133 (#286) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19053.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b8464bc566b4..be84ea163481 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - cbd7387984f7209237a7f63506c63e639a15b377 + 7acae668c8dd3efc4b0e18946982d7ddee3e5591 diff --git a/global.json b/global.json index f0ce2cc0c721..ed1c4784a6ba 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19052.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19053.2", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 9e0002ab8f0d1e0ff80ada58dc475722385a346b Mon Sep 17 00:00:00 2001 From: John Doe Date: Thu, 3 Jan 2019 15:58:03 -0800 Subject: [PATCH 0296/2702] telmetry -> telemetry --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c423303ae480..bc996159a23e 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ While this sample repository has no need to do so, there are many scenarios in w displayName: dotnet publish ``` -## Enabling telmetry +## Enabling telemetry [Arcade](#base-your-builds-on-arcade-for-ease-of-use) provides the ability to send telemetry. To enable telemetry you must... From 942caa88f5aa178d529889301d26567c16275b48 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 4 Jan 2019 17:16:25 +0000 Subject: [PATCH 0297/2702] Update dependencies from https://github.com/dotnet/arcade build 1155 (#288) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19054.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index be84ea163481..3a59b7b8bbf7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 7acae668c8dd3efc4b0e18946982d7ddee3e5591 + c380971edbf944301a3b8bc9bd89f4606b4dedc0 diff --git a/global.json b/global.json index ed1c4784a6ba..da6c533c9b45 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19053.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.2", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From e031002ff88006c200fc3a40af8fe2fb810c4e9e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 4 Jan 2019 17:55:51 +0000 Subject: [PATCH 0298/2702] Update dependencies from https://github.com/dotnet/arcade build 1157 (#289) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19054.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3a59b7b8bbf7..c36ee9e1f043 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - c380971edbf944301a3b8bc9bd89f4606b4dedc0 + ca4788d12e30b9a96b07c185a491a8b2ad160b91 diff --git a/global.json b/global.json index da6c533c9b45..c722bf8a4339 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.3", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 6e918a2eecf49a62c607f973dc766032975a9af6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 4 Jan 2019 18:16:26 +0000 Subject: [PATCH 0299/2702] Update dependencies from https://github.com/dotnet/arcade build 1161 (#290) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19054.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c36ee9e1f043..997465632ec1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - ca4788d12e30b9a96b07c185a491a8b2ad160b91 + 3e5a80ca5278072b3ac250ffdc568ed2ae27c68d diff --git a/global.json b/global.json index c722bf8a4339..2ae09566e54e 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.3", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.4", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 0e7a4a1dc35d5b79dd87dadc30e9c3b79da08622 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 4 Jan 2019 20:01:14 +0000 Subject: [PATCH 0300/2702] Update dependencies from https://github.com/dotnet/arcade build 1170 (#291) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19054.8 --- eng/Version.Details.xml | 4 ++-- eng/common/build.sh | 3 +++ global.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 997465632ec1..a07372ddacb2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3e5a80ca5278072b3ac250ffdc568ed2ae27c68d + be678537d662473de0af1e8ffb19b0ca87c3bb49 diff --git a/eng/common/build.sh b/eng/common/build.sh index 47af926d4d42..99009da7a997 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -130,6 +130,9 @@ while [[ $# > 0 ]]; do /p:*) properties="$properties $1" ;; + /m:*) + properties="$properties $1" + ;; *) echo "Invalid argument: $1" usage diff --git a/global.json b/global.json index 2ae09566e54e..fdfe77800eb8 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.4", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.8", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From b7477ef5500cc52a883293255d9737673ebb5702 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 4 Jan 2019 21:30:03 +0000 Subject: [PATCH 0301/2702] Update dependency files (#292) * Update dependencies from https://github.com/dotnet/arcade build 1175 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19054.9 * Update dependencies from https://github.com/dotnet/arcade build 1177 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19054.10 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a07372ddacb2..d644b2947594 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - be678537d662473de0af1e8ffb19b0ca87c3bb49 + 537b1bb17697a4a9484f7d4d093004478107bbdb diff --git a/global.json b/global.json index fdfe77800eb8..c914c388b7b5 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.8", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.10", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From b0f9e90c0b141c4b1d60c7f7de07c4c8f5a6f909 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 4 Jan 2019 23:38:13 +0000 Subject: [PATCH 0302/2702] Update dependencies from https://github.com/dotnet/arcade build 1183 (#293) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19054.12 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d644b2947594..92f35fc391c2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 537b1bb17697a4a9484f7d4d093004478107bbdb + 9104c21492e1c6ed98105dd87388bca8f1f1abaa diff --git a/global.json b/global.json index c914c388b7b5..28e1295a4273 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.10", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.12", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From b84347036184865733132ccbcf73a0b0794a1ae6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 5 Jan 2019 00:21:17 +0000 Subject: [PATCH 0303/2702] Update dependencies from https://github.com/dotnet/arcade build 1185 (#294) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19054.13 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 92f35fc391c2..4eb2002f9eee 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 9104c21492e1c6ed98105dd87388bca8f1f1abaa + c6268efc7cfcb98197eb374bb01e1fadb5a7f6ed diff --git a/global.json b/global.json index 28e1295a4273..b14d3547e409 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.12", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.13", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From abd02400a1ba311bcec34df02995bc6970c6b9cf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 5 Jan 2019 15:20:49 +0000 Subject: [PATCH 0304/2702] Update dependencies from https://github.com/dotnet/arcade build 1194 (#295) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19055.1 --- eng/Version.Details.xml | 4 ++-- eng/common/tools.sh | 5 +++-- global.json | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4eb2002f9eee..6d639e1d0a84 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - c6268efc7cfcb98197eb374bb01e1fadb5a7f6ed + b43f8c50d78c00d33f0b31a666b46ce5e9bcbe3d diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 65f689775cbc..186dcba26da5 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -189,8 +189,9 @@ function InitializeBuildTool { InitializeDotNetCli $restore - # return value + # return values _InitializeBuildTool="$_InitializeDotNetCli/dotnet" + _InitializeBuildToolCommand="msbuild" } function GetNuGetPackageCachePath { @@ -283,7 +284,7 @@ function MSBuild { warnaserror_switch="/warnaserror" fi - "$_InitializeBuildTool" msbuild /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error "$@" + "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error "$@" lastexitcode=$? if [[ $lastexitcode != 0 ]]; then diff --git a/global.json b/global.json index b14d3547e409..206f442c552b 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19054.13", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19055.1", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 934a7c7a3562a4bb86f269aada3eae8107a82cd5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 7 Jan 2019 17:02:43 +0000 Subject: [PATCH 0305/2702] Update dependencies from https://github.com/dotnet/arcade build 1208 (#296) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19057.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6d639e1d0a84..d75ec5499c36 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b43f8c50d78c00d33f0b31a666b46ce5e9bcbe3d + fa94db7d051b9addd8b449c8582e677822234bf9 diff --git a/global.json b/global.json index 206f442c552b..d2d202f61a74 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19055.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.1", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 3d433308cb84160d75412f5c6e2209c1a98d1a29 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 7 Jan 2019 18:27:07 +0000 Subject: [PATCH 0306/2702] Update dependencies from https://github.com/dotnet/arcade build 1210 (#297) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19057.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d75ec5499c36..3a15469a9fa4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - fa94db7d051b9addd8b449c8582e677822234bf9 + b9cb789c2e2195cbdb4fb0b807cfa657f2444546 diff --git a/global.json b/global.json index d2d202f61a74..6dd1507e312e 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.2", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 5dd70f67089692d4651528d57a86eea66488b646 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 7 Jan 2019 19:58:22 +0000 Subject: [PATCH 0307/2702] Update dependency files (#298) * Update dependencies from https://github.com/dotnet/arcade build 1213 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19057.3 * Update dependencies from https://github.com/dotnet/arcade build 1218 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19057.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3a15469a9fa4..122dddb44c19 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - b9cb789c2e2195cbdb4fb0b807cfa657f2444546 + eaba5a82b7c09d176e5b20ca2237c97b53024119 diff --git a/global.json b/global.json index 6dd1507e312e..8af7ef91030a 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.4", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 56214f8cfa2d8aed864c12878a90b7549dd7b91c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 7 Jan 2019 20:58:46 +0000 Subject: [PATCH 0308/2702] Update dependencies from https://github.com/dotnet/arcade build 1225 (#299) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19057.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 122dddb44c19..3335a4f07641 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - eaba5a82b7c09d176e5b20ca2237c97b53024119 + 3f2c69b88f856e8ccf4c9a528f5aafeeee9d8238 diff --git a/global.json b/global.json index 8af7ef91030a..647fbea6326a 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.4", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.5", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 5f549090312bba9bcff02dc0eaae47a1f9e33756 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 7 Jan 2019 22:53:54 +0000 Subject: [PATCH 0309/2702] Update dependencies from https://github.com/dotnet/arcade build 1228 (#300) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19057.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3335a4f07641..447fb845dcac 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3f2c69b88f856e8ccf4c9a528f5aafeeee9d8238 + 860df47b9e2b3f06f458382c20276bac3f84301c diff --git a/global.json b/global.json index 647fbea6326a..b9bb4b5491a9 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.5", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.6", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From d0b513c498cee30e4a1eab00283231b904934c45 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 8 Jan 2019 13:50:30 +0000 Subject: [PATCH 0310/2702] Update dependencies from https://github.com/dotnet/arcade build 1247 (#301) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19057.9 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 447fb845dcac..4f75d2262c22 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 860df47b9e2b3f06f458382c20276bac3f84301c + 2af148e2371f5ec8cb1214c339d86d0c665aeb12 diff --git a/global.json b/global.json index b9bb4b5491a9..22f512fc35f2 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.6", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.9", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 8965b8cee5e1a11db450af2bb303d8f5c645bd23 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 8 Jan 2019 17:13:57 +0000 Subject: [PATCH 0311/2702] Update dependencies from https://github.com/dotnet/arcade build 1260 (#302) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19058.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4f75d2262c22..2c34bf2d4d59 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 2af148e2371f5ec8cb1214c339d86d0c665aeb12 + 2d20e6718e4d796e9235b3dcd882b39821bc5a82 diff --git a/global.json b/global.json index 22f512fc35f2..65e7d4489e9e 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19057.9", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19058.1", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 3ac94ef31e8b23f40cf52cc65b3a08f7e390de0b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 9 Jan 2019 16:08:52 +0000 Subject: [PATCH 0312/2702] Update dependencies from dotnet/arcade (#303) * Update dependencies from https://github.com/dotnet/arcade build 20190108.2 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19058.2 * Update dependencies from https://github.com/dotnet/arcade build 20190108.5 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19058.5 --- eng/Version.Details.xml | 4 ++-- eng/common/build.sh | 4 ++++ eng/common/tools.sh | 33 ++++++++++++--------------------- global.json | 2 +- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2c34bf2d4d59..61119e4e92af 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 2d20e6718e4d796e9235b3dcd882b39821bc5a82 + 3220be53ac764d9ee160b0bc64baa492af219aa7 diff --git a/eng/common/build.sh b/eng/common/build.sh index 99009da7a997..faccf43179b0 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -3,6 +3,10 @@ # Stop script if unbound variable found (use ${var:-} if intentional) set -u +# Stop script if command returns non-zero exit code. +# Prevents hidden errors caused by missing error code propagation. +set -e + usage() { echo "Common settings:" diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 186dcba26da5..9c3c132abf3d 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -1,8 +1,3 @@ -#!/usr/bin/env bash - -# Stop script if unbound variable found (use ${var:-} if intentional) -set -u - # Initialize variables if they aren't already defined. # CI mode - set to true on CI server for PR validation build or official build. @@ -151,13 +146,11 @@ function InstallDotNetSdk { GetDotNetInstallScript "$root" local install_script=$_GetDotNetInstallScript - bash "$install_script" --version $version --install-dir "$root" - local lastexitcode=$? - - if [[ $lastexitcode != 0 ]]; then - echo "Failed to install dotnet SDK (exit code '$lastexitcode')." >&2 - ExitWithExitCode $lastexitcode - fi + bash "$install_script" --version $version --install-dir "$root" || { + local exit_code=$? + echo "Failed to install dotnet SDK (exit code '$exit_code')." >&2 + ExitWithExitCode $exit_code + } } function GetDotNetInstallScript { @@ -259,8 +252,8 @@ function ExitWithExitCode { function StopProcesses { echo "Killing running build processes..." - pkill -9 "dotnet" - pkill -9 "vbcscompiler" + pkill -9 "dotnet" || true + pkill -9 "vbcscompiler" || true return 0 } @@ -284,13 +277,11 @@ function MSBuild { warnaserror_switch="/warnaserror" fi - "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error "$@" - lastexitcode=$? - - if [[ $lastexitcode != 0 ]]; then - echo "Build failed (exit code '$lastexitcode')." >&2 - ExitWithExitCode $lastexitcode - fi + "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error "$@" || { + local exit_code=$? + echo "Build failed (exit code '$exit_code')." >&2 + ExitWithExitCode $exit_code + } } ResolvePath "${BASH_SOURCE[0]}" diff --git a/global.json b/global.json index 65e7d4489e9e..8b41436b5123 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19058.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19058.5", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 2a1d0868d8a62f9f93fa4da7d1521695cac96474 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 11 Jan 2019 02:23:29 +0000 Subject: [PATCH 0313/2702] Update dependencies from https://github.com/dotnet/arcade build 20190110.8 (#304) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19060.8 --- eng/Version.Details.xml | 4 ++-- eng/common/build.sh | 3 +++ eng/common/helixpublish.proj | 1 + eng/common/templates/phases/base.yml | 1 - eng/common/templates/steps/send-to-helix.yml | 3 +++ eng/common/tools.ps1 | 7 +++++++ eng/common/tools.sh | 7 +++++++ global.json | 2 +- 8 files changed, 24 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 61119e4e92af..918e1ceb8dbc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 3220be53ac764d9ee160b0bc64baa492af219aa7 + 67384d20d310611afc1c2b4dd3b953fda182def4 diff --git a/eng/common/build.sh b/eng/common/build.sh index faccf43179b0..4fe8b41ed706 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -137,6 +137,9 @@ while [[ $# > 0 ]]; do /m:*) properties="$properties $1" ;; + /bl:*) + properties="$properties $1" + ;; *) echo "Invalid argument: $1" usage diff --git a/eng/common/helixpublish.proj b/eng/common/helixpublish.proj index 72668a13374f..d7f185856e79 100644 --- a/eng/common/helixpublish.proj +++ b/eng/common/helixpublish.proj @@ -14,6 +14,7 @@ $(WorkItemDirectory) $(WorkItemCommand) + $(WorkItemTimeout) diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml index e075e8b78bf5..0123cf43b168 100644 --- a/eng/common/templates/phases/base.yml +++ b/eng/common/templates/phases/base.yml @@ -85,7 +85,6 @@ phases: - task: MicroBuildSigningPlugin@2 displayName: Install MicroBuild plugin inputs: - version: 1.1.35 signType: $(_SignType) zipSources: false feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 03f0e3866298..ab44a32769e7 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -8,6 +8,7 @@ parameters: HelixPostCommands: '' # optional -- commands to run after Helix work item execution WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects + WorkItemTimeout: '' # optional -- a timeout in seconds for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects @@ -37,6 +38,7 @@ steps: HelixPostCommands: ${{ parameters.HelixPostCommands }} WorkItemDirectory: ${{ parameters.WorkItemDirectory }} WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} XUnitProjects: ${{ parameters.XUnitProjects }} XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} @@ -64,6 +66,7 @@ steps: HelixPostCommands: ${{ parameters.HelixPostCommands }} WorkItemDirectory: ${{ parameters.WorkItemDirectory }} WorkItemCommand: ${{ parameters.WorkItemCommand }} + WorkItemTimeout: ${{ parameters.WorkItemTimeout }} CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} XUnitProjects: ${{ parameters.XUnitProjects }} XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index a607ec608085..4204dc14f892 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -141,6 +141,13 @@ function InitializeDotNetCli([bool]$install) { # It also ensures that VS msbuild will use the downloaded sdk targets. $env:PATH = "$dotnetRoot;$env:PATH" + if ($ci) { + # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build + Write-Host "##vso[task.prependpath]$dotnetRoot" + Write-Host "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" + Write-Host "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" + } + return $global:_DotNetInstallDir = $dotnetRoot } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 9c3c132abf3d..8a253bef5131 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -135,6 +135,13 @@ function InitializeDotNetCli { # build steps from using anything other than what we've downloaded. export PATH="$dotnet_root:$PATH" + if [[ $ci == true ]]; then + # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build + echo "##vso[task.prependpath]$dotnet_root" + echo "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" + echo "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" + fi + # return value _InitializeDotNetCli="$dotnet_root" } diff --git a/global.json b/global.json index 8b41436b5123..48a57e829869 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19058.5", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19060.8", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 03f8c57a44736a0e41c21812b2513bad16e207c3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 11 Jan 2019 21:56:39 +0000 Subject: [PATCH 0314/2702] Update dependencies from https://github.com/dotnet/arcade build 20190111.6 (#305) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19061.6 --- eng/Version.Details.xml | 4 ++-- eng/common/darc-init.ps1 | 20 +++++++++++++++----- global.json | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 918e1ceb8dbc..e291a4d00fba 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 67384d20d310611afc1c2b4dd3b953fda182def4 + 52d4b539dd1ab771015bdf33ed4221afcaaabf3d diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 9ca150be8600..96cad844ba3b 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,7 +1,11 @@ +param ( + $darcVersion = $null +) + $verbosity = "m" . $PSScriptRoot\tools.ps1 -function InstallDarcCli { +function InstallDarcCli ($darcVersion) { $darcCliPackageName = "microsoft.dotnet.darc" $dotnetRoot = InitializeDotNetCli -install:$true @@ -12,11 +16,17 @@ function InstallDarcCli { Invoke-Expression "& `"$dotnet`" tool uninstall $darcCliPackageName -g" } - $toolsetVersion = $GlobalJson.'msbuild-sdks'.'Microsoft.DotNet.Arcade.Sdk' + # Until we can anonymously query the BAR API for the latest arcade-services + # build applied to the PROD channel, this is hardcoded. + if (-not $darcVersion) { + $darcVersion = '1.1.0-beta.19057.9' + } + + $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-arcade/index.json' - Write-Host "Installing Darc CLI version $toolsetVersion..." + Write-Host "Installing Darc CLI version $darcVersion..." Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - Invoke-Expression "& `"$dotnet`" tool install $darcCliPackageName --version $toolsetVersion -v $verbosity -g" + Invoke-Expression "& `"$dotnet`" tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" } -InstallDarcCli +InstallDarcCli $darcVersion diff --git a/global.json b/global.json index 48a57e829869..9ce656c0c6ce 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19060.8", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19061.6", "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" } } From 7e3680f7ebfca627b7c1766ba27e79ddac3cf76e Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Wed, 16 Jan 2019 17:31:35 -0800 Subject: [PATCH 0315/2702] Make build.cmd -test work (#307) --- .../HelloTests.csproj => Hello.Tests/Hello.Tests.csproj | 3 +-- {HelloTests => Hello.Tests}/HelloTests.cs | 4 ++-- HelloWorld.sln | 2 +- HelloWorld/Program.cs | 6 ++++-- azure-pipelines.yml | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) rename HelloTests/HelloTests.csproj => Hello.Tests/Hello.Tests.csproj (62%) rename {HelloTests => Hello.Tests}/HelloTests.cs (68%) diff --git a/HelloTests/HelloTests.csproj b/Hello.Tests/Hello.Tests.csproj similarity index 62% rename from HelloTests/HelloTests.csproj rename to Hello.Tests/Hello.Tests.csproj index c908c1b74b37..f5e3119fd480 100644 --- a/HelloTests/HelloTests.csproj +++ b/Hello.Tests/Hello.Tests.csproj @@ -6,8 +6,7 @@ - - + diff --git a/HelloTests/HelloTests.cs b/Hello.Tests/HelloTests.cs similarity index 68% rename from HelloTests/HelloTests.cs rename to Hello.Tests/HelloTests.cs index 6b5462ed6d51..4f1d6f376bea 100644 --- a/HelloTests/HelloTests.cs +++ b/Hello.Tests/HelloTests.cs @@ -1,4 +1,4 @@ -using System; +using HelloWorld; using Xunit; namespace HelloTests @@ -8,7 +8,7 @@ public class HelloTests [Fact] public void SuccessfulTest() { - Assert.True(true); + Assert.Equal(42, new Program().Magic); } } } diff --git a/HelloWorld.sln b/HelloWorld.sln index a04ca15e2e0a..e7b2d49b5613 100644 --- a/HelloWorld.sln +++ b/HelloWorld.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution global.json = global.json EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloTests", "HelloTests\HelloTests.csproj", "{6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hello.Tests", "Hello.Tests\Hello.Tests.csproj", "{6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/HelloWorld/Program.cs b/HelloWorld/Program.cs index 88e13abbbafe..bba4070d15d2 100644 --- a/HelloWorld/Program.cs +++ b/HelloWorld/Program.cs @@ -6,8 +6,10 @@ namespace HelloWorld { - class Program - { + public class Program + { + public int Magic => 42; + static void Main(string[] args) { Console.WriteLine("Hello World!"); diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ae924e47d524..5786685cc3ac 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,7 +8,7 @@ variables: - name: _HelixTestType value: test/product/ - name: _XUnitProject - value: $(Build.SourcesDirectory)/HelloTests/HelloTests.csproj + value: $(Build.SourcesDirectory)/Hello.Tests/Hello.Tests.csproj - name: _XUnitTargetFramework value: netcoreapp2.0 - name: _XUnitRunnerVersion From c41651292947f524a34ee8f52981711ac80d8168 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 17 Jan 2019 18:11:18 +0000 Subject: [PATCH 0316/2702] Update dependencies from dotnet/arcade (#306) * Update dependencies from https://github.com/dotnet/arcade build 20190114.4 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19064.4 * Update dependencies from https://github.com/dotnet/arcade build 20190115.1 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19065.1 * Update dependencies from https://github.com/dotnet/arcade build 20190115.2 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19065.2 * Update dependencies from https://github.com/dotnet/arcade build 20190115.4 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19065.4 * Update dependencies from https://github.com/dotnet/arcade build 20190115.5 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19065.5 * Update dependencies from https://github.com/dotnet/arcade build 20190115.6 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19065.6 * Update dependencies from https://github.com/dotnet/arcade build 20190116.1 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19066.1 * add HelixSDK update * add empty access token * Update dependencies from https://github.com/dotnet/arcade build 20190117.1 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19067.1 * fix helix sdk dependency --- azure-pipelines.yml | 8 +++++--- eng/Version.Details.xml | 8 ++++++-- eng/common/templates/steps/send-to-helix.yml | 4 +--- global.json | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5786685cc3ac..eee704c88186 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,6 +17,8 @@ variables: value: sdk - name: _DotNetCliVersion value: 2.1.403 + - name: _HelixAccessToken + value: '' resources: containers: @@ -67,8 +69,8 @@ jobs: DotNetCliVersion: $(_DotNetCliVersion) EnableXUnitReporter: true WaitForWorkItemCompletion: true - IsExternal: true Creator: arcade-minimalci-sample + HelixAccessToken: $(_HelixAccessToken) condition: eq(variables['_BuildConfig'], 'Debug') - task: PublishBuildArtifacts@1 displayName: Publish Logs to VSTS @@ -117,8 +119,8 @@ jobs: DotNetCliVersion: $(_DotNetCliVersion) EnableXUnitReporter: true WaitForWorkItemCompletion: true - IsExternal: true Creator: arcade-minimalci-sample + HelixAccessToken: $(_HelixAccessToken) condition: eq(variables['_BuildConfig'], 'Debug') - task: PublishBuildArtifacts@1 displayName: Publish Logs to VSTS @@ -167,8 +169,8 @@ jobs: DotNetCliVersion: $(_DotNetCliVersion) EnableXUnitReporter: true WaitForWorkItemCompletion: true - IsExternal: true Creator: arcade-minimalci-sample + HelixAccessToken: $(_HelixAccessToken) condition: eq(variables['_BuildConfig'], 'Debug') - task: PublishBuildArtifacts@1 displayName: Publish Logs to VSTS diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e291a4d00fba..e7d0384773be 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,13 @@ - + https://github.com/dotnet/arcade - 52d4b539dd1ab771015bdf33ed4221afcaaabf3d + 13b412cc8a535b71711483936b142173492e18d1 + + + https://github.com/dotnet/arcade + 13b412cc8a535b71711483936b142173492e18d1 diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index ab44a32769e7..a5835c0f4738 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -19,7 +19,7 @@ parameters: DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." - IsExternal: false # optional -- true requires Creator and will make the Mission Control results visible to folks outside the Microsoft Org + IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set Creator: '' # optional -- if the build is external, use this to specify who is sending the job condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false @@ -49,7 +49,6 @@ steps: DotNetCliVersion: ${{ parameters.DotNetCliVersion }} EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - IsExternal: ${{ parameters.IsExternal }} Creator: ${{ parameters.Creator }} condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} @@ -77,7 +76,6 @@ steps: DotNetCliVersion: ${{ parameters.DotNetCliVersion }} EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - IsExternal: ${{ parameters.IsExternal }} Creator: ${{ parameters.Creator }} condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} diff --git a/global.json b/global.json index 9ce656c0c6ce..67c92ade3beb 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19061.6", - "Microsoft.DotNet.Helix.Sdk": "1.0.0-beta.19052.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19067.1", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19067.1" } } From bec2fd233a725df57079226cb978db384e88c486 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 17 Jan 2019 20:42:48 +0000 Subject: [PATCH 0317/2702] Update dependencies from https://github.com/dotnet/arcade build 20190117.3 (#308) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19067.3 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19067.3 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e7d0384773be..986841372cfc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 13b412cc8a535b71711483936b142173492e18d1 + 363fcc661472b9479c291c196b59664b250eeac8 - + https://github.com/dotnet/arcade - 13b412cc8a535b71711483936b142173492e18d1 + 363fcc661472b9479c291c196b59664b250eeac8 diff --git a/global.json b/global.json index 67c92ade3beb..0f9471f94915 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19067.1", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19067.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19067.3", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19067.3" } } From 1922af251019b36997e3a24c18f45c2e3a34baa7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 18 Jan 2019 00:04:04 +0000 Subject: [PATCH 0318/2702] Update dependencies from https://github.com/dotnet/arcade build 20190117.5 (#309) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19067.5 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19067.5 --- eng/Version.Details.xml | 8 ++-- eng/common/PublishBuildAssets.cmd | 2 +- eng/common/build.ps1 | 6 +-- eng/common/sdk-task.ps1 | 74 +++++++++++++++++++++++++++++++ global.json | 4 +- 5 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 eng/common/sdk-task.ps1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 986841372cfc..7630dc75a95d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 363fcc661472b9479c291c196b59664b250eeac8 + d619154829f4abf41b9ae3b82d4fbdeecec2989a - + https://github.com/dotnet/arcade - 363fcc661472b9479c291c196b59664b250eeac8 + d619154829f4abf41b9ae3b82d4fbdeecec2989a diff --git a/eng/common/PublishBuildAssets.cmd b/eng/common/PublishBuildAssets.cmd index ac629f00e12a..3c6e4ff829d5 100644 --- a/eng/common/PublishBuildAssets.cmd +++ b/eng/common/PublishBuildAssets.cmd @@ -1,3 +1,3 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -msbuildEngine dotnet -restore -execute -binaryLog /p:PublishBuildAssets=true /p:SdkTaskProjects=PublishBuildAssets.proj %*" +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0sdk-task.ps1""" -msbuildEngine dotnet -restore -projects PublishBuildAssets.proj -ci %*" exit /b %ErrorLevel% diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 2f5e6052a85f..8279dc713391 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -6,7 +6,6 @@ Param( [string] $msbuildEngine = $null, [bool] $warnAsError = $true, [bool] $nodeReuse = $true, - [switch] $execute, [switch][Alias('r')]$restore, [switch] $deployDeps, [switch][Alias('b')]$build, @@ -18,7 +17,6 @@ Param( [switch] $sign, [switch] $pack, [switch] $publish, - [switch] $publishBuildAssets, [switch][Alias('bl')]$binaryLog, [switch] $ci, [switch] $prepareMachine, @@ -48,7 +46,6 @@ function Print-Usage() { Write-Host " -performanceTest Run all performance tests in the solution" Write-Host " -sign Sign build outputs" Write-Host " -publish Publish artifacts (e.g. symbols)" - Write-Host " -publishBuildAssets Push assets to BAR" Write-Host "" Write-Host "Advanced settings:" @@ -61,7 +58,6 @@ function Print-Usage() { Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." } - function InitializeCustomToolset { if (-not $restore) { return @@ -77,6 +73,7 @@ function InitializeCustomToolset { function Build { $toolsetBuildProj = InitializeToolset InitializeCustomToolset + $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" } if ($projects) { @@ -102,7 +99,6 @@ function Build { /p:PerformanceTest=$performanceTest ` /p:Sign=$sign ` /p:Publish=$publish ` - /p:Execute=$execute ` /p:ContinuousIntegrationBuild=$ci ` @properties } diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 new file mode 100644 index 000000000000..9ba7530122f6 --- /dev/null +++ b/eng/common/sdk-task.ps1 @@ -0,0 +1,74 @@ +[CmdletBinding(PositionalBinding=$false)] +Param( + [string] $projects = "", + [string][Alias('v')]$verbosity = "minimal", + [string] $msbuildEngine = $null, + [bool] $warnAsError = $true, + [switch][Alias('bl')]$binaryLog, + [switch][Alias('r')]$restore, + [switch] $ci, + [switch] $prepareMachine, + [switch] $help, + [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties +) + +. $PSScriptRoot\tools.ps1 + +function Print-Usage() { + Write-Host "Common settings:" + Write-Host " -v[erbosity] Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" + Write-Host " -[bl|binaryLog] Output binary log (short: -bl)" + Write-Host " -help Print help and exit" + Write-Host "" + + Write-Host "Advanced settings:" + Write-Host " -restore Restore dependencies (short: -r)" + Write-Host " -projects Semi-colon delimited list of sln/proj's from the Arcade sdk to build. Globbing is supported (*.sln)" + Write-Host " -ci Set when running on CI server" + Write-Host " -prepareMachine Prepare machine for CI run" + Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." + Write-Host "" + Write-Host "Command line arguments not listed above are passed thru to msbuild." + Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." +} + +function Build { + $toolsetBuildProj = InitializeToolset + + $toolsetBuildProj = Join-Path (Split-Path $toolsetBuildProj -Parent) "SdkTasks\SdkTask.proj" + $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "SdkTask.binlog") } else { "" } + MSBuild $toolsetBuildProj ` + $bl ` + /p:Projects=$projects ` + /p:Restore=$restore ` + /p:RepoRoot=$RepoRoot ` + /p:ContinuousIntegrationBuild=$ci ` + @properties +} + +try { + if ($help -or (($null -ne $properties) -and ($properties.Contains("/help") -or $properties.Contains("/?")))) { + Print-Usage + exit 0 + } + + if ($projects -eq "") { + Write-Error "Missing required parameter '-projects '" + Print-Usage + ExitWithExitCode 1 + } + + if ($ci) { + $binaryLog = $true + } + + Build +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} + +ExitWithExitCode 0 diff --git a/global.json b/global.json index 0f9471f94915..122197819b8c 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19067.3", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19067.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19067.5", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19067.5" } } From 31ab3647b2eeab43de1f48650b14104959e3f6c9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 18 Jan 2019 00:47:13 +0000 Subject: [PATCH 0319/2702] Update dependencies from https://github.com/dotnet/arcade build 20190117.6 (#310) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19067.6 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19067.6 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7630dc75a95d..ba2ee74f703c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - d619154829f4abf41b9ae3b82d4fbdeecec2989a + bed438c56afcd799b4de747291cf68815ae2f53b - + https://github.com/dotnet/arcade - d619154829f4abf41b9ae3b82d4fbdeecec2989a + bed438c56afcd799b4de747291cf68815ae2f53b diff --git a/global.json b/global.json index 122197819b8c..96b0a99e1777 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19067.5", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19067.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19067.6", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19067.6" } } From 2fcec772f58ce493e5ea720aff340aacbca22034 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 18 Jan 2019 15:15:50 +0000 Subject: [PATCH 0320/2702] Update dependencies from https://github.com/dotnet/arcade build 20190118.1 (#311) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19068.1 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19068.1 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ba2ee74f703c..35e451a5fbae 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - bed438c56afcd799b4de747291cf68815ae2f53b + ec8a5ea440f0ffbfbc441f551102fc2488afe45c - + https://github.com/dotnet/arcade - bed438c56afcd799b4de747291cf68815ae2f53b + ec8a5ea440f0ffbfbc441f551102fc2488afe45c diff --git a/global.json b/global.json index 96b0a99e1777..50c8e0d100b8 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19067.6", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19067.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19068.1", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19068.1" } } From 5dbb676ad7e0d04373b71794fdfccb63ae9afd4e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 19 Jan 2019 18:42:52 +0000 Subject: [PATCH 0321/2702] Update dependencies from dotnet/arcade (#312) * Update dependencies from https://github.com/dotnet/arcade build 20190118.2 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19068.2 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19068.2 * Update dependencies from https://github.com/dotnet/arcade build 20190118.3 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19068.3 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19068.3 * Update dependencies from https://github.com/dotnet/arcade build 20190118.4 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19068.4 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19068.4 * Update dependencies from https://github.com/dotnet/arcade build 20190119.2 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19069.2 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19069.2 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 35e451a5fbae..dd074cc7485f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - ec8a5ea440f0ffbfbc441f551102fc2488afe45c + 07ce1f4430b689a7e3aae70a34822c01473cf258 - + https://github.com/dotnet/arcade - ec8a5ea440f0ffbfbc441f551102fc2488afe45c + 07ce1f4430b689a7e3aae70a34822c01473cf258 diff --git a/global.json b/global.json index 50c8e0d100b8..56ad92554aa1 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19068.1", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19068.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19069.2", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 162ff1a5616b6cb0856499c31bea3feb8199aa97 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 20 Jan 2019 16:14:55 +0000 Subject: [PATCH 0322/2702] Update dependencies from https://github.com/dotnet/arcade build 20190120.1 (#313) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19070.1 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19070.1 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dd074cc7485f..f558df3ffad9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 07ce1f4430b689a7e3aae70a34822c01473cf258 + ab6d5e259d7dc32874ee0b18e0baabd7c4211179 - + https://github.com/dotnet/arcade - 07ce1f4430b689a7e3aae70a34822c01473cf258 + ab6d5e259d7dc32874ee0b18e0baabd7c4211179 diff --git a/global.json b/global.json index 56ad92554aa1..f6a68c1d477c 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19069.2", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19070.1", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19070.1" } } From 279a263b61db0cae4acad5b21346683be9d24d6b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 20 Jan 2019 18:26:05 +0000 Subject: [PATCH 0323/2702] Update dependencies from https://github.com/dotnet/arcade build 20190120.2 (#314) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19070.2 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19070.2 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f558df3ffad9..38fb2cf3e542 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - ab6d5e259d7dc32874ee0b18e0baabd7c4211179 + e7e2a81eefde4d3973a579458079e6da27ed0018 - + https://github.com/dotnet/arcade - ab6d5e259d7dc32874ee0b18e0baabd7c4211179 + e7e2a81eefde4d3973a579458079e6da27ed0018 diff --git a/global.json b/global.json index f6a68c1d477c..dabe6a17efc8 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19070.1", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19070.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19070.2", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19070.2" } } From 676ff84a0365dd2eabcd86742ed955bf74636a70 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 23 Jan 2019 02:31:45 +0000 Subject: [PATCH 0324/2702] Update dependencies from https://github.com/dotnet/arcade build 20190122.5 (#315) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19072.5 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19072.5 --- eng/Version.Details.xml | 8 ++++---- eng/common/templates/phases/publish-build-assets.yml | 2 +- global.json | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 38fb2cf3e542..0bc68b270432 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - e7e2a81eefde4d3973a579458079e6da27ed0018 + 044fa99d22e576fcfaf63f09ee9bba821855dddb - + https://github.com/dotnet/arcade - e7e2a81eefde4d3973a579458079e6da27ed0018 + 044fa99d22e576fcfaf63f09ee9bba821855dddb diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml index 0df6203b506f..85fabe62b98f 100644 --- a/eng/common/templates/phases/publish-build-assets.yml +++ b/eng/common/templates/phases/publish-build-assets.yml @@ -29,10 +29,10 @@ phases: condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - script: eng\common\publishbuildassets.cmd - -configuration $(_BuildConfig) /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + /p:Configuration=$(_BuildConfig) displayName: Publish Build Assets condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} diff --git a/global.json b/global.json index dabe6a17efc8..3b47022b2418 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19070.2", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19070.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19072.5", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19072.5" } } From f4c79aaa52688b702da1660885c6afb62ce92aa5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 23 Jan 2019 14:04:32 +0000 Subject: [PATCH 0325/2702] Update dependencies from https://github.com/dotnet/arcade build 20190123.1 (#316) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19073.1 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19073.1 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0bc68b270432..66ed7a58c2a9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 044fa99d22e576fcfaf63f09ee9bba821855dddb + 6d67fe906f2e23cd6ee280bcdeea4cd2b56f7793 - + https://github.com/dotnet/arcade - 044fa99d22e576fcfaf63f09ee9bba821855dddb + 6d67fe906f2e23cd6ee280bcdeea4cd2b56f7793 diff --git a/global.json b/global.json index 3b47022b2418..111ae017ce8c 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19072.5", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19072.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.1", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.1" } } From 555ccaa43b39b9fa4be151310c25d0e9507c55b6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 23 Jan 2019 17:34:32 +0000 Subject: [PATCH 0326/2702] Update dependencies from https://github.com/dotnet/arcade build 20190123.2 (#317) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19073.2 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19073.2 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 66ed7a58c2a9..03827ae88008 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 6d67fe906f2e23cd6ee280bcdeea4cd2b56f7793 + 50a046f971c02279bbcf7c5018eae98fe36925ba - + https://github.com/dotnet/arcade - 6d67fe906f2e23cd6ee280bcdeea4cd2b56f7793 + 50a046f971c02279bbcf7c5018eae98fe36925ba diff --git a/global.json b/global.json index 111ae017ce8c..b8ef6d5baaee 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.1", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.2", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.2" } } From 4eb1dcc9546c50eaf0a73556b0cbeb4036f94534 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 23 Jan 2019 20:25:31 +0000 Subject: [PATCH 0327/2702] Update dependencies from https://github.com/dotnet/arcade build 20190123.3 (#318) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19073.3 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19073.3 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 03827ae88008..2a34978f52bc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 50a046f971c02279bbcf7c5018eae98fe36925ba + c4faec3ff61c3e717e1035d2442f478885017415 - + https://github.com/dotnet/arcade - 50a046f971c02279bbcf7c5018eae98fe36925ba + c4faec3ff61c3e717e1035d2442f478885017415 diff --git a/global.json b/global.json index b8ef6d5baaee..01c494738c18 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.2", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.3", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.3" } } From e949fc5b1b3c2e37b078c5bdb4eedc84d970fba9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 23 Jan 2019 21:16:05 +0000 Subject: [PATCH 0328/2702] Update dependencies from https://github.com/dotnet/arcade build 20190123.4 (#319) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19073.4 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19073.4 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2a34978f52bc..9638b029131d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - c4faec3ff61c3e717e1035d2442f478885017415 + 91bd679afa8b721d645dc42bddef5edef5f7d845 - + https://github.com/dotnet/arcade - c4faec3ff61c3e717e1035d2442f478885017415 + 91bd679afa8b721d645dc42bddef5edef5f7d845 diff --git a/global.json b/global.json index 01c494738c18..cb4a02139ea1 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.3", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.4", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.4" } } From 31596e103636a3c36c836e1658e6a7971dd40a7e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 23 Jan 2019 22:54:26 +0000 Subject: [PATCH 0329/2702] Update dependencies from https://github.com/dotnet/arcade build 20190123.5 (#320) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19073.5 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19073.5 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9638b029131d..8715c46a4c0c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 91bd679afa8b721d645dc42bddef5edef5f7d845 + af8ab7d7ca13d5f129c31cfa7aeda19f6d168e6e - + https://github.com/dotnet/arcade - 91bd679afa8b721d645dc42bddef5edef5f7d845 + af8ab7d7ca13d5f129c31cfa7aeda19f6d168e6e diff --git a/global.json b/global.json index cb4a02139ea1..4b44640b3698 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.4", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.5", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.5" } } From 5d61f352c7d452fad9c0c2b0909618ef6e2ec0e7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 31 Jan 2019 00:27:32 +0000 Subject: [PATCH 0330/2702] Update dependencies from dotnet/arcade (#322) * Update dependencies from https://github.com/dotnet/arcade build 20190129.6 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19079.6 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19079.6 * Update dependencies from https://github.com/dotnet/arcade build 20190130.3 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19080.3 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19080.3 --- eng/Version.Details.xml | 8 ++++---- eng/common/templates/steps/send-to-helix.yml | 4 ++-- global.json | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8715c46a4c0c..20fe28bf27af 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - af8ab7d7ca13d5f129c31cfa7aeda19f6d168e6e + 609a00ac3b6f541b7a9b4ce34be37f0bc01903e5 - + https://github.com/dotnet/arcade - af8ab7d7ca13d5f129c31cfa7aeda19f6d168e6e + 609a00ac3b6f541b7a9b4ce34be37f0bc01903e5 diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index a5835c0f4738..1fbf8b889732 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -25,7 +25,7 @@ parameters: continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false steps: - - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' displayName: Send job to Helix (Windows) env: BuildConfig: $(_BuildConfig) @@ -52,7 +52,7 @@ steps: Creator: ${{ parameters.Creator }} condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} - - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog displayName: Send job to Helix (Unix) env: BuildConfig: $(_BuildConfig) diff --git a/global.json b/global.json index 4b44640b3698..bee867333d0a 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19073.5", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19073.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19080.3", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19080.3" } } From 994e27fc3d4ea12b258c422e2a6720a3e0b2f6c5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 31 Jan 2019 01:02:54 +0000 Subject: [PATCH 0331/2702] Update dependencies from https://github.com/dotnet/arcade build 20190130.6 (#323) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19080.6 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19080.6 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 20fe28bf27af..4b99435ddb88 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 609a00ac3b6f541b7a9b4ce34be37f0bc01903e5 + 14d1133b6074b463784a7adbbf385df0462f4010 - + https://github.com/dotnet/arcade - 609a00ac3b6f541b7a9b4ce34be37f0bc01903e5 + 14d1133b6074b463784a7adbbf385df0462f4010 diff --git a/global.json b/global.json index bee867333d0a..39b6d1a12fc8 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19080.3", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19080.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19080.6", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19080.6" } } From 48db581b08f04087208b87db8773038d12ce78e8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 31 Jan 2019 16:26:31 +0000 Subject: [PATCH 0332/2702] Update dependencies from https://github.com/dotnet/arcade build 20190131.1 (#324) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19081.1 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19081.1 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4b99435ddb88..567b7bfb0149 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 14d1133b6074b463784a7adbbf385df0462f4010 + 0aa62fa4632a25e3a397c00c2e07a651a1169e5e - + https://github.com/dotnet/arcade - 14d1133b6074b463784a7adbbf385df0462f4010 + 0aa62fa4632a25e3a397c00c2e07a651a1169e5e diff --git a/global.json b/global.json index 39b6d1a12fc8..bd761a281637 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19080.6", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19080.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19081.1", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19081.1" } } From 4503a3146040d57160e70f94a970bb9e959653b7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 31 Jan 2019 20:10:55 +0000 Subject: [PATCH 0333/2702] Update dependencies from https://github.com/dotnet/arcade build 20190131.3 (#325) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19081.3 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19081.3 --- eng/Version.Details.xml | 8 ++++---- eng/common/darc-init.ps1 | 2 +- global.json | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 567b7bfb0149..fc47c20a0bdf 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 0aa62fa4632a25e3a397c00c2e07a651a1169e5e + 1e859f1c17fffbe9c4fb6bbfc0fc71cd0c56563b - + https://github.com/dotnet/arcade - 0aa62fa4632a25e3a397c00c2e07a651a1169e5e + 1e859f1c17fffbe9c4fb6bbfc0fc71cd0c56563b diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 96cad844ba3b..57db185df194 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -19,7 +19,7 @@ function InstallDarcCli ($darcVersion) { # Until we can anonymously query the BAR API for the latest arcade-services # build applied to the PROD channel, this is hardcoded. if (-not $darcVersion) { - $darcVersion = '1.1.0-beta.19057.9' + $darcVersion = '1.1.0-beta.19081.1' } $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-arcade/index.json' diff --git a/global.json b/global.json index bd761a281637..acdf4bc1907e 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19081.1", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19081.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19081.3", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19081.3" } } From 4fb4258d7a7bbd1ebb4e2fa0b601e8a8646690e8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 2 Feb 2019 04:05:19 +0000 Subject: [PATCH 0334/2702] Update dependencies from https://github.com/dotnet/arcade build 20190201.13 (#326) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19101.13 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19101.13 --- eng/Version.Details.xml | 8 ++++---- eng/common/PublishToPackageFeed.proj | 22 ++++++++++++++++------ global.json | 4 ++-- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fc47c20a0bdf..e3b8ccd02d7a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 1e859f1c17fffbe9c4fb6bbfc0fc71cd0c56563b + 26e4b7ad355f3c08eea8296d1733ada986d6edf3 - + https://github.com/dotnet/arcade - 1e859f1c17fffbe9c4fb6bbfc0fc71cd0c56563b + 26e4b7ad355f3c08eea8296d1733ada986d6edf3 diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj index 7dc478d981f6..9db453894860 100644 --- a/eng/common/PublishToPackageFeed.proj +++ b/eng/common/PublishToPackageFeed.proj @@ -10,15 +10,25 @@ netcoreapp2.1 - + + + - - + + + + + + + + + + + AssetManifestPath="%(ManifestFiles.Identity)" + BlobAssetsBasePath="$(BlobBasePath)" + PackageAssetsBasePath="$(PackageBasePath)" /> diff --git a/global.json b/global.json index acdf4bc1907e..e19f5c78f651 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19081.3", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19081.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19101.13", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19101.13" } } From d67291d2e3b94a0eee50312ea3c6bf58078d2766 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 2 Feb 2019 05:02:15 +0000 Subject: [PATCH 0335/2702] Update dependencies from https://github.com/dotnet/arcade build 20190201.14 (#327) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19101.14 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19101.14 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e3b8ccd02d7a..77e8f5099517 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 26e4b7ad355f3c08eea8296d1733ada986d6edf3 + 72ebfe02729ca47470904f160a7646adf03c48bc - + https://github.com/dotnet/arcade - 26e4b7ad355f3c08eea8296d1733ada986d6edf3 + 72ebfe02729ca47470904f160a7646adf03c48bc diff --git a/global.json b/global.json index e19f5c78f651..632353da046f 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19101.13", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19101.13" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19101.14", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19101.14" } } From 89b1ebba62fed710830dd4503858a64416a1f671 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 2 Feb 2019 05:56:15 +0000 Subject: [PATCH 0336/2702] Update dependencies from https://github.com/dotnet/arcade build 20190201.15 (#328) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19101.15 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19101.15 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 77e8f5099517..4274f36dcf26 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 72ebfe02729ca47470904f160a7646adf03c48bc + 84c5e467099403b9226cd425efd45810b7ac6b43 - + https://github.com/dotnet/arcade - 72ebfe02729ca47470904f160a7646adf03c48bc + 84c5e467099403b9226cd425efd45810b7ac6b43 diff --git a/global.json b/global.json index 632353da046f..d34c6fb1999b 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19101.14", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19101.14" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19101.15", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19101.15" } } From b9da901e2754aba7c6f484ca47b93984df37c8ad Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 2 Feb 2019 06:28:35 +0000 Subject: [PATCH 0337/2702] Update dependencies from https://github.com/dotnet/arcade build 20190201.16 (#329) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19101.16 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19101.16 --- eng/Version.Details.xml | 8 +- eng/common/templates/steps/telemetry-end.yml | 87 +++++++--- .../templates/steps/telemetry-start.yml | 160 ++++++++++++++---- global.json | 4 +- 4 files changed, 192 insertions(+), 67 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4274f36dcf26..a7762dc2405e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 84c5e467099403b9226cd425efd45810b7ac6b43 + 159c3e6c65ab7b1e89e962290538364898d02cd8 - + https://github.com/dotnet/arcade - 84c5e467099403b9226cd425efd45810b7ac6b43 + 159c3e6c65ab7b1e89e962290538364898d02cd8 diff --git a/eng/common/templates/steps/telemetry-end.yml b/eng/common/templates/steps/telemetry-end.yml index 9b61481e7e19..fadc04ca1b9a 100644 --- a/eng/common/templates/steps/telemetry-end.yml +++ b/eng/common/templates/steps/telemetry-end.yml @@ -1,3 +1,7 @@ +parameters: + maxRetries: 5 + retryDelay: 10 # in seconds + steps: - bash: | if [ "$AGENT_JOBSTATUS" = "Succeeded" ] || [ "$AGENT_JOBSTATUS" = "PartiallySucceeded" ]; then @@ -7,27 +11,41 @@ steps: fi warningCount=0 - # create a temporary file for curl output - res=`mktemp` - - curlResult=` - curl --verbose --output $res --write-out "%{http_code}"\ - -H 'Content-Type: application/json' \ - -H "X-Helix-Job-Token: $Helix_JobToken" \ - -H 'Content-Length: 0' \ - -X POST -G "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$Helix_WorkItemId/finish" \ - --data-urlencode "errorCount=$errorCount" \ - --data-urlencode "warningCount=$warningCount"` - curlStatus=$? - - if [ $curlStatus -eq 0 ]; then - if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then - curlStatus=$curlResult + curlStatus=1 + retryCount=0 + # retry loop to harden against spotty telemetry connections + # we don't retry successes and 4xx client errors + until [[ $curlStatus -eq 0 || ( $curlStatus -ge 400 && $curlStatus -le 499 ) || $retryCount -ge $MaxRetries ]] + do + if [ $retryCount -gt 0 ]; then + echo "Failed to send telemetry to Helix; waiting $RetryDelay seconds before retrying..." + sleep $RetryDelay fi - fi + + # create a temporary file for curl output + res=`mktemp` + + curlResult=` + curl --verbose --output $res --write-out "%{http_code}"\ + -H 'Content-Type: application/json' \ + -H "X-Helix-Job-Token: $Helix_JobToken" \ + -H 'Content-Length: 0' \ + -X POST -G "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$Helix_WorkItemId/finish" \ + --data-urlencode "errorCount=$errorCount" \ + --data-urlencode "warningCount=$warningCount"` + curlStatus=$? + + if [ $curlStatus -eq 0 ]; then + if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then + curlStatus=$curlResult + fi + fi + + let retryCount++ + done if [ $curlStatus -ne 0 ]; then - echo "Failed to Send Build Finish information" + echo "Failed to Send Build Finish information after $retryCount retries" vstsLogOutput="vso[task.logissue type=error;sourcepath=templates/steps/telemetry-end.yml;code=1;]Failed to Send Build Finish information: $curlStatus" echo "##$vstsLogOutput" exit 1 @@ -37,6 +55,8 @@ steps: # defined via VSTS variables in start-job.sh Helix_JobToken: $(Helix_JobToken) Helix_WorkItemId: $(Helix_WorkItemId) + MaxRetries: ${{ parameters.maxRetries }} + RetryDelay: ${{ parameters.retryDelay }} condition: and(always(), ne(variables['Agent.Os'], 'Windows_NT')) - powershell: | if (($env:Agent_JobStatus -eq 'Succeeded') -or ($env:Agent_JobStatus -eq 'PartiallySucceeded')) { @@ -46,13 +66,30 @@ steps: } $WarningCount = 0 - try { - Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$env:Helix_WorkItemId/finish?errorCount=$ErrorCount&warningCount=$WarningCount" -Method Post -ContentType "application/json" -Body "" ` - -Headers @{ 'X-Helix-Job-Token'=$env:Helix_JobToken } + # Basic retry loop to harden against server flakiness + $retryCount = 0 + while ($retryCount -lt $env:MaxRetries) { + try { + Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job/build/$env:Helix_WorkItemId/finish?errorCount=$ErrorCount&warningCount=$WarningCount" -Method Post -ContentType "application/json" -Body "" ` + -Headers @{ 'X-Helix-Job-Token'=$env:Helix_JobToken } + break + } + catch { + $statusCode = $_.Exception.Response.StatusCode.value__ + if ($statusCode -ge 400 -and $statusCode -le 499) { + Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix (status code $statusCode); not retrying (4xx client error)" + Write-Host "##vso[task.logissue]error ", $_.Exception.GetType().FullName, $_.Exception.Message + exit 1 + } + Write-Host "Failed to send telemetry to Helix (status code $statusCode); waiting $env:RetryDelay seconds before retrying..." + $retryCount++ + sleep $env:RetryDelay + continue + } } - catch { - Write-Error $_ - Write-Error $_.Exception + + if ($retryCount -ge $env:MaxRetries) { + Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix after $retryCount retries." exit 1 } displayName: Send Windows Build End Telemetry @@ -60,4 +97,6 @@ steps: # defined via VSTS variables in start-job.ps1 Helix_JobToken: $(Helix_JobToken) Helix_WorkItemId: $(Helix_WorkItemId) + MaxRetries: ${{ parameters.maxRetries }} + RetryDelay: ${{ parameters.retryDelay }} condition: and(always(),eq(variables['Agent.Os'], 'Windows_NT')) diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml index 79c128c5de87..f6a521be21ed 100644 --- a/eng/common/templates/steps/telemetry-start.yml +++ b/eng/common/templates/steps/telemetry-start.yml @@ -3,6 +3,8 @@ parameters: helixType: 'undefined_defaulted_in_telemetry.yml' buildConfig: '' runAsPublic: false + maxRetries: 5 + retryDelay: 10 # in seconds steps: - ${{ if and(eq(parameters.runAsPublic, 'false'), not(eq(variables['System.TeamProject'], 'public'))) }}: @@ -30,7 +32,7 @@ steps: } } JobListStuff - + cat $jobInfo # create a temporary file for curl output @@ -38,30 +40,44 @@ steps: accessTokenParameter="?access_token=$HelixApiAccessToken" - curlResult=` - cat $jobInfo |\ - curl --trace - --verbose --output $res --write-out "%{http_code}" \ - -H 'Content-Type: application/json' \ - -X POST "https://helix.dot.net/api/2018-03-14/telemetry/job$accessTokenParameter" -d @-` - curlStatus=$? + curlStatus=1 + retryCount=0 + # retry loop to harden against spotty telemetry connections + # we don't retry successes and 4xx client errors + until [[ $curlStatus -eq 0 || ( $curlStatus -ge 400 && $curlStatus -le 499 ) || $retryCount -ge $MaxRetries ]] + do + if [ $retryCount -gt 0 ]; then + echo "Failed to send telemetry to Helix; waiting $RetryDelay seconds before retrying..." + sleep $RetryDelay + fi + + curlResult=` + cat $jobInfo |\ + curl --trace - --verbose --output $res --write-out "%{http_code}" \ + -H 'Content-Type: application/json' \ + -X POST "https://helix.dot.net/api/2018-03-14/telemetry/job$accessTokenParameter" -d @-` + curlStatus=$? - if [ $curlStatus -eq 0 ]; then - if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then - curlStatus=$curlResult + if [ $curlStatus -eq 0 ]; then + if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then + curlStatus=$curlResult + fi fi - fi + + let retryCount++ + done curlResult=`cat $res` - + # validate status of curl command if [ $curlStatus -ne 0 ]; then - echo "Failed To Send Job Start information" + echo "Failed To Send Job Start information after $retryCount retries" # We have to append the ## vso prefix or vso will pick up the command when it dumps the inline script into the shell vstsLogOutput="vso[task.logissue type=error;sourcepath=telemetry/start-job.sh;code=1;]Failed to Send Job Start information: $curlStatus" echo "##$vstsLogOutput" exit 1 fi - + # Set the Helix_JobToken variable export Helix_JobToken=`echo $curlResult | xargs echo` # Strip Quotes echo "##vso[task.setvariable variable=Helix_JobToken;issecret=true;]$Helix_JobToken" @@ -75,29 +91,44 @@ steps: Attempt: 1 OperatingSystem: $(Agent.Os) Configuration: ${{ parameters.buildConfig }} + MaxRetries: ${{ parameters.maxRetries }} + RetryDelay: ${{ parameters.retryDelay }} condition: and(always(), ne(variables['Agent.Os'], 'Windows_NT')) - bash: | - res=`mktemp` - curlResult=` - curl --verbose --output $res --write-out "%{http_code}"\ - -H 'Content-Type: application/json' \ - -H "X-Helix-Job-Token: $Helix_JobToken" \ - -H 'Content-Length: 0' \ - -X POST -G "https://helix.dot.net/api/2018-03-14/telemetry/job/build" \ - --data-urlencode "buildUri=$BuildUri"` - curlStatus=$? - - if [ $curlStatus -eq 0 ]; then - if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then - curlStatus=$curlResult + curlStatus=1 + retryCount=0 + # retry loop to harden against spotty telemetry connections + # we don't retry successes and 4xx client errors + until [[ $curlStatus -eq 0 || ( $curlStatus -ge 400 && $curlStatus -le 499 ) || $retryCount -ge $MaxRetries ]] + do + if [ $retryCount -gt 0 ]; then + echo "Failed to send telemetry to Helix; waiting $RetryDelay seconds before retrying..." + sleep $RetryDelay fi - fi - curlResult=`cat $res` + res=`mktemp` + curlResult=` + curl --verbose --output $res --write-out "%{http_code}"\ + -H 'Content-Type: application/json' \ + -H "X-Helix-Job-Token: $Helix_JobToken" \ + -H 'Content-Length: 0' \ + -X POST -G "https://helix.dot.net/api/2018-03-14/telemetry/job/build" \ + --data-urlencode "buildUri=$BuildUri"` + curlStatus=$? + + if [ $curlStatus -eq 0 ]; then + if [ $curlResult -gt 299 ] || [ $curlResult -lt 200 ]; then + curlStatus=$curlResult + fi + fi + + curlResult=`cat $res` + let retryCount++ + done # validate status of curl command if [ $curlStatus -ne 0 ]; then - echo "Failed to Send Build Start information" + echo "Failed to Send Build Start information after $retryCount retries" vstsLogOutput="vso[task.logissue type=error;sourcepath=telemetry/build/start.sh;code=1;]Failed to Send Build Start information: $curlStatus" echo "##$vstsLogOutput" exit 1 @@ -109,8 +140,10 @@ steps: env: BuildUri: $(System.TaskDefinitionsUri)$(System.TeamProject)/_build/index?buildId=$(Build.BuildId)&_a=summary Helix_JobToken: $(Helix_JobToken) + MaxRetries: ${{ parameters.maxRetries }} + RetryDelay: ${{ parameters.retryDelay }} condition: and(always(), ne(variables['Agent.Os'], 'Windows_NT')) - + - powershell: | $jobInfo = [pscustomobject]@{ QueueId=$env:QueueId; @@ -120,17 +153,42 @@ steps: Attempt=$env:Attempt; Properties=[pscustomobject]@{ operatingSystem=$env:OperatingSystem; configuration=$env:Configuration }; } - + $jobInfoJson = $jobInfo | ConvertTo-Json if ($env:HelixApiAccessToken) { $accessTokenParameter="?access_token=$($env:HelixApiAccessToken)" } Write-Host "Job Info: $jobInfoJson" - $jobToken = Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job$($accessTokenParameter)" -Method Post -ContentType "application/json" -Body $jobInfoJson + + # Basic retry loop to harden against server flakiness + $retryCount = 0 + while ($retryCount -lt $env:MaxRetries) { + try { + $jobToken = Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job$($accessTokenParameter)" -Method Post -ContentType "application/json" -Body $jobInfoJson + break + } + catch { + $statusCode = $_.Exception.Response.StatusCode.value__ + if ($statusCode -ge 400 -and $statusCode -le 499) { + Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix (status code $statusCode); not retrying (4xx client error)" + Write-Host "##vso[task.logissue]error ", $_.Exception.GetType().FullName, $_.Exception.Message + exit 1 + } + Write-Host "Failed to send telemetry to Helix (status code $statusCode); waiting $env:RetryDelay seconds before retrying..." + $retryCount++ + sleep $env:RetryDelay + continue + } + } + + if ($retryCount -ge $env:MaxRetries) { + Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix after $retryCount retries." + exit 1 + } + $env:Helix_JobToken = $jobToken Write-Host "##vso[task.setvariable variable=Helix_JobToken;issecret=true;]$env:Helix_JobToken" - displayName: Send Windows Job Start Telemetry env: HelixApiAccessToken: $(HelixApiAccessToken) Source: ${{ parameters.helixSource }} @@ -140,15 +198,43 @@ steps: Attempt: 1 OperatingSystem: $(Agent.Os) Configuration: ${{ parameters.buildConfig }} + MaxRetries: ${{ parameters.maxRetries }} + RetryDelay: ${{ parameters.retryDelay }} condition: and(always(), eq(variables['Agent.Os'], 'Windows_NT')) - powershell: | - $workItemId = Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job/build?buildUri=$([Net.WebUtility]::UrlEncode($env:BuildUri))" -Method Post -ContentType "application/json" -Body "" ` - -Headers @{ 'X-Helix-Job-Token'=$env:Helix_JobToken } - + # Basic retry loop to harden against server flakiness + $retryCount = 0 + while ($retryCount -lt $env:MaxRetries) { + try { + $workItemId = Invoke-RestMethod -Uri "https://helix.dot.net/api/2018-03-14/telemetry/job/build?buildUri=$([Net.WebUtility]::UrlEncode($env:BuildUri))" -Method Post -ContentType "application/json" -Body "" ` + -Headers @{ 'X-Helix-Job-Token'=$env:Helix_JobToken } + break + } + catch { + $statusCode = $_.Exception.Response.StatusCode.value__ + if ($statusCode -ge 400 -and $statusCode -le 499) { + Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix (status code $statusCode); not retrying (4xx client error)" + Write-Host "##vso[task.logissue]error ", $_.Exception.GetType().FullName, $_.Exception.Message + exit 1 + } + Write-Host "Failed to send telemetry to Helix (status code $statusCode); waiting $env:RetryDelay seconds before retrying..." + $retryCount++ + sleep $env:RetryDelay + continue + } + } + + if ($retryCount -ge $env:MaxRetries) { + Write-Host "##vso[task.logissue]error Failed to send telemetry to Helix after $retryCount retries." + exit 1 + } + $env:Helix_WorkItemId = $workItemId Write-Host "##vso[task.setvariable variable=Helix_WorkItemId]$env:Helix_WorkItemId" displayName: Send Windows Build Start Telemetry env: BuildUri: $(System.TaskDefinitionsUri)$(System.TeamProject)/_build/index?buildId=$(Build.BuildId)&_a=summary Helix_JobToken: $(Helix_JobToken) + MaxRetries: ${{ parameters.maxRetries }} + RetryDelay: ${{ parameters.retryDelay }} condition: and(always(), eq(variables['Agent.Os'], 'Windows_NT')) diff --git a/global.json b/global.json index d34c6fb1999b..786425625b90 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19101.15", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19101.15" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19101.16", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19101.16" } } From 27023ceaedaa1868f16d231022e2dbe010a11887 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 2 Feb 2019 15:53:00 +0000 Subject: [PATCH 0338/2702] Update dependencies from https://github.com/dotnet/arcade build 20190202.1 (#330) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19102.1 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19102.1 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a7762dc2405e..746e36a268d6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 159c3e6c65ab7b1e89e962290538364898d02cd8 + fa609521d7545e498da8b877876d59affb36dc0d - + https://github.com/dotnet/arcade - 159c3e6c65ab7b1e89e962290538364898d02cd8 + fa609521d7545e498da8b877876d59affb36dc0d diff --git a/global.json b/global.json index 786425625b90..7d72ab38423f 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19101.16", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19101.16" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19102.1", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19102.1" } } From db04d081774b9bcbb71dbcd0c48c0214a1ee2e6c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 3 Feb 2019 15:22:46 +0000 Subject: [PATCH 0339/2702] Update dependencies from https://github.com/dotnet/arcade build 20190203.1 (#331) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19103.1 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19103.1 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 746e36a268d6..39f981bbf474 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - fa609521d7545e498da8b877876d59affb36dc0d + 58be4cadf2cabd4b3b3186576557835a1987a711 - + https://github.com/dotnet/arcade - fa609521d7545e498da8b877876d59affb36dc0d + 58be4cadf2cabd4b3b3186576557835a1987a711 diff --git a/global.json b/global.json index 7d72ab38423f..6c3343fb8b09 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19102.1", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19102.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19103.1", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19103.1" } } From 0c0fd91f4a1cf56ef8c5b627b254d81d3ad3de7f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 4 Feb 2019 20:48:49 +0000 Subject: [PATCH 0340/2702] Update dependencies from https://github.com/dotnet/arcade build 20190204.3 (#332) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19104.3 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19104.3 --- eng/Version.Details.xml | 8 +- eng/common/PublishBuildAssets.cmd | 3 - eng/common/internal/Directory.Build.props | 4 + eng/common/internal/Directory.Build.targets | 3 + eng/common/internal/Tools.csproj | 17 +++++ eng/common/sdk-task.ps1 | 73 ++++++++++--------- .../templates/job/publish-build-assets.yml | 13 ++-- eng/common/tools.ps1 | 7 +- global.json | 4 +- 9 files changed, 83 insertions(+), 49 deletions(-) delete mode 100644 eng/common/PublishBuildAssets.cmd create mode 100644 eng/common/internal/Directory.Build.props create mode 100644 eng/common/internal/Directory.Build.targets create mode 100644 eng/common/internal/Tools.csproj diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 39f981bbf474..d2676553f441 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 58be4cadf2cabd4b3b3186576557835a1987a711 + d8482000298ac06e7ae13a73329d27b0b13d532b - + https://github.com/dotnet/arcade - 58be4cadf2cabd4b3b3186576557835a1987a711 + d8482000298ac06e7ae13a73329d27b0b13d532b diff --git a/eng/common/PublishBuildAssets.cmd b/eng/common/PublishBuildAssets.cmd deleted file mode 100644 index 3c6e4ff829d5..000000000000 --- a/eng/common/PublishBuildAssets.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0sdk-task.ps1""" -msbuildEngine dotnet -restore -projects PublishBuildAssets.proj -ci %*" -exit /b %ErrorLevel% diff --git a/eng/common/internal/Directory.Build.props b/eng/common/internal/Directory.Build.props new file mode 100644 index 000000000000..99465f1aa501 --- /dev/null +++ b/eng/common/internal/Directory.Build.props @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/eng/common/internal/Directory.Build.targets b/eng/common/internal/Directory.Build.targets new file mode 100644 index 000000000000..d7efd3fada3f --- /dev/null +++ b/eng/common/internal/Directory.Build.targets @@ -0,0 +1,3 @@ + + + diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj new file mode 100644 index 000000000000..5bf0b8099e96 --- /dev/null +++ b/eng/common/internal/Tools.csproj @@ -0,0 +1,17 @@ + + + + + net472 + + + + + + + + https://devdiv.pkgs.visualstudio.com/_packaging/8f470c7e-ac49-4afe-a6ee-cf784e438b93/nuget/v3/index.json; + https://devdiv.pkgs.visualstudio.com/_packaging/VS/nuget/v3/index.json; + + + diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index 9ba7530122f6..d0eec5163efe 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -1,48 +1,47 @@ [CmdletBinding(PositionalBinding=$false)] Param( - [string] $projects = "", - [string][Alias('v')]$verbosity = "minimal", + [string] $configuration = "Debug", + [string] $task, + [string] $verbosity = "minimal", [string] $msbuildEngine = $null, - [bool] $warnAsError = $true, - [switch][Alias('bl')]$binaryLog, - [switch][Alias('r')]$restore, - [switch] $ci, + [switch] $restore, [switch] $prepareMachine, [switch] $help, [Parameter(ValueFromRemainingArguments=$true)][String[]]$properties ) +$ci = $true +$binaryLog = $true +$warnAsError = $true + . $PSScriptRoot\tools.ps1 function Print-Usage() { - Write-Host "Common settings:" - Write-Host " -v[erbosity] Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" - Write-Host " -[bl|binaryLog] Output binary log (short: -bl)" - Write-Host " -help Print help and exit" - Write-Host "" + Write-Host "Common settings:" + Write-Host " -task Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)" + Write-Host " -restore Restore dependencies" + Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" + Write-Host " -help Print help and exit" + Write-Host "" - Write-Host "Advanced settings:" - Write-Host " -restore Restore dependencies (short: -r)" - Write-Host " -projects Semi-colon delimited list of sln/proj's from the Arcade sdk to build. Globbing is supported (*.sln)" - Write-Host " -ci Set when running on CI server" - Write-Host " -prepareMachine Prepare machine for CI run" - Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." - Write-Host "" - Write-Host "Command line arguments not listed above are passed thru to msbuild." - Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." + Write-Host "Advanced settings:" + Write-Host " -prepareMachine Prepare machine for CI run" + Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." + Write-Host "" + Write-Host "Command line arguments not listed above are passed thru to msbuild." } -function Build { - $toolsetBuildProj = InitializeToolset +function Build([string]$target) { + $logSuffix = if ($target -eq "Execute") { "" } else { ".$target" } + $log = Join-Path $LogDir "$task$logSuffix.binlog" + $outputPath = Join-Path $ToolsetDir "$task\\" - $toolsetBuildProj = Join-Path (Split-Path $toolsetBuildProj -Parent) "SdkTasks\SdkTask.proj" - $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "SdkTask.binlog") } else { "" } - MSBuild $toolsetBuildProj ` - $bl ` - /p:Projects=$projects ` - /p:Restore=$restore ` + MSBuild $taskProject ` + /bl:$log ` + /t:$target ` + /p:Configuration=$configuration ` /p:RepoRoot=$RepoRoot ` - /p:ContinuousIntegrationBuild=$ci ` + /p:BaseIntermediateOutputPath=$outputPath ` @properties } @@ -52,17 +51,23 @@ try { exit 0 } - if ($projects -eq "") { - Write-Error "Missing required parameter '-projects '" + if ($task -eq "") { + Write-Host "Missing required parameter '-task '" -ForegroundColor Red Print-Usage ExitWithExitCode 1 } - if ($ci) { - $binaryLog = $true + $taskProject = GetSdkTaskProject $task + if (!(Test-Path $taskProject)) { + Write-Host "Unknown task: $task" -ForegroundColor Red + ExitWithExitCode 1 + } + + if ($restore) { + Build "Restore" } - Build + Build "Execute" } catch { Write-Host $_ diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index c094658fefc7..d6d8697cbdeb 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -44,12 +44,15 @@ jobs: downloadPath: '$(Build.StagingDirectory)/Download' condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - - script: eng\common\publishbuildassets.cmd - /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com - /p:Configuration=$(_BuildConfig) + - task: PowerShell@2 displayName: Publish Build Assets + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + /p:Configuration=$(_BuildConfig) condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 4204dc14f892..e91f8ccf3b31 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -376,6 +376,11 @@ function GetNuGetPackageCachePath() { return $env:NUGET_PACKAGES } +# Returns a full path to an Arcade SDK task project file. +function GetSdkTaskProject([string]$taskName) { + return Join-Path (Split-Path (InitializeToolset) -Parent) "SdkTasks\$taskName.proj" +} + function InitializeToolset() { if (Test-Path variable:global:_ToolsetBuildProj) { return $global:_ToolsetBuildProj @@ -394,7 +399,7 @@ function InitializeToolset() { } if (-not $restore) { - Write-Host "Toolset version $toolsetVersion has not been restored." + Write-Host "Toolset version $toolsetVersion has not been restored." -ForegroundColor Red ExitWithExitCode 1 } diff --git a/global.json b/global.json index 6c3343fb8b09..2a53ca9048b7 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19103.1", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19103.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.3", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.3" } } From e29fe13839bc95e0246312ee1fa77f3e026a2b3a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 4 Feb 2019 21:17:19 +0000 Subject: [PATCH 0341/2702] Update dependencies from https://github.com/dotnet/arcade build 20190204.5 (#333) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19104.5 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19104.5 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d2676553f441..19e3ba78c6c6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - d8482000298ac06e7ae13a73329d27b0b13d532b + 5c6d87070de86a2092e5929f9dcd98b86ada3897 - + https://github.com/dotnet/arcade - d8482000298ac06e7ae13a73329d27b0b13d532b + 5c6d87070de86a2092e5929f9dcd98b86ada3897 diff --git a/global.json b/global.json index 2a53ca9048b7..b84041d1a817 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.3", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.5", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.5" } } From 05617859f9b76e37bcf333ebc5d6d942615f4ad0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 5 Feb 2019 04:52:36 +0000 Subject: [PATCH 0342/2702] Update dependencies from dotnet/arcade (#334) * Update dependencies from https://github.com/dotnet/arcade build 20190204.9 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19104.9 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19104.9 * Update dependencies from https://github.com/dotnet/arcade build 20190204.14 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19104.14 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19104.14 --- eng/Version.Details.xml | 8 ++++---- eng/common/PublishToPackageFeed.proj | 3 +++ eng/common/internal/Directory.Build.props | 4 ++-- eng/common/internal/Directory.Build.targets | 2 +- global.json | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 19e3ba78c6c6..b314c91c2cdd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 5c6d87070de86a2092e5929f9dcd98b86ada3897 + b5f99257d63e4f7784412ef78c5ca11ffea75338 - + https://github.com/dotnet/arcade - 5c6d87070de86a2092e5929f9dcd98b86ada3897 + b5f99257d63e4f7784412ef78c5ca11ffea75338 diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj index 9db453894860..8149e3fb6a13 100644 --- a/eng/common/PublishToPackageFeed.proj +++ b/eng/common/PublishToPackageFeed.proj @@ -32,6 +32,9 @@ + - \ No newline at end of file + diff --git a/eng/common/internal/Directory.Build.targets b/eng/common/internal/Directory.Build.targets index d7efd3fada3f..5d26408a9819 100644 --- a/eng/common/internal/Directory.Build.targets +++ b/eng/common/internal/Directory.Build.targets @@ -1,3 +1,3 @@ - + diff --git a/global.json b/global.json index b84041d1a817..bbc1d75c2355 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.5", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.14", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.14" } } From c39c2d5306fc833bf4aaf9fc8acacfcd6597625c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 5 Feb 2019 05:09:10 +0000 Subject: [PATCH 0343/2702] Update dependencies from https://github.com/dotnet/arcade build 20190204.17 (#335) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19104.17 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19104.17 --- eng/Version.Details.xml | 8 ++++---- eng/common/internal/Tools.csproj | 2 ++ global.json | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b314c91c2cdd..197fffce98d9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - b5f99257d63e4f7784412ef78c5ca11ffea75338 + bfcc6d1829a7141377bc9e563656faf8799a410c - + https://github.com/dotnet/arcade - b5f99257d63e4f7784412ef78c5ca11ffea75338 + bfcc6d1829a7141377bc9e563656faf8799a410c diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index 5bf0b8099e96..1d2e2183766c 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -5,6 +5,8 @@ net472 + + diff --git a/global.json b/global.json index bbc1d75c2355..8af1613f797e 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.14", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.14" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.17", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.17" } } From 92aa97549423dd1d0153cc176bd5078c8985b068 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 5 Feb 2019 06:01:27 +0000 Subject: [PATCH 0344/2702] Update dependencies from https://github.com/dotnet/arcade build 20190204.18 (#336) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19104.18 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19104.18 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 197fffce98d9..1dca9995dc22 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - bfcc6d1829a7141377bc9e563656faf8799a410c + 8888f0d15c7cc51018ffaf0a9a408f7ba8e82301 - + https://github.com/dotnet/arcade - bfcc6d1829a7141377bc9e563656faf8799a410c + 8888f0d15c7cc51018ffaf0a9a408f7ba8e82301 diff --git a/global.json b/global.json index 8af1613f797e..33facaab7648 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.17", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.17" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.18", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.18" } } From 42b148d5d8f8b8792508a3bef512abdb2c30ccf9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 5 Feb 2019 16:47:02 +0000 Subject: [PATCH 0345/2702] Update dependencies from https://github.com/dotnet/arcade build 20190205.1 (#337) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19105.1 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19105.1 --- eng/Version.Details.xml | 8 ++++---- eng/common/tools.ps1 | 5 +++-- eng/common/tools.sh | 7 ++++++- global.json | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1dca9995dc22..0aa5ed1ee9f5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 8888f0d15c7cc51018ffaf0a9a408f7ba8e82301 + 371e609098dbaf6ba394e5522ba74be75b555c06 - + https://github.com/dotnet/arcade - 8888f0d15c7cc51018ffaf0a9a408f7ba8e82301 + 371e609098dbaf6ba394e5522ba74be75b555c06 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index e91f8ccf3b31..c0a559589fcc 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -161,9 +161,10 @@ function GetDotNetInstallScript([string] $dotnetRoot) { return $installScript } -function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { +function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = "") { $installScript = GetDotNetInstallScript $dotnetRoot - & $installScript -Version $version -InstallDir $dotnetRoot + $archArg = if ($architecture) { $architecture } else { "" } + & $installScript -Version $version -InstallDir $dotnetRoot -Architecture $archArg if ($lastExitCode -ne 0) { Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red ExitWithExitCode $lastExitCode diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 8a253bef5131..115a56a827d7 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -153,7 +153,12 @@ function InstallDotNetSdk { GetDotNetInstallScript "$root" local install_script=$_GetDotNetInstallScript - bash "$install_script" --version $version --install-dir "$root" || { + local arch_arg="" + if [[ $# == 3 ]]; then + arch_arg="--architecture $3" + fi + + bash "$install_script" --version $version --install-dir "$root" $arch_arg || { local exit_code=$? echo "Failed to install dotnet SDK (exit code '$exit_code')." >&2 ExitWithExitCode $exit_code diff --git a/global.json b/global.json index 33facaab7648..8fab3ff2c5f6 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19104.18", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19104.18" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19105.1", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19105.1" } } From 48a7b5ccf8719399502b0d9e6d848fa5015ee896 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 5 Feb 2019 18:39:19 +0000 Subject: [PATCH 0346/2702] Update dependencies from https://github.com/dotnet/arcade build 20190205.2 (#338) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19105.2 - Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19105.2 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0aa5ed1ee9f5..d8311f7c1324 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,13 +2,13 @@ - + https://github.com/dotnet/arcade - 371e609098dbaf6ba394e5522ba74be75b555c06 + 44b52e6b16ba146ed2505d469953da9a1af94a42 - + https://github.com/dotnet/arcade - 371e609098dbaf6ba394e5522ba74be75b555c06 + 44b52e6b16ba146ed2505d469953da9a1af94a42 diff --git a/global.json b/global.json index 8fab3ff2c5f6..b09e90ba9eb8 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19105.1", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19105.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19105.2", + "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19105.2" } } From fbd1b5e0c417beca9c2e91d77217008036792a2d Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Fri, 15 Feb 2019 16:16:14 -0800 Subject: [PATCH 0347/2702] removing default solution --- Hello.Tests/Hello.Tests.csproj | 12 ------------ Hello.Tests/HelloTests.cs | 14 ------------- HelloWorld.sln | 36 ---------------------------------- HelloWorld/HelloWorld.csproj | 9 --------- HelloWorld/Program.cs | 18 ----------------- 5 files changed, 89 deletions(-) delete mode 100644 Hello.Tests/Hello.Tests.csproj delete mode 100644 Hello.Tests/HelloTests.cs delete mode 100644 HelloWorld.sln delete mode 100644 HelloWorld/HelloWorld.csproj delete mode 100644 HelloWorld/Program.cs diff --git a/Hello.Tests/Hello.Tests.csproj b/Hello.Tests/Hello.Tests.csproj deleted file mode 100644 index f5e3119fd480..000000000000 --- a/Hello.Tests/Hello.Tests.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - netcoreapp2.0;netcoreapp2.1 - false - - - - - - - diff --git a/Hello.Tests/HelloTests.cs b/Hello.Tests/HelloTests.cs deleted file mode 100644 index 4f1d6f376bea..000000000000 --- a/Hello.Tests/HelloTests.cs +++ /dev/null @@ -1,14 +0,0 @@ -using HelloWorld; -using Xunit; - -namespace HelloTests -{ - public class HelloTests - { - [Fact] - public void SuccessfulTest() - { - Assert.Equal(42, new Program().Magic); - } - } -} diff --git a/HelloWorld.sln b/HelloWorld.sln deleted file mode 100644 index e7b2d49b5613..000000000000 --- a/HelloWorld.sln +++ /dev/null @@ -1,36 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27912.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorld", "HelloWorld\HelloWorld.csproj", "{0D23A41B-2626-4703-9E4A-87C07F69B0B2}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A275E4CF-6AF3-439A-B72B-A2EDAE49A5C6}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hello.Tests", "Hello.Tests\Hello.Tests.csproj", "{6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0D23A41B-2626-4703-9E4A-87C07F69B0B2}.Release|Any CPU.Build.0 = Release|Any CPU - {6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6BD2B121-CAB1-42F2-83A6-82A0F51E6B37}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {56D5F4DA-F710-4026-8F49-4A903BCAA9B5} - EndGlobalSection -EndGlobal diff --git a/HelloWorld/HelloWorld.csproj b/HelloWorld/HelloWorld.csproj deleted file mode 100644 index fdcf1895530e..000000000000 --- a/HelloWorld/HelloWorld.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - Exe - netcoreapp2.0 - true - - - diff --git a/HelloWorld/Program.cs b/HelloWorld/Program.cs deleted file mode 100644 index bba4070d15d2..000000000000 --- a/HelloWorld/Program.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace HelloWorld -{ - public class Program - { - public int Magic => 42; - - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } -} From 09bb7501c607f3da7744fb547e0d175fd405461c Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 16 Feb 2019 17:38:26 -0800 Subject: [PATCH 0348/2702] adding source --- README.md | 271 ++----- eng/Versions.props | 16 +- format.sln | 34 + src/CodeFormatter.cs | 208 +++++ src/EditorConfigOptionsApplier.cs | 93 +++ src/Logging/SimpleConsoleLogger.cs | 61 ++ .../SimpleConsoleLoggerFactoryExtensions.cs | 16 + src/Logging/SimpleConsoleLoggerProvider.cs | 28 + src/MSBuild/MSBuildCoreLoader.cs | 95 +++ src/MSBuild/MSBuildEnvironment.cs | 78 ++ src/MSBuild/MSBuildWorkspaceFinder.cs | 104 +++ src/Program.cs | 117 +++ src/Resources.Designer.cs | 269 +++++++ src/Resources.resx | 186 +++++ src/Utilities/FileNameUtilities.cs | 183 +++++ src/Utilities/GeneratedCodeUtilities.cs | 110 +++ src/Utilities/Hash.cs | 367 +++++++++ src/Utilities/PathKind.cs | 42 + src/Utilities/PathUtilities.cs | 749 ++++++++++++++++++ src/Utilities/PlatformInformation.cs | 33 + src/Utilities/ProcessRunner.cs | 196 +++++ src/dotnet-format.csproj | 56 ++ src/xlf/Resources.cs.xlf | 117 +++ src/xlf/Resources.de.xlf | 117 +++ src/xlf/Resources.es.xlf | 117 +++ src/xlf/Resources.fr.xlf | 117 +++ src/xlf/Resources.it.xlf | 117 +++ src/xlf/Resources.ja.xlf | 117 +++ src/xlf/Resources.ko.xlf | 117 +++ src/xlf/Resources.pl.xlf | 117 +++ src/xlf/Resources.pt-BR.xlf | 117 +++ src/xlf/Resources.ru.xlf | 117 +++ src/xlf/Resources.tr.xlf | 117 +++ src/xlf/Resources.zh-Hans.xlf | 117 +++ src/xlf/Resources.zh-Hant.xlf | 117 +++ 35 files changed, 4635 insertions(+), 198 deletions(-) create mode 100644 format.sln create mode 100644 src/CodeFormatter.cs create mode 100644 src/EditorConfigOptionsApplier.cs create mode 100644 src/Logging/SimpleConsoleLogger.cs create mode 100644 src/Logging/SimpleConsoleLoggerFactoryExtensions.cs create mode 100644 src/Logging/SimpleConsoleLoggerProvider.cs create mode 100644 src/MSBuild/MSBuildCoreLoader.cs create mode 100644 src/MSBuild/MSBuildEnvironment.cs create mode 100644 src/MSBuild/MSBuildWorkspaceFinder.cs create mode 100644 src/Program.cs create mode 100644 src/Resources.Designer.cs create mode 100644 src/Resources.resx create mode 100644 src/Utilities/FileNameUtilities.cs create mode 100644 src/Utilities/GeneratedCodeUtilities.cs create mode 100644 src/Utilities/Hash.cs create mode 100644 src/Utilities/PathKind.cs create mode 100644 src/Utilities/PathUtilities.cs create mode 100644 src/Utilities/PlatformInformation.cs create mode 100644 src/Utilities/ProcessRunner.cs create mode 100644 src/dotnet-format.csproj create mode 100644 src/xlf/Resources.cs.xlf create mode 100644 src/xlf/Resources.de.xlf create mode 100644 src/xlf/Resources.es.xlf create mode 100644 src/xlf/Resources.fr.xlf create mode 100644 src/xlf/Resources.it.xlf create mode 100644 src/xlf/Resources.ja.xlf create mode 100644 src/xlf/Resources.ko.xlf create mode 100644 src/xlf/Resources.pl.xlf create mode 100644 src/xlf/Resources.pt-BR.xlf create mode 100644 src/xlf/Resources.ru.xlf create mode 100644 src/xlf/Resources.tr.xlf create mode 100644 src/xlf/Resources.zh-Hans.xlf create mode 100644 src/xlf/Resources.zh-Hant.xlf diff --git a/README.md b/README.md index bc996159a23e..73254687436e 100644 --- a/README.md +++ b/README.md @@ -1,197 +1,74 @@ -# Arcade Minimal CI Sample - -[![Build Status](https://dnceng.visualstudio.com/public/_apis/build/status/dotnet/arcade-minimalci-sample/arcade-minimalci-sample-ci?branchName=master)](https://dnceng.visualstudio.com/public/_build/latest?definitionId=209?branchName=master) - -This repository serves as an example of how to link GitHub repositories to Azure DevOps for CI and PR builds. - -## Before You Start - -You'll want to start by following the [Azure DevOps Onboarding](https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/AzureDevOpsOnboarding.md) instructions, which provide a thorough, step-by-step list of instructions for creating Azure DevOps CI builds for GitHub repos. From there, you'll find the [Azure DevOps YAML documentation](https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started-yaml?view=vsts), which details the creation of Azure DevOps CI YAML files. - -The purpose of this repository is to provide a jumping off point with an example YAML CI file that already has the basic architecture you'll want for your builds. All examples below are taken from this repository's [azure-pipelines.yml](azure-pipelines.yml). - -## Set build triggers in your YAML - -Documentation on setting CI triggers in YAML can be found [here](https://docs.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=vsts&tabs=yaml#set-up-a-ci-trigger-for-a-topic-branch). The syntax for pull request triggers is identical, and will trigger whenever a PR is created merging into your specified branches. - -**Note: YAML-based PR triggers are a feature currently being rolled out by Azure DevOps. Until they are completed, you must override the YAML PR trigger settings from the build definition GUI on Azure DevOps.** - -```yaml -trigger: -- master - -# Commenting out until Azure DevOps supports YAML PR triggers -# pr: -# - master -``` - -## Base your builds on Arcade for ease of use - -Arcade is designed to make many of the more complex tasks (such as sending telemetry) simple to do out of the box. It is therefore recommended that all builds base themselves on Arcade's `base.yml` template. Today, this can be done by copying the `eng/common` folder from Arcade into a local `eng/common` folder. In the near future, Engineering services will provide the capability to auto-update this folder via Maestro so that you don't need to manually take updates to common Arcade scripts. - -```yaml -jobs: -- template: /eng/common/templates/job/job.yml - parameters: - ... -``` - -## Use the Arcade SDK for an easier build process - -To quickstart your builds, you can use the Arcade SDK's build scripts. Clone the `eng/*` folder from this repository and copy [`Directory.Build.props`](Directory.Build.props), [`Directory.Build.targets`](Directory.Build.targets), [`global.json`](global.json), and [`NuGet.Config`](NuGet.Config) into your root directory. To use the build scripts, simply use a `script` task to run `eng\common\cibuild.cmd` on Windows or `eng/common/cibuild.sh` on a Unix-based OS. - -```yaml -# for Windows -steps: -- script: eng\common\cibuild.cmd - -configuration $(_BuildConfig) - -prepareMachine - -# for Unix-based -steps: -- script: eng/common/cibuild.sh - --configuration $(_BuildConfig) - --prepareMachine -``` - -Note: for the Unix-based scripts to work, make sure you clone rather than copy/paste while on Windows—copying and pasting will remove the `x` chmod parameter from the Unix scripts, which will build breaks when attempting to run them. - -## Use matrices to quickly create phases for different build configurations - -Azure DevOps supports using a **matrix** in a phase definition to quickly create several different phases on the same queue with slightly different build configurations. This is the recommended way to quickly add debug and release configuration builds. - -```yaml -- phase: Windows - queue: - name: Helix - parallel: 99 - matrix: - debug_configuration: - _BuildConfig: Debug - release_configuration: - _BuildConfig: Release -``` - -The variable defined in this matrix (in this case, `_BuildConfig`) can later be referenced in your build steps: - -```yaml -- task: DotNetCoreCLI@2 - inputs: - command: 'build' - projects: '**/*.csproj' - arguments: '--configuration $(_BuildConfig)' -``` - -## Run both CI and PR builds out of the same file - -While this sample repository has no need to do so, there are many scenarios in which you may want to differentiate between different build triggers. The current recommendation is that all repositories have a single `azure-pipelines.yml` file which defines all of their builds (CI, PR, and internal). To do this, use YAML `{{ if }}` directives and the Azure DevOps built-in `Build.Reason` variable. - -```yaml -- ${{ if notIn(variables['Build.Reason'], 'PullRequest') }}: - - task: DotNetCoreCLI@2 - inputs: - command: 'publish' - projects: 'HelloWorld/HelloWorld.csproj' - publishWebProjects: false - arguments: '--configuration $(_BuildConfig) --output $(build.ArtifactStagingDirectory) --framework $(targetFramework)' - displayName: dotnet publish -``` - -## Enabling telemetry - -[Arcade](#base-your-builds-on-arcade-for-ease-of-use) provides the ability to send telemetry. To enable telemetry you must... - -1. Set `enableTelemetry` to `true` - -2. Define the `_HelixType`, `_HelixSource`, and `_HelixBuildConfig` variables - - - `_HelixType` - This is a string that defines the type of run you are currently performing. Note that a trailing slash is required. e.g. test/functional/cli/, build/product/ - - `_HelixSource` - This defines information about the run in a specific format Type/repo/branch/. Note that a trailing slash is required. e.g. pr/corefx/master/, official/coreclr/master/ - - `_HelixBuildConfig` - The build configuration for your current build ie, Release, Debug, etc - -3. For official builds, add an "AzureKeyVault" task reference to `HelixProdKV` - -```YAML -jobs: -- template: /eng/common/templates/job/job.yml - parameters: - agentOs: Windows_NT - name: Windows_NT - enableTelemetry: true - - variables: - _HelixType: build/product - _HelixBuildConfig: $(_BuildConfig) - ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - _HelixSource: official/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) - ${{ if in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - _HelixSource: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) - - steps: - - ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - - task: AzureKeyVault@1 - inputs: - azureSubscription: 'HelixProd_KeyVault' - KeyVaultName: HelixProdKV - SecretsFilter: 'HelixApiAccessToken' - # conditions - https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=vsts - condition: always() -``` - -## Use Helix for cross-platform testing - -Arcade integrates with Helix, making it easy to do cross-platform testing at scale. To get started, you'll need to reference the Helix SDK in your [`global.json`](global.json): - -```json -"msbuild-sdks": { - "Microsoft.DotNet.Helix.Sdk": "" -} -``` - -Finally, reference the `send-to-helix.yml` template after your build step. Make sure to do it for each phase. - -```yaml -# defining your variables first makes them easy to reuse between queues -variables: - - name: _HelixType - value: build/product - - name: _HelixSource - value: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) - - name: _HelixTestType - value: test/product/ - - name: _XUnitProject # the reference(s) to the XUnit project(s) you wish to test, semicolon delimited - value: $(Build.SourcesDirectory)/HelloTests/HelloTests.csproj - - name: _XUnitTargetFramework # the xUnit framework you want to test on - value: netcoreapp2.0 - - name: _XUnitRunnerVersion # the version of the xUnit runner you wish to use - value: 2.4.1 - - name: _DotNetCliPackageType # either 'runtime' or 'sdk', depending on which you want to bootstrap onto the Helix machine - value: sdk - - name: _DotNetCliVersion # the version of the dotnet cli you want to bootstrap (probably the same as the one in your global.json!) - value: 2.1.403 -# ... -# steps: -# build step here -- template: /eng/common/templates/steps/send-to-helix.yml - parameters: - HelixSource: $(_HelixSource) - HelixType: $(_HelixTestType) - HelixTargetQueues: Windows.10.Amd64.Open;Windows.7.Amd64.Open # set queues appropriately for the machine you're building on - XUnitProjects: $(Build.SourcesDirectory)/HelloTests/HelloTests.csproj - XUnitTargetFramework: $(_XUnitTargetFramework) - XUnitRunnerVersion: $(_XUnitRunnerVersion) - IncludeDotNetCli: true - DotNetCliPackageType: $(_DotNetCliPackageType) - DotNetCliVersion: $(_DotNetCliVersion) - EnableXUnitReporter: true - WaitForWorkItemCompletion: true - condition: eq(variables['_BuildConfig'], 'Debug') -``` - -For more information, see the main documentation on sending jobs to Helix [here](https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/SendingJobsToHelix.md). - -## Using the SignToolTask - -Arcade provides an optimized way to sign files using MicroBuild, it is wrapped in a custom MSBuild task called [SignToolTask](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.SignTool/src/SignToolTask.cs). - -The Arcade SDK will automatically [find package](https://github.com/dotnet/arcade/blob/ae38bbbc25d03e1deb49b15ce88e2dd4c683e116/src/Microsoft.DotNet.Arcade.Sdk/tools/Sign.proj) files and forward them to be signed using SignToolTask. Therefore, if the only files that you care to sign are covered by the linked line above you don't have to do anything else. If not, you have options. You can specify explicit files to be signed / excluded from signing or changing the certificate / strong name to be used. For a detailed guide see the [SignTool package documentation](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.SignTool/README.md). +dotnet-format +============= +`dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. + +### How To Install + +The `dotnet-format` nuget package is currently in beta and published to nuget.org. You can visit the [dotnet-format nuget page](https://www.nuget.org/packages/dotnet-format/) to get the latest version number. + +You can install the tool using the following command. + +```console +dotnet tool install -g dotnet-format --version 3.0.0-beta4-19105-10 +``` + +#### Installing Development Builds + +Development builds of `dotnet-format` are being hosted on myget. You can visit the [dotnet-format myget page](https://dotnet.myget.org/feed/roslyn/package/nuget/dotnet-format) to get the latest version number. + +You can install the tool using the following command. + +```console +dotnet tool install -g dotnet-format --version --add-source https://dotnet.myget.org/F/roslyn/api/v3/index.json +``` + +### How To Use + +By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory you will need to specify the workspace to format using the `-w` option. You can control how verbose the output will be by using the `-v` option. + +``` +Usage: + dotnet-format [options] + +Options: + -w, --workspace The solution or project file to operate on. If a file is not specified, the command will search + the current directory for one. + -v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and + diag[nostic] + --version Display version information +``` + +Add `format` after `dotnet` and before the command arguments that you want to run: + +| Examples | +| -------------------------------------------------------- | +| dotnet **format** | +| dotnet **format** -w <workspace> | +| dotnet **format** -v diag | +| dotnet **format** -w <workspace> -v diag | + +### How To Uninstall + +You can uninstall the tool using the following command. + +```console +dotnet tool uninstall -g dotnet-format +``` + +### How To Build From Source + +You can build and package the tool using the following commands. The instructions assume that you are in the root of the repository. + +```console +cd src +cd Tools +cd dotnet-format +dotnet pack -c release -o nupkg /p:SemanticVersioningV1=false +# The final line from the build will read something like +# Successfully created package '..\roslyn\src\Tools\dotnet-code-format\nupkg\dotnet-format.3.0.0-dev.nupkg'. +# Use the value that is in the form `3.0.0-dev` as the version in the next command. +dotnet tool install --add-source .\nupkg -g dotnet-format --version +dotnet format +``` + +> Note: On macOS and Linux, `.\nupkg` will need be switched to `./nupkg` to accomodate for the different slash directions. diff --git a/eng/Versions.props b/eng/Versions.props index 04b66403caaf..7b4fca1dce14 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,21 @@ - 1.0.0 + 3.0.0 prerelease + + + + 0.1.0-alpha-63729-01 + 0.1.0-alpha-63729-01 + 2.1.1 + 2.1.1 + 1.1.20180503.2 + 9.0.1 + 3.0.0-beta3-final + + diff --git a/format.sln b/format.sln new file mode 100644 index 000000000000..887b15880aca --- /dev/null +++ b/format.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-format", "src\dotnet-format.csproj", "{7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x64.ActiveCfg = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x64.Build.0 = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x86.ActiveCfg = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x86.Build.0 = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|Any CPU.Build.0 = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x64.ActiveCfg = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x64.Build.0 = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x86.ActiveCfg = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs new file mode 100644 index 000000000000..7a2781ec5a0a --- /dev/null +++ b/src/CodeFormatter.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeStyle; +using Microsoft.CodeAnalysis.Formatting; +using Microsoft.CodeAnalysis.MSBuild; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Text; +using Microsoft.Extensions.Logging; +using Microsoft.VisualStudio.CodingConventions; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.Tools.CodeFormatter +{ + internal static class CodeFormatter + { + private const int MaxLoggedWorkspaceWarnings = 5; + + public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, CancellationToken cancellationToken) + { + logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, solutionOrProjectPath)); + + logger.LogTrace(Resources.Loading_workspace); + + var loggedWarningCount = 0; + var exitCode = 1; + var workspaceStopwatch = Stopwatch.StartNew(); + + var properties = new Dictionary(StringComparer.Ordinal) + { + // This property ensures that XAML files will be compiled in the current AppDomain + // rather than a separate one. Any tasks isolated in AppDomains or tasks that create + // AppDomains will likely not work due to https://github.com/Microsoft/MSBuildLocator/issues/16. + { "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, + }; + + var codingConventionsManager = CodingConventionsManagerFactory.CreateCodingConventionsManager(); + + using (var workspace = MSBuildWorkspace.Create(properties)) + { + workspace.WorkspaceFailed += LogWorkspaceWarnings; + + var projectPath = string.Empty; + if (isSolution) + { + await workspace.OpenSolutionAsync(solutionOrProjectPath, cancellationToken: cancellationToken).ConfigureAwait(false); + } + else + { + await workspace.OpenProjectAsync(solutionOrProjectPath, cancellationToken: cancellationToken).ConfigureAwait(false); + projectPath = solutionOrProjectPath; + } + + logger.LogTrace(Resources.Workspace_loaded_in_0_ms, workspaceStopwatch.ElapsedMilliseconds); + workspaceStopwatch.Restart(); + + int fileCount; + int filesFormatted; + (exitCode, fileCount, filesFormatted) = await FormatFilesInWorkspaceAsync(logger, workspace, projectPath, codingConventionsManager, saveFormattedFiles, cancellationToken).ConfigureAwait(false); + + logger.LogDebug(Resources.Formatted_0_of_1_files_in_2_ms, filesFormatted, fileCount, workspaceStopwatch.ElapsedMilliseconds); + } + + logger.LogInformation(Resources.Format_complete); + + return exitCode; + + void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) + { + if (args.Diagnostic.Kind == WorkspaceDiagnosticKind.Failure) + { + return; + } + + logger.LogWarning(args.Diagnostic.Message); + + if (!logAllWorkspaceWarnings) + { + loggedWarningCount++; + + if (loggedWarningCount == MaxLoggedWorkspaceWarnings) + { + logger.LogWarning(Resources.Maximum_number_of_workspace_warnings_to_log_has_been_reached_Set_the_verbosity_option_to_the_diagnostic_level_to_see_all_warnings); + ((MSBuildWorkspace)sender).WorkspaceFailed -= LogWorkspaceWarnings; + } + } + } + } + + private static async Task<(int status, int fileCount, int filesFormatted)> FormatFilesInWorkspaceAsync(ILogger logger, Workspace workspace, string projectPath, ICodingConventionsManager codingConventionsManager, bool saveFormattedFiles, CancellationToken cancellationToken) + { + var projectIds = workspace.CurrentSolution.ProjectIds.ToImmutableArray(); + var optionsApplier = new EditorConfigOptionsApplier(); + + var totalFileCount = 0; + var totalFilesFormatted = 0; + foreach (var projectId in projectIds) + { + var project = workspace.CurrentSolution.GetProject(projectId); + if (!string.IsNullOrEmpty(projectPath) && !project.FilePath.Equals(projectPath, StringComparison.OrdinalIgnoreCase)) + { + logger.LogDebug(Resources.Skipping_referenced_project_0, project.Name); + continue; + } + + if (project.Language != LanguageNames.CSharp && project.Language != LanguageNames.VisualBasic) + { + logger.LogWarning(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, project.FilePath); + continue; + } + + logger.LogInformation(Resources.Formatting_code_files_in_project_0, project.Name); + + var (formattedSolution, filesFormatted) = await FormatFilesInProjectAsync(logger, project, codingConventionsManager, optionsApplier, cancellationToken).ConfigureAwait(false); + totalFileCount += project.DocumentIds.Count; + totalFilesFormatted += filesFormatted; + if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution)) + { + logger.LogError(Resources.Failed_to_save_formatting_changes); + return (1, totalFileCount, totalFilesFormatted); + } + } + + return (0, totalFileCount, totalFilesFormatted); + } + + private static async Task<(Solution solution, int filesFormatted)> FormatFilesInProjectAsync(ILogger logger, Project project, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, CancellationToken cancellationToken) + { + var isCommentTrivia = project.Language == LanguageNames.CSharp + ? IsCSharpCommentTrivia + : IsVisualBasicCommentTrivia; + + var formattedDocuments = new List<(DocumentId documentId, Task formatTask)>(); + foreach (var documentId in project.DocumentIds) + { + var document = project.Solution.GetDocument(documentId); + if (!document.SupportsSyntaxTree) + { + continue; + } + + var formatTask = Task.Run(async () => + { + var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + if (GeneratedCodeUtilities.IsGeneratedCode(syntaxTree, isCommentTrivia, cancellationToken)) + { + return null; + } + + logger.LogTrace(Resources.Formatting_code_file_0, Path.GetFileName(document.FilePath)); + + OptionSet documentOptions = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); + + var codingConventionsContext = await codingConventionsManager.GetConventionContextAsync(document.FilePath, cancellationToken).ConfigureAwait(false); + if (codingConventionsContext?.CurrentConventions != null) + { + documentOptions = optionsApplier.ApplyConventions(documentOptions, codingConventionsContext.CurrentConventions, project.Language); + } + + var formattedDocument = await Formatter.FormatAsync(document, documentOptions, cancellationToken).ConfigureAwait(false); + var formattedSourceText = await formattedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + if (formattedSourceText.ContentEquals(await document.GetTextAsync(cancellationToken).ConfigureAwait(false))) + { + // Avoid touching files that didn't actually change + return null; + } + + return formattedSourceText; + }, cancellationToken); + + formattedDocuments.Add((documentId, formatTask)); + } + + var formattedSolution = project.Solution; + var filesFormatted = 0; + foreach (var (documentId, formatTask) in formattedDocuments) + { + var text = await formatTask.ConfigureAwait(false); + if (text is null) + { + continue; + } + + filesFormatted++; + formattedSolution = formattedSolution.WithDocumentText(documentId, text); + } + + return (formattedSolution, filesFormatted); + } + + private static Func IsCSharpCommentTrivia = + (syntaxTrivia) => syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineCommentTrivia) + || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineCommentTrivia) + || syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineDocumentationCommentTrivia) + || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineDocumentationCommentTrivia); + + private static Func IsVisualBasicCommentTrivia = + (syntaxTrivia) => syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia) + || syntaxTrivia.IsKind(VisualBasic.SyntaxKind.DocumentationCommentTrivia); + } +} diff --git a/src/EditorConfigOptionsApplier.cs b/src/EditorConfigOptionsApplier.cs new file mode 100644 index 000000000000..3cb53aba512e --- /dev/null +++ b/src/EditorConfigOptionsApplier.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; +using Microsoft.CodeAnalysis.Options; +using Microsoft.VisualStudio.CodingConventions; + +namespace Microsoft.CodeAnalysis.CodeStyle +{ + internal class EditorConfigOptionsApplier + { + private readonly ImmutableArray<(IOption, OptionStorageLocation, MethodInfo)> _formattingOptionsWithStorage; + + public EditorConfigOptionsApplier() + { + var commonOptionsType = typeof(Formatting.FormattingOptions); + var csharpOptionsType = typeof(CSharp.Formatting.CSharpFormattingOptions); + _formattingOptionsWithStorage = GetOptionsWithStorageFromTypes(new[] { commonOptionsType, csharpOptionsType }); + } + + public OptionSet ApplyConventions(OptionSet optionSet, ICodingConventionsSnapshot codingConventions, string languageName) + { + foreach (var optionWithStorage in _formattingOptionsWithStorage) + { + if (TryGetConventionValue(optionWithStorage, codingConventions, out var value)) + { + var option = optionWithStorage.Item1; + var optionKey = new OptionKey(option, option.IsPerLanguage ? languageName : null); + optionSet = optionSet.WithChangedOption(optionKey, value); + } + } + + return optionSet; + } + + private OptionSet ApplyConventionsForOptions(OptionSet optionSet, IEnumerable<(IOption, OptionStorageLocation, MethodInfo)> optionsWithStorage, ICodingConventionsSnapshot codingConventions, string languageName) + { + foreach (var optionWithStorage in optionsWithStorage) + { + if (TryGetConventionValue(optionWithStorage, codingConventions, out var value)) + { + var option = optionWithStorage.Item1; + var optionKey = new OptionKey(option, option.IsPerLanguage ? languageName : null); + optionSet = optionSet.WithChangedOption(optionKey, value); + } + } + + return optionSet; + } + + internal ImmutableArray<(IOption, OptionStorageLocation, MethodInfo)> GetOptionsWithStorageFromTypes(params Type[] formattingOptionTypes) + { + var optionType = typeof(IOption); + return formattingOptionTypes + .SelectMany(t => t.GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty)) + .Where(p => optionType.IsAssignableFrom(p.PropertyType)) + .Select(p => (IOption)p.GetValue(null)) + .Select(GetOptionWithStorage) + .Where(ows => ows.Item2 != null) + .ToImmutableArray(); + } + + internal (IOption, OptionStorageLocation, MethodInfo) GetOptionWithStorage(IOption option) + { + var editorConfigStorage = !option.StorageLocations.IsDefaultOrEmpty + ? option.StorageLocations.FirstOrDefault(IsEditorConfigStorage) + : null; + var tryGetOptionMethod = editorConfigStorage?.GetType().GetMethod("TryGetOption"); + return (option, editorConfigStorage, tryGetOptionMethod); + } + + internal static bool IsEditorConfigStorage(OptionStorageLocation storageLocation) + { + return storageLocation.GetType().FullName.StartsWith("Microsoft.CodeAnalysis.Options.EditorConfigStorageLocation"); + } + + internal static bool TryGetConventionValue((IOption, OptionStorageLocation, MethodInfo) optionWithStorage, ICodingConventionsSnapshot codingConventions, out object value) + { + var (option, editorConfigStorage, tryGetOptionMethod) = optionWithStorage; + + value = null; + var args = new object[] { option, codingConventions.AllRawConventions, option.Type, value }; + + var isOptionPresent = (bool)tryGetOptionMethod.Invoke(editorConfigStorage, args); + value = args[3]; + + return isOptionPresent; + } + } +} diff --git a/src/Logging/SimpleConsoleLogger.cs b/src/Logging/SimpleConsoleLogger.cs new file mode 100644 index 000000000000..8d02952d9c11 --- /dev/null +++ b/src/Logging/SimpleConsoleLogger.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.CommandLine; +using System.CommandLine.Rendering; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions.Internal; + +namespace Microsoft.CodeAnalysis.Tools.Logging +{ + internal class SimpleConsoleLogger : ILogger + { + private readonly ITerminal _terminal; + private readonly LogLevel _logLevel; + + private static readonly ImmutableDictionary _logLevelColorMap = new Dictionary + { + [LogLevel.Critical] = ConsoleColor.Red, + [LogLevel.Error] = ConsoleColor.Red, + [LogLevel.Warning] = ConsoleColor.Yellow, + [LogLevel.Information] = ConsoleColor.White, + [LogLevel.Debug] = ConsoleColor.Gray, + [LogLevel.Trace] = ConsoleColor.Gray, + [LogLevel.None] = ConsoleColor.White, + }.ToImmutableDictionary(); + + public SimpleConsoleLogger(IConsole console, LogLevel logLevel) + { + _terminal = console.GetTerminal(); + _logLevel = logLevel; + } + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + { + if (!IsEnabled(logLevel)) + { + return; + } + + var messageColor = _logLevelColorMap[logLevel]; + _terminal.ForegroundColor = messageColor; + + var message = formatter(state, exception); + _terminal.Out.WriteLine($" {message}"); + + _terminal.ResetColor(); + } + + public bool IsEnabled(LogLevel logLevel) + { + return (int)logLevel >= (int)_logLevel; + } + + public IDisposable BeginScope(TState state) + { + return NullScope.Instance; + } + } +} diff --git a/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs new file mode 100644 index 000000000000..01392935b4e0 --- /dev/null +++ b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Extensions.Logging; +using System.CommandLine; + +namespace Microsoft.CodeAnalysis.Tools.Logging +{ + internal static class SimpleConsoleLoggerFactoryExtensions + { + public static ILoggerFactory AddSimpleConsole(this ILoggerFactory factory, IConsole console, LogLevel logLevel) + { + factory.AddProvider(new SimpleConsoleLoggerProvider(console, logLevel)); + return factory; + } + } +} diff --git a/src/Logging/SimpleConsoleLoggerProvider.cs b/src/Logging/SimpleConsoleLoggerProvider.cs new file mode 100644 index 000000000000..577cd5c2b29f --- /dev/null +++ b/src/Logging/SimpleConsoleLoggerProvider.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.Extensions.Logging; +using System.CommandLine; + +namespace Microsoft.CodeAnalysis.Tools.Logging +{ + internal class SimpleConsoleLoggerProvider : ILoggerProvider + { + private readonly IConsole _console; + private readonly LogLevel _logLevel; + + public SimpleConsoleLoggerProvider(IConsole console, LogLevel logLevel) + { + _console = console; + _logLevel = logLevel; + } + + public ILogger CreateLogger(string name) + { + return new SimpleConsoleLogger(_console, _logLevel); + } + + public void Dispose() + { + } + } +} diff --git a/src/MSBuild/MSBuildCoreLoader.cs b/src/MSBuild/MSBuildCoreLoader.cs new file mode 100644 index 000000000000..8324aaa9bf95 --- /dev/null +++ b/src/MSBuild/MSBuildCoreLoader.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +// Original License: +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// See https://github.com/Microsoft/MSBuildLocator/blob/6631a6dbf9be72b2426e260c99dc0f345e79b8e5/src/MSBuildLocator/MSBuildLocator.cs + +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace Microsoft.CodeAnalysis.Tools.MSBuild +{ + // TODO: This is a stopgap solution for locating the .NET Core sdk instance of MSBuild. + // MSBuildLocator has an open PR to add .NET Core support and we should transition once + // it has been accepted and released. + // See https://github.com/Microsoft/MSBuildLocator/pull/33 + internal static class MSBuildCoreLoader + { + private const string MSBuildPublicKeyToken = "b03f5f7f11d50a3a"; + + private static readonly string[] s_msBuildAssemblies = + { + "Microsoft.Build", + "Microsoft.Build.Framework", + "Microsoft.Build.Tasks.Core", + "Microsoft.Build.Utilities.Core" + }; + + /// + /// Loads the MSBuild assemblies from the DotNet CLI sdk path. + /// + public static void LoadDotnetInstance(string workingDirectory) + { + // Workaround for https://github.com/Microsoft/msbuild/issues/3352 + LoadMSBuildAssemblies(MSBuildEnvironment.GetDotnetBasePath(workingDirectory)); + } + + /// + /// Load MSBuild assemblies. + /// + /// + /// Path to the directory containing a deployment of MSBuild binaries. + /// + public static void LoadMSBuildAssemblies(string msbuildPath) + { + var loadedMSBuildAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(IsMSBuildAssembly); + if (loadedMSBuildAssemblies.Any()) + { + var loadedAssemblyList = string.Join(Environment.NewLine, loadedMSBuildAssemblies.Select(a => a.GetName())); + + var error = $"{typeof(MSBuildCoreLoader)}.{nameof(LoadMSBuildAssemblies)} was called, but MSBuild assemblies were already loaded." + Environment.NewLine + + $"Ensure that {nameof(LoadDotnetInstance)} is called before any method that directly references types in the Microsoft.Build namespace has been called." + + Environment.NewLine + "Loaded MSBuild assemblies: " + loadedAssemblyList; + + throw new InvalidOperationException(error); + } + + foreach (var msBuildAssembly in s_msBuildAssemblies) + { + var targetAssembly = Path.Combine(msbuildPath, msBuildAssembly + ".dll"); + Assembly.LoadFrom(targetAssembly); + } + } + + private static bool IsMSBuildAssembly(Assembly assembly) + { + return IsMSBuildAssembly(assembly.GetName()); + } + + private static bool IsMSBuildAssembly(AssemblyName assemblyName) + { + if (!s_msBuildAssemblies.Contains(assemblyName.Name, StringComparer.OrdinalIgnoreCase)) + { + return false; + } + + var publicKeyToken = assemblyName.GetPublicKeyToken(); + if (publicKeyToken == null || publicKeyToken.Length == 0) + { + return false; + } + + var sb = new StringBuilder(capacity: MSBuildPublicKeyToken.Length); + foreach (var b in publicKeyToken) + { + sb.Append($"{b:x2}"); + } + + return sb.ToString().Equals(MSBuildPublicKeyToken, StringComparison.OrdinalIgnoreCase); + } + } +} diff --git a/src/MSBuild/MSBuildEnvironment.cs b/src/MSBuild/MSBuildEnvironment.cs new file mode 100644 index 000000000000..f1418e688bcd --- /dev/null +++ b/src/MSBuild/MSBuildEnvironment.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +// Original License: +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// See https://github.com/dotnet/docfx/blob/d4b1e3015d7c527057193974042ba657da96656c/src/Microsoft.DocAsCode.Metadata.ManagedReference/MsBuildEnvironmentScope.cs + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Text.RegularExpressions; +using RunTests; + +namespace Microsoft.CodeAnalysis.Tools.MSBuild +{ + internal class MSBuildEnvironment + { + private static readonly Regex DotnetBasePathRegex = new Regex("Base Path:(.*)$", RegexOptions.Compiled | RegexOptions.Multiline); + + /// + /// Ensures the proper MSBuild environment variables are populated. + /// + public static void ApplyEnvironmentVariables(string workingDirectory) + { + var environment = GetEnvironmentVariables(workingDirectory); + foreach (var kvp in environment) + { + Environment.SetEnvironmentVariable(kvp.Key, kvp.Value); + } + } + + private static ImmutableDictionary GetEnvironmentVariables(string workingDirectory) + { + // workaround for https://github.com/dotnet/docfx/issues/1752 + var dotnetBasePath = GetDotnetBasePath(workingDirectory); + if (dotnetBasePath != null) + { + return new Dictionary + { + ["MSBUILD_EXE_PATH"] = dotnetBasePath + "MSBuild.dll", + ["MSBuildExtensionsPath"] = dotnetBasePath, + ["MSBuildSDKsPath"] = dotnetBasePath + "Sdks" + }.ToImmutableDictionary(); + } + + return ImmutableDictionary.Empty; + } + + public static string GetDotnetBasePath(string workingDirectory) + { + // Ensure we get output in the locale that we require for parsing. + var environmentVariables = new Dictionary + { + ["DOTNET_CLI_UI_LANGUAGE"] = "en-US" + }; + + var processResult = ProcessRunner.CreateProcess( + "dotnet", "--info", lowPriority: false, workingDirectory, captureOutput: true, + displayWindow: false, environmentVariables).Result.Result; + + if (processResult.ExitCode != 0) + { + // when error running dotnet command, consider dotnet as not available + return null; + } + + var outputString = string.Join(Environment.NewLine, processResult.OutputLines); + var matched = DotnetBasePathRegex.Match(outputString); + + if (!matched.Success) + { + return null; + } + + return matched.Groups[1].Value.Trim(); + } + } +} diff --git a/src/MSBuild/MSBuildWorkspaceFinder.cs b/src/MSBuild/MSBuildWorkspaceFinder.cs new file mode 100644 index 000000000000..af85367253e9 --- /dev/null +++ b/src/MSBuild/MSBuildWorkspaceFinder.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +// Original License: +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// See https://github.com/aspnet/DotNetTools/blob/261b27b70027871143540af10a5cba57ce07ff97/src/dotnet-watch/Internal/MsBuildProjectFinder.cs + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.CodeAnalysis.Tools.CodeFormatter; + +namespace Microsoft.CodeAnalysis.Tools.MSBuild +{ + internal class MSBuildWorkspaceFinder + { + // Used to exclude dnx projects + private const string s_dnxProjectExtension = ".xproj"; + + /// + /// Finds a compatible MSBuild project or solution. + /// The base directory to search + /// A specific project or solution file to find + /// + public static (bool isSolution, string workspacePath) FindWorkspace(string searchDirectory, string workspacePath = null) + { + if (!string.IsNullOrEmpty(workspacePath)) + { + if (!Path.IsPathRooted(workspacePath)) + { + workspacePath = Path.GetFullPath(workspacePath, searchDirectory); + } + + return Directory.Exists(workspacePath) + ? FindWorkspace(workspacePath) + : FindFile(workspacePath); + } + + var foundSolution = FindMatchingFile(searchDirectory, FindSolutionFiles, Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option); + var foundProject = FindMatchingFile(searchDirectory, FindProjectFiles, Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option); + + if (!string.IsNullOrEmpty(foundSolution) && !string.IsNullOrEmpty(foundProject)) + { + throw new FileNotFoundException(string.Format(Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, searchDirectory)); + } + else if (string.IsNullOrEmpty(foundSolution) && string.IsNullOrEmpty(foundProject)) + { + throw new FileNotFoundException(string.Format(Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option, searchDirectory)); + } + + return !string.IsNullOrEmpty(foundSolution) + ? (true, foundSolution) + : (false, foundProject); + } + + private static (bool isSolution, string workspacePath) FindFile(string workspacePath) + { + var workspaceExtension = Path.GetExtension(workspacePath); + var isSolution = workspaceExtension.Equals(".sln", StringComparison.OrdinalIgnoreCase); + var isProject = !isSolution + && workspaceExtension.EndsWith("proj", StringComparison.OrdinalIgnoreCase) + && !workspaceExtension.Equals(s_dnxProjectExtension, StringComparison.OrdinalIgnoreCase); + + if (!isSolution && !isProject) + { + throw new FileNotFoundException(string.Format(Resources.The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file, Path.GetFileName(workspacePath))); + } + + if (!File.Exists(workspacePath)) + { + var message = isSolution + ? Resources.The_solution_file_0_does_not_exist + : Resources.The_project_file_0_does_not_exist; + throw new FileNotFoundException(string.Format(message, workspacePath)); + } + + return (isSolution, workspacePath); + } + + private static IEnumerable FindSolutionFiles(string basePath) => Directory.EnumerateFileSystemEntries(basePath, "*.sln", SearchOption.TopDirectoryOnly); + + private static IEnumerable FindProjectFiles(string basePath) => Directory.EnumerateFileSystemEntries(basePath, "*.*proj", SearchOption.TopDirectoryOnly) + .Where(f => !s_dnxProjectExtension.Equals(Path.GetExtension(f), StringComparison.OrdinalIgnoreCase)); + + private static string FindMatchingFile(string searchBase, Func> fileSelector, string multipleFilesFoundError) + { + if (!Directory.Exists(searchBase)) + { + return null; + } + + var files = fileSelector(searchBase).ToList(); + if (files.Count > 1) + { + throw new FileNotFoundException(string.Format(multipleFilesFoundError, searchBase)); + } + + return files.Count == 1 + ? files[0] + : null; + } + } +} diff --git a/src/Program.cs b/src/Program.cs new file mode 100644 index 000000000000..1ffbcf53e787 --- /dev/null +++ b/src/Program.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.CommandLine; +using System.CommandLine.Builder; +using System.CommandLine.Invocation; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Logging; +using Microsoft.CodeAnalysis.Tools.MSBuild; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace Microsoft.CodeAnalysis.Tools.CodeFormatter +{ + internal class Program + { + private static readonly string[] _verbosityLevels = new[] { "q", "quiet", "m", "minimal", "n", "normal", "d", "detailed", "diag", "diagnostic" }; + + private static async Task Main(string[] args) + { + var parser = new CommandLineBuilder(new Command("dotnet-format", handler: CommandHandler.Create(typeof(Program).GetMethod(nameof(Run))))) + .UseParseDirective() + .UseHelp() + .UseDebugDirective() + .UseSuggestDirective() + .RegisterWithDotnetSuggest() + .UseParseErrorReporting() + .UseExceptionHandler() + .AddOption(new Option(new[] { "-w", "--workspace" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one, new Argument(() => null))) + .AddOption(new Option(new[] { "-v", "--verbosity" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) + .AddOption(new Option(new[] { "--dry-run" }, Resources.Format_files_but_do_not_save_changes_to_disk, new Argument())) + .UseVersionOption() + .Build(); + + return await parser.InvokeAsync(args).ConfigureAwait(false); + } + + public static async Task Run(string workspace, string verbosity, bool dryRun, IConsole console = null) + { + var serviceCollection = new ServiceCollection(); + var logLevel = GetLogLevel(verbosity); + ConfigureServices(serviceCollection, console, logLevel); + + var serviceProvider = serviceCollection.BuildServiceProvider(); + var logger = serviceProvider.GetService>(); + + var cancellationTokenSource = new CancellationTokenSource(); + Console.CancelKeyPress += (sender, e) => + { + e.Cancel = true; + cancellationTokenSource.Cancel(); + }; + + try + { + var workingDirectory = Directory.GetCurrentDirectory(); + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(workingDirectory, workspace); + + // To ensure we get the version of MSBuild packaged with the dotnet SDK used by the + // workspace, use its directory as our working directory which will take into account + // a global.json if present. + var workspaceDirectory = Path.GetDirectoryName(workspacePath); + MSBuildEnvironment.ApplyEnvironmentVariables(workspaceDirectory); + MSBuildCoreLoader.LoadDotnetInstance(workspaceDirectory); + + return await CodeFormatter.FormatWorkspaceAsync( + logger, + workspacePath, + isSolution, + logAllWorkspaceWarnings: logLevel == LogLevel.Trace, + saveFormattedFiles: !dryRun, + cancellationTokenSource.Token).ConfigureAwait(false); + } + catch (FileNotFoundException fex) + { + logger.LogError(fex.Message); + return 1; + } + catch (OperationCanceledException) + { + return 1; + } + } + + private static LogLevel GetLogLevel(string verbosity) + { + switch (verbosity) + { + case "q": + case "quiet": + return LogLevel.Error; + case "m": + case "minimal": + return LogLevel.Warning; + case "n": + case "normal": + return LogLevel.Information; + case "d": + case "detailed": + return LogLevel.Debug; + case "diag": + case "diagnostic": + return LogLevel.Trace; + default: + return LogLevel.Information; + } + } + + private static void ConfigureServices(ServiceCollection serviceCollection, IConsole console, LogLevel logLevel) + { + serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, logLevel)); + serviceCollection.AddLogging(); + } + } +} diff --git a/src/Resources.Designer.cs b/src/Resources.Designer.cs new file mode 100644 index 000000000000..f59940e00e2a --- /dev/null +++ b/src/Resources.Designer.cs @@ -0,0 +1,269 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.CodeAnalysis.Tools.CodeFormatter { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.Tools.CodeFormatter.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option.. + /// + internal static string Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option { + get { + return ResourceManager.GetString("Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_wit" + + "h_the_workspace_option", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option.. + /// + internal static string Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option { + get { + return ResourceManager.GetString("Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_" + + "the_workspace_option", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not format '{0}'. Format currently supports only C# and Visual Basic projects.. + /// + internal static string Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects { + get { + return ResourceManager.GetString("Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_project" + + "s", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to save formatting changes.. + /// + internal static string Failed_to_save_formatting_changes { + get { + return ResourceManager.GetString("Failed_to_save_formatting_changes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Format complete.. + /// + internal static string Format_complete { + get { + return ResourceManager.GetString("Format_complete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Format files, but do not save changes to disk.. + /// + internal static string Format_files_but_do_not_save_changes_to_disk { + get { + return ResourceManager.GetString("Format_files_but_do_not_save_changes_to_disk", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Formatted {0} of {1} files in {2}ms.. + /// + internal static string Formatted_0_of_1_files_in_2_ms { + get { + return ResourceManager.GetString("Formatted_0_of_1_files_in_2_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Formatting code file '{0}'.. + /// + internal static string Formatting_code_file_0 { + get { + return ResourceManager.GetString("Formatting_code_file_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Formatting code files in project '{0}'.. + /// + internal static string Formatting_code_files_in_project_0 { + get { + return ResourceManager.GetString("Formatting_code_files_in_project_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Formatting code files in workspace '{0}'.. + /// + internal static string Formatting_code_files_in_workspace_0 { + get { + return ResourceManager.GetString("Formatting_code_files_in_workspace_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Loading workspace.. + /// + internal static string Loading_workspace { + get { + return ResourceManager.GetString("Loading_workspace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings.. + /// + internal static string Maximum_number_of_workspace_warnings_to_log_has_been_reached_Set_the_verbosity_option_to_the_diagnostic_level_to_see_all_warnings { + get { + return ResourceManager.GetString("Maximum_number_of_workspace_warnings_to_log_has_been_reached_Set_the_verbosity_op" + + "tion_to_the_diagnostic_level_to_see_all_warnings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option.. + /// + internal static string Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option { + get { + return ResourceManager.GetString("Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace" + + "_option", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option.. + /// + internal static string Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option { + get { + return ResourceManager.GetString("Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspac" + + "e_option", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. + /// + internal static string Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic { + get { + return ResourceManager.GetString("Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diag" + + "nostic", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Skipping referenced project '{0}'.. + /// + internal static string Skipping_referenced_project_0 { + get { + return ResourceManager.GetString("Skipping_referenced_project_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The file '{0}' does not appear to be a valid project or solution file.. + /// + internal static string The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file { + get { + return ResourceManager.GetString("The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The project file '{0}' does not exist.. + /// + internal static string The_project_file_0_does_not_exist { + get { + return ResourceManager.GetString("The_project_file_0_does_not_exist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The solution file '{0}' does not exist.. + /// + internal static string The_solution_file_0_does_not_exist { + get { + return ResourceManager.GetString("The_solution_file_0_does_not_exist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The solution or project file to operate on. If a file is not specified, the command will search the current directory for one.. + /// + internal static string The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one { + get { + return ResourceManager.GetString("The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command" + + "_will_search_the_current_directory_for_one", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to load workspace.. + /// + internal static string Unable_to_load_workspace { + get { + return ResourceManager.GetString("Unable_to_load_workspace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Workspace loaded in {0}ms.. + /// + internal static string Workspace_loaded_in_0_ms { + get { + return ResourceManager.GetString("Workspace_loaded_in_0_ms", resourceCulture); + } + } + } +} diff --git a/src/Resources.resx b/src/Resources.resx new file mode 100644 index 000000000000..8ecb26d9dc3c --- /dev/null +++ b/src/Resources.resx @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The project file '{0}' does not exist. + + + The solution file '{0}' does not exist. + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + + Failed to save formatting changes. + + + The file '{0}' does not appear to be a valid project or solution file. + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + + Format complete. + + + Formatting code file '{0}'. + + + Formatting code files in project '{0}'. + + + Formatting code files in workspace '{0}'. + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + + + Formatted {0} of {1} files in {2}ms. + + + Loading workspace. + + + Skipping referenced project '{0}'. + + + Unable to load workspace. + + + Workspace loaded in {0}ms. + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + Format files, but do not save changes to disk. + + \ No newline at end of file diff --git a/src/Utilities/FileNameUtilities.cs b/src/Utilities/FileNameUtilities.cs new file mode 100644 index 000000000000..9d1a838f0604 --- /dev/null +++ b/src/Utilities/FileNameUtilities.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Roslyn.Utilities +{ + /// + /// Implements a few file name utilities that are needed by the compiler. + /// In general the compiler is not supposed to understand the format of the paths. + /// In rare cases it needs to check if a string is a valid file name or change the extension + /// (embedded resources, netmodules, output name). + /// The APIs are intentionally limited to cover just these rare cases. Do not add more APIs. + /// + internal static class FileNameUtilities + { + private const string DirectorySeparatorStr = "\\"; + internal const char DirectorySeparatorChar = '\\'; + internal const char AltDirectorySeparatorChar = '/'; + internal const char VolumeSeparatorChar = ':'; + + /// + /// Returns true if the string represents an unqualified file name. + /// The name may contain any characters but directory and volume separators. + /// + /// Path. + /// + /// True if is a simple file name, false if it is null or includes a directory specification. + /// + internal static bool IsFileName(string path) + { + return IndexOfFileName(path) == 0; + } + + /// + /// Returns the offset in where the dot that starts an extension is, or -1 if the path doesn't have an extension. + /// + /// + /// Returns 0 for path ".goo". + /// Returns -1 for path "goo.". + /// + private static int IndexOfExtension(string path) + { + if (path == null) + { + return -1; + } + + int length = path.Length; + int i = length; + + while (--i >= 0) + { + char c = path[i]; + if (c == '.') + { + if (i != length - 1) + { + return i; + } + + return -1; + } + + if (c == DirectorySeparatorChar || c == AltDirectorySeparatorChar || c == VolumeSeparatorChar) + { + break; + } + } + + return -1; + } + + /// + /// Returns an extension of the specified path string. + /// + /// + /// The same functionality as but doesn't throw an exception + /// if there are invalid characters in the path. + /// + internal static string GetExtension(string path) + { + if (path == null) + { + return null; + } + + int index = IndexOfExtension(path); + return (index >= 0) ? path.Substring(index) : string.Empty; + } + + /// + /// Removes extension from path. + /// + /// + /// Returns "goo" for path "goo.". + /// Returns "goo.." for path "goo...". + /// + private static string RemoveExtension(string path) + { + if (path == null) + { + return null; + } + + int index = IndexOfExtension(path); + if (index >= 0) + { + return path.Substring(0, index); + } + + // trim last ".", if present + if (path.Length > 0 && path[path.Length - 1] == '.') + { + return path.Substring(0, path.Length - 1); + } + + return path; + } + + /// + /// Returns path with the extension changed to . + /// + /// + /// Equivalent of + /// + /// If is null, returns null. + /// If path does not end with an extension, the new extension is appended to the path. + /// If extension is null, equivalent to . + /// + internal static string ChangeExtension(string path, string extension) + { + if (path == null) + { + return null; + } + + var pathWithoutExtension = RemoveExtension(path); + if (extension == null || path.Length == 0) + { + return pathWithoutExtension; + } + + if (extension.Length == 0 || extension[0] != '.') + { + return pathWithoutExtension + "." + extension; + } + + return pathWithoutExtension + extension; + } + + /// + /// Returns the position in given path where the file name starts. + /// + /// -1 if path is null. + internal static int IndexOfFileName(string path) + { + if (path == null) + { + return -1; + } + + for (int i = path.Length - 1; i >= 0; i--) + { + char ch = path[i]; + if (ch == DirectorySeparatorChar || ch == AltDirectorySeparatorChar || ch == VolumeSeparatorChar) + { + return i + 1; + } + } + + return 0; + } + + /// + /// Get file name from path. + /// + /// Unlike doesn't check for invalid path characters. + internal static string GetFileName(string path, bool includeExtension = true) + { + int fileNameStart = IndexOfFileName(path); + var fileName = (fileNameStart <= 0) ? path : path.Substring(fileNameStart); + return includeExtension ? fileName : RemoveExtension(fileName); + } + } +} diff --git a/src/Utilities/GeneratedCodeUtilities.cs b/src/Utilities/GeneratedCodeUtilities.cs new file mode 100644 index 000000000000..59dd11ef3c9d --- /dev/null +++ b/src/Utilities/GeneratedCodeUtilities.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using Microsoft.CodeAnalysis; + +namespace Roslyn.Utilities +{ + internal static class GeneratedCodeUtilities + { + private static readonly string[] s_autoGeneratedStrings = new[] { " 1) + { + return false; + } + + foreach (var attribute in symbol.GetAttributes()) + { + if (generatedCodeAttribute.Equals(attribute.AttributeClass)) + { + return true; + } + } + } + + return symbol.ContainingSymbol != null && IsGeneratedSymbolWithGeneratedCodeAttribute(symbol.ContainingSymbol, generatedCodeAttribute); + } + + internal static bool IsGeneratedCode( + SyntaxTree tree, Func isComment, CancellationToken cancellationToken) + { + return IsGeneratedCodeFile(tree.FilePath) || + BeginsWithAutoGeneratedComment(tree, isComment, cancellationToken); + } + + private static bool IsGeneratedCodeFile(string filePath) + { + if (!string.IsNullOrEmpty(filePath)) + { + var fileName = PathUtilities.GetFileName(filePath); + if (fileName.StartsWith("TemporaryGeneratedFile_", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + var extension = PathUtilities.GetExtension(fileName); + if (!string.IsNullOrEmpty(extension)) + { + var fileNameWithoutExtension = PathUtilities.GetFileName(filePath, includeExtension: false); + if (fileNameWithoutExtension.EndsWith(".designer", StringComparison.OrdinalIgnoreCase) || + fileNameWithoutExtension.EndsWith(".generated", StringComparison.OrdinalIgnoreCase) || + fileNameWithoutExtension.EndsWith(".g", StringComparison.OrdinalIgnoreCase) || + fileNameWithoutExtension.EndsWith(".g.i", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + } + + return false; + } + + private static bool BeginsWithAutoGeneratedComment( + SyntaxTree tree, Func isComment, CancellationToken cancellationToken) + { + var root = tree.GetRoot(cancellationToken); + if (root.HasLeadingTrivia) + { + var leadingTrivia = root.GetLeadingTrivia(); + + foreach (var trivia in leadingTrivia) + { + if (!isComment(trivia)) + { + continue; + } + + var text = trivia.ToString(); + + // Check to see if the text of the comment contains an auto generated comment. + foreach (var autoGenerated in s_autoGeneratedStrings) + { + if (text.Contains(autoGenerated)) + { + return true; + } + } + } + } + + return false; + } + } +} diff --git a/src/Utilities/Hash.cs b/src/Utilities/Hash.cs new file mode 100644 index 000000000000..b63ee80ad703 --- /dev/null +++ b/src/Utilities/Hash.cs @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using Microsoft.CodeAnalysis; + +namespace Roslyn.Utilities +{ + internal static class Hash + { + /// + /// This is how VB Anonymous Types combine hash values for fields. + /// + internal static int Combine(int newKey, int currentKey) + { + return unchecked((currentKey * (int)0xA5555529) + newKey); + } + + internal static int Combine(bool newKeyPart, int currentKey) + { + return Combine(currentKey, newKeyPart ? 1 : 0); + } + + /// + /// This is how VB Anonymous Types combine hash values for fields. + /// PERF: Do not use with enum types because that involves multiple + /// unnecessary boxing operations. Unfortunately, we can't constrain + /// T to "non-enum", so we'll use a more restrictive constraint. + /// + internal static int Combine(T newKeyPart, int currentKey) where T : class + { + int hash = unchecked(currentKey * (int)0xA5555529); + + if (newKeyPart != null) + { + return unchecked(hash + newKeyPart.GetHashCode()); + } + + return hash; + } + + internal static int CombineValues(IEnumerable values, int maxItemsToHash = int.MaxValue) + { + if (values == null) + { + return 0; + } + + var hashCode = 0; + var count = 0; + foreach (var value in values) + { + if (count++ >= maxItemsToHash) + { + break; + } + + // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). + if (value != null) + { + hashCode = Hash.Combine(value.GetHashCode(), hashCode); + } + } + + return hashCode; + } + + internal static int CombineValues(T[] values, int maxItemsToHash = int.MaxValue) + { + if (values == null) + { + return 0; + } + + var maxSize = Math.Min(maxItemsToHash, values.Length); + var hashCode = 0; + + for (int i = 0; i < maxSize; i++) + { + T value = values[i]; + + // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). + if (value != null) + { + hashCode = Hash.Combine(value.GetHashCode(), hashCode); + } + } + + return hashCode; + } + + internal static int CombineValues(ImmutableArray values, int maxItemsToHash = int.MaxValue) + { + if (values.IsDefaultOrEmpty) + { + return 0; + } + + var hashCode = 0; + var count = 0; + foreach (var value in values) + { + if (count++ >= maxItemsToHash) + { + break; + } + + // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). + if (value != null) + { + hashCode = Hash.Combine(value.GetHashCode(), hashCode); + } + } + + return hashCode; + } + + internal static int CombineValues(IEnumerable values, StringComparer stringComparer, int maxItemsToHash = int.MaxValue) + { + if (values == null) + { + return 0; + } + + var hashCode = 0; + var count = 0; + foreach (var value in values) + { + if (count++ >= maxItemsToHash) + { + break; + } + + if (value != null) + { + hashCode = Hash.Combine(stringComparer.GetHashCode(value), hashCode); + } + } + + return hashCode; + } + + /// + /// The offset bias value used in the FNV-1a algorithm + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + internal const int FnvOffsetBias = unchecked((int)2166136261); + + /// + /// The generative factor used in the FNV-1a algorithm + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + internal const int FnvPrime = 16777619; + + /// + /// Compute the FNV-1a hash of a sequence of bytes + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The sequence of bytes + /// The FNV-1a hash of + internal static int GetFNVHashCode(byte[] data) + { + int hashCode = Hash.FnvOffsetBias; + + for (int i = 0; i < data.Length; i++) + { + hashCode = unchecked((hashCode ^ data[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the FNV-1a hash of a sequence of bytes and determines if the byte + /// sequence is valid ASCII and hence the hash code matches a char sequence + /// encoding the same text. + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The sequence of bytes that are likely to be ASCII text. + /// True if the sequence contains only characters in the ASCII range. + /// The FNV-1a hash of + internal static int GetFNVHashCode(ReadOnlySpan data, out bool isAscii) + { + int hashCode = Hash.FnvOffsetBias; + + byte asciiMask = 0; + + for (int i = 0; i < data.Length; i++) + { + byte b = data[i]; + asciiMask |= b; + hashCode = unchecked((hashCode ^ b) * Hash.FnvPrime); + } + + isAscii = (asciiMask & 0x80) == 0; + return hashCode; + } + + /// + /// Compute the FNV-1a hash of a sequence of bytes + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The sequence of bytes + /// The FNV-1a hash of + internal static int GetFNVHashCode(ImmutableArray data) + { + int hashCode = Hash.FnvOffsetBias; + + for (int i = 0; i < data.Length; i++) + { + hashCode = unchecked((hashCode ^ data[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the hashcode of a sub-string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// Note: FNV-1a was developed and tuned for 8-bit sequences. We're using it here + /// for 16-bit Unicode chars on the understanding that the majority of chars will + /// fit into 8-bits and, therefore, the algorithm will retain its desirable traits + /// for generating hash codes. + /// + /// The input string + /// The start index of the first character to hash + /// The number of characters, beginning with to hash + /// The FNV-1a hash code of the substring beginning at and ending after characters. + internal static int GetFNVHashCode(string text, int start, int length) + { + int hashCode = Hash.FnvOffsetBias; + int end = start + length; + + for (int i = start; i < end; i++) + { + hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + internal static int GetCaseInsensitiveFNVHashCode(string text) + { + return GetCaseInsensitiveFNVHashCode(text, 0, text.Length); + } + + internal static int GetCaseInsensitiveFNVHashCode(string text, int start, int length) + { + int hashCode = Hash.FnvOffsetBias; + int end = start + length; + + for (int i = start; i < end; i++) + { + hashCode = unchecked((hashCode ^ CaseInsensitiveComparison.ToLower(text[i])) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the hashcode of a sub-string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The input string + /// The start index of the first character to hash + /// The FNV-1a hash code of the substring beginning at and ending at the end of the string. + internal static int GetFNVHashCode(string text, int start) + { + return GetFNVHashCode(text, start, length: text.Length - start); + } + + /// + /// Compute the hashcode of a string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The input string + /// The FNV-1a hash code of + internal static int GetFNVHashCode(string text) + { + return CombineFNVHash(Hash.FnvOffsetBias, text); + } + + /// + /// Compute the hashcode of a string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The input string + /// The FNV-1a hash code of + internal static int GetFNVHashCode(System.Text.StringBuilder text) + { + int hashCode = Hash.FnvOffsetBias; + int end = text.Length; + + for (int i = 0; i < end; i++) + { + hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the hashcode of a sub string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The input string as a char array + /// The start index of the first character to hash + /// The number of characters, beginning with to hash + /// The FNV-1a hash code of the substring beginning at and ending after characters. + internal static int GetFNVHashCode(char[] text, int start, int length) + { + int hashCode = Hash.FnvOffsetBias; + int end = start + length; + + for (int i = start; i < end; i++) + { + hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the hashcode of a single character using the FNV-1a algorithm + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// Note: In general, this isn't any more useful than "char.GetHashCode". However, + /// it may be needed if you need to generate the same hash code as a string or + /// substring with just a single character. + /// + /// The character to hash + /// The FNV-1a hash code of the character. + internal static int GetFNVHashCode(char ch) + { + return Hash.CombineFNVHash(Hash.FnvOffsetBias, ch); + } + + /// + /// Combine a string with an existing FNV-1a hash code + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The accumulated hash code + /// The string to combine + /// The result of combining with using the FNV-1a algorithm + internal static int CombineFNVHash(int hashCode, string text) + { + foreach (char ch in text) + { + hashCode = unchecked((hashCode ^ ch) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Combine a char with an existing FNV-1a hash code + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The accumulated hash code + /// The new character to combine + /// The result of combining with using the FNV-1a algorithm + internal static int CombineFNVHash(int hashCode, char ch) + { + return unchecked((hashCode ^ ch) * Hash.FnvPrime); + } + } +} diff --git a/src/Utilities/PathKind.cs b/src/Utilities/PathKind.cs new file mode 100644 index 000000000000..0d2156b0f5b3 --- /dev/null +++ b/src/Utilities/PathKind.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Roslyn.Utilities +{ + internal enum PathKind + { + /// + /// Null or empty. + /// + Empty, + + /// + /// "file" + /// + Relative, + + /// + /// ".\file" + /// + RelativeToCurrentDirectory, + + /// + /// "..\file" + /// + RelativeToCurrentParent, + + /// + /// "\dir\file" + /// + RelativeToCurrentRoot, + + /// + /// "C:dir\file" + /// + RelativeToDriveDirectory, + + /// + /// "C:\file" or "\\machine" (UNC). + /// + Absolute, + } +} diff --git a/src/Utilities/PathUtilities.cs b/src/Utilities/PathUtilities.cs new file mode 100644 index 000000000000..753136ef3d3a --- /dev/null +++ b/src/Utilities/PathUtilities.cs @@ -0,0 +1,749 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.IO; +using System.Linq; + +namespace Roslyn.Utilities +{ + // Contains path parsing utilities. + // We need our own because System.IO.Path is insufficient for our purposes + // For example we need to be able to work with invalid paths or paths containing wildcards + internal static class PathUtilities + { + // We consider '/' a directory separator on Unix like systems. + // On Windows both / and \ are equally accepted. + internal static readonly char DirectorySeparatorChar = PlatformInformation.IsUnix ? '/' : '\\'; + internal const char AltDirectorySeparatorChar = '/'; + internal const string ParentRelativeDirectory = ".."; + internal const string ThisDirectory = "."; + internal static readonly string DirectorySeparatorStr = new string(DirectorySeparatorChar, 1); + internal const char VolumeSeparatorChar = ':'; + internal static bool IsUnixLikePlatform => PlatformInformation.IsUnix; + + /// + /// True if the character is the platform directory separator character or the alternate directory separator. + /// + public static bool IsDirectorySeparator(char c) => c == DirectorySeparatorChar || c == AltDirectorySeparatorChar; + + /// + /// True if the character is any recognized directory separator character. + /// + public static bool IsAnyDirectorySeparator(char c) => c == '\\' || c == '/'; + + /// + /// Removes trailing directory separator characters + /// + /// + /// This will trim the root directory separator: + /// "C:\" maps to "C:", and "/" maps to "" + /// + public static string TrimTrailingSeparators(string s) + { + int lastSeparator = s.Length; + while (lastSeparator > 0 && IsDirectorySeparator(s[lastSeparator - 1])) + { + lastSeparator = lastSeparator - 1; + } + + if (lastSeparator != s.Length) + { + s = s.Substring(0, lastSeparator); + } + + return s; + } + + /// + /// Ensures a trailing directory separator character + /// + public static string EnsureTrailingSeparator(string s) + { + if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) + { + return s; + } + + // Use the existing slashes in the path, if they're consistent + bool hasSlash = s.IndexOf('/') >= 0; + bool hasBackslash = s.IndexOf('\\') >= 0; + if (hasSlash && !hasBackslash) + { + return s + '/'; + } + else if (!hasSlash && hasBackslash) + { + return s + '\\'; + } + else + { + // If there are no slashes or they are inconsistent, use the current platform's slash. + return s + DirectorySeparatorChar; + } + } + + public static string GetExtension(string path) + { + return FileNameUtilities.GetExtension(path); + } + + public static string ChangeExtension(string path, string extension) + { + return FileNameUtilities.ChangeExtension(path, extension); + } + + public static string RemoveExtension(string path) + { + return FileNameUtilities.ChangeExtension(path, extension: null); + } + + public static string GetFileName(string path, bool includeExtension = true) + { + return FileNameUtilities.GetFileName(path, includeExtension); + } + + /// + /// Get directory name from path. + /// + /// + /// Unlike it doesn't check for invalid path characters + /// + /// Prefix of path that represents a directory + public static string GetDirectoryName(string path) + { + return GetDirectoryName(path, IsUnixLikePlatform); + } + + // Exposed for testing purposes only. + internal static string GetDirectoryName(string path, bool isUnixLike) + { + if (path != null) + { + var rootLength = GetPathRoot(path, isUnixLike).Length; + if (path.Length > rootLength) + { + var i = path.Length; + while (i > rootLength) + { + i--; + if (IsDirectorySeparator(path[i])) + { + if (i > 0 && IsDirectorySeparator(path[i - 1])) + { + continue; + } + + break; + } + } + + return path.Substring(0, i); + } + } + + return null; + } + + internal static bool IsSameDirectoryOrChildOf(string child, string parent) + { + parent = RemoveTrailingDirectorySeparator(parent); + + while (child != null) + { + child = RemoveTrailingDirectorySeparator(child); + + if (child.Equals(parent, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + child = GetDirectoryName(child); + } + + return false; + } + + /// + /// Gets the root part of the path. + /// + public static string GetPathRoot(string path) + { + return GetPathRoot(path, IsUnixLikePlatform); + } + + private static string GetPathRoot(string path, bool isUnixLike) + { + if (path == null) + { + return null; + } + + if (isUnixLike) + { + return GetUnixRoot(path); + } + else + { + return GetWindowsRoot(path); + } + } + + private static string GetWindowsRoot(string path) + { + // Windows + int length = path.Length; + if (length >= 1 && IsDirectorySeparator(path[0])) + { + if (length < 2 || !IsDirectorySeparator(path[1])) + { + // It was of the form: + // \ + // \f + // in this case, just return \ as the root. + return path.Substring(0, 1); + } + + // First consume all directory separators. + int i = 2; + i = ConsumeDirectorySeparators(path, length, i); + + // We've got \\ so far. If we have a path of the form \\x\y\z + // then we want to return "\\x\y" as the root portion. + bool hitSeparator = false; + while (true) + { + if (i == length) + { + // We reached the end of the path. The entire path is + // considered the root. + return path; + } + + if (!IsDirectorySeparator(path[i])) + { + // We got a non separator character. Just keep consuming. + i++; + continue; + } + + if (!hitSeparator) + { + // This is the first separator group we've hit after some server path. + // Consume them and keep going. + hitSeparator = true; + i = ConsumeDirectorySeparators(path, length, i); + continue; + } + + // We hit the second separator. The root is the path up to this point. + return path.Substring(0, i); + } + } + else if (length >= 2 && path[1] == VolumeSeparatorChar) + { + // handles c: and c:\ + return length >= 3 && IsDirectorySeparator(path[2]) + ? path.Substring(0, 3) + : path.Substring(0, 2); + } + else + { + // No path root. + return ""; + } + } + + private static int ConsumeDirectorySeparators(string path, int length, int i) + { + while (i < length && IsDirectorySeparator(path[i])) + { + i++; + } + + return i; + } + + private static string GetUnixRoot(string path) + { + // either it starts with "/" and thus has "/" as the root. Or it has no root. + return path.Length > 0 && IsDirectorySeparator(path[0]) + ? path.Substring(0, 1) + : ""; + } + + /// + /// Gets the specific kind of relative or absolute path. + /// + public static PathKind GetPathKind(string path) + { + if (string.IsNullOrWhiteSpace(path)) + { + return PathKind.Empty; + } + + // "C:\" + // "\\machine" (UNC) + // "/etc" (Unix) + if (IsAbsolute(path)) + { + return PathKind.Absolute; + } + + // "." + // ".." + // ".\" + // "..\" + if (path.Length > 0 && path[0] == '.') + { + if (path.Length == 1 || IsDirectorySeparator(path[1])) + { + return PathKind.RelativeToCurrentDirectory; + } + + if (path[1] == '.') + { + if (path.Length == 2 || IsDirectorySeparator(path[2])) + { + return PathKind.RelativeToCurrentParent; + } + } + } + + if (!IsUnixLikePlatform) + { + // "\" + // "\goo" + if (path.Length >= 1 && IsDirectorySeparator(path[0])) + { + return PathKind.RelativeToCurrentRoot; + } + + // "C:goo" + + if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) + { + return PathKind.RelativeToDriveDirectory; + } + } + + // "goo.dll" + return PathKind.Relative; + } + + /// + /// True if the path is an absolute path (rooted to drive or network share) + /// + public static bool IsAbsolute(string path) + { + if (string.IsNullOrEmpty(path)) + { + return false; + } + + if (IsUnixLikePlatform) + { + return path[0] == DirectorySeparatorChar; + } + + // "C:\" + if (IsDriveRootedAbsolutePath(path)) + { + // Including invalid paths (e.g. "*:\") + return true; + } + + // "\\machine\share" + // Including invalid/incomplete UNC paths (e.g. "\\goo") + return path.Length >= 2 && + IsDirectorySeparator(path[0]) && + IsDirectorySeparator(path[1]); + } + + /// + /// Returns true if given path is absolute and starts with a drive specification ("C:\"). + /// + private static bool IsDriveRootedAbsolutePath(string path) + { + Debug.Assert(!IsUnixLikePlatform); + return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); + } + + /// + /// Combines an absolute path with a relative. + /// + /// Absolute root path. + /// Relative path. + /// + /// An absolute combined path, or null if is + /// absolute (e.g. "C:\abc", "\\machine\share\abc"), + /// relative to the current root (e.g. "\abc"), + /// or relative to a drive directory (e.g. "C:abc\def"). + /// + /// + public static string CombineAbsoluteAndRelativePaths(string root, string relativePath) + { + Debug.Assert(IsAbsolute(root)); + + return CombinePossiblyRelativeAndRelativePaths(root, relativePath); + } + + /// + /// Combine two paths, the first of which may be absolute. + /// + /// First path: absolute, relative, or null. + /// Second path: relative and non-null. + /// null, if is null; a combined path, otherwise. + /// + public static string CombinePossiblyRelativeAndRelativePaths(string rootOpt, string relativePath) + { + if (string.IsNullOrEmpty(rootOpt)) + { + return null; + } + + switch (GetPathKind(relativePath)) + { + case PathKind.Empty: + return rootOpt; + + case PathKind.Absolute: + case PathKind.RelativeToCurrentRoot: + case PathKind.RelativeToDriveDirectory: + return null; + } + + return CombinePathsUnchecked(rootOpt, relativePath); + } + + public static string CombinePathsUnchecked(string root, string relativePath) + { + Debug.Assert(!string.IsNullOrEmpty(root)); + + char c = root[root.Length - 1]; + if (!IsDirectorySeparator(c) && c != VolumeSeparatorChar) + { + return root + DirectorySeparatorStr + relativePath; + } + + return root + relativePath; + } + + private static string RemoveTrailingDirectorySeparator(string path) + { + if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) + { + return path.Substring(0, path.Length - 1); + } + else + { + return path; + } + } + + /// + /// Determines whether an assembly reference is considered an assembly file path or an assembly name. + /// used, for example, on values of /r and #r. + /// + public static bool IsFilePath(string assemblyDisplayNameOrPath) + { + Debug.Assert(assemblyDisplayNameOrPath != null); + + string extension = FileNameUtilities.GetExtension(assemblyDisplayNameOrPath); + return string.Equals(extension, ".dll", StringComparison.OrdinalIgnoreCase) + || string.Equals(extension, ".exe", StringComparison.OrdinalIgnoreCase) + || assemblyDisplayNameOrPath.IndexOf(DirectorySeparatorChar) != -1 + || assemblyDisplayNameOrPath.IndexOf(AltDirectorySeparatorChar) != -1; + } + + /// + /// Determines if "path" contains 'component' within itself. + /// i.e. asking if the path "c:\goo\bar\baz" has component "bar" would return 'true'. + /// On the other hand, if you had "c:\goo\bar1\baz" then it would not have "bar" as a + /// component. + /// + /// A path contains a component if any file name or directory name in the path + /// matches 'component'. As such, if you had something like "\\goo" then that would + /// not have "goo" as a component. That's because here "goo" is the server name portion + /// of the UNC path, and not an actual directory or file name. + /// + public static bool ContainsPathComponent(string path, string component, bool ignoreCase) + { + var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; + if (path?.IndexOf(component, comparison) >= 0) + { + var comparer = ignoreCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; + + int count = 0; + var currentPath = path; + while (currentPath != null) + { + var currentName = GetFileName(currentPath); + if (comparer.Equals(currentName, component)) + { + return true; + } + + currentPath = GetDirectoryName(currentPath); + count++; + } + } + + return false; + } + + /// + /// Gets a path relative to a directory. + /// + public static string GetRelativePath(string directory, string fullPath) + { + string relativePath = string.Empty; + + if (IsChildPath(directory, fullPath)) + { + return GetRelativeChildPath(directory, fullPath); + } + + var directoryPathParts = GetPathParts(directory); + var fullPathParts = GetPathParts(fullPath); + + if (directoryPathParts.Length == 0 || fullPathParts.Length == 0) + { + return fullPath; + } + + int index = 0; + + // find index where full path diverges from base path + for (; index < directoryPathParts.Length; index++) + { + if (!PathsEqual(directoryPathParts[index], fullPathParts[index])) + { + break; + } + } + + // if the first part doesn't match, they don't even have the same volume + // so there can be no relative path. + if (index == 0) + { + return fullPath; + } + + // add backup notation for remaining base path levels beyond the index + var remainingParts = directoryPathParts.Length - index; + if (remainingParts > 0) + { + for (int i = 0; i < remainingParts; i++) + { + relativePath = relativePath + ParentRelativeDirectory + DirectorySeparatorStr; + } + } + + // add the rest of the full path parts + for (int i = index; i < fullPathParts.Length; i++) + { + relativePath = CombinePathsUnchecked(relativePath, fullPathParts[i]); + } + + return relativePath; + } + + /// + /// True if the child path is a child of the parent path. + /// + public static bool IsChildPath(string parentPath, string childPath) + { + return parentPath.Length > 0 + && childPath.Length > parentPath.Length + && PathsEqual(childPath, parentPath, parentPath.Length) + && (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); + } + + private static string GetRelativeChildPath(string parentPath, string childPath) + { + var relativePath = childPath.Substring(parentPath.Length); + + // trim any leading separators left over after removing leading directory + int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); + if (start > 0) + { + relativePath = relativePath.Substring(start); + } + + return relativePath; + } + + private static readonly char[] s_pathChars = new char[] { VolumeSeparatorChar, DirectorySeparatorChar, AltDirectorySeparatorChar }; + + private static string[] GetPathParts(string path) + { + var pathParts = path.Split(s_pathChars); + + // remove references to self directories ('.') + if (pathParts.Contains(ThisDirectory)) + { + pathParts = pathParts.Where(s => s != ThisDirectory).ToArray(); + } + + return pathParts; + } + + /// + /// True if the two paths are the same. + /// + public static bool PathsEqual(string path1, string path2) + { + return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); + } + + /// + /// True if the two paths are the same. (but only up to the specified length) + /// + private static bool PathsEqual(string path1, string path2, int length) + { + if (path1.Length < length || path2.Length < length) + { + return false; + } + + for (int i = 0; i < length; i++) + { + if (!PathCharEqual(path1[i], path2[i])) + { + return false; + } + } + + return true; + } + + private static bool PathCharEqual(char x, char y) + { + if (IsDirectorySeparator(x) && IsDirectorySeparator(y)) + { + return true; + } + + return IsUnixLikePlatform + ? x == y + : char.ToUpperInvariant(x) == char.ToUpperInvariant(y); + } + + private static int PathHashCode(string path) + { + int hc = 0; + + if (path != null) + { + foreach (var ch in path) + { + if (!IsDirectorySeparator(ch)) + { + hc = Hash.Combine((int)char.ToUpperInvariant(ch), hc); + } + } + } + + return hc; + } + + public static string NormalizePathPrefix(string filePath, ImmutableArray> pathMap) + { + if (pathMap.IsDefaultOrEmpty) + { + return filePath; + } + + // find the first key in the path map that matches a prefix of the normalized path. + // Note that we expect the client to use consistent capitalization; we use ordinal (case-sensitive) comparisons. + foreach (var kv in pathMap) + { + var oldPrefix = kv.Key; + if (!(oldPrefix?.Length > 0)) continue; + + // oldPrefix always ends with a path separator, so there's no need to check if it was a partial match + // e.g. for the map /goo=/bar and filename /goooo + if (filePath.StartsWith(oldPrefix, StringComparison.Ordinal)) + { + var replacementPrefix = kv.Value; + + // Replace that prefix. + var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); + + // Normalize the path separators if used uniformly in the replacement + bool hasSlash = replacementPrefix.IndexOf('/') >= 0; + bool hasBackslash = replacementPrefix.IndexOf('\\') >= 0; + return + (hasSlash && !hasBackslash) ? replacement.Replace('\\', '/') : + (hasBackslash && !hasSlash) ? replacement.Replace('/', '\\') : + replacement; + } + } + + return filePath; + } + + /// + /// Unfortunately, we cannot depend on Path.GetInvalidPathChars() or Path.GetInvalidFileNameChars() + /// From MSDN: The array returned from this method is not guaranteed to contain the complete set of characters + /// that are invalid in file and directory names. The full set of invalid characters can vary by file system. + /// https://msdn.microsoft.com/en-us/library/system.io.path.getinvalidfilenamechars.aspx + /// + /// Additionally, Path.GetInvalidPathChars() doesn't include "?" or "*" which are invalid characters, + /// and Path.GetInvalidFileNameChars() includes ":" and "\" which are valid characters. + /// + /// The more accurate way is to let the framework parse the path and throw on any errors. + /// + public static bool IsValidFilePath(string fullPath) + { + try + { + if (string.IsNullOrEmpty(fullPath)) + { + return false; + } + + // Uncomment when this is fixed: https://github.com/dotnet/roslyn/issues/19592 + // Debug.Assert(IsAbsolute(fullPath)); + + var fileInfo = new FileInfo(fullPath); + return !string.IsNullOrEmpty(fileInfo.Name); + } + catch (Exception ex) when ( + ex is ArgumentException || // The file name is empty, contains only white spaces, or contains invalid characters. + ex is PathTooLongException || // The specified path, file name, or both exceed the system-defined maximum length. + ex is NotSupportedException) // fileName contains a colon (:) in the middle of the string. + { + return false; + } + } + + public static readonly IEqualityComparer Comparer = new PathComparer(); + + private class PathComparer : IEqualityComparer + { + public bool Equals(string x, string y) + { + if (x == null && y == null) + { + return true; + } + + if (x == null || y == null) + { + return false; + } + + return PathsEqual(x, y); + } + + public int GetHashCode(string s) + { + return PathHashCode(s); + } + } + } +} diff --git a/src/Utilities/PlatformInformation.cs b/src/Utilities/PlatformInformation.cs new file mode 100644 index 000000000000..01c804a82f7b --- /dev/null +++ b/src/Utilities/PlatformInformation.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.IO; + +namespace Roslyn.Utilities +{ + /// + /// This class provides simple properties for determining whether the current platform is Windows or Unix-based. + /// We intentionally do not use System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(...) because + /// it incorrectly reports 'true' for 'Windows' in desktop builds running on Unix-based platforms via Mono. + /// + internal static class PlatformInformation + { + public static bool IsWindows => Path.DirectorySeparatorChar == '\\'; + public static bool IsUnix => Path.DirectorySeparatorChar == '/'; + public static bool IsRunningOnMono + { + get + { + try + { + return !(Type.GetType("Mono.Runtime") is null); + } + catch + { + // Arbitrarily assume we're not running on Mono. + return false; + } + } + } + } +} diff --git a/src/Utilities/ProcessRunner.cs b/src/Utilities/ProcessRunner.cs new file mode 100644 index 000000000000..508853dddc80 --- /dev/null +++ b/src/Utilities/ProcessRunner.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace RunTests +{ + public readonly struct ProcessResult + { + public Process Process { get; } + public int ExitCode { get; } + public ReadOnlyCollection OutputLines { get; } + public ReadOnlyCollection ErrorLines { get; } + + public ProcessResult(Process process, int exitCode, ReadOnlyCollection outputLines, ReadOnlyCollection errorLines) + { + Process = process; + ExitCode = exitCode; + OutputLines = outputLines; + ErrorLines = errorLines; + } + } + + public readonly struct ProcessInfo + { + public Process Process { get; } + public ProcessStartInfo StartInfo { get; } + public Task Result { get; } + + public int Id => Process.Id; + + public ProcessInfo(Process process, ProcessStartInfo startInfo, Task result) + { + Process = process; + StartInfo = startInfo; + Result = result; + } + } + + public static class ProcessRunner + { + public static void OpenFile(string file) + { + if (File.Exists(file)) + { + Process.Start(file); + } + } + + public static ProcessInfo CreateProcess( + string executable, + string arguments, + bool lowPriority = false, + string workingDirectory = null, + bool captureOutput = false, + bool displayWindow = true, + Dictionary environmentVariables = null, + Action onProcessStartHandler = null, + CancellationToken cancellationToken = default) => + CreateProcess( + CreateProcessStartInfo(executable, arguments, workingDirectory, captureOutput, displayWindow, environmentVariables), + lowPriority: lowPriority, + onProcessStartHandler: onProcessStartHandler, + cancellationToken: cancellationToken); + + public static ProcessInfo CreateProcess( + ProcessStartInfo processStartInfo, + bool lowPriority = false, + Action onProcessStartHandler = null, + CancellationToken cancellationToken = default) + { + var errorLines = new List(); + var outputLines = new List(); + var process = new Process(); + var tcs = new TaskCompletionSource(); + + process.EnableRaisingEvents = true; + process.StartInfo = processStartInfo; + + process.OutputDataReceived += (s, e) => + { + if (e.Data != null) + { + outputLines.Add(e.Data); + } + }; + + process.ErrorDataReceived += (s, e) => + { + if (e.Data != null) + { + errorLines.Add(e.Data); + } + }; + + process.Exited += (s, e) => + { + // We must call WaitForExit to make sure we've received all OutputDataReceived/ErrorDataReceived calls + // or else we'll be returning a list we're still modifying. For paranoia, we'll start a task here rather + // than enter right back into the Process type and start a wait which isn't guaranteed to be safe. + Task.Run(() => + { + process.WaitForExit(); + var result = new ProcessResult( + process, + process.ExitCode, + new ReadOnlyCollection(outputLines), + new ReadOnlyCollection(errorLines)); + tcs.TrySetResult(result); + }); + }; + + var registration = cancellationToken.Register(() => + { + if (tcs.TrySetCanceled()) + { + // If the underlying process is still running, we should kill it + if (!process.HasExited) + { + try + { + process.Kill(); + } + catch (InvalidOperationException) + { + // Ignore, since the process is already dead + } + } + } + }); + + process.Start(); + onProcessStartHandler?.Invoke(process); + + if (lowPriority) + { + process.PriorityClass = ProcessPriorityClass.BelowNormal; + } + + if (processStartInfo.RedirectStandardOutput) + { + process.BeginOutputReadLine(); + } + + if (processStartInfo.RedirectStandardError) + { + process.BeginErrorReadLine(); + } + + return new ProcessInfo(process, processStartInfo, tcs.Task); + } + + public static ProcessStartInfo CreateProcessStartInfo( + string executable, + string arguments, + string workingDirectory = null, + bool captureOutput = false, + bool displayWindow = true, + Dictionary environmentVariables = null) + { + var processStartInfo = new ProcessStartInfo(executable, arguments); + + if (!string.IsNullOrEmpty(workingDirectory)) + { + processStartInfo.WorkingDirectory = workingDirectory; + } + + if (environmentVariables != null) + { + foreach (var pair in environmentVariables) + { + processStartInfo.EnvironmentVariables[pair.Key] = pair.Value; + } + } + + if (captureOutput) + { + processStartInfo.UseShellExecute = false; + processStartInfo.RedirectStandardOutput = true; + processStartInfo.RedirectStandardError = true; + } + else + { + processStartInfo.CreateNoWindow = !displayWindow; + processStartInfo.UseShellExecute = displayWindow; + } + + return processStartInfo; + } + } +} diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj new file mode 100644 index 000000000000..4a1de56bbd1c --- /dev/null +++ b/src/dotnet-format.csproj @@ -0,0 +1,56 @@ + + + + netcoreapp2.1 + Exe + 7.3 + Microsoft.CodeAnalysis.Tools.CodeFormatter + Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings. + + true + true + true + + win-x64;win-x86;osx-x64 + + true + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf new file mode 100644 index 000000000000..0d5b0eef70d2 --- /dev/null +++ b/src/xlf/Resources.cs.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + V adresáři {0} nešlo najít soubor projektu MSBuild nebo soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + {0} nejde formátovat. Formátovat jde v současné době jenom projekty v jazycích C# a Visual Basic. + + + + Failed to save formatting changes. + Nepodařilo se uložit změny formátování. + + + + Format complete. + Formátování se dokončilo. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + Formátuje se soubor kódu {0}. + + + + Formatting code files in project '{0}'. + Formátují se soubory kódu v projektu {0}. + + + + Formatting code files in workspace '{0}'. + Formátují se soubory kódu v pracovním prostoru {0}. + + + + Loading workspace. + Načítá se pracovní prostor. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + {0} obsahuje více souborů projektů MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Nastavte úroveň podrobností. Povolené hodnoty jsou: q[uiet], m[inimal], n[ormal], d[etailed] a diag[nostic] + + + + Skipping referenced project '{0}'. + Přeskočí se odkazovaný projekt {0}. + + + + The file '{0}' does not appear to be a valid project or solution file. + Soubor {0} zřejmě není platný soubor projektu nebo řešení. + + + + The project file '{0}' does not exist. + Soubor projektu {0} neexistuje. + + + + The solution file '{0}' does not exist. + Soubor řešení {0} neexistuje. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Soubor řešení nebo projektu, se kterým se má operace provést. Pokud soubor není zadaný, příkaz ho bude hledat v aktuálním adresáři. + + + + Unable to load workspace. + Pracovní prostor nejde načíst. + + + + Workspace loaded in {0}ms. + Pracovní prostor se načetl za {0} ms. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf new file mode 100644 index 000000000000..8ff0128c76e9 --- /dev/null +++ b/src/xlf/Resources.de.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappe gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Kein MSBuild-Projektdatei oder Projektmappendatei in "{0}" gefunden. Geben Sie die zu verwendende Datei mit der Option "--workspace" an. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + "{0}" konnte nicht formatiert werden. Derzeit wird die Formatierung nur für C#- und Visual Basic-Projekte unterstützt. + + + + Failed to save formatting changes. + Fehler beim Speichern von Formatierungsänderungen. + + + + Format complete. + Formatierung abgeschlossen. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + Codedatei "{0}" wird formatiert. + + + + Formatting code files in project '{0}'. + Codedateien im Projekt "{0}" werden formatiert. + + + + Formatting code files in workspace '{0}'. + Codedateien im Arbeitsbereich "{0}" werden formatiert. + + + + Loading workspace. + Arbeitsbereich wird geladen. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Mehrere MSBuild-Projektdateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Mehrere MSBuild Projektmappendateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Legen Sie den Ausführlichkeitsgrad fest. Zulässige Werte sind "q[uiet]", "m[inimal]", "n[ormal]", "d[etailed]" und "diag[nostic]". + + + + Skipping referenced project '{0}'. + Überspringen von referenziertem Projekt "{0}". + + + + The file '{0}' does not appear to be a valid project or solution file. + Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. + + + + The project file '{0}' does not exist. + Die Projektdatei "{0}" ist nicht vorhanden. + + + + The solution file '{0}' does not exist. + Die Projektmappendatei "{0}" ist nicht vorhanden. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Die Projektmappe oder Projektdatei, die verwendet werden soll. Wenn keine Datei angegeben ist, durchsucht der Befehl das aktuelle Verzeichnis nach einer Datei. + + + + Unable to load workspace. + Arbeitsbereich kann nicht geladen werden. + + + + Workspace loaded in {0}ms. + Arbeitsbereich in {0} ms geladen. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf new file mode 100644 index 000000000000..e0a6df5b0674 --- /dev/null +++ b/src/xlf/Resources.es.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Se encontró un archivo de proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + No se pudo encontrar un archivo de proyecto o archivo de solución MSBuild en "{0}". Especifique cuál debe utilizarse con la opción --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + No se pudo dar formato a "{0}". El formato admite solo proyectos de C# y Visual Basic en este momento. + + + + Failed to save formatting changes. + Error al guardar cambios de formato. + + + + Format complete. + Formato completo. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + Formato de archivo de código "{0}". + + + + Formatting code files in project '{0}'. + Formato de archivos de código de proyecto "{0}". + + + + Formatting code files in workspace '{0}'. + Aplicar formato a archivos de código en espacio de trabajo "{0}". + + + + Loading workspace. + Cargando área de trabajo. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Se encontraron múltiples archivos de proyecto MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Se encontraron múltiples archivos de solución MSBuild en "{0}". Especifique cuáles se deben utilizar con la opción --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Establecer el nivel de detalle. Los valores permitidos son q[uiet], m[inimal], n[ormal], d[etailed]c y diag[nostic] + + + + Skipping referenced project '{0}'. + Omitiendo projecto al que se hace referencia "{0}". + + + + The file '{0}' does not appear to be a valid project or solution file. + El archivo "{0}" no parece ser un proyecto o archivo de solución válido. + + + + The project file '{0}' does not exist. + El archivo de proyecto "{0}" no existe. + + + + The solution file '{0}' does not exist. + El archivo de solución "{0}" no existe. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + El archivo de solución o el proyecto para operar. Si no se especifica un archivo, el comando buscará uno en el directorio actual. + + + + Unable to load workspace. + No se puede cargar el espacio de trabajo. + + + + Workspace loaded in {0}ms. + Espacio de trabajo cargado en {0} ms. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf new file mode 100644 index 000000000000..73a1609afbf4 --- /dev/null +++ b/src/xlf/Resources.fr.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Un fichier projet et un fichier solution MSBuild ont été trouvés dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Fichier projet ou solution MSBuild introuvable dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Impossible de mettre en forme '{0}'. L'opération Mettre en forme prend uniquement en charge les projets C# et Visual Basic pour le moment. + + + + Failed to save formatting changes. + L'enregistrement des changements de mise en forme a échoué. + + + + Format complete. + Format complet. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + Mise en forme du fichier de code '{0}'. + + + + Formatting code files in project '{0}'. + Mise en forme des fichiers de code du projet '{0}'. + + + + Formatting code files in workspace '{0}'. + Mise en forme des fichiers de code dans l'espace de travail '{0}'. + + + + Loading workspace. + Chargement de l'espace de travail. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Plusieurs fichiers projet MSBuild dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Plusieurs fichiers solution MSBuild dans '{0}'. Spécifiez ceux à utiliser avec l'option --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Définissez le niveau de détail. Les valeurs autorisées sont q[uiet], m[inimal], n[ormal], d[etailed] et diag[nostic] + + + + Skipping referenced project '{0}'. + Saut du projet référencé '{0}'. + + + + The file '{0}' does not appear to be a valid project or solution file. + Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. + + + + The project file '{0}' does not exist. + Le fichier projet '{0}' n'existe pas. + + + + The solution file '{0}' does not exist. + Le fichier solution '{0}' n'existe pas. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Fichier solution ou projet à utiliser. Si un fichier n'est pas spécifié, la commande en recherche un dans le répertoire actuel. + + + + Unable to load workspace. + Impossible de charger l'espace de travail. + + + + Workspace loaded in {0}ms. + Espace de travail chargé en {0} ms. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf new file mode 100644 index 000000000000..86d0856c4562 --- /dev/null +++ b/src/xlf/Resources.it.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + In '{0}' non è stato possibile trovare alcun file di progetto o di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Non è stato possibile formattare '{0}'. Il formato supporta attualmente solo progetti C# e Visual Basic. + + + + Failed to save formatting changes. + Non è stato possibile salvare le modifiche di formattazione. + + + + Format complete. + Formattazione completata. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + Formattazione del file di codice '{0}'. + + + + Formatting code files in project '{0}'. + Formattazione del file di codice nel progetto '{0}'. + + + + Formatting code files in workspace '{0}'. + Formattazione del file di codice nell'area di lavoro '{0}'. + + + + Loading workspace. + Caricamento dell'area di lavoro. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + In '{0}' sono stati trovati più file di progetto MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Consente di impostare il livello di dettaglio. I valori consentiti sono q[uiet], m[inimal], n[ormal], d[etailed] e diag[nostic] + + + + Skipping referenced project '{0}'. + Il progetto di riferimento '{0}' verrà ignorato. + + + + The file '{0}' does not appear to be a valid project or solution file. + Il file '{0}' non sembra essere un file di progetto o di soluzione valido. + + + + The project file '{0}' does not exist. + Il file di progetto '{0}' non esiste. + + + + The solution file '{0}' does not exist. + Il file di soluzione '{0}' non esiste. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + File di progetto o di soluzione su cui intervenire. Se non si specifica un file, il comando ne cercherà uno nella directory corrente. + + + + Unable to load workspace. + Non è possibile caricare l'area di lavoro. + + + + Workspace loaded in {0}ms. + Area di lavoro caricata in {0} ms. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf new file mode 100644 index 000000000000..06d2026c1bea --- /dev/null +++ b/src/xlf/Resources.ja.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + MSBuild プロジェクト ファイルとソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + '{0}' で MSBuild プロジェクト ファイルまたはソリューション ファイルが見つかりませんでした。使用するファイルを --workspace オプションで指定してください。 + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + '{0}' をフォーマットできませんでした。フォーマットは、C# および Visual Basic のプロジェクトでのみサポートされています。 + + + + Failed to save formatting changes. + 書式変更を保存できませんでした。 + + + + Format complete. + フォーマットが完了しました。 + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + コード ファイル '{0}' をフォーマットしています。 + + + + Formatting code files in project '{0}'. + プロジェクト '{0}' でコード ファイルを書式設定しています。 + + + + Formatting code files in workspace '{0}'. + ワークスペース '{0}' でコード ファイルを書式設定します。 + + + + Loading workspace. + ワークスペースを読み込んでいます。 + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + 複数の MSBuild プロジェクト ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + 詳細レベルを設定します。許可されている値: q[uiet]、m[inimal]、n[ormal]、d[etailed]、diag[nostic] + + + + Skipping referenced project '{0}'. + 参照プロジェクト '{0}' をスキップしています。 + + + + The file '{0}' does not appear to be a valid project or solution file. + ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 + + + + The project file '{0}' does not exist. + プロジェクト ファイル '{0}' が存在しません。 + + + + The solution file '{0}' does not exist. + ソリューション ファイル '{0}' が存在しません。 + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 操作対象のソリューション ファイルまたはプロジェクト ファイル。ファイルを指定しない場合、コマンドは現在のディレクトリを検索します。 + + + + Unable to load workspace. + ワークスペースをロードできません。 + + + + Workspace loaded in {0}ms. + ワークスペース {0} ミリ秒で読み込まれます。 + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf new file mode 100644 index 000000000000..fc5295530d54 --- /dev/null +++ b/src/xlf/Resources.ko.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + '{0}'에서 MSBuild 프로젝트 파일 또는 솔루션 파일을 찾을 수 없습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + '{0}'의 서식을 지정할 수 없습니다. 서식 지정은 현재 C# 및 Visual Basic 프로젝트만 지원합니다. + + + + Failed to save formatting changes. + 서식 변경 내용을 저장하지 못했습니다. + + + + Format complete. + 포맷이 완료되었습니다. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + 코드 파일 '{0}'의 서식을 지정합니다. + + + + Formatting code files in project '{0}'. + '{0}' 프로젝트에서 코드 파일의 서식을 지정합니다. + + + + Formatting code files in workspace '{0}'. + '{0}' 작업 영역에서 코드 파일의 서식을 지정합니다. + + + + Loading workspace. + 작업 영역을 로드하는 중입니다. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + '{0}'에서 여러 MSBuild 프로젝트 파일을 찾았습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + 세부 정보 표시 수준을 설정합니다. 허용되는 값은 q[uiet], m[inimal], n[ormal], d[etailed] 및 diag[nostic]입니다. + + + + Skipping referenced project '{0}'. + 참조된 프로젝트 '{0}'을(를) 건너뜁니다. + + + + The file '{0}' does not appear to be a valid project or solution file. + '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. + + + + The project file '{0}' does not exist. + 프로젝트 파일 '{0}'이(가) 없습니다. + + + + The solution file '{0}' does not exist. + 솔루션 파일 '{0}'이(가) 없습니다. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 수행할 솔루션 또는 프로젝트 파일입니다. 파일을 지정하지 않으면 명령이 현재 디렉터리에서 파일을 검색합니다. + + + + Unable to load workspace. + 작업 영역을 로드할 수 없습니다. + + + + Workspace loaded in {0}ms. + 작업 영역이 {0}밀리초 안에 로드되었습니다. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf new file mode 100644 index 000000000000..716a769f7b5a --- /dev/null +++ b/src/xlf/Resources.pl.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą opcji --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Nie można znaleźć pliku rozwiązania lub projektu MSBuild w elemencie „{0}”. Określ plik do użycia za pomocą opcji --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Nie można sformatować elementu „{0}”. Obecnie format obsługuje tylko projekty C# i Visual Basic. + + + + Failed to save formatting changes. + Nie można zapisać zmian formatowania. + + + + Format complete. + Formatowanie zakończone. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + Formatowanie pliku kodu „{0}”. + + + + Formatting code files in project '{0}'. + Formatowanie plików kodu w projekcie „{0}”. + + + + Formatting code files in workspace '{0}'. + Formatowanie plików kodu w obszarze roboczym „{0}”. + + + + Loading workspace. + Ładowanie obszaru roboczego. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + W elemencie „{0}” znaleziono wiele plików projektów MSBuild. Określ, którego użyć, za pomocą opcji --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą opcji --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Ustaw poziom szczegółowości. Dozwolone wartości to q[uiet] (cicha), m[inimal] (minimalna), n[ormal] (normalna), d[etailed] (szczegółowa) i diag[nostic] (diagnostyczna) + + + + Skipping referenced project '{0}'. + Pomijanie przywoływanego projektu „{0}”. + + + + The file '{0}' does not appear to be a valid project or solution file. + Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. + + + + The project file '{0}' does not exist. + Plik projektu „{0}” nie istnieje. + + + + The solution file '{0}' does not exist. + Plik rozwiązania „{0}” nie istnieje. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Plik rozwiązania lub projektu, względem którego operacja ma być wykonana. Jeśli plik nie zostanie określony, polecenie wyszuka go w bieżącym katalogu. + + + + Unable to load workspace. + Nie można załadować obszaru roboczego. + + + + Workspace loaded in {0}ms. + Obszar roboczy załadowano w {0} ms. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf new file mode 100644 index 000000000000..22e48c927df3 --- /dev/null +++ b/src/xlf/Resources.pt-BR.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Foram encontrados um arquivo de solução e um arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Não foi possível encontrar um arquivo de solução ou arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Não foi possível formatar '{0}'. O formato atualmente suporta apenas projetos do Visual Basic e C#. + + + + Failed to save formatting changes. + Falha ao salvar alterações de formatação. + + + + Format complete. + Formato completo. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + Arquivo de código de formatação '{0}'. + + + + Formatting code files in project '{0}'. + Formatando arquivos de código no projeto '{0}'. + + + + Formatting code files in workspace '{0}'. + Formatação de arquivos de código no espaço de trabalho '{0}'. + + + + Loading workspace. + Carregando espaço de trabalho. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Foram encontrados vários arquivos do projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Foram encontrados vários arquivos de solução MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Defina o nível de detalhes. Os valores permitidos são q[uiet], m[inimal], n[ormal], d[etailed], e diag[nostic] + + + + Skipping referenced project '{0}'. + Ignorando o projeto referenciado '{0}'. + + + + The file '{0}' does not appear to be a valid project or solution file. + O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. + + + + The project file '{0}' does not exist. + O arquivo de projeto '{0}' não existe. + + + + The solution file '{0}' does not exist. + O arquivo de solução '{0}' não existe. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + O arquivo de projeto ou solução para operar. Se um arquivo não for especificado, o comando pesquisará o diretório atual para um. + + + + Unable to load workspace. + Não é possível carregar o espaço de trabalho. + + + + Workspace loaded in {0}ms. + Espaço de trabalho carregado em {0}ms. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf new file mode 100644 index 000000000000..930d9669fe48 --- /dev/null +++ b/src/xlf/Resources.ru.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью параметра --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Не удалось найти файл проекта или решения MSBuild в "{0}". Укажите используемый файл с параметром --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Не удалось отформатировать "{0}". Форматирование сейчас поддерживается только для проектов C# и Visual Basic. + + + + Failed to save formatting changes. + Не удалось сохранить изменения форматирования. + + + + Format complete. + Форматирование завершено. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + Форматирование файла кода "{0}". + + + + Formatting code files in project '{0}'. + Форматирование файлов кода в проекте "{0}". + + + + Formatting code files in workspace '{0}'. + Форматирование кода файлов в рабочей области "{0}". + + + + Loading workspace. + Загрузка рабочей области. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + В "{0}" обнаружено несколько файлов проектов MSBuild. Укажите используемый файл с помощью параметра --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + В "{0}" обнаружено несколько файлов решений MSBuild. Укажите используемый файл с параметром --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Задает уровень детализации. Допустимые значения: q (без вывода подробных сведений), m (минимальный), n (нормальный), d (подробный) и diag (диагностика) + + + + Skipping referenced project '{0}'. + Пропуск указанного проекта "{0}". + + + + The file '{0}' does not appear to be a valid project or solution file. + Файл "{0}" не является допустимым файлом проекта или решения. + + + + The project file '{0}' does not exist. + Файл проекта "{0}" не существует. + + + + The solution file '{0}' does not exist. + Файл решения "{0}" не существует. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Файл решения или проекта. Если файл не указан, команда будет искать этот файл в текущем каталоге. + + + + Unable to load workspace. + Не удается загрузить рабочую область. + + + + Workspace loaded in {0}ms. + Рабочая область загружена за {0} мс. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf new file mode 100644 index 000000000000..5f64d3108fdf --- /dev/null +++ b/src/xlf/Resources.tr.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Hem bir MSBuild proje dosyası ve çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Bir MSBuild proje dosyası veya çözüm dosyası '{0}' içinde bulunamadı. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + '{0}' biçiminde değil. Biçimi şu anda yalnızca C# ve Visual Basic projeleri desteklemektedir. + + + + Failed to save formatting changes. + Biçimlendirme değişiklikleri kaydedilemedi. + + + + Format complete. + Tam biçimlendirme. + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + Biçimlendirme kod dosyası '{0}'. + + + + Formatting code files in project '{0}'. + Proje '{0}' kod dosyalarında biçimlendirme. + + + + Formatting code files in workspace '{0}'. + Çalışma alanı '{0}' kod dosyalarında biçimlendirme. + + + + Loading workspace. + Çalışma alanı yükleniyor. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Birden fazla MSBuild proje dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Birden fazla MSBuild çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Ayrıntı düzeyini ayarlayın. İzin verilen değerler şunlardır: q [uiet], [inimal] m, n [nizamî], d [ayrıntılı] ve diag [nostic] + + + + Skipping referenced project '{0}'. + Atlama projesi '{0}' başvuru. + + + + The file '{0}' does not appear to be a valid project or solution file. + '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. + + + + The project file '{0}' does not exist. + Proje dosyası '{0}' yok. + + + + The solution file '{0}' does not exist. + Çözüm dosyası '{0}' yok. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Ameliyat için çözüm ya da proje dosyasını. Bir dosya belirtilmezse, komut için bir geçerli dizini arar. + + + + Unable to load workspace. + Çalışma alanı yüklenemedi. + + + + Workspace loaded in {0}ms. + Çalışma alanı {0} ms yüklü. + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf new file mode 100644 index 000000000000..9f6005f43efd --- /dev/null +++ b/src/xlf/Resources.zh-Hans.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要将哪一个文件用于 --workspace 选项。 + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + 无法在“{0}”中找到 MSBuild 项目文件或解决方案文件。请指定要用于 --workspace 选项的文件。 + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + 无法设置“{0}”的格式。该格式当前仅支持 C# 和 Visual Basic 项目。 + + + + Failed to save formatting changes. + 未能保存格式更改。 + + + + Format complete. + 格式设置完毕。 + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + 正在设置代码文件“{0}”的格式。 + + + + Formatting code files in project '{0}'. + 正在格式化项目“{0}”中的代码文件。 + + + + Formatting code files in workspace '{0}'. + 正在设置工作区“{0}”中代码文件的格式。 + + + + Loading workspace. + 正在加载工作区。 + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + 在“{0}”中找到多个 MSBuild 项目文件。请指定要将哪一个文件用于 --workspace 选项。 + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 --workspace 选项的文件。 + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + 设置详细级别。允许的值为 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] + + + + Skipping referenced project '{0}'. + 正在跳过引用的项目“{0}”。 + + + + The file '{0}' does not appear to be a valid project or solution file. + 文件“{0}”似乎不是有效的项目或解决方案文件。 + + + + The project file '{0}' does not exist. + 项目文件“{0}” 不存在。 + + + + The solution file '{0}' does not exist. + 解决方案文件“{0}”不存在。 + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 要操作的解决方案或项目文件。如果未指定文件,该命令将在当前目录中搜索一个文件。 + + + + Unable to load workspace. + 无法加载工作区。 + + + + Workspace loaded in {0}ms. + 工作区已在 {0} 毫秒内加载完毕。 + + + + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf new file mode 100644 index 000000000000..4bcd28ebd430 --- /dev/null +++ b/src/xlf/Resources.zh-Hant.xlf @@ -0,0 +1,117 @@ + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中同時找到 MSBuild 專案檔和解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中找不到 MSBuild 專案檔或解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + 無法將 '{0}' 格式化。格式化目前只支援 C# 和 Visual Basic 專案。 + + + + Failed to save formatting changes. + 無法儲存格式化變更。 + + + + Format complete. + 格式化已完成。 + + + + Format files, but do not save changes to disk. + Format files, but do not save changes to disk. + + + + Formatted {0} of {1} files in {2}ms. + Formatted {0} of {1} files in {2}ms. + + + + Formatting code file '{0}'. + 正在將程式碼檔案 '{0}' 格式化。 + + + + Formatting code files in project '{0}'. + 正在將專案 '{0}' 中的程式碼檔案格式化。 + + + + Formatting code files in workspace '{0}'. + 正在將工作區 '{0}' 中的程式碼檔案格式化。 + + + + Loading workspace. + 正在載入工作區。 + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中找到多個 MSBuild 專案檔。請指定要搭配 --workspace 選項使用的檔案。 + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + 設定詳細資訊層級。允許的值為 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] + + + + Skipping referenced project '{0}'. + 跳過參考的專案 '{0}’。 + + + + The file '{0}' does not appear to be a valid project or solution file. + 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 + + + + The project file '{0}' does not exist. + 專案檔 '{0}' 不存在。 + + + + The solution file '{0}' does not exist. + 解決方案檔 '{0}' 不存在。 + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 要操作的解決方案或專案檔。若未指定檔案,該命令會在目前的目錄中搜尋一個檔案。 + + + + Unable to load workspace. + 無法載入工作區。 + + + + Workspace loaded in {0}ms. + {0} 毫秒內載入的工作區。 + + + + + \ No newline at end of file From 5c30185eb35e032eb4a5cd093bbdf22e1161740c Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 16 Feb 2019 17:41:18 -0800 Subject: [PATCH 0349/2702] removing ado for now --- azure-pipelines.yml | 184 -------------------------------------------- 1 file changed, 184 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index eee704c88186..000000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,184 +0,0 @@ -variables: - - name: Build.Repository.Clean - value: true - - name: _HelixType - value: build/product - - name: _HelixSource - value: pr/dotnet/arcade-minimalci-sample/$(Build.SourceBranch) - - name: _HelixTestType - value: test/product/ - - name: _XUnitProject - value: $(Build.SourcesDirectory)/Hello.Tests/Hello.Tests.csproj - - name: _XUnitTargetFramework - value: netcoreapp2.0 - - name: _XUnitRunnerVersion - value: 2.4.1 - - name: _DotNetCliPackageType - value: sdk - - name: _DotNetCliVersion - value: 2.1.403 - - name: _HelixAccessToken - value: '' - -resources: - containers: - - container: LinuxContainer - image: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20170319080304 - -# CI and PR triggers -trigger: -- master - -pr: -- master - -jobs: -- template: /eng/common/templates/job/job.yml - parameters: - name: Windows_NT - enableTelemetry: true - enablePublishBuildArtifacts: true - helixRepo: dotnet/arcade-minimalci-sample - pool: - name: NetCorePublic-Int-Pool - queue: Windows.10.Amd64.Open - strategy: - matrix: - debug_configuration: - _BuildConfig: Debug - release_configuration: - _BuildConfig: Release - steps: - - script: eng\common\cibuild.cmd - -configuration $(_BuildConfig) - -prepareMachine - name: Build - displayName: Build - condition: succeeded() - - template: /eng/common/templates/steps/send-to-helix.yml - parameters: - HelixSource: $(_HelixSource) - HelixType: $(_HelixTestType) - HelixTargetQueues: Windows.10.Amd64.Open;Windows.81.Amd64.Open;Windows.7.Amd64.Open - XUnitProjects: $(_XUnitProject) - XUnitPublishTargetFramework: $(_XUnitTargetFramework) - XUnitRuntimeTargetFramework: $(_XUnitTargetFramework) - XUnitRunnerVersion: $(_XUnitRunnerVersion) - IncludeDotNetCli: true - DotNetCliPackageType: $(_DotNetCliPackageType) - DotNetCliVersion: $(_DotNetCliVersion) - EnableXUnitReporter: true - WaitForWorkItemCompletion: true - Creator: arcade-minimalci-sample - HelixAccessToken: $(_HelixAccessToken) - condition: eq(variables['_BuildConfig'], 'Debug') - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: $(Agent.Os)_$(Agent.JobName) - continueOnError: true - condition: always() - variables: - _HelixBuildConfig: $(_BuildConfig) - -- template: /eng/common/templates/job/job.yml - parameters: - name: OSX - enableTelemetry: true - enablePublishBuildArtifacts: true - helixRepo: dotnet/arcade-minimalci-sample - pool: - name: NetCorePublic-Int-Pool - queue: OSX.1012.Amd64.Open - strategy: - matrix: - debug_configuration: - _BuildConfig: Debug - release_configuration: - _BuildConfig: Release - steps: - - script: eng/common/cibuild.sh - --configuration $(_BuildConfig) - --prepareMachine - name: Build - displayName: Build - condition: succeeded() - - template: /eng/common/templates/steps/send-to-helix.yml - parameters: - HelixSource: $(_HelixSource) - HelixType: $(_HelixTestType) - HelixTargetQueues: OSX.1012.Amd64.Open;OSX.1013.Amd64.Open - XUnitProjects: $(_XUnitProject) - XUnitPublishTargetFramework: $(_XUnitTargetFramework) - XUnitRuntimeTargetFramework: $(_XUnitTargetFramework) - XUnitRunnerVersion: $(_XUnitRunnerVersion) - IncludeDotNetCli: true - DotNetCliPackageType: $(_DotNetCliPackageType) - DotNetCliVersion: $(_DotNetCliVersion) - EnableXUnitReporter: true - WaitForWorkItemCompletion: true - Creator: arcade-minimalci-sample - HelixAccessToken: $(_HelixAccessToken) - condition: eq(variables['_BuildConfig'], 'Debug') - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: $(Agent.Os)_$(Agent.JobName) - continueOnError: true - condition: always() - variables: - _HelixBuildConfig: $(_BuildConfig) - -- template: /eng/common/templates/job/job.yml - parameters: - name: Linux - enableTelemetry: true - enablePublishBuildArtifacts: true - helixRepo: dotnet/arcade-minimalci-sample - pool: - name: Hosted Ubuntu 1604 - container: LinuxContainer - strategy: - matrix: - debug_configuration: - _BuildConfig: Debug - release_configuration: - _BuildConfig: Release - steps: - - script: eng/common/cibuild.sh - --configuration $(_BuildConfig) - --prepareMachine - name: Build - displayName: Build - condition: succeeded() - - template: /eng/common/templates/steps/send-to-helix.yml - parameters: - HelixSource: $(_HelixSource) - HelixType: $(_HelixTestType) - HelixTargetQueues: Debian.9.Amd64.Open;Fedora.27.Amd64.Open;RedHat.7.Amd64.Open;Ubuntu.1604.Amd64.Open - XUnitProjects: $(_XUnitProject) - XUnitPublishTargetFramework: $(_XUnitTargetFramework) - XUnitRuntimeTargetFramework: $(_XUnitTargetFramework) - XUnitRunnerVersion: $(_XUnitRunnerVersion) - IncludeDotNetCli: true - DotNetCliPackageType: $(_DotNetCliPackageType) - DotNetCliVersion: $(_DotNetCliVersion) - EnableXUnitReporter: true - WaitForWorkItemCompletion: true - Creator: arcade-minimalci-sample - HelixAccessToken: $(_HelixAccessToken) - condition: eq(variables['_BuildConfig'], 'Debug') - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: $(Agent.Os)_$(Agent.JobName) - continueOnError: true - condition: always() - variables: - _HelixBuildConfig: $(_BuildConfig) From 68c848eae9fa3c3ef689293a11148fec9de79ddf Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sun, 17 Feb 2019 13:14:13 -0800 Subject: [PATCH 0350/2702] adding azure pipelines --- azure-pipelines.yml | 72 +++++++++++++++++++++++++++++++++++++++++ eng/Signing.props | 14 ++++++++ eng/Version.Details.xml | 4 --- eng/Versions.props | 14 ++++++++ 4 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 azure-pipelines.yml create mode 100644 eng/Signing.props diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000000..233b14dd7cb1 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,72 @@ +# Branches that trigger a build on commit +trigger: +- master + +# Branches that trigger builds on PR +pr: +- master + +jobs: +- job: Windows + pool: dotnet-external-temp + variables: + _os: Windows + strategy: + maxParallel: 4 + matrix: + Debug: + _configuration: Debug + Release: + _configuration: Release + timeoutInMinutes: 20 + + steps: + - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine + displayName: Build and Test + + - task: PublishTestResults@1 + inputs: + testRunner: XUnit + testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml' + mergeTestResults: true + testRunTitle: '$(_os) $(_configuration)' + condition: always() + - task: PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: '$(_os) $(_configuration)' + continueOnError: true + condition: not(succeeded()) + +- job: Linux + pool: DotNetCore-Linux + variables: + _os: Linux + strategy: + maxParallel: 4 + matrix: + Debug: + _configuration: Debug + Release: + _configuration: Release + timeoutInMinutes: 90 + steps: + - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine + displayName: Build and Test + + - task: PublishTestResults@2 + displayName: Publish xUnit Test Results + inputs: + testRunner: XUnit + testResultsFiles: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_configuration)/*.xml' + mergeTestResults: true + testRunTitle: '$(_os) $(_configuration)' + condition: always() + - task: PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_configuration)' + ArtifactName: '$(_os) $(_configuration)' + continueOnError: true + condition: not(succeeded()) \ No newline at end of file diff --git a/eng/Signing.props b/eng/Signing.props new file mode 100644 index 000000000000..e4591c3880c8 --- /dev/null +++ b/eng/Signing.props @@ -0,0 +1,14 @@ + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + + + + + \ No newline at end of file diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d8311f7c1324..d0e2aece1f82 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,5 @@ https://github.com/dotnet/arcade 44b52e6b16ba146ed2505d469953da9a1af94a42 - - https://github.com/dotnet/arcade - 44b52e6b16ba146ed2505d469953da9a1af94a42 - diff --git a/eng/Versions.props b/eng/Versions.props index 7b4fca1dce14..573bc7b6497e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -18,4 +18,18 @@ 3.0.0-beta3-final + + + $(RestoreSources); + https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json; + https://dotnet.myget.org/F/system-commandline/api/v3/index.json; + https://dotnet.myget.org/F/roslyn/api/v3/index.json; + https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json; + https://myget.org/F/vs-devcore/api/v3/index.json; + https://myget.org/F/vs-editor/api/v3/index.json; + https://vside.myget.org/F/vssdk/api/v3/index.json; + https://vside.myget.org/F/vs-impl/api/v3/index.json; + + + From 36eeedc61077a7781fa398622196a895930fbcd6 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sun, 17 Feb 2019 13:26:38 -0800 Subject: [PATCH 0351/2702] adding test project --- format.sln | 14 ++++++++++++++ src/dotnet-format.csproj | 2 +- tests/UnitTest1.cs | 14 ++++++++++++++ tests/dotnet-format.UnitTests.csproj | 12 ++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/UnitTest1.cs create mode 100644 tests/dotnet-format.UnitTests.csproj diff --git a/format.sln b/format.sln index 887b15880aca..ab8289c0cf19 100644 --- a/format.sln +++ b/format.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.26124.0 MinimumVisualStudioVersion = 15.0.26124.0 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-format", "src\dotnet-format.csproj", "{7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-format.UnitTests", "tests\dotnet-format.UnitTests.csproj", "{4F181F8B-534F-48A6-A28B-0D11F5AEFF55}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -30,5 +32,17 @@ Global {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x64.Build.0 = Release|Any CPU {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x86.ActiveCfg = Release|Any CPU {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x86.Build.0 = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x64.ActiveCfg = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x64.Build.0 = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x86.ActiveCfg = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x86.Build.0 = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|Any CPU.Build.0 = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x64.ActiveCfg = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x64.Build.0 = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x86.ActiveCfg = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 4a1de56bbd1c..cfdf0c4a5eac 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -31,7 +31,7 @@ - + diff --git a/tests/UnitTest1.cs b/tests/UnitTest1.cs new file mode 100644 index 000000000000..2b517d3cc881 --- /dev/null +++ b/tests/UnitTest1.cs @@ -0,0 +1,14 @@ +using System; +using Xunit; + +namespace tests +{ + public class UnitTest1 + { + [Fact] + public void Test1() + { + + } + } +} diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj new file mode 100644 index 000000000000..452fbc059fc7 --- /dev/null +++ b/tests/dotnet-format.UnitTests.csproj @@ -0,0 +1,12 @@ + + + + netcoreapp2.1 + false + + + + + + + From aa84b6ec6f3606f0b09f77be2627e6cbb3620191 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sun, 17 Feb 2019 13:39:35 -0800 Subject: [PATCH 0352/2702] adding official build definition --- azure-pipelines-official.yml | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 azure-pipelines-official.yml diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml new file mode 100644 index 000000000000..4d8308ece8fa --- /dev/null +++ b/azure-pipelines-official.yml @@ -0,0 +1,71 @@ +resources: +- repo: self + clean: true + +queue: + name: VSEng-MicroBuildVS2017 + demands: Cmd + +variables: + BuildConfiguration: Release + SignType: real + TeamName: Roslyn + VisualStudioDropName: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber) + +# Branches that trigger a build on commit +trigger: +- master + +steps: +- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1 + displayName: Install Signing Plugin + inputs: + signType: $(SignType) + esrpSigning: true + condition: and(succeeded(), ne(variables['SignType'], '')) + +- script: eng\common\CIBuild.cmd + -configuration $(BuildConfiguration) + /p:OfficialBuildId=$(Build.BuildNumber) + /p:VisualStudioDropName=$(VisualStudioDropName) + /p:DotNetSignType=$(SignType) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + displayName: Build + +- task: NuGetPublisher@0 + displayName: Publish NuGet Packages to MyGet + inputs: + searchPattern: 'artifacts\packages\$(BuildConfiguration)\Shipping\*.nupkg' + connectedServiceName: 'RoslynSdk - NuGet feed' + nuGetVersion: 4.0.0.2283 + condition: succeeded() + +- task: PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: 'Logs' + continueOnError: true + condition: not(succeeded()) + +- task: PublishTestResults@1 + displayName: Publish Test Results + inputs: + testRunner: XUnit + testResultsFiles: 'artifacts/TestResults/$(BuildConfiguration)/*.xml' + mergeTestResults: true + testRunTitle: 'Unit Tests' + condition: always() + +# Archive NuGet packages to DevOps. +- task: PublishBuildArtifacts@1 + displayName: Publish Artifact Packages + inputs: + PathtoPublish: 'artifacts\packages\$(BuildConfiguration)' + ArtifactName: 'Packages' + condition: succeeded() + +- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 + displayName: Cleanup + condition: always() \ No newline at end of file From 15e608f30301d29562540140ebdb2772f95a15de Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sun, 17 Feb 2019 14:00:47 -0800 Subject: [PATCH 0353/2702] updating readme --- README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 73254687436e..b9473ef6cf5c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ -dotnet-format +## dotnet-format + ============= + +|Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) +|---|:--:|:--:|:--:|:--:| +[master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master) + + `dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. ### How To Install @@ -60,15 +67,12 @@ dotnet tool uninstall -g dotnet-format You can build and package the tool using the following commands. The instructions assume that you are in the root of the repository. ```console -cd src -cd Tools -cd dotnet-format -dotnet pack -c release -o nupkg /p:SemanticVersioningV1=false +build -pack # The final line from the build will read something like -# Successfully created package '..\roslyn\src\Tools\dotnet-code-format\nupkg\dotnet-format.3.0.0-dev.nupkg'. +# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.3.0.0-dev.nupkg'. # Use the value that is in the form `3.0.0-dev` as the version in the next command. -dotnet tool install --add-source .\nupkg -g dotnet-format --version +dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version dotnet format ``` -> Note: On macOS and Linux, `.\nupkg` will need be switched to `./nupkg` to accomodate for the different slash directions. +> Note: On macOS and Linux, `.\artifacts` will need be switched to `./artifacts` to accommodate for the different slash directions. From 05deef8da0e3162811e265d6a2a1b9f54ab17847 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sun, 17 Feb 2019 14:05:40 -0800 Subject: [PATCH 0354/2702] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index b9473ef6cf5c..a26a4ab18ed2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ ## dotnet-format -============= - |Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) |---|:--:|:--:|:--:|:--:| [master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master) From 4eb2caafdef5c435c2b634f800406a29327ec255 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sun, 17 Feb 2019 14:08:22 -0800 Subject: [PATCH 0355/2702] Update azure-pipelines-official.yml --- azure-pipelines-official.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 4d8308ece8fa..1b9a57d6233f 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -37,7 +37,7 @@ steps: displayName: Publish NuGet Packages to MyGet inputs: searchPattern: 'artifacts\packages\$(BuildConfiguration)\Shipping\*.nupkg' - connectedServiceName: 'RoslynSdk - NuGet feed' + connectedServiceName: 'dotnet-format - NuGet feed' nuGetVersion: 4.0.0.2283 condition: succeeded() @@ -68,4 +68,4 @@ steps: - task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 displayName: Cleanup - condition: always() \ No newline at end of file + condition: always() From 51e83c1da311feb786f8e3a8c9edb9510aea7d9b Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sun, 17 Feb 2019 14:12:44 -0800 Subject: [PATCH 0356/2702] updating license text --- src/CodeFormatter.cs | 2 +- src/EditorConfigOptionsApplier.cs | 2 +- src/Logging/SimpleConsoleLogger.cs | 2 +- src/Logging/SimpleConsoleLoggerFactoryExtensions.cs | 2 +- src/Logging/SimpleConsoleLoggerProvider.cs | 2 +- src/MSBuild/MSBuildCoreLoader.cs | 2 +- src/MSBuild/MSBuildEnvironment.cs | 2 +- src/MSBuild/MSBuildWorkspaceFinder.cs | 2 +- src/Program.cs | 2 +- src/Utilities/FileNameUtilities.cs | 2 +- src/Utilities/GeneratedCodeUtilities.cs | 2 +- src/Utilities/Hash.cs | 2 +- src/Utilities/PathKind.cs | 2 +- src/Utilities/PathUtilities.cs | 2 +- src/Utilities/PlatformInformation.cs | 2 +- src/Utilities/ProcessRunner.cs | 2 +- src/dotnet-format.csproj | 4 ++-- tests/UnitTest1.cs | 3 ++- 18 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 7a2781ec5a0a..cbd60716947b 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Concurrent; diff --git a/src/EditorConfigOptionsApplier.cs b/src/EditorConfigOptionsApplier.cs index 3cb53aba512e..e3ee43c1025a 100644 --- a/src/EditorConfigOptionsApplier.cs +++ b/src/EditorConfigOptionsApplier.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/src/Logging/SimpleConsoleLogger.cs b/src/Logging/SimpleConsoleLogger.cs index 8d02952d9c11..987d164c4c10 100644 --- a/src/Logging/SimpleConsoleLogger.cs +++ b/src/Logging/SimpleConsoleLogger.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs index 01392935b4e0..416dac0f2379 100644 --- a/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs +++ b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using Microsoft.Extensions.Logging; using System.CommandLine; diff --git a/src/Logging/SimpleConsoleLoggerProvider.cs b/src/Logging/SimpleConsoleLoggerProvider.cs index 577cd5c2b29f..2ad0a9f0cc5f 100644 --- a/src/Logging/SimpleConsoleLoggerProvider.cs +++ b/src/Logging/SimpleConsoleLoggerProvider.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using Microsoft.Extensions.Logging; using System.CommandLine; diff --git a/src/MSBuild/MSBuildCoreLoader.cs b/src/MSBuild/MSBuildCoreLoader.cs index 8324aaa9bf95..a1a65a61a9d2 100644 --- a/src/MSBuild/MSBuildCoreLoader.cs +++ b/src/MSBuild/MSBuildCoreLoader.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. // Original License: // Copyright (c) Microsoft. All rights reserved. diff --git a/src/MSBuild/MSBuildEnvironment.cs b/src/MSBuild/MSBuildEnvironment.cs index f1418e688bcd..ed1d8ebc68be 100644 --- a/src/MSBuild/MSBuildEnvironment.cs +++ b/src/MSBuild/MSBuildEnvironment.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. // Original License: // Copyright (c) Microsoft. All rights reserved. diff --git a/src/MSBuild/MSBuildWorkspaceFinder.cs b/src/MSBuild/MSBuildWorkspaceFinder.cs index af85367253e9..6892c30c372f 100644 --- a/src/MSBuild/MSBuildWorkspaceFinder.cs +++ b/src/MSBuild/MSBuildWorkspaceFinder.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. // Original License: // Copyright (c) .NET Foundation. All rights reserved. diff --git a/src/Program.cs b/src/Program.cs index 1ffbcf53e787..440d555f1486 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.CommandLine; diff --git a/src/Utilities/FileNameUtilities.cs b/src/Utilities/FileNameUtilities.cs index 9d1a838f0604..7c9542fe1a7f 100644 --- a/src/Utilities/FileNameUtilities.cs +++ b/src/Utilities/FileNameUtilities.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. namespace Roslyn.Utilities { diff --git a/src/Utilities/GeneratedCodeUtilities.cs b/src/Utilities/GeneratedCodeUtilities.cs index 59dd11ef3c9d..28836a1b942d 100644 --- a/src/Utilities/GeneratedCodeUtilities.cs +++ b/src/Utilities/GeneratedCodeUtilities.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Diagnostics; diff --git a/src/Utilities/Hash.cs b/src/Utilities/Hash.cs index b63ee80ad703..dae60ed2385d 100644 --- a/src/Utilities/Hash.cs +++ b/src/Utilities/Hash.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/src/Utilities/PathKind.cs b/src/Utilities/PathKind.cs index 0d2156b0f5b3..65ac8da979c6 100644 --- a/src/Utilities/PathKind.cs +++ b/src/Utilities/PathKind.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. namespace Roslyn.Utilities { diff --git a/src/Utilities/PathUtilities.cs b/src/Utilities/PathUtilities.cs index 753136ef3d3a..ce06864585fe 100644 --- a/src/Utilities/PathUtilities.cs +++ b/src/Utilities/PathUtilities.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/src/Utilities/PlatformInformation.cs b/src/Utilities/PlatformInformation.cs index 01c804a82f7b..086f169f5961 100644 --- a/src/Utilities/PlatformInformation.cs +++ b/src/Utilities/PlatformInformation.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.IO; diff --git a/src/Utilities/ProcessRunner.cs b/src/Utilities/ProcessRunner.cs index 508853dddc80..d13abf997d6f 100644 --- a/src/Utilities/ProcessRunner.cs +++ b/src/Utilities/ProcessRunner.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index cfdf0c4a5eac..66171b9cf042 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.1 @@ -35,7 +35,7 @@ - + diff --git a/tests/UnitTest1.cs b/tests/UnitTest1.cs index 2b517d3cc881..c76110761fde 100644 --- a/tests/UnitTest1.cs +++ b/tests/UnitTest1.cs @@ -1,4 +1,5 @@ -using System; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + using Xunit; namespace tests From a8ec7ee1c6777c5e7fec086ef5278f8ab69c27a7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 18 Feb 2019 13:49:59 +0000 Subject: [PATCH 0357/2702] Update dependencies from https://github.com/dotnet/arcade build 20190215.1 (#5) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19115.1 --- eng/Version.Details.xml | 4 +- eng/Versions.props | 3 -- eng/common/internal/Directory.Build.targets | 3 -- eng/common/internal/Tools.csproj | 4 ++ eng/common/templates/job/job.yml | 42 +++++++------------ eng/common/templates/jobs/jobs.yml | 10 +---- .../templates/phases/publish-build-assets.yml | 13 +++--- .../templates/steps/telemetry-start.yml | 1 + eng/common/tools.ps1 | 27 ++++++++---- eng/common/tools.sh | 8 +++- global.json | 2 +- 11 files changed, 57 insertions(+), 60 deletions(-) delete mode 100644 eng/common/internal/Directory.Build.targets diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d0e2aece1f82..5d87e1223a34 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 44b52e6b16ba146ed2505d469953da9a1af94a42 + 75af3cdef5022dbb92b8a94388198a6fd59a5d94 diff --git a/eng/Versions.props b/eng/Versions.props index 573bc7b6497e..5f3079056171 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -4,7 +4,6 @@ 3.0.0 prerelease - @@ -17,7 +16,6 @@ 9.0.1 3.0.0-beta3-final - $(RestoreSources); @@ -31,5 +29,4 @@ https://vside.myget.org/F/vs-impl/api/v3/index.json; - diff --git a/eng/common/internal/Directory.Build.targets b/eng/common/internal/Directory.Build.targets deleted file mode 100644 index 5d26408a9819..000000000000 --- a/eng/common/internal/Directory.Build.targets +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index 1d2e2183766c..1a81ff906f6e 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -3,6 +3,7 @@ net472 + false @@ -16,4 +17,7 @@ https://devdiv.pkgs.visualstudio.com/_packaging/VS/nuget/v3/index.json; + + + diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 5e293db35d7e..98ca94c326cf 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -41,18 +41,11 @@ parameters: enablePublishTestResults: false # Optional: enable sending telemetry - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _HelixBuildConfig - differentiate between Debug, Release, other - # _HelixType - Example: build/product/ - # _HelixSource - Example: official/dotnet/arcade/$(Build.SourceBranch) enableTelemetry: false - # Optional: If specified, then automatically derive "_HelixSource" variable for telemetry + # Optional: define the helix repo for telemeetry (example: 'dotnet/arcade') helixRepo: '' - # Optional: Define the type for helix telemetry (must end in '/') - helixType: build/product/ - # Required: name of the job name: '' @@ -115,29 +108,20 @@ jobs: - name: ${{ pair.key }} value: ${{ pair.value }} - # Add additional variables - - ${{ if and(ne(parameters.helixRepo, ''), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notIn(variables['Build.Reason'], 'PullRequest')) }}: - - name: _HelixSource - value: official/${{ parameters.helixRepo }}/$(Build.SourceBranch) - - ${{ if and(ne(parameters.helixRepo, ''), or(ne(parameters.runAsPublic, 'false'), eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest'))) }}: - - name: _HelixSource - value: pr/${{ parameters.helixRepo }}/$(Build.SourceBranch) - - name: _HelixType - value: ${{ parameters.helixType }} - - name: _HelixBuildConfig - value: $(_BuildConfig) - ${{ if ne(parameters.workspace, '') }}: workspace: ${{ parameters.workspace }} steps: - ${{ if eq(parameters.enableTelemetry, 'true') }}: - - template: /eng/common/templates/steps/telemetry-start.yml - parameters: - buildConfig: $(_HelixBuildConfig) - helixSource: $(_HelixSource) - helixType: $(_HelixType) + # Telemetry tasks are built from https://github.com/dotnet/arcade-extensions + - task: sendStartTelemetry@0 + displayName: 'Send Helix Start Telemetry' + inputs: + helixRepo: ${{ parameters.helixRepo }} + buildConfig: $(_BuildConfig) runAsPublic: ${{ parameters.runAsPublic }} + continueOnError: ${{ parameters.continueOnError }} + condition: always() - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: @@ -165,11 +149,15 @@ jobs: TeamName: $(_TeamName) - ${{ if eq(parameters.enableTelemetry, 'true') }}: - - template: /eng/common/templates/steps/telemetry-end.yml + # Telemetry tasks are built from https://github.com/dotnet/arcade-extensions + - task: sendEndTelemetry@0 + displayName: 'Send Helix End Telemetry' + continueOnError: ${{ parameters.continueOnError }} + condition: always() - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS + displayName: Publish Logs inputs: PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' PublishLocation: Container diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index c7226b12ed28..c1a5b4849ace 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -18,21 +18,15 @@ parameters: enablePublishTestResults: false # Optional: enable sending telemetry - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _HelixBuildConfig - differentiate between Debug, Release, other - # _HelixType - Example: build/product/ - # _HelixSource - Example: official/dotnet/arcade/$(Build.SourceBranch) + # if enabled then the 'helixRepo' parameter should also be specified enableTelemetry: false # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job jobs: [] - # Optional: If specified, then automatically derive "_HelixSource" variable for telemetry + # Optional: define the helix repo for telemetry (example: 'dotnet/arcade') helixRepo: '' - # Optional: Define the type for helix telemetry (must end in '/') - helixType: build/product/ - # Optional: Override automatically derived dependsOn value for "publish build assets" job publishBuildAssetsDependsOn: '' diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml index 85fabe62b98f..211967debab5 100644 --- a/eng/common/templates/phases/publish-build-assets.yml +++ b/eng/common/templates/phases/publish-build-assets.yml @@ -28,12 +28,15 @@ phases: SecretsFilter: 'MaestroAccessToken' condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - - script: eng\common\publishbuildassets.cmd - /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com - /p:Configuration=$(_BuildConfig) + - task: PowerShell@2 displayName: Publish Build Assets + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' + /p:BuildAssetRegistryToken=$(MaestroAccessToken) + /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + /p:Configuration=$(_BuildConfig) condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - task: PublishBuildArtifacts@1 diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml index f6a521be21ed..32c01ef0b553 100644 --- a/eng/common/templates/steps/telemetry-start.yml +++ b/eng/common/templates/steps/telemetry-start.yml @@ -201,6 +201,7 @@ steps: MaxRetries: ${{ parameters.maxRetries }} RetryDelay: ${{ parameters.retryDelay }} condition: and(always(), eq(variables['Agent.Os'], 'Windows_NT')) + displayName: Send Windows Job Start Telemetry - powershell: | # Basic retry loop to harden against server flakiness $retryCount = 0 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index c0a559589fcc..fbcc4e3ba07b 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -211,7 +211,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion - } elseif ($install) { + } else { if (Get-Member -InputObject $GlobalJson.tools -Name "xcopy-msbuild") { $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' @@ -221,9 +221,10 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $xcopyMSBuildVersion = "$vsMajorVersion.$($vsMinVersion.Minor).0-alpha" } - $vsInstallDir = InstallXCopyMSBuild $xcopyMSBuildVersion - } else { - throw "Unable to find Visual Studio that has required version and components installed" + $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install + if ($vsInstallDir -eq $null) { + throw "Unable to find Visual Studio that has required version and components installed" + } } $msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" } @@ -241,12 +242,20 @@ function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [str } } -function InstallXCopyMSBuild([string] $packageVersion) { +function InstallXCopyMSBuild([string]$packageVersion) { + return InitializeXCopyMSBuild $packageVersion -install $true +} + +function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { $packageName = "RoslynTools.MSBuild" $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion" $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg" if (!(Test-Path $packageDir)) { + if (!$install) { + return $null + } + Create-Directory $packageDir Write-Host "Downloading $packageName $packageVersion" Invoke-WebRequest "https://dotnet.myget.org/F/roslyn-tools/api/v2/package/$packageName/$packageVersion/" -OutFile $packagePath @@ -408,15 +417,15 @@ function InitializeToolset() { $proj = Join-Path $ToolsetDir "restore.proj" $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "ToolsetRestore.binlog") } else { "" } - + '' | Set-Content $proj - MSBuild $proj $bl /t:__WriteToolsetLocation /noconsolelogger /p:__ToolsetLocationOutputFile=$toolsetLocationFile - + MSBuild $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile + $path = Get-Content $toolsetLocationFile -TotalCount 1 if (!(Test-Path $path)) { throw "Invalid toolset path: $path" } - + return $global:_ToolsetBuildProj = $path } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 115a56a827d7..633a8167b09a 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -238,11 +238,15 @@ function InitializeToolset { ExitWithExitCode 2 fi - local toolset_restore_log="$log_dir/ToolsetRestore.binlog" local proj="$toolset_dir/restore.proj" + local bl="" + if [[ "$binary_log" == true ]]; then + bl="/bl:$log_dir/ToolsetRestore.binlog" + fi + echo '' > "$proj" - MSBuild "$proj" /t:__WriteToolsetLocation /noconsolelogger /bl:"$toolset_restore_log" /p:__ToolsetLocationOutputFile="$toolset_location_file" + MSBuild "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file" local toolset_build_proj=`cat "$toolset_location_file"` diff --git a/global.json b/global.json index b09e90ba9eb8..a4dca0916a2c 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "dotnet": "2.1.403" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19105.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19115.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19105.2" } } From 617d45815e4102dac35cf7e971ad1e38084f1887 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Wed, 20 Feb 2019 06:44:42 -0800 Subject: [PATCH 0358/2702] update version of .NET core that the project uses --- Directory.Build.props | 1 + global.json | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index f81de84ed716..203f6933df6d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,6 +2,7 @@ false + $(NoWarn);NU5125 diff --git a/global.json b/global.json index a4dca0916a2c..ef415a293470 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,8 @@ { "tools": { - "dotnet": "2.1.403" + "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19115.1", - "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19105.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19115.1" } } From c76fbb73b706fc0cc96990a8c945d112e27ed629 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Wed, 20 Feb 2019 07:08:42 -0800 Subject: [PATCH 0359/2702] update arcade dependecies --- eng/Version.Details.xml | 20 ++++++++++---------- global.json | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5d87e1223a34..2f0ddf4a8173 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,10 +1,10 @@ - - - - - - https://github.com/dotnet/arcade - 75af3cdef5022dbb92b8a94388198a6fd59a5d94 - - - + + + + + + https://github.com/dotnet/arcade + 8549f0f5f303b53dcafd5b26c5f2ec4c5137521b + + + diff --git a/global.json b/global.json index ef415a293470..192e45fe2187 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,8 @@ -{ - "tools": { - "dotnet": "2.1.504" - }, - "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19115.1" - } -} +{ + "tools": { + "dotnet": "2.1.504" + }, + "msbuild-sdks": { + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19119.2" + } +} From d8356772b0c796ca1e1a1874385bb59428bd34f0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 20 Feb 2019 15:24:11 -0800 Subject: [PATCH 0360/2702] Fix myget links in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a26a4ab18ed2..c18804362c6a 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ dotnet tool install -g dotnet-format --version 3.0.0-beta4-19105-10 #### Installing Development Builds -Development builds of `dotnet-format` are being hosted on myget. You can visit the [dotnet-format myget page](https://dotnet.myget.org/feed/roslyn/package/nuget/dotnet-format) to get the latest version number. +Development builds of `dotnet-format` are being hosted on myget. You can visit the [dotnet-format myget page](https://dotnet.myget.org/feed/format/package/nuget/dotnet-format) to get the latest version number. You can install the tool using the following command. ```console -dotnet tool install -g dotnet-format --version --add-source https://dotnet.myget.org/F/roslyn/api/v3/index.json +dotnet tool install -g dotnet-format --version 3.0.0-prerelease.19119.4 --add-source https://dotnet.myget.org/F/format/api/v3/index.json ``` ### How To Use From 712f8001c7866d237e7dcb09e37f03fb83a842ae Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 21 Feb 2019 07:52:37 -0800 Subject: [PATCH 0361/2702] Added editorconfig --- .editorconfig | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000000..0884d2396901 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,180 @@ +# EditorConfig is awesome:http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Don't use tabs for indentation. +[*] +indent_style = space +# (Please don't specify an indent_size here; that has too many unintended consequences.) + +# Code files +[*.{cs,csx,vb,vbx}] +indent_size = 4 +insert_final_newline = true +charset = utf-8-bom + +# Xml project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +indent_size = 2 + +# Xml config files +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] +indent_size = 2 + +# JSON files +[*.json] +indent_size = 2 + +[*.{sh}] +end_of_line = lf +indent_size = 2 + +# Dotnet code style settings: +[*.{cs,vb}] +# Sort using and Import directives with System.* appearing first +dotnet_sort_system_directives_first = true +# Avoid "this." and "Me." if not necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# Use language keywords instead of framework type names for type references +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# Suggest more modern language features when available +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion + +# Non-private static fields are PascalCase +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static + +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case + +# Constants are PascalCase +dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants +dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style + +dotnet_naming_symbols.constants.applicable_kinds = field, local +dotnet_naming_symbols.constants.required_modifiers = const + +dotnet_naming_style.constant_style.capitalization = pascal_case + +# Static fields are camelCase and start with s_ +dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields +dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style + +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static + +dotnet_naming_style.static_field_style.capitalization = camel_case +dotnet_naming_style.static_field_style.required_prefix = s_ + +# Instance fields are camelCase and start with _ +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields +dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style + +dotnet_naming_symbols.instance_fields.applicable_kinds = field + +dotnet_naming_style.instance_field_style.capitalization = camel_case +dotnet_naming_style.instance_field_style.required_prefix = _ + +# Locals and parameters are camelCase +dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style + +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local + +dotnet_naming_style.camel_case_style.capitalization = camel_case + +# Local functions are PascalCase +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function + +dotnet_naming_style.local_function_style.capitalization = pascal_case + +# By default, name items with PascalCase +dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members +dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style + +dotnet_naming_symbols.all_members.applicable_kinds = * + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# CSharp code style settings: +[*.cs] +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_switch_labels = true +csharp_indent_labels = flush_left + +# Prefer "var" everywhere +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_style_var_elsewhere = true:suggestion + +# Prefer method-like constructs to have a block body +csharp_style_expression_bodied_methods = false:none +csharp_style_expression_bodied_constructors = false:none +csharp_style_expression_bodied_operators = false:none + +# Prefer property-like constructs to have an expression-body +csharp_style_expression_bodied_properties = true:none +csharp_style_expression_bodied_indexers = true:none +csharp_style_expression_bodied_accessors = true:none + +# Suggest more modern language features when available +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Newline settings +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Spacing +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_around_binary_operators = before_and_after +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false + +# Blocks are allowed +csharp_prefer_braces = true:silent +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true From d48a5949aeab1bb5422f173b4e03637a79db628b Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Thu, 21 Feb 2019 10:41:49 -0800 Subject: [PATCH 0362/2702] Update version to 3.0.1 --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 5f3079056171..8c9100aeb4a7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - 3.0.0 + 3.0.1 prerelease + + true + + From 2def4f9d01c4d7429110e7fb68568ac4ede5356d Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Mon, 25 Feb 2019 12:50:22 -0800 Subject: [PATCH 0368/2702] do not repack nuget packages --- eng/Versions.props | 6 ------ 1 file changed, 6 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index cccf8ac0c38f..51036cf8e2e2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -4,12 +4,6 @@ 3.0.1 prerelease - - - true - From 26b1b9b63976667d6e5e9dcf93d2124c448a2888 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Mon, 25 Feb 2019 13:22:32 -0800 Subject: [PATCH 0369/2702] do not publish symbols --- azure-pipelines-official.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 5a60d51b2843..91493dc85729 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -29,8 +29,6 @@ steps: /p:OfficialBuildId=$(Build.BuildNumber) /p:VisualStudioDropName=$(VisualStudioDropName) /p:DotNetSignType=$(SignType) - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) displayName: Build - task: NuGetPublisher@0 @@ -46,8 +44,6 @@ steps: /p:OfficialBuildId=$(Build.BuildNumber) /p:VisualStudioDropName=$(VisualStudioDropName) /p:DotNetSignType=$(SignType) - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:DotNetFinalVersionKind=release displayName: Build From c9bca3b0432cfde9c07b5ebbf9f126a2102d96c0 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Mon, 25 Feb 2019 14:05:40 -0800 Subject: [PATCH 0370/2702] Update azure-pipelines-official.yml --- azure-pipelines-official.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 91493dc85729..1586754cef20 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -29,6 +29,9 @@ steps: /p:OfficialBuildId=$(Build.BuildNumber) /p:VisualStudioDropName=$(VisualStudioDropName) /p:DotNetSignType=$(SignType) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:DotNetFinalVersionKind=$(_additionalBuildArgs) displayName: Build - task: NuGetPublisher@0 @@ -39,14 +42,6 @@ steps: nuGetVersion: 4.0.0.2283 condition: succeeded() -- script: eng\common\CIBuild.cmd - -configuration $(BuildConfiguration) - /p:OfficialBuildId=$(Build.BuildNumber) - /p:VisualStudioDropName=$(VisualStudioDropName) - /p:DotNetSignType=$(SignType) - /p:DotNetFinalVersionKind=release - displayName: Build - - task: PublishBuildArtifacts@1 displayName: Publish Logs inputs: From 0172f34a60d38948222e7a1938043b3732b48444 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 25 Feb 2019 14:54:45 -0800 Subject: [PATCH 0371/2702] Updated LOC --- src/xlf/Resources.cs.xlf | 6 +++--- src/xlf/Resources.de.xlf | 6 +++--- src/xlf/Resources.es.xlf | 6 +++--- src/xlf/Resources.fr.xlf | 6 +++--- src/xlf/Resources.it.xlf | 6 +++--- src/xlf/Resources.ja.xlf | 6 +++--- src/xlf/Resources.ko.xlf | 6 +++--- src/xlf/Resources.pl.xlf | 6 +++--- src/xlf/Resources.pt-BR.xlf | 6 +++--- src/xlf/Resources.ru.xlf | 6 +++--- src/xlf/Resources.tr.xlf | 6 +++--- src/xlf/Resources.zh-Hans.xlf | 6 +++--- src/xlf/Resources.zh-Hant.xlf | 6 +++--- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 0d5b0eef70d2..f92b472a3a07 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + Soubory se naformátují, ale změny se neuloží na disk. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + Naformátovali jsme {0} z {1} souborů za {2} ms. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Dosáhlo se maximálního počtu upozornění pracovního prostoru, který se dá protokolovat. Pokud chcete zobrazit všechna upozornění, nastavte parametr --verbosity na úroveň diagnostic. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 8ff0128c76e9..dcddb604d5e6 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + Dateien formatieren, Änderungen aber nicht auf Festplatte speichern. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + {0} von {1} Dateien in {2} ms formatiert. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Die maximale Anzahl der Arbeitsbereichwarnungen wurde erreicht. Legen Sie --verbosity auf "diagnostic" fest, um alle Warnungen anzuzeigen. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index e0a6df5b0674..aa7d0cd8cba2 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + Formato de archivos, pero no guardar los cambios al disco. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + {0} de {1} archivos con formato en {2} ms. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Se ha alcanzado el número máximo de advertencias del espacio de trabajo que se deben registrar. Establezca la opción --verbosity al nivel "diagnóstico" para ver todas las advertencias. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 73a1609afbf4..8fdcf5207187 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + Mettez en forme les fichiers, mais n'enregistrez pas les changements sur le disque. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + {0} fichiers sur {1} mis en forme en {2} ms. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Le nombre maximal d'avertissements d'espace de travail à journaliser a été atteint. Définissez l'option --verbosity sur le niveau 'diagnostic' pour voir les avertissements. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 86d0856c4562..9a3926d6fcea 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + Formatta i file, ma non salvare le modifiche sul disco. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + Sono stati formattati {0} di {1} file in {2} ms. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + È stato raggiunto il numero massimo di avvisi da registrare per l'area di lavoro. Per visualizzare tutti gli avvisi, impostare l'opzione --verbosity sul livello 'diagnostic'. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 06d2026c1bea..225626380cd3 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + ファイルを書式設定しますが、変更をディスクに保存しません。 Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + {2} ミリ秒で {1} 個中 {0} 個のファイルが書式設定されました。 @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + ログに記録するワークスペース警告の最大数に達しました。すべての警告を表示するには --verbosity オプションを 'diagnostic' レベルに設定します。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index fc5295530d54..e41d6dfec3c2 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + 파일의 형식을 지정하지만 변경 내용을 디스크에 저장하지 않습니다. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + {2}밀리초 내에 {1}개 중 {0}개 파일의 형식을 지정했습니다. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + 로그의 작업 영역 경고 수가 최대치에 도달했습니다. '진단' 수준에 --verbosity 옵션을 설정하여 모든 경고를 볼 수 있습니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 716a769f7b5a..0e94a846781e 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + Formatuj pliki, ale nie zapisuj zmian na dysku. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + Sformatowano następującą liczbę plików: {0} z {1} w {2} ms. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Osiągnięto maksymalną liczbę ostrzeżeń obszaru roboczego do zarejestrowania. Ustaw opcję --verbosity na poziom „diagnostic”, aby zobaczyć wszystkie ostrzeżenia. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 22e48c927df3..9a75f91dc0ec 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + Arquivos de formato, mas não salva as alterações para o disco. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + Formatado {0} de {1} arquivos em ms {2}. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Foi atingido o número máximo de avisos do workspace a serem registrados em log. Defina a opção --verbosity para o nível 'diagnostic' para ver todos os avisos. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 930d9669fe48..5637d826ec82 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + Форматировать файлы без сохранения изменений на диск. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + Отформатировано файлов: {0} из {1} за {2} мс. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Достигнуто максимальное количество предупреждений рабочей области, которые могут быть записаны в журнал. Чтобы просмотреть все предупреждения, установите параметр --verbosity. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 5f64d3108fdf..5bb74641d416 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + Dosyaları biçimlendir, ancak değişiklikleri diske kaydetme. Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + {1} dosyadan {0} tanesi {2} milisaniyede biçimlendirildi. @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Günlüğe kaydedilecek en fazla çalışma alanı uyarısı sayısına ulaşıldı. Tüm uyarıları görmek için --verbosity seçeneğini 'diagnostic' düzeyine ayarlayın. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 9f6005f43efd..0c189d4d5a74 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + 格式化文件, 但不将更改保存到磁盘。 Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + 在 {2}ms 中设置 {1} 文件的格式。 @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + 已达到要记录的工作区警告的最大数量。将--详细程度选项设置为 "诊断" 级别以查看所有警告。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 4bcd28ebd430..b91498926be7 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -29,12 +29,12 @@ Format files, but do not save changes to disk. - Format files, but do not save changes to disk. + 將檔案格式化,但不儲存變更到磁碟。 Formatted {0} of {1} files in {2}ms. - Formatted {0} of {1} files in {2}ms. + 已將 {0}/{1} 個檔案格式化,花費 {2} 毫秒。 @@ -59,7 +59,7 @@ Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + 已達到要記錄的工作區警告數上限。請將 --verbosity 選項設定為 'diagnostic’ 層級,以查看所有警告。 From baa08dafca751a1c3d2807b617e44eca38c46f10 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Mon, 25 Feb 2019 20:45:33 -0800 Subject: [PATCH 0372/2702] Add badges to readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index c18804362c6a..8e5546d8e2b8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ ## dotnet-format +[![Nuget](https://img.shields.io/nuget/v/dotnet-format.svg)](https://www.nuget.org/packages/dotnet-format) + +[![MyGet](https://img.shields.io/dotnet.myget/format/v/dotnet-format.svg?label=myget)](https://dotnet.myget.org/feed/format/package/nuget/dotnet-format) + |Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) |---|:--:|:--:|:--:|:--:| [master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master) From ba27149ab96d485a50def5c064c114ac83483afd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 26 Feb 2019 14:15:14 +0000 Subject: [PATCH 0373/2702] Update dependencies from https://github.com/dotnet/arcade build 20190225.2 (#20) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19125.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7dafed1a1956..8a5c7574fa34 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - bae9ce31a13d501429608f4666fd5b479bdc4a87 + a0ed7c38c714b1f60f50a4a408171e2c3bcf8f7f diff --git a/global.json b/global.json index 259367b8e2a2..4fc94a168b4d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19124.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19125.2" } } From e4cd975c8f8a8629a086775bbb03ac241f64f3ff Mon Sep 17 00:00:00 2001 From: William Li Date: Tue, 26 Feb 2019 17:41:10 -0800 Subject: [PATCH 0374/2702] add roll forward Or it will require 2.1 runtime like the following It was not possible to find any compatible framework version The specified framework 'Microsoft.NETCore.App', version '2.1.0' was not found. - Check application dependencies and target a framework version installed at: C:\Program Files\dotnet - The .NET Core Runtime and SDK can be installed from: https://aka.ms/dotnet-download - The following versions are installed: 3.0.0-preview3-27425-4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] - Installing .NET Core prerequisites might help resolve this problem: https://go.microsoft.com/fwlink/?linkid=798306 --- src/runtimeconfig.template.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/runtimeconfig.template.json diff --git a/src/runtimeconfig.template.json b/src/runtimeconfig.template.json new file mode 100644 index 000000000000..a35af1d706bf --- /dev/null +++ b/src/runtimeconfig.template.json @@ -0,0 +1,3 @@ +{ + "rollForwardOnNoCandidateFx": 2 +} \ No newline at end of file From e0723b653fa1c712b657c7f623968e1fdf1f32ea Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Wed, 27 Feb 2019 14:00:04 +0000 Subject: [PATCH 0375/2702] Update dependencies from https://github.com/dotnet/arcade build 20190226.6 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19126.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8a5c7574fa34..ee464b3da2bb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - a0ed7c38c714b1f60f50a4a408171e2c3bcf8f7f + 3f38c38af31863b35c9334320b95cca56e29c942 diff --git a/global.json b/global.json index 4fc94a168b4d..b2902ee9cb43 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19125.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19126.6" } } From 3bade1fab5160064b40c704616b6e2aa5c970f37 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Wed, 27 Feb 2019 09:07:45 -0800 Subject: [PATCH 0376/2702] update version number for unreleased packages --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 51036cf8e2e2..4d40abb3c358 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - 3.0.1 + 3.0.2 prerelease - - - - \ No newline at end of file diff --git a/eng/Versions.props b/eng/Versions.props index ac5a42d00487..d797fa342d08 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,6 @@ 2.1.1 2.1.1 1.1.20180503.2 - 9.0.1 3.0.0-beta3-final diff --git a/src/MSBuild/LooseVersionAssemblyLoader.cs b/src/MSBuild/LooseVersionAssemblyLoader.cs new file mode 100644 index 000000000000..cca1e2102c30 --- /dev/null +++ b/src/MSBuild/LooseVersionAssemblyLoader.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Runtime.Loader; + +namespace Microsoft.CodeAnalysis.Tools.MSBuild +{ + internal static class LooseVersionAssemblyLoader + { + private static readonly Dictionary s_pathsToAssemblies = new Dictionary(StringComparer.OrdinalIgnoreCase); + private static readonly Dictionary s_namesToAssemblies = new Dictionary(); + + private static readonly object s_guard = new object(); + private static readonly string[] s_extensions = new[] { "ni.dll", "ni.exe", "dll", "exe" }; + + /// + /// Register an assembly loader that will load assemblies with higher version than what was requested. + /// + public static void Register(string searchPath) + { + AssemblyLoadContext.Default.Resolving += (AssemblyLoadContext context, AssemblyName assemblyName) => + { + lock (s_guard) + { + if (s_namesToAssemblies.TryGetValue(assemblyName.FullName, out var assembly)) + { + return assembly; + } + + return TryResolveAssemblyFromPaths(context, assemblyName, searchPath); + } + }; + } + + private static Assembly TryResolveAssemblyFromPaths(AssemblyLoadContext context, AssemblyName assemblyName, string searchPath) + { + foreach (var cultureSubfolder in string.IsNullOrEmpty(assemblyName.CultureName) + // If no culture is specified, attempt to load directly from + // the known dependency paths. + ? new[] { string.Empty } + // Search for satellite assemblies in culture subdirectories + // of the assembly search directories, but fall back to the + // bare search directory if that fails. + : new[] { assemblyName.CultureName, string.Empty }) + { + foreach (var extension in s_extensions) + { + var candidatePath = Path.Combine( + searchPath, cultureSubfolder, $"{assemblyName.Name}.{extension}"); + + var isAssemblyLoaded = s_pathsToAssemblies.ContainsKey(candidatePath); + if (isAssemblyLoaded || !File.Exists(candidatePath)) + { + continue; + } + + var candidateAssemblyName = AssemblyLoadContext.GetAssemblyName(candidatePath); + if (candidateAssemblyName.Version < assemblyName.Version) + { + continue; + } + + return LoadAndCache(context, candidatePath); + } + } + + return null; + } + + /// + /// Assumes we have a lock on _guard + /// + private static Assembly LoadAndCache(AssemblyLoadContext context, string fullPath) + { + var assembly = context.LoadFromAssemblyPath(fullPath); + var name = assembly.FullName; + + s_pathsToAssemblies[fullPath] = assembly; + s_namesToAssemblies[name] = assembly; + + return assembly; + } + } +} \ No newline at end of file diff --git a/src/Program.cs b/src/Program.cs index 126cfe5a6c67..a5b2ed202430 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -72,6 +72,13 @@ public static async Task Run(string workspace, string verbosity, bool dryRu // Since we are running as a dotnet tool we should be able to find an instance of // MSBuild in a .NET Core SDK. var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); + + // Since we do not inherit msbuild.deps.json when referencing the SDK copy + // of MSBuild and because the SDK no longer ships with version matched assemblies, we + // register an assembly loader that will load assemblies from the msbuild path with + // equal or higher version numbers than requested. + LooseVersionAssemblyLoader.Register(msBuildInstance.MSBuildPath); + Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); return await CodeFormatter.FormatWorkspaceAsync( diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 2436cbc24667..a2b1e326f2df 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -24,7 +24,6 @@ - diff --git a/tests/MSBuildFixture.cs b/tests/MSBuildFixture.cs index 4c4c6d761c7f..22106777ff4f 100644 --- a/tests/MSBuildFixture.cs +++ b/tests/MSBuildFixture.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using System.Threading; +using Microsoft.CodeAnalysis.Tools.MSBuild; namespace Microsoft.CodeAnalysis.Tools.Tests { @@ -13,6 +14,7 @@ public void RegisterInstance() if (Interlocked.Exchange(ref _registered, 1) == 0) { var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); + LooseVersionAssemblyLoader.Register(msBuildInstance.MSBuildPath); Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); } } diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 0d7a2f1926e9..0049bddd1789 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -14,7 +14,6 @@ - From df0e8ef266b3e9e6bed60fc425158a77fa6ce674 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 2 Mar 2019 14:06:31 +0000 Subject: [PATCH 0388/2702] Update dependencies from https://github.com/dotnet/arcade build 20190301.5 (#34) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19151.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 345ddbc630fa..663dd5817e3d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6c034531b2af9e6b2f76c86d471fd308a400269e + 2f6e31ec56a54a5bd1cdd2d9410dae2ddc375d23 diff --git a/global.json b/global.json index b5231db2d003..df53cded689a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19128.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19151.5" } } From 53806a0c53733d434b8707367b46d217d65b95aa Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 2 Mar 2019 14:50:45 -0800 Subject: [PATCH 0389/2702] updating readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c584a0a7c080..b8f6c887d896 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master) -`dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. +`dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects. ### How To Install From cc4442cb3c7d146f5dc3c3d2e2a2153141c444c7 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 2 Mar 2019 15:07:35 -0800 Subject: [PATCH 0390/2702] add message for project load failure --- src/CodeFormatter.cs | 12 ++++++++++-- tests/CodeFormatterTests.cs | 16 ++++++++++++++++ .../for_code_formatter/fsharp_project/Program.fs | 8 ++++++++ .../fsharp_project/fsharp_project.fsproj | 12 ++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 tests/projects/for_code_formatter/fsharp_project/Program.fs create mode 100644 tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 6d15bee25ebf..c6e89651e690 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -56,8 +56,16 @@ public static async Task FormatWorkspaceAsync(ILogger logger, string soluti } else { - await workspace.OpenProjectAsync(solutionOrProjectPath, cancellationToken: cancellationToken).ConfigureAwait(false); - projectPath = solutionOrProjectPath; + try + { + await workspace.OpenProjectAsync(solutionOrProjectPath, cancellationToken: cancellationToken).ConfigureAwait(false); + projectPath = solutionOrProjectPath; + } + catch (InvalidOperationException) + { + logger.LogError(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, solutionOrProjectPath); + return 1; + } } logger.LogTrace(Resources.Workspace_loaded_in_0_ms, workspaceStopwatch.ElapsedMilliseconds); diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 4915e1335a7a..2f8904851589 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -76,5 +76,21 @@ public async Task FilesFormattedInUnformattedSolution() Assert.True(match.Success); Assert.Equal("1", match.Groups[1].Value); } + + [Fact] + public async Task FSharpProjectsDoNotCreateException() + { + var logger = new TestLogger(); + var path = Path.GetFullPath("tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj", SolutionPath); + + var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); + var logLines = logger.GetLog().Split(Environment.NewLine); + + Assert.Equal(4, logLines.Length); + var actualErrorMessage = logLines[2]; + var expectedErrorMessage = string.Format(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, path); + Assert.Equal(expectedErrorMessage, actualErrorMessage); + Assert.Equal(1, exitCode); + } } } diff --git a/tests/projects/for_code_formatter/fsharp_project/Program.fs b/tests/projects/for_code_formatter/fsharp_project/Program.fs new file mode 100644 index 000000000000..6f75f64e0053 --- /dev/null +++ b/tests/projects/for_code_formatter/fsharp_project/Program.fs @@ -0,0 +1,8 @@ +// Learn more about F# at http://fsharp.org + +open System + +[] +let main argv = + printfn "Hello World from F#!" + 0 // return an integer exit code diff --git a/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj b/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj new file mode 100644 index 000000000000..102afe877fc6 --- /dev/null +++ b/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj @@ -0,0 +1,12 @@ + + + + Exe + netcoreapp3.0 + + + + + + + \ No newline at end of file From 696e860cec45d8a44dfcaa4826c4d867cc69a4a9 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 2 Mar 2019 15:55:19 -0800 Subject: [PATCH 0391/2702] ensure that developers on non-english machines can build and test --- azure-pipelines.yml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 233b14dd7cb1..f79ee7ee42bf 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,6 +7,7 @@ pr: - master jobs: + - job: Windows pool: dotnet-external-temp variables: @@ -19,11 +20,9 @@ jobs: Release: _configuration: Release timeoutInMinutes: 20 - steps: - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine displayName: Build and Test - - task: PublishTestResults@1 inputs: testRunner: XUnit @@ -54,7 +53,6 @@ jobs: steps: - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine displayName: Build and Test - - task: PublishTestResults@2 displayName: Publish xUnit Test Results inputs: @@ -69,4 +67,34 @@ jobs: PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_configuration)' ArtifactName: '$(_os) $(_configuration)' continueOnError: true - condition: not(succeeded()) \ No newline at end of file + condition: not(succeeded()) + +- job: Windows Spanish + pool: dnceng-windows-spanish-external-temp + variables: + _os: Windows + strategy: + maxParallel: 4 + matrix: + Debug: + _configuration: Debug + Release: + _configuration: Release + timeoutInMinutes: 20 + steps: + - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine + displayName: Build and Test + - task: PublishTestResults@1 + inputs: + testRunner: XUnit + testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml' + mergeTestResults: true + testRunTitle: '$(_os) $(_configuration)' + condition: always() + - task: PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: '$(_os) $(_configuration)' + continueOnError: true + condition: not(succeeded()) From 231407cc01f64bf135e9d32ec98abb091eb3d9f0 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 2 Mar 2019 15:56:59 -0800 Subject: [PATCH 0392/2702] remove space from name --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f79ee7ee42bf..3e50cb3f9360 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -69,7 +69,7 @@ jobs: continueOnError: true condition: not(succeeded()) -- job: Windows Spanish +- job: Windows_Spanish pool: dnceng-windows-spanish-external-temp variables: _os: Windows From 2143bb1eb284cf05bf0e3d46d393f5aa27df2a84 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 2 Mar 2019 16:06:50 -0800 Subject: [PATCH 0393/2702] use non-roslyn linux queue --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3e50cb3f9360..2546358a87c3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -39,7 +39,7 @@ jobs: condition: not(succeeded()) - job: Linux - pool: DotNetCore-Linux + pool: dnceng-linux-external-temp variables: _os: Linux strategy: From b5c73a7344f6589aa50637a7a16d89e175787e4f Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 2 Mar 2019 16:07:09 -0800 Subject: [PATCH 0394/2702] have unique artifact names --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2546358a87c3..80ce4f9a8617 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -89,12 +89,12 @@ jobs: testRunner: XUnit testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml' mergeTestResults: true - testRunTitle: '$(_os) $(_configuration)' + testRunTitle: 'Spanish $(_os) $(_configuration)' condition: always() - task: PublishBuildArtifacts@1 displayName: Publish Logs inputs: PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' - ArtifactName: '$(_os) $(_configuration)' + ArtifactName: 'Spanish $(_os) $(_configuration)' continueOnError: true condition: not(succeeded()) From 52354c61677f189b72b56c64b9b5e68bc1eeca90 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 2 Mar 2019 16:27:30 -0800 Subject: [PATCH 0395/2702] update tests to work on other spoken languages --- tests/MSBuildWorkspaceFinderTests.cs | 48 +++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/tests/MSBuildWorkspaceFinderTests.cs b/tests/MSBuildWorkspaceFinderTests.cs index 21877d162167..ae6f3b74c62d 100644 --- a/tests/MSBuildWorkspaceFinderTests.cs +++ b/tests/MSBuildWorkspaceFinderTests.cs @@ -11,16 +11,48 @@ public class MSBuildWorkspaceFinderTests { private static string SolutionPath => Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.Parent.Parent.FullName; - [Theory] - [InlineData("Could not find a MSBuild project file or solution file in ", "tests/projects/for_workspace_finder/no_project_or_solution/")] - [InlineData("Multiple MSBuild project files found in ", "tests/projects/for_workspace_finder/multiple_projects/")] - [InlineData("Multiple MSBuild solution files found in ", "tests/projects/for_workspace_finder/multiple_solutions/")] - [InlineData("Both a MSBuild project file and solution file found in ", "tests/projects/for_workspace_finder/project_and_solution/")] - public void ThrowsExceptions(string exceptionMessageStart, string workspacePath) + [Fact] + public void ThrowsException_CannotFindMSBuildProjectFile() { + var workspacePath = "tests/projects/for_workspace_finder/no_project_or_solution/"; + var exceptionMessageStart = string.Format( + Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); - - Assert.StartsWith(exceptionMessageStart, exception.Message); + Assert.StartsWith(exceptionMessageStart, exception.Message); + } + + [Fact] + public void ThrowsException_MultipleMSBuildProjectFiles() + { + var workspacePath = "tests/projects/for_workspace_finder/multiple_projects/"; + var exceptionMessageStart = string.Format( + Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Assert.Equal(exceptionMessageStart, exception.Message); + } + + [Fact] + public void ThrowsException_MultipleMSBuildSolutionFiles() + { + var workspacePath = "tests/projects/for_workspace_finder/multiple_solutions/"; + var exceptionMessageStart = string.Format( + Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Assert.Equal(exceptionMessageStart, exception.Message); + } + + [Fact] + public void ThrowsException_SolutionAndProjectAmbiguity() + { + var workspacePath = "tests/projects/for_workspace_finder/project_and_solution/"; + var exceptionMessageStart = string.Format( + Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Assert.Equal(exceptionMessageStart, exception.Message); } [Fact] From c81abc1c8e76702cf2009c129e86f8a476c93f82 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 2 Mar 2019 16:37:39 -0800 Subject: [PATCH 0396/2702] print log on match failure --- tests/CodeFormatterTests.cs | 8 +- tests/MSBuildWorkspaceFinderTests.cs | 180 +++++++++++++-------------- 2 files changed, 94 insertions(+), 94 deletions(-) diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 4915e1335a7a..727469cc8ae3 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -27,7 +27,7 @@ public async Task NoFilesFormattedInFormattedProject() var log = logger.GetLog(); var match = FilesFormatted.Match(log); - Assert.True(match.Success); + Assert.True(match.Success, log); Assert.Equal("0", match.Groups[1].Value); Assert.Equal(0, exitCode); } @@ -43,7 +43,7 @@ public async Task NoFilesFormattedInFormattedSolution() var match = FilesFormatted.Match(log); Assert.Equal(0, exitCode); - Assert.True(match.Success); + Assert.True(match.Success, log); Assert.Equal("0", match.Groups[1].Value); } @@ -57,7 +57,7 @@ public async Task FilesFormattedInUnformattedProject() var log = logger.GetLog(); var match = FilesFormatted.Match(log); - Assert.True(match.Success); + Assert.True(match.Success, log); Assert.Equal("1", match.Groups[1].Value); Assert.Equal(0, exitCode); } @@ -73,7 +73,7 @@ public async Task FilesFormattedInUnformattedSolution() var match = FilesFormatted.Match(log); Assert.Equal(0, exitCode); - Assert.True(match.Success); + Assert.True(match.Success, log); Assert.Equal("1", match.Groups[1].Value); } } diff --git a/tests/MSBuildWorkspaceFinderTests.cs b/tests/MSBuildWorkspaceFinderTests.cs index ae6f3b74c62d..6e059d51a91d 100644 --- a/tests/MSBuildWorkspaceFinderTests.cs +++ b/tests/MSBuildWorkspaceFinderTests.cs @@ -1,106 +1,106 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.IO; -using Microsoft.CodeAnalysis.Tools.MSBuild; -using Xunit; - -namespace Microsoft.CodeAnalysis.Tools.Tests -{ - public class MSBuildWorkspaceFinderTests - { - private static string SolutionPath => Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.Parent.Parent.FullName; - - [Fact] - public void ThrowsException_CannotFindMSBuildProjectFile() - { +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.IO; +using Microsoft.CodeAnalysis.Tools.MSBuild; +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests +{ + public class MSBuildWorkspaceFinderTests + { + private static string SolutionPath => Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.Parent.Parent.FullName; + + [Fact] + public void ThrowsException_CannotFindMSBuildProjectFile() + { var workspacePath = "tests/projects/for_workspace_finder/no_project_or_solution/"; var exceptionMessageStart = string.Format( Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); Assert.StartsWith(exceptionMessageStart, exception.Message); } [Fact] - public void ThrowsException_MultipleMSBuildProjectFiles() - { - var workspacePath = "tests/projects/for_workspace_finder/multiple_projects/"; - var exceptionMessageStart = string.Format( - Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + public void ThrowsException_MultipleMSBuildProjectFiles() + { + var workspacePath = "tests/projects/for_workspace_finder/multiple_projects/"; + var exceptionMessageStart = string.Format( + Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); Assert.Equal(exceptionMessageStart, exception.Message); } [Fact] - public void ThrowsException_MultipleMSBuildSolutionFiles() - { - var workspacePath = "tests/projects/for_workspace_finder/multiple_solutions/"; - var exceptionMessageStart = string.Format( - Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + public void ThrowsException_MultipleMSBuildSolutionFiles() + { + var workspacePath = "tests/projects/for_workspace_finder/multiple_solutions/"; + var exceptionMessageStart = string.Format( + Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); Assert.Equal(exceptionMessageStart, exception.Message); } [Fact] - public void ThrowsException_SolutionAndProjectAmbiguity() - { - var workspacePath = "tests/projects/for_workspace_finder/project_and_solution/"; - var exceptionMessageStart = string.Format( - Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + public void ThrowsException_SolutionAndProjectAmbiguity() + { + var workspacePath = "tests/projects/for_workspace_finder/project_and_solution/"; + var exceptionMessageStart = string.Format( + Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); Assert.Equal(exceptionMessageStart, exception.Message); - } - - [Fact] - public void FindsSolutionByFolder() - { - const string Path = "tests/projects/for_workspace_finder/single_solution/"; - - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); - - var solutionFileName = System.IO.Path.GetFileName(workspacePath); - Assert.Equal("single_solution.sln", solutionFileName); - Assert.True(isSolution); - } - - [Fact] - public void FindsSolutionByFilePath() - { - const string Path = "tests/projects/for_workspace_finder/multiple_solutions/solution_b.sln"; - - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); - - var solutionFileName = System.IO.Path.GetFileName(workspacePath); - Assert.Equal("solution_b.sln", solutionFileName); - Assert.True(isSolution); - } - - [Fact] - public void FindsProjectByFolder() - { - const string Path = "tests/projects/for_workspace_finder/single_project/"; - - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); - - var solutionFileName = System.IO.Path.GetFileName(workspacePath); - Assert.Equal("single_project.csproj", solutionFileName); - Assert.False(isSolution); - } - - [Fact] - public void FindsProjectByFilePath() - { - const string Path = "tests/projects/for_workspace_finder/multiple_projects/project_b.csproj"; - - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); - - var solutionFileName = System.IO.Path.GetFileName(workspacePath); - Assert.Equal("project_b.csproj", solutionFileName); - Assert.False(isSolution); - } - } -} + } + + [Fact] + public void FindsSolutionByFolder() + { + const string Path = "tests/projects/for_workspace_finder/single_solution/"; + + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + + var solutionFileName = System.IO.Path.GetFileName(workspacePath); + Assert.Equal("single_solution.sln", solutionFileName); + Assert.True(isSolution); + } + + [Fact] + public void FindsSolutionByFilePath() + { + const string Path = "tests/projects/for_workspace_finder/multiple_solutions/solution_b.sln"; + + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + + var solutionFileName = System.IO.Path.GetFileName(workspacePath); + Assert.Equal("solution_b.sln", solutionFileName); + Assert.True(isSolution); + } + + [Fact] + public void FindsProjectByFolder() + { + const string Path = "tests/projects/for_workspace_finder/single_project/"; + + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + + var solutionFileName = System.IO.Path.GetFileName(workspacePath); + Assert.Equal("single_project.csproj", solutionFileName); + Assert.False(isSolution); + } + + [Fact] + public void FindsProjectByFilePath() + { + const string Path = "tests/projects/for_workspace_finder/multiple_projects/project_b.csproj"; + + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + + var solutionFileName = System.IO.Path.GetFileName(workspacePath); + Assert.Equal("project_b.csproj", solutionFileName); + Assert.False(isSolution); + } + } +} From 1e62dc1a8320434f3032fd5e9ced1e2773d406ff Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Sat, 2 Mar 2019 16:53:24 -0800 Subject: [PATCH 0397/2702] use resource files to generate the regex patterns --- tests/CodeFormatterTests.cs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 727469cc8ae3..c017d18bf887 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -10,7 +10,6 @@ namespace Microsoft.CodeAnalysis.Tools.Tests public class CodeFormatterTests : IClassFixture { private static string SolutionPath => Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.Parent.Parent.FullName; - private static Regex FilesFormatted => new Regex(@"Formatted (\d+) of \d+ files in ", RegexOptions.Multiline); public CodeFormatterTests(MSBuildFixture msBuildFixture) { @@ -25,7 +24,9 @@ public async Task NoFilesFormattedInFormattedProject() var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); var log = logger.GetLog(); - var match = FilesFormatted.Match(log); + var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); + var filesFormatted = new Regex(pattern, RegexOptions.Multiline); + var match = filesFormatted.Match(log); Assert.True(match.Success, log); Assert.Equal("0", match.Groups[1].Value); @@ -39,8 +40,10 @@ public async Task NoFilesFormattedInFormattedSolution() var path = Path.GetFullPath("tests/projects/for_code_formatter/formatted_solution/formatted_solution.sln", SolutionPath); var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); - var match = FilesFormatted.Match(log); + var log = logger.GetLog(); + var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); + var filesFormatted = new Regex(pattern, RegexOptions.Multiline); + var match = filesFormatted.Match(log); Assert.Equal(0, exitCode); Assert.True(match.Success, log); @@ -54,8 +57,10 @@ public async Task FilesFormattedInUnformattedProject() var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj", SolutionPath); var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); - var match = FilesFormatted.Match(log); + var log = logger.GetLog(); + var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); + var filesFormatted = new Regex(pattern, RegexOptions.Multiline); + var match = filesFormatted.Match(log); Assert.True(match.Success, log); Assert.Equal("1", match.Groups[1].Value); @@ -69,8 +74,10 @@ public async Task FilesFormattedInUnformattedSolution() var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln", SolutionPath); var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); - var match = FilesFormatted.Match(log); + var log = logger.GetLog(); + var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); + var filesFormatted = new Regex(pattern, RegexOptions.Multiline); + var match = filesFormatted.Match(log); Assert.Equal(0, exitCode); Assert.True(match.Success, log); From 082a1125e81c773ec5f276e5ee3663793e76bbbe Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Mon, 4 Mar 2019 09:23:24 -0800 Subject: [PATCH 0398/2702] Adding localization builds --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b8f6c887d896..b60a45370f80 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ [![MyGet](https://img.shields.io/dotnet.myget/format/vpre/dotnet-format.svg?label=myget)](https://dotnet.myget.org/feed/format/package/nuget/dotnet-format) -|Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) -|---|:--:|:--:|:--:|:--:| -[master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master) +|Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) | Localization (Debug) | Localization (Release) | +|---|:--:|:--:|:--:|:--:|:--:|:--:| +[master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)| `dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects. From 3d8e982057be6bdd4fe82feec3d07d7be7ca1d0b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 5 Mar 2019 14:09:47 +0000 Subject: [PATCH 0399/2702] Update dependencies from https://github.com/dotnet/arcade build 20190304.14 (#42) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19154.14 --- eng/Version.Details.xml | 4 +- eng/common/darc-init.ps1 | 2 +- eng/common/darc-init.sh | 2 +- eng/common/templates/steps/send-to-helix.yml | 53 ++++++++++---------- global.json | 2 +- 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 663dd5817e3d..def6482cdda7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 2f6e31ec56a54a5bd1cdd2d9410dae2ddc375d23 + 827c7896f8aa902136ad9dc68cb46147a43cd383 diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 24676b261d58..2467ebdd4225 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -19,7 +19,7 @@ function InstallDarcCli ($darcVersion) { # Until we can anonymously query the BAR API for the latest arcade-services # build applied to the PROD channel, this is hardcoded. if (-not $darcVersion) { - $darcVersion = '1.1.0-beta.19120.2' + $darcVersion = '1.1.0-beta.19151.3' } $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-arcade/index.json' diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index d4dfdc94fcb0..8d63dd711b2a 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash source="${BASH_SOURCE[0]}" -darcVersion="1.1.0-beta.19120.2" +darcVersion="1.1.0-beta.19151.3" while [[ $# > 0 ]]; do opt="$(echo "$1" | awk '{print tolower($0)}')" diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 1fbf8b889732..38e143818721 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -1,32 +1,33 @@ parameters: - HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ - HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' - HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number - HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/api/2018-03-14/info/queues for a list of queues - HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group - HelixPreCommands: '' # optional -- commands to run before Helix work item execution - HelixPostCommands: '' # optional -- commands to run after Helix work item execution - WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects - WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects - WorkItemTimeout: '' # optional -- a timeout in seconds for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects - CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload - XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true - XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects - XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner - XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects - IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion - DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json - DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json - EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control - WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." - IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set - Creator: '' # optional -- if the build is external, use this to specify who is sending the job - condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() - continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/api/2018-03-14/info/queues for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects + WorkItemTimeout: '' # optional -- a timeout in seconds for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true + XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects + XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner + XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + DisplayNamePrefix: 'Send job to Helix' # optional -- rename the beginning of the displayName of the steps in AzDO + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false steps: - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' - displayName: Send job to Helix (Windows) + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) env: BuildConfig: $(_BuildConfig) HelixSource: ${{ parameters.HelixSource }} @@ -53,7 +54,7 @@ steps: condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog - displayName: Send job to Helix (Unix) + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) env: BuildConfig: $(_BuildConfig) HelixSource: ${{ parameters.HelixSource }} diff --git a/global.json b/global.json index df53cded689a..7800f59cb4dc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19151.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19154.14" } } From 91170eac540a0b69bea9d244ec710c551697ffa6 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 5 Mar 2019 13:28:28 -0800 Subject: [PATCH 0400/2702] Created supported .editorconfig options page --- Supported-.editorconfig-options.md | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Supported-.editorconfig-options.md diff --git a/Supported-.editorconfig-options.md b/Supported-.editorconfig-options.md new file mode 100644 index 000000000000..757688196e11 --- /dev/null +++ b/Supported-.editorconfig-options.md @@ -0,0 +1,61 @@ +The dotnet-format global tool supports the core set of EditorConfig properties: + +- indent_style +- indent_size +- tab_width +- end_of_line +- charset +- trim_trailing_whitespace +- insert_final_newline +- root + +In addition dotnet-format supports a subset of the [.NET coding convention settings for EditorConfig](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017). + +# Formatting conventions +Most of the rules for formatting conventions have the following format: + +`rule_name = false|true` + +You specify either `true` (prefer this style) or `false` (do not prefer this style). You do not specify a severity. For a few rules, instead of `true` or `false`, you specify other values to describe when and where to apply the rule. + +## C# formatting settings +The formatting rules in this section apply only to C# code. + +**Newline options** +These formatting rules concern the use of new lines to format code. + +- csharp_new_line_before_open_brace (default value: `all`) +- csharp_new_line_before_else (default value: `true`) +- csharp_new_line_before_catch (default value: `true`) +- csharp_new_line_before_finally (default value: `true`) +- csharp_new_line_before_members_in_object_initializers (default value: `true`) +- csharp_new_line_before_members_in_anonymous_types (default value: `true`) +- csharp_new_line_between_query_expression_clauses (default value: `true`) + +**Indentation options** +These formatting rules concern the use of indentation to format code. + +- csharp_indent_case_contents (default value: `true`) +- csharp_indent_switch_labels (default value: `true`) +- csharp_indent_labels (default value: `no_change`) + +**Spacing options** +These formatting rules concern the use of space characters to format code. + +- csharp_space_after_cast (default value: `false`) +- csharp_space_after_keywords_in_control_flow_statements (default value: `true`) +- csharp_space_between_method_declaration_parameter_list_parentheses (default value: `false`) +- csharp_space_between_method_call_parameter_list_parentheses (default value: `false`) +- csharp_space_between_parentheses (default value: `false`) +- csharp_space_before_colon_in_inheritance_clause (default value: `true`) +- csharp_space_after_colon_in_inheritance_clause (default value: `true`) +- csharp_space_around_binary_operators (default value: `before_and_after`) +- csharp_space_between_method_declaration_empty_parameter_list_parentheses (default value: `false`) +- csharp_space_between_method_call_name_and_opening_parenthesis (default value: `false`) +- csharp_space_between_method_call_empty_parameter_list_parentheses (default value: `false`) + +**Wrapping options** +These formatting rules concern the use of single lines versus separate lines for statements and code blocks. + +- csharp_preserve_single_line_statements (default value: `true`) +- csharp_preserve_single_line_blocks (default value: `true`) \ No newline at end of file From 4a065216f233e20b0375f70ff8b54502cf01e170 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 5 Mar 2019 13:28:28 -0800 Subject: [PATCH 0401/2702] Initial Home page --- Home.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Home.md diff --git a/Home.md b/Home.md new file mode 100644 index 000000000000..9dfce6579be5 --- /dev/null +++ b/Home.md @@ -0,0 +1 @@ +Welcome to the format wiki! From 932722066c7a5ea71996f168dd3d6e453bdffa7f Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 5 Mar 2019 13:46:14 -0800 Subject: [PATCH 0402/2702] Remove unsupported core settings --- Supported-.editorconfig-options.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Supported-.editorconfig-options.md b/Supported-.editorconfig-options.md index 757688196e11..8a6286234242 100644 --- a/Supported-.editorconfig-options.md +++ b/Supported-.editorconfig-options.md @@ -1,12 +1,9 @@ -The dotnet-format global tool supports the core set of EditorConfig properties: +The dotnet-format global tool supports the following core set of EditorConfig properties: - indent_style - indent_size - tab_width -- end_of_line -- charset - trim_trailing_whitespace -- insert_final_newline - root In addition dotnet-format supports a subset of the [.NET coding convention settings for EditorConfig](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017). From f365f3ba86e4e76badcae6ebb4b7eae28b81269c Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 5 Mar 2019 17:31:30 -0800 Subject: [PATCH 0403/2702] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b60a45370f80..56dfd7295064 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)| -`dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects. +`dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](https://github.com/dotnet/format/wiki/Supported-.editorconfig-options). ### How To Install From 05fc79cd52b9cd605bd9e586a00a6cb3a8f73c46 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 9 Mar 2019 14:06:28 +0000 Subject: [PATCH 0404/2702] Update dependencies from https://github.com/dotnet/arcade build 20190308.5 (#44) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19158.5 --- eng/Version.Details.xml | 4 +- eng/common/PublishToPackageFeed.proj | 1 - eng/common/build.sh | 9 ++- eng/common/generate-graph-files.ps1 | 61 ++++++++++++++++++++ eng/common/templates/job/job.yml | 4 +- eng/common/templates/steps/send-to-helix.yml | 4 +- global.json | 2 +- 7 files changed, 75 insertions(+), 10 deletions(-) create mode 100644 eng/common/generate-graph-files.ps1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index def6482cdda7..8f85ae5d9761 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 827c7896f8aa902136ad9dc68cb46147a43cd383 + 6f0a12a38fec78c48c406cd4d220b224e9c4dfb6 diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj index 8149e3fb6a13..b26d28a90b81 100644 --- a/eng/common/PublishToPackageFeed.proj +++ b/eng/common/PublishToPackageFeed.proj @@ -11,7 +11,6 @@ - diff --git a/eng/common/build.sh b/eng/common/build.sh index 0227c6e1e554..40b1e8ec73e3 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -137,13 +137,16 @@ while [[ $# > 0 ]]; do node_reuse=$2 shift ;; - /p:*) + -p:*|/p:*) properties="$properties $1" ;; - /m:*) + -m:*|/m:*) properties="$properties $1" ;; - /bl:*) + -bl:*|/bl:*) + properties="$properties $1" + ;; + -dl:*|/dl:*) properties="$properties $1" ;; *) diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1 new file mode 100644 index 000000000000..c04c80e4f61d --- /dev/null +++ b/eng/common/generate-graph-files.ps1 @@ -0,0 +1,61 @@ +Param( + [Parameter(Mandatory=$true)][string] $barToken, # Token generated at https://maestro-prod.westus2.cloudapp.azure.com/Account/Tokens + [Parameter(Mandatory=$true)][string] $gitHubPat, # GitHub personal access token from https://github.com/settings/tokens (no auth scopes needed) + [Parameter(Mandatory=$true)][string] $azdoPat, # Azure Dev Ops tokens from https://dev.azure.com/dnceng/_details/security/tokens (code read scope needed) + [Parameter(Mandatory=$true)][string] $outputFolder, # Where the graphviz.txt file will be created + [string] $darcVersion = '1.1.0-beta.19156.4', # darc's version + [switch] $includeToolset # Whether the graph should include toolset dependencies or not. i.e. arcade, optimization. For more about + # toolset dependencies see https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#toolset-vs-product-dependencies +) + +$ErrorActionPreference = "Stop" +. $PSScriptRoot\tools.ps1 + +function CheckExitCode ([string]$stage) +{ + $exitCode = $LASTEXITCODE + if ($exitCode -ne 0) { + Write-Host "Something failed in stage: '$stage'. Check for errors above. Exiting now..." + ExitWithExitCode $exitCode + } +} + +try { + Push-Location $PSScriptRoot + + Write-Host "Installing darc..." + . .\darc-init.ps1 -darcVersion $darcVersion + CheckExitCode "Running darc-init" + + $darcExe = "$env:USERPROFILE\.dotnet\tools" + $darcExe = Resolve-Path "$darcExe\darc.exe" + + Create-Directory $outputFolder + + $graphVizFilePath = "$outputFolder\graphviz.txt" + $graphFilePath = "$outputFolder\graph.txt" + $options = "get-dependency-graph --graphviz '$graphVizFilePath' --github-pat $gitHubPat --azdev-pat $azdoPat --password $barToken --output-file $graphFilePath" + + if ($includeToolset) { + Write-Host "Toolsets will be included in the graph..." + $options += " --include-toolset" + } + + Write-Host "Generating dependency graph..." + $darc = Invoke-Expression "& `"$darcExe`" $options" + CheckExitCode "Generating dependency graph" + + $graph = Get-Content $graphVizFilePath + Set-Content $graphVizFilePath -Value "Paste the following digraph object in http://www.webgraphviz.com `r`n", $graph + Write-Host "'$graphVizFilePath' and '$graphFilePath' created!" +} +catch { + if (!$includeToolset) { + Write-Host "This might be a toolset repo which includes only toolset dependencies. " -NoNewline -ForegroundColor Yellow + Write-Host "Since -includeToolset is not set there is no graph to create. Include -includeToolset and try again..." -ForegroundColor Yellow + } + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} \ No newline at end of file diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index cd4e5731a624..74dd81fdc0a3 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -179,7 +179,7 @@ jobs: continueOnError: true condition: always() - - ${{ if and(eq(parameters.enablePublishBuildAssets, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if and(eq(parameters.enablePublishBuildAssets, true), ne(variables['_PublishUsingPipelines'], 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: CopyFiles@2 displayName: Gather Asset Manifests inputs: @@ -194,4 +194,4 @@ jobs: PublishLocation: Container ArtifactName: AssetManifests continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) \ No newline at end of file + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 38e143818721..0925e8ebd123 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -51,6 +51,7 @@ steps: EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog @@ -78,5 +79,6 @@ steps: EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} + continueOnError: ${{ parameters.continueOnError }} \ No newline at end of file diff --git a/global.json b/global.json index 7800f59cb4dc..90fbaeb8cc99 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19154.14" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19158.5" } } From 2458bf80a073edd314c35f6b90f0e3035abd335c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 10 Mar 2019 13:04:50 +0000 Subject: [PATCH 0405/2702] Update dependencies from https://github.com/dotnet/arcade build 20190309.2 (#45) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19159.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8f85ae5d9761..c9596d4b2ceb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 6f0a12a38fec78c48c406cd4d220b224e9c4dfb6 + 9006be3d7a82737fc359442e08376516f3e6573e diff --git a/global.json b/global.json index 90fbaeb8cc99..c3ad105e649e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19158.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19159.2" } } From 1e350251e5bdecd8ba4d921f1565380ac2269107 Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Sun, 10 Mar 2019 23:55:45 +0000 Subject: [PATCH 0406/2702] Update dependencies from https://github.com/dotnet/arcade build 20190310.1 This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19160.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c9596d4b2ceb..804bb86588dc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 9006be3d7a82737fc359442e08376516f3e6573e + 66f42e93ab4c68327167679021b3ba14e8f99f93 diff --git a/global.json b/global.json index c3ad105e649e..c131ae7dd3bc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19159.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19160.1" } } From 139da148cb2625d46a2718c2967aa39c99294a10 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 11 Mar 2019 12:05:31 +0000 Subject: [PATCH 0407/2702] Update dependencies from https://github.com/dotnet/arcade build 20190310.2 (#47) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19160.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 804bb86588dc..14c5fd35dea2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 66f42e93ab4c68327167679021b3ba14e8f99f93 + 89ab8b2b806397e5e444809a6ac12e275e0e20a2 diff --git a/global.json b/global.json index c131ae7dd3bc..60fce45ba1e5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19160.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19160.2" } } From 1b356cec54d8d3f7d463817e82b7be5c7fd3c159 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 12 Mar 2019 12:05:30 +0000 Subject: [PATCH 0408/2702] Update dependencies from https://github.com/dotnet/arcade build 20190311.14 (#49) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19161.14 --- eng/Version.Details.xml | 4 +- eng/common/generate-graph-files.ps1 | 2 +- .../templates/job/generate-graph-files.yml | 48 +++++++++++++++++++ eng/common/templates/jobs/jobs.yml | 19 +++++++- global.json | 2 +- 5 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 eng/common/templates/job/generate-graph-files.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 14c5fd35dea2..87b8ad3debcc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,9 +2,9 @@ - + https://github.com/dotnet/arcade - 89ab8b2b806397e5e444809a6ac12e275e0e20a2 + 2ca74c76adc84f0459b4a0352034db463d0b910f diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1 index c04c80e4f61d..e09c64e9f6f4 100644 --- a/eng/common/generate-graph-files.ps1 +++ b/eng/common/generate-graph-files.ps1 @@ -42,7 +42,7 @@ try { } Write-Host "Generating dependency graph..." - $darc = Invoke-Expression "& `"$darcExe`" $options" + Invoke-Expression "& `"$darcExe`" $options" CheckExitCode "Generating dependency graph" $graph = Get-Content $graphVizFilePath diff --git a/eng/common/templates/job/generate-graph-files.yml b/eng/common/templates/job/generate-graph-files.yml new file mode 100644 index 000000000000..e54ce956f908 --- /dev/null +++ b/eng/common/templates/job/generate-graph-files.yml @@ -0,0 +1,48 @@ +parameters: + # Optional: dependencies of the job + dependsOn: '' + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: {} + + # Optional: Include toolset dependencies in the generated graph files + includeToolset: false + +jobs: +- job: Generate_Graph_Files + + dependsOn: ${{ parameters.dependsOn }} + + displayName: Generate Graph Files + + pool: ${{ parameters.pool }} + + variables: + # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT + # DotNet-AllOrgs-Darc-Pats provides: dn-bot-devdiv-dnceng-rw-code-pat + - group: Publish-Build-Assets + - group: DotNet-AllOrgs-Darc-Pats + - name: _GraphArguments + value: -gitHubPat $(BotAccount-dotnet-maestro-bot-PAT) + -azdoPat $(dn-bot-devdiv-dnceng-rw-code-pat) + -barToken $(MaestroAccessToken) + -outputFolder '$(Build.StagingDirectory)/GraphFiles/' + - ${{ if ne(parameters.includeToolset, 'false') }}: + - name: _GraphArguments + value: ${{ variables._GraphArguments }} -includeToolset + + steps: + - task: PowerShell@2 + displayName: Generate Graph Files + inputs: + filePath: eng\common\generate-graph-files.ps1 + arguments: $(_GraphArguments) + continueOnError: true + - task: PublishBuildArtifacts@1 + displayName: Publish Graph to Artifacts + inputs: + PathtoPublish: '$(Build.StagingDirectory)/GraphFiles' + PublishLocation: Container + ArtifactName: GraphFiles + continueOnError: true + condition: always() diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index c1a5b4849ace..06ed58de41f3 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -13,7 +13,13 @@ parameters: # Optional: Enable publishing to the build asset registry enablePublishBuildAssets: false - + + graphFileGeneration: + # Optional: Enable generating the graph files at the end of the build + enabled: false + # Optional: Include toolset dependencies in the generated graph files + includeToolset: false + # Optional: Include PublishTestResults task enablePublishTestResults: false @@ -68,4 +74,13 @@ jobs: vmImage: vs2017-win2016 runAsPublic: ${{ parameters.runAsPublic }} enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} - + +- ${{ if and(eq(parameters.graphFileGeneration.enabled, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - template: ../job/generate-graph-files.yml + parameters: + continueOnError: ${{ parameters.continueOnError }} + includeToolset: ${{ parameters.graphFileGeneration.includeToolset }} + dependsOn: + - Asset_Registry_Publish + pool: + vmImage: vs2017-win2016 diff --git a/global.json b/global.json index 60fce45ba1e5..e42e257d207e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19160.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19161.14" } } From 1b54be40644135e43f60926ef3306c02ac1a7a82 Mon Sep 17 00:00:00 2001 From: Roman Petrov Date: Tue, 12 Mar 2019 19:43:45 +0300 Subject: [PATCH 0409/2702] Add new CLI '--check' option (#48) * Add localized message for '--check' option * Add new '--check' option * Update localized messages * Finish implementation * Update tests * Document '--check' option in README.md * Add program exit code tests * Use named arguments when passing boolean literals. --- README.md | 1 + src/CodeFormatter.cs | 21 +++++++++-------- src/Program.cs | 10 ++++++-- src/Resources.Designer.cs | 9 +++++++ src/Resources.resx | 3 +++ src/WorkspaceFormatResult.cs | 9 +++++++ src/xlf/Resources.cs.xlf | 5 ++++ src/xlf/Resources.de.xlf | 5 ++++ src/xlf/Resources.es.xlf | 5 ++++ src/xlf/Resources.fr.xlf | 5 ++++ src/xlf/Resources.it.xlf | 5 ++++ src/xlf/Resources.ja.xlf | 5 ++++ src/xlf/Resources.ko.xlf | 5 ++++ src/xlf/Resources.pl.xlf | 5 ++++ src/xlf/Resources.pt-BR.xlf | 5 ++++ src/xlf/Resources.ru.xlf | 5 ++++ src/xlf/Resources.tr.xlf | 5 ++++ src/xlf/Resources.zh-Hans.xlf | 5 ++++ src/xlf/Resources.zh-Hant.xlf | 5 ++++ tests/CodeFormatterTests.cs | 35 ++++++++++++++++++++-------- tests/ProgramTests.cs | 44 +++++++++++++++++++++++++++++++++++ 21 files changed, 175 insertions(+), 22 deletions(-) create mode 100644 src/WorkspaceFormatResult.cs create mode 100644 tests/ProgramTests.cs diff --git a/README.md b/README.md index 56dfd7295064..d5b41984376d 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ Options: the current directory for one. -v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + --check Terminate with non-zero exit code if any files formatted. --version Display version information ``` diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index c6e89651e690..f9762ecd298f 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -22,14 +22,17 @@ internal static class CodeFormatter { private const int MaxLoggedWorkspaceWarnings = 5; - public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, CancellationToken cancellationToken) + public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, CancellationToken cancellationToken) { logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, solutionOrProjectPath)); logger.LogTrace(Resources.Loading_workspace); var loggedWarningCount = 0; - var exitCode = 1; + var formatResult = new WorkspaceFormatResult() + { + ExitCode = 1 + }; var workspaceStopwatch = Stopwatch.StartNew(); var properties = new Dictionary(StringComparer.Ordinal) @@ -64,23 +67,21 @@ public static async Task FormatWorkspaceAsync(ILogger logger, string soluti catch (InvalidOperationException) { logger.LogError(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, solutionOrProjectPath); - return 1; + return formatResult; } } logger.LogTrace(Resources.Workspace_loaded_in_0_ms, workspaceStopwatch.ElapsedMilliseconds); workspaceStopwatch.Restart(); - int fileCount; - int filesFormatted; - (exitCode, fileCount, filesFormatted) = await FormatFilesInWorkspaceAsync(logger, workspace, projectPath, codingConventionsManager, saveFormattedFiles, cancellationToken).ConfigureAwait(false); + (formatResult.ExitCode, formatResult.FileCount, formatResult.FilesFormatted) = await FormatFilesInWorkspaceAsync(logger, workspace, projectPath, codingConventionsManager, saveFormattedFiles, cancellationToken).ConfigureAwait(false); - logger.LogDebug(Resources.Formatted_0_of_1_files_in_2_ms, filesFormatted, fileCount, workspaceStopwatch.ElapsedMilliseconds); + logger.LogDebug(Resources.Formatted_0_of_1_files_in_2_ms, formatResult.FilesFormatted, formatResult.FileCount, workspaceStopwatch.ElapsedMilliseconds); } logger.LogInformation(Resources.Format_complete); - return exitCode; + return formatResult; void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) { @@ -205,13 +206,13 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) return (formattedSolution, filesFormatted); } - private static Func IsCSharpCommentTrivia = + private static readonly Func IsCSharpCommentTrivia = (syntaxTrivia) => syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineCommentTrivia) || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineCommentTrivia) || syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineDocumentationCommentTrivia) || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineDocumentationCommentTrivia); - private static Func IsVisualBasicCommentTrivia = + private static readonly Func IsVisualBasicCommentTrivia = (syntaxTrivia) => syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia) || syntaxTrivia.IsKind(VisualBasic.SyntaxKind.DocumentationCommentTrivia); } diff --git a/src/Program.cs b/src/Program.cs index a5b2ed202430..ac167fd31d47 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -32,13 +32,14 @@ private static async Task Main(string[] args) .AddOption(new Option(new[] { "-w", "--workspace" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one, new Argument(() => null))) .AddOption(new Option(new[] { "-v", "--verbosity" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) .AddOption(new Option(new[] { "--dry-run" }, Resources.Format_files_but_do_not_save_changes_to_disk, new Argument())) + .AddOption(new Option(new[] { "--check" }, Resources.Terminate_with_non_zero_exit_code_if_any_files_formatted, new Argument())) .UseVersionOption() .Build(); return await parser.InvokeAsync(args).ConfigureAwait(false); } - public static async Task Run(string workspace, string verbosity, bool dryRun, IConsole console = null) + public static async Task Run(string workspace, string verbosity, bool dryRun, bool check, IConsole console = null) { var serviceCollection = new ServiceCollection(); var logLevel = GetLogLevel(verbosity); @@ -81,13 +82,15 @@ public static async Task Run(string workspace, string verbosity, bool dryRu Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); - return await CodeFormatter.FormatWorkspaceAsync( + var formatResult = await CodeFormatter.FormatWorkspaceAsync( logger, workspacePath, isSolution, logAllWorkspaceWarnings: logLevel == LogLevel.Trace, saveFormattedFiles: !dryRun, cancellationTokenSource.Token).ConfigureAwait(false); + + return GetExitCode(formatResult, check); } catch (FileNotFoundException fex) { @@ -107,6 +110,9 @@ public static async Task Run(string workspace, string verbosity, bool dryRu } } + public static int GetExitCode(WorkspaceFormatResult formatResult, bool check) => + !check ? formatResult.ExitCode : (formatResult.FilesFormatted == 0 ? 0 : 1); + private static LogLevel GetLogLevel(string verbosity) { switch (verbosity) diff --git a/src/Resources.Designer.cs b/src/Resources.Designer.cs index ae12cb1ac67c..b9e7f7f76e15 100644 --- a/src/Resources.Designer.cs +++ b/src/Resources.Designer.cs @@ -211,6 +211,15 @@ internal static string Skipping_referenced_project_0 { } } + /// + /// Looks up a localized string similar to Terminate with non-zero exit code if any files formatted.. + /// + internal static string Terminate_with_non_zero_exit_code_if_any_files_formatted { + get { + return ResourceManager.GetString("Terminate_with_non_zero_exit_code_if_any_files_formatted", resourceCulture); + } + } + /// /// Looks up a localized string similar to The file '{0}' does not appear to be a valid project or solution file.. /// diff --git a/src/Resources.resx b/src/Resources.resx index 8ecb26d9dc3c..d16251054342 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -183,4 +183,7 @@ Format files, but do not save changes to disk. + + Terminate with non-zero exit code if any files formatted. + \ No newline at end of file diff --git a/src/WorkspaceFormatResult.cs b/src/WorkspaceFormatResult.cs new file mode 100644 index 000000000000..14cd9469c786 --- /dev/null +++ b/src/WorkspaceFormatResult.cs @@ -0,0 +1,9 @@ +namespace Microsoft.CodeAnalysis.Tools +{ + internal class WorkspaceFormatResult + { + public int ExitCode { get; set; } + public int FilesFormatted { get; set; } + public int FileCount { get; set; } + } +} diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index f92b472a3a07..3660bcefafcb 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -82,6 +82,11 @@ Přeskočí se odkazovaný projekt {0}. + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. Soubor {0} zřejmě není platný soubor projektu nebo řešení. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index dcddb604d5e6..bfac756e62fb 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -82,6 +82,11 @@ Überspringen von referenziertem Projekt "{0}". + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index aa7d0cd8cba2..185b197fbcaa 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -82,6 +82,11 @@ Omitiendo projecto al que se hace referencia "{0}". + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. El archivo "{0}" no parece ser un proyecto o archivo de solución válido. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 8fdcf5207187..48abf6a02a08 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -82,6 +82,11 @@ Saut du projet référencé '{0}'. + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 9a3926d6fcea..3e621e4a87a3 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -82,6 +82,11 @@ Il progetto di riferimento '{0}' verrà ignorato. + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. Il file '{0}' non sembra essere un file di progetto o di soluzione valido. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 225626380cd3..bee5f53d9995 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -82,6 +82,11 @@ 参照プロジェクト '{0}' をスキップしています。 + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index e41d6dfec3c2..2c781fd8b9e2 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -82,6 +82,11 @@ 참조된 프로젝트 '{0}'을(를) 건너뜁니다. + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 0e94a846781e..a4c9e1f66aa6 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -82,6 +82,11 @@ Pomijanie przywoływanego projektu „{0}”. + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 9a75f91dc0ec..64ab7e6d3dde 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -82,6 +82,11 @@ Ignorando o projeto referenciado '{0}'. + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 5637d826ec82..052322c871be 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -82,6 +82,11 @@ Пропуск указанного проекта "{0}". + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. Файл "{0}" не является допустимым файлом проекта или решения. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 5bb74641d416..83a54d7b201a 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -82,6 +82,11 @@ Atlama projesi '{0}' başvuru. + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 0c189d4d5a74..234c1aabcc4f 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -82,6 +82,11 @@ 正在跳过引用的项目“{0}”。 + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. 文件“{0}”似乎不是有效的项目或解决方案文件。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index b91498926be7..58e656567d33 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -82,6 +82,11 @@ 跳過參考的專案 '{0}’。 + + Terminate with non-zero exit code if any files formatted. + Terminate with non-zero exit code if any files formatted. + + The file '{0}' does not appear to be a valid project or solution file. 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index efd2ca6010dc..1b65314ffe58 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -22,7 +22,7 @@ public async Task NoFilesFormattedInFormattedProject() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/formatted_project/formatted_project.csproj", SolutionPath); - var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); var log = logger.GetLog(); var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); var filesFormatted = new Regex(pattern, RegexOptions.Multiline); @@ -30,7 +30,10 @@ public async Task NoFilesFormattedInFormattedProject() Assert.True(match.Success, log); Assert.Equal("0", match.Groups[1].Value); - Assert.Equal(0, exitCode); + + Assert.Equal(0, formatResult.ExitCode); + Assert.Equal(0, formatResult.FilesFormatted); + Assert.Equal(3, formatResult.FileCount); } [Fact] @@ -39,13 +42,16 @@ public async Task NoFilesFormattedInFormattedSolution() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/formatted_solution/formatted_solution.sln", SolutionPath); - var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); var log = logger.GetLog(); var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); var filesFormatted = new Regex(pattern, RegexOptions.Multiline); var match = filesFormatted.Match(log); - Assert.Equal(0, exitCode); + Assert.Equal(0, formatResult.ExitCode); + Assert.Equal(0, formatResult.FilesFormatted); + Assert.Equal(3, formatResult.FileCount); + Assert.True(match.Success, log); Assert.Equal("0", match.Groups[1].Value); } @@ -56,7 +62,7 @@ public async Task FilesFormattedInUnformattedProject() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj", SolutionPath); - var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); var log = logger.GetLog(); var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); var filesFormatted = new Regex(pattern, RegexOptions.Multiline); @@ -64,7 +70,10 @@ public async Task FilesFormattedInUnformattedProject() Assert.True(match.Success, log); Assert.Equal("1", match.Groups[1].Value); - Assert.Equal(0, exitCode); + + Assert.Equal(0, formatResult.ExitCode); + Assert.Equal(1, formatResult.FilesFormatted); + Assert.Equal(3, formatResult.FileCount); } [Fact] @@ -73,13 +82,16 @@ public async Task FilesFormattedInUnformattedSolution() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln", SolutionPath); - var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); var log = logger.GetLog(); var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); var filesFormatted = new Regex(pattern, RegexOptions.Multiline); var match = filesFormatted.Match(log); - Assert.Equal(0, exitCode); + Assert.Equal(0, formatResult.ExitCode); + Assert.Equal(1, formatResult.FilesFormatted); + Assert.Equal(3, formatResult.FileCount); + Assert.True(match.Success, log); Assert.Equal("1", match.Groups[1].Value); } @@ -90,14 +102,17 @@ public async Task FSharpProjectsDoNotCreateException() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj", SolutionPath); - var exitCode = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); var logLines = logger.GetLog().Split(Environment.NewLine); Assert.Equal(4, logLines.Length); var actualErrorMessage = logLines[2]; var expectedErrorMessage = string.Format(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, path); Assert.Equal(expectedErrorMessage, actualErrorMessage); - Assert.Equal(1, exitCode); + + Assert.Equal(1, formatResult.ExitCode); + Assert.Equal(0, formatResult.FilesFormatted); + Assert.Equal(0, formatResult.FileCount); } } } diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs new file mode 100644 index 000000000000..1e21939658f6 --- /dev/null +++ b/tests/ProgramTests.cs @@ -0,0 +1,44 @@ +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests +{ + public class ProgramTests + { + [Fact] + public void ExitCodeIsOneWithCheckAndAnyFilesFormatted() + { + var formatResult = new WorkspaceFormatResult() + { + FilesFormatted = 1 + }; + var exitCode = Program.GetExitCode(formatResult, check: true); + + Assert.Equal(1, exitCode); + } + + [Fact] + public void ExitCodeIsZeroWithCheckAndNoFilesFormatted() + { + var formatResult = new WorkspaceFormatResult() + { + ExitCode = 42, + FilesFormatted = 0 + }; + var exitCode = Program.GetExitCode(formatResult, check: true); + + Assert.Equal(0, exitCode); + } + + [Fact] + public void ExitCodeIsSameWithoutCheck() + { + var formatResult = new WorkspaceFormatResult() + { + ExitCode = 42 + }; + var exitCode = Program.GetExitCode(formatResult, check: false); + + Assert.Equal(formatResult.ExitCode, exitCode); + } + } +} From aa690cdc50b0bd8a5513fdb75c4dd052239535a7 Mon Sep 17 00:00:00 2001 From: Chris Allen Date: Tue, 12 Mar 2019 21:00:59 -0600 Subject: [PATCH 0410/2702] added dry-run option to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d5b41984376d..e0b27fec01f0 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Options: -v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] --check Terminate with non-zero exit code if any files formatted. + --dry-run Format files, but do not save changes to disk. --version Display version information ``` From 8abcf508a670f24e504bd5954c11d6806d2b82bb Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 12 Mar 2019 20:34:39 -0700 Subject: [PATCH 0411/2702] update the language in the option description for --check --- README.md | 2 +- src/Program.cs | 2 +- src/Resources.Designer.cs | 7 ++++--- src/Resources.resx | 4 ++-- src/xlf/Resources.cs.xlf | 6 +++--- src/xlf/Resources.de.xlf | 6 +++--- src/xlf/Resources.es.xlf | 6 +++--- src/xlf/Resources.fr.xlf | 6 +++--- src/xlf/Resources.it.xlf | 6 +++--- src/xlf/Resources.ja.xlf | 6 +++--- src/xlf/Resources.ko.xlf | 6 +++--- src/xlf/Resources.pl.xlf | 6 +++--- src/xlf/Resources.pt-BR.xlf | 6 +++--- src/xlf/Resources.ru.xlf | 6 +++--- src/xlf/Resources.tr.xlf | 6 +++--- src/xlf/Resources.zh-Hans.xlf | 6 +++--- src/xlf/Resources.zh-Hant.xlf | 6 +++--- 17 files changed, 47 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index e0b27fec01f0..17a3c7fa8c2e 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,8 @@ Options: the current directory for one. -v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - --check Terminate with non-zero exit code if any files formatted. --dry-run Format files, but do not save changes to disk. + --check Terminate with non-zero exit code if any files need to be formatted in the workspace. --version Display version information ``` diff --git a/src/Program.cs b/src/Program.cs index ac167fd31d47..ebcefef64a02 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -32,7 +32,7 @@ private static async Task Main(string[] args) .AddOption(new Option(new[] { "-w", "--workspace" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one, new Argument(() => null))) .AddOption(new Option(new[] { "-v", "--verbosity" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) .AddOption(new Option(new[] { "--dry-run" }, Resources.Format_files_but_do_not_save_changes_to_disk, new Argument())) - .AddOption(new Option(new[] { "--check" }, Resources.Terminate_with_non_zero_exit_code_if_any_files_formatted, new Argument())) + .AddOption(new Option(new[] { "--check" }, Resources.Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_workspace, new Argument())) .UseVersionOption() .Build(); diff --git a/src/Resources.Designer.cs b/src/Resources.Designer.cs index b9e7f7f76e15..7d0fe78ad866 100644 --- a/src/Resources.Designer.cs +++ b/src/Resources.Designer.cs @@ -212,11 +212,12 @@ internal static string Skipping_referenced_project_0 { } /// - /// Looks up a localized string similar to Terminate with non-zero exit code if any files formatted.. + /// Looks up a localized string similar to Terminate with non-zero exit code if any files need to be formatted in the workspace.. /// - internal static string Terminate_with_non_zero_exit_code_if_any_files_formatted { + internal static string Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_workspace { get { - return ResourceManager.GetString("Terminate_with_non_zero_exit_code_if_any_files_formatted", resourceCulture); + return ResourceManager.GetString("Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_worksp" + + "ace", resourceCulture); } } diff --git a/src/Resources.resx b/src/Resources.resx index d16251054342..040391a4a219 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -183,7 +183,7 @@ Format files, but do not save changes to disk. - - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 3660bcefafcb..9d4310a86058 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -82,9 +82,9 @@ Přeskočí se odkazovaný projekt {0}. - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index bfac756e62fb..9023839c6ebd 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -82,9 +82,9 @@ Überspringen von referenziertem Projekt "{0}". - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 185b197fbcaa..d73a86eca438 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -82,9 +82,9 @@ Omitiendo projecto al que se hace referencia "{0}". - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 48abf6a02a08..19acbb5f16f5 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -82,9 +82,9 @@ Saut du projet référencé '{0}'. - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 3e621e4a87a3..3f3d41cb00d7 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -82,9 +82,9 @@ Il progetto di riferimento '{0}' verrà ignorato. - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index bee5f53d9995..3890ec94ca7d 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -82,9 +82,9 @@ 参照プロジェクト '{0}' をスキップしています。 - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 2c781fd8b9e2..1f84fc50eeae 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -82,9 +82,9 @@ 참조된 프로젝트 '{0}'을(를) 건너뜁니다. - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index a4c9e1f66aa6..620d01247c72 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -82,9 +82,9 @@ Pomijanie przywoływanego projektu „{0}”. - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 64ab7e6d3dde..9078908287d5 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -82,9 +82,9 @@ Ignorando o projeto referenciado '{0}'. - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 052322c871be..6a72556f5759 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -82,9 +82,9 @@ Пропуск указанного проекта "{0}". - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 83a54d7b201a..f095d9212d04 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -82,9 +82,9 @@ Atlama projesi '{0}' başvuru. - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 234c1aabcc4f..98a775765382 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -82,9 +82,9 @@ 正在跳过引用的项目“{0}”。 - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 58e656567d33..b3c3ae048bc4 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -82,9 +82,9 @@ 跳過參考的專案 '{0}’。 - - Terminate with non-zero exit code if any files formatted. - Terminate with non-zero exit code if any files formatted. + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. From ba48c24e548e4b570ff51efe94bf9bb35ebfc276 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 18 Mar 2019 22:02:36 +0000 Subject: [PATCH 0412/2702] Update dependencies from https://github.com/dotnet/arcade build 20190312.7 (#54) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19162.7 --- eng/Version.Details.xml | 7 ++++--- global.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 87b8ad3debcc..86148d7e37e3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,10 +1,11 @@ - + + - + https://github.com/dotnet/arcade - 2ca74c76adc84f0459b4a0352034db463d0b910f + 443dea11f8649fe12fedf60cfab0a4b2b20bd153 diff --git a/global.json b/global.json index e42e257d207e..1630d1f11adb 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19161.14" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19162.7" } } From 0949268e16a22aef0d7268cbee78b6ffee67f9e2 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 19 Mar 2019 09:51:31 -0700 Subject: [PATCH 0413/2702] Update LicenseExpression used when packaging --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3460172f4cd2..783068de0f10 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,6 +8,6 @@ $(CopyrightMicrosoft) - Apache-2.0 + MIT From 0e27b691ffc6aba9641aa8f1c3f50f0598010747 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 19 Mar 2019 14:00:44 -0700 Subject: [PATCH 0414/2702] Update dependencies from https://github.com/dotnet/arcade build 20190317.10 (#55) This change updates the following dependencies - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19167.10 --- eng/Version.Details.xml | 4 ++-- eng/common/PublishToPackageFeed.proj | 24 +++++++++++++++++-- eng/common/init-tools-native.ps1 | 14 +++++++++-- .../templates/job/publish-build-assets.yml | 1 + eng/common/templates/steps/send-to-helix.yml | 2 +- global.json | 2 +- 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 86148d7e37e3..5ec22ed8eb55 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 443dea11f8649fe12fedf60cfab0a4b2b20bd153 + de7be3ba62b92e5c48c36876c851a14f154444af diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj index b26d28a90b81..25362ff060c1 100644 --- a/eng/common/PublishToPackageFeed.proj +++ b/eng/common/PublishToPackageFeed.proj @@ -11,11 +11,17 @@ + + + - + @@ -26,7 +32,21 @@ - + + + + https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json + https://dotnetfeed.blob.core.windows.net/arcade-validation/index.json + + + + Date: Thu, 21 Mar 2019 12:51:32 +0000 Subject: [PATCH 0415/2702] Update dependencies from https://github.com/dotnet/arcade build 20190320.2 (#59) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19170.2 --- eng/Version.Details.xml | 4 +- eng/common/generate-graph-files.ps1 | 46 +++++++++++++++---- .../templates/job/publish-build-assets.yml | 5 +- eng/common/templates/jobs/jobs.yml | 4 ++ eng/common/templates/steps/send-to-helix.yml | 3 ++ global.json | 2 +- 6 files changed, 50 insertions(+), 14 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5ec22ed8eb55..59f95e93b396 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - de7be3ba62b92e5c48c36876c851a14f154444af + f70fa34786cff993625a4548ae0125335eabe82e diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1 index e09c64e9f6f4..76f57076a323 100644 --- a/eng/common/generate-graph-files.ps1 +++ b/eng/common/generate-graph-files.ps1 @@ -3,7 +3,8 @@ Param( [Parameter(Mandatory=$true)][string] $gitHubPat, # GitHub personal access token from https://github.com/settings/tokens (no auth scopes needed) [Parameter(Mandatory=$true)][string] $azdoPat, # Azure Dev Ops tokens from https://dev.azure.com/dnceng/_details/security/tokens (code read scope needed) [Parameter(Mandatory=$true)][string] $outputFolder, # Where the graphviz.txt file will be created - [string] $darcVersion = '1.1.0-beta.19156.4', # darc's version + [string] $darcVersion = '1.1.0-beta.19169.5', # darc's version + [string] $graphvizVersion = '2.38', # GraphViz version [switch] $includeToolset # Whether the graph should include toolset dependencies or not. i.e. arcade, optimization. For more about # toolset dependencies see https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#toolset-vs-product-dependencies ) @@ -11,6 +12,8 @@ Param( $ErrorActionPreference = "Stop" . $PSScriptRoot\tools.ps1 +Import-Module -Name (Join-Path $PSScriptRoot "native\CommonLibrary.psm1") + function CheckExitCode ([string]$stage) { $exitCode = $LASTEXITCODE @@ -27,27 +30,48 @@ try { . .\darc-init.ps1 -darcVersion $darcVersion CheckExitCode "Running darc-init" + $engCommonBaseDir = Join-Path $PSScriptRoot "native\" + $graphvizInstallDir = CommonLibrary\Get-NativeInstallDirectory + $nativeToolBaseUri = "https://netcorenativeassets.blob.core.windows.net/resource-packages/external" + $installBin = Join-Path $graphvizInstallDir "bin" + + Write-Host "Installing dot..." + .\native\install-tool.ps1 -ToolName graphviz -InstallPath $installBin -BaseUri $nativeToolBaseUri -CommonLibraryDirectory $engCommonBaseDir -Version $graphvizVersion -Verbose + $darcExe = "$env:USERPROFILE\.dotnet\tools" $darcExe = Resolve-Path "$darcExe\darc.exe" Create-Directory $outputFolder + # Generate 3 graph descriptions: + # 1. Flat with coherency information + # 2. Graphviz (dot) file + # 3. Standard dependency graph $graphVizFilePath = "$outputFolder\graphviz.txt" - $graphFilePath = "$outputFolder\graph.txt" - $options = "get-dependency-graph --graphviz '$graphVizFilePath' --github-pat $gitHubPat --azdev-pat $azdoPat --password $barToken --output-file $graphFilePath" + $graphVizImageFilePath = "$outputFolder\graph.png" + $normalGraphFilePath = "$outputFolder\graph-full.txt" + $flatGraphFilePath = "$outputFolder\graph-flat.txt" + $baseOptions = "get-dependency-graph --github-pat $gitHubPat --azdev-pat $azdoPat --password $barToken" if ($includeToolset) { Write-Host "Toolsets will be included in the graph..." - $options += " --include-toolset" + $baseOptions += " --include-toolset" } - Write-Host "Generating dependency graph..." - Invoke-Expression "& `"$darcExe`" $options" - CheckExitCode "Generating dependency graph" + Write-Host "Generating standard dependency graph..." + Invoke-Expression "& `"$darcExe`" $baseOptions --output-file $normalGraphFilePath" + CheckExitCode "Generating normal dependency graph" + + Write-Host "Generating flat dependency graph and graphviz file..." + Invoke-Expression "& `"$darcExe`" $baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath" + CheckExitCode "Generating flat and graphviz dependency graph" + + Write-Host "Generating graph image $graphVizFilePath" + $dotFilePath = Join-Path $installBin "graphviz\$graphvizVersion\release\bin\dot.exe" + Invoke-Expression "& `"$dotFilePath`" -Tpng -o'$graphVizImageFilePath' `"$graphVizFilePath`"" + CheckExitCode "Generating graphviz image" - $graph = Get-Content $graphVizFilePath - Set-Content $graphVizFilePath -Value "Paste the following digraph object in http://www.webgraphviz.com `r`n", $graph - Write-Host "'$graphVizFilePath' and '$graphFilePath' created!" + Write-Host "'$graphVizFilePath', '$flatGraphFilePath', '$normalGraphFilePath' and '$graphVizImageFilePath' created!" } catch { if (!$includeToolset) { @@ -58,4 +82,6 @@ catch { Write-Host $_.Exception Write-Host $_.ScriptStackTrace ExitWithExitCode 1 +} finally { + Pop-Location } \ No newline at end of file diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 83646c643882..620bd3c62e78 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -20,6 +20,9 @@ parameters: # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. runAsPublic: false + # Optional: whether the build's artifacts will be published using release pipelines or direct feed publishing + publishUsingPipelines: false + jobs: - job: Asset_Registry_Publish @@ -52,7 +55,7 @@ jobs: /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com - /p:PublishUsingPipelines=$(_PublishUsingPipelines) + /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:Configuration=$(_BuildConfig) condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 06ed58de41f3..6a2f98c036f6 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -13,6 +13,9 @@ parameters: # Optional: Enable publishing to the build asset registry enablePublishBuildAssets: false + + # Optional: Enable publishing using release pipelines + enablePublishUsingPipelines: false graphFileGeneration: # Optional: Enable generating the graph files at the end of the build @@ -73,6 +76,7 @@ jobs: pool: vmImage: vs2017-win2016 runAsPublic: ${{ parameters.runAsPublic }} + publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} - ${{ if and(eq(parameters.graphFileGeneration.enabled, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 45d63fbc3890..0187597681e3 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -11,6 +11,7 @@ parameters: WorkItemTimeout: '' # optional -- a timeout in seconds for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true + XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects @@ -42,6 +43,7 @@ steps: WorkItemTimeout: ${{ parameters.WorkItemTimeout }} CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} @@ -70,6 +72,7 @@ steps: WorkItemTimeout: ${{ parameters.WorkItemTimeout }} CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} XUnitProjects: ${{ parameters.XUnitProjects }} + XUnitWorkItemTimeout: ${{ parameters.XUnitWorkItemTimeout }} XUnitPublishTargetFramework: ${{ parameters.XUnitPublishTargetFramework }} XUnitRuntimeTargetFramework: ${{ parameters.XUnitRuntimeTargetFramework }} XUnitRunnerVersion: ${{ parameters.XUnitRunnerVersion }} diff --git a/global.json b/global.json index 966f452a11b4..19ae070f9fcd 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19167.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19170.2" } } From 822c03662c5331c9a6beb8a8754e28ef8a00fdcf Mon Sep 17 00:00:00 2001 From: Chris Allen <30563180+challen0@users.noreply.github.com> Date: Thu, 21 Mar 2019 12:31:12 -0600 Subject: [PATCH 0416/2702] Added files option (#52) * added files option resource * added files option * convert string from cli into an array of paths * pass list of files into formatter * added default value if files option isn't present * need to check if files argument is null * moved where file list is created * added null file list to existing tests * skip a document if the path is in the list * added test for files option with a list of files * fixed xlf files * added files option to readme * use unformatted project * moved extra file into unformatted project * deleted new project * fixed tests since adding new file to unformatted project * added a test for a file in the list that doesn't exist * ignore case when comparing paths * break after finding file * convert loop to linq * new resource missing from two xlf files * removed directory from test file path * use GetRelativePath to fix directory separators * added test for directory separator insensitivity * moved fixing path separators to when the list is split * removed failing test since code moved * make GetFileList internal for future test * added new test for directory separator insensitivity --- README.md | 1 + src/CodeFormatter.cs | 23 ++++-- src/Program.cs | 11 ++- src/Resources.Designer.cs | 10 +++ src/Resources.resx | 3 + src/xlf/Resources.cs.xlf | 5 ++ src/xlf/Resources.de.xlf | 5 ++ src/xlf/Resources.es.xlf | 5 ++ src/xlf/Resources.fr.xlf | 5 ++ src/xlf/Resources.it.xlf | 5 ++ src/xlf/Resources.ja.xlf | 5 ++ src/xlf/Resources.ko.xlf | 5 ++ src/xlf/Resources.pl.xlf | 5 ++ src/xlf/Resources.pt-BR.xlf | 5 ++ src/xlf/Resources.ru.xlf | 5 ++ src/xlf/Resources.tr.xlf | 5 ++ src/xlf/Resources.zh-Hans.xlf | 5 ++ src/xlf/Resources.zh-Hant.xlf | 5 ++ tests/CodeFormatterTests.cs | 70 +++++++++++++++---- tests/ProgramTests.cs | 15 +++- .../other_items/OtherClass.cs | 12 ++++ 21 files changed, 188 insertions(+), 22 deletions(-) create mode 100644 tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs diff --git a/README.md b/README.md index 17a3c7fa8c2e..df99ba178fb9 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Options: diag[nostic] --dry-run Format files, but do not save changes to disk. --check Terminate with non-zero exit code if any files need to be formatted in the workspace. + --files The files to operate on. If none specified, all files in workspace will be operated on. --version Display version information ``` diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index f9762ecd298f..2f8849e15bcd 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -1,10 +1,11 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.IO; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeStyle; @@ -22,7 +23,7 @@ internal static class CodeFormatter { private const int MaxLoggedWorkspaceWarnings = 5; - public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, CancellationToken cancellationToken) + public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, string[] filesToFormat, CancellationToken cancellationToken) { logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, solutionOrProjectPath)); @@ -74,7 +75,7 @@ public static async Task FormatWorkspaceAsync(ILogger log logger.LogTrace(Resources.Workspace_loaded_in_0_ms, workspaceStopwatch.ElapsedMilliseconds); workspaceStopwatch.Restart(); - (formatResult.ExitCode, formatResult.FileCount, formatResult.FilesFormatted) = await FormatFilesInWorkspaceAsync(logger, workspace, projectPath, codingConventionsManager, saveFormattedFiles, cancellationToken).ConfigureAwait(false); + (formatResult.ExitCode, formatResult.FileCount, formatResult.FilesFormatted) = await FormatFilesInWorkspaceAsync(logger, workspace, projectPath, codingConventionsManager, saveFormattedFiles, filesToFormat, cancellationToken).ConfigureAwait(false); logger.LogDebug(Resources.Formatted_0_of_1_files_in_2_ms, formatResult.FilesFormatted, formatResult.FileCount, workspaceStopwatch.ElapsedMilliseconds); } @@ -105,7 +106,7 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) } } - private static async Task<(int status, int fileCount, int filesFormatted)> FormatFilesInWorkspaceAsync(ILogger logger, Workspace workspace, string projectPath, ICodingConventionsManager codingConventionsManager, bool saveFormattedFiles, CancellationToken cancellationToken) + private static async Task<(int status, int fileCount, int filesFormatted)> FormatFilesInWorkspaceAsync(ILogger logger, Workspace workspace, string projectPath, ICodingConventionsManager codingConventionsManager, bool saveFormattedFiles, string[] filesToFormat, CancellationToken cancellationToken) { var projectIds = workspace.CurrentSolution.ProjectIds.ToImmutableArray(); var optionsApplier = new EditorConfigOptionsApplier(); @@ -129,7 +130,7 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) logger.LogInformation(Resources.Formatting_code_files_in_project_0, project.Name); - var (formattedSolution, filesFormatted) = await FormatFilesInProjectAsync(logger, project, codingConventionsManager, optionsApplier, cancellationToken).ConfigureAwait(false); + var (formattedSolution, filesFormatted) = await FormatFilesInProjectAsync(logger, project, codingConventionsManager, optionsApplier, filesToFormat, cancellationToken).ConfigureAwait(false); totalFileCount += project.DocumentIds.Count; totalFilesFormatted += filesFormatted; if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution)) @@ -142,7 +143,7 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) return (0, totalFileCount, totalFilesFormatted); } - private static async Task<(Solution solution, int filesFormatted)> FormatFilesInProjectAsync(ILogger logger, Project project, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, CancellationToken cancellationToken) + private static async Task<(Solution solution, int filesFormatted)> FormatFilesInProjectAsync(ILogger logger, Project project, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, string[] filesToFormat, CancellationToken cancellationToken) { var isCommentTrivia = project.Language == LanguageNames.CSharp ? IsCSharpCommentTrivia @@ -157,6 +158,16 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) continue; } + if (filesToFormat != null) + { + var fileInArgumentList = filesToFormat.Any(relativePath => document.FilePath.EndsWith(relativePath, StringComparison.OrdinalIgnoreCase)); + + if (!fileInArgumentList) + { + continue; + } + } + var formatTask = Task.Run(async () => { var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); diff --git a/src/Program.cs b/src/Program.cs index ebcefef64a02..e406c9f0f189 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -33,13 +33,14 @@ private static async Task Main(string[] args) .AddOption(new Option(new[] { "-v", "--verbosity" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) .AddOption(new Option(new[] { "--dry-run" }, Resources.Format_files_but_do_not_save_changes_to_disk, new Argument())) .AddOption(new Option(new[] { "--check" }, Resources.Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_workspace, new Argument())) + .AddOption(new Option(new[] { "--files" }, Resources.The_files_to_operate_on_If_none_specified_all_files_in_workspace_will_be_operated_on, new Argument(() => null))) .UseVersionOption() .Build(); return await parser.InvokeAsync(args).ConfigureAwait(false); } - public static async Task Run(string workspace, string verbosity, bool dryRun, bool check, IConsole console = null) + public static async Task Run(string workspace, string verbosity, bool dryRun, bool check, string files, IConsole console = null) { var serviceCollection = new ServiceCollection(); var logLevel = GetLogLevel(verbosity); @@ -70,6 +71,8 @@ public static async Task Run(string workspace, string verbosity, bool dryRu var workspaceDirectory = Path.GetDirectoryName(workspacePath); Environment.CurrentDirectory = workingDirectory; + var fileList = GetFileList(files); + // Since we are running as a dotnet tool we should be able to find an instance of // MSBuild in a .NET Core SDK. var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); @@ -88,6 +91,7 @@ public static async Task Run(string workspace, string verbosity, bool dryRu isSolution, logAllWorkspaceWarnings: logLevel == LogLevel.Trace, saveFormattedFiles: !dryRun, + filesToFormat: fileList, cancellationTokenSource.Token).ConfigureAwait(false); return GetExitCode(formatResult, check); @@ -142,5 +146,10 @@ private static void ConfigureServices(ServiceCollection serviceCollection, ICons serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, logLevel)); serviceCollection.AddLogging(); } + + internal static string[] GetFileList(string files) + { + return files?.Split(',').Select(path => Path.GetRelativePath(Environment.CurrentDirectory, path)).ToArray(); + } } } diff --git a/src/Resources.Designer.cs b/src/Resources.Designer.cs index 7d0fe78ad866..b3dfbc6cac02 100644 --- a/src/Resources.Designer.cs +++ b/src/Resources.Designer.cs @@ -275,5 +275,15 @@ internal static string Workspace_loaded_in_0_ms { return ResourceManager.GetString("Workspace_loaded_in_0_ms", resourceCulture); } } + + /// + /// Looks up a localized string similar to The files to operate on. If none specified, all files in workspace will be operated on.. + /// + internal static string The_files_to_operate_on_If_none_specified_all_files_in_workspace_will_be_operated_on { + get { + return ResourceManager.GetString("The_files_to_operate_on_If_none_specified_all_files_in_workspace_will_be_operated" + + "_on", resourceCulture); + } + } } } diff --git a/src/Resources.resx b/src/Resources.resx index 040391a4a219..ab3587660d12 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -186,4 +186,7 @@ Terminate with non-zero exit code if any files need to be formatted in the workspace. + + The files to operate on. If none specified, all files in workspace will be operated on. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 9d4310a86058..7fa21de30bbf 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -117,6 +117,11 @@ Pracovní prostor se načetl za {0} ms. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 9023839c6ebd..f9923c59b3ad 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -117,6 +117,11 @@ Arbeitsbereich in {0} ms geladen. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index d73a86eca438..a2aa4421a4f1 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -117,6 +117,11 @@ Espacio de trabajo cargado en {0} ms. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 19acbb5f16f5..9878e17fc2e5 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -117,6 +117,11 @@ Espace de travail chargé en {0} ms. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 3f3d41cb00d7..e71378f5d158 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -117,6 +117,11 @@ Area di lavoro caricata in {0} ms. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 3890ec94ca7d..3772565f755c 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -117,6 +117,11 @@ ワークスペース {0} ミリ秒で読み込まれます。 + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 1f84fc50eeae..57d0f2f10651 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -117,6 +117,11 @@ 작업 영역이 {0}밀리초 안에 로드되었습니다. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 620d01247c72..247f8455a5ae 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -117,6 +117,11 @@ Obszar roboczy załadowano w {0} ms. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 9078908287d5..9d88bdf1c8d3 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -117,6 +117,11 @@ Espaço de trabalho carregado em {0}ms. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 6a72556f5759..1f3d77537e33 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -117,6 +117,11 @@ Рабочая область загружена за {0} мс. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index f095d9212d04..d274419d0799 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -117,6 +117,11 @@ Çalışma alanı {0} ms yüklü. + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 98a775765382..d20aacc10868 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -117,6 +117,11 @@ 工作区已在 {0} 毫秒内加载完毕。 + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index b3c3ae048bc4..d5791b193695 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -117,6 +117,11 @@ {0} 毫秒內載入的工作區。 + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + \ No newline at end of file diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 1b65314ffe58..b6b45477cb45 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -22,7 +22,7 @@ public async Task NoFilesFormattedInFormattedProject() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/formatted_project/formatted_project.csproj", SolutionPath); - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); var log = logger.GetLog(); var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); var filesFormatted = new Regex(pattern, RegexOptions.Multiline); @@ -42,8 +42,8 @@ public async Task NoFilesFormattedInFormattedSolution() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/formatted_solution/formatted_solution.sln", SolutionPath); - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); + var log = logger.GetLog(); var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); var filesFormatted = new Regex(pattern, RegexOptions.Multiline); var match = filesFormatted.Match(log); @@ -62,18 +62,18 @@ public async Task FilesFormattedInUnformattedProject() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj", SolutionPath); - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); + var log = logger.GetLog(); var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); var filesFormatted = new Regex(pattern, RegexOptions.Multiline); var match = filesFormatted.Match(log); Assert.True(match.Success, log); - Assert.Equal("1", match.Groups[1].Value); + Assert.Equal("2", match.Groups[1].Value); Assert.Equal(0, formatResult.ExitCode); - Assert.Equal(1, formatResult.FilesFormatted); - Assert.Equal(3, formatResult.FileCount); + Assert.Equal(2, formatResult.FilesFormatted); + Assert.Equal(4, formatResult.FileCount); } [Fact] @@ -82,18 +82,18 @@ public async Task FilesFormattedInUnformattedSolution() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln", SolutionPath); - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); + var log = logger.GetLog(); var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); var filesFormatted = new Regex(pattern, RegexOptions.Multiline); var match = filesFormatted.Match(log); Assert.Equal(0, formatResult.ExitCode); - Assert.Equal(1, formatResult.FilesFormatted); - Assert.Equal(3, formatResult.FileCount); + Assert.Equal(2, formatResult.FilesFormatted); + Assert.Equal(4, formatResult.FileCount); Assert.True(match.Success, log); - Assert.Equal("1", match.Groups[1].Value); + Assert.Equal("2", match.Groups[1].Value); } [Fact] @@ -102,7 +102,7 @@ public async Task FSharpProjectsDoNotCreateException() var logger = new TestLogger(); var path = Path.GetFullPath("tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj", SolutionPath); - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, cancellationToken: CancellationToken.None); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); var logLines = logger.GetLog().Split(Environment.NewLine); Assert.Equal(4, logLines.Length); @@ -114,5 +114,47 @@ public async Task FSharpProjectsDoNotCreateException() Assert.Equal(0, formatResult.FilesFormatted); Assert.Equal(0, formatResult.FileCount); } + + [Fact] + public async Task OnlyFormatFilesFromList() + { + var logger = new TestLogger(); + var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj", SolutionPath); + + var files = new[] {"OtherClass.cs"}; + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: files, cancellationToken: CancellationToken.None); + var log = logger.GetLog(); + var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); + var filesFormatted = new Regex(pattern, RegexOptions.Multiline); + var match = filesFormatted.Match(log); + + Assert.True(match.Success, log); + Assert.Equal("1", match.Groups[1].Value); + + Assert.Equal(0, formatResult.ExitCode); + Assert.Equal(1, formatResult.FilesFormatted); + Assert.Equal(4, formatResult.FileCount); + } + + [Fact] + public async Task NoFilesFormattedWhenNotInList() + { + var logger = new TestLogger(); + var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj", SolutionPath); + + var files = new[] {"ThisFileDoesNotExist.cs"}; + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: files, cancellationToken: CancellationToken.None); + var log = logger.GetLog(); + var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); + var filesFormatted = new Regex(pattern, RegexOptions.Multiline); + var match = filesFormatted.Match(log); + + Assert.True(match.Success, log); + Assert.Equal("0", match.Groups[1].Value); + + Assert.Equal(0, formatResult.ExitCode); + Assert.Equal(0, formatResult.FilesFormatted); + Assert.Equal(4, formatResult.FileCount); + } } } diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 1e21939658f6..9cbdd5870fc0 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -1,4 +1,5 @@ -using Xunit; +using System.IO; +using Xunit; namespace Microsoft.CodeAnalysis.Tools.Tests { @@ -40,5 +41,17 @@ public void ExitCodeIsSameWithoutCheck() Assert.Equal(formatResult.ExitCode, exitCode); } + + [Fact] + public void FilesFormattedDirectorySeparatorInsensitive() + { + var filePath = $"other_items{Path.DirectorySeparatorChar}OtherClass.cs"; + var files = Program.GetFileList(filePath); + + var filePathAlt = $"other_items{Path.AltDirectorySeparatorChar}OtherClass.cs"; + var filesAlt = Program.GetFileList(filePathAlt); + + Assert.True(files[0] == filesAlt[0]); + } } } diff --git a/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs b/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs new file mode 100644 index 000000000000..e4cfa76c0046 --- /dev/null +++ b/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs @@ -0,0 +1,12 @@ +using System; + +namespace for_code_formatter +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} From 7e0a7815a5f098bfce66f53627f7f9408b18f770 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 22 Mar 2019 12:52:20 +0000 Subject: [PATCH 0417/2702] Update dependencies from https://github.com/dotnet/arcade build 20190321.3 (#62) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19171.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 59f95e93b396..5ea98bd6922e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - f70fa34786cff993625a4548ae0125335eabe82e + b3bcf3034ff395bd09066114379ec64736b13633 diff --git a/global.json b/global.json index 19ae070f9fcd..b6e737cf5a0d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19170.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19171.3" } } From 0636e5ca450ac6764c4a2ce7b623814cd5b67619 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 23 Mar 2019 12:54:46 +0000 Subject: [PATCH 0418/2702] Update dependencies from https://github.com/dotnet/arcade build 20190321.6 (#63) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19171.6 --- eng/Version.Details.xml | 4 ++-- eng/common/generate-graph-files.ps1 | 2 +- eng/common/templates/steps/send-to-helix.yml | 3 ++- global.json | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5ea98bd6922e..881450e5c239 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - b3bcf3034ff395bd09066114379ec64736b13633 + 2eb45ff0eed6f86f1071b16b11a447cadeeeec59 diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1 index 76f57076a323..b8dae49cde86 100644 --- a/eng/common/generate-graph-files.ps1 +++ b/eng/common/generate-graph-files.ps1 @@ -3,7 +3,7 @@ Param( [Parameter(Mandatory=$true)][string] $gitHubPat, # GitHub personal access token from https://github.com/settings/tokens (no auth scopes needed) [Parameter(Mandatory=$true)][string] $azdoPat, # Azure Dev Ops tokens from https://dev.azure.com/dnceng/_details/security/tokens (code read scope needed) [Parameter(Mandatory=$true)][string] $outputFolder, # Where the graphviz.txt file will be created - [string] $darcVersion = '1.1.0-beta.19169.5', # darc's version + [string] $darcVersion = '1.1.0-beta.19171.6', # darc's version [string] $graphvizVersion = '2.38', # GraphViz version [switch] $includeToolset # Whether the graph should include toolset dependencies or not. i.e. arcade, optimization. For more about # toolset dependencies see https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#toolset-vs-product-dependencies diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 0187597681e3..7c185e94147a 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -1,3 +1,4 @@ +# Please remember to update the documentation if you make changes to these parameters! parameters: HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' @@ -84,4 +85,4 @@ steps: Creator: ${{ parameters.Creator }} SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} \ No newline at end of file + continueOnError: ${{ parameters.continueOnError }} diff --git a/global.json b/global.json index b6e737cf5a0d..1e5b8b00a17c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19171.3" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19171.6" } } From d3d143f22d567d6c6f7816872b3a6e7ddfeb2a9b Mon Sep 17 00:00:00 2001 From: Chris Allen <30563180+challen0@users.noreply.github.com> Date: Sat, 23 Mar 2019 21:32:29 -0600 Subject: [PATCH 0419/2702] Log formatted files (#61) * added resource messages for formatted file * log info message when file formatted * added test to only log formatted files * update test to find file name in match * aligned text in resource files --- src/CodeFormatter.cs | 2 ++ src/Resources.Designer.cs | 9 +++++++++ src/Resources.resx | 3 +++ src/xlf/Resources.cs.xlf | 5 +++++ src/xlf/Resources.de.xlf | 5 +++++ src/xlf/Resources.es.xlf | 5 +++++ src/xlf/Resources.fr.xlf | 5 +++++ src/xlf/Resources.it.xlf | 5 +++++ src/xlf/Resources.ja.xlf | 5 +++++ src/xlf/Resources.ko.xlf | 5 +++++ src/xlf/Resources.pl.xlf | 5 +++++ src/xlf/Resources.pt-BR.xlf | 5 +++++ src/xlf/Resources.ru.xlf | 5 +++++ src/xlf/Resources.tr.xlf | 5 +++++ src/xlf/Resources.zh-Hans.xlf | 5 +++++ src/xlf/Resources.zh-Hant.xlf | 5 +++++ tests/CodeFormatterTests.cs | 18 ++++++++++++++++++ 17 files changed, 97 insertions(+) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 2f8849e15bcd..bc85ff3dd746 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -194,6 +194,8 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) return null; } + logger.LogInformation(Resources.Formatted_code_file_0, Path.GetFileName(document.FilePath)); + return formattedSourceText; }, cancellationToken); diff --git a/src/Resources.Designer.cs b/src/Resources.Designer.cs index b3dfbc6cac02..e84f94a5e1ab 100644 --- a/src/Resources.Designer.cs +++ b/src/Resources.Designer.cs @@ -285,5 +285,14 @@ internal static string The_files_to_operate_on_If_none_specified_all_files_in_wo "_on", resourceCulture); } } + + /// + /// Looks up a localized string similar to Formatted code file '{0}'.. + /// + internal static string Formatted_code_file_0 { + get { + return ResourceManager.GetString("Formatted_code_file_0", resourceCulture); + } + } } } diff --git a/src/Resources.resx b/src/Resources.resx index ab3587660d12..02c11c1e7087 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -189,4 +189,7 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 7fa21de30bbf..9ad94ef673d8 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index f9923c59b3ad..3e9e89dfa29a 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index a2aa4421a4f1..a49b87da24d3 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 9878e17fc2e5..7e7eb5756348 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index e71378f5d158..45c0db5f0f40 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 3772565f755c..5d09465ef7f0 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 57d0f2f10651..f2480d15e4d6 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 247f8455a5ae..dc0259e1f7fe 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 9d88bdf1c8d3..9f124d026da3 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 1f3d77537e33..30ef8f7913bf 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index d274419d0799..63e8d0493f28 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index d20aacc10868..09d5aa4eafc5 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index d5791b193695..2bc2acdbf30d 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -122,6 +122,11 @@ The files to operate on. If none specified, all files in workspace will be operated on. + + Formatted code file '{0}'. + Formatted code file '{0}'. + + \ No newline at end of file diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index b6b45477cb45..f74630bf1f92 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -156,5 +156,23 @@ public async Task NoFilesFormattedWhenNotInList() Assert.Equal(0, formatResult.FilesFormatted); Assert.Equal(4, formatResult.FileCount); } + + [Fact] + public async Task OnlyLogFormattedFiles() + { + var logger = new TestLogger(); + var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln", SolutionPath); + + var files = new[] {"Program.cs"}; + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: files, cancellationToken: CancellationToken.None); + var log = logger.GetLog(); + + var pattern = string.Format(Resources.Formatted_code_file_0, @"(.*)"); + var fileFormatted = new Regex(pattern, RegexOptions.Multiline); + var match = fileFormatted.Match(log); + + Assert.True(match.Success, log); + Assert.Equal("Program.cs", match.Groups[1].Value); + } } } From c0f612660ba2aff95939f5474e3f233d5d679a70 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 25 Mar 2019 13:37:03 -0500 Subject: [PATCH 0420/2702] Add .gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..176a458f94e0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto From 1976d12cd6f30a53a7f0ec57a51b0a69489584fe Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Mon, 25 Mar 2019 13:40:33 -0500 Subject: [PATCH 0421/2702] Normalize source files --- README.md | 166 +- azure-pipelines-official.yml | 144 +- format.sln | 96 +- src/CodeFormatter.cs | 464 ++--- src/EditorConfigOptionsApplier.cs | 186 +- src/Logging/SimpleConsoleLogger.cs | 156 +- .../SimpleConsoleLoggerFactoryExtensions.cs | 32 +- src/Logging/SimpleConsoleLoggerProvider.cs | 56 +- src/MSBuild/MSBuildWorkspaceFinder.cs | 206 +-- src/Program.cs | 310 ++-- src/Resources.Designer.cs | 596 +++---- src/Resources.resx | 388 ++--- src/Utilities/FileNameUtilities.cs | 366 ++-- src/Utilities/GeneratedCodeUtilities.cs | 220 +-- src/Utilities/Hash.cs | 734 ++++---- src/Utilities/PathKind.cs | 84 +- src/Utilities/PathUtilities.cs | 1498 ++++++++--------- src/Utilities/PlatformInformation.cs | 66 +- src/Utilities/ProcessRunner.cs | 392 ++--- src/WorkspaceFormatResult.cs | 18 +- src/dotnet-format.csproj | 120 +- src/runtimeconfig.template.json | 4 +- src/xlf/Resources.cs.xlf | 262 +-- src/xlf/Resources.de.xlf | 262 +-- src/xlf/Resources.es.xlf | 262 +-- src/xlf/Resources.fr.xlf | 262 +-- src/xlf/Resources.it.xlf | 262 +-- src/xlf/Resources.ja.xlf | 262 +-- src/xlf/Resources.ko.xlf | 262 +-- src/xlf/Resources.pl.xlf | 262 +-- src/xlf/Resources.pt-BR.xlf | 262 +-- src/xlf/Resources.ru.xlf | 262 +-- src/xlf/Resources.tr.xlf | 262 +-- src/xlf/Resources.zh-Hans.xlf | 262 +-- src/xlf/Resources.zh-Hant.xlf | 262 +-- tests/MSBuildWorkspaceFinderTests.cs | 212 +-- tests/ProgramTests.cs | 114 +- tests/dotnet-format.UnitTests.csproj | 46 +- .../fsharp_project/Program.fs | 16 +- .../fsharp_project/fsharp_project.fsproj | 22 +- 40 files changed, 5059 insertions(+), 5059 deletions(-) diff --git a/README.md b/README.md index df99ba178fb9..a3d85ad24501 100644 --- a/README.md +++ b/README.md @@ -1,83 +1,83 @@ -## dotnet-format - -[![Nuget](https://img.shields.io/nuget/v/dotnet-format.svg)](https://www.nuget.org/packages/dotnet-format) - -[![MyGet](https://img.shields.io/dotnet.myget/format/vpre/dotnet-format.svg?label=myget)](https://dotnet.myget.org/feed/format/package/nuget/dotnet-format) - -|Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) | Localization (Debug) | Localization (Release) | -|---|:--:|:--:|:--:|:--:|:--:|:--:| -[master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)| - - -`dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](https://github.com/dotnet/format/wiki/Supported-.editorconfig-options). - -### How To Install - -The `dotnet-format` nuget package is [published to nuget.org](https://www.nuget.org/packages/dotnet-format/). - -You can install the tool using the following command. - -```console -dotnet tool install -g dotnet-format -``` - -#### Installing Development Builds - -Development builds of `dotnet-format` are being hosted on myget. You can visit the [dotnet-format myget page](https://dotnet.myget.org/feed/format/package/nuget/dotnet-format) to get the latest version number. - -You can install the tool using the following command. - -```console -dotnet tool install -g dotnet-format --version 3.0.0-prerelease.19119.4 --add-source https://dotnet.myget.org/F/format/api/v3/index.json -``` - -### How To Use - -By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory you will need to specify the workspace to format using the `-w` option. You can control how verbose the output will be by using the `-v` option. - -``` -Usage: - dotnet-format [options] - -Options: - -w, --workspace The solution or project file to operate on. If a file is not specified, the command will search - the current directory for one. - -v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and - diag[nostic] - --dry-run Format files, but do not save changes to disk. - --check Terminate with non-zero exit code if any files need to be formatted in the workspace. - --files The files to operate on. If none specified, all files in workspace will be operated on. - --version Display version information -``` - -Add `format` after `dotnet` and before the command arguments that you want to run: - -| Examples | -| -------------------------------------------------------- | -| dotnet **format** | -| dotnet **format** -w <workspace> | -| dotnet **format** -v diag | -| dotnet **format** -w <workspace> -v diag | - -### How To Uninstall - -You can uninstall the tool using the following command. - -```console -dotnet tool uninstall -g dotnet-format -``` - -### How To Build From Source - -You can build and package the tool using the following commands. The instructions assume that you are in the root of the repository. - -```console -build -pack -# The final line from the build will read something like -# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.3.0.0-dev.nupkg'. -# Use the value that is in the form `3.0.0-dev` as the version in the next command. -dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version -dotnet format -``` - -> Note: On macOS and Linux, `.\artifacts` will need be switched to `./artifacts` to accommodate for the different slash directions. +## dotnet-format + +[![Nuget](https://img.shields.io/nuget/v/dotnet-format.svg)](https://www.nuget.org/packages/dotnet-format) + +[![MyGet](https://img.shields.io/dotnet.myget/format/vpre/dotnet-format.svg?label=myget)](https://dotnet.myget.org/feed/format/package/nuget/dotnet-format) + +|Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) | Localization (Debug) | Localization (Release) | +|---|:--:|:--:|:--:|:--:|:--:|:--:| +[master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)| + + +`dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](https://github.com/dotnet/format/wiki/Supported-.editorconfig-options). + +### How To Install + +The `dotnet-format` nuget package is [published to nuget.org](https://www.nuget.org/packages/dotnet-format/). + +You can install the tool using the following command. + +```console +dotnet tool install -g dotnet-format +``` + +#### Installing Development Builds + +Development builds of `dotnet-format` are being hosted on myget. You can visit the [dotnet-format myget page](https://dotnet.myget.org/feed/format/package/nuget/dotnet-format) to get the latest version number. + +You can install the tool using the following command. + +```console +dotnet tool install -g dotnet-format --version 3.0.0-prerelease.19119.4 --add-source https://dotnet.myget.org/F/format/api/v3/index.json +``` + +### How To Use + +By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory you will need to specify the workspace to format using the `-w` option. You can control how verbose the output will be by using the `-v` option. + +``` +Usage: + dotnet-format [options] + +Options: + -w, --workspace The solution or project file to operate on. If a file is not specified, the command will search + the current directory for one. + -v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and + diag[nostic] + --dry-run Format files, but do not save changes to disk. + --check Terminate with non-zero exit code if any files need to be formatted in the workspace. + --files The files to operate on. If none specified, all files in workspace will be operated on. + --version Display version information +``` + +Add `format` after `dotnet` and before the command arguments that you want to run: + +| Examples | +| -------------------------------------------------------- | +| dotnet **format** | +| dotnet **format** -w <workspace> | +| dotnet **format** -v diag | +| dotnet **format** -w <workspace> -v diag | + +### How To Uninstall + +You can uninstall the tool using the following command. + +```console +dotnet tool uninstall -g dotnet-format +``` + +### How To Build From Source + +You can build and package the tool using the following commands. The instructions assume that you are in the root of the repository. + +```console +build -pack +# The final line from the build will read something like +# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.3.0.0-dev.nupkg'. +# Use the value that is in the form `3.0.0-dev` as the version in the next command. +dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version +dotnet format +``` + +> Note: On macOS and Linux, `.\artifacts` will need be switched to `./artifacts` to accommodate for the different slash directions. diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 1586754cef20..59b8190ff7a6 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -1,72 +1,72 @@ -resources: -- repo: self - clean: true - -queue: - name: VSEng-MicroBuildVS2017 - demands: Cmd - -variables: - BuildConfiguration: Release - SignType: real - TeamName: Roslyn - VisualStudioDropName: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber) - -# Branches that trigger a build on commit -trigger: -- master - -steps: -- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1 - displayName: Install Signing Plugin - inputs: - signType: $(SignType) - esrpSigning: true - condition: and(succeeded(), ne(variables['SignType'], '')) - -- script: eng\common\CIBuild.cmd - -configuration $(BuildConfiguration) - /p:OfficialBuildId=$(Build.BuildNumber) - /p:VisualStudioDropName=$(VisualStudioDropName) - /p:DotNetSignType=$(SignType) - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:DotNetFinalVersionKind=$(_additionalBuildArgs) - displayName: Build - -- task: NuGetPublisher@0 - displayName: Publish NuGet Packages to MyGet - inputs: - searchPattern: 'artifacts\packages\$(BuildConfiguration)\Shipping\*.nupkg' - connectedServiceName: 'dotnet-format - NuGet feed' - nuGetVersion: 4.0.0.2283 - condition: succeeded() - -- task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' - ArtifactName: 'Logs' - continueOnError: true - condition: not(succeeded()) - -- task: PublishTestResults@1 - displayName: Publish Test Results - inputs: - testRunner: XUnit - testResultsFiles: 'artifacts/TestResults/$(BuildConfiguration)/*.xml' - mergeTestResults: true - testRunTitle: 'Unit Tests' - condition: always() - -# Archive NuGet packages to DevOps. -- task: PublishBuildArtifacts@1 - displayName: Publish Artifact Packages - inputs: - PathtoPublish: 'artifacts\packages\$(BuildConfiguration)' - ArtifactName: 'Packages' - condition: succeeded() - -- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 - displayName: Cleanup - condition: always() +resources: +- repo: self + clean: true + +queue: + name: VSEng-MicroBuildVS2017 + demands: Cmd + +variables: + BuildConfiguration: Release + SignType: real + TeamName: Roslyn + VisualStudioDropName: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber) + +# Branches that trigger a build on commit +trigger: +- master + +steps: +- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1 + displayName: Install Signing Plugin + inputs: + signType: $(SignType) + esrpSigning: true + condition: and(succeeded(), ne(variables['SignType'], '')) + +- script: eng\common\CIBuild.cmd + -configuration $(BuildConfiguration) + /p:OfficialBuildId=$(Build.BuildNumber) + /p:VisualStudioDropName=$(VisualStudioDropName) + /p:DotNetSignType=$(SignType) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:DotNetFinalVersionKind=$(_additionalBuildArgs) + displayName: Build + +- task: NuGetPublisher@0 + displayName: Publish NuGet Packages to MyGet + inputs: + searchPattern: 'artifacts\packages\$(BuildConfiguration)\Shipping\*.nupkg' + connectedServiceName: 'dotnet-format - NuGet feed' + nuGetVersion: 4.0.0.2283 + condition: succeeded() + +- task: PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + ArtifactName: 'Logs' + continueOnError: true + condition: not(succeeded()) + +- task: PublishTestResults@1 + displayName: Publish Test Results + inputs: + testRunner: XUnit + testResultsFiles: 'artifacts/TestResults/$(BuildConfiguration)/*.xml' + mergeTestResults: true + testRunTitle: 'Unit Tests' + condition: always() + +# Archive NuGet packages to DevOps. +- task: PublishBuildArtifacts@1 + displayName: Publish Artifact Packages + inputs: + PathtoPublish: 'artifacts\packages\$(BuildConfiguration)' + ArtifactName: 'Packages' + condition: succeeded() + +- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 + displayName: Cleanup + condition: always() diff --git a/format.sln b/format.sln index ab8289c0cf19..aac7662b136b 100644 --- a/format.sln +++ b/format.sln @@ -1,48 +1,48 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-format", "src\dotnet-format.csproj", "{7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-format.UnitTests", "tests\dotnet-format.UnitTests.csproj", "{4F181F8B-534F-48A6-A28B-0D11F5AEFF55}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x64.ActiveCfg = Debug|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x64.Build.0 = Debug|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x86.ActiveCfg = Debug|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x86.Build.0 = Debug|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|Any CPU.Build.0 = Release|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x64.ActiveCfg = Release|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x64.Build.0 = Release|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x86.ActiveCfg = Release|Any CPU - {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x86.Build.0 = Release|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x64.ActiveCfg = Debug|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x64.Build.0 = Debug|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x86.ActiveCfg = Debug|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x86.Build.0 = Debug|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|Any CPU.Build.0 = Release|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x64.ActiveCfg = Release|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x64.Build.0 = Release|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x86.ActiveCfg = Release|Any CPU - {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-format", "src\dotnet-format.csproj", "{7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnet-format.UnitTests", "tests\dotnet-format.UnitTests.csproj", "{4F181F8B-534F-48A6-A28B-0D11F5AEFF55}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x64.ActiveCfg = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x64.Build.0 = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x86.ActiveCfg = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Debug|x86.Build.0 = Debug|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|Any CPU.Build.0 = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x64.ActiveCfg = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x64.Build.0 = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x86.ActiveCfg = Release|Any CPU + {7DFBB9BC-E3A9-46EB-B225-9DFD4E57D344}.Release|x86.Build.0 = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x64.ActiveCfg = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x64.Build.0 = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x86.ActiveCfg = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Debug|x86.Build.0 = Debug|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|Any CPU.Build.0 = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x64.ActiveCfg = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x64.Build.0 = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x86.ActiveCfg = Release|Any CPU + {4F181F8B-534F-48A6-A28B-0D11F5AEFF55}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index bc85ff3dd746..d3d10997ab96 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -1,232 +1,232 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CodeStyle; -using Microsoft.CodeAnalysis.Formatting; -using Microsoft.CodeAnalysis.MSBuild; -using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Tools -{ - internal static class CodeFormatter - { - private const int MaxLoggedWorkspaceWarnings = 5; - - public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, string[] filesToFormat, CancellationToken cancellationToken) - { - logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, solutionOrProjectPath)); - - logger.LogTrace(Resources.Loading_workspace); - - var loggedWarningCount = 0; - var formatResult = new WorkspaceFormatResult() - { - ExitCode = 1 - }; - var workspaceStopwatch = Stopwatch.StartNew(); - - var properties = new Dictionary(StringComparer.Ordinal) - { - // This property ensures that XAML files will be compiled in the current AppDomain - // rather than a separate one. Any tasks isolated in AppDomains or tasks that create - // AppDomains will likely not work due to https://github.com/Microsoft/MSBuildLocator/issues/16. - { "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, - // This flag is used at restore time to avoid imports from packages changing the inputs to restore, - // without this it is possible to get different results between the first and second restore. - { "ExcludeRestorePackageImports", bool.TrueString }, - }; - - var codingConventionsManager = CodingConventionsManagerFactory.CreateCodingConventionsManager(); - - using (var workspace = MSBuildWorkspace.Create(properties)) - { - workspace.WorkspaceFailed += LogWorkspaceWarnings; - - var projectPath = string.Empty; - if (isSolution) - { - await workspace.OpenSolutionAsync(solutionOrProjectPath, cancellationToken: cancellationToken).ConfigureAwait(false); - } - else - { - try - { - await workspace.OpenProjectAsync(solutionOrProjectPath, cancellationToken: cancellationToken).ConfigureAwait(false); - projectPath = solutionOrProjectPath; - } - catch (InvalidOperationException) - { - logger.LogError(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, solutionOrProjectPath); - return formatResult; - } - } - - logger.LogTrace(Resources.Workspace_loaded_in_0_ms, workspaceStopwatch.ElapsedMilliseconds); - workspaceStopwatch.Restart(); - - (formatResult.ExitCode, formatResult.FileCount, formatResult.FilesFormatted) = await FormatFilesInWorkspaceAsync(logger, workspace, projectPath, codingConventionsManager, saveFormattedFiles, filesToFormat, cancellationToken).ConfigureAwait(false); - - logger.LogDebug(Resources.Formatted_0_of_1_files_in_2_ms, formatResult.FilesFormatted, formatResult.FileCount, workspaceStopwatch.ElapsedMilliseconds); - } - - logger.LogInformation(Resources.Format_complete); - - return formatResult; - - void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) - { - if (args.Diagnostic.Kind == WorkspaceDiagnosticKind.Failure) - { - return; - } - - logger.LogWarning(args.Diagnostic.Message); - - if (!logAllWorkspaceWarnings) - { - loggedWarningCount++; - - if (loggedWarningCount == MaxLoggedWorkspaceWarnings) - { - logger.LogWarning(Resources.Maximum_number_of_workspace_warnings_to_log_has_been_reached_Set_the_verbosity_option_to_the_diagnostic_level_to_see_all_warnings); - ((MSBuildWorkspace)sender).WorkspaceFailed -= LogWorkspaceWarnings; - } - } - } - } - - private static async Task<(int status, int fileCount, int filesFormatted)> FormatFilesInWorkspaceAsync(ILogger logger, Workspace workspace, string projectPath, ICodingConventionsManager codingConventionsManager, bool saveFormattedFiles, string[] filesToFormat, CancellationToken cancellationToken) - { - var projectIds = workspace.CurrentSolution.ProjectIds.ToImmutableArray(); - var optionsApplier = new EditorConfigOptionsApplier(); - - var totalFileCount = 0; - var totalFilesFormatted = 0; - foreach (var projectId in projectIds) - { - var project = workspace.CurrentSolution.GetProject(projectId); - if (!string.IsNullOrEmpty(projectPath) && !project.FilePath.Equals(projectPath, StringComparison.OrdinalIgnoreCase)) - { - logger.LogDebug(Resources.Skipping_referenced_project_0, project.Name); - continue; - } - - if (project.Language != LanguageNames.CSharp && project.Language != LanguageNames.VisualBasic) - { - logger.LogWarning(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, project.FilePath); - continue; - } - - logger.LogInformation(Resources.Formatting_code_files_in_project_0, project.Name); - - var (formattedSolution, filesFormatted) = await FormatFilesInProjectAsync(logger, project, codingConventionsManager, optionsApplier, filesToFormat, cancellationToken).ConfigureAwait(false); - totalFileCount += project.DocumentIds.Count; - totalFilesFormatted += filesFormatted; - if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution)) - { - logger.LogError(Resources.Failed_to_save_formatting_changes); - return (1, totalFileCount, totalFilesFormatted); - } - } - - return (0, totalFileCount, totalFilesFormatted); - } - - private static async Task<(Solution solution, int filesFormatted)> FormatFilesInProjectAsync(ILogger logger, Project project, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, string[] filesToFormat, CancellationToken cancellationToken) - { - var isCommentTrivia = project.Language == LanguageNames.CSharp - ? IsCSharpCommentTrivia - : IsVisualBasicCommentTrivia; - - var formattedDocuments = new List<(DocumentId documentId, Task formatTask)>(); - foreach (var documentId in project.DocumentIds) - { - var document = project.Solution.GetDocument(documentId); - if (!document.SupportsSyntaxTree) - { - continue; - } - - if (filesToFormat != null) - { - var fileInArgumentList = filesToFormat.Any(relativePath => document.FilePath.EndsWith(relativePath, StringComparison.OrdinalIgnoreCase)); - - if (!fileInArgumentList) - { - continue; - } - } - - var formatTask = Task.Run(async () => - { - var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - if (GeneratedCodeUtilities.IsGeneratedCode(syntaxTree, isCommentTrivia, cancellationToken)) - { - return null; - } - - logger.LogTrace(Resources.Formatting_code_file_0, Path.GetFileName(document.FilePath)); - - OptionSet documentOptions = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); - - var codingConventionsContext = await codingConventionsManager.GetConventionContextAsync(document.FilePath, cancellationToken).ConfigureAwait(false); - if (codingConventionsContext?.CurrentConventions != null) - { - documentOptions = optionsApplier.ApplyConventions(documentOptions, codingConventionsContext.CurrentConventions, project.Language); - } - - var formattedDocument = await Formatter.FormatAsync(document, documentOptions, cancellationToken).ConfigureAwait(false); - var formattedSourceText = await formattedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); - if (formattedSourceText.ContentEquals(await document.GetTextAsync(cancellationToken).ConfigureAwait(false))) - { - // Avoid touching files that didn't actually change - return null; - } - - logger.LogInformation(Resources.Formatted_code_file_0, Path.GetFileName(document.FilePath)); - - return formattedSourceText; - }, cancellationToken); - - formattedDocuments.Add((documentId, formatTask)); - } - - var formattedSolution = project.Solution; - var filesFormatted = 0; - foreach (var (documentId, formatTask) in formattedDocuments) - { - var text = await formatTask.ConfigureAwait(false); - if (text is null) - { - continue; - } - - filesFormatted++; - formattedSolution = formattedSolution.WithDocumentText(documentId, text); - } - - return (formattedSolution, filesFormatted); - } - - private static readonly Func IsCSharpCommentTrivia = - (syntaxTrivia) => syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineCommentTrivia) - || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineCommentTrivia) - || syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineDocumentationCommentTrivia) - || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineDocumentationCommentTrivia); - - private static readonly Func IsVisualBasicCommentTrivia = - (syntaxTrivia) => syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia) - || syntaxTrivia.IsKind(VisualBasic.SyntaxKind.DocumentationCommentTrivia); - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeStyle; +using Microsoft.CodeAnalysis.Formatting; +using Microsoft.CodeAnalysis.MSBuild; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Text; +using Microsoft.Extensions.Logging; +using Microsoft.VisualStudio.CodingConventions; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.Tools +{ + internal static class CodeFormatter + { + private const int MaxLoggedWorkspaceWarnings = 5; + + public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, string[] filesToFormat, CancellationToken cancellationToken) + { + logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, solutionOrProjectPath)); + + logger.LogTrace(Resources.Loading_workspace); + + var loggedWarningCount = 0; + var formatResult = new WorkspaceFormatResult() + { + ExitCode = 1 + }; + var workspaceStopwatch = Stopwatch.StartNew(); + + var properties = new Dictionary(StringComparer.Ordinal) + { + // This property ensures that XAML files will be compiled in the current AppDomain + // rather than a separate one. Any tasks isolated in AppDomains or tasks that create + // AppDomains will likely not work due to https://github.com/Microsoft/MSBuildLocator/issues/16. + { "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, + // This flag is used at restore time to avoid imports from packages changing the inputs to restore, + // without this it is possible to get different results between the first and second restore. + { "ExcludeRestorePackageImports", bool.TrueString }, + }; + + var codingConventionsManager = CodingConventionsManagerFactory.CreateCodingConventionsManager(); + + using (var workspace = MSBuildWorkspace.Create(properties)) + { + workspace.WorkspaceFailed += LogWorkspaceWarnings; + + var projectPath = string.Empty; + if (isSolution) + { + await workspace.OpenSolutionAsync(solutionOrProjectPath, cancellationToken: cancellationToken).ConfigureAwait(false); + } + else + { + try + { + await workspace.OpenProjectAsync(solutionOrProjectPath, cancellationToken: cancellationToken).ConfigureAwait(false); + projectPath = solutionOrProjectPath; + } + catch (InvalidOperationException) + { + logger.LogError(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, solutionOrProjectPath); + return formatResult; + } + } + + logger.LogTrace(Resources.Workspace_loaded_in_0_ms, workspaceStopwatch.ElapsedMilliseconds); + workspaceStopwatch.Restart(); + + (formatResult.ExitCode, formatResult.FileCount, formatResult.FilesFormatted) = await FormatFilesInWorkspaceAsync(logger, workspace, projectPath, codingConventionsManager, saveFormattedFiles, filesToFormat, cancellationToken).ConfigureAwait(false); + + logger.LogDebug(Resources.Formatted_0_of_1_files_in_2_ms, formatResult.FilesFormatted, formatResult.FileCount, workspaceStopwatch.ElapsedMilliseconds); + } + + logger.LogInformation(Resources.Format_complete); + + return formatResult; + + void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) + { + if (args.Diagnostic.Kind == WorkspaceDiagnosticKind.Failure) + { + return; + } + + logger.LogWarning(args.Diagnostic.Message); + + if (!logAllWorkspaceWarnings) + { + loggedWarningCount++; + + if (loggedWarningCount == MaxLoggedWorkspaceWarnings) + { + logger.LogWarning(Resources.Maximum_number_of_workspace_warnings_to_log_has_been_reached_Set_the_verbosity_option_to_the_diagnostic_level_to_see_all_warnings); + ((MSBuildWorkspace)sender).WorkspaceFailed -= LogWorkspaceWarnings; + } + } + } + } + + private static async Task<(int status, int fileCount, int filesFormatted)> FormatFilesInWorkspaceAsync(ILogger logger, Workspace workspace, string projectPath, ICodingConventionsManager codingConventionsManager, bool saveFormattedFiles, string[] filesToFormat, CancellationToken cancellationToken) + { + var projectIds = workspace.CurrentSolution.ProjectIds.ToImmutableArray(); + var optionsApplier = new EditorConfigOptionsApplier(); + + var totalFileCount = 0; + var totalFilesFormatted = 0; + foreach (var projectId in projectIds) + { + var project = workspace.CurrentSolution.GetProject(projectId); + if (!string.IsNullOrEmpty(projectPath) && !project.FilePath.Equals(projectPath, StringComparison.OrdinalIgnoreCase)) + { + logger.LogDebug(Resources.Skipping_referenced_project_0, project.Name); + continue; + } + + if (project.Language != LanguageNames.CSharp && project.Language != LanguageNames.VisualBasic) + { + logger.LogWarning(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, project.FilePath); + continue; + } + + logger.LogInformation(Resources.Formatting_code_files_in_project_0, project.Name); + + var (formattedSolution, filesFormatted) = await FormatFilesInProjectAsync(logger, project, codingConventionsManager, optionsApplier, filesToFormat, cancellationToken).ConfigureAwait(false); + totalFileCount += project.DocumentIds.Count; + totalFilesFormatted += filesFormatted; + if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution)) + { + logger.LogError(Resources.Failed_to_save_formatting_changes); + return (1, totalFileCount, totalFilesFormatted); + } + } + + return (0, totalFileCount, totalFilesFormatted); + } + + private static async Task<(Solution solution, int filesFormatted)> FormatFilesInProjectAsync(ILogger logger, Project project, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, string[] filesToFormat, CancellationToken cancellationToken) + { + var isCommentTrivia = project.Language == LanguageNames.CSharp + ? IsCSharpCommentTrivia + : IsVisualBasicCommentTrivia; + + var formattedDocuments = new List<(DocumentId documentId, Task formatTask)>(); + foreach (var documentId in project.DocumentIds) + { + var document = project.Solution.GetDocument(documentId); + if (!document.SupportsSyntaxTree) + { + continue; + } + + if (filesToFormat != null) + { + var fileInArgumentList = filesToFormat.Any(relativePath => document.FilePath.EndsWith(relativePath, StringComparison.OrdinalIgnoreCase)); + + if (!fileInArgumentList) + { + continue; + } + } + + var formatTask = Task.Run(async () => + { + var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + if (GeneratedCodeUtilities.IsGeneratedCode(syntaxTree, isCommentTrivia, cancellationToken)) + { + return null; + } + + logger.LogTrace(Resources.Formatting_code_file_0, Path.GetFileName(document.FilePath)); + + OptionSet documentOptions = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); + + var codingConventionsContext = await codingConventionsManager.GetConventionContextAsync(document.FilePath, cancellationToken).ConfigureAwait(false); + if (codingConventionsContext?.CurrentConventions != null) + { + documentOptions = optionsApplier.ApplyConventions(documentOptions, codingConventionsContext.CurrentConventions, project.Language); + } + + var formattedDocument = await Formatter.FormatAsync(document, documentOptions, cancellationToken).ConfigureAwait(false); + var formattedSourceText = await formattedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + if (formattedSourceText.ContentEquals(await document.GetTextAsync(cancellationToken).ConfigureAwait(false))) + { + // Avoid touching files that didn't actually change + return null; + } + + logger.LogInformation(Resources.Formatted_code_file_0, Path.GetFileName(document.FilePath)); + + return formattedSourceText; + }, cancellationToken); + + formattedDocuments.Add((documentId, formatTask)); + } + + var formattedSolution = project.Solution; + var filesFormatted = 0; + foreach (var (documentId, formatTask) in formattedDocuments) + { + var text = await formatTask.ConfigureAwait(false); + if (text is null) + { + continue; + } + + filesFormatted++; + formattedSolution = formattedSolution.WithDocumentText(documentId, text); + } + + return (formattedSolution, filesFormatted); + } + + private static readonly Func IsCSharpCommentTrivia = + (syntaxTrivia) => syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineCommentTrivia) + || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineCommentTrivia) + || syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineDocumentationCommentTrivia) + || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineDocumentationCommentTrivia); + + private static readonly Func IsVisualBasicCommentTrivia = + (syntaxTrivia) => syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia) + || syntaxTrivia.IsKind(VisualBasic.SyntaxKind.DocumentationCommentTrivia); + } +} diff --git a/src/EditorConfigOptionsApplier.cs b/src/EditorConfigOptionsApplier.cs index e3ee43c1025a..1508c8be2ecf 100644 --- a/src/EditorConfigOptionsApplier.cs +++ b/src/EditorConfigOptionsApplier.cs @@ -1,93 +1,93 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; -using System.Reflection; -using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.CodingConventions; - -namespace Microsoft.CodeAnalysis.CodeStyle -{ - internal class EditorConfigOptionsApplier - { - private readonly ImmutableArray<(IOption, OptionStorageLocation, MethodInfo)> _formattingOptionsWithStorage; - - public EditorConfigOptionsApplier() - { - var commonOptionsType = typeof(Formatting.FormattingOptions); - var csharpOptionsType = typeof(CSharp.Formatting.CSharpFormattingOptions); - _formattingOptionsWithStorage = GetOptionsWithStorageFromTypes(new[] { commonOptionsType, csharpOptionsType }); - } - - public OptionSet ApplyConventions(OptionSet optionSet, ICodingConventionsSnapshot codingConventions, string languageName) - { - foreach (var optionWithStorage in _formattingOptionsWithStorage) - { - if (TryGetConventionValue(optionWithStorage, codingConventions, out var value)) - { - var option = optionWithStorage.Item1; - var optionKey = new OptionKey(option, option.IsPerLanguage ? languageName : null); - optionSet = optionSet.WithChangedOption(optionKey, value); - } - } - - return optionSet; - } - - private OptionSet ApplyConventionsForOptions(OptionSet optionSet, IEnumerable<(IOption, OptionStorageLocation, MethodInfo)> optionsWithStorage, ICodingConventionsSnapshot codingConventions, string languageName) - { - foreach (var optionWithStorage in optionsWithStorage) - { - if (TryGetConventionValue(optionWithStorage, codingConventions, out var value)) - { - var option = optionWithStorage.Item1; - var optionKey = new OptionKey(option, option.IsPerLanguage ? languageName : null); - optionSet = optionSet.WithChangedOption(optionKey, value); - } - } - - return optionSet; - } - - internal ImmutableArray<(IOption, OptionStorageLocation, MethodInfo)> GetOptionsWithStorageFromTypes(params Type[] formattingOptionTypes) - { - var optionType = typeof(IOption); - return formattingOptionTypes - .SelectMany(t => t.GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty)) - .Where(p => optionType.IsAssignableFrom(p.PropertyType)) - .Select(p => (IOption)p.GetValue(null)) - .Select(GetOptionWithStorage) - .Where(ows => ows.Item2 != null) - .ToImmutableArray(); - } - - internal (IOption, OptionStorageLocation, MethodInfo) GetOptionWithStorage(IOption option) - { - var editorConfigStorage = !option.StorageLocations.IsDefaultOrEmpty - ? option.StorageLocations.FirstOrDefault(IsEditorConfigStorage) - : null; - var tryGetOptionMethod = editorConfigStorage?.GetType().GetMethod("TryGetOption"); - return (option, editorConfigStorage, tryGetOptionMethod); - } - - internal static bool IsEditorConfigStorage(OptionStorageLocation storageLocation) - { - return storageLocation.GetType().FullName.StartsWith("Microsoft.CodeAnalysis.Options.EditorConfigStorageLocation"); - } - - internal static bool TryGetConventionValue((IOption, OptionStorageLocation, MethodInfo) optionWithStorage, ICodingConventionsSnapshot codingConventions, out object value) - { - var (option, editorConfigStorage, tryGetOptionMethod) = optionWithStorage; - - value = null; - var args = new object[] { option, codingConventions.AllRawConventions, option.Type, value }; - - var isOptionPresent = (bool)tryGetOptionMethod.Invoke(editorConfigStorage, args); - value = args[3]; - - return isOptionPresent; - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; +using Microsoft.CodeAnalysis.Options; +using Microsoft.VisualStudio.CodingConventions; + +namespace Microsoft.CodeAnalysis.CodeStyle +{ + internal class EditorConfigOptionsApplier + { + private readonly ImmutableArray<(IOption, OptionStorageLocation, MethodInfo)> _formattingOptionsWithStorage; + + public EditorConfigOptionsApplier() + { + var commonOptionsType = typeof(Formatting.FormattingOptions); + var csharpOptionsType = typeof(CSharp.Formatting.CSharpFormattingOptions); + _formattingOptionsWithStorage = GetOptionsWithStorageFromTypes(new[] { commonOptionsType, csharpOptionsType }); + } + + public OptionSet ApplyConventions(OptionSet optionSet, ICodingConventionsSnapshot codingConventions, string languageName) + { + foreach (var optionWithStorage in _formattingOptionsWithStorage) + { + if (TryGetConventionValue(optionWithStorage, codingConventions, out var value)) + { + var option = optionWithStorage.Item1; + var optionKey = new OptionKey(option, option.IsPerLanguage ? languageName : null); + optionSet = optionSet.WithChangedOption(optionKey, value); + } + } + + return optionSet; + } + + private OptionSet ApplyConventionsForOptions(OptionSet optionSet, IEnumerable<(IOption, OptionStorageLocation, MethodInfo)> optionsWithStorage, ICodingConventionsSnapshot codingConventions, string languageName) + { + foreach (var optionWithStorage in optionsWithStorage) + { + if (TryGetConventionValue(optionWithStorage, codingConventions, out var value)) + { + var option = optionWithStorage.Item1; + var optionKey = new OptionKey(option, option.IsPerLanguage ? languageName : null); + optionSet = optionSet.WithChangedOption(optionKey, value); + } + } + + return optionSet; + } + + internal ImmutableArray<(IOption, OptionStorageLocation, MethodInfo)> GetOptionsWithStorageFromTypes(params Type[] formattingOptionTypes) + { + var optionType = typeof(IOption); + return formattingOptionTypes + .SelectMany(t => t.GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty)) + .Where(p => optionType.IsAssignableFrom(p.PropertyType)) + .Select(p => (IOption)p.GetValue(null)) + .Select(GetOptionWithStorage) + .Where(ows => ows.Item2 != null) + .ToImmutableArray(); + } + + internal (IOption, OptionStorageLocation, MethodInfo) GetOptionWithStorage(IOption option) + { + var editorConfigStorage = !option.StorageLocations.IsDefaultOrEmpty + ? option.StorageLocations.FirstOrDefault(IsEditorConfigStorage) + : null; + var tryGetOptionMethod = editorConfigStorage?.GetType().GetMethod("TryGetOption"); + return (option, editorConfigStorage, tryGetOptionMethod); + } + + internal static bool IsEditorConfigStorage(OptionStorageLocation storageLocation) + { + return storageLocation.GetType().FullName.StartsWith("Microsoft.CodeAnalysis.Options.EditorConfigStorageLocation"); + } + + internal static bool TryGetConventionValue((IOption, OptionStorageLocation, MethodInfo) optionWithStorage, ICodingConventionsSnapshot codingConventions, out object value) + { + var (option, editorConfigStorage, tryGetOptionMethod) = optionWithStorage; + + value = null; + var args = new object[] { option, codingConventions.AllRawConventions, option.Type, value }; + + var isOptionPresent = (bool)tryGetOptionMethod.Invoke(editorConfigStorage, args); + value = args[3]; + + return isOptionPresent; + } + } +} diff --git a/src/Logging/SimpleConsoleLogger.cs b/src/Logging/SimpleConsoleLogger.cs index 89e34975097e..f0f5ec7ed5c8 100644 --- a/src/Logging/SimpleConsoleLogger.cs +++ b/src/Logging/SimpleConsoleLogger.cs @@ -1,78 +1,78 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.CommandLine; -using System.CommandLine.Rendering; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions.Internal; - -namespace Microsoft.CodeAnalysis.Tools.Logging -{ - internal class SimpleConsoleLogger : ILogger - { - private readonly IConsole _console; - private readonly ITerminal _terminal; - private readonly LogLevel _logLevel; - - private static readonly ImmutableDictionary _logLevelColorMap = new Dictionary - { - [LogLevel.Critical] = ConsoleColor.Red, - [LogLevel.Error] = ConsoleColor.Red, - [LogLevel.Warning] = ConsoleColor.Yellow, - [LogLevel.Information] = ConsoleColor.White, - [LogLevel.Debug] = ConsoleColor.Gray, - [LogLevel.Trace] = ConsoleColor.Gray, - [LogLevel.None] = ConsoleColor.White, - }.ToImmutableDictionary(); - - public SimpleConsoleLogger(IConsole console, LogLevel logLevel) - { - _terminal = console.GetTerminal(); - _console = console; - _logLevel = logLevel; - } - - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { - if (!IsEnabled(logLevel)) - { - return; - } - - var message = formatter(state, exception); - if (_terminal is null) - { - LogToConsole(message); - } - else - { - LogToTerminal(message, logLevel); - } - } - - public bool IsEnabled(LogLevel logLevel) - { - return (int)logLevel >= (int)_logLevel; - } - - public IDisposable BeginScope(TState state) - { - return NullScope.Instance; - } - - void LogToTerminal(string message, LogLevel logLevel) - { - var messageColor = _logLevelColorMap[logLevel]; - _terminal.ForegroundColor = messageColor; - _terminal.Out.WriteLine($" {message}"); - _terminal.ResetColor(); - } - - void LogToConsole(string message) - { - _console.Out.WriteLine($" {message}"); - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.CommandLine; +using System.CommandLine.Rendering; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions.Internal; + +namespace Microsoft.CodeAnalysis.Tools.Logging +{ + internal class SimpleConsoleLogger : ILogger + { + private readonly IConsole _console; + private readonly ITerminal _terminal; + private readonly LogLevel _logLevel; + + private static readonly ImmutableDictionary _logLevelColorMap = new Dictionary + { + [LogLevel.Critical] = ConsoleColor.Red, + [LogLevel.Error] = ConsoleColor.Red, + [LogLevel.Warning] = ConsoleColor.Yellow, + [LogLevel.Information] = ConsoleColor.White, + [LogLevel.Debug] = ConsoleColor.Gray, + [LogLevel.Trace] = ConsoleColor.Gray, + [LogLevel.None] = ConsoleColor.White, + }.ToImmutableDictionary(); + + public SimpleConsoleLogger(IConsole console, LogLevel logLevel) + { + _terminal = console.GetTerminal(); + _console = console; + _logLevel = logLevel; + } + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + { + if (!IsEnabled(logLevel)) + { + return; + } + + var message = formatter(state, exception); + if (_terminal is null) + { + LogToConsole(message); + } + else + { + LogToTerminal(message, logLevel); + } + } + + public bool IsEnabled(LogLevel logLevel) + { + return (int)logLevel >= (int)_logLevel; + } + + public IDisposable BeginScope(TState state) + { + return NullScope.Instance; + } + + void LogToTerminal(string message, LogLevel logLevel) + { + var messageColor = _logLevelColorMap[logLevel]; + _terminal.ForegroundColor = messageColor; + _terminal.Out.WriteLine($" {message}"); + _terminal.ResetColor(); + } + + void LogToConsole(string message) + { + _console.Out.WriteLine($" {message}"); + } + } +} diff --git a/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs index 416dac0f2379..f4b2405ac223 100644 --- a/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs +++ b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs @@ -1,16 +1,16 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using Microsoft.Extensions.Logging; -using System.CommandLine; - -namespace Microsoft.CodeAnalysis.Tools.Logging -{ - internal static class SimpleConsoleLoggerFactoryExtensions - { - public static ILoggerFactory AddSimpleConsole(this ILoggerFactory factory, IConsole console, LogLevel logLevel) - { - factory.AddProvider(new SimpleConsoleLoggerProvider(console, logLevel)); - return factory; - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.Extensions.Logging; +using System.CommandLine; + +namespace Microsoft.CodeAnalysis.Tools.Logging +{ + internal static class SimpleConsoleLoggerFactoryExtensions + { + public static ILoggerFactory AddSimpleConsole(this ILoggerFactory factory, IConsole console, LogLevel logLevel) + { + factory.AddProvider(new SimpleConsoleLoggerProvider(console, logLevel)); + return factory; + } + } +} diff --git a/src/Logging/SimpleConsoleLoggerProvider.cs b/src/Logging/SimpleConsoleLoggerProvider.cs index 2ad0a9f0cc5f..3a01da83afaa 100644 --- a/src/Logging/SimpleConsoleLoggerProvider.cs +++ b/src/Logging/SimpleConsoleLoggerProvider.cs @@ -1,28 +1,28 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using Microsoft.Extensions.Logging; -using System.CommandLine; - -namespace Microsoft.CodeAnalysis.Tools.Logging -{ - internal class SimpleConsoleLoggerProvider : ILoggerProvider - { - private readonly IConsole _console; - private readonly LogLevel _logLevel; - - public SimpleConsoleLoggerProvider(IConsole console, LogLevel logLevel) - { - _console = console; - _logLevel = logLevel; - } - - public ILogger CreateLogger(string name) - { - return new SimpleConsoleLogger(_console, _logLevel); - } - - public void Dispose() - { - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.Extensions.Logging; +using System.CommandLine; + +namespace Microsoft.CodeAnalysis.Tools.Logging +{ + internal class SimpleConsoleLoggerProvider : ILoggerProvider + { + private readonly IConsole _console; + private readonly LogLevel _logLevel; + + public SimpleConsoleLoggerProvider(IConsole console, LogLevel logLevel) + { + _console = console; + _logLevel = logLevel; + } + + public ILogger CreateLogger(string name) + { + return new SimpleConsoleLogger(_console, _logLevel); + } + + public void Dispose() + { + } + } +} diff --git a/src/MSBuild/MSBuildWorkspaceFinder.cs b/src/MSBuild/MSBuildWorkspaceFinder.cs index 25fb08788d41..b0f60c4abe45 100644 --- a/src/MSBuild/MSBuildWorkspaceFinder.cs +++ b/src/MSBuild/MSBuildWorkspaceFinder.cs @@ -1,103 +1,103 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -// Original License: -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// See https://github.com/aspnet/DotNetTools/blob/261b27b70027871143540af10a5cba57ce07ff97/src/dotnet-watch/Internal/MsBuildProjectFinder.cs - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace Microsoft.CodeAnalysis.Tools.MSBuild -{ - internal class MSBuildWorkspaceFinder - { - // Used to exclude dnx projects - private const string s_dnxProjectExtension = ".xproj"; - - /// - /// Finds a compatible MSBuild project or solution. - /// The base directory to search - /// A specific project or solution file to find - /// - public static (bool isSolution, string workspacePath) FindWorkspace(string searchDirectory, string workspacePath = null) - { - if (!string.IsNullOrEmpty(workspacePath)) - { - if (!Path.IsPathRooted(workspacePath)) - { - workspacePath = Path.GetFullPath(workspacePath, searchDirectory); - } - - return Directory.Exists(workspacePath) - ? FindWorkspace(workspacePath) - : FindFile(workspacePath); - } - - var foundSolution = FindMatchingFile(searchDirectory, FindSolutionFiles, Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option); - var foundProject = FindMatchingFile(searchDirectory, FindProjectFiles, Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option); - - if (!string.IsNullOrEmpty(foundSolution) && !string.IsNullOrEmpty(foundProject)) - { - throw new FileNotFoundException(string.Format(Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, searchDirectory)); - } - else if (string.IsNullOrEmpty(foundSolution) && string.IsNullOrEmpty(foundProject)) - { - throw new FileNotFoundException(string.Format(Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option, searchDirectory)); - } - - return !string.IsNullOrEmpty(foundSolution) - ? (true, foundSolution) - : (false, foundProject); - } - - private static (bool isSolution, string workspacePath) FindFile(string workspacePath) - { - var workspaceExtension = Path.GetExtension(workspacePath); - var isSolution = workspaceExtension.Equals(".sln", StringComparison.OrdinalIgnoreCase); - var isProject = !isSolution - && workspaceExtension.EndsWith("proj", StringComparison.OrdinalIgnoreCase) - && !workspaceExtension.Equals(s_dnxProjectExtension, StringComparison.OrdinalIgnoreCase); - - if (!isSolution && !isProject) - { - throw new FileNotFoundException(string.Format(Resources.The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file, Path.GetFileName(workspacePath))); - } - - if (!File.Exists(workspacePath)) - { - var message = isSolution - ? Resources.The_solution_file_0_does_not_exist - : Resources.The_project_file_0_does_not_exist; - throw new FileNotFoundException(string.Format(message, workspacePath)); - } - - return (isSolution, workspacePath); - } - - private static IEnumerable FindSolutionFiles(string basePath) => Directory.EnumerateFileSystemEntries(basePath, "*.sln", SearchOption.TopDirectoryOnly); - - private static IEnumerable FindProjectFiles(string basePath) => Directory.EnumerateFileSystemEntries(basePath, "*.*proj", SearchOption.TopDirectoryOnly) - .Where(f => !s_dnxProjectExtension.Equals(Path.GetExtension(f), StringComparison.OrdinalIgnoreCase)); - - private static string FindMatchingFile(string searchBase, Func> fileSelector, string multipleFilesFoundError) - { - if (!Directory.Exists(searchBase)) - { - return null; - } - - var files = fileSelector(searchBase).ToList(); - if (files.Count > 1) - { - throw new FileNotFoundException(string.Format(multipleFilesFoundError, searchBase)); - } - - return files.Count == 1 - ? files[0] - : null; - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +// Original License: +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// See https://github.com/aspnet/DotNetTools/blob/261b27b70027871143540af10a5cba57ce07ff97/src/dotnet-watch/Internal/MsBuildProjectFinder.cs + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace Microsoft.CodeAnalysis.Tools.MSBuild +{ + internal class MSBuildWorkspaceFinder + { + // Used to exclude dnx projects + private const string s_dnxProjectExtension = ".xproj"; + + /// + /// Finds a compatible MSBuild project or solution. + /// The base directory to search + /// A specific project or solution file to find + /// + public static (bool isSolution, string workspacePath) FindWorkspace(string searchDirectory, string workspacePath = null) + { + if (!string.IsNullOrEmpty(workspacePath)) + { + if (!Path.IsPathRooted(workspacePath)) + { + workspacePath = Path.GetFullPath(workspacePath, searchDirectory); + } + + return Directory.Exists(workspacePath) + ? FindWorkspace(workspacePath) + : FindFile(workspacePath); + } + + var foundSolution = FindMatchingFile(searchDirectory, FindSolutionFiles, Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option); + var foundProject = FindMatchingFile(searchDirectory, FindProjectFiles, Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option); + + if (!string.IsNullOrEmpty(foundSolution) && !string.IsNullOrEmpty(foundProject)) + { + throw new FileNotFoundException(string.Format(Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, searchDirectory)); + } + else if (string.IsNullOrEmpty(foundSolution) && string.IsNullOrEmpty(foundProject)) + { + throw new FileNotFoundException(string.Format(Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option, searchDirectory)); + } + + return !string.IsNullOrEmpty(foundSolution) + ? (true, foundSolution) + : (false, foundProject); + } + + private static (bool isSolution, string workspacePath) FindFile(string workspacePath) + { + var workspaceExtension = Path.GetExtension(workspacePath); + var isSolution = workspaceExtension.Equals(".sln", StringComparison.OrdinalIgnoreCase); + var isProject = !isSolution + && workspaceExtension.EndsWith("proj", StringComparison.OrdinalIgnoreCase) + && !workspaceExtension.Equals(s_dnxProjectExtension, StringComparison.OrdinalIgnoreCase); + + if (!isSolution && !isProject) + { + throw new FileNotFoundException(string.Format(Resources.The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file, Path.GetFileName(workspacePath))); + } + + if (!File.Exists(workspacePath)) + { + var message = isSolution + ? Resources.The_solution_file_0_does_not_exist + : Resources.The_project_file_0_does_not_exist; + throw new FileNotFoundException(string.Format(message, workspacePath)); + } + + return (isSolution, workspacePath); + } + + private static IEnumerable FindSolutionFiles(string basePath) => Directory.EnumerateFileSystemEntries(basePath, "*.sln", SearchOption.TopDirectoryOnly); + + private static IEnumerable FindProjectFiles(string basePath) => Directory.EnumerateFileSystemEntries(basePath, "*.*proj", SearchOption.TopDirectoryOnly) + .Where(f => !s_dnxProjectExtension.Equals(Path.GetExtension(f), StringComparison.OrdinalIgnoreCase)); + + private static string FindMatchingFile(string searchBase, Func> fileSelector, string multipleFilesFoundError) + { + if (!Directory.Exists(searchBase)) + { + return null; + } + + var files = fileSelector(searchBase).ToList(); + if (files.Count > 1) + { + throw new FileNotFoundException(string.Format(multipleFilesFoundError, searchBase)); + } + + return files.Count == 1 + ? files[0] + : null; + } + } +} diff --git a/src/Program.cs b/src/Program.cs index e406c9f0f189..0cc00a0f74ab 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,155 +1,155 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.CommandLine; -using System.CommandLine.Builder; -using System.CommandLine.Invocation; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Tools.Logging; -using Microsoft.CodeAnalysis.Tools.MSBuild; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace Microsoft.CodeAnalysis.Tools -{ - internal class Program - { - private static readonly string[] _verbosityLevels = new[] { "q", "quiet", "m", "minimal", "n", "normal", "d", "detailed", "diag", "diagnostic" }; - - private static async Task Main(string[] args) - { - var parser = new CommandLineBuilder(new Command("dotnet-format", handler: CommandHandler.Create(typeof(Program).GetMethod(nameof(Run))))) - .UseParseDirective() - .UseHelp() - .UseDebugDirective() - .UseSuggestDirective() - .RegisterWithDotnetSuggest() - .UseParseErrorReporting() - .UseExceptionHandler() - .AddOption(new Option(new[] { "-w", "--workspace" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one, new Argument(() => null))) - .AddOption(new Option(new[] { "-v", "--verbosity" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) - .AddOption(new Option(new[] { "--dry-run" }, Resources.Format_files_but_do_not_save_changes_to_disk, new Argument())) - .AddOption(new Option(new[] { "--check" }, Resources.Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_workspace, new Argument())) - .AddOption(new Option(new[] { "--files" }, Resources.The_files_to_operate_on_If_none_specified_all_files_in_workspace_will_be_operated_on, new Argument(() => null))) - .UseVersionOption() - .Build(); - - return await parser.InvokeAsync(args).ConfigureAwait(false); - } - - public static async Task Run(string workspace, string verbosity, bool dryRun, bool check, string files, IConsole console = null) - { - var serviceCollection = new ServiceCollection(); - var logLevel = GetLogLevel(verbosity); - ConfigureServices(serviceCollection, console, logLevel); - - var serviceProvider = serviceCollection.BuildServiceProvider(); - var logger = serviceProvider.GetService>(); - - var cancellationTokenSource = new CancellationTokenSource(); - Console.CancelKeyPress += (sender, e) => - { - e.Cancel = true; - cancellationTokenSource.Cancel(); - }; - - string currentDirectory = string.Empty; - - try - { - currentDirectory = Environment.CurrentDirectory; - - var workingDirectory = Directory.GetCurrentDirectory(); - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(workingDirectory, workspace); - - // To ensure we get the version of MSBuild packaged with the dotnet SDK used by the - // workspace, use its directory as our working directory which will take into account - // a global.json if present. - var workspaceDirectory = Path.GetDirectoryName(workspacePath); - Environment.CurrentDirectory = workingDirectory; - - var fileList = GetFileList(files); - - // Since we are running as a dotnet tool we should be able to find an instance of - // MSBuild in a .NET Core SDK. - var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); - - // Since we do not inherit msbuild.deps.json when referencing the SDK copy - // of MSBuild and because the SDK no longer ships with version matched assemblies, we - // register an assembly loader that will load assemblies from the msbuild path with - // equal or higher version numbers than requested. - LooseVersionAssemblyLoader.Register(msBuildInstance.MSBuildPath); - - Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); - - var formatResult = await CodeFormatter.FormatWorkspaceAsync( - logger, - workspacePath, - isSolution, - logAllWorkspaceWarnings: logLevel == LogLevel.Trace, - saveFormattedFiles: !dryRun, - filesToFormat: fileList, - cancellationTokenSource.Token).ConfigureAwait(false); - - return GetExitCode(formatResult, check); - } - catch (FileNotFoundException fex) - { - logger.LogError(fex.Message); - return 1; - } - catch (OperationCanceledException) - { - return 1; - } - finally - { - if (!string.IsNullOrEmpty(currentDirectory)) - { - Environment.CurrentDirectory = currentDirectory; - } - } - } - - public static int GetExitCode(WorkspaceFormatResult formatResult, bool check) => - !check ? formatResult.ExitCode : (formatResult.FilesFormatted == 0 ? 0 : 1); - - private static LogLevel GetLogLevel(string verbosity) - { - switch (verbosity) - { - case "q": - case "quiet": - return LogLevel.Error; - case "m": - case "minimal": - return LogLevel.Warning; - case "n": - case "normal": - return LogLevel.Information; - case "d": - case "detailed": - return LogLevel.Debug; - case "diag": - case "diagnostic": - return LogLevel.Trace; - default: - return LogLevel.Information; - } - } - - private static void ConfigureServices(ServiceCollection serviceCollection, IConsole console, LogLevel logLevel) - { - serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, logLevel)); - serviceCollection.AddLogging(); - } - - internal static string[] GetFileList(string files) - { - return files?.Split(',').Select(path => Path.GetRelativePath(Environment.CurrentDirectory, path)).ToArray(); - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.CommandLine; +using System.CommandLine.Builder; +using System.CommandLine.Invocation; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Logging; +using Microsoft.CodeAnalysis.Tools.MSBuild; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace Microsoft.CodeAnalysis.Tools +{ + internal class Program + { + private static readonly string[] _verbosityLevels = new[] { "q", "quiet", "m", "minimal", "n", "normal", "d", "detailed", "diag", "diagnostic" }; + + private static async Task Main(string[] args) + { + var parser = new CommandLineBuilder(new Command("dotnet-format", handler: CommandHandler.Create(typeof(Program).GetMethod(nameof(Run))))) + .UseParseDirective() + .UseHelp() + .UseDebugDirective() + .UseSuggestDirective() + .RegisterWithDotnetSuggest() + .UseParseErrorReporting() + .UseExceptionHandler() + .AddOption(new Option(new[] { "-w", "--workspace" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one, new Argument(() => null))) + .AddOption(new Option(new[] { "-v", "--verbosity" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) + .AddOption(new Option(new[] { "--dry-run" }, Resources.Format_files_but_do_not_save_changes_to_disk, new Argument())) + .AddOption(new Option(new[] { "--check" }, Resources.Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_workspace, new Argument())) + .AddOption(new Option(new[] { "--files" }, Resources.The_files_to_operate_on_If_none_specified_all_files_in_workspace_will_be_operated_on, new Argument(() => null))) + .UseVersionOption() + .Build(); + + return await parser.InvokeAsync(args).ConfigureAwait(false); + } + + public static async Task Run(string workspace, string verbosity, bool dryRun, bool check, string files, IConsole console = null) + { + var serviceCollection = new ServiceCollection(); + var logLevel = GetLogLevel(verbosity); + ConfigureServices(serviceCollection, console, logLevel); + + var serviceProvider = serviceCollection.BuildServiceProvider(); + var logger = serviceProvider.GetService>(); + + var cancellationTokenSource = new CancellationTokenSource(); + Console.CancelKeyPress += (sender, e) => + { + e.Cancel = true; + cancellationTokenSource.Cancel(); + }; + + string currentDirectory = string.Empty; + + try + { + currentDirectory = Environment.CurrentDirectory; + + var workingDirectory = Directory.GetCurrentDirectory(); + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(workingDirectory, workspace); + + // To ensure we get the version of MSBuild packaged with the dotnet SDK used by the + // workspace, use its directory as our working directory which will take into account + // a global.json if present. + var workspaceDirectory = Path.GetDirectoryName(workspacePath); + Environment.CurrentDirectory = workingDirectory; + + var fileList = GetFileList(files); + + // Since we are running as a dotnet tool we should be able to find an instance of + // MSBuild in a .NET Core SDK. + var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); + + // Since we do not inherit msbuild.deps.json when referencing the SDK copy + // of MSBuild and because the SDK no longer ships with version matched assemblies, we + // register an assembly loader that will load assemblies from the msbuild path with + // equal or higher version numbers than requested. + LooseVersionAssemblyLoader.Register(msBuildInstance.MSBuildPath); + + Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); + + var formatResult = await CodeFormatter.FormatWorkspaceAsync( + logger, + workspacePath, + isSolution, + logAllWorkspaceWarnings: logLevel == LogLevel.Trace, + saveFormattedFiles: !dryRun, + filesToFormat: fileList, + cancellationTokenSource.Token).ConfigureAwait(false); + + return GetExitCode(formatResult, check); + } + catch (FileNotFoundException fex) + { + logger.LogError(fex.Message); + return 1; + } + catch (OperationCanceledException) + { + return 1; + } + finally + { + if (!string.IsNullOrEmpty(currentDirectory)) + { + Environment.CurrentDirectory = currentDirectory; + } + } + } + + public static int GetExitCode(WorkspaceFormatResult formatResult, bool check) => + !check ? formatResult.ExitCode : (formatResult.FilesFormatted == 0 ? 0 : 1); + + private static LogLevel GetLogLevel(string verbosity) + { + switch (verbosity) + { + case "q": + case "quiet": + return LogLevel.Error; + case "m": + case "minimal": + return LogLevel.Warning; + case "n": + case "normal": + return LogLevel.Information; + case "d": + case "detailed": + return LogLevel.Debug; + case "diag": + case "diagnostic": + return LogLevel.Trace; + default: + return LogLevel.Information; + } + } + + private static void ConfigureServices(ServiceCollection serviceCollection, IConsole console, LogLevel logLevel) + { + serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, logLevel)); + serviceCollection.AddLogging(); + } + + internal static string[] GetFileList(string files) + { + return files?.Split(',').Select(path => Path.GetRelativePath(Environment.CurrentDirectory, path)).ToArray(); + } + } +} diff --git a/src/Resources.Designer.cs b/src/Resources.Designer.cs index e84f94a5e1ab..8de7be9a9dbd 100644 --- a/src/Resources.Designer.cs +++ b/src/Resources.Designer.cs @@ -1,298 +1,298 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.CodeAnalysis.Tools { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.Tools.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option.. - /// - internal static string Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option { - get { - return ResourceManager.GetString("Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_wit" + - "h_the_workspace_option", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option.. - /// - internal static string Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option { - get { - return ResourceManager.GetString("Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_" + - "the_workspace_option", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not format '{0}'. Format currently supports only C# and Visual Basic projects.. - /// - internal static string Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects { - get { - return ResourceManager.GetString("Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_project" + - "s", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Failed to save formatting changes.. - /// - internal static string Failed_to_save_formatting_changes { - get { - return ResourceManager.GetString("Failed_to_save_formatting_changes", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Format complete.. - /// - internal static string Format_complete { - get { - return ResourceManager.GetString("Format_complete", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Format files, but do not save changes to disk.. - /// - internal static string Format_files_but_do_not_save_changes_to_disk { - get { - return ResourceManager.GetString("Format_files_but_do_not_save_changes_to_disk", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Formatted {0} of {1} files in {2}ms.. - /// - internal static string Formatted_0_of_1_files_in_2_ms { - get { - return ResourceManager.GetString("Formatted_0_of_1_files_in_2_ms", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Formatting code file '{0}'.. - /// - internal static string Formatting_code_file_0 { - get { - return ResourceManager.GetString("Formatting_code_file_0", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Formatting code files in project '{0}'.. - /// - internal static string Formatting_code_files_in_project_0 { - get { - return ResourceManager.GetString("Formatting_code_files_in_project_0", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Formatting code files in workspace '{0}'.. - /// - internal static string Formatting_code_files_in_workspace_0 { - get { - return ResourceManager.GetString("Formatting_code_files_in_workspace_0", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Loading workspace.. - /// - internal static string Loading_workspace { - get { - return ResourceManager.GetString("Loading_workspace", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings.. - /// - internal static string Maximum_number_of_workspace_warnings_to_log_has_been_reached_Set_the_verbosity_option_to_the_diagnostic_level_to_see_all_warnings { - get { - return ResourceManager.GetString("Maximum_number_of_workspace_warnings_to_log_has_been_reached_Set_the_verbosity_op" + - "tion_to_the_diagnostic_level_to_see_all_warnings", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option.. - /// - internal static string Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option { - get { - return ResourceManager.GetString("Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace" + - "_option", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option.. - /// - internal static string Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option { - get { - return ResourceManager.GetString("Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspac" + - "e_option", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. - /// - internal static string Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic { - get { - return ResourceManager.GetString("Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diag" + - "nostic", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Skipping referenced project '{0}'.. - /// - internal static string Skipping_referenced_project_0 { - get { - return ResourceManager.GetString("Skipping_referenced_project_0", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Terminate with non-zero exit code if any files need to be formatted in the workspace.. - /// - internal static string Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_workspace { - get { - return ResourceManager.GetString("Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_worksp" + - "ace", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The file '{0}' does not appear to be a valid project or solution file.. - /// - internal static string The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file { - get { - return ResourceManager.GetString("The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The project file '{0}' does not exist.. - /// - internal static string The_project_file_0_does_not_exist { - get { - return ResourceManager.GetString("The_project_file_0_does_not_exist", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The solution file '{0}' does not exist.. - /// - internal static string The_solution_file_0_does_not_exist { - get { - return ResourceManager.GetString("The_solution_file_0_does_not_exist", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The solution or project file to operate on. If a file is not specified, the command will search the current directory for one.. - /// - internal static string The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one { - get { - return ResourceManager.GetString("The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command" + - "_will_search_the_current_directory_for_one", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Unable to load workspace.. - /// - internal static string Unable_to_load_workspace { - get { - return ResourceManager.GetString("Unable_to_load_workspace", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Workspace loaded in {0}ms.. - /// - internal static string Workspace_loaded_in_0_ms { - get { - return ResourceManager.GetString("Workspace_loaded_in_0_ms", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The files to operate on. If none specified, all files in workspace will be operated on.. - /// - internal static string The_files_to_operate_on_If_none_specified_all_files_in_workspace_will_be_operated_on { - get { - return ResourceManager.GetString("The_files_to_operate_on_If_none_specified_all_files_in_workspace_will_be_operated" + - "_on", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Formatted code file '{0}'.. - /// - internal static string Formatted_code_file_0 { - get { - return ResourceManager.GetString("Formatted_code_file_0", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.CodeAnalysis.Tools { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.Tools.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option.. + /// + internal static string Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option { + get { + return ResourceManager.GetString("Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_wit" + + "h_the_workspace_option", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option.. + /// + internal static string Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option { + get { + return ResourceManager.GetString("Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_" + + "the_workspace_option", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not format '{0}'. Format currently supports only C# and Visual Basic projects.. + /// + internal static string Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects { + get { + return ResourceManager.GetString("Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_project" + + "s", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to save formatting changes.. + /// + internal static string Failed_to_save_formatting_changes { + get { + return ResourceManager.GetString("Failed_to_save_formatting_changes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Format complete.. + /// + internal static string Format_complete { + get { + return ResourceManager.GetString("Format_complete", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Format files, but do not save changes to disk.. + /// + internal static string Format_files_but_do_not_save_changes_to_disk { + get { + return ResourceManager.GetString("Format_files_but_do_not_save_changes_to_disk", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Formatted {0} of {1} files in {2}ms.. + /// + internal static string Formatted_0_of_1_files_in_2_ms { + get { + return ResourceManager.GetString("Formatted_0_of_1_files_in_2_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Formatting code file '{0}'.. + /// + internal static string Formatting_code_file_0 { + get { + return ResourceManager.GetString("Formatting_code_file_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Formatting code files in project '{0}'.. + /// + internal static string Formatting_code_files_in_project_0 { + get { + return ResourceManager.GetString("Formatting_code_files_in_project_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Formatting code files in workspace '{0}'.. + /// + internal static string Formatting_code_files_in_workspace_0 { + get { + return ResourceManager.GetString("Formatting_code_files_in_workspace_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Loading workspace.. + /// + internal static string Loading_workspace { + get { + return ResourceManager.GetString("Loading_workspace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings.. + /// + internal static string Maximum_number_of_workspace_warnings_to_log_has_been_reached_Set_the_verbosity_option_to_the_diagnostic_level_to_see_all_warnings { + get { + return ResourceManager.GetString("Maximum_number_of_workspace_warnings_to_log_has_been_reached_Set_the_verbosity_op" + + "tion_to_the_diagnostic_level_to_see_all_warnings", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option.. + /// + internal static string Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option { + get { + return ResourceManager.GetString("Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace" + + "_option", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option.. + /// + internal static string Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option { + get { + return ResourceManager.GetString("Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspac" + + "e_option", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. + /// + internal static string Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic { + get { + return ResourceManager.GetString("Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diag" + + "nostic", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Skipping referenced project '{0}'.. + /// + internal static string Skipping_referenced_project_0 { + get { + return ResourceManager.GetString("Skipping_referenced_project_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Terminate with non-zero exit code if any files need to be formatted in the workspace.. + /// + internal static string Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_workspace { + get { + return ResourceManager.GetString("Terminate_with_non_zero_exit_code_if_any_files_need_to_be_formatted_in_the_worksp" + + "ace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The file '{0}' does not appear to be a valid project or solution file.. + /// + internal static string The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file { + get { + return ResourceManager.GetString("The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The project file '{0}' does not exist.. + /// + internal static string The_project_file_0_does_not_exist { + get { + return ResourceManager.GetString("The_project_file_0_does_not_exist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The solution file '{0}' does not exist.. + /// + internal static string The_solution_file_0_does_not_exist { + get { + return ResourceManager.GetString("The_solution_file_0_does_not_exist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The solution or project file to operate on. If a file is not specified, the command will search the current directory for one.. + /// + internal static string The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one { + get { + return ResourceManager.GetString("The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command" + + "_will_search_the_current_directory_for_one", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to load workspace.. + /// + internal static string Unable_to_load_workspace { + get { + return ResourceManager.GetString("Unable_to_load_workspace", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Workspace loaded in {0}ms.. + /// + internal static string Workspace_loaded_in_0_ms { + get { + return ResourceManager.GetString("Workspace_loaded_in_0_ms", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The files to operate on. If none specified, all files in workspace will be operated on.. + /// + internal static string The_files_to_operate_on_If_none_specified_all_files_in_workspace_will_be_operated_on { + get { + return ResourceManager.GetString("The_files_to_operate_on_If_none_specified_all_files_in_workspace_will_be_operated" + + "_on", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Formatted code file '{0}'.. + /// + internal static string Formatted_code_file_0 { + get { + return ResourceManager.GetString("Formatted_code_file_0", resourceCulture); + } + } + } +} diff --git a/src/Resources.resx b/src/Resources.resx index 02c11c1e7087..7156aa410425 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -1,195 +1,195 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - The project file '{0}' does not exist. - - - The solution file '{0}' does not exist. - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - - - Failed to save formatting changes. - - - The file '{0}' does not appear to be a valid project or solution file. - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - - - Format complete. - - - Formatting code file '{0}'. - - - Formatting code files in project '{0}'. - - - Formatting code files in workspace '{0}'. - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - - - Formatted {0} of {1} files in {2}ms. - - - Loading workspace. - - - Skipping referenced project '{0}'. - - - Unable to load workspace. - - - Workspace loaded in {0}ms. - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - - - Format files, but do not save changes to disk. - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - The files to operate on. If none specified, all files in workspace will be operated on. - - - Formatted code file '{0}'. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The project file '{0}' does not exist. + + + The solution file '{0}' does not exist. + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + + Failed to save formatting changes. + + + The file '{0}' does not appear to be a valid project or solution file. + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + + Format complete. + + + Formatting code file '{0}'. + + + Formatting code files in project '{0}'. + + + Formatting code files in workspace '{0}'. + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + + + Formatted {0} of {1} files in {2}ms. + + + Loading workspace. + + + Skipping referenced project '{0}'. + + + Unable to load workspace. + + + Workspace loaded in {0}ms. + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + + + Format files, but do not save changes to disk. + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + The files to operate on. If none specified, all files in workspace will be operated on. + + + Formatted code file '{0}'. + \ No newline at end of file diff --git a/src/Utilities/FileNameUtilities.cs b/src/Utilities/FileNameUtilities.cs index 7c9542fe1a7f..f21636aebb61 100644 --- a/src/Utilities/FileNameUtilities.cs +++ b/src/Utilities/FileNameUtilities.cs @@ -1,183 +1,183 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -namespace Roslyn.Utilities -{ - /// - /// Implements a few file name utilities that are needed by the compiler. - /// In general the compiler is not supposed to understand the format of the paths. - /// In rare cases it needs to check if a string is a valid file name or change the extension - /// (embedded resources, netmodules, output name). - /// The APIs are intentionally limited to cover just these rare cases. Do not add more APIs. - /// - internal static class FileNameUtilities - { - private const string DirectorySeparatorStr = "\\"; - internal const char DirectorySeparatorChar = '\\'; - internal const char AltDirectorySeparatorChar = '/'; - internal const char VolumeSeparatorChar = ':'; - - /// - /// Returns true if the string represents an unqualified file name. - /// The name may contain any characters but directory and volume separators. - /// - /// Path. - /// - /// True if is a simple file name, false if it is null or includes a directory specification. - /// - internal static bool IsFileName(string path) - { - return IndexOfFileName(path) == 0; - } - - /// - /// Returns the offset in where the dot that starts an extension is, or -1 if the path doesn't have an extension. - /// - /// - /// Returns 0 for path ".goo". - /// Returns -1 for path "goo.". - /// - private static int IndexOfExtension(string path) - { - if (path == null) - { - return -1; - } - - int length = path.Length; - int i = length; - - while (--i >= 0) - { - char c = path[i]; - if (c == '.') - { - if (i != length - 1) - { - return i; - } - - return -1; - } - - if (c == DirectorySeparatorChar || c == AltDirectorySeparatorChar || c == VolumeSeparatorChar) - { - break; - } - } - - return -1; - } - - /// - /// Returns an extension of the specified path string. - /// - /// - /// The same functionality as but doesn't throw an exception - /// if there are invalid characters in the path. - /// - internal static string GetExtension(string path) - { - if (path == null) - { - return null; - } - - int index = IndexOfExtension(path); - return (index >= 0) ? path.Substring(index) : string.Empty; - } - - /// - /// Removes extension from path. - /// - /// - /// Returns "goo" for path "goo.". - /// Returns "goo.." for path "goo...". - /// - private static string RemoveExtension(string path) - { - if (path == null) - { - return null; - } - - int index = IndexOfExtension(path); - if (index >= 0) - { - return path.Substring(0, index); - } - - // trim last ".", if present - if (path.Length > 0 && path[path.Length - 1] == '.') - { - return path.Substring(0, path.Length - 1); - } - - return path; - } - - /// - /// Returns path with the extension changed to . - /// - /// - /// Equivalent of - /// - /// If is null, returns null. - /// If path does not end with an extension, the new extension is appended to the path. - /// If extension is null, equivalent to . - /// - internal static string ChangeExtension(string path, string extension) - { - if (path == null) - { - return null; - } - - var pathWithoutExtension = RemoveExtension(path); - if (extension == null || path.Length == 0) - { - return pathWithoutExtension; - } - - if (extension.Length == 0 || extension[0] != '.') - { - return pathWithoutExtension + "." + extension; - } - - return pathWithoutExtension + extension; - } - - /// - /// Returns the position in given path where the file name starts. - /// - /// -1 if path is null. - internal static int IndexOfFileName(string path) - { - if (path == null) - { - return -1; - } - - for (int i = path.Length - 1; i >= 0; i--) - { - char ch = path[i]; - if (ch == DirectorySeparatorChar || ch == AltDirectorySeparatorChar || ch == VolumeSeparatorChar) - { - return i + 1; - } - } - - return 0; - } - - /// - /// Get file name from path. - /// - /// Unlike doesn't check for invalid path characters. - internal static string GetFileName(string path, bool includeExtension = true) - { - int fileNameStart = IndexOfFileName(path); - var fileName = (fileNameStart <= 0) ? path : path.Substring(fileNameStart); - return includeExtension ? fileName : RemoveExtension(fileName); - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Roslyn.Utilities +{ + /// + /// Implements a few file name utilities that are needed by the compiler. + /// In general the compiler is not supposed to understand the format of the paths. + /// In rare cases it needs to check if a string is a valid file name or change the extension + /// (embedded resources, netmodules, output name). + /// The APIs are intentionally limited to cover just these rare cases. Do not add more APIs. + /// + internal static class FileNameUtilities + { + private const string DirectorySeparatorStr = "\\"; + internal const char DirectorySeparatorChar = '\\'; + internal const char AltDirectorySeparatorChar = '/'; + internal const char VolumeSeparatorChar = ':'; + + /// + /// Returns true if the string represents an unqualified file name. + /// The name may contain any characters but directory and volume separators. + /// + /// Path. + /// + /// True if is a simple file name, false if it is null or includes a directory specification. + /// + internal static bool IsFileName(string path) + { + return IndexOfFileName(path) == 0; + } + + /// + /// Returns the offset in where the dot that starts an extension is, or -1 if the path doesn't have an extension. + /// + /// + /// Returns 0 for path ".goo". + /// Returns -1 for path "goo.". + /// + private static int IndexOfExtension(string path) + { + if (path == null) + { + return -1; + } + + int length = path.Length; + int i = length; + + while (--i >= 0) + { + char c = path[i]; + if (c == '.') + { + if (i != length - 1) + { + return i; + } + + return -1; + } + + if (c == DirectorySeparatorChar || c == AltDirectorySeparatorChar || c == VolumeSeparatorChar) + { + break; + } + } + + return -1; + } + + /// + /// Returns an extension of the specified path string. + /// + /// + /// The same functionality as but doesn't throw an exception + /// if there are invalid characters in the path. + /// + internal static string GetExtension(string path) + { + if (path == null) + { + return null; + } + + int index = IndexOfExtension(path); + return (index >= 0) ? path.Substring(index) : string.Empty; + } + + /// + /// Removes extension from path. + /// + /// + /// Returns "goo" for path "goo.". + /// Returns "goo.." for path "goo...". + /// + private static string RemoveExtension(string path) + { + if (path == null) + { + return null; + } + + int index = IndexOfExtension(path); + if (index >= 0) + { + return path.Substring(0, index); + } + + // trim last ".", if present + if (path.Length > 0 && path[path.Length - 1] == '.') + { + return path.Substring(0, path.Length - 1); + } + + return path; + } + + /// + /// Returns path with the extension changed to . + /// + /// + /// Equivalent of + /// + /// If is null, returns null. + /// If path does not end with an extension, the new extension is appended to the path. + /// If extension is null, equivalent to . + /// + internal static string ChangeExtension(string path, string extension) + { + if (path == null) + { + return null; + } + + var pathWithoutExtension = RemoveExtension(path); + if (extension == null || path.Length == 0) + { + return pathWithoutExtension; + } + + if (extension.Length == 0 || extension[0] != '.') + { + return pathWithoutExtension + "." + extension; + } + + return pathWithoutExtension + extension; + } + + /// + /// Returns the position in given path where the file name starts. + /// + /// -1 if path is null. + internal static int IndexOfFileName(string path) + { + if (path == null) + { + return -1; + } + + for (int i = path.Length - 1; i >= 0; i--) + { + char ch = path[i]; + if (ch == DirectorySeparatorChar || ch == AltDirectorySeparatorChar || ch == VolumeSeparatorChar) + { + return i + 1; + } + } + + return 0; + } + + /// + /// Get file name from path. + /// + /// Unlike doesn't check for invalid path characters. + internal static string GetFileName(string path, bool includeExtension = true) + { + int fileNameStart = IndexOfFileName(path); + var fileName = (fileNameStart <= 0) ? path : path.Substring(fileNameStart); + return includeExtension ? fileName : RemoveExtension(fileName); + } + } +} diff --git a/src/Utilities/GeneratedCodeUtilities.cs b/src/Utilities/GeneratedCodeUtilities.cs index 28836a1b942d..33a8bca6f892 100644 --- a/src/Utilities/GeneratedCodeUtilities.cs +++ b/src/Utilities/GeneratedCodeUtilities.cs @@ -1,110 +1,110 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using System.Linq; -using System.Threading; -using Microsoft.CodeAnalysis; - -namespace Roslyn.Utilities -{ - internal static class GeneratedCodeUtilities - { - private static readonly string[] s_autoGeneratedStrings = new[] { " 1) - { - return false; - } - - foreach (var attribute in symbol.GetAttributes()) - { - if (generatedCodeAttribute.Equals(attribute.AttributeClass)) - { - return true; - } - } - } - - return symbol.ContainingSymbol != null && IsGeneratedSymbolWithGeneratedCodeAttribute(symbol.ContainingSymbol, generatedCodeAttribute); - } - - internal static bool IsGeneratedCode( - SyntaxTree tree, Func isComment, CancellationToken cancellationToken) - { - return IsGeneratedCodeFile(tree.FilePath) || - BeginsWithAutoGeneratedComment(tree, isComment, cancellationToken); - } - - private static bool IsGeneratedCodeFile(string filePath) - { - if (!string.IsNullOrEmpty(filePath)) - { - var fileName = PathUtilities.GetFileName(filePath); - if (fileName.StartsWith("TemporaryGeneratedFile_", StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - var extension = PathUtilities.GetExtension(fileName); - if (!string.IsNullOrEmpty(extension)) - { - var fileNameWithoutExtension = PathUtilities.GetFileName(filePath, includeExtension: false); - if (fileNameWithoutExtension.EndsWith(".designer", StringComparison.OrdinalIgnoreCase) || - fileNameWithoutExtension.EndsWith(".generated", StringComparison.OrdinalIgnoreCase) || - fileNameWithoutExtension.EndsWith(".g", StringComparison.OrdinalIgnoreCase) || - fileNameWithoutExtension.EndsWith(".g.i", StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - } - - return false; - } - - private static bool BeginsWithAutoGeneratedComment( - SyntaxTree tree, Func isComment, CancellationToken cancellationToken) - { - var root = tree.GetRoot(cancellationToken); - if (root.HasLeadingTrivia) - { - var leadingTrivia = root.GetLeadingTrivia(); - - foreach (var trivia in leadingTrivia) - { - if (!isComment(trivia)) - { - continue; - } - - var text = trivia.ToString(); - - // Check to see if the text of the comment contains an auto generated comment. - foreach (var autoGenerated in s_autoGeneratedStrings) - { - if (text.Contains(autoGenerated)) - { - return true; - } - } - } - } - - return false; - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using Microsoft.CodeAnalysis; + +namespace Roslyn.Utilities +{ + internal static class GeneratedCodeUtilities + { + private static readonly string[] s_autoGeneratedStrings = new[] { " 1) + { + return false; + } + + foreach (var attribute in symbol.GetAttributes()) + { + if (generatedCodeAttribute.Equals(attribute.AttributeClass)) + { + return true; + } + } + } + + return symbol.ContainingSymbol != null && IsGeneratedSymbolWithGeneratedCodeAttribute(symbol.ContainingSymbol, generatedCodeAttribute); + } + + internal static bool IsGeneratedCode( + SyntaxTree tree, Func isComment, CancellationToken cancellationToken) + { + return IsGeneratedCodeFile(tree.FilePath) || + BeginsWithAutoGeneratedComment(tree, isComment, cancellationToken); + } + + private static bool IsGeneratedCodeFile(string filePath) + { + if (!string.IsNullOrEmpty(filePath)) + { + var fileName = PathUtilities.GetFileName(filePath); + if (fileName.StartsWith("TemporaryGeneratedFile_", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + var extension = PathUtilities.GetExtension(fileName); + if (!string.IsNullOrEmpty(extension)) + { + var fileNameWithoutExtension = PathUtilities.GetFileName(filePath, includeExtension: false); + if (fileNameWithoutExtension.EndsWith(".designer", StringComparison.OrdinalIgnoreCase) || + fileNameWithoutExtension.EndsWith(".generated", StringComparison.OrdinalIgnoreCase) || + fileNameWithoutExtension.EndsWith(".g", StringComparison.OrdinalIgnoreCase) || + fileNameWithoutExtension.EndsWith(".g.i", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + } + + return false; + } + + private static bool BeginsWithAutoGeneratedComment( + SyntaxTree tree, Func isComment, CancellationToken cancellationToken) + { + var root = tree.GetRoot(cancellationToken); + if (root.HasLeadingTrivia) + { + var leadingTrivia = root.GetLeadingTrivia(); + + foreach (var trivia in leadingTrivia) + { + if (!isComment(trivia)) + { + continue; + } + + var text = trivia.ToString(); + + // Check to see if the text of the comment contains an auto generated comment. + foreach (var autoGenerated in s_autoGeneratedStrings) + { + if (text.Contains(autoGenerated)) + { + return true; + } + } + } + } + + return false; + } + } +} diff --git a/src/Utilities/Hash.cs b/src/Utilities/Hash.cs index dae60ed2385d..43120cd27de4 100644 --- a/src/Utilities/Hash.cs +++ b/src/Utilities/Hash.cs @@ -1,367 +1,367 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using Microsoft.CodeAnalysis; - -namespace Roslyn.Utilities -{ - internal static class Hash - { - /// - /// This is how VB Anonymous Types combine hash values for fields. - /// - internal static int Combine(int newKey, int currentKey) - { - return unchecked((currentKey * (int)0xA5555529) + newKey); - } - - internal static int Combine(bool newKeyPart, int currentKey) - { - return Combine(currentKey, newKeyPart ? 1 : 0); - } - - /// - /// This is how VB Anonymous Types combine hash values for fields. - /// PERF: Do not use with enum types because that involves multiple - /// unnecessary boxing operations. Unfortunately, we can't constrain - /// T to "non-enum", so we'll use a more restrictive constraint. - /// - internal static int Combine(T newKeyPart, int currentKey) where T : class - { - int hash = unchecked(currentKey * (int)0xA5555529); - - if (newKeyPart != null) - { - return unchecked(hash + newKeyPart.GetHashCode()); - } - - return hash; - } - - internal static int CombineValues(IEnumerable values, int maxItemsToHash = int.MaxValue) - { - if (values == null) - { - return 0; - } - - var hashCode = 0; - var count = 0; - foreach (var value in values) - { - if (count++ >= maxItemsToHash) - { - break; - } - - // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). - if (value != null) - { - hashCode = Hash.Combine(value.GetHashCode(), hashCode); - } - } - - return hashCode; - } - - internal static int CombineValues(T[] values, int maxItemsToHash = int.MaxValue) - { - if (values == null) - { - return 0; - } - - var maxSize = Math.Min(maxItemsToHash, values.Length); - var hashCode = 0; - - for (int i = 0; i < maxSize; i++) - { - T value = values[i]; - - // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). - if (value != null) - { - hashCode = Hash.Combine(value.GetHashCode(), hashCode); - } - } - - return hashCode; - } - - internal static int CombineValues(ImmutableArray values, int maxItemsToHash = int.MaxValue) - { - if (values.IsDefaultOrEmpty) - { - return 0; - } - - var hashCode = 0; - var count = 0; - foreach (var value in values) - { - if (count++ >= maxItemsToHash) - { - break; - } - - // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). - if (value != null) - { - hashCode = Hash.Combine(value.GetHashCode(), hashCode); - } - } - - return hashCode; - } - - internal static int CombineValues(IEnumerable values, StringComparer stringComparer, int maxItemsToHash = int.MaxValue) - { - if (values == null) - { - return 0; - } - - var hashCode = 0; - var count = 0; - foreach (var value in values) - { - if (count++ >= maxItemsToHash) - { - break; - } - - if (value != null) - { - hashCode = Hash.Combine(stringComparer.GetHashCode(value), hashCode); - } - } - - return hashCode; - } - - /// - /// The offset bias value used in the FNV-1a algorithm - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - internal const int FnvOffsetBias = unchecked((int)2166136261); - - /// - /// The generative factor used in the FNV-1a algorithm - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - internal const int FnvPrime = 16777619; - - /// - /// Compute the FNV-1a hash of a sequence of bytes - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The sequence of bytes - /// The FNV-1a hash of - internal static int GetFNVHashCode(byte[] data) - { - int hashCode = Hash.FnvOffsetBias; - - for (int i = 0; i < data.Length; i++) - { - hashCode = unchecked((hashCode ^ data[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the FNV-1a hash of a sequence of bytes and determines if the byte - /// sequence is valid ASCII and hence the hash code matches a char sequence - /// encoding the same text. - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The sequence of bytes that are likely to be ASCII text. - /// True if the sequence contains only characters in the ASCII range. - /// The FNV-1a hash of - internal static int GetFNVHashCode(ReadOnlySpan data, out bool isAscii) - { - int hashCode = Hash.FnvOffsetBias; - - byte asciiMask = 0; - - for (int i = 0; i < data.Length; i++) - { - byte b = data[i]; - asciiMask |= b; - hashCode = unchecked((hashCode ^ b) * Hash.FnvPrime); - } - - isAscii = (asciiMask & 0x80) == 0; - return hashCode; - } - - /// - /// Compute the FNV-1a hash of a sequence of bytes - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The sequence of bytes - /// The FNV-1a hash of - internal static int GetFNVHashCode(ImmutableArray data) - { - int hashCode = Hash.FnvOffsetBias; - - for (int i = 0; i < data.Length; i++) - { - hashCode = unchecked((hashCode ^ data[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the hashcode of a sub-string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// Note: FNV-1a was developed and tuned for 8-bit sequences. We're using it here - /// for 16-bit Unicode chars on the understanding that the majority of chars will - /// fit into 8-bits and, therefore, the algorithm will retain its desirable traits - /// for generating hash codes. - /// - /// The input string - /// The start index of the first character to hash - /// The number of characters, beginning with to hash - /// The FNV-1a hash code of the substring beginning at and ending after characters. - internal static int GetFNVHashCode(string text, int start, int length) - { - int hashCode = Hash.FnvOffsetBias; - int end = start + length; - - for (int i = start; i < end; i++) - { - hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - internal static int GetCaseInsensitiveFNVHashCode(string text) - { - return GetCaseInsensitiveFNVHashCode(text, 0, text.Length); - } - - internal static int GetCaseInsensitiveFNVHashCode(string text, int start, int length) - { - int hashCode = Hash.FnvOffsetBias; - int end = start + length; - - for (int i = start; i < end; i++) - { - hashCode = unchecked((hashCode ^ CaseInsensitiveComparison.ToLower(text[i])) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the hashcode of a sub-string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The input string - /// The start index of the first character to hash - /// The FNV-1a hash code of the substring beginning at and ending at the end of the string. - internal static int GetFNVHashCode(string text, int start) - { - return GetFNVHashCode(text, start, length: text.Length - start); - } - - /// - /// Compute the hashcode of a string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The input string - /// The FNV-1a hash code of - internal static int GetFNVHashCode(string text) - { - return CombineFNVHash(Hash.FnvOffsetBias, text); - } - - /// - /// Compute the hashcode of a string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The input string - /// The FNV-1a hash code of - internal static int GetFNVHashCode(System.Text.StringBuilder text) - { - int hashCode = Hash.FnvOffsetBias; - int end = text.Length; - - for (int i = 0; i < end; i++) - { - hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the hashcode of a sub string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The input string as a char array - /// The start index of the first character to hash - /// The number of characters, beginning with to hash - /// The FNV-1a hash code of the substring beginning at and ending after characters. - internal static int GetFNVHashCode(char[] text, int start, int length) - { - int hashCode = Hash.FnvOffsetBias; - int end = start + length; - - for (int i = start; i < end; i++) - { - hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the hashcode of a single character using the FNV-1a algorithm - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// Note: In general, this isn't any more useful than "char.GetHashCode". However, - /// it may be needed if you need to generate the same hash code as a string or - /// substring with just a single character. - /// - /// The character to hash - /// The FNV-1a hash code of the character. - internal static int GetFNVHashCode(char ch) - { - return Hash.CombineFNVHash(Hash.FnvOffsetBias, ch); - } - - /// - /// Combine a string with an existing FNV-1a hash code - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The accumulated hash code - /// The string to combine - /// The result of combining with using the FNV-1a algorithm - internal static int CombineFNVHash(int hashCode, string text) - { - foreach (char ch in text) - { - hashCode = unchecked((hashCode ^ ch) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Combine a char with an existing FNV-1a hash code - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The accumulated hash code - /// The new character to combine - /// The result of combining with using the FNV-1a algorithm - internal static int CombineFNVHash(int hashCode, char ch) - { - return unchecked((hashCode ^ ch) * Hash.FnvPrime); - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using Microsoft.CodeAnalysis; + +namespace Roslyn.Utilities +{ + internal static class Hash + { + /// + /// This is how VB Anonymous Types combine hash values for fields. + /// + internal static int Combine(int newKey, int currentKey) + { + return unchecked((currentKey * (int)0xA5555529) + newKey); + } + + internal static int Combine(bool newKeyPart, int currentKey) + { + return Combine(currentKey, newKeyPart ? 1 : 0); + } + + /// + /// This is how VB Anonymous Types combine hash values for fields. + /// PERF: Do not use with enum types because that involves multiple + /// unnecessary boxing operations. Unfortunately, we can't constrain + /// T to "non-enum", so we'll use a more restrictive constraint. + /// + internal static int Combine(T newKeyPart, int currentKey) where T : class + { + int hash = unchecked(currentKey * (int)0xA5555529); + + if (newKeyPart != null) + { + return unchecked(hash + newKeyPart.GetHashCode()); + } + + return hash; + } + + internal static int CombineValues(IEnumerable values, int maxItemsToHash = int.MaxValue) + { + if (values == null) + { + return 0; + } + + var hashCode = 0; + var count = 0; + foreach (var value in values) + { + if (count++ >= maxItemsToHash) + { + break; + } + + // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). + if (value != null) + { + hashCode = Hash.Combine(value.GetHashCode(), hashCode); + } + } + + return hashCode; + } + + internal static int CombineValues(T[] values, int maxItemsToHash = int.MaxValue) + { + if (values == null) + { + return 0; + } + + var maxSize = Math.Min(maxItemsToHash, values.Length); + var hashCode = 0; + + for (int i = 0; i < maxSize; i++) + { + T value = values[i]; + + // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). + if (value != null) + { + hashCode = Hash.Combine(value.GetHashCode(), hashCode); + } + } + + return hashCode; + } + + internal static int CombineValues(ImmutableArray values, int maxItemsToHash = int.MaxValue) + { + if (values.IsDefaultOrEmpty) + { + return 0; + } + + var hashCode = 0; + var count = 0; + foreach (var value in values) + { + if (count++ >= maxItemsToHash) + { + break; + } + + // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). + if (value != null) + { + hashCode = Hash.Combine(value.GetHashCode(), hashCode); + } + } + + return hashCode; + } + + internal static int CombineValues(IEnumerable values, StringComparer stringComparer, int maxItemsToHash = int.MaxValue) + { + if (values == null) + { + return 0; + } + + var hashCode = 0; + var count = 0; + foreach (var value in values) + { + if (count++ >= maxItemsToHash) + { + break; + } + + if (value != null) + { + hashCode = Hash.Combine(stringComparer.GetHashCode(value), hashCode); + } + } + + return hashCode; + } + + /// + /// The offset bias value used in the FNV-1a algorithm + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + internal const int FnvOffsetBias = unchecked((int)2166136261); + + /// + /// The generative factor used in the FNV-1a algorithm + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + internal const int FnvPrime = 16777619; + + /// + /// Compute the FNV-1a hash of a sequence of bytes + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The sequence of bytes + /// The FNV-1a hash of + internal static int GetFNVHashCode(byte[] data) + { + int hashCode = Hash.FnvOffsetBias; + + for (int i = 0; i < data.Length; i++) + { + hashCode = unchecked((hashCode ^ data[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the FNV-1a hash of a sequence of bytes and determines if the byte + /// sequence is valid ASCII and hence the hash code matches a char sequence + /// encoding the same text. + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The sequence of bytes that are likely to be ASCII text. + /// True if the sequence contains only characters in the ASCII range. + /// The FNV-1a hash of + internal static int GetFNVHashCode(ReadOnlySpan data, out bool isAscii) + { + int hashCode = Hash.FnvOffsetBias; + + byte asciiMask = 0; + + for (int i = 0; i < data.Length; i++) + { + byte b = data[i]; + asciiMask |= b; + hashCode = unchecked((hashCode ^ b) * Hash.FnvPrime); + } + + isAscii = (asciiMask & 0x80) == 0; + return hashCode; + } + + /// + /// Compute the FNV-1a hash of a sequence of bytes + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The sequence of bytes + /// The FNV-1a hash of + internal static int GetFNVHashCode(ImmutableArray data) + { + int hashCode = Hash.FnvOffsetBias; + + for (int i = 0; i < data.Length; i++) + { + hashCode = unchecked((hashCode ^ data[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the hashcode of a sub-string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// Note: FNV-1a was developed and tuned for 8-bit sequences. We're using it here + /// for 16-bit Unicode chars on the understanding that the majority of chars will + /// fit into 8-bits and, therefore, the algorithm will retain its desirable traits + /// for generating hash codes. + /// + /// The input string + /// The start index of the first character to hash + /// The number of characters, beginning with to hash + /// The FNV-1a hash code of the substring beginning at and ending after characters. + internal static int GetFNVHashCode(string text, int start, int length) + { + int hashCode = Hash.FnvOffsetBias; + int end = start + length; + + for (int i = start; i < end; i++) + { + hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + internal static int GetCaseInsensitiveFNVHashCode(string text) + { + return GetCaseInsensitiveFNVHashCode(text, 0, text.Length); + } + + internal static int GetCaseInsensitiveFNVHashCode(string text, int start, int length) + { + int hashCode = Hash.FnvOffsetBias; + int end = start + length; + + for (int i = start; i < end; i++) + { + hashCode = unchecked((hashCode ^ CaseInsensitiveComparison.ToLower(text[i])) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the hashcode of a sub-string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The input string + /// The start index of the first character to hash + /// The FNV-1a hash code of the substring beginning at and ending at the end of the string. + internal static int GetFNVHashCode(string text, int start) + { + return GetFNVHashCode(text, start, length: text.Length - start); + } + + /// + /// Compute the hashcode of a string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The input string + /// The FNV-1a hash code of + internal static int GetFNVHashCode(string text) + { + return CombineFNVHash(Hash.FnvOffsetBias, text); + } + + /// + /// Compute the hashcode of a string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The input string + /// The FNV-1a hash code of + internal static int GetFNVHashCode(System.Text.StringBuilder text) + { + int hashCode = Hash.FnvOffsetBias; + int end = text.Length; + + for (int i = 0; i < end; i++) + { + hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the hashcode of a sub string using FNV-1a + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The input string as a char array + /// The start index of the first character to hash + /// The number of characters, beginning with to hash + /// The FNV-1a hash code of the substring beginning at and ending after characters. + internal static int GetFNVHashCode(char[] text, int start, int length) + { + int hashCode = Hash.FnvOffsetBias; + int end = start + length; + + for (int i = start; i < end; i++) + { + hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Compute the hashcode of a single character using the FNV-1a algorithm + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// Note: In general, this isn't any more useful than "char.GetHashCode". However, + /// it may be needed if you need to generate the same hash code as a string or + /// substring with just a single character. + /// + /// The character to hash + /// The FNV-1a hash code of the character. + internal static int GetFNVHashCode(char ch) + { + return Hash.CombineFNVHash(Hash.FnvOffsetBias, ch); + } + + /// + /// Combine a string with an existing FNV-1a hash code + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The accumulated hash code + /// The string to combine + /// The result of combining with using the FNV-1a algorithm + internal static int CombineFNVHash(int hashCode, string text) + { + foreach (char ch in text) + { + hashCode = unchecked((hashCode ^ ch) * Hash.FnvPrime); + } + + return hashCode; + } + + /// + /// Combine a char with an existing FNV-1a hash code + /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function + /// + /// The accumulated hash code + /// The new character to combine + /// The result of combining with using the FNV-1a algorithm + internal static int CombineFNVHash(int hashCode, char ch) + { + return unchecked((hashCode ^ ch) * Hash.FnvPrime); + } + } +} diff --git a/src/Utilities/PathKind.cs b/src/Utilities/PathKind.cs index 65ac8da979c6..05005d5c3aa4 100644 --- a/src/Utilities/PathKind.cs +++ b/src/Utilities/PathKind.cs @@ -1,42 +1,42 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -namespace Roslyn.Utilities -{ - internal enum PathKind - { - /// - /// Null or empty. - /// - Empty, - - /// - /// "file" - /// - Relative, - - /// - /// ".\file" - /// - RelativeToCurrentDirectory, - - /// - /// "..\file" - /// - RelativeToCurrentParent, - - /// - /// "\dir\file" - /// - RelativeToCurrentRoot, - - /// - /// "C:dir\file" - /// - RelativeToDriveDirectory, - - /// - /// "C:\file" or "\\machine" (UNC). - /// - Absolute, - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Roslyn.Utilities +{ + internal enum PathKind + { + /// + /// Null or empty. + /// + Empty, + + /// + /// "file" + /// + Relative, + + /// + /// ".\file" + /// + RelativeToCurrentDirectory, + + /// + /// "..\file" + /// + RelativeToCurrentParent, + + /// + /// "\dir\file" + /// + RelativeToCurrentRoot, + + /// + /// "C:dir\file" + /// + RelativeToDriveDirectory, + + /// + /// "C:\file" or "\\machine" (UNC). + /// + Absolute, + } +} diff --git a/src/Utilities/PathUtilities.cs b/src/Utilities/PathUtilities.cs index ce06864585fe..9c342671579f 100644 --- a/src/Utilities/PathUtilities.cs +++ b/src/Utilities/PathUtilities.cs @@ -1,749 +1,749 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Diagnostics; -using System.IO; -using System.Linq; - -namespace Roslyn.Utilities -{ - // Contains path parsing utilities. - // We need our own because System.IO.Path is insufficient for our purposes - // For example we need to be able to work with invalid paths or paths containing wildcards - internal static class PathUtilities - { - // We consider '/' a directory separator on Unix like systems. - // On Windows both / and \ are equally accepted. - internal static readonly char DirectorySeparatorChar = PlatformInformation.IsUnix ? '/' : '\\'; - internal const char AltDirectorySeparatorChar = '/'; - internal const string ParentRelativeDirectory = ".."; - internal const string ThisDirectory = "."; - internal static readonly string DirectorySeparatorStr = new string(DirectorySeparatorChar, 1); - internal const char VolumeSeparatorChar = ':'; - internal static bool IsUnixLikePlatform => PlatformInformation.IsUnix; - - /// - /// True if the character is the platform directory separator character or the alternate directory separator. - /// - public static bool IsDirectorySeparator(char c) => c == DirectorySeparatorChar || c == AltDirectorySeparatorChar; - - /// - /// True if the character is any recognized directory separator character. - /// - public static bool IsAnyDirectorySeparator(char c) => c == '\\' || c == '/'; - - /// - /// Removes trailing directory separator characters - /// - /// - /// This will trim the root directory separator: - /// "C:\" maps to "C:", and "/" maps to "" - /// - public static string TrimTrailingSeparators(string s) - { - int lastSeparator = s.Length; - while (lastSeparator > 0 && IsDirectorySeparator(s[lastSeparator - 1])) - { - lastSeparator = lastSeparator - 1; - } - - if (lastSeparator != s.Length) - { - s = s.Substring(0, lastSeparator); - } - - return s; - } - - /// - /// Ensures a trailing directory separator character - /// - public static string EnsureTrailingSeparator(string s) - { - if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) - { - return s; - } - - // Use the existing slashes in the path, if they're consistent - bool hasSlash = s.IndexOf('/') >= 0; - bool hasBackslash = s.IndexOf('\\') >= 0; - if (hasSlash && !hasBackslash) - { - return s + '/'; - } - else if (!hasSlash && hasBackslash) - { - return s + '\\'; - } - else - { - // If there are no slashes or they are inconsistent, use the current platform's slash. - return s + DirectorySeparatorChar; - } - } - - public static string GetExtension(string path) - { - return FileNameUtilities.GetExtension(path); - } - - public static string ChangeExtension(string path, string extension) - { - return FileNameUtilities.ChangeExtension(path, extension); - } - - public static string RemoveExtension(string path) - { - return FileNameUtilities.ChangeExtension(path, extension: null); - } - - public static string GetFileName(string path, bool includeExtension = true) - { - return FileNameUtilities.GetFileName(path, includeExtension); - } - - /// - /// Get directory name from path. - /// - /// - /// Unlike it doesn't check for invalid path characters - /// - /// Prefix of path that represents a directory - public static string GetDirectoryName(string path) - { - return GetDirectoryName(path, IsUnixLikePlatform); - } - - // Exposed for testing purposes only. - internal static string GetDirectoryName(string path, bool isUnixLike) - { - if (path != null) - { - var rootLength = GetPathRoot(path, isUnixLike).Length; - if (path.Length > rootLength) - { - var i = path.Length; - while (i > rootLength) - { - i--; - if (IsDirectorySeparator(path[i])) - { - if (i > 0 && IsDirectorySeparator(path[i - 1])) - { - continue; - } - - break; - } - } - - return path.Substring(0, i); - } - } - - return null; - } - - internal static bool IsSameDirectoryOrChildOf(string child, string parent) - { - parent = RemoveTrailingDirectorySeparator(parent); - - while (child != null) - { - child = RemoveTrailingDirectorySeparator(child); - - if (child.Equals(parent, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - child = GetDirectoryName(child); - } - - return false; - } - - /// - /// Gets the root part of the path. - /// - public static string GetPathRoot(string path) - { - return GetPathRoot(path, IsUnixLikePlatform); - } - - private static string GetPathRoot(string path, bool isUnixLike) - { - if (path == null) - { - return null; - } - - if (isUnixLike) - { - return GetUnixRoot(path); - } - else - { - return GetWindowsRoot(path); - } - } - - private static string GetWindowsRoot(string path) - { - // Windows - int length = path.Length; - if (length >= 1 && IsDirectorySeparator(path[0])) - { - if (length < 2 || !IsDirectorySeparator(path[1])) - { - // It was of the form: - // \ - // \f - // in this case, just return \ as the root. - return path.Substring(0, 1); - } - - // First consume all directory separators. - int i = 2; - i = ConsumeDirectorySeparators(path, length, i); - - // We've got \\ so far. If we have a path of the form \\x\y\z - // then we want to return "\\x\y" as the root portion. - bool hitSeparator = false; - while (true) - { - if (i == length) - { - // We reached the end of the path. The entire path is - // considered the root. - return path; - } - - if (!IsDirectorySeparator(path[i])) - { - // We got a non separator character. Just keep consuming. - i++; - continue; - } - - if (!hitSeparator) - { - // This is the first separator group we've hit after some server path. - // Consume them and keep going. - hitSeparator = true; - i = ConsumeDirectorySeparators(path, length, i); - continue; - } - - // We hit the second separator. The root is the path up to this point. - return path.Substring(0, i); - } - } - else if (length >= 2 && path[1] == VolumeSeparatorChar) - { - // handles c: and c:\ - return length >= 3 && IsDirectorySeparator(path[2]) - ? path.Substring(0, 3) - : path.Substring(0, 2); - } - else - { - // No path root. - return ""; - } - } - - private static int ConsumeDirectorySeparators(string path, int length, int i) - { - while (i < length && IsDirectorySeparator(path[i])) - { - i++; - } - - return i; - } - - private static string GetUnixRoot(string path) - { - // either it starts with "/" and thus has "/" as the root. Or it has no root. - return path.Length > 0 && IsDirectorySeparator(path[0]) - ? path.Substring(0, 1) - : ""; - } - - /// - /// Gets the specific kind of relative or absolute path. - /// - public static PathKind GetPathKind(string path) - { - if (string.IsNullOrWhiteSpace(path)) - { - return PathKind.Empty; - } - - // "C:\" - // "\\machine" (UNC) - // "/etc" (Unix) - if (IsAbsolute(path)) - { - return PathKind.Absolute; - } - - // "." - // ".." - // ".\" - // "..\" - if (path.Length > 0 && path[0] == '.') - { - if (path.Length == 1 || IsDirectorySeparator(path[1])) - { - return PathKind.RelativeToCurrentDirectory; - } - - if (path[1] == '.') - { - if (path.Length == 2 || IsDirectorySeparator(path[2])) - { - return PathKind.RelativeToCurrentParent; - } - } - } - - if (!IsUnixLikePlatform) - { - // "\" - // "\goo" - if (path.Length >= 1 && IsDirectorySeparator(path[0])) - { - return PathKind.RelativeToCurrentRoot; - } - - // "C:goo" - - if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) - { - return PathKind.RelativeToDriveDirectory; - } - } - - // "goo.dll" - return PathKind.Relative; - } - - /// - /// True if the path is an absolute path (rooted to drive or network share) - /// - public static bool IsAbsolute(string path) - { - if (string.IsNullOrEmpty(path)) - { - return false; - } - - if (IsUnixLikePlatform) - { - return path[0] == DirectorySeparatorChar; - } - - // "C:\" - if (IsDriveRootedAbsolutePath(path)) - { - // Including invalid paths (e.g. "*:\") - return true; - } - - // "\\machine\share" - // Including invalid/incomplete UNC paths (e.g. "\\goo") - return path.Length >= 2 && - IsDirectorySeparator(path[0]) && - IsDirectorySeparator(path[1]); - } - - /// - /// Returns true if given path is absolute and starts with a drive specification ("C:\"). - /// - private static bool IsDriveRootedAbsolutePath(string path) - { - Debug.Assert(!IsUnixLikePlatform); - return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); - } - - /// - /// Combines an absolute path with a relative. - /// - /// Absolute root path. - /// Relative path. - /// - /// An absolute combined path, or null if is - /// absolute (e.g. "C:\abc", "\\machine\share\abc"), - /// relative to the current root (e.g. "\abc"), - /// or relative to a drive directory (e.g. "C:abc\def"). - /// - /// - public static string CombineAbsoluteAndRelativePaths(string root, string relativePath) - { - Debug.Assert(IsAbsolute(root)); - - return CombinePossiblyRelativeAndRelativePaths(root, relativePath); - } - - /// - /// Combine two paths, the first of which may be absolute. - /// - /// First path: absolute, relative, or null. - /// Second path: relative and non-null. - /// null, if is null; a combined path, otherwise. - /// - public static string CombinePossiblyRelativeAndRelativePaths(string rootOpt, string relativePath) - { - if (string.IsNullOrEmpty(rootOpt)) - { - return null; - } - - switch (GetPathKind(relativePath)) - { - case PathKind.Empty: - return rootOpt; - - case PathKind.Absolute: - case PathKind.RelativeToCurrentRoot: - case PathKind.RelativeToDriveDirectory: - return null; - } - - return CombinePathsUnchecked(rootOpt, relativePath); - } - - public static string CombinePathsUnchecked(string root, string relativePath) - { - Debug.Assert(!string.IsNullOrEmpty(root)); - - char c = root[root.Length - 1]; - if (!IsDirectorySeparator(c) && c != VolumeSeparatorChar) - { - return root + DirectorySeparatorStr + relativePath; - } - - return root + relativePath; - } - - private static string RemoveTrailingDirectorySeparator(string path) - { - if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) - { - return path.Substring(0, path.Length - 1); - } - else - { - return path; - } - } - - /// - /// Determines whether an assembly reference is considered an assembly file path or an assembly name. - /// used, for example, on values of /r and #r. - /// - public static bool IsFilePath(string assemblyDisplayNameOrPath) - { - Debug.Assert(assemblyDisplayNameOrPath != null); - - string extension = FileNameUtilities.GetExtension(assemblyDisplayNameOrPath); - return string.Equals(extension, ".dll", StringComparison.OrdinalIgnoreCase) - || string.Equals(extension, ".exe", StringComparison.OrdinalIgnoreCase) - || assemblyDisplayNameOrPath.IndexOf(DirectorySeparatorChar) != -1 - || assemblyDisplayNameOrPath.IndexOf(AltDirectorySeparatorChar) != -1; - } - - /// - /// Determines if "path" contains 'component' within itself. - /// i.e. asking if the path "c:\goo\bar\baz" has component "bar" would return 'true'. - /// On the other hand, if you had "c:\goo\bar1\baz" then it would not have "bar" as a - /// component. - /// - /// A path contains a component if any file name or directory name in the path - /// matches 'component'. As such, if you had something like "\\goo" then that would - /// not have "goo" as a component. That's because here "goo" is the server name portion - /// of the UNC path, and not an actual directory or file name. - /// - public static bool ContainsPathComponent(string path, string component, bool ignoreCase) - { - var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; - if (path?.IndexOf(component, comparison) >= 0) - { - var comparer = ignoreCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; - - int count = 0; - var currentPath = path; - while (currentPath != null) - { - var currentName = GetFileName(currentPath); - if (comparer.Equals(currentName, component)) - { - return true; - } - - currentPath = GetDirectoryName(currentPath); - count++; - } - } - - return false; - } - - /// - /// Gets a path relative to a directory. - /// - public static string GetRelativePath(string directory, string fullPath) - { - string relativePath = string.Empty; - - if (IsChildPath(directory, fullPath)) - { - return GetRelativeChildPath(directory, fullPath); - } - - var directoryPathParts = GetPathParts(directory); - var fullPathParts = GetPathParts(fullPath); - - if (directoryPathParts.Length == 0 || fullPathParts.Length == 0) - { - return fullPath; - } - - int index = 0; - - // find index where full path diverges from base path - for (; index < directoryPathParts.Length; index++) - { - if (!PathsEqual(directoryPathParts[index], fullPathParts[index])) - { - break; - } - } - - // if the first part doesn't match, they don't even have the same volume - // so there can be no relative path. - if (index == 0) - { - return fullPath; - } - - // add backup notation for remaining base path levels beyond the index - var remainingParts = directoryPathParts.Length - index; - if (remainingParts > 0) - { - for (int i = 0; i < remainingParts; i++) - { - relativePath = relativePath + ParentRelativeDirectory + DirectorySeparatorStr; - } - } - - // add the rest of the full path parts - for (int i = index; i < fullPathParts.Length; i++) - { - relativePath = CombinePathsUnchecked(relativePath, fullPathParts[i]); - } - - return relativePath; - } - - /// - /// True if the child path is a child of the parent path. - /// - public static bool IsChildPath(string parentPath, string childPath) - { - return parentPath.Length > 0 - && childPath.Length > parentPath.Length - && PathsEqual(childPath, parentPath, parentPath.Length) - && (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); - } - - private static string GetRelativeChildPath(string parentPath, string childPath) - { - var relativePath = childPath.Substring(parentPath.Length); - - // trim any leading separators left over after removing leading directory - int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); - if (start > 0) - { - relativePath = relativePath.Substring(start); - } - - return relativePath; - } - - private static readonly char[] s_pathChars = new char[] { VolumeSeparatorChar, DirectorySeparatorChar, AltDirectorySeparatorChar }; - - private static string[] GetPathParts(string path) - { - var pathParts = path.Split(s_pathChars); - - // remove references to self directories ('.') - if (pathParts.Contains(ThisDirectory)) - { - pathParts = pathParts.Where(s => s != ThisDirectory).ToArray(); - } - - return pathParts; - } - - /// - /// True if the two paths are the same. - /// - public static bool PathsEqual(string path1, string path2) - { - return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); - } - - /// - /// True if the two paths are the same. (but only up to the specified length) - /// - private static bool PathsEqual(string path1, string path2, int length) - { - if (path1.Length < length || path2.Length < length) - { - return false; - } - - for (int i = 0; i < length; i++) - { - if (!PathCharEqual(path1[i], path2[i])) - { - return false; - } - } - - return true; - } - - private static bool PathCharEqual(char x, char y) - { - if (IsDirectorySeparator(x) && IsDirectorySeparator(y)) - { - return true; - } - - return IsUnixLikePlatform - ? x == y - : char.ToUpperInvariant(x) == char.ToUpperInvariant(y); - } - - private static int PathHashCode(string path) - { - int hc = 0; - - if (path != null) - { - foreach (var ch in path) - { - if (!IsDirectorySeparator(ch)) - { - hc = Hash.Combine((int)char.ToUpperInvariant(ch), hc); - } - } - } - - return hc; - } - - public static string NormalizePathPrefix(string filePath, ImmutableArray> pathMap) - { - if (pathMap.IsDefaultOrEmpty) - { - return filePath; - } - - // find the first key in the path map that matches a prefix of the normalized path. - // Note that we expect the client to use consistent capitalization; we use ordinal (case-sensitive) comparisons. - foreach (var kv in pathMap) - { - var oldPrefix = kv.Key; - if (!(oldPrefix?.Length > 0)) continue; - - // oldPrefix always ends with a path separator, so there's no need to check if it was a partial match - // e.g. for the map /goo=/bar and filename /goooo - if (filePath.StartsWith(oldPrefix, StringComparison.Ordinal)) - { - var replacementPrefix = kv.Value; - - // Replace that prefix. - var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); - - // Normalize the path separators if used uniformly in the replacement - bool hasSlash = replacementPrefix.IndexOf('/') >= 0; - bool hasBackslash = replacementPrefix.IndexOf('\\') >= 0; - return - (hasSlash && !hasBackslash) ? replacement.Replace('\\', '/') : - (hasBackslash && !hasSlash) ? replacement.Replace('/', '\\') : - replacement; - } - } - - return filePath; - } - - /// - /// Unfortunately, we cannot depend on Path.GetInvalidPathChars() or Path.GetInvalidFileNameChars() - /// From MSDN: The array returned from this method is not guaranteed to contain the complete set of characters - /// that are invalid in file and directory names. The full set of invalid characters can vary by file system. - /// https://msdn.microsoft.com/en-us/library/system.io.path.getinvalidfilenamechars.aspx - /// - /// Additionally, Path.GetInvalidPathChars() doesn't include "?" or "*" which are invalid characters, - /// and Path.GetInvalidFileNameChars() includes ":" and "\" which are valid characters. - /// - /// The more accurate way is to let the framework parse the path and throw on any errors. - /// - public static bool IsValidFilePath(string fullPath) - { - try - { - if (string.IsNullOrEmpty(fullPath)) - { - return false; - } - - // Uncomment when this is fixed: https://github.com/dotnet/roslyn/issues/19592 - // Debug.Assert(IsAbsolute(fullPath)); - - var fileInfo = new FileInfo(fullPath); - return !string.IsNullOrEmpty(fileInfo.Name); - } - catch (Exception ex) when ( - ex is ArgumentException || // The file name is empty, contains only white spaces, or contains invalid characters. - ex is PathTooLongException || // The specified path, file name, or both exceed the system-defined maximum length. - ex is NotSupportedException) // fileName contains a colon (:) in the middle of the string. - { - return false; - } - } - - public static readonly IEqualityComparer Comparer = new PathComparer(); - - private class PathComparer : IEqualityComparer - { - public bool Equals(string x, string y) - { - if (x == null && y == null) - { - return true; - } - - if (x == null || y == null) - { - return false; - } - - return PathsEqual(x, y); - } - - public int GetHashCode(string s) - { - return PathHashCode(s); - } - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.IO; +using System.Linq; + +namespace Roslyn.Utilities +{ + // Contains path parsing utilities. + // We need our own because System.IO.Path is insufficient for our purposes + // For example we need to be able to work with invalid paths or paths containing wildcards + internal static class PathUtilities + { + // We consider '/' a directory separator on Unix like systems. + // On Windows both / and \ are equally accepted. + internal static readonly char DirectorySeparatorChar = PlatformInformation.IsUnix ? '/' : '\\'; + internal const char AltDirectorySeparatorChar = '/'; + internal const string ParentRelativeDirectory = ".."; + internal const string ThisDirectory = "."; + internal static readonly string DirectorySeparatorStr = new string(DirectorySeparatorChar, 1); + internal const char VolumeSeparatorChar = ':'; + internal static bool IsUnixLikePlatform => PlatformInformation.IsUnix; + + /// + /// True if the character is the platform directory separator character or the alternate directory separator. + /// + public static bool IsDirectorySeparator(char c) => c == DirectorySeparatorChar || c == AltDirectorySeparatorChar; + + /// + /// True if the character is any recognized directory separator character. + /// + public static bool IsAnyDirectorySeparator(char c) => c == '\\' || c == '/'; + + /// + /// Removes trailing directory separator characters + /// + /// + /// This will trim the root directory separator: + /// "C:\" maps to "C:", and "/" maps to "" + /// + public static string TrimTrailingSeparators(string s) + { + int lastSeparator = s.Length; + while (lastSeparator > 0 && IsDirectorySeparator(s[lastSeparator - 1])) + { + lastSeparator = lastSeparator - 1; + } + + if (lastSeparator != s.Length) + { + s = s.Substring(0, lastSeparator); + } + + return s; + } + + /// + /// Ensures a trailing directory separator character + /// + public static string EnsureTrailingSeparator(string s) + { + if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) + { + return s; + } + + // Use the existing slashes in the path, if they're consistent + bool hasSlash = s.IndexOf('/') >= 0; + bool hasBackslash = s.IndexOf('\\') >= 0; + if (hasSlash && !hasBackslash) + { + return s + '/'; + } + else if (!hasSlash && hasBackslash) + { + return s + '\\'; + } + else + { + // If there are no slashes or they are inconsistent, use the current platform's slash. + return s + DirectorySeparatorChar; + } + } + + public static string GetExtension(string path) + { + return FileNameUtilities.GetExtension(path); + } + + public static string ChangeExtension(string path, string extension) + { + return FileNameUtilities.ChangeExtension(path, extension); + } + + public static string RemoveExtension(string path) + { + return FileNameUtilities.ChangeExtension(path, extension: null); + } + + public static string GetFileName(string path, bool includeExtension = true) + { + return FileNameUtilities.GetFileName(path, includeExtension); + } + + /// + /// Get directory name from path. + /// + /// + /// Unlike it doesn't check for invalid path characters + /// + /// Prefix of path that represents a directory + public static string GetDirectoryName(string path) + { + return GetDirectoryName(path, IsUnixLikePlatform); + } + + // Exposed for testing purposes only. + internal static string GetDirectoryName(string path, bool isUnixLike) + { + if (path != null) + { + var rootLength = GetPathRoot(path, isUnixLike).Length; + if (path.Length > rootLength) + { + var i = path.Length; + while (i > rootLength) + { + i--; + if (IsDirectorySeparator(path[i])) + { + if (i > 0 && IsDirectorySeparator(path[i - 1])) + { + continue; + } + + break; + } + } + + return path.Substring(0, i); + } + } + + return null; + } + + internal static bool IsSameDirectoryOrChildOf(string child, string parent) + { + parent = RemoveTrailingDirectorySeparator(parent); + + while (child != null) + { + child = RemoveTrailingDirectorySeparator(child); + + if (child.Equals(parent, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + child = GetDirectoryName(child); + } + + return false; + } + + /// + /// Gets the root part of the path. + /// + public static string GetPathRoot(string path) + { + return GetPathRoot(path, IsUnixLikePlatform); + } + + private static string GetPathRoot(string path, bool isUnixLike) + { + if (path == null) + { + return null; + } + + if (isUnixLike) + { + return GetUnixRoot(path); + } + else + { + return GetWindowsRoot(path); + } + } + + private static string GetWindowsRoot(string path) + { + // Windows + int length = path.Length; + if (length >= 1 && IsDirectorySeparator(path[0])) + { + if (length < 2 || !IsDirectorySeparator(path[1])) + { + // It was of the form: + // \ + // \f + // in this case, just return \ as the root. + return path.Substring(0, 1); + } + + // First consume all directory separators. + int i = 2; + i = ConsumeDirectorySeparators(path, length, i); + + // We've got \\ so far. If we have a path of the form \\x\y\z + // then we want to return "\\x\y" as the root portion. + bool hitSeparator = false; + while (true) + { + if (i == length) + { + // We reached the end of the path. The entire path is + // considered the root. + return path; + } + + if (!IsDirectorySeparator(path[i])) + { + // We got a non separator character. Just keep consuming. + i++; + continue; + } + + if (!hitSeparator) + { + // This is the first separator group we've hit after some server path. + // Consume them and keep going. + hitSeparator = true; + i = ConsumeDirectorySeparators(path, length, i); + continue; + } + + // We hit the second separator. The root is the path up to this point. + return path.Substring(0, i); + } + } + else if (length >= 2 && path[1] == VolumeSeparatorChar) + { + // handles c: and c:\ + return length >= 3 && IsDirectorySeparator(path[2]) + ? path.Substring(0, 3) + : path.Substring(0, 2); + } + else + { + // No path root. + return ""; + } + } + + private static int ConsumeDirectorySeparators(string path, int length, int i) + { + while (i < length && IsDirectorySeparator(path[i])) + { + i++; + } + + return i; + } + + private static string GetUnixRoot(string path) + { + // either it starts with "/" and thus has "/" as the root. Or it has no root. + return path.Length > 0 && IsDirectorySeparator(path[0]) + ? path.Substring(0, 1) + : ""; + } + + /// + /// Gets the specific kind of relative or absolute path. + /// + public static PathKind GetPathKind(string path) + { + if (string.IsNullOrWhiteSpace(path)) + { + return PathKind.Empty; + } + + // "C:\" + // "\\machine" (UNC) + // "/etc" (Unix) + if (IsAbsolute(path)) + { + return PathKind.Absolute; + } + + // "." + // ".." + // ".\" + // "..\" + if (path.Length > 0 && path[0] == '.') + { + if (path.Length == 1 || IsDirectorySeparator(path[1])) + { + return PathKind.RelativeToCurrentDirectory; + } + + if (path[1] == '.') + { + if (path.Length == 2 || IsDirectorySeparator(path[2])) + { + return PathKind.RelativeToCurrentParent; + } + } + } + + if (!IsUnixLikePlatform) + { + // "\" + // "\goo" + if (path.Length >= 1 && IsDirectorySeparator(path[0])) + { + return PathKind.RelativeToCurrentRoot; + } + + // "C:goo" + + if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) + { + return PathKind.RelativeToDriveDirectory; + } + } + + // "goo.dll" + return PathKind.Relative; + } + + /// + /// True if the path is an absolute path (rooted to drive or network share) + /// + public static bool IsAbsolute(string path) + { + if (string.IsNullOrEmpty(path)) + { + return false; + } + + if (IsUnixLikePlatform) + { + return path[0] == DirectorySeparatorChar; + } + + // "C:\" + if (IsDriveRootedAbsolutePath(path)) + { + // Including invalid paths (e.g. "*:\") + return true; + } + + // "\\machine\share" + // Including invalid/incomplete UNC paths (e.g. "\\goo") + return path.Length >= 2 && + IsDirectorySeparator(path[0]) && + IsDirectorySeparator(path[1]); + } + + /// + /// Returns true if given path is absolute and starts with a drive specification ("C:\"). + /// + private static bool IsDriveRootedAbsolutePath(string path) + { + Debug.Assert(!IsUnixLikePlatform); + return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); + } + + /// + /// Combines an absolute path with a relative. + /// + /// Absolute root path. + /// Relative path. + /// + /// An absolute combined path, or null if is + /// absolute (e.g. "C:\abc", "\\machine\share\abc"), + /// relative to the current root (e.g. "\abc"), + /// or relative to a drive directory (e.g. "C:abc\def"). + /// + /// + public static string CombineAbsoluteAndRelativePaths(string root, string relativePath) + { + Debug.Assert(IsAbsolute(root)); + + return CombinePossiblyRelativeAndRelativePaths(root, relativePath); + } + + /// + /// Combine two paths, the first of which may be absolute. + /// + /// First path: absolute, relative, or null. + /// Second path: relative and non-null. + /// null, if is null; a combined path, otherwise. + /// + public static string CombinePossiblyRelativeAndRelativePaths(string rootOpt, string relativePath) + { + if (string.IsNullOrEmpty(rootOpt)) + { + return null; + } + + switch (GetPathKind(relativePath)) + { + case PathKind.Empty: + return rootOpt; + + case PathKind.Absolute: + case PathKind.RelativeToCurrentRoot: + case PathKind.RelativeToDriveDirectory: + return null; + } + + return CombinePathsUnchecked(rootOpt, relativePath); + } + + public static string CombinePathsUnchecked(string root, string relativePath) + { + Debug.Assert(!string.IsNullOrEmpty(root)); + + char c = root[root.Length - 1]; + if (!IsDirectorySeparator(c) && c != VolumeSeparatorChar) + { + return root + DirectorySeparatorStr + relativePath; + } + + return root + relativePath; + } + + private static string RemoveTrailingDirectorySeparator(string path) + { + if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) + { + return path.Substring(0, path.Length - 1); + } + else + { + return path; + } + } + + /// + /// Determines whether an assembly reference is considered an assembly file path or an assembly name. + /// used, for example, on values of /r and #r. + /// + public static bool IsFilePath(string assemblyDisplayNameOrPath) + { + Debug.Assert(assemblyDisplayNameOrPath != null); + + string extension = FileNameUtilities.GetExtension(assemblyDisplayNameOrPath); + return string.Equals(extension, ".dll", StringComparison.OrdinalIgnoreCase) + || string.Equals(extension, ".exe", StringComparison.OrdinalIgnoreCase) + || assemblyDisplayNameOrPath.IndexOf(DirectorySeparatorChar) != -1 + || assemblyDisplayNameOrPath.IndexOf(AltDirectorySeparatorChar) != -1; + } + + /// + /// Determines if "path" contains 'component' within itself. + /// i.e. asking if the path "c:\goo\bar\baz" has component "bar" would return 'true'. + /// On the other hand, if you had "c:\goo\bar1\baz" then it would not have "bar" as a + /// component. + /// + /// A path contains a component if any file name or directory name in the path + /// matches 'component'. As such, if you had something like "\\goo" then that would + /// not have "goo" as a component. That's because here "goo" is the server name portion + /// of the UNC path, and not an actual directory or file name. + /// + public static bool ContainsPathComponent(string path, string component, bool ignoreCase) + { + var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; + if (path?.IndexOf(component, comparison) >= 0) + { + var comparer = ignoreCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; + + int count = 0; + var currentPath = path; + while (currentPath != null) + { + var currentName = GetFileName(currentPath); + if (comparer.Equals(currentName, component)) + { + return true; + } + + currentPath = GetDirectoryName(currentPath); + count++; + } + } + + return false; + } + + /// + /// Gets a path relative to a directory. + /// + public static string GetRelativePath(string directory, string fullPath) + { + string relativePath = string.Empty; + + if (IsChildPath(directory, fullPath)) + { + return GetRelativeChildPath(directory, fullPath); + } + + var directoryPathParts = GetPathParts(directory); + var fullPathParts = GetPathParts(fullPath); + + if (directoryPathParts.Length == 0 || fullPathParts.Length == 0) + { + return fullPath; + } + + int index = 0; + + // find index where full path diverges from base path + for (; index < directoryPathParts.Length; index++) + { + if (!PathsEqual(directoryPathParts[index], fullPathParts[index])) + { + break; + } + } + + // if the first part doesn't match, they don't even have the same volume + // so there can be no relative path. + if (index == 0) + { + return fullPath; + } + + // add backup notation for remaining base path levels beyond the index + var remainingParts = directoryPathParts.Length - index; + if (remainingParts > 0) + { + for (int i = 0; i < remainingParts; i++) + { + relativePath = relativePath + ParentRelativeDirectory + DirectorySeparatorStr; + } + } + + // add the rest of the full path parts + for (int i = index; i < fullPathParts.Length; i++) + { + relativePath = CombinePathsUnchecked(relativePath, fullPathParts[i]); + } + + return relativePath; + } + + /// + /// True if the child path is a child of the parent path. + /// + public static bool IsChildPath(string parentPath, string childPath) + { + return parentPath.Length > 0 + && childPath.Length > parentPath.Length + && PathsEqual(childPath, parentPath, parentPath.Length) + && (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); + } + + private static string GetRelativeChildPath(string parentPath, string childPath) + { + var relativePath = childPath.Substring(parentPath.Length); + + // trim any leading separators left over after removing leading directory + int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); + if (start > 0) + { + relativePath = relativePath.Substring(start); + } + + return relativePath; + } + + private static readonly char[] s_pathChars = new char[] { VolumeSeparatorChar, DirectorySeparatorChar, AltDirectorySeparatorChar }; + + private static string[] GetPathParts(string path) + { + var pathParts = path.Split(s_pathChars); + + // remove references to self directories ('.') + if (pathParts.Contains(ThisDirectory)) + { + pathParts = pathParts.Where(s => s != ThisDirectory).ToArray(); + } + + return pathParts; + } + + /// + /// True if the two paths are the same. + /// + public static bool PathsEqual(string path1, string path2) + { + return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); + } + + /// + /// True if the two paths are the same. (but only up to the specified length) + /// + private static bool PathsEqual(string path1, string path2, int length) + { + if (path1.Length < length || path2.Length < length) + { + return false; + } + + for (int i = 0; i < length; i++) + { + if (!PathCharEqual(path1[i], path2[i])) + { + return false; + } + } + + return true; + } + + private static bool PathCharEqual(char x, char y) + { + if (IsDirectorySeparator(x) && IsDirectorySeparator(y)) + { + return true; + } + + return IsUnixLikePlatform + ? x == y + : char.ToUpperInvariant(x) == char.ToUpperInvariant(y); + } + + private static int PathHashCode(string path) + { + int hc = 0; + + if (path != null) + { + foreach (var ch in path) + { + if (!IsDirectorySeparator(ch)) + { + hc = Hash.Combine((int)char.ToUpperInvariant(ch), hc); + } + } + } + + return hc; + } + + public static string NormalizePathPrefix(string filePath, ImmutableArray> pathMap) + { + if (pathMap.IsDefaultOrEmpty) + { + return filePath; + } + + // find the first key in the path map that matches a prefix of the normalized path. + // Note that we expect the client to use consistent capitalization; we use ordinal (case-sensitive) comparisons. + foreach (var kv in pathMap) + { + var oldPrefix = kv.Key; + if (!(oldPrefix?.Length > 0)) continue; + + // oldPrefix always ends with a path separator, so there's no need to check if it was a partial match + // e.g. for the map /goo=/bar and filename /goooo + if (filePath.StartsWith(oldPrefix, StringComparison.Ordinal)) + { + var replacementPrefix = kv.Value; + + // Replace that prefix. + var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); + + // Normalize the path separators if used uniformly in the replacement + bool hasSlash = replacementPrefix.IndexOf('/') >= 0; + bool hasBackslash = replacementPrefix.IndexOf('\\') >= 0; + return + (hasSlash && !hasBackslash) ? replacement.Replace('\\', '/') : + (hasBackslash && !hasSlash) ? replacement.Replace('/', '\\') : + replacement; + } + } + + return filePath; + } + + /// + /// Unfortunately, we cannot depend on Path.GetInvalidPathChars() or Path.GetInvalidFileNameChars() + /// From MSDN: The array returned from this method is not guaranteed to contain the complete set of characters + /// that are invalid in file and directory names. The full set of invalid characters can vary by file system. + /// https://msdn.microsoft.com/en-us/library/system.io.path.getinvalidfilenamechars.aspx + /// + /// Additionally, Path.GetInvalidPathChars() doesn't include "?" or "*" which are invalid characters, + /// and Path.GetInvalidFileNameChars() includes ":" and "\" which are valid characters. + /// + /// The more accurate way is to let the framework parse the path and throw on any errors. + /// + public static bool IsValidFilePath(string fullPath) + { + try + { + if (string.IsNullOrEmpty(fullPath)) + { + return false; + } + + // Uncomment when this is fixed: https://github.com/dotnet/roslyn/issues/19592 + // Debug.Assert(IsAbsolute(fullPath)); + + var fileInfo = new FileInfo(fullPath); + return !string.IsNullOrEmpty(fileInfo.Name); + } + catch (Exception ex) when ( + ex is ArgumentException || // The file name is empty, contains only white spaces, or contains invalid characters. + ex is PathTooLongException || // The specified path, file name, or both exceed the system-defined maximum length. + ex is NotSupportedException) // fileName contains a colon (:) in the middle of the string. + { + return false; + } + } + + public static readonly IEqualityComparer Comparer = new PathComparer(); + + private class PathComparer : IEqualityComparer + { + public bool Equals(string x, string y) + { + if (x == null && y == null) + { + return true; + } + + if (x == null || y == null) + { + return false; + } + + return PathsEqual(x, y); + } + + public int GetHashCode(string s) + { + return PathHashCode(s); + } + } + } +} diff --git a/src/Utilities/PlatformInformation.cs b/src/Utilities/PlatformInformation.cs index 086f169f5961..0556c147a9fb 100644 --- a/src/Utilities/PlatformInformation.cs +++ b/src/Utilities/PlatformInformation.cs @@ -1,33 +1,33 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.IO; - -namespace Roslyn.Utilities -{ - /// - /// This class provides simple properties for determining whether the current platform is Windows or Unix-based. - /// We intentionally do not use System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(...) because - /// it incorrectly reports 'true' for 'Windows' in desktop builds running on Unix-based platforms via Mono. - /// - internal static class PlatformInformation - { - public static bool IsWindows => Path.DirectorySeparatorChar == '\\'; - public static bool IsUnix => Path.DirectorySeparatorChar == '/'; - public static bool IsRunningOnMono - { - get - { - try - { - return !(Type.GetType("Mono.Runtime") is null); - } - catch - { - // Arbitrarily assume we're not running on Mono. - return false; - } - } - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.IO; + +namespace Roslyn.Utilities +{ + /// + /// This class provides simple properties for determining whether the current platform is Windows or Unix-based. + /// We intentionally do not use System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(...) because + /// it incorrectly reports 'true' for 'Windows' in desktop builds running on Unix-based platforms via Mono. + /// + internal static class PlatformInformation + { + public static bool IsWindows => Path.DirectorySeparatorChar == '\\'; + public static bool IsUnix => Path.DirectorySeparatorChar == '/'; + public static bool IsRunningOnMono + { + get + { + try + { + return !(Type.GetType("Mono.Runtime") is null); + } + catch + { + // Arbitrarily assume we're not running on Mono. + return false; + } + } + } + } +} diff --git a/src/Utilities/ProcessRunner.cs b/src/Utilities/ProcessRunner.cs index d13abf997d6f..2212cd370595 100644 --- a/src/Utilities/ProcessRunner.cs +++ b/src/Utilities/ProcessRunner.cs @@ -1,196 +1,196 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace RunTests -{ - public readonly struct ProcessResult - { - public Process Process { get; } - public int ExitCode { get; } - public ReadOnlyCollection OutputLines { get; } - public ReadOnlyCollection ErrorLines { get; } - - public ProcessResult(Process process, int exitCode, ReadOnlyCollection outputLines, ReadOnlyCollection errorLines) - { - Process = process; - ExitCode = exitCode; - OutputLines = outputLines; - ErrorLines = errorLines; - } - } - - public readonly struct ProcessInfo - { - public Process Process { get; } - public ProcessStartInfo StartInfo { get; } - public Task Result { get; } - - public int Id => Process.Id; - - public ProcessInfo(Process process, ProcessStartInfo startInfo, Task result) - { - Process = process; - StartInfo = startInfo; - Result = result; - } - } - - public static class ProcessRunner - { - public static void OpenFile(string file) - { - if (File.Exists(file)) - { - Process.Start(file); - } - } - - public static ProcessInfo CreateProcess( - string executable, - string arguments, - bool lowPriority = false, - string workingDirectory = null, - bool captureOutput = false, - bool displayWindow = true, - Dictionary environmentVariables = null, - Action onProcessStartHandler = null, - CancellationToken cancellationToken = default) => - CreateProcess( - CreateProcessStartInfo(executable, arguments, workingDirectory, captureOutput, displayWindow, environmentVariables), - lowPriority: lowPriority, - onProcessStartHandler: onProcessStartHandler, - cancellationToken: cancellationToken); - - public static ProcessInfo CreateProcess( - ProcessStartInfo processStartInfo, - bool lowPriority = false, - Action onProcessStartHandler = null, - CancellationToken cancellationToken = default) - { - var errorLines = new List(); - var outputLines = new List(); - var process = new Process(); - var tcs = new TaskCompletionSource(); - - process.EnableRaisingEvents = true; - process.StartInfo = processStartInfo; - - process.OutputDataReceived += (s, e) => - { - if (e.Data != null) - { - outputLines.Add(e.Data); - } - }; - - process.ErrorDataReceived += (s, e) => - { - if (e.Data != null) - { - errorLines.Add(e.Data); - } - }; - - process.Exited += (s, e) => - { - // We must call WaitForExit to make sure we've received all OutputDataReceived/ErrorDataReceived calls - // or else we'll be returning a list we're still modifying. For paranoia, we'll start a task here rather - // than enter right back into the Process type and start a wait which isn't guaranteed to be safe. - Task.Run(() => - { - process.WaitForExit(); - var result = new ProcessResult( - process, - process.ExitCode, - new ReadOnlyCollection(outputLines), - new ReadOnlyCollection(errorLines)); - tcs.TrySetResult(result); - }); - }; - - var registration = cancellationToken.Register(() => - { - if (tcs.TrySetCanceled()) - { - // If the underlying process is still running, we should kill it - if (!process.HasExited) - { - try - { - process.Kill(); - } - catch (InvalidOperationException) - { - // Ignore, since the process is already dead - } - } - } - }); - - process.Start(); - onProcessStartHandler?.Invoke(process); - - if (lowPriority) - { - process.PriorityClass = ProcessPriorityClass.BelowNormal; - } - - if (processStartInfo.RedirectStandardOutput) - { - process.BeginOutputReadLine(); - } - - if (processStartInfo.RedirectStandardError) - { - process.BeginErrorReadLine(); - } - - return new ProcessInfo(process, processStartInfo, tcs.Task); - } - - public static ProcessStartInfo CreateProcessStartInfo( - string executable, - string arguments, - string workingDirectory = null, - bool captureOutput = false, - bool displayWindow = true, - Dictionary environmentVariables = null) - { - var processStartInfo = new ProcessStartInfo(executable, arguments); - - if (!string.IsNullOrEmpty(workingDirectory)) - { - processStartInfo.WorkingDirectory = workingDirectory; - } - - if (environmentVariables != null) - { - foreach (var pair in environmentVariables) - { - processStartInfo.EnvironmentVariables[pair.Key] = pair.Value; - } - } - - if (captureOutput) - { - processStartInfo.UseShellExecute = false; - processStartInfo.RedirectStandardOutput = true; - processStartInfo.RedirectStandardError = true; - } - else - { - processStartInfo.CreateNoWindow = !displayWindow; - processStartInfo.UseShellExecute = displayWindow; - } - - return processStartInfo; - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace RunTests +{ + public readonly struct ProcessResult + { + public Process Process { get; } + public int ExitCode { get; } + public ReadOnlyCollection OutputLines { get; } + public ReadOnlyCollection ErrorLines { get; } + + public ProcessResult(Process process, int exitCode, ReadOnlyCollection outputLines, ReadOnlyCollection errorLines) + { + Process = process; + ExitCode = exitCode; + OutputLines = outputLines; + ErrorLines = errorLines; + } + } + + public readonly struct ProcessInfo + { + public Process Process { get; } + public ProcessStartInfo StartInfo { get; } + public Task Result { get; } + + public int Id => Process.Id; + + public ProcessInfo(Process process, ProcessStartInfo startInfo, Task result) + { + Process = process; + StartInfo = startInfo; + Result = result; + } + } + + public static class ProcessRunner + { + public static void OpenFile(string file) + { + if (File.Exists(file)) + { + Process.Start(file); + } + } + + public static ProcessInfo CreateProcess( + string executable, + string arguments, + bool lowPriority = false, + string workingDirectory = null, + bool captureOutput = false, + bool displayWindow = true, + Dictionary environmentVariables = null, + Action onProcessStartHandler = null, + CancellationToken cancellationToken = default) => + CreateProcess( + CreateProcessStartInfo(executable, arguments, workingDirectory, captureOutput, displayWindow, environmentVariables), + lowPriority: lowPriority, + onProcessStartHandler: onProcessStartHandler, + cancellationToken: cancellationToken); + + public static ProcessInfo CreateProcess( + ProcessStartInfo processStartInfo, + bool lowPriority = false, + Action onProcessStartHandler = null, + CancellationToken cancellationToken = default) + { + var errorLines = new List(); + var outputLines = new List(); + var process = new Process(); + var tcs = new TaskCompletionSource(); + + process.EnableRaisingEvents = true; + process.StartInfo = processStartInfo; + + process.OutputDataReceived += (s, e) => + { + if (e.Data != null) + { + outputLines.Add(e.Data); + } + }; + + process.ErrorDataReceived += (s, e) => + { + if (e.Data != null) + { + errorLines.Add(e.Data); + } + }; + + process.Exited += (s, e) => + { + // We must call WaitForExit to make sure we've received all OutputDataReceived/ErrorDataReceived calls + // or else we'll be returning a list we're still modifying. For paranoia, we'll start a task here rather + // than enter right back into the Process type and start a wait which isn't guaranteed to be safe. + Task.Run(() => + { + process.WaitForExit(); + var result = new ProcessResult( + process, + process.ExitCode, + new ReadOnlyCollection(outputLines), + new ReadOnlyCollection(errorLines)); + tcs.TrySetResult(result); + }); + }; + + var registration = cancellationToken.Register(() => + { + if (tcs.TrySetCanceled()) + { + // If the underlying process is still running, we should kill it + if (!process.HasExited) + { + try + { + process.Kill(); + } + catch (InvalidOperationException) + { + // Ignore, since the process is already dead + } + } + } + }); + + process.Start(); + onProcessStartHandler?.Invoke(process); + + if (lowPriority) + { + process.PriorityClass = ProcessPriorityClass.BelowNormal; + } + + if (processStartInfo.RedirectStandardOutput) + { + process.BeginOutputReadLine(); + } + + if (processStartInfo.RedirectStandardError) + { + process.BeginErrorReadLine(); + } + + return new ProcessInfo(process, processStartInfo, tcs.Task); + } + + public static ProcessStartInfo CreateProcessStartInfo( + string executable, + string arguments, + string workingDirectory = null, + bool captureOutput = false, + bool displayWindow = true, + Dictionary environmentVariables = null) + { + var processStartInfo = new ProcessStartInfo(executable, arguments); + + if (!string.IsNullOrEmpty(workingDirectory)) + { + processStartInfo.WorkingDirectory = workingDirectory; + } + + if (environmentVariables != null) + { + foreach (var pair in environmentVariables) + { + processStartInfo.EnvironmentVariables[pair.Key] = pair.Value; + } + } + + if (captureOutput) + { + processStartInfo.UseShellExecute = false; + processStartInfo.RedirectStandardOutput = true; + processStartInfo.RedirectStandardError = true; + } + else + { + processStartInfo.CreateNoWindow = !displayWindow; + processStartInfo.UseShellExecute = displayWindow; + } + + return processStartInfo; + } + } +} diff --git a/src/WorkspaceFormatResult.cs b/src/WorkspaceFormatResult.cs index 14cd9469c786..13511e759816 100644 --- a/src/WorkspaceFormatResult.cs +++ b/src/WorkspaceFormatResult.cs @@ -1,9 +1,9 @@ -namespace Microsoft.CodeAnalysis.Tools -{ - internal class WorkspaceFormatResult - { - public int ExitCode { get; set; } - public int FilesFormatted { get; set; } - public int FileCount { get; set; } - } -} +namespace Microsoft.CodeAnalysis.Tools +{ + internal class WorkspaceFormatResult + { + public int ExitCode { get; set; } + public int FilesFormatted { get; set; } + public int FileCount { get; set; } + } +} diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index a2b1e326f2df..9fd65341ee6f 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -1,60 +1,60 @@ - - - - netcoreapp2.1 - Exe - 7.3 - Microsoft.CodeAnalysis.Tools - Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings. - - true - true - true - - win-x64;win-x86;osx-x64 - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - + + + + netcoreapp2.1 + Exe + 7.3 + Microsoft.CodeAnalysis.Tools + Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings. + + true + true + true + + win-x64;win-x86;osx-x64 + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + diff --git a/src/runtimeconfig.template.json b/src/runtimeconfig.template.json index a35af1d706bf..f022b7ffce12 100644 --- a/src/runtimeconfig.template.json +++ b/src/runtimeconfig.template.json @@ -1,3 +1,3 @@ -{ - "rollForwardOnNoCandidateFx": 2 +{ + "rollForwardOnNoCandidateFx": 2 } \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 9ad94ef673d8..03e5a87e27d8 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - V adresáři {0} nešlo najít soubor projektu MSBuild nebo soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - {0} nejde formátovat. Formátovat jde v současné době jenom projekty v jazycích C# a Visual Basic. - - - - Failed to save formatting changes. - Nepodařilo se uložit změny formátování. - - - - Format complete. - Formátování se dokončilo. - - - - Format files, but do not save changes to disk. - Soubory se naformátují, ale změny se neuloží na disk. - - - - Formatted {0} of {1} files in {2}ms. - Naformátovali jsme {0} z {1} souborů za {2} ms. - - - - Formatting code file '{0}'. - Formátuje se soubor kódu {0}. - - - - Formatting code files in project '{0}'. - Formátují se soubory kódu v projektu {0}. - - - - Formatting code files in workspace '{0}'. - Formátují se soubory kódu v pracovním prostoru {0}. - - - - Loading workspace. - Načítá se pracovní prostor. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Dosáhlo se maximálního počtu upozornění pracovního prostoru, který se dá protokolovat. Pokud chcete zobrazit všechna upozornění, nastavte parametr --verbosity na úroveň diagnostic. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - {0} obsahuje více souborů projektů MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Nastavte úroveň podrobností. Povolené hodnoty jsou: q[uiet], m[inimal], n[ormal], d[etailed] a diag[nostic] - - - - Skipping referenced project '{0}'. - Přeskočí se odkazovaný projekt {0}. - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - Soubor {0} zřejmě není platný soubor projektu nebo řešení. - - - - The project file '{0}' does not exist. - Soubor projektu {0} neexistuje. - - - - The solution file '{0}' does not exist. - Soubor řešení {0} neexistuje. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Soubor řešení nebo projektu, se kterým se má operace provést. Pokud soubor není zadaný, příkaz ho bude hledat v aktuálním adresáři. - - - - Unable to load workspace. - Pracovní prostor nejde načíst. - - - - Workspace loaded in {0}ms. - Pracovní prostor se načetl za {0} ms. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + V adresáři {0} nešlo najít soubor projektu MSBuild nebo soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + {0} nejde formátovat. Formátovat jde v současné době jenom projekty v jazycích C# a Visual Basic. + + + + Failed to save formatting changes. + Nepodařilo se uložit změny formátování. + + + + Format complete. + Formátování se dokončilo. + + + + Format files, but do not save changes to disk. + Soubory se naformátují, ale změny se neuloží na disk. + + + + Formatted {0} of {1} files in {2}ms. + Naformátovali jsme {0} z {1} souborů za {2} ms. + + + + Formatting code file '{0}'. + Formátuje se soubor kódu {0}. + + + + Formatting code files in project '{0}'. + Formátují se soubory kódu v projektu {0}. + + + + Formatting code files in workspace '{0}'. + Formátují se soubory kódu v pracovním prostoru {0}. + + + + Loading workspace. + Načítá se pracovní prostor. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Dosáhlo se maximálního počtu upozornění pracovního prostoru, který se dá protokolovat. Pokud chcete zobrazit všechna upozornění, nastavte parametr --verbosity na úroveň diagnostic. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + {0} obsahuje více souborů projektů MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Nastavte úroveň podrobností. Povolené hodnoty jsou: q[uiet], m[inimal], n[ormal], d[etailed] a diag[nostic] + + + + Skipping referenced project '{0}'. + Přeskočí se odkazovaný projekt {0}. + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + Soubor {0} zřejmě není platný soubor projektu nebo řešení. + + + + The project file '{0}' does not exist. + Soubor projektu {0} neexistuje. + + + + The solution file '{0}' does not exist. + Soubor řešení {0} neexistuje. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Soubor řešení nebo projektu, se kterým se má operace provést. Pokud soubor není zadaný, příkaz ho bude hledat v aktuálním adresáři. + + + + Unable to load workspace. + Pracovní prostor nejde načíst. + + + + Workspace loaded in {0}ms. + Pracovní prostor se načetl za {0} ms. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 3e9e89dfa29a..5a211e901e12 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappe gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Kein MSBuild-Projektdatei oder Projektmappendatei in "{0}" gefunden. Geben Sie die zu verwendende Datei mit der Option "--workspace" an. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - "{0}" konnte nicht formatiert werden. Derzeit wird die Formatierung nur für C#- und Visual Basic-Projekte unterstützt. - - - - Failed to save formatting changes. - Fehler beim Speichern von Formatierungsänderungen. - - - - Format complete. - Formatierung abgeschlossen. - - - - Format files, but do not save changes to disk. - Dateien formatieren, Änderungen aber nicht auf Festplatte speichern. - - - - Formatted {0} of {1} files in {2}ms. - {0} von {1} Dateien in {2} ms formatiert. - - - - Formatting code file '{0}'. - Codedatei "{0}" wird formatiert. - - - - Formatting code files in project '{0}'. - Codedateien im Projekt "{0}" werden formatiert. - - - - Formatting code files in workspace '{0}'. - Codedateien im Arbeitsbereich "{0}" werden formatiert. - - - - Loading workspace. - Arbeitsbereich wird geladen. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Die maximale Anzahl der Arbeitsbereichwarnungen wurde erreicht. Legen Sie --verbosity auf "diagnostic" fest, um alle Warnungen anzuzeigen. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Mehrere MSBuild-Projektdateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Mehrere MSBuild Projektmappendateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Legen Sie den Ausführlichkeitsgrad fest. Zulässige Werte sind "q[uiet]", "m[inimal]", "n[ormal]", "d[etailed]" und "diag[nostic]". - - - - Skipping referenced project '{0}'. - Überspringen von referenziertem Projekt "{0}". - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. - - - - The project file '{0}' does not exist. - Die Projektdatei "{0}" ist nicht vorhanden. - - - - The solution file '{0}' does not exist. - Die Projektmappendatei "{0}" ist nicht vorhanden. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Die Projektmappe oder Projektdatei, die verwendet werden soll. Wenn keine Datei angegeben ist, durchsucht der Befehl das aktuelle Verzeichnis nach einer Datei. - - - - Unable to load workspace. - Arbeitsbereich kann nicht geladen werden. - - - - Workspace loaded in {0}ms. - Arbeitsbereich in {0} ms geladen. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappe gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Kein MSBuild-Projektdatei oder Projektmappendatei in "{0}" gefunden. Geben Sie die zu verwendende Datei mit der Option "--workspace" an. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + "{0}" konnte nicht formatiert werden. Derzeit wird die Formatierung nur für C#- und Visual Basic-Projekte unterstützt. + + + + Failed to save formatting changes. + Fehler beim Speichern von Formatierungsänderungen. + + + + Format complete. + Formatierung abgeschlossen. + + + + Format files, but do not save changes to disk. + Dateien formatieren, Änderungen aber nicht auf Festplatte speichern. + + + + Formatted {0} of {1} files in {2}ms. + {0} von {1} Dateien in {2} ms formatiert. + + + + Formatting code file '{0}'. + Codedatei "{0}" wird formatiert. + + + + Formatting code files in project '{0}'. + Codedateien im Projekt "{0}" werden formatiert. + + + + Formatting code files in workspace '{0}'. + Codedateien im Arbeitsbereich "{0}" werden formatiert. + + + + Loading workspace. + Arbeitsbereich wird geladen. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Die maximale Anzahl der Arbeitsbereichwarnungen wurde erreicht. Legen Sie --verbosity auf "diagnostic" fest, um alle Warnungen anzuzeigen. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Mehrere MSBuild-Projektdateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Mehrere MSBuild Projektmappendateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Legen Sie den Ausführlichkeitsgrad fest. Zulässige Werte sind "q[uiet]", "m[inimal]", "n[ormal]", "d[etailed]" und "diag[nostic]". + + + + Skipping referenced project '{0}'. + Überspringen von referenziertem Projekt "{0}". + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. + + + + The project file '{0}' does not exist. + Die Projektdatei "{0}" ist nicht vorhanden. + + + + The solution file '{0}' does not exist. + Die Projektmappendatei "{0}" ist nicht vorhanden. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Die Projektmappe oder Projektdatei, die verwendet werden soll. Wenn keine Datei angegeben ist, durchsucht der Befehl das aktuelle Verzeichnis nach einer Datei. + + + + Unable to load workspace. + Arbeitsbereich kann nicht geladen werden. + + + + Workspace loaded in {0}ms. + Arbeitsbereich in {0} ms geladen. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index a49b87da24d3..6d62dc972cb7 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - Se encontró un archivo de proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - No se pudo encontrar un archivo de proyecto o archivo de solución MSBuild en "{0}". Especifique cuál debe utilizarse con la opción --workspace. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - No se pudo dar formato a "{0}". El formato admite solo proyectos de C# y Visual Basic en este momento. - - - - Failed to save formatting changes. - Error al guardar cambios de formato. - - - - Format complete. - Formato completo. - - - - Format files, but do not save changes to disk. - Formato de archivos, pero no guardar los cambios al disco. - - - - Formatted {0} of {1} files in {2}ms. - {0} de {1} archivos con formato en {2} ms. - - - - Formatting code file '{0}'. - Formato de archivo de código "{0}". - - - - Formatting code files in project '{0}'. - Formato de archivos de código de proyecto "{0}". - - - - Formatting code files in workspace '{0}'. - Aplicar formato a archivos de código en espacio de trabajo "{0}". - - - - Loading workspace. - Cargando área de trabajo. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Se ha alcanzado el número máximo de advertencias del espacio de trabajo que se deben registrar. Establezca la opción --verbosity al nivel "diagnóstico" para ver todas las advertencias. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Se encontraron múltiples archivos de proyecto MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Se encontraron múltiples archivos de solución MSBuild en "{0}". Especifique cuáles se deben utilizar con la opción --workspace. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Establecer el nivel de detalle. Los valores permitidos son q[uiet], m[inimal], n[ormal], d[etailed]c y diag[nostic] - - - - Skipping referenced project '{0}'. - Omitiendo projecto al que se hace referencia "{0}". - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - El archivo "{0}" no parece ser un proyecto o archivo de solución válido. - - - - The project file '{0}' does not exist. - El archivo de proyecto "{0}" no existe. - - - - The solution file '{0}' does not exist. - El archivo de solución "{0}" no existe. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - El archivo de solución o el proyecto para operar. Si no se especifica un archivo, el comando buscará uno en el directorio actual. - - - - Unable to load workspace. - No se puede cargar el espacio de trabajo. - - - - Workspace loaded in {0}ms. - Espacio de trabajo cargado en {0} ms. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Se encontró un archivo de proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + No se pudo encontrar un archivo de proyecto o archivo de solución MSBuild en "{0}". Especifique cuál debe utilizarse con la opción --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + No se pudo dar formato a "{0}". El formato admite solo proyectos de C# y Visual Basic en este momento. + + + + Failed to save formatting changes. + Error al guardar cambios de formato. + + + + Format complete. + Formato completo. + + + + Format files, but do not save changes to disk. + Formato de archivos, pero no guardar los cambios al disco. + + + + Formatted {0} of {1} files in {2}ms. + {0} de {1} archivos con formato en {2} ms. + + + + Formatting code file '{0}'. + Formato de archivo de código "{0}". + + + + Formatting code files in project '{0}'. + Formato de archivos de código de proyecto "{0}". + + + + Formatting code files in workspace '{0}'. + Aplicar formato a archivos de código en espacio de trabajo "{0}". + + + + Loading workspace. + Cargando área de trabajo. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Se ha alcanzado el número máximo de advertencias del espacio de trabajo que se deben registrar. Establezca la opción --verbosity al nivel "diagnóstico" para ver todas las advertencias. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Se encontraron múltiples archivos de proyecto MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Se encontraron múltiples archivos de solución MSBuild en "{0}". Especifique cuáles se deben utilizar con la opción --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Establecer el nivel de detalle. Los valores permitidos son q[uiet], m[inimal], n[ormal], d[etailed]c y diag[nostic] + + + + Skipping referenced project '{0}'. + Omitiendo projecto al que se hace referencia "{0}". + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + El archivo "{0}" no parece ser un proyecto o archivo de solución válido. + + + + The project file '{0}' does not exist. + El archivo de proyecto "{0}" no existe. + + + + The solution file '{0}' does not exist. + El archivo de solución "{0}" no existe. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + El archivo de solución o el proyecto para operar. Si no se especifica un archivo, el comando buscará uno en el directorio actual. + + + + Unable to load workspace. + No se puede cargar el espacio de trabajo. + + + + Workspace loaded in {0}ms. + Espacio de trabajo cargado en {0} ms. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 7e7eb5756348..4226b355f1f5 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - Un fichier projet et un fichier solution MSBuild ont été trouvés dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Fichier projet ou solution MSBuild introuvable dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Impossible de mettre en forme '{0}'. L'opération Mettre en forme prend uniquement en charge les projets C# et Visual Basic pour le moment. - - - - Failed to save formatting changes. - L'enregistrement des changements de mise en forme a échoué. - - - - Format complete. - Format complet. - - - - Format files, but do not save changes to disk. - Mettez en forme les fichiers, mais n'enregistrez pas les changements sur le disque. - - - - Formatted {0} of {1} files in {2}ms. - {0} fichiers sur {1} mis en forme en {2} ms. - - - - Formatting code file '{0}'. - Mise en forme du fichier de code '{0}'. - - - - Formatting code files in project '{0}'. - Mise en forme des fichiers de code du projet '{0}'. - - - - Formatting code files in workspace '{0}'. - Mise en forme des fichiers de code dans l'espace de travail '{0}'. - - - - Loading workspace. - Chargement de l'espace de travail. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Le nombre maximal d'avertissements d'espace de travail à journaliser a été atteint. Définissez l'option --verbosity sur le niveau 'diagnostic' pour voir les avertissements. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Plusieurs fichiers projet MSBuild dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Plusieurs fichiers solution MSBuild dans '{0}'. Spécifiez ceux à utiliser avec l'option --workspace. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Définissez le niveau de détail. Les valeurs autorisées sont q[uiet], m[inimal], n[ormal], d[etailed] et diag[nostic] - - - - Skipping referenced project '{0}'. - Saut du projet référencé '{0}'. - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. - - - - The project file '{0}' does not exist. - Le fichier projet '{0}' n'existe pas. - - - - The solution file '{0}' does not exist. - Le fichier solution '{0}' n'existe pas. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Fichier solution ou projet à utiliser. Si un fichier n'est pas spécifié, la commande en recherche un dans le répertoire actuel. - - - - Unable to load workspace. - Impossible de charger l'espace de travail. - - - - Workspace loaded in {0}ms. - Espace de travail chargé en {0} ms. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Un fichier projet et un fichier solution MSBuild ont été trouvés dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Fichier projet ou solution MSBuild introuvable dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Impossible de mettre en forme '{0}'. L'opération Mettre en forme prend uniquement en charge les projets C# et Visual Basic pour le moment. + + + + Failed to save formatting changes. + L'enregistrement des changements de mise en forme a échoué. + + + + Format complete. + Format complet. + + + + Format files, but do not save changes to disk. + Mettez en forme les fichiers, mais n'enregistrez pas les changements sur le disque. + + + + Formatted {0} of {1} files in {2}ms. + {0} fichiers sur {1} mis en forme en {2} ms. + + + + Formatting code file '{0}'. + Mise en forme du fichier de code '{0}'. + + + + Formatting code files in project '{0}'. + Mise en forme des fichiers de code du projet '{0}'. + + + + Formatting code files in workspace '{0}'. + Mise en forme des fichiers de code dans l'espace de travail '{0}'. + + + + Loading workspace. + Chargement de l'espace de travail. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Le nombre maximal d'avertissements d'espace de travail à journaliser a été atteint. Définissez l'option --verbosity sur le niveau 'diagnostic' pour voir les avertissements. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Plusieurs fichiers projet MSBuild dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Plusieurs fichiers solution MSBuild dans '{0}'. Spécifiez ceux à utiliser avec l'option --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Définissez le niveau de détail. Les valeurs autorisées sont q[uiet], m[inimal], n[ormal], d[etailed] et diag[nostic] + + + + Skipping referenced project '{0}'. + Saut du projet référencé '{0}'. + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. + + + + The project file '{0}' does not exist. + Le fichier projet '{0}' n'existe pas. + + + + The solution file '{0}' does not exist. + Le fichier solution '{0}' n'existe pas. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Fichier solution ou projet à utiliser. Si un fichier n'est pas spécifié, la commande en recherche un dans le répertoire actuel. + + + + Unable to load workspace. + Impossible de charger l'espace de travail. + + + + Workspace loaded in {0}ms. + Espace de travail chargé en {0} ms. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 45c0db5f0f40..595999800b43 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - In '{0}' non è stato possibile trovare alcun file di progetto o di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Non è stato possibile formattare '{0}'. Il formato supporta attualmente solo progetti C# e Visual Basic. - - - - Failed to save formatting changes. - Non è stato possibile salvare le modifiche di formattazione. - - - - Format complete. - Formattazione completata. - - - - Format files, but do not save changes to disk. - Formatta i file, ma non salvare le modifiche sul disco. - - - - Formatted {0} of {1} files in {2}ms. - Sono stati formattati {0} di {1} file in {2} ms. - - - - Formatting code file '{0}'. - Formattazione del file di codice '{0}'. - - - - Formatting code files in project '{0}'. - Formattazione del file di codice nel progetto '{0}'. - - - - Formatting code files in workspace '{0}'. - Formattazione del file di codice nell'area di lavoro '{0}'. - - - - Loading workspace. - Caricamento dell'area di lavoro. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - È stato raggiunto il numero massimo di avvisi da registrare per l'area di lavoro. Per visualizzare tutti gli avvisi, impostare l'opzione --verbosity sul livello 'diagnostic'. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - In '{0}' sono stati trovati più file di progetto MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Consente di impostare il livello di dettaglio. I valori consentiti sono q[uiet], m[inimal], n[ormal], d[etailed] e diag[nostic] - - - - Skipping referenced project '{0}'. - Il progetto di riferimento '{0}' verrà ignorato. - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - Il file '{0}' non sembra essere un file di progetto o di soluzione valido. - - - - The project file '{0}' does not exist. - Il file di progetto '{0}' non esiste. - - - - The solution file '{0}' does not exist. - Il file di soluzione '{0}' non esiste. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - File di progetto o di soluzione su cui intervenire. Se non si specifica un file, il comando ne cercherà uno nella directory corrente. - - - - Unable to load workspace. - Non è possibile caricare l'area di lavoro. - - - - Workspace loaded in {0}ms. - Area di lavoro caricata in {0} ms. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + In '{0}' non è stato possibile trovare alcun file di progetto o di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Non è stato possibile formattare '{0}'. Il formato supporta attualmente solo progetti C# e Visual Basic. + + + + Failed to save formatting changes. + Non è stato possibile salvare le modifiche di formattazione. + + + + Format complete. + Formattazione completata. + + + + Format files, but do not save changes to disk. + Formatta i file, ma non salvare le modifiche sul disco. + + + + Formatted {0} of {1} files in {2}ms. + Sono stati formattati {0} di {1} file in {2} ms. + + + + Formatting code file '{0}'. + Formattazione del file di codice '{0}'. + + + + Formatting code files in project '{0}'. + Formattazione del file di codice nel progetto '{0}'. + + + + Formatting code files in workspace '{0}'. + Formattazione del file di codice nell'area di lavoro '{0}'. + + + + Loading workspace. + Caricamento dell'area di lavoro. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + È stato raggiunto il numero massimo di avvisi da registrare per l'area di lavoro. Per visualizzare tutti gli avvisi, impostare l'opzione --verbosity sul livello 'diagnostic'. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + In '{0}' sono stati trovati più file di progetto MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Consente di impostare il livello di dettaglio. I valori consentiti sono q[uiet], m[inimal], n[ormal], d[etailed] e diag[nostic] + + + + Skipping referenced project '{0}'. + Il progetto di riferimento '{0}' verrà ignorato. + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + Il file '{0}' non sembra essere un file di progetto o di soluzione valido. + + + + The project file '{0}' does not exist. + Il file di progetto '{0}' non esiste. + + + + The solution file '{0}' does not exist. + Il file di soluzione '{0}' non esiste. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + File di progetto o di soluzione su cui intervenire. Se non si specifica un file, il comando ne cercherà uno nella directory corrente. + + + + Unable to load workspace. + Non è possibile caricare l'area di lavoro. + + + + Workspace loaded in {0}ms. + Area di lavoro caricata in {0} ms. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 5d09465ef7f0..31b8556c190c 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - MSBuild プロジェクト ファイルとソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - '{0}' で MSBuild プロジェクト ファイルまたはソリューション ファイルが見つかりませんでした。使用するファイルを --workspace オプションで指定してください。 - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - '{0}' をフォーマットできませんでした。フォーマットは、C# および Visual Basic のプロジェクトでのみサポートされています。 - - - - Failed to save formatting changes. - 書式変更を保存できませんでした。 - - - - Format complete. - フォーマットが完了しました。 - - - - Format files, but do not save changes to disk. - ファイルを書式設定しますが、変更をディスクに保存しません。 - - - - Formatted {0} of {1} files in {2}ms. - {2} ミリ秒で {1} 個中 {0} 個のファイルが書式設定されました。 - - - - Formatting code file '{0}'. - コード ファイル '{0}' をフォーマットしています。 - - - - Formatting code files in project '{0}'. - プロジェクト '{0}' でコード ファイルを書式設定しています。 - - - - Formatting code files in workspace '{0}'. - ワークスペース '{0}' でコード ファイルを書式設定します。 - - - - Loading workspace. - ワークスペースを読み込んでいます。 - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - ログに記録するワークスペース警告の最大数に達しました。すべての警告を表示するには --verbosity オプションを 'diagnostic' レベルに設定します。 - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - 複数の MSBuild プロジェクト ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 詳細レベルを設定します。許可されている値: q[uiet]、m[inimal]、n[ormal]、d[etailed]、diag[nostic] - - - - Skipping referenced project '{0}'. - 参照プロジェクト '{0}' をスキップしています。 - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 - - - - The project file '{0}' does not exist. - プロジェクト ファイル '{0}' が存在しません。 - - - - The solution file '{0}' does not exist. - ソリューション ファイル '{0}' が存在しません。 - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 操作対象のソリューション ファイルまたはプロジェクト ファイル。ファイルを指定しない場合、コマンドは現在のディレクトリを検索します。 - - - - Unable to load workspace. - ワークスペースをロードできません。 - - - - Workspace loaded in {0}ms. - ワークスペース {0} ミリ秒で読み込まれます。 - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + MSBuild プロジェクト ファイルとソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + '{0}' で MSBuild プロジェクト ファイルまたはソリューション ファイルが見つかりませんでした。使用するファイルを --workspace オプションで指定してください。 + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + '{0}' をフォーマットできませんでした。フォーマットは、C# および Visual Basic のプロジェクトでのみサポートされています。 + + + + Failed to save formatting changes. + 書式変更を保存できませんでした。 + + + + Format complete. + フォーマットが完了しました。 + + + + Format files, but do not save changes to disk. + ファイルを書式設定しますが、変更をディスクに保存しません。 + + + + Formatted {0} of {1} files in {2}ms. + {2} ミリ秒で {1} 個中 {0} 個のファイルが書式設定されました。 + + + + Formatting code file '{0}'. + コード ファイル '{0}' をフォーマットしています。 + + + + Formatting code files in project '{0}'. + プロジェクト '{0}' でコード ファイルを書式設定しています。 + + + + Formatting code files in workspace '{0}'. + ワークスペース '{0}' でコード ファイルを書式設定します。 + + + + Loading workspace. + ワークスペースを読み込んでいます。 + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + ログに記録するワークスペース警告の最大数に達しました。すべての警告を表示するには --verbosity オプションを 'diagnostic' レベルに設定します。 + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + 複数の MSBuild プロジェクト ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + 詳細レベルを設定します。許可されている値: q[uiet]、m[inimal]、n[ormal]、d[etailed]、diag[nostic] + + + + Skipping referenced project '{0}'. + 参照プロジェクト '{0}' をスキップしています。 + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 + + + + The project file '{0}' does not exist. + プロジェクト ファイル '{0}' が存在しません。 + + + + The solution file '{0}' does not exist. + ソリューション ファイル '{0}' が存在しません。 + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 操作対象のソリューション ファイルまたはプロジェクト ファイル。ファイルを指定しない場合、コマンドは現在のディレクトリを検索します。 + + + + Unable to load workspace. + ワークスペースをロードできません。 + + + + Workspace loaded in {0}ms. + ワークスペース {0} ミリ秒で読み込まれます。 + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index f2480d15e4d6..bdf53df18dce 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - '{0}'에서 MSBuild 프로젝트 파일 또는 솔루션 파일을 찾을 수 없습니다. --workspace 옵션에 사용할 파일을 지정하세요. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - '{0}'의 서식을 지정할 수 없습니다. 서식 지정은 현재 C# 및 Visual Basic 프로젝트만 지원합니다. - - - - Failed to save formatting changes. - 서식 변경 내용을 저장하지 못했습니다. - - - - Format complete. - 포맷이 완료되었습니다. - - - - Format files, but do not save changes to disk. - 파일의 형식을 지정하지만 변경 내용을 디스크에 저장하지 않습니다. - - - - Formatted {0} of {1} files in {2}ms. - {2}밀리초 내에 {1}개 중 {0}개 파일의 형식을 지정했습니다. - - - - Formatting code file '{0}'. - 코드 파일 '{0}'의 서식을 지정합니다. - - - - Formatting code files in project '{0}'. - '{0}' 프로젝트에서 코드 파일의 서식을 지정합니다. - - - - Formatting code files in workspace '{0}'. - '{0}' 작업 영역에서 코드 파일의 서식을 지정합니다. - - - - Loading workspace. - 작업 영역을 로드하는 중입니다. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - 로그의 작업 영역 경고 수가 최대치에 도달했습니다. '진단' 수준에 --verbosity 옵션을 설정하여 모든 경고를 볼 수 있습니다. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - '{0}'에서 여러 MSBuild 프로젝트 파일을 찾았습니다. --workspace 옵션에 사용할 파일을 지정하세요. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 세부 정보 표시 수준을 설정합니다. 허용되는 값은 q[uiet], m[inimal], n[ormal], d[etailed] 및 diag[nostic]입니다. - - - - Skipping referenced project '{0}'. - 참조된 프로젝트 '{0}'을(를) 건너뜁니다. - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. - - - - The project file '{0}' does not exist. - 프로젝트 파일 '{0}'이(가) 없습니다. - - - - The solution file '{0}' does not exist. - 솔루션 파일 '{0}'이(가) 없습니다. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 수행할 솔루션 또는 프로젝트 파일입니다. 파일을 지정하지 않으면 명령이 현재 디렉터리에서 파일을 검색합니다. - - - - Unable to load workspace. - 작업 영역을 로드할 수 없습니다. - - - - Workspace loaded in {0}ms. - 작업 영역이 {0}밀리초 안에 로드되었습니다. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + '{0}'에서 MSBuild 프로젝트 파일 또는 솔루션 파일을 찾을 수 없습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + '{0}'의 서식을 지정할 수 없습니다. 서식 지정은 현재 C# 및 Visual Basic 프로젝트만 지원합니다. + + + + Failed to save formatting changes. + 서식 변경 내용을 저장하지 못했습니다. + + + + Format complete. + 포맷이 완료되었습니다. + + + + Format files, but do not save changes to disk. + 파일의 형식을 지정하지만 변경 내용을 디스크에 저장하지 않습니다. + + + + Formatted {0} of {1} files in {2}ms. + {2}밀리초 내에 {1}개 중 {0}개 파일의 형식을 지정했습니다. + + + + Formatting code file '{0}'. + 코드 파일 '{0}'의 서식을 지정합니다. + + + + Formatting code files in project '{0}'. + '{0}' 프로젝트에서 코드 파일의 서식을 지정합니다. + + + + Formatting code files in workspace '{0}'. + '{0}' 작업 영역에서 코드 파일의 서식을 지정합니다. + + + + Loading workspace. + 작업 영역을 로드하는 중입니다. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + 로그의 작업 영역 경고 수가 최대치에 도달했습니다. '진단' 수준에 --verbosity 옵션을 설정하여 모든 경고를 볼 수 있습니다. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + '{0}'에서 여러 MSBuild 프로젝트 파일을 찾았습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + 세부 정보 표시 수준을 설정합니다. 허용되는 값은 q[uiet], m[inimal], n[ormal], d[etailed] 및 diag[nostic]입니다. + + + + Skipping referenced project '{0}'. + 참조된 프로젝트 '{0}'을(를) 건너뜁니다. + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. + + + + The project file '{0}' does not exist. + 프로젝트 파일 '{0}'이(가) 없습니다. + + + + The solution file '{0}' does not exist. + 솔루션 파일 '{0}'이(가) 없습니다. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 수행할 솔루션 또는 프로젝트 파일입니다. 파일을 지정하지 않으면 명령이 현재 디렉터리에서 파일을 검색합니다. + + + + Unable to load workspace. + 작업 영역을 로드할 수 없습니다. + + + + Workspace loaded in {0}ms. + 작업 영역이 {0}밀리초 안에 로드되었습니다. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index dc0259e1f7fe..a849463a1482 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą opcji --workspace. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Nie można znaleźć pliku rozwiązania lub projektu MSBuild w elemencie „{0}”. Określ plik do użycia za pomocą opcji --workspace. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Nie można sformatować elementu „{0}”. Obecnie format obsługuje tylko projekty C# i Visual Basic. - - - - Failed to save formatting changes. - Nie można zapisać zmian formatowania. - - - - Format complete. - Formatowanie zakończone. - - - - Format files, but do not save changes to disk. - Formatuj pliki, ale nie zapisuj zmian na dysku. - - - - Formatted {0} of {1} files in {2}ms. - Sformatowano następującą liczbę plików: {0} z {1} w {2} ms. - - - - Formatting code file '{0}'. - Formatowanie pliku kodu „{0}”. - - - - Formatting code files in project '{0}'. - Formatowanie plików kodu w projekcie „{0}”. - - - - Formatting code files in workspace '{0}'. - Formatowanie plików kodu w obszarze roboczym „{0}”. - - - - Loading workspace. - Ładowanie obszaru roboczego. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Osiągnięto maksymalną liczbę ostrzeżeń obszaru roboczego do zarejestrowania. Ustaw opcję --verbosity na poziom „diagnostic”, aby zobaczyć wszystkie ostrzeżenia. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - W elemencie „{0}” znaleziono wiele plików projektów MSBuild. Określ, którego użyć, za pomocą opcji --workspace. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą opcji --workspace. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Ustaw poziom szczegółowości. Dozwolone wartości to q[uiet] (cicha), m[inimal] (minimalna), n[ormal] (normalna), d[etailed] (szczegółowa) i diag[nostic] (diagnostyczna) - - - - Skipping referenced project '{0}'. - Pomijanie przywoływanego projektu „{0}”. - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. - - - - The project file '{0}' does not exist. - Plik projektu „{0}” nie istnieje. - - - - The solution file '{0}' does not exist. - Plik rozwiązania „{0}” nie istnieje. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Plik rozwiązania lub projektu, względem którego operacja ma być wykonana. Jeśli plik nie zostanie określony, polecenie wyszuka go w bieżącym katalogu. - - - - Unable to load workspace. - Nie można załadować obszaru roboczego. - - - - Workspace loaded in {0}ms. - Obszar roboczy załadowano w {0} ms. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą opcji --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Nie można znaleźć pliku rozwiązania lub projektu MSBuild w elemencie „{0}”. Określ plik do użycia za pomocą opcji --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Nie można sformatować elementu „{0}”. Obecnie format obsługuje tylko projekty C# i Visual Basic. + + + + Failed to save formatting changes. + Nie można zapisać zmian formatowania. + + + + Format complete. + Formatowanie zakończone. + + + + Format files, but do not save changes to disk. + Formatuj pliki, ale nie zapisuj zmian na dysku. + + + + Formatted {0} of {1} files in {2}ms. + Sformatowano następującą liczbę plików: {0} z {1} w {2} ms. + + + + Formatting code file '{0}'. + Formatowanie pliku kodu „{0}”. + + + + Formatting code files in project '{0}'. + Formatowanie plików kodu w projekcie „{0}”. + + + + Formatting code files in workspace '{0}'. + Formatowanie plików kodu w obszarze roboczym „{0}”. + + + + Loading workspace. + Ładowanie obszaru roboczego. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Osiągnięto maksymalną liczbę ostrzeżeń obszaru roboczego do zarejestrowania. Ustaw opcję --verbosity na poziom „diagnostic”, aby zobaczyć wszystkie ostrzeżenia. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + W elemencie „{0}” znaleziono wiele plików projektów MSBuild. Określ, którego użyć, za pomocą opcji --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą opcji --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Ustaw poziom szczegółowości. Dozwolone wartości to q[uiet] (cicha), m[inimal] (minimalna), n[ormal] (normalna), d[etailed] (szczegółowa) i diag[nostic] (diagnostyczna) + + + + Skipping referenced project '{0}'. + Pomijanie przywoływanego projektu „{0}”. + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. + + + + The project file '{0}' does not exist. + Plik projektu „{0}” nie istnieje. + + + + The solution file '{0}' does not exist. + Plik rozwiązania „{0}” nie istnieje. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Plik rozwiązania lub projektu, względem którego operacja ma być wykonana. Jeśli plik nie zostanie określony, polecenie wyszuka go w bieżącym katalogu. + + + + Unable to load workspace. + Nie można załadować obszaru roboczego. + + + + Workspace loaded in {0}ms. + Obszar roboczy załadowano w {0} ms. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 9f124d026da3..272a00c9acdc 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - Foram encontrados um arquivo de solução e um arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Não foi possível encontrar um arquivo de solução ou arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Não foi possível formatar '{0}'. O formato atualmente suporta apenas projetos do Visual Basic e C#. - - - - Failed to save formatting changes. - Falha ao salvar alterações de formatação. - - - - Format complete. - Formato completo. - - - - Format files, but do not save changes to disk. - Arquivos de formato, mas não salva as alterações para o disco. - - - - Formatted {0} of {1} files in {2}ms. - Formatado {0} de {1} arquivos em ms {2}. - - - - Formatting code file '{0}'. - Arquivo de código de formatação '{0}'. - - - - Formatting code files in project '{0}'. - Formatando arquivos de código no projeto '{0}'. - - - - Formatting code files in workspace '{0}'. - Formatação de arquivos de código no espaço de trabalho '{0}'. - - - - Loading workspace. - Carregando espaço de trabalho. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Foi atingido o número máximo de avisos do workspace a serem registrados em log. Defina a opção --verbosity para o nível 'diagnostic' para ver todos os avisos. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Foram encontrados vários arquivos do projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Foram encontrados vários arquivos de solução MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Defina o nível de detalhes. Os valores permitidos são q[uiet], m[inimal], n[ormal], d[etailed], e diag[nostic] - - - - Skipping referenced project '{0}'. - Ignorando o projeto referenciado '{0}'. - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. - - - - The project file '{0}' does not exist. - O arquivo de projeto '{0}' não existe. - - - - The solution file '{0}' does not exist. - O arquivo de solução '{0}' não existe. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - O arquivo de projeto ou solução para operar. Se um arquivo não for especificado, o comando pesquisará o diretório atual para um. - - - - Unable to load workspace. - Não é possível carregar o espaço de trabalho. - - - - Workspace loaded in {0}ms. - Espaço de trabalho carregado em {0}ms. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Foram encontrados um arquivo de solução e um arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Não foi possível encontrar um arquivo de solução ou arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Não foi possível formatar '{0}'. O formato atualmente suporta apenas projetos do Visual Basic e C#. + + + + Failed to save formatting changes. + Falha ao salvar alterações de formatação. + + + + Format complete. + Formato completo. + + + + Format files, but do not save changes to disk. + Arquivos de formato, mas não salva as alterações para o disco. + + + + Formatted {0} of {1} files in {2}ms. + Formatado {0} de {1} arquivos em ms {2}. + + + + Formatting code file '{0}'. + Arquivo de código de formatação '{0}'. + + + + Formatting code files in project '{0}'. + Formatando arquivos de código no projeto '{0}'. + + + + Formatting code files in workspace '{0}'. + Formatação de arquivos de código no espaço de trabalho '{0}'. + + + + Loading workspace. + Carregando espaço de trabalho. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Foi atingido o número máximo de avisos do workspace a serem registrados em log. Defina a opção --verbosity para o nível 'diagnostic' para ver todos os avisos. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Foram encontrados vários arquivos do projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Foram encontrados vários arquivos de solução MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Defina o nível de detalhes. Os valores permitidos são q[uiet], m[inimal], n[ormal], d[etailed], e diag[nostic] + + + + Skipping referenced project '{0}'. + Ignorando o projeto referenciado '{0}'. + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. + + + + The project file '{0}' does not exist. + O arquivo de projeto '{0}' não existe. + + + + The solution file '{0}' does not exist. + O arquivo de solução '{0}' não existe. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + O arquivo de projeto ou solução para operar. Se um arquivo não for especificado, o comando pesquisará o diretório atual para um. + + + + Unable to load workspace. + Não é possível carregar o espaço de trabalho. + + + + Workspace loaded in {0}ms. + Espaço de trabalho carregado em {0}ms. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 30ef8f7913bf..e31758bbce9d 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью параметра --workspace. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Не удалось найти файл проекта или решения MSBuild в "{0}". Укажите используемый файл с параметром --workspace. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Не удалось отформатировать "{0}". Форматирование сейчас поддерживается только для проектов C# и Visual Basic. - - - - Failed to save formatting changes. - Не удалось сохранить изменения форматирования. - - - - Format complete. - Форматирование завершено. - - - - Format files, but do not save changes to disk. - Форматировать файлы без сохранения изменений на диск. - - - - Formatted {0} of {1} files in {2}ms. - Отформатировано файлов: {0} из {1} за {2} мс. - - - - Formatting code file '{0}'. - Форматирование файла кода "{0}". - - - - Formatting code files in project '{0}'. - Форматирование файлов кода в проекте "{0}". - - - - Formatting code files in workspace '{0}'. - Форматирование кода файлов в рабочей области "{0}". - - - - Loading workspace. - Загрузка рабочей области. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Достигнуто максимальное количество предупреждений рабочей области, которые могут быть записаны в журнал. Чтобы просмотреть все предупреждения, установите параметр --verbosity. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - В "{0}" обнаружено несколько файлов проектов MSBuild. Укажите используемый файл с помощью параметра --workspace. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - В "{0}" обнаружено несколько файлов решений MSBuild. Укажите используемый файл с параметром --workspace. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Задает уровень детализации. Допустимые значения: q (без вывода подробных сведений), m (минимальный), n (нормальный), d (подробный) и diag (диагностика) - - - - Skipping referenced project '{0}'. - Пропуск указанного проекта "{0}". - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - Файл "{0}" не является допустимым файлом проекта или решения. - - - - The project file '{0}' does not exist. - Файл проекта "{0}" не существует. - - - - The solution file '{0}' does not exist. - Файл решения "{0}" не существует. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Файл решения или проекта. Если файл не указан, команда будет искать этот файл в текущем каталоге. - - - - Unable to load workspace. - Не удается загрузить рабочую область. - - - - Workspace loaded in {0}ms. - Рабочая область загружена за {0} мс. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью параметра --workspace. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Не удалось найти файл проекта или решения MSBuild в "{0}". Укажите используемый файл с параметром --workspace. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + Не удалось отформатировать "{0}". Форматирование сейчас поддерживается только для проектов C# и Visual Basic. + + + + Failed to save formatting changes. + Не удалось сохранить изменения форматирования. + + + + Format complete. + Форматирование завершено. + + + + Format files, but do not save changes to disk. + Форматировать файлы без сохранения изменений на диск. + + + + Formatted {0} of {1} files in {2}ms. + Отформатировано файлов: {0} из {1} за {2} мс. + + + + Formatting code file '{0}'. + Форматирование файла кода "{0}". + + + + Formatting code files in project '{0}'. + Форматирование файлов кода в проекте "{0}". + + + + Formatting code files in workspace '{0}'. + Форматирование кода файлов в рабочей области "{0}". + + + + Loading workspace. + Загрузка рабочей области. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Достигнуто максимальное количество предупреждений рабочей области, которые могут быть записаны в журнал. Чтобы просмотреть все предупреждения, установите параметр --verbosity. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + В "{0}" обнаружено несколько файлов проектов MSBuild. Укажите используемый файл с помощью параметра --workspace. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + В "{0}" обнаружено несколько файлов решений MSBuild. Укажите используемый файл с параметром --workspace. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Задает уровень детализации. Допустимые значения: q (без вывода подробных сведений), m (минимальный), n (нормальный), d (подробный) и diag (диагностика) + + + + Skipping referenced project '{0}'. + Пропуск указанного проекта "{0}". + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + Файл "{0}" не является допустимым файлом проекта или решения. + + + + The project file '{0}' does not exist. + Файл проекта "{0}" не существует. + + + + The solution file '{0}' does not exist. + Файл решения "{0}" не существует. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Файл решения или проекта. Если файл не указан, команда будет искать этот файл в текущем каталоге. + + + + Unable to load workspace. + Не удается загрузить рабочую область. + + + + Workspace loaded in {0}ms. + Рабочая область загружена за {0} мс. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 63e8d0493f28..37fae158289c 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - Hem bir MSBuild proje dosyası ve çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Bir MSBuild proje dosyası veya çözüm dosyası '{0}' içinde bulunamadı. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - '{0}' biçiminde değil. Biçimi şu anda yalnızca C# ve Visual Basic projeleri desteklemektedir. - - - - Failed to save formatting changes. - Biçimlendirme değişiklikleri kaydedilemedi. - - - - Format complete. - Tam biçimlendirme. - - - - Format files, but do not save changes to disk. - Dosyaları biçimlendir, ancak değişiklikleri diske kaydetme. - - - - Formatted {0} of {1} files in {2}ms. - {1} dosyadan {0} tanesi {2} milisaniyede biçimlendirildi. - - - - Formatting code file '{0}'. - Biçimlendirme kod dosyası '{0}'. - - - - Formatting code files in project '{0}'. - Proje '{0}' kod dosyalarında biçimlendirme. - - - - Formatting code files in workspace '{0}'. - Çalışma alanı '{0}' kod dosyalarında biçimlendirme. - - - - Loading workspace. - Çalışma alanı yükleniyor. - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - Günlüğe kaydedilecek en fazla çalışma alanı uyarısı sayısına ulaşıldı. Tüm uyarıları görmek için --verbosity seçeneğini 'diagnostic' düzeyine ayarlayın. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Birden fazla MSBuild proje dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Birden fazla MSBuild çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Ayrıntı düzeyini ayarlayın. İzin verilen değerler şunlardır: q [uiet], [inimal] m, n [nizamî], d [ayrıntılı] ve diag [nostic] - - - - Skipping referenced project '{0}'. - Atlama projesi '{0}' başvuru. - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. - - - - The project file '{0}' does not exist. - Proje dosyası '{0}' yok. - - - - The solution file '{0}' does not exist. - Çözüm dosyası '{0}' yok. - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Ameliyat için çözüm ya da proje dosyasını. Bir dosya belirtilmezse, komut için bir geçerli dizini arar. - - - - Unable to load workspace. - Çalışma alanı yüklenemedi. - - - - Workspace loaded in {0}ms. - Çalışma alanı {0} ms yüklü. - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Hem bir MSBuild proje dosyası ve çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Bir MSBuild proje dosyası veya çözüm dosyası '{0}' içinde bulunamadı. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + '{0}' biçiminde değil. Biçimi şu anda yalnızca C# ve Visual Basic projeleri desteklemektedir. + + + + Failed to save formatting changes. + Biçimlendirme değişiklikleri kaydedilemedi. + + + + Format complete. + Tam biçimlendirme. + + + + Format files, but do not save changes to disk. + Dosyaları biçimlendir, ancak değişiklikleri diske kaydetme. + + + + Formatted {0} of {1} files in {2}ms. + {1} dosyadan {0} tanesi {2} milisaniyede biçimlendirildi. + + + + Formatting code file '{0}'. + Biçimlendirme kod dosyası '{0}'. + + + + Formatting code files in project '{0}'. + Proje '{0}' kod dosyalarında biçimlendirme. + + + + Formatting code files in workspace '{0}'. + Çalışma alanı '{0}' kod dosyalarında biçimlendirme. + + + + Loading workspace. + Çalışma alanı yükleniyor. + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + Günlüğe kaydedilecek en fazla çalışma alanı uyarısı sayısına ulaşıldı. Tüm uyarıları görmek için --verbosity seçeneğini 'diagnostic' düzeyine ayarlayın. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Birden fazla MSBuild proje dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Birden fazla MSBuild çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + Ayrıntı düzeyini ayarlayın. İzin verilen değerler şunlardır: q [uiet], [inimal] m, n [nizamî], d [ayrıntılı] ve diag [nostic] + + + + Skipping referenced project '{0}'. + Atlama projesi '{0}' başvuru. + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. + + + + The project file '{0}' does not exist. + Proje dosyası '{0}' yok. + + + + The solution file '{0}' does not exist. + Çözüm dosyası '{0}' yok. + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Ameliyat için çözüm ya da proje dosyasını. Bir dosya belirtilmezse, komut için bir geçerli dizini arar. + + + + Unable to load workspace. + Çalışma alanı yüklenemedi. + + + + Workspace loaded in {0}ms. + Çalışma alanı {0} ms yüklü. + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 09d5aa4eafc5..7f7774389493 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要将哪一个文件用于 --workspace 选项。 - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - 无法在“{0}”中找到 MSBuild 项目文件或解决方案文件。请指定要用于 --workspace 选项的文件。 - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - 无法设置“{0}”的格式。该格式当前仅支持 C# 和 Visual Basic 项目。 - - - - Failed to save formatting changes. - 未能保存格式更改。 - - - - Format complete. - 格式设置完毕。 - - - - Format files, but do not save changes to disk. - 格式化文件, 但不将更改保存到磁盘。 - - - - Formatted {0} of {1} files in {2}ms. - 在 {2}ms 中设置 {1} 文件的格式。 - - - - Formatting code file '{0}'. - 正在设置代码文件“{0}”的格式。 - - - - Formatting code files in project '{0}'. - 正在格式化项目“{0}”中的代码文件。 - - - - Formatting code files in workspace '{0}'. - 正在设置工作区“{0}”中代码文件的格式。 - - - - Loading workspace. - 正在加载工作区。 - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - 已达到要记录的工作区警告的最大数量。将--详细程度选项设置为 "诊断" 级别以查看所有警告。 - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - 在“{0}”中找到多个 MSBuild 项目文件。请指定要将哪一个文件用于 --workspace 选项。 - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 --workspace 选项的文件。 - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 设置详细级别。允许的值为 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] - - - - Skipping referenced project '{0}'. - 正在跳过引用的项目“{0}”。 - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - 文件“{0}”似乎不是有效的项目或解决方案文件。 - - - - The project file '{0}' does not exist. - 项目文件“{0}” 不存在。 - - - - The solution file '{0}' does not exist. - 解决方案文件“{0}”不存在。 - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 要操作的解决方案或项目文件。如果未指定文件,该命令将在当前目录中搜索一个文件。 - - - - Unable to load workspace. - 无法加载工作区。 - - - - Workspace loaded in {0}ms. - 工作区已在 {0} 毫秒内加载完毕。 - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要将哪一个文件用于 --workspace 选项。 + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + 无法在“{0}”中找到 MSBuild 项目文件或解决方案文件。请指定要用于 --workspace 选项的文件。 + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + 无法设置“{0}”的格式。该格式当前仅支持 C# 和 Visual Basic 项目。 + + + + Failed to save formatting changes. + 未能保存格式更改。 + + + + Format complete. + 格式设置完毕。 + + + + Format files, but do not save changes to disk. + 格式化文件, 但不将更改保存到磁盘。 + + + + Formatted {0} of {1} files in {2}ms. + 在 {2}ms 中设置 {1} 文件的格式。 + + + + Formatting code file '{0}'. + 正在设置代码文件“{0}”的格式。 + + + + Formatting code files in project '{0}'. + 正在格式化项目“{0}”中的代码文件。 + + + + Formatting code files in workspace '{0}'. + 正在设置工作区“{0}”中代码文件的格式。 + + + + Loading workspace. + 正在加载工作区。 + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + 已达到要记录的工作区警告的最大数量。将--详细程度选项设置为 "诊断" 级别以查看所有警告。 + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + 在“{0}”中找到多个 MSBuild 项目文件。请指定要将哪一个文件用于 --workspace 选项。 + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 --workspace 选项的文件。 + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + 设置详细级别。允许的值为 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] + + + + Skipping referenced project '{0}'. + 正在跳过引用的项目“{0}”。 + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + 文件“{0}”似乎不是有效的项目或解决方案文件。 + + + + The project file '{0}' does not exist. + 项目文件“{0}” 不存在。 + + + + The solution file '{0}' does not exist. + 解决方案文件“{0}”不存在。 + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 要操作的解决方案或项目文件。如果未指定文件,该命令将在当前目录中搜索一个文件。 + + + + Unable to load workspace. + 无法加载工作区。 + + + + Workspace loaded in {0}ms. + 工作区已在 {0} 毫秒内加载完毕。 + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 2bc2acdbf30d..489cf85fe0db 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -1,132 +1,132 @@ - - - - - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - 在 '{0}' 中同時找到 MSBuild 專案檔和解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 - - - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - 在 '{0}' 中找不到 MSBuild 專案檔或解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 - - - - Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - 無法將 '{0}' 格式化。格式化目前只支援 C# 和 Visual Basic 專案。 - - - - Failed to save formatting changes. - 無法儲存格式化變更。 - - - - Format complete. - 格式化已完成。 - - - - Format files, but do not save changes to disk. - 將檔案格式化,但不儲存變更到磁碟。 - - - - Formatted {0} of {1} files in {2}ms. - 已將 {0}/{1} 個檔案格式化,花費 {2} 毫秒。 - - - - Formatting code file '{0}'. - 正在將程式碼檔案 '{0}' 格式化。 - - - - Formatting code files in project '{0}'. - 正在將專案 '{0}' 中的程式碼檔案格式化。 - - - - Formatting code files in workspace '{0}'. - 正在將工作區 '{0}' 中的程式碼檔案格式化。 - - - - Loading workspace. - 正在載入工作區。 - - - - Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. - 已達到要記錄的工作區警告數上限。請將 --verbosity 選項設定為 'diagnostic’ 層級,以查看所有警告。 - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - 在 '{0}' 中找到多個 MSBuild 專案檔。請指定要搭配 --workspace 選項使用的檔案。 - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 - - - - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 設定詳細資訊層級。允許的值為 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] - - - - Skipping referenced project '{0}'. - 跳過參考的專案 '{0}’。 - - - - Terminate with non-zero exit code if any files need to be formatted in the workspace. - Terminate with non-zero exit code if any files need to be formatted in the workspace. - - - - The file '{0}' does not appear to be a valid project or solution file. - 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 - - - - The project file '{0}' does not exist. - 專案檔 '{0}' 不存在。 - - - - The solution file '{0}' does not exist. - 解決方案檔 '{0}' 不存在。 - - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 要操作的解決方案或專案檔。若未指定檔案,該命令會在目前的目錄中搜尋一個檔案。 - - - - Unable to load workspace. - 無法載入工作區。 - - - - Workspace loaded in {0}ms. - {0} 毫秒內載入的工作區。 - - - - The files to operate on. If none specified, all files in workspace will be operated on. - The files to operate on. If none specified, all files in workspace will be operated on. - - - - Formatted code file '{0}'. - Formatted code file '{0}'. - - - - + + + + + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中同時找到 MSBuild 專案檔和解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中找不到 MSBuild 專案檔或解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + + + Could not format '{0}'. Format currently supports only C# and Visual Basic projects. + 無法將 '{0}' 格式化。格式化目前只支援 C# 和 Visual Basic 專案。 + + + + Failed to save formatting changes. + 無法儲存格式化變更。 + + + + Format complete. + 格式化已完成。 + + + + Format files, but do not save changes to disk. + 將檔案格式化,但不儲存變更到磁碟。 + + + + Formatted {0} of {1} files in {2}ms. + 已將 {0}/{1} 個檔案格式化,花費 {2} 毫秒。 + + + + Formatting code file '{0}'. + 正在將程式碼檔案 '{0}' 格式化。 + + + + Formatting code files in project '{0}'. + 正在將專案 '{0}' 中的程式碼檔案格式化。 + + + + Formatting code files in workspace '{0}'. + 正在將工作區 '{0}' 中的程式碼檔案格式化。 + + + + Loading workspace. + 正在載入工作區。 + + + + Maximum number of workspace warnings to log has been reached. Set the --verbosity option to the 'diagnostic' level to see all warnings. + 已達到要記錄的工作區警告數上限。請將 --verbosity 選項設定為 'diagnostic’ 層級,以查看所有警告。 + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中找到多個 MSBuild 專案檔。請指定要搭配 --workspace 選項使用的檔案。 + + + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + 設定詳細資訊層級。允許的值為 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] + + + + Skipping referenced project '{0}'. + 跳過參考的專案 '{0}’。 + + + + Terminate with non-zero exit code if any files need to be formatted in the workspace. + Terminate with non-zero exit code if any files need to be formatted in the workspace. + + + + The file '{0}' does not appear to be a valid project or solution file. + 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 + + + + The project file '{0}' does not exist. + 專案檔 '{0}' 不存在。 + + + + The solution file '{0}' does not exist. + 解決方案檔 '{0}' 不存在。 + + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 要操作的解決方案或專案檔。若未指定檔案,該命令會在目前的目錄中搜尋一個檔案。 + + + + Unable to load workspace. + 無法載入工作區。 + + + + Workspace loaded in {0}ms. + {0} 毫秒內載入的工作區。 + + + + The files to operate on. If none specified, all files in workspace will be operated on. + The files to operate on. If none specified, all files in workspace will be operated on. + + + + Formatted code file '{0}'. + Formatted code file '{0}'. + + + + \ No newline at end of file diff --git a/tests/MSBuildWorkspaceFinderTests.cs b/tests/MSBuildWorkspaceFinderTests.cs index 6e059d51a91d..19bb81ed7261 100644 --- a/tests/MSBuildWorkspaceFinderTests.cs +++ b/tests/MSBuildWorkspaceFinderTests.cs @@ -1,106 +1,106 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.IO; -using Microsoft.CodeAnalysis.Tools.MSBuild; -using Xunit; - -namespace Microsoft.CodeAnalysis.Tools.Tests -{ - public class MSBuildWorkspaceFinderTests - { - private static string SolutionPath => Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.Parent.Parent.FullName; - - [Fact] - public void ThrowsException_CannotFindMSBuildProjectFile() - { - var workspacePath = "tests/projects/for_workspace_finder/no_project_or_solution/"; - var exceptionMessageStart = string.Format( - Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); - Assert.StartsWith(exceptionMessageStart, exception.Message); - } - - [Fact] - public void ThrowsException_MultipleMSBuildProjectFiles() - { - var workspacePath = "tests/projects/for_workspace_finder/multiple_projects/"; - var exceptionMessageStart = string.Format( - Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); - Assert.Equal(exceptionMessageStart, exception.Message); - } - - [Fact] - public void ThrowsException_MultipleMSBuildSolutionFiles() - { - var workspacePath = "tests/projects/for_workspace_finder/multiple_solutions/"; - var exceptionMessageStart = string.Format( - Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); - Assert.Equal(exceptionMessageStart, exception.Message); - } - - [Fact] - public void ThrowsException_SolutionAndProjectAmbiguity() - { - var workspacePath = "tests/projects/for_workspace_finder/project_and_solution/"; - var exceptionMessageStart = string.Format( - Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); - Assert.Equal(exceptionMessageStart, exception.Message); - } - - [Fact] - public void FindsSolutionByFolder() - { - const string Path = "tests/projects/for_workspace_finder/single_solution/"; - - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); - - var solutionFileName = System.IO.Path.GetFileName(workspacePath); - Assert.Equal("single_solution.sln", solutionFileName); - Assert.True(isSolution); - } - - [Fact] - public void FindsSolutionByFilePath() - { - const string Path = "tests/projects/for_workspace_finder/multiple_solutions/solution_b.sln"; - - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); - - var solutionFileName = System.IO.Path.GetFileName(workspacePath); - Assert.Equal("solution_b.sln", solutionFileName); - Assert.True(isSolution); - } - - [Fact] - public void FindsProjectByFolder() - { - const string Path = "tests/projects/for_workspace_finder/single_project/"; - - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); - - var solutionFileName = System.IO.Path.GetFileName(workspacePath); - Assert.Equal("single_project.csproj", solutionFileName); - Assert.False(isSolution); - } - - [Fact] - public void FindsProjectByFilePath() - { - const string Path = "tests/projects/for_workspace_finder/multiple_projects/project_b.csproj"; - - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); - - var solutionFileName = System.IO.Path.GetFileName(workspacePath); - Assert.Equal("project_b.csproj", solutionFileName); - Assert.False(isSolution); - } - } -} +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.IO; +using Microsoft.CodeAnalysis.Tools.MSBuild; +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests +{ + public class MSBuildWorkspaceFinderTests + { + private static string SolutionPath => Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.Parent.Parent.FullName; + + [Fact] + public void ThrowsException_CannotFindMSBuildProjectFile() + { + var workspacePath = "tests/projects/for_workspace_finder/no_project_or_solution/"; + var exceptionMessageStart = string.Format( + Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Assert.StartsWith(exceptionMessageStart, exception.Message); + } + + [Fact] + public void ThrowsException_MultipleMSBuildProjectFiles() + { + var workspacePath = "tests/projects/for_workspace_finder/multiple_projects/"; + var exceptionMessageStart = string.Format( + Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Assert.Equal(exceptionMessageStart, exception.Message); + } + + [Fact] + public void ThrowsException_MultipleMSBuildSolutionFiles() + { + var workspacePath = "tests/projects/for_workspace_finder/multiple_solutions/"; + var exceptionMessageStart = string.Format( + Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Assert.Equal(exceptionMessageStart, exception.Message); + } + + [Fact] + public void ThrowsException_SolutionAndProjectAmbiguity() + { + var workspacePath = "tests/projects/for_workspace_finder/project_and_solution/"; + var exceptionMessageStart = string.Format( + Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, + Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Assert.Equal(exceptionMessageStart, exception.Message); + } + + [Fact] + public void FindsSolutionByFolder() + { + const string Path = "tests/projects/for_workspace_finder/single_solution/"; + + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + + var solutionFileName = System.IO.Path.GetFileName(workspacePath); + Assert.Equal("single_solution.sln", solutionFileName); + Assert.True(isSolution); + } + + [Fact] + public void FindsSolutionByFilePath() + { + const string Path = "tests/projects/for_workspace_finder/multiple_solutions/solution_b.sln"; + + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + + var solutionFileName = System.IO.Path.GetFileName(workspacePath); + Assert.Equal("solution_b.sln", solutionFileName); + Assert.True(isSolution); + } + + [Fact] + public void FindsProjectByFolder() + { + const string Path = "tests/projects/for_workspace_finder/single_project/"; + + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + + var solutionFileName = System.IO.Path.GetFileName(workspacePath); + Assert.Equal("single_project.csproj", solutionFileName); + Assert.False(isSolution); + } + + [Fact] + public void FindsProjectByFilePath() + { + const string Path = "tests/projects/for_workspace_finder/multiple_projects/project_b.csproj"; + + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + + var solutionFileName = System.IO.Path.GetFileName(workspacePath); + Assert.Equal("project_b.csproj", solutionFileName); + Assert.False(isSolution); + } + } +} diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 9cbdd5870fc0..e987f637d9a7 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -1,57 +1,57 @@ -using System.IO; -using Xunit; - -namespace Microsoft.CodeAnalysis.Tools.Tests -{ - public class ProgramTests - { - [Fact] - public void ExitCodeIsOneWithCheckAndAnyFilesFormatted() - { - var formatResult = new WorkspaceFormatResult() - { - FilesFormatted = 1 - }; - var exitCode = Program.GetExitCode(formatResult, check: true); - - Assert.Equal(1, exitCode); - } - - [Fact] - public void ExitCodeIsZeroWithCheckAndNoFilesFormatted() - { - var formatResult = new WorkspaceFormatResult() - { - ExitCode = 42, - FilesFormatted = 0 - }; - var exitCode = Program.GetExitCode(formatResult, check: true); - - Assert.Equal(0, exitCode); - } - - [Fact] - public void ExitCodeIsSameWithoutCheck() - { - var formatResult = new WorkspaceFormatResult() - { - ExitCode = 42 - }; - var exitCode = Program.GetExitCode(formatResult, check: false); - - Assert.Equal(formatResult.ExitCode, exitCode); - } - - [Fact] - public void FilesFormattedDirectorySeparatorInsensitive() - { - var filePath = $"other_items{Path.DirectorySeparatorChar}OtherClass.cs"; - var files = Program.GetFileList(filePath); - - var filePathAlt = $"other_items{Path.AltDirectorySeparatorChar}OtherClass.cs"; - var filesAlt = Program.GetFileList(filePathAlt); - - Assert.True(files[0] == filesAlt[0]); - } - } -} +using System.IO; +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests +{ + public class ProgramTests + { + [Fact] + public void ExitCodeIsOneWithCheckAndAnyFilesFormatted() + { + var formatResult = new WorkspaceFormatResult() + { + FilesFormatted = 1 + }; + var exitCode = Program.GetExitCode(formatResult, check: true); + + Assert.Equal(1, exitCode); + } + + [Fact] + public void ExitCodeIsZeroWithCheckAndNoFilesFormatted() + { + var formatResult = new WorkspaceFormatResult() + { + ExitCode = 42, + FilesFormatted = 0 + }; + var exitCode = Program.GetExitCode(formatResult, check: true); + + Assert.Equal(0, exitCode); + } + + [Fact] + public void ExitCodeIsSameWithoutCheck() + { + var formatResult = new WorkspaceFormatResult() + { + ExitCode = 42 + }; + var exitCode = Program.GetExitCode(formatResult, check: false); + + Assert.Equal(formatResult.ExitCode, exitCode); + } + + [Fact] + public void FilesFormattedDirectorySeparatorInsensitive() + { + var filePath = $"other_items{Path.DirectorySeparatorChar}OtherClass.cs"; + var files = Program.GetFileList(filePath); + + var filePathAlt = $"other_items{Path.AltDirectorySeparatorChar}OtherClass.cs"; + var filesAlt = Program.GetFileList(filePathAlt); + + Assert.True(files[0] == filesAlt[0]); + } + } +} diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 0049bddd1789..89eeb77cb7c3 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -1,23 +1,23 @@ - - - - netcoreapp2.1 - false - Microsoft.CodeAnalysis.Tools.Tests - - - - - - - - - - - - - - - - - + + + + netcoreapp2.1 + false + Microsoft.CodeAnalysis.Tools.Tests + + + + + + + + + + + + + + + + + diff --git a/tests/projects/for_code_formatter/fsharp_project/Program.fs b/tests/projects/for_code_formatter/fsharp_project/Program.fs index 6f75f64e0053..358ad0edc6d0 100644 --- a/tests/projects/for_code_formatter/fsharp_project/Program.fs +++ b/tests/projects/for_code_formatter/fsharp_project/Program.fs @@ -1,8 +1,8 @@ -// Learn more about F# at http://fsharp.org - -open System - -[] -let main argv = - printfn "Hello World from F#!" - 0 // return an integer exit code +// Learn more about F# at http://fsharp.org + +open System + +[] +let main argv = + printfn "Hello World from F#!" + 0 // return an integer exit code diff --git a/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj b/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj index 102afe877fc6..f8d4c9246f6a 100644 --- a/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj +++ b/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj @@ -1,12 +1,12 @@ - - - - Exe - netcoreapp3.0 - - - - - - + + + + Exe + netcoreapp3.0 + + + + + + \ No newline at end of file From a788023e6b8b9212e8c1dd4b26d219903567feac Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Tue, 26 Mar 2019 12:54:14 +0000 Subject: [PATCH 0422/2702] Update dependencies from https://github.com/dotnet/arcade build 20190325.7 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19175.7 --- eng/Version.Details.xml | 4 ++-- eng/common/darc-init.ps1 | 2 +- eng/common/darc-init.sh | 2 +- global.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 881450e5c239..8b05768b273c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 2eb45ff0eed6f86f1071b16b11a447cadeeeec59 + 002cce7e8e3e043c50acae673741ee3962411e10 diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 2467ebdd4225..70f5e575dc82 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -19,7 +19,7 @@ function InstallDarcCli ($darcVersion) { # Until we can anonymously query the BAR API for the latest arcade-services # build applied to the PROD channel, this is hardcoded. if (-not $darcVersion) { - $darcVersion = '1.1.0-beta.19151.3' + $darcVersion = '1.1.0-beta.19172.2' } $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-arcade/index.json' diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index 8d63dd711b2a..fd84b0b700c5 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash source="${BASH_SOURCE[0]}" -darcVersion="1.1.0-beta.19151.3" +darcVersion="1.1.0-beta.19172.2" while [[ $# > 0 ]]; do opt="$(echo "$1" | awk '{print tolower($0)}')" diff --git a/global.json b/global.json index 1e5b8b00a17c..f942a975cb1d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19171.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19175.7" } } From eb3f14f61862d18574068703a8b5b136dd8d8903 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 27 Mar 2019 04:49:21 +0000 Subject: [PATCH 0423/2702] Update dependencies from https://github.com/dotnet/arcade build 20190325.9 (#69) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19175.9 --- eng/Version.Details.xml | 4 ++-- eng/common/darc-init.ps1 | 2 +- eng/common/darc-init.sh | 2 +- eng/common/generate-graph-files.ps1 | 2 +- global.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8b05768b273c..0fb0a0df0678 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 002cce7e8e3e043c50acae673741ee3962411e10 + 13daa29185518ef3c6d4074fd07efbc5236a76c5 diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 70f5e575dc82..29c443212b45 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -19,7 +19,7 @@ function InstallDarcCli ($darcVersion) { # Until we can anonymously query the BAR API for the latest arcade-services # build applied to the PROD channel, this is hardcoded. if (-not $darcVersion) { - $darcVersion = '1.1.0-beta.19172.2' + $darcVersion = '1.1.0-beta.19175.6' } $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-arcade/index.json' diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index fd84b0b700c5..cab6cd5bf9f3 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash source="${BASH_SOURCE[0]}" -darcVersion="1.1.0-beta.19172.2" +darcVersion="1.1.0-beta.19175.6" while [[ $# > 0 ]]; do opt="$(echo "$1" | awk '{print tolower($0)}')" diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1 index b8dae49cde86..a05b84f7987b 100644 --- a/eng/common/generate-graph-files.ps1 +++ b/eng/common/generate-graph-files.ps1 @@ -3,7 +3,7 @@ Param( [Parameter(Mandatory=$true)][string] $gitHubPat, # GitHub personal access token from https://github.com/settings/tokens (no auth scopes needed) [Parameter(Mandatory=$true)][string] $azdoPat, # Azure Dev Ops tokens from https://dev.azure.com/dnceng/_details/security/tokens (code read scope needed) [Parameter(Mandatory=$true)][string] $outputFolder, # Where the graphviz.txt file will be created - [string] $darcVersion = '1.1.0-beta.19171.6', # darc's version + [string] $darcVersion = '1.1.0-beta.19175.6', # darc's version [string] $graphvizVersion = '2.38', # GraphViz version [switch] $includeToolset # Whether the graph should include toolset dependencies or not. i.e. arcade, optimization. For more about # toolset dependencies see https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#toolset-vs-product-dependencies diff --git a/global.json b/global.json index f942a975cb1d..7f03c5e79107 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19175.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19175.9" } } From 0e5103c6e5ca00fe77bda757b14d617e5b9e48ca Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 27 Mar 2019 13:08:26 +0000 Subject: [PATCH 0424/2702] Update dependencies from https://github.com/dotnet/arcade build 20190326.14 (#70) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19176.14 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0fb0a0df0678..24c727b67934 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 13daa29185518ef3c6d4074fd07efbc5236a76c5 + e23a3e2fd09a6222361ce47b78d23ab42867924c diff --git a/global.json b/global.json index 7f03c5e79107..28c335ff611e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19175.9" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19176.14" } } From 5086aa1d4111d6be75cbefce328b145bfec3382b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 28 Mar 2019 13:13:43 +0000 Subject: [PATCH 0425/2702] Update dependencies from https://github.com/dotnet/arcade build 20190327.11 (#72) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19177.11 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 24c727b67934..2430c913b2b9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - e23a3e2fd09a6222361ce47b78d23ab42867924c + 69f276904fdd6d8f81404b857f295537894b81d3 diff --git a/global.json b/global.json index 28c335ff611e..c8e63dd1c4a9 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19176.14" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19177.11" } } From 9021635e941727fa06bb125b8b674129fd52a2a9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 29 Mar 2019 13:11:11 +0000 Subject: [PATCH 0426/2702] Update dependencies from https://github.com/dotnet/arcade build 20190329.1 (#73) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19179.1 --- eng/Version.Details.xml | 4 +- eng/common/PublishToPackageFeed.proj | 2 +- eng/common/SigningValidation.proj | 81 ++++++++++++++++++++++++++++ eng/common/tools.ps1 | 4 ++ global.json | 2 +- 5 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 eng/common/SigningValidation.proj diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2430c913b2b9..a86ba27bafe9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 69f276904fdd6d8f81404b857f295537894b81d3 + ef139c7533e2e33c5e0946b80cb1aa95d84da868 diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj index 25362ff060c1..ccb81e8c3550 100644 --- a/eng/common/PublishToPackageFeed.proj +++ b/eng/common/PublishToPackageFeed.proj @@ -60,7 +60,7 @@ UploadTimeoutInMinutes="$(MaxUploadTimeoutInMinutes)" AssetManifestPath="%(ManifestFiles.Identity)" BlobAssetsBasePath="$(BlobBasePath)" - PackageAssetsBasePath="$(PackageBasePath)" /> + PackageAssetsBasePath="$(PackageBasePath)"/> diff --git a/eng/common/SigningValidation.proj b/eng/common/SigningValidation.proj new file mode 100644 index 000000000000..17e40d128773 --- /dev/null +++ b/eng/common/SigningValidation.proj @@ -0,0 +1,81 @@ + + + + netcoreapp2.1 + + + + + + + + $(NuGetPackageRoot)Microsoft.DotNet.SignCheck\$(SignCheckVersion)\tools\Microsoft.DotNet.SignCheck.exe + + $(PackageBasePath) + signcheck.log + signcheck.errors.log + signcheck.exclusions.txt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index de7523cae581..5c4a129c8632 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -518,6 +518,10 @@ Create-Directory $TempDir Create-Directory $LogDir if ($ci) { + Write-Host "##vso[task.setvariable variable=Artifacts]$ArtifactsDir" + Write-Host "##vso[task.setvariable variable=Artifacts.Toolset]$ToolsetDir" + Write-Host "##vso[task.setvariable variable=Artifacts.Log]$LogDir" + $env:TEMP = $TempDir $env:TMP = $TempDir } diff --git a/global.json b/global.json index c8e63dd1c4a9..efb72635c16f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19177.11" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19179.1" } } From de2a675d17c950dbd69f5ba5af687d826f52d58a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 30 Mar 2019 13:08:53 +0000 Subject: [PATCH 0427/2702] Update dependencies from https://github.com/dotnet/arcade build 20190329.2 (#74) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19179.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a86ba27bafe9..471a391472f0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - ef139c7533e2e33c5e0946b80cb1aa95d84da868 + 31abd61b43b115a6af83c92ce35ed4e8efd01dfd diff --git a/global.json b/global.json index efb72635c16f..4ba8932a1589 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19179.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19179.2" } } From 211cab024c37fdffa5955c5855f9d62a14703452 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Apr 2019 12:44:37 -0700 Subject: [PATCH 0428/2702] Simplify tests and add copyright headers. (#75) --- src/CodeFormatter.cs | 18 +- src/EditorConfigOptionsApplier.cs | 15 -- src/Program.cs | 27 ++- src/WorkspaceFormatResult.cs | 4 +- tests/CodeFormatterTests.cs | 213 +++++++++++------------- tests/ProgramTests.cs | 6 +- tests/{ => Utilities}/MSBuildFixture.cs | 7 +- tests/Utilities/SolutionPathFixture.cs | 33 ++++ tests/{ => Utilities}/TestLogger.cs | 4 +- 9 files changed, 173 insertions(+), 154 deletions(-) rename tests/{ => Utilities}/MSBuildFixture.cs (73%) create mode 100644 tests/Utilities/SolutionPathFixture.cs rename tests/{ => Utilities}/TestLogger.cs (84%) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index d3d10997ab96..303dacb995a5 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -1,11 +1,10 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.IO; -using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeStyle; @@ -23,7 +22,7 @@ internal static class CodeFormatter { private const int MaxLoggedWorkspaceWarnings = 5; - public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, string[] filesToFormat, CancellationToken cancellationToken) + public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, ImmutableHashSet filesToFormat, CancellationToken cancellationToken) { logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, solutionOrProjectPath)); @@ -106,7 +105,7 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) } } - private static async Task<(int status, int fileCount, int filesFormatted)> FormatFilesInWorkspaceAsync(ILogger logger, Workspace workspace, string projectPath, ICodingConventionsManager codingConventionsManager, bool saveFormattedFiles, string[] filesToFormat, CancellationToken cancellationToken) + private static async Task<(int status, int fileCount, int filesFormatted)> FormatFilesInWorkspaceAsync(ILogger logger, Workspace workspace, string projectPath, ICodingConventionsManager codingConventionsManager, bool saveFormattedFiles, ImmutableHashSet filesToFormat, CancellationToken cancellationToken) { var projectIds = workspace.CurrentSolution.ProjectIds.ToImmutableArray(); var optionsApplier = new EditorConfigOptionsApplier(); @@ -143,7 +142,7 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) return (0, totalFileCount, totalFilesFormatted); } - private static async Task<(Solution solution, int filesFormatted)> FormatFilesInProjectAsync(ILogger logger, Project project, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, string[] filesToFormat, CancellationToken cancellationToken) + private static async Task<(Solution solution, int filesFormatted)> FormatFilesInProjectAsync(ILogger logger, Project project, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, ImmutableHashSet filesToFormat, CancellationToken cancellationToken) { var isCommentTrivia = project.Language == LanguageNames.CSharp ? IsCSharpCommentTrivia @@ -158,14 +157,9 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) continue; } - if (filesToFormat != null) + if (!filesToFormat.IsEmpty && !filesToFormat.Contains(document.FilePath)) { - var fileInArgumentList = filesToFormat.Any(relativePath => document.FilePath.EndsWith(relativePath, StringComparison.OrdinalIgnoreCase)); - - if (!fileInArgumentList) - { - continue; - } + continue; } var formatTask = Task.Run(async () => diff --git a/src/EditorConfigOptionsApplier.cs b/src/EditorConfigOptionsApplier.cs index 1508c8be2ecf..bdf6decc0477 100644 --- a/src/EditorConfigOptionsApplier.cs +++ b/src/EditorConfigOptionsApplier.cs @@ -36,21 +36,6 @@ public OptionSet ApplyConventions(OptionSet optionSet, ICodingConventionsSnapsho return optionSet; } - private OptionSet ApplyConventionsForOptions(OptionSet optionSet, IEnumerable<(IOption, OptionStorageLocation, MethodInfo)> optionsWithStorage, ICodingConventionsSnapshot codingConventions, string languageName) - { - foreach (var optionWithStorage in optionsWithStorage) - { - if (TryGetConventionValue(optionWithStorage, codingConventions, out var value)) - { - var option = optionWithStorage.Item1; - var optionKey = new OptionKey(option, option.IsPerLanguage ? languageName : null); - optionSet = optionSet.WithChangedOption(optionKey, value); - } - } - - return optionSet; - } - internal ImmutableArray<(IOption, OptionStorageLocation, MethodInfo)> GetOptionsWithStorageFromTypes(params Type[] formattingOptionTypes) { var optionType = typeof(IOption); diff --git a/src/Program.cs b/src/Program.cs index 0cc00a0f74ab..1d968076a41a 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using System.CommandLine; using System.CommandLine.Builder; using System.CommandLine.Invocation; @@ -114,10 +115,17 @@ public static async Task Run(string workspace, string verbosity, bool dryRu } } - public static int GetExitCode(WorkspaceFormatResult formatResult, bool check) => - !check ? formatResult.ExitCode : (formatResult.FilesFormatted == 0 ? 0 : 1); + internal static int GetExitCode(WorkspaceFormatResult formatResult, bool check) + { + if (!check) + { + return formatResult.ExitCode; + } + + return formatResult.FilesFormatted == 0 ? 0 : 1; + } - private static LogLevel GetLogLevel(string verbosity) + internal static LogLevel GetLogLevel(string verbosity) { switch (verbosity) { @@ -146,10 +154,17 @@ private static void ConfigureServices(ServiceCollection serviceCollection, ICons serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, logLevel)); serviceCollection.AddLogging(); } - - internal static string[] GetFileList(string files) + + internal static ImmutableHashSet GetFileList(string files) { - return files?.Split(',').Select(path => Path.GetRelativePath(Environment.CurrentDirectory, path)).ToArray(); + if (string.IsNullOrEmpty(files)) + { + return ImmutableHashSet.Create(); + } + + return files.Split(',') + .Select(path => Path.GetFullPath(path, Environment.CurrentDirectory)) + .ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); } } } diff --git a/src/WorkspaceFormatResult.cs b/src/WorkspaceFormatResult.cs index 13511e759816..54f346bccf78 100644 --- a/src/WorkspaceFormatResult.cs +++ b/src/WorkspaceFormatResult.cs @@ -1,4 +1,6 @@ -namespace Microsoft.CodeAnalysis.Tools +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Tools { internal class WorkspaceFormatResult { diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index f74630bf1f92..6f0e6232fc51 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -1,5 +1,10 @@ -using System; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; using System.IO; +using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -7,172 +12,148 @@ namespace Microsoft.CodeAnalysis.Tools.Tests { - public class CodeFormatterTests : IClassFixture + public class CodeFormatterTests : IClassFixture, IClassFixture { - private static string SolutionPath => Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.Parent.Parent.FullName; + private const string FormattedProjectPath = "tests/projects/for_code_formatter/formatted_project"; + private const string FormattedProjectFilePath = FormattedProjectPath + "/formatted_project.csproj"; + private const string FormattedSolutionFilePath = "tests/projects/for_code_formatter/formatted_solution/formatted_solution.sln"; + + private const string UnformattedProjectPath = "tests/projects/for_code_formatter/unformatted_project"; + private const string UnformattedProjectFilePath = UnformattedProjectPath + "/unformatted_project.csproj"; + private const string UnformattedProgramFilePath = UnformattedProjectPath + "/program.cs"; + private const string UnformattedSolutionFilePath = "tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln"; + + private const string FSharpProjectPath = "tests/projects/for_code_formatter/fsharp_project"; + private const string FSharpProjectFilePath = FSharpProjectPath + "/fsharp_project.fsproj"; - public CodeFormatterTests(MSBuildFixture msBuildFixture) + private static IEnumerable EmptyFilesToFormat => Array.Empty(); + + public CodeFormatterTests(MSBuildFixture msBuildFixture, SolutionPathFixture solutionPathFixture) { msBuildFixture.RegisterInstance(); + solutionPathFixture.SetCurrentDirectory(); } [Fact] public async Task NoFilesFormattedInFormattedProject() { - var logger = new TestLogger(); - var path = Path.GetFullPath("tests/projects/for_code_formatter/formatted_project/formatted_project.csproj", SolutionPath); - - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); - var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); - var filesFormatted = new Regex(pattern, RegexOptions.Multiline); - var match = filesFormatted.Match(log); - - Assert.True(match.Success, log); - Assert.Equal("0", match.Groups[1].Value); - - Assert.Equal(0, formatResult.ExitCode); - Assert.Equal(0, formatResult.FilesFormatted); - Assert.Equal(3, formatResult.FileCount); + await TestFormatWorkspaceAsync( + FormattedProjectFilePath, + EmptyFilesToFormat, + expectedExitCode: 0, + expectedFilesFormatted: 0, + expectedFileCount: 3); } [Fact] public async Task NoFilesFormattedInFormattedSolution() { - var logger = new TestLogger(); - var path = Path.GetFullPath("tests/projects/for_code_formatter/formatted_solution/formatted_solution.sln", SolutionPath); - - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); - var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); - var filesFormatted = new Regex(pattern, RegexOptions.Multiline); - var match = filesFormatted.Match(log); - - Assert.Equal(0, formatResult.ExitCode); - Assert.Equal(0, formatResult.FilesFormatted); - Assert.Equal(3, formatResult.FileCount); - - Assert.True(match.Success, log); - Assert.Equal("0", match.Groups[1].Value); + await TestFormatWorkspaceAsync( + FormattedSolutionFilePath, + EmptyFilesToFormat, + expectedExitCode: 0, + expectedFilesFormatted: 0, + expectedFileCount: 3); } [Fact] public async Task FilesFormattedInUnformattedProject() { - var logger = new TestLogger(); - var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj", SolutionPath); - - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); - var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); - var filesFormatted = new Regex(pattern, RegexOptions.Multiline); - var match = filesFormatted.Match(log); - - Assert.True(match.Success, log); - Assert.Equal("2", match.Groups[1].Value); - - Assert.Equal(0, formatResult.ExitCode); - Assert.Equal(2, formatResult.FilesFormatted); - Assert.Equal(4, formatResult.FileCount); + await TestFormatWorkspaceAsync( + UnformattedProjectFilePath, + EmptyFilesToFormat, + expectedExitCode: 0, + expectedFilesFormatted: 2, + expectedFileCount: 4); } [Fact] public async Task FilesFormattedInUnformattedSolution() { - var logger = new TestLogger(); - var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln", SolutionPath); - - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); - var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); - var filesFormatted = new Regex(pattern, RegexOptions.Multiline); - var match = filesFormatted.Match(log); - - Assert.Equal(0, formatResult.ExitCode); - Assert.Equal(2, formatResult.FilesFormatted); - Assert.Equal(4, formatResult.FileCount); - - Assert.True(match.Success, log); - Assert.Equal("2", match.Groups[1].Value); + await TestFormatWorkspaceAsync( + UnformattedSolutionFilePath, + EmptyFilesToFormat, + expectedExitCode: 0, + expectedFilesFormatted: 2, + expectedFileCount: 4); } [Fact] public async Task FSharpProjectsDoNotCreateException() { - var logger = new TestLogger(); - var path = Path.GetFullPath("tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj", SolutionPath); - - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: null, cancellationToken: CancellationToken.None); - var logLines = logger.GetLog().Split(Environment.NewLine); + var log = await TestFormatWorkspaceAsync( + FSharpProjectFilePath, + EmptyFilesToFormat, + expectedExitCode: 1, + expectedFilesFormatted: 0, + expectedFileCount: 0); - Assert.Equal(4, logLines.Length); - var actualErrorMessage = logLines[2]; - var expectedErrorMessage = string.Format(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, path); - Assert.Equal(expectedErrorMessage, actualErrorMessage); + var pattern = string.Format(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, "(.*)"); + var match = new Regex(pattern, RegexOptions.Multiline).Match(log); - Assert.Equal(1, formatResult.ExitCode); - Assert.Equal(0, formatResult.FilesFormatted); - Assert.Equal(0, formatResult.FileCount); + Assert.True(match.Success, log); + Assert.Equal(match.Groups[1].Value, Path.GetFullPath(FSharpProjectFilePath)); } - [Fact] + [Fact] public async Task OnlyFormatFilesFromList() { - var logger = new TestLogger(); - var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj", SolutionPath); - - var files = new[] {"OtherClass.cs"}; - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: files, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); - var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); - var filesFormatted = new Regex(pattern, RegexOptions.Multiline); - var match = filesFormatted.Match(log); - - Assert.True(match.Success, log); - Assert.Equal("1", match.Groups[1].Value); - - Assert.Equal(0, formatResult.ExitCode); - Assert.Equal(1, formatResult.FilesFormatted); - Assert.Equal(4, formatResult.FileCount); + var filesToFormat = new[] { UnformattedProgramFilePath }; + + await TestFormatWorkspaceAsync( + UnformattedProjectFilePath, + filesToFormat, + expectedExitCode: 0, + expectedFilesFormatted: 1, + expectedFileCount: 4); } [Fact] public async Task NoFilesFormattedWhenNotInList() { - var logger = new TestLogger(); - var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj", SolutionPath); - - var files = new[] {"ThisFileDoesNotExist.cs"}; - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: false, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: files, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); - var pattern = string.Format(Resources.Formatted_0_of_1_files_in_2_ms, "(\\d+)", "\\d+", "\\d+"); - var filesFormatted = new Regex(pattern, RegexOptions.Multiline); - var match = filesFormatted.Match(log); - - Assert.True(match.Success, log); - Assert.Equal("0", match.Groups[1].Value); - - Assert.Equal(0, formatResult.ExitCode); - Assert.Equal(0, formatResult.FilesFormatted); - Assert.Equal(4, formatResult.FileCount); + var filesToFormat = new[] { Path.Combine(UnformattedProjectPath, "does_not_exist.cs") }; + + await TestFormatWorkspaceAsync( + UnformattedProjectFilePath, + filesToFormat, + expectedExitCode: 0, + expectedFilesFormatted: 0, + expectedFileCount: 4); } [Fact] public async Task OnlyLogFormattedFiles() { - var logger = new TestLogger(); - var path = Path.GetFullPath("tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln", SolutionPath); + var filesToFormat = new[] { UnformattedProgramFilePath }; - var files = new[] {"Program.cs"}; - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, path, isSolution: true, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: files, cancellationToken: CancellationToken.None); - var log = logger.GetLog(); + var log = await TestFormatWorkspaceAsync( + UnformattedSolutionFilePath, + filesToFormat, + expectedExitCode: 0, + expectedFilesFormatted: 1, + expectedFileCount: 4); var pattern = string.Format(Resources.Formatted_code_file_0, @"(.*)"); - var fileFormatted = new Regex(pattern, RegexOptions.Multiline); - var match = fileFormatted.Match(log); + var match = new Regex(pattern, RegexOptions.Multiline).Match(log); Assert.True(match.Success, log); Assert.Equal("Program.cs", match.Groups[1].Value); } + + public async Task TestFormatWorkspaceAsync(string solutionOrProjectPath, IEnumerable filesToFormat, int expectedExitCode, int expectedFilesFormatted, int expectedFileCount) + { + var workspacePath = Path.GetFullPath(solutionOrProjectPath); + var isSolution = workspacePath.EndsWith(".sln"); + var files = filesToFormat.Select(Path.GetFullPath).ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); + + var logger = new TestLogger(); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, workspacePath, isSolution, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: files, cancellationToken: CancellationToken.None); + + Assert.Equal(expectedExitCode, formatResult.ExitCode); + Assert.Equal(expectedFilesFormatted, formatResult.FilesFormatted); + Assert.Equal(expectedFileCount, formatResult.FileCount); + + return logger.GetLog(); + } } } diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index e987f637d9a7..bd3e24979a40 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -1,4 +1,6 @@ -using System.IO; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.IO; using Xunit; namespace Microsoft.CodeAnalysis.Tools.Tests @@ -51,7 +53,7 @@ public void FilesFormattedDirectorySeparatorInsensitive() var filePathAlt = $"other_items{Path.AltDirectorySeparatorChar}OtherClass.cs"; var filesAlt = Program.GetFileList(filePathAlt); - Assert.True(files[0] == filesAlt[0]); + Assert.True(files.IsSubsetOf(filesAlt)); } } } diff --git a/tests/MSBuildFixture.cs b/tests/Utilities/MSBuildFixture.cs similarity index 73% rename from tests/MSBuildFixture.cs rename to tests/Utilities/MSBuildFixture.cs index 22106777ff4f..017473aeb923 100644 --- a/tests/MSBuildFixture.cs +++ b/tests/Utilities/MSBuildFixture.cs @@ -1,10 +1,15 @@ -using System; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.Tools.MSBuild; namespace Microsoft.CodeAnalysis.Tools.Tests { + /// + /// This test fixture ensures that MSBuild is loaded. + /// public class MSBuildFixture : IDisposable { private static int _registered = 0; diff --git a/tests/Utilities/SolutionPathFixture.cs b/tests/Utilities/SolutionPathFixture.cs new file mode 100644 index 000000000000..3b19262468bc --- /dev/null +++ b/tests/Utilities/SolutionPathFixture.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.IO; +using System.Threading; + +namespace Microsoft.CodeAnalysis.Tools.Tests +{ + /// + /// This test fixture sets the to the dotnet-format solution's path. + /// + public class SolutionPathFixture : IDisposable + { + private static int _registered = 0; + private static string _currentDirectory; + + public void SetCurrentDirectory() + { + if (Interlocked.Exchange(ref _registered, 1) == 0) + { + _currentDirectory = Environment.CurrentDirectory; + var solutionPath = Directory.GetParent(_currentDirectory).Parent.Parent.Parent.Parent.FullName; + Environment.CurrentDirectory = solutionPath; + } + } + + public void Dispose() + { + Environment.CurrentDirectory = _currentDirectory; + _currentDirectory = null; + } + } +} diff --git a/tests/TestLogger.cs b/tests/Utilities/TestLogger.cs similarity index 84% rename from tests/TestLogger.cs rename to tests/Utilities/TestLogger.cs index 64b98dfb2d16..1cd417b2668d 100644 --- a/tests/TestLogger.cs +++ b/tests/Utilities/TestLogger.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; using System.Text; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions.Internal; From 9a83fbd542735f7764c74f81ee6e3225a24fb8ae Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Apr 2019 12:58:41 -0700 Subject: [PATCH 0429/2702] Version bump --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index d797fa342d08..785b23924f37 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - 3.0.4 + 3.0.5 prerelease + + + netcoreapp2.1 @@ -41,6 +43,16 @@ https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json https://dotnetfeed.blob.core.windows.net/arcade-validation/index.json + https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json + https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json + https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json + https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json + https://dotnetfeed.blob.core.windows.net/dotnet-coreclr/index.json + https://dotnetfeed.blob.core.windows.net/dotnet-sdk/index.json + https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json + https://dotnetfeed.blob.core.windows.net/dotnet-toolset/index.json + https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json + https://dotnetfeed.blob.core.windows.net/nuget-nugetclient/index.json + + + + + netcoreapp2.1 + + + + + + + + + + + + 3650 + true + false + + + + + + + + + + + + + + + + + diff --git a/eng/common/SigningValidation.proj b/eng/common/SigningValidation.proj index 17e40d128773..7045fb6fb9d4 100644 --- a/eng/common/SigningValidation.proj +++ b/eng/common/SigningValidation.proj @@ -1,18 +1,20 @@ - + + - + - PackageBasePath : Directory containing all files that need to be validated. + - SignCheckVersion : Version of SignCheck package to be used. + - SignValidationExclusionList : ItemGroup containing exclusion list to be forwarded to SignCheck. + - EnableJarSigningCheck : Whether .jar files should be validated. + - EnableStrongNameCheck : Whether strong name check should be performed. + --> + netcoreapp2.1 diff --git a/global.json b/global.json index fd0c04675549..d2532893a98b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19203.10" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19204.16" } } From 2682e919ba4ec7cf8f030467de5b26d71af015f2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 6 Apr 2019 13:21:43 +0000 Subject: [PATCH 0439/2702] Update dependencies from https://github.com/dotnet/arcade build 20190405.6 (#85) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19205.6 --- eng/Version.Details.xml | 4 ++-- eng/common/darc-init.ps1 | 2 +- eng/common/darc-init.sh | 2 +- global.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c02071a5d289..dc25533540d5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 61196044ed70a65c610beb230ac6ea77566668c2 + 4217db4a23ffd15abb3771d635b66162994fb9e4 diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 29c443212b45..81ffd16779cb 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -19,7 +19,7 @@ function InstallDarcCli ($darcVersion) { # Until we can anonymously query the BAR API for the latest arcade-services # build applied to the PROD channel, this is hardcoded. if (-not $darcVersion) { - $darcVersion = '1.1.0-beta.19175.6' + $darcVersion = '1.1.0-beta.19205.4' } $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-arcade/index.json' diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index cab6cd5bf9f3..bd7eb4639864 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash source="${BASH_SOURCE[0]}" -darcVersion="1.1.0-beta.19175.6" +darcVersion="1.1.0-beta.19205.4" while [[ $# > 0 ]]; do opt="$(echo "$1" | awk '{print tolower($0)}')" diff --git a/global.json b/global.json index d2532893a98b..f3b47a2b8b96 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19204.16" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19205.6" } } From b6db94c361b1ecd0558fc7429335ec01133773ed Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 7 Apr 2019 13:30:09 +0000 Subject: [PATCH 0440/2702] Update dependencies from https://github.com/dotnet/arcade build 20190406.5 (#87) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19206.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dc25533540d5..7396e9dbcfa7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 4217db4a23ffd15abb3771d635b66162994fb9e4 + 9d8abf998866f10bc19d97e1916ff1c0ada3fd42 diff --git a/global.json b/global.json index f3b47a2b8b96..bebfe6347631 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19205.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19206.5" } } From 401e3a2798242c1a98775973083bf26501340fa8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 9 Apr 2019 12:45:16 +0000 Subject: [PATCH 0441/2702] Update dependencies from https://github.com/dotnet/arcade build 20190407.1 (#89) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19207.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7396e9dbcfa7..f063e405aaeb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 9d8abf998866f10bc19d97e1916ff1c0ada3fd42 + b1f9e12fe3ee71c48ea60b15968745850ac0a4a7 diff --git a/global.json b/global.json index bebfe6347631..e12b65d6accb 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19206.5" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19207.1" } } From 2c6cd160664b98be494d94023953635c972f6b57 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 9 Apr 2019 07:45:29 -0700 Subject: [PATCH 0442/2702] Add integration test runner (#88) * Add integration tests. --- azure-pipelines-integration.yml | 52 +++++++++++++++++++++++++++ eng/format-verifier.ps1 | 64 +++++++++++++++++++++++++++++++++ eng/integration-test.cmd | 3 ++ 3 files changed, 119 insertions(+) create mode 100644 azure-pipelines-integration.yml create mode 100644 eng/format-verifier.ps1 create mode 100644 eng/integration-test.cmd diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml new file mode 100644 index 000000000000..94ad13142c5c --- /dev/null +++ b/azure-pipelines-integration.yml @@ -0,0 +1,52 @@ +# Branches that trigger a build on commit +trigger: +- master + +# Branches that trigger builds on PR +pr: +- master + +jobs: + +- job: Format + pool: + vmImage: 'vs2017-win2016' + strategy: + maxParallel: 8 + matrix: + format: + _repo: "https://github.com/dotnet/format" + _repoName: "dotnet/format" + _sha: "b6db94c361b1ecd0558fc7429335ec01133773ed" + roslyn: + _repo: "https://github.com/dotnet/roslyn" + _repoName: "dotnet/roslyn" + _sha: "665dc224dcfefb66dce215ca0204363172b611ad" + cli: + _repo: "https://github.com/dotnet/cli" + _repoName: "dotnet/cli" + _sha: "8d0f2a593ec98ccc1ef2141452d7dccadc34ac40" + project-system: + _repo: "https://github.com/dotnet/project-system" + _repoName: "dotnet/project-system" + _sha: "80580ad27c5544f00f4abb9db930e698ce305285" + msbuild: + _repo: "https://github.com/Microsoft/msbuild" + _repoName: "Microsoft/msbuild" + _sha: "d54d2e0180b99b7773f0fef2cdb03168f134d9aa" + Blazor: + _repo: "https://github.com/aspnet/Blazor" + _repoName: "aspnet/Blazor" + _sha: "3addb6169afcae1b5c6a64de4a7cd02bd270ffed" + EntityFrameworkCore: + _repo: "https://github.com/aspnet/EntityFrameworkCore" + _repoName: "aspnet/EntityFrameworkCore" + _sha: "090f385ffe4f2cd1a3e6b794523bdf574862c298" + EntityFramework6: + _repo: "https://github.com/aspnet/EntityFramework6" + _repoName: "aspnet/EntityFramework6" + _sha: "936befcd88a4b58be6f35038248cd5337aca4967" + timeoutInMinutes: 20 + steps: + - script: eng\integration-test.cmd -repo '$(_repo)' -sha '$(_sha)' -testPath '$(Build.SourcesDirectory)\temp' + displayName: Run dotnet-format on $(_repoName) diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 new file mode 100644 index 000000000000..cbe2a082ef28 --- /dev/null +++ b/eng/format-verifier.ps1 @@ -0,0 +1,64 @@ +[CmdletBinding(PositionalBinding = $false)] +Param( + [string]$repo, + [string]$sha, + [string]$testPath +) + +function Clone-Repo([string]$repo, [string]$sha, [string]$repoPath) { + $currentLocation = Get-Location + + git.exe clone $repo $repoPath + + Set-Location $repoPath + + git.exe checkout $sha + + Set-Location $currentLocation +} + +if (!(Test-Path $testPath)) { + New-Item -ItemType Directory -Force -Path $testPath | Out-Null +} + +try { + $repoName = $repo.Substring(19) + $folderName = $repoName.Split("/")[1] + $repoPath = Join-Path $testPath $folderName + + Write-Output "$(Get-Date) - Cloning $repoName." + Clone-Repo $repo $sha $repoPath + + Write-Output "$(Get-Date) - Finding solutions." + $solutions = Get-ChildItem -Path $repoPath -Filter *.sln -Recurse -Depth 2 | Select-Object -ExpandProperty FullName | Where-Object { $_ -match '.sln$' } + + foreach ($solution in $solutions) { + $solutionFile = Split-Path $solution -leaf + + Write-Output "$(Get-Date) - $solutionFile - Restoring" + dotnet.exe restore $solution + + Write-Output "$(Get-Date) - $solutionFile - Formatting" + $output = dotnet.exe run -p .\src\dotnet-format.csproj -c Release -- -w $solution -v d --dry-run | Out-String + Write-Output $output.TrimEnd() + + if ($LastExitCode -ne 0) { + Write-Output "$(Get-Date) - Formatting failed with error code $LastExitCode." + exit -1 + } + + if (($output -notmatch "(?m)Formatted \d+ of (\d+) files") -or ($Matches[1] -eq "0")) { + Write-Output "$(Get-Date) - No files found for project." + exit -1 + } + + Write-Output "$(Get-Date) - $solutionFile - Complete" + } +} +catch { + exit -1 +} +finally { + Remove-Item $repoPath -Force -Recurse + Write-Output "$(Get-Date) - Deleted $repoName." +} diff --git a/eng/integration-test.cmd b/eng/integration-test.cmd new file mode 100644 index 000000000000..bb23395fc926 --- /dev/null +++ b/eng/integration-test.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0format-verifier.ps1""" %*" +exit /b %ErrorLevel% \ No newline at end of file From 9ba9845f69fa4debe3fb2d32b1c7a67364fe4678 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 9 Apr 2019 08:30:46 -0700 Subject: [PATCH 0443/2702] Code cleanup (#86) * Use System.IO.Path instead of PathUtilities * Add IsGeneratedCodeAsync method that accepts a Document * Fix naming violation in MSBuildWorkspaceFinder * Move logger to end of argument lists * Fixup filesToFormat naming * Add more comments * Update namespaces to match folder structure. * Fix whitespace formatting and set compiler version to 7.3 for tests --- src/CodeFormatter.cs | 29 +- src/MSBuild/LooseVersionAssemblyLoader.cs | 2 +- src/MSBuild/MSBuildWorkspaceFinder.cs | 6 +- src/Program.cs | 13 +- .../EditorConfigOptionsApplier.cs | 6 +- src/Utilities/FileNameUtilities.cs | 183 ----- src/Utilities/GeneratedCodeUtilities.cs | 56 +- src/Utilities/Hash.cs | 367 --------- src/Utilities/PathKind.cs | 42 - src/Utilities/PathUtilities.cs | 749 ------------------ src/Utilities/PlatformInformation.cs | 33 - src/Utilities/ProcessRunner.cs | 2 +- tests/CodeFormatterTests.cs | 23 +- tests/ProgramTests.cs | 6 +- tests/Utilities/MSBuildFixture.cs | 2 +- tests/Utilities/SolutionPathFixture.cs | 2 +- tests/Utilities/TestLogger.cs | 5 +- tests/dotnet-format.UnitTests.csproj | 1 + 18 files changed, 71 insertions(+), 1456 deletions(-) rename src/{ => Utilities}/EditorConfigOptionsApplier.cs (95%) delete mode 100644 src/Utilities/FileNameUtilities.cs delete mode 100644 src/Utilities/Hash.cs delete mode 100644 src/Utilities/PathKind.cs delete mode 100644 src/Utilities/PathUtilities.cs delete mode 100644 src/Utilities/PlatformInformation.cs diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 303dacb995a5..3b9cdbc95c06 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -7,11 +7,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.MSBuild; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; +using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.CodingConventions; using Roslyn.Utilities; @@ -22,7 +22,7 @@ internal static class CodeFormatter { private const int MaxLoggedWorkspaceWarnings = 5; - public static async Task FormatWorkspaceAsync(ILogger logger, string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, ImmutableHashSet filesToFormat, CancellationToken cancellationToken) + public static async Task FormatWorkspaceAsync(string solutionOrProjectPath, bool isSolution, bool logAllWorkspaceWarnings, bool saveFormattedFiles, ImmutableHashSet filesToFormat, ILogger logger, CancellationToken cancellationToken) { logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, solutionOrProjectPath)); @@ -74,7 +74,7 @@ public static async Task FormatWorkspaceAsync(ILogger log logger.LogTrace(Resources.Workspace_loaded_in_0_ms, workspaceStopwatch.ElapsedMilliseconds); workspaceStopwatch.Restart(); - (formatResult.ExitCode, formatResult.FileCount, formatResult.FilesFormatted) = await FormatFilesInWorkspaceAsync(logger, workspace, projectPath, codingConventionsManager, saveFormattedFiles, filesToFormat, cancellationToken).ConfigureAwait(false); + (formatResult.ExitCode, formatResult.FileCount, formatResult.FilesFormatted) = await FormatFilesInWorkspaceAsync(workspace, projectPath, codingConventionsManager, saveFormattedFiles, filesToFormat, logger, cancellationToken).ConfigureAwait(false); logger.LogDebug(Resources.Formatted_0_of_1_files_in_2_ms, formatResult.FilesFormatted, formatResult.FileCount, workspaceStopwatch.ElapsedMilliseconds); } @@ -105,7 +105,7 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) } } - private static async Task<(int status, int fileCount, int filesFormatted)> FormatFilesInWorkspaceAsync(ILogger logger, Workspace workspace, string projectPath, ICodingConventionsManager codingConventionsManager, bool saveFormattedFiles, ImmutableHashSet filesToFormat, CancellationToken cancellationToken) + private static async Task<(int status, int fileCount, int filesFormatted)> FormatFilesInWorkspaceAsync(Workspace workspace, string projectPath, ICodingConventionsManager codingConventionsManager, bool saveFormattedFiles, ImmutableHashSet filesToFormat, ILogger logger, CancellationToken cancellationToken) { var projectIds = workspace.CurrentSolution.ProjectIds.ToImmutableArray(); var optionsApplier = new EditorConfigOptionsApplier(); @@ -129,7 +129,7 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) logger.LogInformation(Resources.Formatting_code_files_in_project_0, project.Name); - var (formattedSolution, filesFormatted) = await FormatFilesInProjectAsync(logger, project, codingConventionsManager, optionsApplier, filesToFormat, cancellationToken).ConfigureAwait(false); + var (formattedSolution, filesFormatted) = await FormatFilesInProjectAsync(project, codingConventionsManager, optionsApplier, filesToFormat, logger, cancellationToken).ConfigureAwait(false); totalFileCount += project.DocumentIds.Count; totalFilesFormatted += filesFormatted; if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution)) @@ -142,12 +142,8 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) return (0, totalFileCount, totalFilesFormatted); } - private static async Task<(Solution solution, int filesFormatted)> FormatFilesInProjectAsync(ILogger logger, Project project, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, ImmutableHashSet filesToFormat, CancellationToken cancellationToken) + private static async Task<(Solution solution, int filesFormatted)> FormatFilesInProjectAsync(Project project, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, ImmutableHashSet filesToFormat, ILogger logger, CancellationToken cancellationToken) { - var isCommentTrivia = project.Language == LanguageNames.CSharp - ? IsCSharpCommentTrivia - : IsVisualBasicCommentTrivia; - var formattedDocuments = new List<(DocumentId documentId, Task formatTask)>(); foreach (var documentId in project.DocumentIds) { @@ -164,8 +160,7 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) var formatTask = Task.Run(async () => { - var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - if (GeneratedCodeUtilities.IsGeneratedCode(syntaxTree, isCommentTrivia, cancellationToken)) + if (await GeneratedCodeUtilities.IsGeneratedCodeAsync(document, cancellationToken)) { return null; } @@ -212,15 +207,5 @@ void LogWorkspaceWarnings(object sender, WorkspaceDiagnosticEventArgs args) return (formattedSolution, filesFormatted); } - - private static readonly Func IsCSharpCommentTrivia = - (syntaxTrivia) => syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineCommentTrivia) - || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineCommentTrivia) - || syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineDocumentationCommentTrivia) - || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineDocumentationCommentTrivia); - - private static readonly Func IsVisualBasicCommentTrivia = - (syntaxTrivia) => syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia) - || syntaxTrivia.IsKind(VisualBasic.SyntaxKind.DocumentationCommentTrivia); } } diff --git a/src/MSBuild/LooseVersionAssemblyLoader.cs b/src/MSBuild/LooseVersionAssemblyLoader.cs index cca1e2102c30..bcc4f26df6f0 100644 --- a/src/MSBuild/LooseVersionAssemblyLoader.cs +++ b/src/MSBuild/LooseVersionAssemblyLoader.cs @@ -84,4 +84,4 @@ private static Assembly LoadAndCache(AssemblyLoadContext context, string fullPat return assembly; } } -} \ No newline at end of file +} diff --git a/src/MSBuild/MSBuildWorkspaceFinder.cs b/src/MSBuild/MSBuildWorkspaceFinder.cs index b0f60c4abe45..55a5fce1ae80 100644 --- a/src/MSBuild/MSBuildWorkspaceFinder.cs +++ b/src/MSBuild/MSBuildWorkspaceFinder.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.Tools.MSBuild internal class MSBuildWorkspaceFinder { // Used to exclude dnx projects - private const string s_dnxProjectExtension = ".xproj"; + private const string DnxProjectExtension = ".xproj"; /// /// Finds a compatible MSBuild project or solution. @@ -59,7 +59,7 @@ private static (bool isSolution, string workspacePath) FindFile(string workspace var isSolution = workspaceExtension.Equals(".sln", StringComparison.OrdinalIgnoreCase); var isProject = !isSolution && workspaceExtension.EndsWith("proj", StringComparison.OrdinalIgnoreCase) - && !workspaceExtension.Equals(s_dnxProjectExtension, StringComparison.OrdinalIgnoreCase); + && !workspaceExtension.Equals(DnxProjectExtension, StringComparison.OrdinalIgnoreCase); if (!isSolution && !isProject) { @@ -80,7 +80,7 @@ private static (bool isSolution, string workspacePath) FindFile(string workspace private static IEnumerable FindSolutionFiles(string basePath) => Directory.EnumerateFileSystemEntries(basePath, "*.sln", SearchOption.TopDirectoryOnly); private static IEnumerable FindProjectFiles(string basePath) => Directory.EnumerateFileSystemEntries(basePath, "*.*proj", SearchOption.TopDirectoryOnly) - .Where(f => !s_dnxProjectExtension.Equals(Path.GetExtension(f), StringComparison.OrdinalIgnoreCase)); + .Where(f => !DnxProjectExtension.Equals(Path.GetExtension(f), StringComparison.OrdinalIgnoreCase)); private static string FindMatchingFile(string searchBase, Func> fileSelector, string multipleFilesFoundError) { diff --git a/src/Program.cs b/src/Program.cs index 9250c83942da..16f64f91cd83 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -43,6 +43,7 @@ private static async Task Main(string[] args) public static async Task Run(string workspace, string verbosity, bool dryRun, bool check, string files, IConsole console = null) { + // Setup logging var serviceCollection = new ServiceCollection(); var logLevel = GetLogLevel(verbosity); ConfigureServices(serviceCollection, console, logLevel); @@ -50,6 +51,7 @@ public static async Task Run(string workspace, string verbosity, bool dryRu var serviceProvider = serviceCollection.BuildServiceProvider(); var logger = serviceProvider.GetService>(); + // Hook so we can process ctrl+c key presses var cancellationTokenSource = new CancellationTokenSource(); Console.CancelKeyPress += (sender, e) => { @@ -72,7 +74,7 @@ public static async Task Run(string workspace, string verbosity, bool dryRu var workspaceDirectory = Path.GetDirectoryName(workspacePath); Environment.CurrentDirectory = workingDirectory; - var fileList = GetFileList(files); + var filesToFormat = GetFilesToFormat(files); // Since we are running as a dotnet tool we should be able to find an instance of // MSBuild in a .NET Core SDK. @@ -87,12 +89,12 @@ public static async Task Run(string workspace, string verbosity, bool dryRu Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); var formatResult = await CodeFormatter.FormatWorkspaceAsync( - logger, workspacePath, isSolution, logAllWorkspaceWarnings: logLevel == LogLevel.Trace, saveFormattedFiles: !dryRun, - filesToFormat: fileList, + filesToFormat, + logger, cancellationTokenSource.Token).ConfigureAwait(false); return GetExitCode(formatResult, check); @@ -155,7 +157,10 @@ private static void ConfigureServices(ServiceCollection serviceCollection, ICons serviceCollection.AddLogging(); } - internal static ImmutableHashSet GetFileList(string files) + /// + /// Converts a comma-separated list of relative file paths to a hashmap of full file paths. + /// + internal static ImmutableHashSet GetFilesToFormat(string files) { if (string.IsNullOrEmpty(files)) { diff --git a/src/EditorConfigOptionsApplier.cs b/src/Utilities/EditorConfigOptionsApplier.cs similarity index 95% rename from src/EditorConfigOptionsApplier.cs rename to src/Utilities/EditorConfigOptionsApplier.cs index bdf6decc0477..8481046e18c3 100644 --- a/src/EditorConfigOptionsApplier.cs +++ b/src/Utilities/EditorConfigOptionsApplier.cs @@ -1,14 +1,13 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Reflection; using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.CodingConventions; -namespace Microsoft.CodeAnalysis.CodeStyle +namespace Microsoft.CodeAnalysis.Tools.Utilities { internal class EditorConfigOptionsApplier { @@ -21,6 +20,9 @@ public EditorConfigOptionsApplier() _formattingOptionsWithStorage = GetOptionsWithStorageFromTypes(new[] { commonOptionsType, csharpOptionsType }); } + /// + /// Apply .editorconfig settings to the . + /// public OptionSet ApplyConventions(OptionSet optionSet, ICodingConventionsSnapshot codingConventions, string languageName) { foreach (var optionWithStorage in _formattingOptionsWithStorage) diff --git a/src/Utilities/FileNameUtilities.cs b/src/Utilities/FileNameUtilities.cs deleted file mode 100644 index f21636aebb61..000000000000 --- a/src/Utilities/FileNameUtilities.cs +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -namespace Roslyn.Utilities -{ - /// - /// Implements a few file name utilities that are needed by the compiler. - /// In general the compiler is not supposed to understand the format of the paths. - /// In rare cases it needs to check if a string is a valid file name or change the extension - /// (embedded resources, netmodules, output name). - /// The APIs are intentionally limited to cover just these rare cases. Do not add more APIs. - /// - internal static class FileNameUtilities - { - private const string DirectorySeparatorStr = "\\"; - internal const char DirectorySeparatorChar = '\\'; - internal const char AltDirectorySeparatorChar = '/'; - internal const char VolumeSeparatorChar = ':'; - - /// - /// Returns true if the string represents an unqualified file name. - /// The name may contain any characters but directory and volume separators. - /// - /// Path. - /// - /// True if is a simple file name, false if it is null or includes a directory specification. - /// - internal static bool IsFileName(string path) - { - return IndexOfFileName(path) == 0; - } - - /// - /// Returns the offset in where the dot that starts an extension is, or -1 if the path doesn't have an extension. - /// - /// - /// Returns 0 for path ".goo". - /// Returns -1 for path "goo.". - /// - private static int IndexOfExtension(string path) - { - if (path == null) - { - return -1; - } - - int length = path.Length; - int i = length; - - while (--i >= 0) - { - char c = path[i]; - if (c == '.') - { - if (i != length - 1) - { - return i; - } - - return -1; - } - - if (c == DirectorySeparatorChar || c == AltDirectorySeparatorChar || c == VolumeSeparatorChar) - { - break; - } - } - - return -1; - } - - /// - /// Returns an extension of the specified path string. - /// - /// - /// The same functionality as but doesn't throw an exception - /// if there are invalid characters in the path. - /// - internal static string GetExtension(string path) - { - if (path == null) - { - return null; - } - - int index = IndexOfExtension(path); - return (index >= 0) ? path.Substring(index) : string.Empty; - } - - /// - /// Removes extension from path. - /// - /// - /// Returns "goo" for path "goo.". - /// Returns "goo.." for path "goo...". - /// - private static string RemoveExtension(string path) - { - if (path == null) - { - return null; - } - - int index = IndexOfExtension(path); - if (index >= 0) - { - return path.Substring(0, index); - } - - // trim last ".", if present - if (path.Length > 0 && path[path.Length - 1] == '.') - { - return path.Substring(0, path.Length - 1); - } - - return path; - } - - /// - /// Returns path with the extension changed to . - /// - /// - /// Equivalent of - /// - /// If is null, returns null. - /// If path does not end with an extension, the new extension is appended to the path. - /// If extension is null, equivalent to . - /// - internal static string ChangeExtension(string path, string extension) - { - if (path == null) - { - return null; - } - - var pathWithoutExtension = RemoveExtension(path); - if (extension == null || path.Length == 0) - { - return pathWithoutExtension; - } - - if (extension.Length == 0 || extension[0] != '.') - { - return pathWithoutExtension + "." + extension; - } - - return pathWithoutExtension + extension; - } - - /// - /// Returns the position in given path where the file name starts. - /// - /// -1 if path is null. - internal static int IndexOfFileName(string path) - { - if (path == null) - { - return -1; - } - - for (int i = path.Length - 1; i >= 0; i--) - { - char ch = path[i]; - if (ch == DirectorySeparatorChar || ch == AltDirectorySeparatorChar || ch == VolumeSeparatorChar) - { - return i + 1; - } - } - - return 0; - } - - /// - /// Get file name from path. - /// - /// Unlike doesn't check for invalid path characters. - internal static string GetFileName(string path, bool includeExtension = true) - { - int fileNameStart = IndexOfFileName(path); - var fileName = (fileNameStart <= 0) ? path : path.Substring(fileNameStart); - return includeExtension ? fileName : RemoveExtension(fileName); - } - } -} diff --git a/src/Utilities/GeneratedCodeUtilities.cs b/src/Utilities/GeneratedCodeUtilities.cs index 33a8bca6f892..e326f99d37b8 100644 --- a/src/Utilities/GeneratedCodeUtilities.cs +++ b/src/Utilities/GeneratedCodeUtilities.cs @@ -1,45 +1,27 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Diagnostics; -using System.Linq; +using System.IO; using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis; +using CSharp = Microsoft.CodeAnalysis.CSharp; +using VisualBasic = Microsoft.CodeAnalysis.VisualBasic; -namespace Roslyn.Utilities +namespace Microsoft.CodeAnalysis.Tools.Utilities { internal static class GeneratedCodeUtilities { private static readonly string[] s_autoGeneratedStrings = new[] { " IsGeneratedCodeAsync(Document document, CancellationToken cancellationToken) { - Debug.Assert(symbol != null); - Debug.Assert(generatedCodeAttribute != null); + var isCommentTrivia = document.Project.Language == LanguageNames.CSharp + ? s_isCSharpCommentTrivia + : s_isVisualBasicCommentTrivia; - // Don't check this for namespaces. Namespaces cannot have attributes on them. And, - // currently, calling DeclaringSyntaxReferences on an INamespaceSymbol is more expensive - // than is desirable. - if (symbol.Kind != SymbolKind.Namespace) - { - // GeneratedCodeAttribute can only be applied once on a symbol. - // For partial symbols with more than one definition, we must treat them as non-generated code symbols. - if (symbol.DeclaringSyntaxReferences.Length > 1) - { - return false; - } - - foreach (var attribute in symbol.GetAttributes()) - { - if (generatedCodeAttribute.Equals(attribute.AttributeClass)) - { - return true; - } - } - } - - return symbol.ContainingSymbol != null && IsGeneratedSymbolWithGeneratedCodeAttribute(symbol.ContainingSymbol, generatedCodeAttribute); + var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + return IsGeneratedCode(syntaxTree, isCommentTrivia, cancellationToken); } internal static bool IsGeneratedCode( @@ -53,16 +35,16 @@ private static bool IsGeneratedCodeFile(string filePath) { if (!string.IsNullOrEmpty(filePath)) { - var fileName = PathUtilities.GetFileName(filePath); + var fileName = Path.GetFileName(filePath); if (fileName.StartsWith("TemporaryGeneratedFile_", StringComparison.OrdinalIgnoreCase)) { return true; } - var extension = PathUtilities.GetExtension(fileName); + var extension = Path.GetExtension(fileName); if (!string.IsNullOrEmpty(extension)) { - var fileNameWithoutExtension = PathUtilities.GetFileName(filePath, includeExtension: false); + var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath); if (fileNameWithoutExtension.EndsWith(".designer", StringComparison.OrdinalIgnoreCase) || fileNameWithoutExtension.EndsWith(".generated", StringComparison.OrdinalIgnoreCase) || fileNameWithoutExtension.EndsWith(".g", StringComparison.OrdinalIgnoreCase) || @@ -106,5 +88,15 @@ private static bool BeginsWithAutoGeneratedComment( return false; } + + private static readonly Func s_isCSharpCommentTrivia = + (syntaxTrivia) => syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineCommentTrivia) + || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineCommentTrivia) + || syntaxTrivia.IsKind(CSharp.SyntaxKind.SingleLineDocumentationCommentTrivia) + || syntaxTrivia.IsKind(CSharp.SyntaxKind.MultiLineDocumentationCommentTrivia); + + private static readonly Func s_isVisualBasicCommentTrivia = + (syntaxTrivia) => syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia) + || syntaxTrivia.IsKind(VisualBasic.SyntaxKind.DocumentationCommentTrivia); } } diff --git a/src/Utilities/Hash.cs b/src/Utilities/Hash.cs deleted file mode 100644 index 43120cd27de4..000000000000 --- a/src/Utilities/Hash.cs +++ /dev/null @@ -1,367 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using Microsoft.CodeAnalysis; - -namespace Roslyn.Utilities -{ - internal static class Hash - { - /// - /// This is how VB Anonymous Types combine hash values for fields. - /// - internal static int Combine(int newKey, int currentKey) - { - return unchecked((currentKey * (int)0xA5555529) + newKey); - } - - internal static int Combine(bool newKeyPart, int currentKey) - { - return Combine(currentKey, newKeyPart ? 1 : 0); - } - - /// - /// This is how VB Anonymous Types combine hash values for fields. - /// PERF: Do not use with enum types because that involves multiple - /// unnecessary boxing operations. Unfortunately, we can't constrain - /// T to "non-enum", so we'll use a more restrictive constraint. - /// - internal static int Combine(T newKeyPart, int currentKey) where T : class - { - int hash = unchecked(currentKey * (int)0xA5555529); - - if (newKeyPart != null) - { - return unchecked(hash + newKeyPart.GetHashCode()); - } - - return hash; - } - - internal static int CombineValues(IEnumerable values, int maxItemsToHash = int.MaxValue) - { - if (values == null) - { - return 0; - } - - var hashCode = 0; - var count = 0; - foreach (var value in values) - { - if (count++ >= maxItemsToHash) - { - break; - } - - // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). - if (value != null) - { - hashCode = Hash.Combine(value.GetHashCode(), hashCode); - } - } - - return hashCode; - } - - internal static int CombineValues(T[] values, int maxItemsToHash = int.MaxValue) - { - if (values == null) - { - return 0; - } - - var maxSize = Math.Min(maxItemsToHash, values.Length); - var hashCode = 0; - - for (int i = 0; i < maxSize; i++) - { - T value = values[i]; - - // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). - if (value != null) - { - hashCode = Hash.Combine(value.GetHashCode(), hashCode); - } - } - - return hashCode; - } - - internal static int CombineValues(ImmutableArray values, int maxItemsToHash = int.MaxValue) - { - if (values.IsDefaultOrEmpty) - { - return 0; - } - - var hashCode = 0; - var count = 0; - foreach (var value in values) - { - if (count++ >= maxItemsToHash) - { - break; - } - - // Should end up with a constrained virtual call to object.GetHashCode (i.e. avoid boxing where possible). - if (value != null) - { - hashCode = Hash.Combine(value.GetHashCode(), hashCode); - } - } - - return hashCode; - } - - internal static int CombineValues(IEnumerable values, StringComparer stringComparer, int maxItemsToHash = int.MaxValue) - { - if (values == null) - { - return 0; - } - - var hashCode = 0; - var count = 0; - foreach (var value in values) - { - if (count++ >= maxItemsToHash) - { - break; - } - - if (value != null) - { - hashCode = Hash.Combine(stringComparer.GetHashCode(value), hashCode); - } - } - - return hashCode; - } - - /// - /// The offset bias value used in the FNV-1a algorithm - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - internal const int FnvOffsetBias = unchecked((int)2166136261); - - /// - /// The generative factor used in the FNV-1a algorithm - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - internal const int FnvPrime = 16777619; - - /// - /// Compute the FNV-1a hash of a sequence of bytes - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The sequence of bytes - /// The FNV-1a hash of - internal static int GetFNVHashCode(byte[] data) - { - int hashCode = Hash.FnvOffsetBias; - - for (int i = 0; i < data.Length; i++) - { - hashCode = unchecked((hashCode ^ data[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the FNV-1a hash of a sequence of bytes and determines if the byte - /// sequence is valid ASCII and hence the hash code matches a char sequence - /// encoding the same text. - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The sequence of bytes that are likely to be ASCII text. - /// True if the sequence contains only characters in the ASCII range. - /// The FNV-1a hash of - internal static int GetFNVHashCode(ReadOnlySpan data, out bool isAscii) - { - int hashCode = Hash.FnvOffsetBias; - - byte asciiMask = 0; - - for (int i = 0; i < data.Length; i++) - { - byte b = data[i]; - asciiMask |= b; - hashCode = unchecked((hashCode ^ b) * Hash.FnvPrime); - } - - isAscii = (asciiMask & 0x80) == 0; - return hashCode; - } - - /// - /// Compute the FNV-1a hash of a sequence of bytes - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The sequence of bytes - /// The FNV-1a hash of - internal static int GetFNVHashCode(ImmutableArray data) - { - int hashCode = Hash.FnvOffsetBias; - - for (int i = 0; i < data.Length; i++) - { - hashCode = unchecked((hashCode ^ data[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the hashcode of a sub-string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// Note: FNV-1a was developed and tuned for 8-bit sequences. We're using it here - /// for 16-bit Unicode chars on the understanding that the majority of chars will - /// fit into 8-bits and, therefore, the algorithm will retain its desirable traits - /// for generating hash codes. - /// - /// The input string - /// The start index of the first character to hash - /// The number of characters, beginning with to hash - /// The FNV-1a hash code of the substring beginning at and ending after characters. - internal static int GetFNVHashCode(string text, int start, int length) - { - int hashCode = Hash.FnvOffsetBias; - int end = start + length; - - for (int i = start; i < end; i++) - { - hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - internal static int GetCaseInsensitiveFNVHashCode(string text) - { - return GetCaseInsensitiveFNVHashCode(text, 0, text.Length); - } - - internal static int GetCaseInsensitiveFNVHashCode(string text, int start, int length) - { - int hashCode = Hash.FnvOffsetBias; - int end = start + length; - - for (int i = start; i < end; i++) - { - hashCode = unchecked((hashCode ^ CaseInsensitiveComparison.ToLower(text[i])) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the hashcode of a sub-string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The input string - /// The start index of the first character to hash - /// The FNV-1a hash code of the substring beginning at and ending at the end of the string. - internal static int GetFNVHashCode(string text, int start) - { - return GetFNVHashCode(text, start, length: text.Length - start); - } - - /// - /// Compute the hashcode of a string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The input string - /// The FNV-1a hash code of - internal static int GetFNVHashCode(string text) - { - return CombineFNVHash(Hash.FnvOffsetBias, text); - } - - /// - /// Compute the hashcode of a string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The input string - /// The FNV-1a hash code of - internal static int GetFNVHashCode(System.Text.StringBuilder text) - { - int hashCode = Hash.FnvOffsetBias; - int end = text.Length; - - for (int i = 0; i < end; i++) - { - hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the hashcode of a sub string using FNV-1a - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The input string as a char array - /// The start index of the first character to hash - /// The number of characters, beginning with to hash - /// The FNV-1a hash code of the substring beginning at and ending after characters. - internal static int GetFNVHashCode(char[] text, int start, int length) - { - int hashCode = Hash.FnvOffsetBias; - int end = start + length; - - for (int i = start; i < end; i++) - { - hashCode = unchecked((hashCode ^ text[i]) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Compute the hashcode of a single character using the FNV-1a algorithm - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// Note: In general, this isn't any more useful than "char.GetHashCode". However, - /// it may be needed if you need to generate the same hash code as a string or - /// substring with just a single character. - /// - /// The character to hash - /// The FNV-1a hash code of the character. - internal static int GetFNVHashCode(char ch) - { - return Hash.CombineFNVHash(Hash.FnvOffsetBias, ch); - } - - /// - /// Combine a string with an existing FNV-1a hash code - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The accumulated hash code - /// The string to combine - /// The result of combining with using the FNV-1a algorithm - internal static int CombineFNVHash(int hashCode, string text) - { - foreach (char ch in text) - { - hashCode = unchecked((hashCode ^ ch) * Hash.FnvPrime); - } - - return hashCode; - } - - /// - /// Combine a char with an existing FNV-1a hash code - /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function - /// - /// The accumulated hash code - /// The new character to combine - /// The result of combining with using the FNV-1a algorithm - internal static int CombineFNVHash(int hashCode, char ch) - { - return unchecked((hashCode ^ ch) * Hash.FnvPrime); - } - } -} diff --git a/src/Utilities/PathKind.cs b/src/Utilities/PathKind.cs deleted file mode 100644 index 05005d5c3aa4..000000000000 --- a/src/Utilities/PathKind.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -namespace Roslyn.Utilities -{ - internal enum PathKind - { - /// - /// Null or empty. - /// - Empty, - - /// - /// "file" - /// - Relative, - - /// - /// ".\file" - /// - RelativeToCurrentDirectory, - - /// - /// "..\file" - /// - RelativeToCurrentParent, - - /// - /// "\dir\file" - /// - RelativeToCurrentRoot, - - /// - /// "C:dir\file" - /// - RelativeToDriveDirectory, - - /// - /// "C:\file" or "\\machine" (UNC). - /// - Absolute, - } -} diff --git a/src/Utilities/PathUtilities.cs b/src/Utilities/PathUtilities.cs deleted file mode 100644 index 9c342671579f..000000000000 --- a/src/Utilities/PathUtilities.cs +++ /dev/null @@ -1,749 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Diagnostics; -using System.IO; -using System.Linq; - -namespace Roslyn.Utilities -{ - // Contains path parsing utilities. - // We need our own because System.IO.Path is insufficient for our purposes - // For example we need to be able to work with invalid paths or paths containing wildcards - internal static class PathUtilities - { - // We consider '/' a directory separator on Unix like systems. - // On Windows both / and \ are equally accepted. - internal static readonly char DirectorySeparatorChar = PlatformInformation.IsUnix ? '/' : '\\'; - internal const char AltDirectorySeparatorChar = '/'; - internal const string ParentRelativeDirectory = ".."; - internal const string ThisDirectory = "."; - internal static readonly string DirectorySeparatorStr = new string(DirectorySeparatorChar, 1); - internal const char VolumeSeparatorChar = ':'; - internal static bool IsUnixLikePlatform => PlatformInformation.IsUnix; - - /// - /// True if the character is the platform directory separator character or the alternate directory separator. - /// - public static bool IsDirectorySeparator(char c) => c == DirectorySeparatorChar || c == AltDirectorySeparatorChar; - - /// - /// True if the character is any recognized directory separator character. - /// - public static bool IsAnyDirectorySeparator(char c) => c == '\\' || c == '/'; - - /// - /// Removes trailing directory separator characters - /// - /// - /// This will trim the root directory separator: - /// "C:\" maps to "C:", and "/" maps to "" - /// - public static string TrimTrailingSeparators(string s) - { - int lastSeparator = s.Length; - while (lastSeparator > 0 && IsDirectorySeparator(s[lastSeparator - 1])) - { - lastSeparator = lastSeparator - 1; - } - - if (lastSeparator != s.Length) - { - s = s.Substring(0, lastSeparator); - } - - return s; - } - - /// - /// Ensures a trailing directory separator character - /// - public static string EnsureTrailingSeparator(string s) - { - if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) - { - return s; - } - - // Use the existing slashes in the path, if they're consistent - bool hasSlash = s.IndexOf('/') >= 0; - bool hasBackslash = s.IndexOf('\\') >= 0; - if (hasSlash && !hasBackslash) - { - return s + '/'; - } - else if (!hasSlash && hasBackslash) - { - return s + '\\'; - } - else - { - // If there are no slashes or they are inconsistent, use the current platform's slash. - return s + DirectorySeparatorChar; - } - } - - public static string GetExtension(string path) - { - return FileNameUtilities.GetExtension(path); - } - - public static string ChangeExtension(string path, string extension) - { - return FileNameUtilities.ChangeExtension(path, extension); - } - - public static string RemoveExtension(string path) - { - return FileNameUtilities.ChangeExtension(path, extension: null); - } - - public static string GetFileName(string path, bool includeExtension = true) - { - return FileNameUtilities.GetFileName(path, includeExtension); - } - - /// - /// Get directory name from path. - /// - /// - /// Unlike it doesn't check for invalid path characters - /// - /// Prefix of path that represents a directory - public static string GetDirectoryName(string path) - { - return GetDirectoryName(path, IsUnixLikePlatform); - } - - // Exposed for testing purposes only. - internal static string GetDirectoryName(string path, bool isUnixLike) - { - if (path != null) - { - var rootLength = GetPathRoot(path, isUnixLike).Length; - if (path.Length > rootLength) - { - var i = path.Length; - while (i > rootLength) - { - i--; - if (IsDirectorySeparator(path[i])) - { - if (i > 0 && IsDirectorySeparator(path[i - 1])) - { - continue; - } - - break; - } - } - - return path.Substring(0, i); - } - } - - return null; - } - - internal static bool IsSameDirectoryOrChildOf(string child, string parent) - { - parent = RemoveTrailingDirectorySeparator(parent); - - while (child != null) - { - child = RemoveTrailingDirectorySeparator(child); - - if (child.Equals(parent, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - child = GetDirectoryName(child); - } - - return false; - } - - /// - /// Gets the root part of the path. - /// - public static string GetPathRoot(string path) - { - return GetPathRoot(path, IsUnixLikePlatform); - } - - private static string GetPathRoot(string path, bool isUnixLike) - { - if (path == null) - { - return null; - } - - if (isUnixLike) - { - return GetUnixRoot(path); - } - else - { - return GetWindowsRoot(path); - } - } - - private static string GetWindowsRoot(string path) - { - // Windows - int length = path.Length; - if (length >= 1 && IsDirectorySeparator(path[0])) - { - if (length < 2 || !IsDirectorySeparator(path[1])) - { - // It was of the form: - // \ - // \f - // in this case, just return \ as the root. - return path.Substring(0, 1); - } - - // First consume all directory separators. - int i = 2; - i = ConsumeDirectorySeparators(path, length, i); - - // We've got \\ so far. If we have a path of the form \\x\y\z - // then we want to return "\\x\y" as the root portion. - bool hitSeparator = false; - while (true) - { - if (i == length) - { - // We reached the end of the path. The entire path is - // considered the root. - return path; - } - - if (!IsDirectorySeparator(path[i])) - { - // We got a non separator character. Just keep consuming. - i++; - continue; - } - - if (!hitSeparator) - { - // This is the first separator group we've hit after some server path. - // Consume them and keep going. - hitSeparator = true; - i = ConsumeDirectorySeparators(path, length, i); - continue; - } - - // We hit the second separator. The root is the path up to this point. - return path.Substring(0, i); - } - } - else if (length >= 2 && path[1] == VolumeSeparatorChar) - { - // handles c: and c:\ - return length >= 3 && IsDirectorySeparator(path[2]) - ? path.Substring(0, 3) - : path.Substring(0, 2); - } - else - { - // No path root. - return ""; - } - } - - private static int ConsumeDirectorySeparators(string path, int length, int i) - { - while (i < length && IsDirectorySeparator(path[i])) - { - i++; - } - - return i; - } - - private static string GetUnixRoot(string path) - { - // either it starts with "/" and thus has "/" as the root. Or it has no root. - return path.Length > 0 && IsDirectorySeparator(path[0]) - ? path.Substring(0, 1) - : ""; - } - - /// - /// Gets the specific kind of relative or absolute path. - /// - public static PathKind GetPathKind(string path) - { - if (string.IsNullOrWhiteSpace(path)) - { - return PathKind.Empty; - } - - // "C:\" - // "\\machine" (UNC) - // "/etc" (Unix) - if (IsAbsolute(path)) - { - return PathKind.Absolute; - } - - // "." - // ".." - // ".\" - // "..\" - if (path.Length > 0 && path[0] == '.') - { - if (path.Length == 1 || IsDirectorySeparator(path[1])) - { - return PathKind.RelativeToCurrentDirectory; - } - - if (path[1] == '.') - { - if (path.Length == 2 || IsDirectorySeparator(path[2])) - { - return PathKind.RelativeToCurrentParent; - } - } - } - - if (!IsUnixLikePlatform) - { - // "\" - // "\goo" - if (path.Length >= 1 && IsDirectorySeparator(path[0])) - { - return PathKind.RelativeToCurrentRoot; - } - - // "C:goo" - - if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) - { - return PathKind.RelativeToDriveDirectory; - } - } - - // "goo.dll" - return PathKind.Relative; - } - - /// - /// True if the path is an absolute path (rooted to drive or network share) - /// - public static bool IsAbsolute(string path) - { - if (string.IsNullOrEmpty(path)) - { - return false; - } - - if (IsUnixLikePlatform) - { - return path[0] == DirectorySeparatorChar; - } - - // "C:\" - if (IsDriveRootedAbsolutePath(path)) - { - // Including invalid paths (e.g. "*:\") - return true; - } - - // "\\machine\share" - // Including invalid/incomplete UNC paths (e.g. "\\goo") - return path.Length >= 2 && - IsDirectorySeparator(path[0]) && - IsDirectorySeparator(path[1]); - } - - /// - /// Returns true if given path is absolute and starts with a drive specification ("C:\"). - /// - private static bool IsDriveRootedAbsolutePath(string path) - { - Debug.Assert(!IsUnixLikePlatform); - return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); - } - - /// - /// Combines an absolute path with a relative. - /// - /// Absolute root path. - /// Relative path. - /// - /// An absolute combined path, or null if is - /// absolute (e.g. "C:\abc", "\\machine\share\abc"), - /// relative to the current root (e.g. "\abc"), - /// or relative to a drive directory (e.g. "C:abc\def"). - /// - /// - public static string CombineAbsoluteAndRelativePaths(string root, string relativePath) - { - Debug.Assert(IsAbsolute(root)); - - return CombinePossiblyRelativeAndRelativePaths(root, relativePath); - } - - /// - /// Combine two paths, the first of which may be absolute. - /// - /// First path: absolute, relative, or null. - /// Second path: relative and non-null. - /// null, if is null; a combined path, otherwise. - /// - public static string CombinePossiblyRelativeAndRelativePaths(string rootOpt, string relativePath) - { - if (string.IsNullOrEmpty(rootOpt)) - { - return null; - } - - switch (GetPathKind(relativePath)) - { - case PathKind.Empty: - return rootOpt; - - case PathKind.Absolute: - case PathKind.RelativeToCurrentRoot: - case PathKind.RelativeToDriveDirectory: - return null; - } - - return CombinePathsUnchecked(rootOpt, relativePath); - } - - public static string CombinePathsUnchecked(string root, string relativePath) - { - Debug.Assert(!string.IsNullOrEmpty(root)); - - char c = root[root.Length - 1]; - if (!IsDirectorySeparator(c) && c != VolumeSeparatorChar) - { - return root + DirectorySeparatorStr + relativePath; - } - - return root + relativePath; - } - - private static string RemoveTrailingDirectorySeparator(string path) - { - if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) - { - return path.Substring(0, path.Length - 1); - } - else - { - return path; - } - } - - /// - /// Determines whether an assembly reference is considered an assembly file path or an assembly name. - /// used, for example, on values of /r and #r. - /// - public static bool IsFilePath(string assemblyDisplayNameOrPath) - { - Debug.Assert(assemblyDisplayNameOrPath != null); - - string extension = FileNameUtilities.GetExtension(assemblyDisplayNameOrPath); - return string.Equals(extension, ".dll", StringComparison.OrdinalIgnoreCase) - || string.Equals(extension, ".exe", StringComparison.OrdinalIgnoreCase) - || assemblyDisplayNameOrPath.IndexOf(DirectorySeparatorChar) != -1 - || assemblyDisplayNameOrPath.IndexOf(AltDirectorySeparatorChar) != -1; - } - - /// - /// Determines if "path" contains 'component' within itself. - /// i.e. asking if the path "c:\goo\bar\baz" has component "bar" would return 'true'. - /// On the other hand, if you had "c:\goo\bar1\baz" then it would not have "bar" as a - /// component. - /// - /// A path contains a component if any file name or directory name in the path - /// matches 'component'. As such, if you had something like "\\goo" then that would - /// not have "goo" as a component. That's because here "goo" is the server name portion - /// of the UNC path, and not an actual directory or file name. - /// - public static bool ContainsPathComponent(string path, string component, bool ignoreCase) - { - var comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; - if (path?.IndexOf(component, comparison) >= 0) - { - var comparer = ignoreCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; - - int count = 0; - var currentPath = path; - while (currentPath != null) - { - var currentName = GetFileName(currentPath); - if (comparer.Equals(currentName, component)) - { - return true; - } - - currentPath = GetDirectoryName(currentPath); - count++; - } - } - - return false; - } - - /// - /// Gets a path relative to a directory. - /// - public static string GetRelativePath(string directory, string fullPath) - { - string relativePath = string.Empty; - - if (IsChildPath(directory, fullPath)) - { - return GetRelativeChildPath(directory, fullPath); - } - - var directoryPathParts = GetPathParts(directory); - var fullPathParts = GetPathParts(fullPath); - - if (directoryPathParts.Length == 0 || fullPathParts.Length == 0) - { - return fullPath; - } - - int index = 0; - - // find index where full path diverges from base path - for (; index < directoryPathParts.Length; index++) - { - if (!PathsEqual(directoryPathParts[index], fullPathParts[index])) - { - break; - } - } - - // if the first part doesn't match, they don't even have the same volume - // so there can be no relative path. - if (index == 0) - { - return fullPath; - } - - // add backup notation for remaining base path levels beyond the index - var remainingParts = directoryPathParts.Length - index; - if (remainingParts > 0) - { - for (int i = 0; i < remainingParts; i++) - { - relativePath = relativePath + ParentRelativeDirectory + DirectorySeparatorStr; - } - } - - // add the rest of the full path parts - for (int i = index; i < fullPathParts.Length; i++) - { - relativePath = CombinePathsUnchecked(relativePath, fullPathParts[i]); - } - - return relativePath; - } - - /// - /// True if the child path is a child of the parent path. - /// - public static bool IsChildPath(string parentPath, string childPath) - { - return parentPath.Length > 0 - && childPath.Length > parentPath.Length - && PathsEqual(childPath, parentPath, parentPath.Length) - && (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); - } - - private static string GetRelativeChildPath(string parentPath, string childPath) - { - var relativePath = childPath.Substring(parentPath.Length); - - // trim any leading separators left over after removing leading directory - int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); - if (start > 0) - { - relativePath = relativePath.Substring(start); - } - - return relativePath; - } - - private static readonly char[] s_pathChars = new char[] { VolumeSeparatorChar, DirectorySeparatorChar, AltDirectorySeparatorChar }; - - private static string[] GetPathParts(string path) - { - var pathParts = path.Split(s_pathChars); - - // remove references to self directories ('.') - if (pathParts.Contains(ThisDirectory)) - { - pathParts = pathParts.Where(s => s != ThisDirectory).ToArray(); - } - - return pathParts; - } - - /// - /// True if the two paths are the same. - /// - public static bool PathsEqual(string path1, string path2) - { - return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); - } - - /// - /// True if the two paths are the same. (but only up to the specified length) - /// - private static bool PathsEqual(string path1, string path2, int length) - { - if (path1.Length < length || path2.Length < length) - { - return false; - } - - for (int i = 0; i < length; i++) - { - if (!PathCharEqual(path1[i], path2[i])) - { - return false; - } - } - - return true; - } - - private static bool PathCharEqual(char x, char y) - { - if (IsDirectorySeparator(x) && IsDirectorySeparator(y)) - { - return true; - } - - return IsUnixLikePlatform - ? x == y - : char.ToUpperInvariant(x) == char.ToUpperInvariant(y); - } - - private static int PathHashCode(string path) - { - int hc = 0; - - if (path != null) - { - foreach (var ch in path) - { - if (!IsDirectorySeparator(ch)) - { - hc = Hash.Combine((int)char.ToUpperInvariant(ch), hc); - } - } - } - - return hc; - } - - public static string NormalizePathPrefix(string filePath, ImmutableArray> pathMap) - { - if (pathMap.IsDefaultOrEmpty) - { - return filePath; - } - - // find the first key in the path map that matches a prefix of the normalized path. - // Note that we expect the client to use consistent capitalization; we use ordinal (case-sensitive) comparisons. - foreach (var kv in pathMap) - { - var oldPrefix = kv.Key; - if (!(oldPrefix?.Length > 0)) continue; - - // oldPrefix always ends with a path separator, so there's no need to check if it was a partial match - // e.g. for the map /goo=/bar and filename /goooo - if (filePath.StartsWith(oldPrefix, StringComparison.Ordinal)) - { - var replacementPrefix = kv.Value; - - // Replace that prefix. - var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); - - // Normalize the path separators if used uniformly in the replacement - bool hasSlash = replacementPrefix.IndexOf('/') >= 0; - bool hasBackslash = replacementPrefix.IndexOf('\\') >= 0; - return - (hasSlash && !hasBackslash) ? replacement.Replace('\\', '/') : - (hasBackslash && !hasSlash) ? replacement.Replace('/', '\\') : - replacement; - } - } - - return filePath; - } - - /// - /// Unfortunately, we cannot depend on Path.GetInvalidPathChars() or Path.GetInvalidFileNameChars() - /// From MSDN: The array returned from this method is not guaranteed to contain the complete set of characters - /// that are invalid in file and directory names. The full set of invalid characters can vary by file system. - /// https://msdn.microsoft.com/en-us/library/system.io.path.getinvalidfilenamechars.aspx - /// - /// Additionally, Path.GetInvalidPathChars() doesn't include "?" or "*" which are invalid characters, - /// and Path.GetInvalidFileNameChars() includes ":" and "\" which are valid characters. - /// - /// The more accurate way is to let the framework parse the path and throw on any errors. - /// - public static bool IsValidFilePath(string fullPath) - { - try - { - if (string.IsNullOrEmpty(fullPath)) - { - return false; - } - - // Uncomment when this is fixed: https://github.com/dotnet/roslyn/issues/19592 - // Debug.Assert(IsAbsolute(fullPath)); - - var fileInfo = new FileInfo(fullPath); - return !string.IsNullOrEmpty(fileInfo.Name); - } - catch (Exception ex) when ( - ex is ArgumentException || // The file name is empty, contains only white spaces, or contains invalid characters. - ex is PathTooLongException || // The specified path, file name, or both exceed the system-defined maximum length. - ex is NotSupportedException) // fileName contains a colon (:) in the middle of the string. - { - return false; - } - } - - public static readonly IEqualityComparer Comparer = new PathComparer(); - - private class PathComparer : IEqualityComparer - { - public bool Equals(string x, string y) - { - if (x == null && y == null) - { - return true; - } - - if (x == null || y == null) - { - return false; - } - - return PathsEqual(x, y); - } - - public int GetHashCode(string s) - { - return PathHashCode(s); - } - } - } -} diff --git a/src/Utilities/PlatformInformation.cs b/src/Utilities/PlatformInformation.cs deleted file mode 100644 index 0556c147a9fb..000000000000 --- a/src/Utilities/PlatformInformation.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.IO; - -namespace Roslyn.Utilities -{ - /// - /// This class provides simple properties for determining whether the current platform is Windows or Unix-based. - /// We intentionally do not use System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(...) because - /// it incorrectly reports 'true' for 'Windows' in desktop builds running on Unix-based platforms via Mono. - /// - internal static class PlatformInformation - { - public static bool IsWindows => Path.DirectorySeparatorChar == '\\'; - public static bool IsUnix => Path.DirectorySeparatorChar == '/'; - public static bool IsRunningOnMono - { - get - { - try - { - return !(Type.GetType("Mono.Runtime") is null); - } - catch - { - // Arbitrarily assume we're not running on Mono. - return false; - } - } - } - } -} diff --git a/src/Utilities/ProcessRunner.cs b/src/Utilities/ProcessRunner.cs index 2212cd370595..5e485d968692 100644 --- a/src/Utilities/ProcessRunner.cs +++ b/src/Utilities/ProcessRunner.cs @@ -8,7 +8,7 @@ using System.Threading; using System.Threading.Tasks; -namespace RunTests +namespace Microsoft.CodeAnalysis.Tools.Utilities { public readonly struct ProcessResult { diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 6f0e6232fc51..10202ad4b146 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -8,6 +8,7 @@ using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Tests.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Tools.Tests @@ -111,11 +112,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task NoFilesFormattedWhenNotInList() { - var filesToFormat = new[] { Path.Combine(UnformattedProjectPath, "does_not_exist.cs") }; + var files = new[] { Path.Combine(UnformattedProjectPath, "does_not_exist.cs") }; await TestFormatWorkspaceAsync( - UnformattedProjectFilePath, - filesToFormat, + UnformattedProjectFilePath, + files, expectedExitCode: 0, expectedFilesFormatted: 0, expectedFileCount: 4); @@ -124,13 +125,13 @@ await TestFormatWorkspaceAsync( [Fact] public async Task OnlyLogFormattedFiles() { - var filesToFormat = new[] { UnformattedProgramFilePath }; + var files = new[] { UnformattedProgramFilePath }; var log = await TestFormatWorkspaceAsync( - UnformattedSolutionFilePath, - filesToFormat, - expectedExitCode: 0, - expectedFilesFormatted: 1, + UnformattedSolutionFilePath, + files, + expectedExitCode: 0, + expectedFilesFormatted: 1, expectedFileCount: 4); var pattern = string.Format(Resources.Formatted_code_file_0, @"(.*)"); @@ -140,14 +141,14 @@ public async Task OnlyLogFormattedFiles() Assert.Equal("Program.cs", match.Groups[1].Value); } - public async Task TestFormatWorkspaceAsync(string solutionOrProjectPath, IEnumerable filesToFormat, int expectedExitCode, int expectedFilesFormatted, int expectedFileCount) + public async Task TestFormatWorkspaceAsync(string solutionOrProjectPath, IEnumerable files, int expectedExitCode, int expectedFilesFormatted, int expectedFileCount) { var workspacePath = Path.GetFullPath(solutionOrProjectPath); var isSolution = workspacePath.EndsWith(".sln"); - var files = filesToFormat.Select(Path.GetFullPath).ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); + var filesToFormat = files.Select(Path.GetFullPath).ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); var logger = new TestLogger(); - var formatResult = await CodeFormatter.FormatWorkspaceAsync(logger, workspacePath, isSolution, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat: files, cancellationToken: CancellationToken.None); + var formatResult = await CodeFormatter.FormatWorkspaceAsync(workspacePath, isSolution, logAllWorkspaceWarnings: false, saveFormattedFiles: false, filesToFormat, logger, CancellationToken.None); Assert.Equal(expectedExitCode, formatResult.ExitCode); Assert.Equal(expectedFilesFormatted, formatResult.FilesFormatted); diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index bd3e24979a40..13af278f0dcf 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -48,10 +48,10 @@ public void ExitCodeIsSameWithoutCheck() public void FilesFormattedDirectorySeparatorInsensitive() { var filePath = $"other_items{Path.DirectorySeparatorChar}OtherClass.cs"; - var files = Program.GetFileList(filePath); - + var files = Program.GetFilesToFormat(filePath); + var filePathAlt = $"other_items{Path.AltDirectorySeparatorChar}OtherClass.cs"; - var filesAlt = Program.GetFileList(filePathAlt); + var filesAlt = Program.GetFilesToFormat(filePathAlt); Assert.True(files.IsSubsetOf(filesAlt)); } diff --git a/tests/Utilities/MSBuildFixture.cs b/tests/Utilities/MSBuildFixture.cs index 017473aeb923..c68aaac298ed 100644 --- a/tests/Utilities/MSBuildFixture.cs +++ b/tests/Utilities/MSBuildFixture.cs @@ -5,7 +5,7 @@ using System.Threading; using Microsoft.CodeAnalysis.Tools.MSBuild; -namespace Microsoft.CodeAnalysis.Tools.Tests +namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities { /// /// This test fixture ensures that MSBuild is loaded. diff --git a/tests/Utilities/SolutionPathFixture.cs b/tests/Utilities/SolutionPathFixture.cs index 3b19262468bc..a8e4b40a6109 100644 --- a/tests/Utilities/SolutionPathFixture.cs +++ b/tests/Utilities/SolutionPathFixture.cs @@ -4,7 +4,7 @@ using System.IO; using System.Threading; -namespace Microsoft.CodeAnalysis.Tools.Tests +namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities { /// /// This test fixture sets the to the dotnet-format solution's path. diff --git a/tests/Utilities/TestLogger.cs b/tests/Utilities/TestLogger.cs index 1cd417b2668d..199469259124 100644 --- a/tests/Utilities/TestLogger.cs +++ b/tests/Utilities/TestLogger.cs @@ -5,8 +5,11 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions.Internal; -namespace Microsoft.CodeAnalysis.Tools.Tests +namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities { + /// + /// Logger that records all logged messages. + /// internal class TestLogger : ILogger { private readonly StringBuilder _builder = new StringBuilder(); diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 89eeb77cb7c3..4ade99c7e43f 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -2,6 +2,7 @@ netcoreapp2.1 + 7.3 false Microsoft.CodeAnalysis.Tools.Tests From e70cb9c8a6ed4e94627abfd74343187128238afc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 10 Apr 2019 12:46:00 +0000 Subject: [PATCH 0444/2702] Update dependencies from https://github.com/dotnet/arcade build 20190409.1 (#91) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19209.1 --- eng/Version.Details.xml | 4 ++-- eng/common/PublishToSymbolServers.proj | 8 ++++++++ eng/common/templates/phases/publish-build-assets.yml | 2 ++ global.json | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f063e405aaeb..aa7bf25578ae 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - b1f9e12fe3ee71c48ea60b15968745850ac0a4a7 + 9d7e665ecf2606094677524ecd5af0fc39c7bb49 diff --git a/eng/common/PublishToSymbolServers.proj b/eng/common/PublishToSymbolServers.proj index 36c08f0ea492..5d55e312b012 100644 --- a/eng/common/PublishToSymbolServers.proj +++ b/eng/common/PublishToSymbolServers.proj @@ -24,6 +24,14 @@ + + + + diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml index 211967debab5..a0a8074282aa 100644 --- a/eng/common/templates/phases/publish-build-assets.yml +++ b/eng/common/templates/phases/publish-build-assets.yml @@ -5,6 +5,7 @@ parameters: condition: succeeded() continueOnError: false runAsPublic: false + publishUsingPipelines: false phases: - phase: Asset_Registry_Publish displayName: Publish to Build Asset Registry @@ -36,6 +37,7 @@ phases: /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com + /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:Configuration=$(_BuildConfig) condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} diff --git a/global.json b/global.json index e12b65d6accb..94be7761f2b8 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19207.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19209.1" } } From 9d6673b6b3d519279847b295c645b72a0c175c40 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 11 Apr 2019 12:46:11 +0000 Subject: [PATCH 0445/2702] Update dependencies from https://github.com/dotnet/arcade build 20190409.2 (#92) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19209.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index aa7bf25578ae..ecbea738e7a2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 9d7e665ecf2606094677524ecd5af0fc39c7bb49 + 63b76f3f952f821d0a7996427a9f3534f1c25ab7 diff --git a/global.json b/global.json index 94be7761f2b8..61776d4c50b0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19209.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19209.2" } } From 564a4a56d92609bab0385d3346ea5a08bb3ebff4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 11 Apr 2019 13:36:57 +0000 Subject: [PATCH 0446/2702] Update dependencies from https://github.com/dotnet/arcade build 20190410.7 (#93) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19210.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ecbea738e7a2..5b6886348af6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 63b76f3f952f821d0a7996427a9f3534f1c25ab7 + 4f645e4a5385eb96cad3f72f5ded239761c7d075 diff --git a/global.json b/global.json index 61776d4c50b0..6ed605a7f1c1 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19209.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19210.7" } } From 87afcc8b2d4b5f27f8ce5c2fffc33d9e9f54bc29 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 12 Apr 2019 13:01:56 +0000 Subject: [PATCH 0447/2702] Update dependencies from https://github.com/dotnet/arcade build 20190411.2 (#94) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19211.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5b6886348af6..80f318890927 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 4f645e4a5385eb96cad3f72f5ded239761c7d075 + e7b5230799a6db9121d90cf548d5a2313bd682dd diff --git a/global.json b/global.json index 6ed605a7f1c1..46909e0d7789 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19210.7" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19211.2" } } From 377e602ac661c455bbd8600b0ffdca03b559b12d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 13 Apr 2019 13:09:58 +0000 Subject: [PATCH 0448/2702] Update dependencies from https://github.com/dotnet/arcade build 20190412.2 (#95) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19212.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 80f318890927..60cd4c90cf37 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - e7b5230799a6db9121d90cf548d5a2313bd682dd + 9d0fd805448082c8d55e2434607b481bca70a146 diff --git a/global.json b/global.json index 46909e0d7789..2c8043a8d624 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19211.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19212.2" } } From eaf5b5f5ae9a6ad7f18b96071a80750b613ed1af Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 14 Apr 2019 13:33:22 +0000 Subject: [PATCH 0449/2702] Update dependencies from https://github.com/dotnet/arcade build 20190413.2 (#96) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19213.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 60cd4c90cf37..1d1280f6337d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 9d0fd805448082c8d55e2434607b481bca70a146 + 10655eec2ab92accc1487d077979935127f16b4e diff --git a/global.json b/global.json index 2c8043a8d624..a805070a5cea 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19212.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19213.2" } } From 423a9cbc798697b0757a8cadf9099b45accacdc6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 15 Apr 2019 13:28:48 +0000 Subject: [PATCH 0450/2702] Update dependencies from https://github.com/dotnet/arcade build 20190414.2 (#97) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19214.2 --- eng/Version.Details.xml | 4 ++-- eng/common/internal/Tools.csproj | 8 ++++++-- global.json | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1d1280f6337d..ba6e52fa3f2f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 10655eec2ab92accc1487d077979935127f16b4e + bcf1186cb0db792906fd319ae49bdbc41f44f8ec diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index 1a81ff906f6e..1a39a7ef3f67 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -12,8 +12,12 @@ - - https://devdiv.pkgs.visualstudio.com/_packaging/8f470c7e-ac49-4afe-a6ee-cf784e438b93/nuget/v3/index.json; + + + https://devdiv.pkgs.visualstudio.com/_packaging/dotnet-core-internal-tooling/nuget/v3/index.json; + + + $(RestoreSources); https://devdiv.pkgs.visualstudio.com/_packaging/VS/nuget/v3/index.json; diff --git a/global.json b/global.json index a805070a5cea..d49571b7f111 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19213.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19214.2" } } From 01e101d1017da394f00028ab5ac526ef3f77857c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 16 Apr 2019 13:20:36 +0000 Subject: [PATCH 0451/2702] Update dependencies from https://github.com/dotnet/arcade build 20190415.12 (#98) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19215.12 --- eng/Version.Details.xml | 4 +- eng/common/CheckSymbols.ps1 | 134 ++++++++++++++++++++++++++++++++++++ global.json | 2 +- 3 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 eng/common/CheckSymbols.ps1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ba6e52fa3f2f..a0cf73a0fc8f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - bcf1186cb0db792906fd319ae49bdbc41f44f8ec + 517bf671ea342965d007aa48f5bfd4926e58d582 diff --git a/eng/common/CheckSymbols.ps1 b/eng/common/CheckSymbols.ps1 new file mode 100644 index 000000000000..074b423245c8 --- /dev/null +++ b/eng/common/CheckSymbols.ps1 @@ -0,0 +1,134 @@ +param( + [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored + [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation + [Parameter(Mandatory=$true)][string] $SymbolToolPath # Full path to directory where dotnet symbol-tool was installed +) + +Add-Type -AssemblyName System.IO.Compression.FileSystem + +function FirstMatchingSymbolDescriptionOrDefault { + param( + [string] $FullPath, # Full path to the module that has to be checked + [string] $TargetServerParam # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + ) + + $FileName = [System.IO.Path]::GetFileName($FullPath) + $Extension = [System.IO.Path]::GetExtension($FullPath) + + # Those below are potential symbol files that the `dotnet symbol` might + # return. Which one will be returned depend on the type of file we are + # checking and which type of file was uploaded. + + # The file itself is returned + $SymbolPath = $SymbolsPath + "\" + $FileName + + # PDB file for the module + $PdbPath = $SymbolPath.Replace($Extension, ".pdb") + + # PDB file for R2R module (created by crossgen) + $NGenPdb = $SymbolPath.Replace($Extension, ".ni.pdb") + + # DBG file for a .so library + $SODbg = $SymbolPath.Replace($Extension, ".so.dbg") + + # DWARF file for a .dylib + $DylibDwarf = $SymbolPath.Replace($Extension, ".dylib.dwarf") + + .\dotnet-symbol.exe --symbols --modules $TargetServerParam $FullPath -o $SymbolsPath -d | Out-Null + + if (Test-Path $PdbPath) { + return "PDB" + } + elseif (Test-Path $NGenPdb) { + return "NGen PDB" + } + elseif (Test-Path $SODbg) { + return "DBG for SO" + } + elseif (Test-Path $DylibDwarf) { + return "Dwarf for Dylib" + } + elseif (Test-Path $SymbolPath) { + return "Module" + } + else { + return $null + } +} + +function CountMissingSymbols { + param( + [string] $PackagePath # Path to a NuGet package + ) + + # Ensure input file exist + if (!(Test-Path $PackagePath)) { + throw "Input file does not exist: $PackagePath" + } + + # Extensions for which we'll look for symbols + $RelevantExtensions = @(".dll", ".exe", ".so", ".dylib") + + # How many files are missing symbol information + $MissingSymbols = 0 + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $ExtractPath = $ExtractPath + $PackageId; + $SymbolsPath = $ExtractPath + $PackageId + ".Symbols"; + + [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) + + # Makes easier to reference `symbol tool` + Push-Location $SymbolToolPath + + Get-ChildItem -Recurse $ExtractPath | + Where-Object {$RelevantExtensions -contains $_.Extension} | + ForEach-Object { + Write-Host -NoNewLine "`t Checking file" $_.FullName "... " + + $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--microsoft-symbol-server" + $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--internal-server" + + if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { + Write-Host "Symbols found on MSDL (" $SymbolsOnMSDL ") and SymWeb (" $SymbolsOnSymWeb ")" + } + else { + $MissingSymbols++ + + if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) { + Write-Host "No symbols found on MSDL or SymWeb!" + } + else { + if ($SymbolsOnMSDL -eq $null) { + Write-Host "No symbols found on MSDL!" + } + else { + Write-Host "No symbols found on SymWeb!" + } + } + } + } + + Pop-Location + + return $MissingSymbols +} + +function CheckSymbolsAvailable { + if (Test-Path $ExtractPath) { + Remove-Item -recurse $ExtractPath + } + + Get-ChildItem "$InputPath\*.nupkg" | + ForEach-Object { + $FileName = $_.Name + Write-Host "Validating $FileName " + $Status = CountMissingSymbols "$InputPath\$FileName" + + if ($Status -ne 0) { + Write-Error "Missing symbols for $Status modules in the package $FileName" + } + } +} + +CheckSymbolsAvailable diff --git a/global.json b/global.json index d49571b7f111..3aa3c18dcf6f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19214.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19215.12" } } From dc9c16d45b0d05412d65fa2cbf50c05bae33be3b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 17 Apr 2019 13:25:45 +0000 Subject: [PATCH 0452/2702] Update dependencies from https://github.com/dotnet/arcade build 20190417.1 (#100) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19217.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a0cf73a0fc8f..f7bc5720deef 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 517bf671ea342965d007aa48f5bfd4926e58d582 + 4e21d52dabbb9f5705a90f097acb1465a0354c0d diff --git a/global.json b/global.json index 3aa3c18dcf6f..704b9d4f4d5d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19215.12" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19217.1" } } From 9e3929d82a9d7616e86300ec5ac549bb6712332f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 18 Apr 2019 13:15:54 +0000 Subject: [PATCH 0453/2702] Update dependencies from https://github.com/dotnet/arcade build 20190418.1 (#101) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19218.1 --- eng/Version.Details.xml | 4 ++-- eng/common/CheckSymbols.ps1 | 44 ++++++++++++++++++++++++++++--------- global.json | 2 +- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f7bc5720deef..accc00e55621 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 4e21d52dabbb9f5705a90f097acb1465a0354c0d + 46718d98c0fd03690a6a8c83da692a4a85a17902 diff --git a/eng/common/CheckSymbols.ps1 b/eng/common/CheckSymbols.ps1 index 074b423245c8..b8d84607b89b 100644 --- a/eng/common/CheckSymbols.ps1 +++ b/eng/common/CheckSymbols.ps1 @@ -9,7 +9,8 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem function FirstMatchingSymbolDescriptionOrDefault { param( [string] $FullPath, # Full path to the module that has to be checked - [string] $TargetServerParam # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + [string] $SymbolsPath ) $FileName = [System.IO.Path]::GetFileName($FullPath) @@ -33,9 +34,9 @@ function FirstMatchingSymbolDescriptionOrDefault { # DWARF file for a .dylib $DylibDwarf = $SymbolPath.Replace($Extension, ".dylib.dwarf") - - .\dotnet-symbol.exe --symbols --modules $TargetServerParam $FullPath -o $SymbolsPath -d | Out-Null - + + .\dotnet-symbol.exe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null + if (Test-Path $PdbPath) { return "PDB" } @@ -73,8 +74,9 @@ function CountMissingSymbols { $MissingSymbols = 0 $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) - $ExtractPath = $ExtractPath + $PackageId; - $SymbolsPath = $ExtractPath + $PackageId + ".Symbols"; + $PackageGuid = New-Guid + $ExtractPath = Join-Path -Path $ExtractPath -ChildPath $PackageGuid + $SymbolsPath = Join-Path -Path $ExtractPath -ChildPath "Symbols" [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) @@ -84,10 +86,15 @@ function CountMissingSymbols { Get-ChildItem -Recurse $ExtractPath | Where-Object {$RelevantExtensions -contains $_.Extension} | ForEach-Object { - Write-Host -NoNewLine "`t Checking file" $_.FullName "... " + if ($_.FullName -Match "\\ref\\") { + Write-Host "`t Ignoring reference assembly file" $_.FullName + return + } - $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--microsoft-symbol-server" - $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--internal-server" + $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--microsoft-symbol-server" $SymbolsPath + $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--internal-server" $SymbolsPath + + Write-Host -NoNewLine "`t Checking file" $_.FullName "... " if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { Write-Host "Symbols found on MSDL (" $SymbolsOnMSDL ") and SymWeb (" $SymbolsOnSymWeb ")" @@ -116,18 +123,35 @@ function CountMissingSymbols { function CheckSymbolsAvailable { if (Test-Path $ExtractPath) { - Remove-Item -recurse $ExtractPath + Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue } Get-ChildItem "$InputPath\*.nupkg" | ForEach-Object { $FileName = $_.Name + + # These packages from Arcade-Services include some native libraries that + # our current symbol uploader can't handle. Below is a workaround until + # we get issue: https://github.com/dotnet/arcade/issues/2457 sorted. + if ($FileName -Match "Microsoft\.DotNet\.Darc\.") { + Write-Host "Ignoring Arcade-services file: $FileName" + Write-Host + return + } + elseif ($FileName -Match "Microsoft\.DotNet\.Maestro\.Tasks\.") { + Write-Host "Ignoring Arcade-services file: $FileName" + Write-Host + return + } + Write-Host "Validating $FileName " $Status = CountMissingSymbols "$InputPath\$FileName" if ($Status -ne 0) { Write-Error "Missing symbols for $Status modules in the package $FileName" } + + Write-Host } } diff --git a/global.json b/global.json index 704b9d4f4d5d..958797d46ea1 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19217.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19218.1" } } From 85ea37e76c135b95b173e63de3d4aa95d6a7a29f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 19 Apr 2019 13:08:50 +0000 Subject: [PATCH 0454/2702] Update dependencies from https://github.com/dotnet/arcade build 20190418.4 (#103) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19218.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index accc00e55621..728c0cfa8a85 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 46718d98c0fd03690a6a8c83da692a4a85a17902 + 1d4c87ff798d7de521128e6c3d890055c2401e80 diff --git a/global.json b/global.json index 958797d46ea1..a3ca763e09e7 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19218.1" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19218.4" } } From 2cfa2196a44f59686ca4be2f5b84f1329fcc3062 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Fri, 19 Apr 2019 10:17:36 -0700 Subject: [PATCH 0455/2702] automatically select newest roslyn version --- eng/Version.Details.xml | 4 ++++ eng/Versions.props | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 728c0cfa8a85..5f8423ac91f8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,6 +1,10 @@ + + https://github.com/dotnet/roslyn + 79b8271f65609b23e0c0ee1babed6862b7c5ed56 + diff --git a/eng/Versions.props b/eng/Versions.props index 785b23924f37..9217d6ed4e1e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -4,8 +4,14 @@ 3.0.5 prerelease + + + + 3.1.0-beta3-19217-05 + + 0.1.0-alpha-63729-01 @@ -14,7 +20,7 @@ 2.1.1 2.1.1 1.1.20180503.2 - 3.0.0-beta3-final + $(MicrosoftNETCoreCompilersPackageVersion) From 93e5de46f40db855f13f22cb04bb68d85fb52078 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Fri, 19 Apr 2019 10:18:39 -0700 Subject: [PATCH 0456/2702] adding common scripts --- Restore.cmd | 3 +++ Test.cmd | 3 +++ restore.sh | 16 ++++++++++++++++ test.sh | 16 ++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 Restore.cmd create mode 100644 Test.cmd create mode 100644 restore.sh create mode 100644 test.sh diff --git a/Restore.cmd b/Restore.cmd new file mode 100644 index 000000000000..51cb3c4dc8f5 --- /dev/null +++ b/Restore.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore %*" +exit /b %ErrorLevel% diff --git a/Test.cmd b/Test.cmd new file mode 100644 index 000000000000..db9e8e061d32 --- /dev/null +++ b/Test.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -test %*" +exit /b %ErrorLevel% diff --git a/restore.sh b/restore.sh new file mode 100644 index 000000000000..02531e1d7101 --- /dev/null +++ b/restore.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done + +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +"$scriptroot/eng/common/build.sh" --restore $@ diff --git a/test.sh b/test.sh new file mode 100644 index 000000000000..637dec3600c0 --- /dev/null +++ b/test.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done + +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +"$scriptroot/eng/common/build.sh" --test $@ From f8fdb28982ec1b81075522ea062ce727dc078cc0 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Fri, 19 Apr 2019 10:31:44 -0700 Subject: [PATCH 0457/2702] this should speed up CI --- azure-pipelines.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index df66b2f09944..10db8f60fb3f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,8 +10,7 @@ jobs: - job: Windows pool: - name: NetCorePublic-Int-Pool - queue: buildpool.windows.10.amd64.vs2017.open + vmImage: 'vs2017-win2016' variables: _os: Windows strategy: @@ -42,8 +41,7 @@ jobs: - job: Linux pool: - name: NetCorePublic-Int-Pool - queue: buildpool.ubuntu.1604.amd64.open + vmImage: 'ubuntu-16.04' variables: _os: Linux strategy: From 3684ac0b00c3c082a5c6e3ca753b1f0c6ab17f1d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 19 Apr 2019 22:49:31 +0000 Subject: [PATCH 0458/2702] Update dependencies from https://github.com/dotnet/roslyn build 20190419.4 (#108) - Microsoft.NETCore.Compilers - 3.1.0-beta3-19219-04 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5f8423ac91f8..777a289290c2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 79b8271f65609b23e0c0ee1babed6862b7c5ed56 + 9243898b6a5f18ae1b273282070e45799ac18d0b diff --git a/eng/Versions.props b/eng/Versions.props index 9217d6ed4e1e..c47d808d267f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -4,12 +4,10 @@ 3.0.5 prerelease - - 3.1.0-beta3-19217-05 + 3.1.0-beta3-19219-04 - From 51453f92242327e2b6984ca36ce64354cf096a2a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 21 Apr 2019 12:28:41 +0000 Subject: [PATCH 0459/2702] Update dependencies from https://github.com/dotnet/arcade build 20190418.7 (#110) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19218.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 777a289290c2..58e8d3a628e3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 1d4c87ff798d7de521128e6c3d890055c2401e80 + 5e7ce5b394f3477bb0a485a4b761b7742e95be37 diff --git a/global.json b/global.json index a3ca763e09e7..74816dc022d9 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.1.504" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19218.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19218.7" } } From 7a68ac8bc0b2a8dc0fba46075ff488eac3f73e97 Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Sun, 21 Apr 2019 12:43:27 +0000 Subject: [PATCH 0460/2702] Update dependencies from https://github.com/dotnet/roslyn build 20190421.1 - Microsoft.NETCore.Compilers - 3.1.0-beta3-19221-01 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 58e8d3a628e3..77ac31519d0e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 9243898b6a5f18ae1b273282070e45799ac18d0b + 9e5f5d6f97b97f4ac0e11c850fe6e8f00bc75b14 diff --git a/eng/Versions.props b/eng/Versions.props index c47d808d267f..ea6f1e2ff3bc 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -6,7 +6,7 @@ - 3.1.0-beta3-19219-04 + 3.1.0-beta3-19221-01 - 3.1.0-beta3-19221-01 + 3.1.0-beta3-19222-02 - 3.1.0-beta3-19222-02 + 3.1.0-beta3-19223-07 - 3.1.0-beta3-19223-07 + 3.2.0-beta1-19224-01 - 3.2.0-beta1-19224-01 + 3.2.0-beta1-19225-01 - 3.2.0-beta1-19225-01 + 3.2.0-beta1-19227-04 - 3.2.0-beta1-19227-04 + 3.2.0-beta1-19229-02 - 3.2.0-beta1-19229-02 + 3.2.0-beta1-19230-07 - 3.2.0-beta1-19230-07 + 3.2.0-beta1-19251-08 + diff --git a/src/Resources.Designer.cs b/src/Resources.Designer.cs deleted file mode 100644 index 4d4cb33715df..000000000000 --- a/src/Resources.Designer.cs +++ /dev/null @@ -1,297 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.CodeAnalysis.Tools { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.Tools.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to A comma separated list of relative file paths to format. All files are formatted if empty.. - /// - internal static string A_comma_separated_list_of_relative_file_paths_to_format_All_files_are_formatted_if_empty { - get { - return ResourceManager.GetString("A_comma_separated_list_of_relative_file_paths_to_format_All_files_are_formatted_i" + - "f_empty", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option.. - /// - internal static string Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option { - get { - return ResourceManager.GetString("Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_wit" + - "h_the_workspace_option", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Complete in {0}ms.. - /// - internal static string Complete_in_0_ms { - get { - return ResourceManager.GetString("Complete_in_0_ms", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option.. - /// - internal static string Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option { - get { - return ResourceManager.GetString("Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_" + - "the_workspace_option", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not format '{0}'. Format currently supports only C# and Visual Basic projects.. - /// - internal static string Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects { - get { - return ResourceManager.GetString("Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_project" + - "s", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Determining formattable files.. - /// - internal static string Determining_formattable_files { - get { - return ResourceManager.GetString("Determining_formattable_files", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Failed to save formatting changes.. - /// - internal static string Failed_to_save_formatting_changes { - get { - return ResourceManager.GetString("Failed_to_save_formatting_changes", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Format complete in {0}ms.. - /// - internal static string Format_complete_in_0_ms { - get { - return ResourceManager.GetString("Format_complete_in_0_ms", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Format files, but do not save changes to disk.. - /// - internal static string Format_files_but_do_not_save_changes_to_disk { - get { - return ResourceManager.GetString("Format_files_but_do_not_save_changes_to_disk", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Formatted {0} of {1} files.. - /// - internal static string Formatted_0_of_1_files { - get { - return ResourceManager.GetString("Formatted_0_of_1_files", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Formatted code file '{0}'.. - /// - internal static string Formatted_code_file_0 { - get { - return ResourceManager.GetString("Formatted_code_file_0", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Formatting code file '{0}'.. - /// - internal static string Formatting_code_file_0 { - get { - return ResourceManager.GetString("Formatting_code_file_0", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Formatting code files in workspace '{0}'.. - /// - internal static string Formatting_code_files_in_workspace_0 { - get { - return ResourceManager.GetString("Formatting_code_files_in_workspace_0", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Loading workspace.. - /// - internal static string Loading_workspace { - get { - return ResourceManager.GetString("Loading_workspace", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option.. - /// - internal static string Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option { - get { - return ResourceManager.GetString("Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace" + - "_option", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option.. - /// - internal static string Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option { - get { - return ResourceManager.GetString("Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspac" + - "e_option", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Running formatters.. - /// - internal static string Running_formatters { - get { - return ResourceManager.GetString("Running_formatters", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. - /// - internal static string Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic { - get { - return ResourceManager.GetString("Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diag" + - "nostic", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Skipping referenced project '{0}'.. - /// - internal static string Skipping_referenced_project_0 { - get { - return ResourceManager.GetString("Skipping_referenced_project_0", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Terminates with a non-zero exit code if any files were formatted.. - /// - internal static string Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted { - get { - return ResourceManager.GetString("Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The file '{0}' does not appear to be a valid project or solution file.. - /// - internal static string The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file { - get { - return ResourceManager.GetString("The_file_0_does_not_appear_to_be_a_valid_project_or_solution_file", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The project file '{0}' does not exist.. - /// - internal static string The_project_file_0_does_not_exist { - get { - return ResourceManager.GetString("The_project_file_0_does_not_exist", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The solution file '{0}' does not exist.. - /// - internal static string The_solution_file_0_does_not_exist { - get { - return ResourceManager.GetString("The_solution_file_0_does_not_exist", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The solution or project file to operate on. If a file is not specified, the command will search the current directory for one.. - /// - internal static string The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one { - get { - return ResourceManager.GetString("The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command" + - "_will_search_the_current_directory_for_one", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings.. - /// - internal static string Warnings_were_encountered_while_loading_the_workspace_Set_the_verbosity_option_to_the_diagnostic_level_to_log_warnings { - get { - return ResourceManager.GetString("Warnings_were_encountered_while_loading_the_workspace_Set_the_verbosity_option_to" + - "_the_diagnostic_level_to_log_warnings", resourceCulture); - } - } - } -} diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index f017ece63bb4..4c76e869aeea 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -3,19 +3,23 @@ netcoreapp2.1 Exe - 7.3 + 7.3 + true Microsoft.CodeAnalysis.Tools + true + true + Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings. - https://go.microsoft.com/fwlink/?LinkID=288859 - true true true - + https://go.microsoft.com/fwlink/?LinkID=288859 + + win-x64;win-x86;osx-x64 - - true @@ -44,18 +48,7 @@ - - True - True - Resources.resx - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - + From 4be76d4f4858b6309058dec0ac7429e6c483719a Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 3 May 2019 19:18:28 -0700 Subject: [PATCH 0482/2702] Make test.sh and restore.sh executable --- restore.sh | 0 test.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 restore.sh mode change 100644 => 100755 test.sh diff --git a/restore.sh b/restore.sh old mode 100644 new mode 100755 diff --git a/test.sh b/test.sh old mode 100644 new mode 100755 From 28f17774a446bab119d82d48d0da98e157e4c40f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 4 May 2019 13:01:48 +0000 Subject: [PATCH 0483/2702] Update dependencies from https://github.com/dotnet/arcade build 20190503.8 (#134) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19253.8 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 3 +-- eng/common/build.ps1 | 2 +- eng/common/build.sh | 2 +- global.json | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7be49c6c0f17..76f05833749a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - ed63a7faf2d119829dd971be91bb46b6ebaa1dd2 + 4cacf7aa7b2cd8bdd042e721e6ad73d809dd5678 diff --git a/eng/Versions.props b/eng/Versions.props index dacf68c4b28e..d970fbb76859 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -3,9 +3,8 @@ 3 1 - - + diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index ed9f754ea832..d7e3799ebd99 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -122,7 +122,7 @@ try { . $configureToolsetScript } - if ($restore) { + if (($restore) -and ($null -eq $env:DisableNativeToolsetInstalls)) { InitializeNativeTools } diff --git a/eng/common/build.sh b/eng/common/build.sh index e14210632aaf..d038959ab46c 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -218,7 +218,7 @@ if [[ -n "${useInstalledDotNetCli:-}" ]]; then use_installed_dotnet_cli="$useInstalledDotNetCli" fi -if [[ "$restore" == true ]]; then +if [[ "$restore" == true && -z ${DisableNativeToolsetInstalls:-} ]]; then InitializeNativeTools fi diff --git a/global.json b/global.json index b850cfeb46a5..492dd9e8f120 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "2.2.203" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19252.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19253.8" } } From 233bfa46f0759fc1bca9957c01593c6d6b7d71e9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 4 May 2019 13:34:36 +0000 Subject: [PATCH 0484/2702] Update dependencies from https://github.com/dotnet/roslyn build 20190503.8 (#135) - Microsoft.NETCore.Compilers - 3.2.0-beta1-19253-08 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 76f05833749a..024eed7d7626 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 841ca683a72cac8a468be0de7163e0f1ba8a2d4c + 6a87a933050706e75aadd74ed689d98a40fdda8f diff --git a/eng/Versions.props b/eng/Versions.props index d970fbb76859..8c70f3076765 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.2.0-beta1-19251-08 + 3.2.0-beta1-19253-08 - 3.2.0-beta1-19253-08 + 3.2.0-beta1-19255-01 - 3.2.0-beta1-19255-01 + 3.2.0-beta1-19256-06 - 3.2.0-beta1-19256-06 + 3.2.0-beta1-19258-02 - 3.2.0-beta1-19258-02 + 3.2.0-beta1-19259-01 - 3.2.0-beta1-19259-01 + 3.2.0-beta1-19260-01 - 3.2.0-beta1-19260-01 + 3.2.0-beta2-19265-01 - 3.2.0-beta2-19265-01 + 3.2.0-beta2-19266-02 - 3.2.0-beta2-19266-02 + 3.2.0-beta2-19267-03 - 3.2.0-beta2-19267-03 + 3.2.0-beta2-19271-03 - 3.2.0-beta2-19271-03 + 3.2.0-beta2-19271-05 - 3.2.0-beta2-19271-05 + 3.2.0-beta2-19272-04 - 3.2.0-beta2-19272-04 + 3.2.0-beta2-19274-03 - 3.2.0-beta2-19274-03 + 3.2.0-beta2-19275-04 - 3.2.0-beta2-19275-04 + 3.2.0-beta3-19275-09 - 3.2.0-beta3-19275-09 + 3.2.0-beta2-19278-03 - 3.2.0-beta2-19278-03 + 3.2.0-beta3-19279-03 - 3.2.0-beta3-19279-03 + 3.2.0-beta3-19280-02 - 3.2.0-beta3-19280-02 + 3.2.0-beta3-19281-01 git commit --> git push +Write-Host "git add ." +git add . +if ($LASTEXITCODE -ne 0) { + Write-Error "Git add failed with exit code $LASTEXITCODE." +} +Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`"" +git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName" +if ($LASTEXITCODE -ne 0) { + Write-Error "Git commit failed with exit code $LASTEXITCODE." +} +Write-Host "git push" +git push +if ($LASTEXITCODE -ne 0) { + Write-Error "Git push failed with exit code $LASTEXITCODE." +} + +# Return to the original directory +Pop-Location \ No newline at end of file diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 new file mode 100644 index 000000000000..e6a86d03a210 --- /dev/null +++ b/eng/common/sdl/run-sdl.ps1 @@ -0,0 +1,65 @@ +Param( + [string] $GuardianCliLocation, + [string] $WorkingDirectory, + [string] $TargetDirectory, + [string] $GdnFolder, + [string[]] $ToolsList, + [string] $UpdateBaseline, + [string] $GuardianLoggerLevel="Standard" +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 +$LASTEXITCODE = 0 + +# We store config files in the r directory of .gdn +Write-Host $ToolsList +$gdnConfigPath = Join-Path $GdnFolder "r" +$ValidPath = Test-Path $GuardianCliLocation + +if ($ValidPath -eq $False) +{ + Write-Host "Invalid Guardian CLI Location." + exit 1 +} + +foreach ($tool in $ToolsList) { + $gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig" + $config = $False + Write-Host $tool + # We have to manually configure tools that run on source to look at the source directory only + if ($tool -eq "credscan") { + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `"" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory " + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + $config = $True + } + if ($tool -eq "policheck") { + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `"" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target : $TargetDirectory " + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + $config = $True + } + + Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile $config" + if ($config) { + & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian run for $tool using $gdnConfigFile failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + } else { + & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian run for $tool failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + } +} + diff --git a/global.json b/global.json index 7e3008a0f7af..ac934c93e134 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100-preview5-011568" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19302.2" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19304.1" } } From 5721e3e64d7633eeed9bfd4d02314f0ec810e346 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 4 Jun 2019 13:11:00 +0000 Subject: [PATCH 0534/2702] Update dependencies from https://github.com/dotnet/roslyn build 20190604.1 (#185) - Microsoft.NETCore.Compilers - 3.2.0-beta3-19304-01 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d77ccfbe6057..54060e1b0e3f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 3f10ddd4e64013c8e1627b24e766f9c84ef853a5 + a160d9ea400c78d8f4fb626607a10c240dc492f0 diff --git a/eng/Versions.props b/eng/Versions.props index 75f17f449ed4..5c46ab03eebe 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.2.0-beta3-19281-01 + 3.2.0-beta3-19304-01 - 3.2.0-beta3-19304-01 + 3.2.0-beta3-19304-07 - 3.2.0-beta3-19304-07 + 3.2.0-beta3-19306-03 - 3.2.0-beta3-19306-03 + 3.2.0-beta3-19307-03 - 3.2.0-beta3-19307-03 + 3.2.0-beta4-19311-07 - 3.2.0-beta4-19311-07 + 3.2.0-beta4-19312-04 - 3.2.0-beta4-19312-04 + 3.2.0-beta4-19312-15 - 3.2.0-beta4-19312-15 + 3.2.0-beta4-19314-04 - 3.2.0-beta4-19314-04 + 3.2.0-beta4-19315-04 - 3.2.0-beta4-19315-04 + 3.2.0-beta4-19317-08 - 3.2.0-beta4-19317-08 + 3.2.0-beta4-19319-04 - 3.2.0-beta4-19319-04 + 3.2.0-beta4-19320-01 - 3.2.0-beta4-19320-01 + 3.2.0-beta4-19321-02 - 3.2.0-beta4-19321-02 + 3.2.0-beta4-19321-04 - 3.2.0-beta4-19321-04 + 3.2.0-beta4-19324-01 - 3.2.0-beta4-19324-01 + 3.2.0-beta4-19326-06 - 3.2.0-beta4-19326-06 + 3.2.0-beta4-19326-12 - 3.2.0-beta4-19326-12 + 3.3.0-beta1-19327-07 - 3.3.0-beta1-19327-07 + 3.3.0-beta2-19351-06 - 3.3.0-beta2-19351-06 + 3.3.0-beta2-19354-03 - 3.3.0-beta2-19354-03 + 3.3.0-beta2-19355-05 - 3.3.0-beta2-19355-05 + 3.3.0-beta2-19356-02 - 3.3.0-beta2-19356-02 + 3.3.0-beta2-19357-02 - 3.3.0-beta2-19357-02 + 3.3.0-beta2-19359-05 + + + $(WorkItemDirectory) + $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" + 4:00 + + + + + $(WorkItemDirectory) + $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory)" + 4:00 + + + \ No newline at end of file diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 new file mode 100644 index 000000000000..7e5441f79743 --- /dev/null +++ b/eng/common/performance/performance-setup.ps1 @@ -0,0 +1,91 @@ +Param( + [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, + [string] $CoreRootDirectory, + [string] $Architecture="x64", + [string] $Framework="netcoreapp3.0", + [string] $CompilationMode="Tiered", + [string] $Repository=$env:BUILD_REPOSITORY_NAME, + [string] $Branch=$env:BUILD_SOURCEBRANCH, + [string] $CommitSha=$env:BUILD_SOURCEVERSION, + [string] $BuildNumber=$env:BUILD_BUILDNUMBER, + [string] $RunCategories="coreclr corefx", + [string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj", + [string] $Kind="micro", + [switch] $Internal, + [string] $Configurations="CompilationMode=$CompilationMode" +) + +$RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") +$UseCoreRun = ($CoreRootDirectory -ne [string]::Empty) + +$PayloadDirectory = (Join-Path $SourceDirectory "Payload") +$PerformanceDirectory = (Join-Path $PayloadDirectory "performance") +$WorkItemDirectory = (Join-Path $SourceDirectory "workitem") +$ExtraBenchmarkDotNetArguments = "--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" +$Creator = $env:BUILD_DEFINITIONNAME +$PerfLabArguments = "" +$HelixSourcePrefix = "pr" + +$Queue = "Windows.10.Amd64.ClientRS4.DevEx.15.8.Open" + +if ($Framework.StartsWith("netcoreapp")) { + $Queue = "Windows.10.Amd64.ClientRS4.Open" +} + +if ($Internal) { + $Queue = "Windows.10.Amd64.ClientRS5.Perf" + $PerfLabArguments = "--upload-to-perflab-container" + $ExtraBenchmarkDotNetArguments = "" + $Creator = "" + $HelixSourcePrefix = "official" +} + +$CommonSetupArguments="--frameworks $Framework --queue $Queue --build-number $BuildNumber --build-configs $Configurations" +$SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments" + +if ($RunFromPerformanceRepo) { + $SetupArguments = "--perf-hash $CommitSha $CommonSetupArguments" + + robocopy $SourceDirectory $PerformanceDirectory /E /XD $PayloadDirectory $SourceDirectory\artifacts $SourceDirectory\.git +} +else { + git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $PerformanceDirectory +} + +if ($UseCoreRun) { + $NewCoreRoot = (Join-Path $PayloadDirectory "Core_Root") + Move-Item -Path $CoreRootDirectory -Destination $NewCoreRoot +} + +$DocsDir = (Join-Path $PerformanceDirectory "docs") +robocopy $DocsDir $WorkItemDirectory + +# Set variables that we will need to have in future steps +$ci = $true + +. "$PSScriptRoot\..\pipeline-logging-functions.ps1" + +# Directories +Write-PipelineSetVariable -Name 'PayloadDirectory' -Value "$PayloadDirectory" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'PerformanceDirectory' -Value "$PerformanceDirectory" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'WorkItemDirectory' -Value "$WorkItemDirectory" -IsMultiJobVariable $false + +# Script Arguments +Write-PipelineSetVariable -Name 'Python' -Value "py -3" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'ExtraBenchmarkDotNetArguments' -Value "$ExtraBenchmarkDotNetArguments" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'SetupArguments' -Value "$SetupArguments" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'PerfLabArguments' -Value "$PerfLabArguments" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'BDNCategories' -Value "$RunCategories" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'TargetCsproj' -Value "$Csproj" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'Kind' -Value "$Kind" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'Architecture' -Value "$Architecture" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'UseCoreRun' -Value "$UseCoreRun" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'RunFromPerfRepo' -Value "$RunFromPerformanceRepo" -IsMultiJobVariable $false + +# Helix Arguments +Write-PipelineSetVariable -Name 'Creator' -Value "$Creator" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'Queue' -Value "$Queue" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'HelixSourcePrefix' -Value "$HelixSourcePrefix" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name '_BuildConfig' -Value "$Architecture.$Kind.$Framework" -IsMultiJobVariable $false + +exit 0 \ No newline at end of file diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh new file mode 100644 index 000000000000..126da5f76d43 --- /dev/null +++ b/eng/common/performance/performance-setup.sh @@ -0,0 +1,176 @@ +#!/usr/bin/env bash + +source_directory=$BUILD_SOURCESDIRECTORY +core_root_directory= +architecture=x64 +framework=netcoreapp3.0 +compilation_mode=tiered +repository=$BUILD_REPOSITORY_NAME +branch=$BUILD_SOURCEBRANCH +commit_sha=$BUILD_SOURCEVERSION +build_number=$BUILD_BUILDNUMBER +internal=false +kind="micro" +run_categories="coreclr corefx" +csproj="src\benchmarks\micro\MicroBenchmarks.csproj" +configurations= +run_from_perf_repo=false +use_core_run=true + +while (($# > 0)); do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + --sourcedirectory) + source_directory=$2 + shift 2 + ;; + --corerootdirectory) + core_root_directory=$2 + shift 2 + ;; + --architecture) + architecture=$2 + shift 2 + ;; + --framework) + framework=$2 + shift 2 + ;; + --compilationmode) + compilation_mode=$2 + shift 2 + ;; + --repository) + repository=$2 + shift 2 + ;; + --branch) + branch=$2 + shift 2 + ;; + --commitsha) + commit_sha=$2 + shift 2 + ;; + --buildnumber) + build_number=$2 + shift 2 + ;; + --kind) + kind=$2 + shift 2 + ;; + --runcategories) + run_categories=$2 + shift 2 + ;; + --csproj) + csproj=$2 + shift 2 + ;; + --internal) + internal=true + shift 1 + ;; + --configurations) + configurations=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --corerootdirectory Directory where Core_Root exists, if running perf testing with --corerun" + echo " --architecture Architecture of the testing being run" + echo " --configurations List of key=value pairs that will be passed to perf testing infrastructure." + echo " ex: --configurations \"CompilationMode=Tiered OptimzationLevel=PGO\"" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --framework The framework to run, if not running in master" + echo " --compliationmode The compilation mode if not passing --configurations" + echo " --sourcedirectory The directory of the sources. Defaults to env:BUILD_SOURCESDIRECTORY" + echo " --repository The name of the repository in the / format. Defaults to env:BUILD_REPOSITORY_NAME" + echo " --branch The name of the branch. Defaults to env:BUILD_SOURCEBRANCH" + echo " --commitsha The commit sha1 to run against. Defaults to env:BUILD_SOURCEVERSION" + echo " --buildnumber The build number currently running. Defaults to env:BUILD_BUILDNUMBER" + echo " --csproj The relative path to the benchmark csproj whose tests should be run. Defaults to src\benchmarks\micro\MicroBenchmarks.csproj" + echo " --kind Related to csproj. The kind of benchmarks that should be run. Defaults to micro" + echo " --runcategories Related to csproj. Categories of benchmarks to run. Defaults to \"coreclr corefx\"" + echo " --internal If the benchmarks are running as an official job." + echo "" + exit 0 + ;; + esac +done + +if [[ "$repository" == "dotnet/performance" ]]; then + run_from_perf_repo=true +fi + +if [ -z "$configurations" ]; then + configurations="CompliationMode=$compilation_mode" +fi + +if [ -z "$core_root_directory" ]; then + use_core_run=false +fi + +payload_directory=$source_directory/Payload +performance_directory=$payload_directory/performance +workitem_directory=$source_directory/workitem +extra_benchmark_dotnet_arguments="--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" +perflab_arguments= +queue=Ubuntu.1804.Amd64.Open +creator=$BUILD_DEFINITIONNAME +helix_source_prefix="pr" + +if [[ "$internal" == true ]]; then + perflab_arguments="--upload-to-perflab-container" + helix_source_prefix="official" + creator= + extra_benchmark_dotnet_arguments= + + if [[ "$architecture" = "arm64" ]]; then + queue=Ubuntu.1804.Arm64.Perf + else + queue=Ubuntu.1804.Amd64.Perf + fi +fi + +common_setup_arguments="--frameworks $framework --queue $queue --build-number $build_number --build-configs $configurations" +setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" + +if [[ "$run_from_perf_repo" = true ]]; then + payload_directory= + workitem_directory=$source_directory + performance_directory=$workitem_directory + setup_arguments="--perf-hash $commit_sha $common_setup_arguments" +else + git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $performance_directory + + docs_directory=$performance_directory/docs + mv $docs_directory $workitem_directory +fi + +if [[ "$use_core_run" = true ]]; then + new_core_root=$payload_directory/Core_Root + mv $core_root_directory $new_core_root +fi + +# Make sure all of our variables are available for future steps +echo "##vso[task.setvariable variable=UseCoreRun]$use_core_run" +echo "##vso[task.setvariable variable=Architecture]$architecture" +echo "##vso[task.setvariable variable=PayloadDirectory]$payload_directory" +echo "##vso[task.setvariable variable=PerformanceDirectory]$performance_directory" +echo "##vso[task.setvariable variable=WorkItemDirectory]$workitem_directory" +echo "##vso[task.setvariable variable=Queue]$queue" +echo "##vso[task.setvariable variable=SetupArguments]$setup_arguments" +echo "##vso[task.setvariable variable=Python]python3" +echo "##vso[task.setvariable variable=PerfLabArguments]$perflab_arguments" +echo "##vso[task.setvariable variable=ExtraBenchmarkDotNetArguments]$extra_benchmark_dotnet_arguments" +echo "##vso[task.setvariable variable=BDNCategories]$run_categories" +echo "##vso[task.setvariable variable=TargetCsproj]$csproj" +echo "##vso[task.setvariable variable=RunFromPerfRepo]$run_from_perf_repo" +echo "##vso[task.setvariable variable=Creator]$creator" +echo "##vso[task.setvariable variable=HelixSourcePrefix]$helix_source_prefix" +echo "##vso[task.setvariable variable=Kind]$kind" +echo "##vso[task.setvariable variable=_BuildConfig]$architecture.$kind.$framework" \ No newline at end of file diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 index 7b61376f8aab..af5f48aacebc 100644 --- a/eng/common/pipeline-logging-functions.ps1 +++ b/eng/common/pipeline-logging-functions.ps1 @@ -77,13 +77,14 @@ function Write-PipelineTaskError { [string]$Name, [string]$Value, [switch]$Secret, - [switch]$AsOutput) - + [switch]$AsOutput, + [bool]$IsMultiJobVariable=$true) + if($ci) { Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ 'variable' = $Name 'isSecret' = $Secret - 'isOutput' = 'true' + 'isOutput' = $IsMultiJobVariable } -AsOutput:$AsOutput } } diff --git a/eng/common/post-build/trigger-subscriptions.ps1 b/eng/common/post-build/trigger-subscriptions.ps1 index db8a839457aa..1a91dab0371e 100644 --- a/eng/common/post-build/trigger-subscriptions.ps1 +++ b/eng/common/post-build/trigger-subscriptions.ps1 @@ -19,14 +19,14 @@ function Get-Headers([string]$accept, [string]$barToken) { } # Get all the $SourceRepo subscriptions -$normalizedSurceRepo = $SourceRepo.Replace('dnceng@', '') -$getSubscriptionsApiEndpoint = "$maestroEndpoint/api/subscriptions?sourceRepository=$normalizedSurceRepo&api-version=$apiVersion" +$normalizedSourceRepo = $SourceRepo.Replace('dnceng@', '') +$getSubscriptionsApiEndpoint = "$maestroEndpoint/api/subscriptions?sourceRepository=$normalizedSourceRepo&api-version=$apiVersion" $headers = Get-Headers 'application/json' $barToken $subscriptions = Invoke-WebRequest -Uri $getSubscriptionsApiEndpoint -Headers $headers | ConvertFrom-Json if (!$subscriptions) { - Write-Host "No subscriptions found for source repo '$normalizedSurceRepo' in channel '$ChannelId'" + Write-Host "No subscriptions found for source repo '$normalizedSourceRepo' in channel '$ChannelId'" return } diff --git a/eng/common/templates/job/performance.yml b/eng/common/templates/job/performance.yml new file mode 100644 index 000000000000..ef809253d1a9 --- /dev/null +++ b/eng/common/templates/job/performance.yml @@ -0,0 +1,93 @@ +parameters: + steps: [] # optional -- any additional steps that need to happen before pulling down the performance repo and sending the performance benchmarks to helix (ie building your repo) + variables: [] # optional -- list of additional variables to send to the template + jobName: '' # required -- job name + displayName: '' # optional -- display name for the job. Will use jobName if not passed + pool: '' # required -- name of the Build pool + container: '' # required -- name of the container + extraSetupParameters: '' # optional -- extra arguments to pass to the setup script + frameworks: ['netcoreapp3.0'] # optional -- list of frameworks to run against + continueOnError: 'false' # optional -- determines whether to continue the build if the step errors + dependsOn: '' # optional -- dependencies of the job + timeoutInMinutes: 320 # optional -- timeout for the job + enableTelemetry: false # optional -- enable for telemetry + +jobs: +- template: ../jobs/jobs.yml + parameters: + dependsOn: ${{ parameters.dependsOn }} + enableTelemetry: ${{ parameters.enableTelemetry }} + enablePublishBuildArtifacts: true + continueOnError: ${{ parameters.continueOnError }} + + jobs: + - job: '${{ parameters.jobName }}' + + ${{ if ne(parameters.displayName, '') }}: + displayName: '${{ parameters.displayName }}' + ${{ if eq(parameters.displayName, '') }}: + displayName: '${{ parameters.jobName }}' + + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + variables: + + - ${{ each variable in parameters.variables }}: + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + + - IsInternal: '' + - HelixApiAccessToken: '' + - HelixPreCommand: '' + + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(variables['Agent.Os'], 'Windows_NT') }}: + - HelixPreCommand: 'set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"' + - IsInternal: -Internal + - ${{ if ne(variables['Agent.Os'], 'Windows_NT') }}: + - HelixPreCommand: 'export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' + - IsInternal: --internal + - group: DotNet-HelixApi-Access + - group: dotnet-benchview + + workspace: + clean: all + pool: + ${{ parameters.pool }} + container: ${{ parameters.container }} + strategy: + matrix: + ${{ each framework in parameters.frameworks }}: + ${{ framework }}: + _Framework: ${{ framework }} + steps: + - checkout: self + clean: true + # Run all of the steps to setup repo + - ${{ each step in parameters.steps }}: + - ${{ step }} + - powershell: $(Build.SourcesDirectory)\eng\common\performance\performance-setup.ps1 $(IsInternal) -Framework $(_Framework) ${{ parameters.extraSetupParameters }} + displayName: Performance Setup (Windows) + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $(Build.SourcesDirectory)/eng/common/performance/performance-setup.sh $(IsInternal) --framework $(_Framework) ${{ parameters.extraSetupParameters }} + displayName: Performance Setup (Unix) + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $(Python) $(PerformanceDirectory)/scripts/ci_setup.py $(SetupArguments) + displayName: Run ci setup script + # Run perf testing in helix + - template: /eng/common/templates/steps/perf-send-to-helix.yml + parameters: + HelixSource: '$(HelixSourcePrefix)/$(Build.Repository.Name)/$(Build.SourceBranch)' # sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'test/performance/$(Kind)/$(_Framework)/$(Architecture)' + HelixAccessToken: $(HelixApiAccessToken) + HelixTargetQueues: $(Queue) + HelixPreCommands: $(HelixPreCommand) + Creator: $(Creator) + WorkItemTimeout: 4:00 # 4 hours + WorkItemDirectory: '$(WorkItemDirectory)' # WorkItemDirectory can not be empty, so we send it some docs to keep it happy + CorrelationPayloadDirectory: '$(PayloadDirectory)' # it gets checked out to a folder with shorter path than WorkItemDirectory so we can avoid file name too long exceptions \ No newline at end of file diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml index 808d46b17f29..50ad724fc0cf 100644 --- a/eng/common/templates/post-build/channels/internal-servicing.yml +++ b/eng/common/templates/post-build/channels/internal-servicing.yml @@ -81,10 +81,10 @@ stages: /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) + /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) + /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) + /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' /p:BuildAssetRegistryToken='$(MaestroAccessToken)' @@ -167,4 +167,4 @@ stages: - template: ../promote-build.yml parameters: - ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} \ No newline at end of file + ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index 79c6822db720..bdc631016b6c 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -77,6 +77,7 @@ stages: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicDevRelease_30_Channel_Id) + /p:ArtifactsCategory=.NetCore /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml index 25923020df87..574cb1c2b927 100644 --- a/eng/common/templates/post-build/channels/public-release.yml +++ b/eng/common/templates/post-build/channels/public-release.yml @@ -81,10 +81,10 @@ stages: /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(Agent.BuildDirectory)/Nuget/NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) + /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) + /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) + /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' /p:BuildAssetRegistryToken='$(MaestroAccessToken)' diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index 114477d3adb9..f12f402ad9a2 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -48,6 +48,7 @@ stages: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicValidationRelease_30_Channel_Id) + /p:ArtifactsCategory=.NetCoreValidation /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 828346735200..42df4ae77e31 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -14,5 +14,8 @@ variables: # Whether the build is internal or not IsInternalBuild: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} + # Storage account name for proxy-backed feeds + ProxyBackedFeedsAccountName: dotnetfeed + SourceLinkCLIVersion: 3.0.0 SymbolToolVersion: 1.0.1 diff --git a/eng/common/templates/steps/perf-send-to-helix.yml b/eng/common/templates/steps/perf-send-to-helix.yml new file mode 100644 index 000000000000..b3ea9acf1f16 --- /dev/null +++ b/eng/common/templates/steps/perf-send-to-helix.yml @@ -0,0 +1,66 @@ +# Please remember to update the documentation if you make changes to these parameters! +parameters: + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + DisplayNamePrefix: 'Send job to Helix' # optional -- rename the beginning of the displayName of the steps in AzDO + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false + +steps: + - powershell: $(Build.SourcesDirectory)\eng\common\msbuild.ps1 $(Build.SourcesDirectory)\eng\common\performance\perfhelixpublish.proj /restore /t:Test /bl:$(Build.SourcesDirectory)\artifacts\log\$env:BuildConfig\SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/performance/perfhelixpublish.proj /restore /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 60741f039011..9abaac015fb5 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -84,7 +84,7 @@ function Exec-Process([string]$command, [string]$commandArgs) { return $global:LASTEXITCODE = $process.ExitCode } finally { - # If we didn't finish then an error occured or the user hit ctrl-c. Either + # If we didn't finish then an error occurred or the user hit ctrl-c. Either # way kill the process if (-not $finished) { $process.Kill() @@ -147,7 +147,7 @@ function InitializeDotNetCli([bool]$install) { # It also ensures that VS msbuild will use the downloaded sdk targets. $env:PATH = "$dotnetRoot;$env:PATH" - # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build + # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build Write-PipelinePrependPath -Path $dotnetRoot Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0' Write-PipelineSetVariable -Name 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value '1' diff --git a/global.json b/global.json index dbf076d352fd..beaee5df8ef5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100-preview6-012264" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19359.6" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19360.8" } } From cf0fd941ebaf4f7381af3ff11b88f083bd4eeada Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2019 12:49:43 +0000 Subject: [PATCH 0595/2702] Update dependencies from https://github.com/dotnet/arcade build 20190711.7 (#250) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19361.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dc6cdfa5ce34..43b593137926 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - a6ae1b637ed236354529992729af875f6c8a180a + f1b09644408f45f43f5835786b3e4bdfd2e78141 diff --git a/global.json b/global.json index beaee5df8ef5..7a130cbc8e31 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100-preview6-012264" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19360.8" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19361.7" } } From fe45034d9092eb5168c2ead06a2a900234ce8c6b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2019 12:58:13 +0000 Subject: [PATCH 0596/2702] Update dependencies from https://github.com/dotnet/roslyn build 20190712.4 (#251) - Microsoft.NETCore.Compilers - 3.3.0-beta2-19362-04 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 43b593137926..ba314e83d5bc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 17aaaf42dfcf86952acf0c7f788887623e7f4095 + 9193e307de9851db520debadb304b124c132a7b7 diff --git a/eng/Versions.props b/eng/Versions.props index c398d3a3a53a..1eca4dd71445 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.3.0-beta2-19359-05 + 3.3.0-beta2-19362-04 - 3.3.0-beta2-19362-04 + 3.3.0-beta2-19363-02 - 3.3.0-beta2-19363-02 + 3.3.0-beta2-19365-06 - 3.3.0-beta2-19365-06 + 3.3.0-beta2-19366-02 - 3.3.0-beta2-19366-02 + 3.3.0-beta2-19369-01 - 3.3.0-beta2-19369-01 + 3.3.0-beta2-19370-01 - 3.3.0-beta2-19370-01 + 3.3.0-beta2-19374-02 - 3.3.0-beta2-19374-02 + 3.3.0-beta2-19374-05 - 3.3.0-beta2-19374-05 + 3.3.0-beta2-19376-02 - 3.3.0-beta2-19376-02 + 3.3.0-beta2-19380-01 - 3.3.0-beta2-19380-01 + 3.3.0-beta2-19381-04 - 3.3.0-beta2-19381-04 + 3.3.0-beta3-19401-01 - 3.3.0-beta3-19401-01 + 3.3.0-beta3-19406-05 - 3.3.0-beta3-19406-05 + 3.3.0-beta3-19407-05 - 3.3.0-beta3-19407-05 + 3.3.0-beta2-19407-12 - 3.3.0-beta2-19407-12 + 3.3.0-beta3-19413-06 - 3.3.0-beta3-19413-06 + 3.3.0-beta3-19413-08 - 3.3.0-beta3-19413-08 + 3.3.0-beta3-19415-01 - 3.3.0-beta3-19415-01 + 3.3.1-beta3-19422-01 $(WorkItemDirectory) + $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --artifacts $(BaselineArtifactsDirectory) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" + $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults);$(FinalCommand) 4:00 + $(WorkItemDirectory) + $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --artifacts $(ArtifactsDirectory)" $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory)" + $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults) 4:00 diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index 4a6706b638ae..268986246e54 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -1,6 +1,7 @@ Param( [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, [string] $CoreRootDirectory, + [string] $BaselineCoreRootDirectory, [string] $Architecture="x64", [string] $Framework="netcoreapp5.0", [string] $CompilationMode="Tiered", @@ -12,11 +13,13 @@ Param( [string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj", [string] $Kind="micro", [switch] $Internal, + [switch] $Compare, [string] $Configurations="CompilationMode=$CompilationMode" ) $RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") $UseCoreRun = ($CoreRootDirectory -ne [string]::Empty) +$UseBaselineCoreRun = ($BaselineCoreRootDirectory -ne [string]::Empty) $PayloadDirectory = (Join-Path $SourceDirectory "Payload") $PerformanceDirectory = (Join-Path $PayloadDirectory "performance") @@ -29,7 +32,13 @@ $HelixSourcePrefix = "pr" $Queue = "Windows.10.Amd64.ClientRS4.DevEx.15.8.Open" if ($Framework.StartsWith("netcoreapp")) { - $Queue = "Windows.10.Amd64.ClientRS4.Open" + $Queue = "Windows.10.Amd64.ClientRS5.Open" +} + +if ($Compare) { + $Queue = "Windows.10.Amd64.19H1.Tiger.Perf.Open" + $PerfLabArguments = "" + $ExtraBenchmarkDotNetArguments = "" } if ($Internal) { @@ -56,6 +65,10 @@ if ($UseCoreRun) { $NewCoreRoot = (Join-Path $PayloadDirectory "Core_Root") Move-Item -Path $CoreRootDirectory -Destination $NewCoreRoot } +if ($UseBaselineCoreRun) { + $NewBaselineCoreRoot = (Join-Path $PayloadDirectory "Baseline_Core_Root") + Move-Item -Path $BaselineCoreRootDirectory -Destination $NewBaselineCoreRoot +} $DocsDir = (Join-Path $PerformanceDirectory "docs") robocopy $DocsDir $WorkItemDirectory @@ -80,7 +93,9 @@ Write-PipelineSetVariable -Name 'TargetCsproj' -Value "$Csproj" -IsMultiJobVaria Write-PipelineSetVariable -Name 'Kind' -Value "$Kind" -IsMultiJobVariable $false Write-PipelineSetVariable -Name 'Architecture' -Value "$Architecture" -IsMultiJobVariable $false Write-PipelineSetVariable -Name 'UseCoreRun' -Value "$UseCoreRun" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'UseBaselineCoreRun' -Value "$UseBaselineCoreRun" -IsMultiJobVariable $false Write-PipelineSetVariable -Name 'RunFromPerfRepo' -Value "$RunFromPerformanceRepo" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'Compare' -Value "$Compare" -IsMultiJobVariable $false # Helix Arguments Write-PipelineSetVariable -Name 'Creator' -Value "$Creator" -IsMultiJobVariable $false diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 76126b1f86e1..550b3ebf18e6 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -2,6 +2,7 @@ source_directory=$BUILD_SOURCESDIRECTORY core_root_directory= +baseline_core_root_directory= architecture=x64 framework=netcoreapp5.0 compilation_mode=tiered @@ -10,12 +11,14 @@ branch=$BUILD_SOURCEBRANCH commit_sha=$BUILD_SOURCEVERSION build_number=$BUILD_BUILDNUMBER internal=false +compare=false kind="micro" run_categories="coreclr corefx" csproj="src\benchmarks\micro\MicroBenchmarks.csproj" configurations= run_from_perf_repo=false use_core_run=true +use_baseline_core_run=true while (($# > 0)); do lowerI="$(echo $1 | awk '{print tolower($0)}')" @@ -28,6 +31,10 @@ while (($# > 0)); do core_root_directory=$2 shift 2 ;; + --baselinecorerootdirectory) + baseline_core_root_directory=$2 + shift 2 + ;; --architecture) architecture=$2 shift 2 @@ -72,6 +79,10 @@ while (($# > 0)); do internal=true shift 1 ;; + --compare) + compare=true + shift 1 + ;; --configurations) configurations=$2 shift 2 @@ -114,6 +125,10 @@ if [ -z "$core_root_directory" ]; then use_core_run=false fi +if [ -z "$baseline_core_root_directory" ]; then + use_baseline_core_run=false +fi + payload_directory=$source_directory/Payload performance_directory=$payload_directory/performance workitem_directory=$source_directory/workitem @@ -123,6 +138,19 @@ queue=Ubuntu.1804.Amd64.Open creator=$BUILD_DEFINITIONNAME helix_source_prefix="pr" +if [[ "$compare" == true ]]; then + extra_benchmark_dotnet_arguments= + perflab_arguments= + + # No open queues for arm64 + if [[ "$architecture" = "arm64" ]]; then + echo "Compare not available for arm64" + exit 1 + fi + + queue=Ubuntu.1804.Amd64.Tiger.Perf.Open +fi + if [[ "$internal" == true ]]; then perflab_arguments="--upload-to-perflab-container" helix_source_prefix="official" @@ -156,6 +184,11 @@ if [[ "$use_core_run" = true ]]; then mv $core_root_directory $new_core_root fi +if [[ "$use_baseline_core_run" = true ]]; then + new_baseline_core_root=$payload_directory/Baseline_Core_Root + mv $baseline_core_root_directory $new_baseline_core_root +fi + ci=true _script_dir=$(pwd)/eng/common @@ -163,6 +196,7 @@ _script_dir=$(pwd)/eng/common # Make sure all of our variables are available for future steps Write-PipelineSetVariable -name "UseCoreRun" -value "$use_core_run" -is_multi_job_variable false +Write-PipelineSetVariable -name "UseBaselineCoreRun" -value "$use_baseline_core_run" -is_multi_job_variable false Write-PipelineSetVariable -name "Architecture" -value "$architecture" -is_multi_job_variable false Write-PipelineSetVariable -name "PayloadDirectory" -value "$payload_directory" -is_multi_job_variable false Write-PipelineSetVariable -name "PerformanceDirectory" -value "$performance_directory" -is_multi_job_variable false @@ -178,4 +212,5 @@ Write-PipelineSetVariable -name "RunFromPerfRepo" -value "$run_from_perf_repo" - Write-PipelineSetVariable -name "Creator" -value "$creator" -is_multi_job_variable false Write-PipelineSetVariable -name "HelixSourcePrefix" -value "$helix_source_prefix" -is_multi_job_variable false Write-PipelineSetVariable -name "Kind" -value "$kind" -is_multi_job_variable false -Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false \ No newline at end of file +Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false +Write-PipelineSetVariable -name "Compare" -value "$compare" -is_multi_job_variable false diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 428e8c9607a6..bbfdacca1307 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -215,7 +215,7 @@ function ValidateSourceLinkLinks { } $ValidationFailures = 0 - foreach ($Job in $Jobs) { + foreach ($Job in @(Get-Job)) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job if ($jobResult -ne "0") { $ValidationFailures++ diff --git a/global.json b/global.json index 4f2c291106c0..5571684d6909 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100-preview6-012264" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19421.4" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19422.24" } } From 3092a031a3f02e4a587cbe3d8fd41a8d6cb0f8de Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2019 12:43:30 +0000 Subject: [PATCH 0662/2702] Update dependencies from https://github.com/dotnet/roslyn build 20190822.5 (#343) - Microsoft.NETCore.Compilers - 3.3.1-beta3-19422-05 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 74afb9fa8c05..928c85823b0e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 807f6d9c1f62e66aa907513ccf0fa5b2372748f6 + 8cf35ae627a2ab41758993875ac987fc3b188f1f diff --git a/eng/Versions.props b/eng/Versions.props index 1223ad178aeb..ce792f5f295e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.3.1-beta3-19422-01 + 3.3.1-beta3-19422-05 - 3.3.1-beta3-19422-05 + 3.3.1-beta3-19423-01 - 3.3.1-beta3-19423-01 + 3.3.1-beta3-19426-02 - 3.3.1-beta3-19426-02 + 3.3.1-beta3-19428-02 - 3.3.1-beta3-19428-02 + 3.3.1-beta3-19429-03 - 3.3.1-beta3-19429-03 + 3.3.1-beta3-19430-03 - 3.3.1-beta3-19430-03 + 3.3.1-beta3-19454-05 - 3.3.1-beta3-19454-05 + 3.3.1-beta4-19476-06 - 3.3.1-beta4-19476-06 + 3.4.0-beta4-19562-01 - 3.4.0-beta4-19562-01 + 3.4.0-beta4-19562-05 - 3.4.0-beta4-19562-05 + 3.4.0-beta4-19568-04 - 3.4.0-beta4-19568-04 + 3.4.0-beta4-19569-03 git commit --> git push -Write-Host "git add ." -git add . -if ($LASTEXITCODE -ne 0) { - Write-Error "Git add failed with exit code $LASTEXITCODE." -} -Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`"" -git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName" -if ($LASTEXITCODE -ne 0) { - Write-Error "Git commit failed with exit code $LASTEXITCODE." -} -Write-Host "git push" -git push -if ($LASTEXITCODE -ne 0) { - Write-Error "Git push failed with exit code $LASTEXITCODE." -} + # We create the temp directory where we'll store the sdl-config repository + $sdlDir = Join-Path $env:TEMP 'sdl' + if (Test-Path $sdlDir) { + Remove-Item -Force -Recurse $sdlDir + } -# Return to the original directory -Pop-Location \ No newline at end of file + Write-Host "git clone https://dnceng:`$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir" + git clone https://dnceng:$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git clone failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + # We copy the .gdn folder from our local run into the git repository so it can be committed + $sdlRepositoryFolder = Join-Path (Join-Path (Join-Path $sdlDir $Repository) $BranchName) '.gdn' + if (Get-Command Robocopy) { + Robocopy /S $GdnFolder $sdlRepositoryFolder + } else { + rsync -r $GdnFolder $sdlRepositoryFolder + } + # cd to the sdl-config directory so we can run git there + Push-Location $sdlDir + # git add . --> git commit --> git push + Write-Host 'git add .' + git add . + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git add failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`"" + git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName" + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git commit failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + Write-Host 'git push' + git push + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git push failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + + # Return to the original directory + Pop-Location +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} \ No newline at end of file diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 index 9bc25314ae21..40a084f79698 100644 --- a/eng/common/sdl/run-sdl.ps1 +++ b/eng/common/sdl/run-sdl.ps1 @@ -5,55 +5,65 @@ Param( [string] $GdnFolder, [string[]] $ToolsList, [string] $UpdateBaseline, - [string] $GuardianLoggerLevel="Standard", + [string] $GuardianLoggerLevel='Standard', [string[]] $CrScanAdditionalRunConfigParams, [string[]] $PoliCheckAdditionalRunConfigParams ) -$ErrorActionPreference = "Stop" +$ErrorActionPreference = 'Stop' Set-StrictMode -Version 2.0 +$disableConfigureToolsetImport = $true $LASTEXITCODE = 0 -# We store config files in the r directory of .gdn -Write-Host $ToolsList -$gdnConfigPath = Join-Path $GdnFolder "r" -$ValidPath = Test-Path $GuardianCliLocation +try { + . $PSScriptRoot\..\tools.ps1 -if ($ValidPath -eq $False) -{ - Write-Host "Invalid Guardian CLI Location." - exit 1 -} + # We store config files in the r directory of .gdn + Write-Host $ToolsList + $gdnConfigPath = Join-Path $GdnFolder 'r' + $ValidPath = Test-Path $GuardianCliLocation -$configParam = @("--config") - -foreach ($tool in $ToolsList) { - $gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig" - Write-Host $tool - # We have to manually configure tools that run on source to look at the source directory only - if ($tool -eq "credscan") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory < $TargetDirectory `" `" OutputType < pre `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory < $TargetDirectory " "OutputType < pre" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } + if ($ValidPath -eq $False) + { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Invalid Guardian CLI Location." + ExitWithExitCode 1 } - if ($tool -eq "policheck") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target < $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target < $TargetDirectory " $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams}) - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE + + $configParam = @('--config') + + foreach ($tool in $ToolsList) { + $gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig" + Write-Host $tool + # We have to manually configure tools that run on source to look at the source directory only + if ($tool -eq 'credscan') { + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory < $TargetDirectory `" `" OutputType < pre `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory < $TargetDirectory " "OutputType < pre" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian configure for $tool failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } + } + if ($tool -eq 'policheck') { + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target < $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target < $TargetDirectory " $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams}) + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian configure for $tool failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } } - } - $configParam+=$gdnConfigFile -} + $configParam+=$gdnConfigFile + } -Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam" -& $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam -if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian run for $ToolsList using $configParam failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE + Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam" + & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam + if ($LASTEXITCODE -ne 0) { + Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Guardian run for $ToolsList using $configParam failed with exit code $LASTEXITCODE." + ExitWithExitCode $LASTEXITCODE + } } +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Sdl' -Message $_ + ExitWithExitCode 1 +} \ No newline at end of file diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 0a2c40c1035c..402dc40734db 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -4,7 +4,7 @@ variables: - group: DotNet-DotNetCli-Storage - group: DotNet-MSRC-Storage - group: Publish-Build-Assets - + # .NET Core 3.1 Dev - name: PublicDevRelease_31_Channel_Id value: 128 @@ -13,19 +13,19 @@ variables: - name: NetCore_5_Dev_Channel_Id value: 131 - # .NET Tools - Validation - - name: NetCore_Tools_Validation_Channel_Id + # .NET Eng - Validation + - name: Net_Eng_Validation_Channel_Id value: 9 - # .NET Tools - Latest - - name: NetCore_Tools_Latest_Channel_Id + # .NET Eng - Latest + - name: Net_Eng_Latest_Channel_Id value: 2 - # .NET 3 Tools - Validation - - name: NETCore_3_Tools_Validation_Channel_Id + # .NET 3 Eng - Validation + - name: NET_3_Eng_Validation_Channel_Id value: 390 - # .NET 3 Tools - Latest + # .NET 3 Eng - name: NetCore_3_Tools_Channel_Id value: 344 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 5965cc2005dd..c1948cb651cf 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -137,8 +137,8 @@ stages: dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NetCore_Tools_Latest_Publish' - channelName: '.NET Tools - Latest' + stageName: 'Net_Eng_Latest_Publish' + channelName: '.NET Eng - Latest' channelId: 2 transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' @@ -150,8 +150,8 @@ stages: dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'PVR_Publish' - channelName: '.NET Tools - Validation' + stageName: 'Net_Eng_Validation_Publish' + channelName: '.NET Eng - Validation' channelId: 9 transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' @@ -195,3 +195,16 @@ stages: transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-internal-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NET_Internal_Tooling_Publishing' + channelName: '.NET Internal Tooling' + channelId: 551 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-internal/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-internal/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json' \ No newline at end of file diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 42ca33ac33dc..26a6d03c8a0a 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -5,7 +5,7 @@ [bool]$ci = if (Test-Path variable:ci) { $ci } else { $false } # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. -[string]$configuration = if (Test-Path variable:configuration) { $configuration } else { "Debug" } +[string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' } # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. # Binary log must be enabled on CI. @@ -24,7 +24,7 @@ [bool]$restore = if (Test-Path variable:restore) { $restore } else { $true } # Adjusts msbuild verbosity level. -[string]$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { "minimal" } +[string]$verbosity = if (Test-Path variable:verbosity) { $verbosity } else { 'minimal' } # Set to true to reuse msbuild nodes. Recommended to not reuse on CI. [bool]$nodeReuse = if (Test-Path variable:nodeReuse) { $nodeReuse } else { !$ci } @@ -41,23 +41,23 @@ # Enable repos to use a particular version of the on-line dotnet-install scripts. # default URL: https://dot.net/v1/dotnet-install.ps1 -[string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { "v1" } +[string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { 'v1' } # True to use global NuGet cache instead of restoring packages to repository-local directory. [bool]$useGlobalNuGetCache = if (Test-Path variable:useGlobalNuGetCache) { $useGlobalNuGetCache } else { !$ci } # An array of names of processes to stop on script exit if prepareMachine is true. -$processesToStopOnExit = if (Test-Path variable:processesToStopOnExit) { $processesToStopOnExit } else { @("msbuild", "dotnet", "vbcscompiler") } +$processesToStopOnExit = if (Test-Path variable:processesToStopOnExit) { $processesToStopOnExit } else { @('msbuild', 'dotnet', 'vbcscompiler') } $disableConfigureToolsetImport = if (Test-Path variable:disableConfigureToolsetImport) { $disableConfigureToolsetImport } else { $null } set-strictmode -version 2.0 -$ErrorActionPreference = "Stop" +$ErrorActionPreference = 'Stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 function Create-Directory([string[]] $path) { if (!(Test-Path $path)) { - New-Item -path $path -force -itemType "Directory" | Out-Null + New-Item -path $path -force -itemType 'Directory' | Out-Null } } @@ -121,7 +121,7 @@ function InitializeDotNetCli([bool]$install) { # Find the first path on %PATH% that contains the dotnet.exe if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -eq $null)) { - $dotnetCmd = Get-Command "dotnet.exe" -ErrorAction SilentlyContinue + $dotnetCmd = Get-Command 'dotnet.exe' -ErrorAction SilentlyContinue if ($dotnetCmd -ne $null) { $env:DOTNET_INSTALL_DIR = Split-Path $dotnetCmd.Path -Parent } @@ -134,13 +134,13 @@ function InitializeDotNetCli([bool]$install) { if ((-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -ne $null) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { $dotnetRoot = $env:DOTNET_INSTALL_DIR } else { - $dotnetRoot = Join-Path $RepoRoot ".dotnet" + $dotnetRoot = Join-Path $RepoRoot '.dotnet' if (-not (Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) { if ($install) { InstallDotNetSdk $dotnetRoot $dotnetSdkVersion } else { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Unable to find dotnet with SDK version '$dotnetSdkVersion'" + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unable to find dotnet with SDK version '$dotnetSdkVersion'" ExitWithExitCode 1 } } @@ -163,7 +163,7 @@ function InitializeDotNetCli([bool]$install) { } function GetDotNetInstallScript([string] $dotnetRoot) { - $installScript = Join-Path $dotnetRoot "dotnet-install.ps1" + $installScript = Join-Path $dotnetRoot 'dotnet-install.ps1' if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit @@ -173,17 +173,17 @@ function GetDotNetInstallScript([string] $dotnetRoot) { return $installScript } -function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = "") { +function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $architecture = '') { InstallDotNet $dotnetRoot $version $architecture } function InstallDotNet([string] $dotnetRoot, [string] $version, - [string] $architecture = "", - [string] $runtime = "", + [string] $architecture = '', + [string] $runtime = '', [bool] $skipNonVersionedFiles = $false, - [string] $runtimeSourceFeed = "", - [string] $runtimeSourceFeedKey = "") { + [string] $runtimeSourceFeed = '', + [string] $runtimeSourceFeedKey = '') { $installScript = GetDotNetInstallScript $dotnetRoot $installParameters = @{ @@ -199,7 +199,7 @@ function InstallDotNet([string] $dotnetRoot, & $installScript @installParameters } catch { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Failed to install dotnet runtime '$runtime' from public location." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from public location." # Only the runtime can be installed from a custom [private] location. if ($runtime -and ($runtimeSourceFeed -or $runtimeSourceFeedKey)) { @@ -215,7 +215,7 @@ function InstallDotNet([string] $dotnetRoot, & $installScript @installParameters } catch { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'." } } } @@ -238,12 +238,12 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = } if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } - $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { "15.9" } + $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { '15.9' } $vsMinVersion = [Version]::new($vsMinVersionStr) # Try msbuild command available in the environment. if ($env:VSINSTALLDIR -ne $null) { - $msbuildCmd = Get-Command "msbuild.exe" -ErrorAction SilentlyContinue + $msbuildCmd = Get-Command 'msbuild.exe' -ErrorAction SilentlyContinue if ($msbuildCmd -ne $null) { # Workaround for https://github.com/dotnet/roslyn/issues/35793 # Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+ @@ -267,7 +267,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion } else { - if (Get-Member -InputObject $GlobalJson.tools -Name "xcopy-msbuild") { + if (Get-Member -InputObject $GlobalJson.tools -Name 'xcopy-msbuild') { $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] } else { @@ -277,7 +277,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install if ($vsInstallDir -eq $null) { - throw "Unable to find Visual Studio that has required version and components installed" + throw 'Unable to find Visual Studio that has required version and components installed' } } @@ -301,7 +301,7 @@ function InstallXCopyMSBuild([string]$packageVersion) { } function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { - $packageName = "RoslynTools.MSBuild" + $packageName = 'RoslynTools.MSBuild' $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion" $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg" @@ -317,7 +317,7 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { Unzip $packagePath $packageDir } - return Join-Path $packageDir "tools" + return Join-Path $packageDir 'tools' } # @@ -334,32 +334,32 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { # or $null if no instance meeting the requirements is found on the machine. # function LocateVisualStudio([object]$vsRequirements = $null){ - if (Get-Member -InputObject $GlobalJson.tools -Name "vswhere") { + if (Get-Member -InputObject $GlobalJson.tools -Name 'vswhere') { $vswhereVersion = $GlobalJson.tools.vswhere } else { - $vswhereVersion = "2.5.2" + $vswhereVersion = '2.5.2' } $vsWhereDir = Join-Path $ToolsDir "vswhere\$vswhereVersion" - $vsWhereExe = Join-Path $vsWhereDir "vswhere.exe" + $vsWhereExe = Join-Path $vsWhereDir 'vswhere.exe' if (!(Test-Path $vsWhereExe)) { Create-Directory $vsWhereDir - Write-Host "Downloading vswhere" + Write-Host 'Downloading vswhere' Invoke-WebRequest "https://github.com/Microsoft/vswhere/releases/download/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe } if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } - $args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild", "-products", "*") + $args = @('-latest', '-prerelease', '-format', 'json', '-requires', 'Microsoft.Component.MSBuild', '-products', '*') - if (Get-Member -InputObject $vsRequirements -Name "version") { - $args += "-version" + if (Get-Member -InputObject $vsRequirements -Name 'version') { + $args += '-version' $args += $vsRequirements.version } - if (Get-Member -InputObject $vsRequirements -Name "components") { + if (Get-Member -InputObject $vsRequirements -Name 'components') { foreach ($component in $vsRequirements.components) { - $args += "-requires" + $args += '-requires' $args += $component } } @@ -385,27 +385,27 @@ function InitializeBuildTool() { # Initialize dotnet cli if listed in 'tools' $dotnetRoot = $null - if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { + if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { $dotnetRoot = InitializeDotNetCli -install:$restore } - if ($msbuildEngine -eq "dotnet") { + if ($msbuildEngine -eq 'dotnet') { if (!$dotnetRoot) { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "/global.json must specify 'tools.dotnet'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "/global.json must specify 'tools.dotnet'." ExitWithExitCode 1 } - $buildTool = @{ Path = Join-Path $dotnetRoot "dotnet.exe"; Command = "msbuild"; Tool = "dotnet"; Framework = "netcoreapp2.1" } + $buildTool = @{ Path = Join-Path $dotnetRoot 'dotnet.exe'; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp2.1' } } elseif ($msbuildEngine -eq "vs") { try { $msbuildPath = InitializeVisualStudioMSBuild -install:$restore } catch { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message $_ + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ ExitWithExitCode 1 } $buildTool = @{ Path = $msbuildPath; Command = ""; Tool = "vs"; Framework = "net472" } } else { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Unexpected value of -msbuildEngine: '$msbuildEngine'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unexpected value of -msbuildEngine: '$msbuildEngine'." ExitWithExitCode 1 } @@ -414,15 +414,15 @@ function InitializeBuildTool() { function GetDefaultMSBuildEngine() { # Presence of tools.vs indicates the repo needs to build using VS msbuild on Windows. - if (Get-Member -InputObject $GlobalJson.tools -Name "vs") { - return "vs" + if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { + return 'vs' } - if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { - return "dotnet" + if (Get-Member -InputObject $GlobalJson.tools -Name 'dotnet') { + return 'dotnet' } - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." ExitWithExitCode 1 } @@ -431,9 +431,9 @@ function GetNuGetPackageCachePath() { # Use local cache on CI to ensure deterministic build, # use global cache in dev builds to avoid cost of downloading packages. if ($useGlobalNuGetCache) { - $env:NUGET_PACKAGES = Join-Path $env:UserProfile ".nuget\packages" + $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages' } else { - $env:NUGET_PACKAGES = Join-Path $RepoRoot ".packages" + $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages' } } @@ -475,14 +475,14 @@ function InitializeToolset() { } if (-not $restore) { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Toolset version $toolsetVersion has not been restored." + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Toolset version $toolsetVersion has not been restored." ExitWithExitCode 1 } $buildTool = InitializeBuildTool - $proj = Join-Path $ToolsetDir "restore.proj" - $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "ToolsetRestore.binlog") } else { "" } + $proj = Join-Path $ToolsetDir 'restore.proj' + $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ToolsetRestore.binlog') } else { '' } '' | Set-Content $proj @@ -504,7 +504,7 @@ function ExitWithExitCode([int] $exitCode) { } function Stop-Processes() { - Write-Host "Killing running build processes..." + Write-Host 'Killing running build processes...' foreach ($processName in $processesToStopOnExit) { Get-Process -Name $processName -ErrorAction SilentlyContinue | Stop-Process } @@ -521,7 +521,7 @@ function MSBuild() { # Work around issues with Azure Artifacts credential provider # https://github.com/dotnet/arcade/issues/3932 - if ($ci -and $buildTool.Tool -eq "dotnet") { + if ($ci -and $buildTool.Tool -eq 'dotnet') { dotnet nuget locals http-cache -c $env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 @@ -532,7 +532,7 @@ function MSBuild() { $toolsetBuildProject = InitializeToolset $path = Split-Path -parent $toolsetBuildProject - $path = Join-Path $path (Join-Path $buildTool.Framework "Microsoft.DotNet.Arcade.Sdk.dll") + $path = Join-Path $path (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll') $args += "/logger:$path" } @@ -547,12 +547,12 @@ function MSBuild() { function MSBuild-Core() { if ($ci) { if (!$binaryLog) { - Write-PipelineTaskError -Message "Binary log must be enabled in CI build." + Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build.' ExitWithExitCode 1 } if ($nodeReuse) { - Write-PipelineTaskError -Message "Node reuse must be disabled in CI build." + Write-PipelineTelemetryError -Category 'Build' -Message 'Node reuse must be disabled in CI build.' ExitWithExitCode 1 } } @@ -562,10 +562,10 @@ function MSBuild-Core() { $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" if ($warnAsError) { - $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" + $cmdArgs += ' /warnaserror /p:TreatWarningsAsErrors=true' } else { - $cmdArgs += " /p:TreatWarningsAsErrors=false" + $cmdArgs += ' /p:TreatWarningsAsErrors=false' } foreach ($arg in $args) { @@ -577,7 +577,7 @@ function MSBuild-Core() { $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { - Write-PipelineTaskError -Message "Build failed." + Write-PipelineTelemetryError Category 'Build' -Message 'Build failed.' $buildLog = GetMSBuildBinaryLogCommandLineArgument $args if ($buildLog -ne $null) { @@ -592,12 +592,12 @@ function GetMSBuildBinaryLogCommandLineArgument($arguments) { foreach ($argument in $arguments) { if ($argument -ne $null) { $arg = $argument.Trim() - if ($arg.StartsWith("/bl:", "OrdinalIgnoreCase")) { - return $arg.Substring("/bl:".Length) + if ($arg.StartsWith('/bl:', "OrdinalIgnoreCase")) { + return $arg.Substring('/bl:'.Length) } - if ($arg.StartsWith("/binaryLogger:", "OrdinalIgnoreCase")) { - return $arg.Substring("/binaryLogger:".Length) + if ($arg.StartsWith('/binaryLogger:', 'OrdinalIgnoreCase')) { + return $arg.Substring('/binaryLogger:'.Length) } } } @@ -607,14 +607,14 @@ function GetMSBuildBinaryLogCommandLineArgument($arguments) { . $PSScriptRoot\pipeline-logging-functions.ps1 -$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") -$EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") -$ArtifactsDir = Join-Path $RepoRoot "artifacts" -$ToolsetDir = Join-Path $ArtifactsDir "toolset" -$ToolsDir = Join-Path $RepoRoot ".tools" -$LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration -$TempDir = Join-Path (Join-Path $ArtifactsDir "tmp") $configuration -$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json +$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..') +$EngRoot = Resolve-Path (Join-Path $PSScriptRoot '..') +$ArtifactsDir = Join-Path $RepoRoot 'artifacts' +$ToolsetDir = Join-Path $ArtifactsDir 'toolset' +$ToolsDir = Join-Path $RepoRoot '.tools' +$LogDir = Join-Path (Join-Path $ArtifactsDir 'log') $configuration +$TempDir = Join-Path (Join-Path $ArtifactsDir 'tmp') $configuration +$GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot 'global.json') | ConvertFrom-Json # true if global.json contains a "runtimes" section $globalJsonHasRuntimes = if ($GlobalJson.tools.PSObject.Properties.Name -Match 'runtimes') { $true } else { $false } @@ -631,8 +631,14 @@ Write-PipelineSetVariable -Name 'TMP' -Value $TempDir # Import custom tools configuration, if present in the repo. # Note: Import in global scope so that the script set top-level variables without qualification. if (!$disableConfigureToolsetImport) { - $configureToolsetScript = Join-Path $EngRoot "configure-toolset.ps1" + $configureToolsetScript = Join-Path $EngRoot 'configure-toolset.ps1' if (Test-Path $configureToolsetScript) { - . $configureToolsetScript + . $configureToolsetScript + if ((Test-Path variable:failOnConfigureToolsetError) -And $failOnConfigureToolsetError) { + if ((Test-Path variable:LastExitCode) -And ($LastExitCode -ne 0)) { + Write-PipelineTelemetryError -Category 'Build' -Message 'configure-toolset.ps1 returned a non-zero exit code' + ExitWithExitCode $LastExitCode + } + } } } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 6a23ac0a3452..f58db5e25d16 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -4,7 +4,6 @@ # CI mode - set to true on CI server for PR validation build or official build. ci=${ci:-false} -disable_configure_toolset_import=${disable_configure_toolset_import:-} # Set to true to use the pipelines logger which will enable Azure logging output. # https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md @@ -82,7 +81,7 @@ function ReadGlobalVersion { local pattern="\"$key\" *: *\"(.*)\"" if [[ ! $line =~ $pattern ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Error: Cannot find \"$key\" in $global_json_file" + Write-PipelineTelemetryError -category 'Build' "Error: Cannot find \"$key\" in $global_json_file" ExitWithExitCode 1 fi @@ -325,7 +324,7 @@ function InitializeToolset { local toolset_build_proj=`cat "$toolset_location_file"` if [[ ! -a "$toolset_build_proj" ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Invalid toolset path: $toolset_build_proj" + Write-PipelineTelemetryError -category 'Build' "Invalid toolset path: $toolset_build_proj" ExitWithExitCode 3 fi @@ -375,12 +374,12 @@ function MSBuild { function MSBuild-Core { if [[ "$ci" == true ]]; then if [[ "$binary_log" != true ]]; then - Write-PipelineTaskError "Binary log must be enabled in CI build." + Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build." ExitWithExitCode 1 fi if [[ "$node_reuse" == true ]]; then - Write-PipelineTaskError "Node reuse must be disabled in CI build." + Write-PipelineTelemetryError -category 'Build' "Node reuse must be disabled in CI build." ExitWithExitCode 1 fi fi @@ -394,7 +393,7 @@ function MSBuild-Core { "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" || { local exit_code=$? - Write-PipelineTaskError "Build failed (exit code '$exit_code')." + Write-PipelineTelemetryError -category 'Build' "Build failed (exit code '$exit_code')." ExitWithExitCode $exit_code } } @@ -437,7 +436,7 @@ Write-PipelineSetVariable -name "Temp" -value "$temp_dir" Write-PipelineSetVariable -name "TMP" -value "$temp_dir" # Import custom tools configuration, if present in the repo. -if [[ -z "$disable_configure_toolset_import" ]]; then +if [ -z "${disable_configure_toolset_import:-}" ]; then configure_toolset_script="$eng_root/configure-toolset.sh" if [[ -a "$configure_toolset_script" ]]; then . "$configure_toolset_script" diff --git a/global.json b/global.json index d491d91fbc53..e30d3dab4506 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19570.6" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19571.10" } } From f4d8dcb910ee26f9398e32d6329f2cf8dca15b2e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 23 Nov 2019 16:57:50 +0000 Subject: [PATCH 0742/2702] Update dependencies from https://github.com/dotnet/arcade build 20191122.5 (#438) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19572.5 --- eng/Version.Details.xml | 4 ++-- eng/common/templates/post-build/post-build.yml | 6 +++--- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 71849f614fce..3736cfc878e5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 6ade65ab9d2d63b3fcb73647fc109e2b36ffdc80 + 18ef57ae9aa0a728553f757e312b369d82e0abc9 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index c1948cb651cf..7a4252a4837b 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -205,6 +205,6 @@ stages: stageName: 'NET_Internal_Tooling_Publishing' channelName: '.NET Internal Tooling' channelId: 551 - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-internal/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-internal/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json' \ No newline at end of file + transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json' \ No newline at end of file diff --git a/global.json b/global.json index e30d3dab4506..426d531fd0bc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19571.10" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19572.5" } } From 600a5b921894a5876d5417edfd047f2c32a20f79 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 24 Nov 2019 13:35:13 +0000 Subject: [PATCH 0743/2702] Update dependencies from https://github.com/dotnet/arcade build 20191123.1 (#439) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19573.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3736cfc878e5..d173d7c00c2a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 18ef57ae9aa0a728553f757e312b369d82e0abc9 + 9393e2e903d42774c63770e40119c1621b88dc16 diff --git a/global.json b/global.json index 426d531fd0bc..2fc506bac0d4 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19572.5" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19573.1" } } From 32c80357b6acb348c33a94543b9e4f50acd09d3c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2019 13:35:41 +0000 Subject: [PATCH 0744/2702] Update dependencies from https://github.com/dotnet/arcade build 20191124.1 (#440) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19574.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d173d7c00c2a..505f3a302bcf 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 9393e2e903d42774c63770e40119c1621b88dc16 + 87b59e17420bf0c3341edacbd8a6721e619afbac diff --git a/global.json b/global.json index 2fc506bac0d4..1cb7c3fbb90d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19573.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19574.1" } } From 7d0ecff1f6a08f16d630ec77b78b4d3603b43896 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2019 13:30:38 +0000 Subject: [PATCH 0745/2702] Update dependencies from https://github.com/dotnet/arcade build 20191125.7 (#441) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19575.7 --- eng/Version.Details.xml | 4 ++-- .../templates/post-build/common-variables.yml | 4 ++++ eng/common/templates/post-build/post-build.yml | 15 ++++++++++++++- global.json | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 505f3a302bcf..159beb4546a5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 87b59e17420bf0c3341edacbd8a6721e619afbac + 549475dff607986e6d9626f0dc8678e9736b7d0c diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 402dc40734db..9505cf170f0f 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -49,6 +49,10 @@ variables: - name: NetCore_31_Blazor_Features_Channel_Id value: 531 + # .NET Core Experimental + - name: NetCore_Experimental_Channel_Id + value: 562 + # Whether the build is internal or not - name: IsInternalBuild value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 7a4252a4837b..8a8d84f20265 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -207,4 +207,17 @@ stages: channelId: 551 transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json' \ No newline at end of file + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NETCore_Experimental_Publishing' + channelName: '.NET Core Experimental' + channelId: 562 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental-symbols/nuget/v3/index.json' diff --git a/global.json b/global.json index 1cb7c3fbb90d..c34946742f19 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19574.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19575.7" } } From 8a2c8663631887655cb900fe56a318efaf7f4bdc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2019 13:30:32 +0000 Subject: [PATCH 0746/2702] Update dependencies from https://github.com/dotnet/arcade build 20191126.2 (#442) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19576.2 --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 159beb4546a5..a28f5e595233 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 549475dff607986e6d9626f0dc8678e9736b7d0c + e1f099bf18a14e8ef5dc50f1a90078839aa102c8 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 26a6d03c8a0a..d762c9f044a6 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -247,7 +247,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = if ($msbuildCmd -ne $null) { # Workaround for https://github.com/dotnet/roslyn/issues/35793 # Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+ - $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split(@('-', '+'))[0]) + $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split([char[]]@('-', '+'))[0]) if ($msbuildVersion -ge $vsMinVersion) { return $global:_MSBuildExe = $msbuildCmd.Path diff --git a/global.json b/global.json index c34946742f19..2d38a3b6229d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19575.7" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19576.2" } } From 388161cf78c860350d33949211e3e9cc5a181fe0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2019 13:25:58 +0000 Subject: [PATCH 0747/2702] Update dependencies from https://github.com/dotnet/arcade build 20191127.4 (#444) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19577.4 --- eng/Version.Details.xml | 4 ++-- eng/common/build.ps1 | 19 ++++++++++--------- global.json | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a28f5e595233..adf51a844a96 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - e1f099bf18a14e8ef5dc50f1a90078839aa102c8 + e103549927549c5b5b8cf02479f8e3b021037001 diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index ce6882eead6d..0fd4d9c7f231 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -112,17 +112,18 @@ function Build { @properties } -if ($clean) { - if(Test-Path $ArtifactsDir) { - Remove-Item -Recurse -Force $ArtifactsDir - Write-Host 'Artifacts directory deleted.' - } - exit 0 -} - try { . $PSScriptRoot\tools.ps1 - If ((Test-Path variable:LastExitCode) -And ($LastExitCode -ne 0)) { + + if ($clean) { + if (Test-Path $ArtifactsDir) { + Remove-Item -Recurse -Force $ArtifactsDir + Write-Host 'Artifacts directory deleted.' + } + exit 0 + } + + if ((Test-Path variable:LastExitCode) -And ($LastExitCode -ne 0)) { Write-PipelineTelemetryError -Category 'InitializeToolset' -Message 'Eng/common/tools.ps1 returned a non-zero exit code.' ExitWithExitCode $LastExitCode } diff --git a/global.json b/global.json index 2d38a3b6229d..f59fce88793c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19576.2" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19577.4" } } From 535f47810af7d8bf566a2d819d9daa7194ed1a1b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2019 13:36:03 +0000 Subject: [PATCH 0748/2702] Update dependencies from https://github.com/dotnet/arcade build 20191128.1 (#445) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19578.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index adf51a844a96..54688ac065d6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - e103549927549c5b5b8cf02479f8e3b021037001 + 7d8af3c802523cd7d9df9f6cb4ce49236851ca0f diff --git a/global.json b/global.json index f59fce88793c..0553d8055c92 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19577.4" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19578.1" } } From 654b13839de4e6f8a45b0023be30a154d1eaacdc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 30 Nov 2019 13:40:57 +0000 Subject: [PATCH 0749/2702] Update dependencies from https://github.com/dotnet/arcade build 20191129.1 (#446) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19579.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 54688ac065d6..da5caf16b1d2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 7d8af3c802523cd7d9df9f6cb4ce49236851ca0f + ab04a0fb86ba6bcb63b59317833c47996facafdf diff --git a/global.json b/global.json index 0553d8055c92..7fb01db3248b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19578.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19579.1" } } From 5f0092e8d4641c44e662f32990498b5702eac6e2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2019 13:35:31 +0000 Subject: [PATCH 0750/2702] Update dependencies from https://github.com/dotnet/arcade build 20191130.1 (#447) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19580.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index da5caf16b1d2..51bc06863386 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - ab04a0fb86ba6bcb63b59317833c47996facafdf + d58525128d68de745027d7eaf83b3a9e178e23df diff --git a/global.json b/global.json index 7fb01db3248b..8dff98230891 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19579.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19580.1" } } From 4667448388a184d373ef7e47bfa3a289f377b022 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2019 13:36:26 +0000 Subject: [PATCH 0751/2702] Update dependencies from https://github.com/dotnet/arcade build 20191201.1 (#448) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19601.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 51bc06863386..9adbf1835c33 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - d58525128d68de745027d7eaf83b3a9e178e23df + c0b56ff3569e3c7475070486c40543ea4c6f6dc7 diff --git a/global.json b/global.json index 8dff98230891..7ebe7404d745 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19580.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19601.1" } } From afeb66ff85c3060bf3a6772f42dccdbb7f02a552 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2019 13:31:14 +0000 Subject: [PATCH 0752/2702] Update dependencies from https://github.com/dotnet/arcade build 20191202.4 (#449) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19602.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9adbf1835c33..3512c365ca5c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - c0b56ff3569e3c7475070486c40543ea4c6f6dc7 + 9d34fd008e754e1ada35c8b6bc3694e7a90b4ed7 diff --git a/global.json b/global.json index 7ebe7404d745..8551add71688 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19601.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19602.4" } } From 9e01a40b3e8738e28abff3c23569ecaff5fd4553 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2019 19:03:23 +0000 Subject: [PATCH 0753/2702] Update dependencies from https://github.com/dotnet/arcade build 20191203.17 (#450) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19603.17 --- eng/Version.Details.xml | 4 +- eng/common/SetupNugetSources.ps1 | 65 ++++++++++--------- eng/common/SetupNugetSources.sh | 78 ++++++++++++++++------- eng/common/build.ps1 | 11 +--- eng/common/init-tools-native.ps1 | 6 +- eng/common/native/install-tool.ps1 | 2 +- eng/common/pipeline-logging-functions.ps1 | 2 +- global.json | 2 +- 8 files changed, 103 insertions(+), 67 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3512c365ca5c..b084d4701416 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 9d34fd008e754e1ada35c8b6bc3694e7a90b4ed7 + b902fd6b6948e689a5128fa6d94dc7de13e6af84 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 6662e4bc1ece..a5a1e711d79c 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -16,7 +16,7 @@ # condition: eq(variables['Agent.OS'], 'Windows_NT') # inputs: # filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 -# arguments: -ConfigFile ${Env:BUILD_SOURCESDIRECTORY}/NuGet.config -Password $Env:Token +# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token # env: # Token: $(dn-bot-dnceng-artifact-feeds-rw) @@ -94,41 +94,48 @@ function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Password) { } } -try { - if (!(Test-Path $ConfigFile -PathType Leaf)) { - Write-PipelineTelemetryError -Category 'Build' -Message "Couldn't find the file NuGet config file: $ConfigFile" +if (!(Test-Path $ConfigFile -PathType Leaf)) { + Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile" + ExitWithExitCode 1 +} + +if (!$Password) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Please supply a valid PAT' ExitWithExitCode 1 - } +} - # Load NuGet.config - $doc = New-Object System.Xml.XmlDocument - $filename = (Get-Item $ConfigFile).FullName - $doc.Load($filename) +# Load NuGet.config +$doc = New-Object System.Xml.XmlDocument +$filename = (Get-Item $ConfigFile).FullName +$doc.Load($filename) - # Get reference to or create one if none exist already - $sources = $doc.DocumentElement.SelectSingleNode("packageSources") - if ($sources -eq $null) { - $sources = $doc.CreateElement("packageSources") - $doc.DocumentElement.AppendChild($sources) | Out-Null - } +# Get reference to or create one if none exist already +$sources = $doc.DocumentElement.SelectSingleNode("packageSources") +if ($sources -eq $null) { + $sources = $doc.CreateElement("packageSources") + $doc.DocumentElement.AppendChild($sources) | Out-Null +} - # Looks for a node. Create it if none is found. - $creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials") - if ($creds -eq $null) { - $creds = $doc.CreateElement("packageSourceCredentials") - $doc.DocumentElement.AppendChild($creds) | Out-Null - } +# Looks for a node. Create it if none is found. +$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials") +if ($creds -eq $null) { + $creds = $doc.CreateElement("packageSourceCredentials") + $doc.DocumentElement.AppendChild($creds) | Out-Null +} - # Insert credential nodes for Maestro's private feeds - InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password +# Insert credential nodes for Maestro's private feeds +InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password +$dotnet3Source = $sources.SelectSingleNode("add[@key='dotnet3']") +if ($dotnet3Source -ne $null) { AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password - - $doc.Save($filename) } -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ - ExitWithExitCode 1 + +$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']") +if ($dotnet31Source -ne $null) { + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password } + +$doc.Save($filename) diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index 55ad70e36631..7d6fef27fe49 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -17,7 +17,7 @@ # displayName: Setup Private Feeds Credentials # inputs: # filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh -# arguments: $BUILD_SOURCESDIRECTORY/NuGet.config $Token +# arguments: $(Build.SourcesDirectory)/NuGet.config $Token # condition: ne(variables['Agent.OS'], 'Windows_NT') # env: # Token: $(dn-bot-dnceng-artifact-feeds-rw) @@ -42,7 +42,12 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" . "$scriptroot/tools.sh" if [ ! -f "$ConfigFile" ]; then - Write-PipelineTelemetryError -Category 'Build' -Message "Couldn't find the file NuGet config file: $ConfigFile" + Write-PipelineTelemetryError -Category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile" + ExitWithExitCode 1 +fi + +if [ -z "$CredToken" ]; then + Write-PipelineTelemetryError -category 'Build' "Error: Eng/common/SetupNugetSources.sh returned a non-zero exit code. Please supply a valid PAT" ExitWithExitCode 1 fi @@ -52,7 +57,7 @@ if [[ `uname -s` == "Darwin" ]]; then fi # Ensure there is a ... section. -grep -i "" $ConfigFile +grep -i "" $ConfigFile if [ "$?" != "0" ]; then echo "Adding ... section." ConfigNodeHeader="" @@ -62,7 +67,7 @@ if [ "$?" != "0" ]; then fi # Ensure there is a ... section. -grep -i "" $ConfigFile +grep -i "" $ConfigFile if [ "$?" != "0" ]; then echo "Adding ... section." @@ -72,37 +77,64 @@ if [ "$?" != "0" ]; then sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" NuGet.config fi -# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources -grep -i "" $ConfigFile -if [ "$?" != "0" ]; then - echo "Adding dotnet3-internal to the packageSources." +PackageSources=() - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" +# Ensure dotnet3-internal and dotnet3-internal-transport are in the packageSources if the public dotnet3 feeds are present +grep -i "" $ConfigFile + if [ "$?" != "0" ]; then + echo "Adding dotnet3-internal to the packageSources." + PackageSourcesNodeFooter="" + PackageSourceTemplate="${TB}" + + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=('dotnet3-internal') + + grep -i "" - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" NuGet.config + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=('dotnet3-internal-transport') fi -# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources -grep -i "" $ConfigFile -if [ "$?" != "0" ]; then - echo "Adding dotnet3-internal-transport to the packageSources." +# Ensure dotnet3.1-internal and dotnet3.1-internal-transport are in the packageSources if the public dotnet3.1 feeds are present +grep -i "" - PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=('dotnet3.1-internal') + + grep -i "" $ConfigFile + if [ "$?" != "0" ]; then + echo "Adding dotnet3.1-internal-transport to the packageSources." + PackageSourcesNodeFooter="" + PackageSourceTemplate="${TB}" - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" NuGet.config + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile + fi + PackageSources+=('dotnet3.1-internal-transport') fi # I want things split line by line PrevIFS=$IFS IFS=$'\n' -PackageSources=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"') +PackageSources+="$IFS" +PackageSources+=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"') IFS=$PrevIFS -PackageSources+=('dotnet3-internal') -PackageSources+=('dotnet3-internal-transport') - for FeedName in ${PackageSources[@]} ; do # Check if there is no existing credential for this FeedName grep -i "<$FeedName>" $ConfigFile @@ -112,6 +144,6 @@ for FeedName in ${PackageSources[@]} ; do PackageSourceCredentialsNodeFooter="" NewCredential="${TB}${TB}<$FeedName>${NL}${NL}${NL}" - sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" NuGet.config + sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile fi done diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 0fd4d9c7f231..88814514d828 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -62,6 +62,8 @@ function Print-Usage() { Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)." } +. $PSScriptRoot\tools.ps1 + function InitializeCustomToolset { if (-not $restore) { return @@ -113,8 +115,6 @@ function Build { } try { - . $PSScriptRoot\tools.ps1 - if ($clean) { if (Test-Path $ArtifactsDir) { Remove-Item -Recurse -Force $ArtifactsDir @@ -122,12 +122,7 @@ try { } exit 0 } - - if ((Test-Path variable:LastExitCode) -And ($LastExitCode -ne 0)) { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message 'Eng/common/tools.ps1 returned a non-zero exit code.' - ExitWithExitCode $LastExitCode - } - + if ($help -or (($null -ne $properties) -and ($properties.Contains('/help') -or $properties.Contains('/?')))) { Print-Usage exit 0 diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index f4409f0835ac..db830c00a6f8 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -113,14 +113,16 @@ try { } $toolInstallationFailure = $true } else { - Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message $errMsg + # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 + Write-Host $errMsg exit 1 } } } if ((Get-Variable 'toolInstallationFailure' -ErrorAction 'SilentlyContinue') -and $toolInstallationFailure) { - Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message 'Native tools bootstrap failed' + # We cannot change this to Write-PipelineTelemetryError because of https://github.com/dotnet/arcade/issues/4482 + Write-Host 'Native tools bootstrap failed' exit 1 } } diff --git a/eng/common/native/install-tool.ps1 b/eng/common/native/install-tool.ps1 index ca180d03ba18..f397e1c75d41 100644 --- a/eng/common/native/install-tool.ps1 +++ b/eng/common/native/install-tool.ps1 @@ -105,7 +105,7 @@ try { Write-Error "There are multiple copies of $ToolName in $($ToolInstallDirectory): `n$(@($ToolFilePath | out-string))" exit 1 } elseif (@($ToolFilePath).Length -Lt 1) { - Write-Error "$ToolName was not found in $ToolFilePath." + Write-Host "$ToolName was not found in $ToolFilePath." exit 1 } diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 index e0656185886f..2688c389bd96 100644 --- a/eng/common/pipeline-logging-functions.ps1 +++ b/eng/common/pipeline-logging-functions.ps1 @@ -85,7 +85,7 @@ function Write-PipelineTaskError { [switch]$AsOutput, [bool]$IsMultiJobVariable=$true) - if(-Not (Test-Path variable:ci) -Or !$ci) { + if((Test-Path variable:ci) -And $ci) { Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ 'variable' = $Name 'isSecret' = $Secret diff --git a/global.json b/global.json index 8551add71688..a83d46693aa5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19602.4" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19603.17" } } From 6f9b95d6cb931ae2580c2df7eb5e5ccb71c83d1f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2019 13:30:56 +0000 Subject: [PATCH 0754/2702] Update dependencies from https://github.com/dotnet/arcade build 20191204.4 (#451) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19604.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b084d4701416..fc80f269d40a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - b902fd6b6948e689a5128fa6d94dc7de13e6af84 + f2999360b70f05d7738cbfa2b61d1fdaff4ee77d diff --git a/global.json b/global.json index a83d46693aa5..afe721b78e8d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19603.17" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19604.4" } } From 0806c1de0881a174b8375f089c9fb6e2c56b083a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2019 13:25:11 +0000 Subject: [PATCH 0755/2702] Update dependencies from https://github.com/dotnet/arcade build 20191205.6 (#452) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19605.6 --- eng/Version.Details.xml | 4 ++-- eng/common/pipeline-logging-functions.ps1 | 4 ++-- global.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fc80f269d40a..3205e502e7ba 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - f2999360b70f05d7738cbfa2b61d1fdaff4ee77d + 45bfe0972a7354356daf799aae88533dcd0f071a diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 index 2688c389bd96..a3e1317ad434 100644 --- a/eng/common/pipeline-logging-functions.ps1 +++ b/eng/common/pipeline-logging-functions.ps1 @@ -101,7 +101,7 @@ function Write-PipelineTaskError { [string]$Path, [switch]$AsOutput) - if(-Not (Test-Path variable:ci) -Or !$ci) { + if((Test-Path variable:ci) -And $ci) { Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput } } @@ -237,4 +237,4 @@ function Write-LogIssue { } Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} \ No newline at end of file +} diff --git a/global.json b/global.json index afe721b78e8d..e2f13fe3c4f1 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,8 @@ { "tools": { - "dotnet": "3.0.100" + "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19604.4" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19605.6" } } From dbf21d4056d533b3d0d862079e63ed71a441426a Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 6 Dec 2019 17:09:52 -0800 Subject: [PATCH 0756/2702] Add dotnet-eng as a NuGet source --- NuGet.config | 1 + 1 file changed, 1 insertion(+) diff --git a/NuGet.config b/NuGet.config index 9b611ba841d2..ff6bdea599df 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,6 +4,7 @@ + From e992523088ad245d26226399c5032e51ef0a936c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2019 13:29:58 +0000 Subject: [PATCH 0757/2702] Update dependencies from https://github.com/dotnet/arcade build 20191206.1 (#453) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19606.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3205e502e7ba..3867bd1ba446 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 45bfe0972a7354356daf799aae88533dcd0f071a + 4c050b4705ee1743665e7ad721dfafdc9b82a4b7 diff --git a/global.json b/global.json index e2f13fe3c4f1..e84ccce4f90a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19605.6" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19606.1" } } From 2f898a20f42cfb8b9e4e87958b74ff476e9595fe Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 8 Dec 2019 13:34:45 +0000 Subject: [PATCH 0758/2702] Update dependencies from https://github.com/dotnet/arcade build 20191207.1 (#454) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19607.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3867bd1ba446..d07ebab4db3f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 4c050b4705ee1743665e7ad721dfafdc9b82a4b7 + 97cce7cb41de117e849d42a2eb7c99065dd1602f diff --git a/global.json b/global.json index e84ccce4f90a..e5fa23393fad 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19606.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19607.1" } } From 9904323fb73d34b78d3f053470953d74332d0eef Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2019 14:05:12 +0000 Subject: [PATCH 0759/2702] Update dependencies from https://github.com/dotnet/arcade build 20191208.1 (#455) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19608.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d07ebab4db3f..6fe6f825706b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 97cce7cb41de117e849d42a2eb7c99065dd1602f + 71ce4c736b882e6112b395a0e92313be5dcb4328 diff --git a/global.json b/global.json index e5fa23393fad..a8159c422494 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19607.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19608.1" } } From 541f4e647d1ec1fad4799fa7e376a5ccb9dabe9e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2019 13:30:09 +0000 Subject: [PATCH 0760/2702] Update dependencies from https://github.com/dotnet/arcade build 20191211.6 (#456) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19611.6 --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 28 +++++++++++++++++++++++++--- eng/common/tools.sh | 2 ++ global.json | 2 +- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6fe6f825706b..776e09898240 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 71ce4c736b882e6112b395a0e92313be5dcb4328 + 71a91bbb3c49bad2f1e7f2c7f28b32c5c0efc9e5 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index d762c9f044a6..09c3a3325eac 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -98,7 +98,7 @@ function Exec-Process([string]$command, [string]$commandArgs) { } } -function InitializeDotNetCli([bool]$install) { +function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { if (Test-Path variable:global:_DotNetInstallDir) { return $global:_DotNetInstallDir } @@ -146,6 +146,22 @@ function InitializeDotNetCli([bool]$install) { } $env:DOTNET_INSTALL_DIR = $dotnetRoot + + if ($createSdkLocationFile) { + # Create a temporary file under the toolset dir and rename it to sdk.txt to avoid races. + do { + $sdkCacheFileTemp = Join-Path $ToolsetDir $([System.IO.Path]::GetRandomFileName()) + } + until (!(Test-Path $sdkCacheFileTemp)) + Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot + + try { + Rename-Item -Force -Path $sdkCacheFileTemp 'sdk.txt' + } catch { + # Somebody beat us + Remove-Item -Path $sdkCacheFileTemp + } + } } # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom @@ -216,7 +232,10 @@ function InstallDotNet([string] $dotnetRoot, } catch { Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Failed to install dotnet runtime '$runtime' from custom location '$runtimeSourceFeed'." + ExitWithExitCode 1 } + } else { + ExitWithExitCode 1 } } } @@ -274,8 +293,11 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $vsMajorVersion = $vsMinVersion.Major $xcopyMSBuildVersion = "$vsMajorVersion.$($vsMinVersion.Minor).0-alpha" } - - $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install + + $vsInstallDir = $null + if ($xcopyMSBuildVersion.Trim() -ine "none") { + $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install + } if ($vsInstallDir -eq $null) { throw 'Unable to find Visual Studio that has required version and components installed' } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index f58db5e25d16..e071af4ee494 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -211,6 +211,8 @@ function InstallDotNet { Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK from custom location '$runtimeSourceFeed' (exit code '$exit_code')." ExitWithExitCode $exit_code } + else + ExitWithExitCode $exit_code fi fi } diff --git a/global.json b/global.json index a8159c422494..6ca314f7d036 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19608.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19611.6" } } From a4695e9beb003defeac162e75df35069e2f26163 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2019 13:34:46 +0000 Subject: [PATCH 0761/2702] Update dependencies from https://github.com/dotnet/arcade build 20191212.1 (#457) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19612.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 776e09898240..9ce90957af3d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 71a91bbb3c49bad2f1e7f2c7f28b32c5c0efc9e5 + b590bede6a5244ee732c63c99f725728cabbda48 diff --git a/global.json b/global.json index 6ca314f7d036..2b6c02049c32 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19611.6" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19612.1" } } From 12141c30fba6428b320e147983eb6907278460d3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 14 Dec 2019 13:29:10 +0000 Subject: [PATCH 0762/2702] Update dependencies from https://github.com/dotnet/arcade build 20191213.1 (#458) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19613.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9ce90957af3d..1e4f4f10d32f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - b590bede6a5244ee732c63c99f725728cabbda48 + acd18a717ab18e484addef602e2af2b2bc4c4bd1 diff --git a/global.json b/global.json index 2b6c02049c32..5bf3fc0381f7 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19612.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19613.1" } } From 9dd019af4ccb2a8a3f4ee6ca80dd3dd77966311d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 15 Dec 2019 13:34:52 +0000 Subject: [PATCH 0763/2702] Update dependencies from https://github.com/dotnet/arcade build 20191214.1 (#459) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19614.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1e4f4f10d32f..de3240559066 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - acd18a717ab18e484addef602e2af2b2bc4c4bd1 + 64e95735b49d37b6cf908cfa5228ff65bee6dfff diff --git a/global.json b/global.json index 5bf3fc0381f7..dd5c15d3b17d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19613.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19614.1" } } From ad6c232e5e92db36251c089c69d2b908aa03b33e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2019 13:51:06 +0000 Subject: [PATCH 0764/2702] Update dependencies from https://github.com/dotnet/arcade build 20191215.1 (#460) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19615.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index de3240559066..51d5729da428 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 64e95735b49d37b6cf908cfa5228ff65bee6dfff + 77698ebba1ab096ad9580a5d9ebefe0499ba00ce diff --git a/global.json b/global.json index dd5c15d3b17d..bc3abbd6dcb1 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19614.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19615.1" } } From 57947961aeda5280f042255e9800d907e480796c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2019 13:30:41 +0000 Subject: [PATCH 0765/2702] Update dependencies from https://github.com/dotnet/arcade build 20191216.4 (#461) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19616.4 --- eng/Version.Details.xml | 4 +-- eng/common/templates/steps/publish-logs.yml | 2 +- eng/common/tools.ps1 | 33 ++++++++++++--------- global.json | 2 +- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 51d5729da428..7ae86fad50f0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 77698ebba1ab096ad9580a5d9ebefe0499ba00ce + 4736ddca60a4040447b450437cf3767c9045edc0 diff --git a/eng/common/templates/steps/publish-logs.yml b/eng/common/templates/steps/publish-logs.yml index 8903ba57c006..f91751fe78e1 100644 --- a/eng/common/templates/steps/publish-logs.yml +++ b/eng/common/templates/steps/publish-logs.yml @@ -18,6 +18,6 @@ steps: inputs: PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs' PublishLocation: Container - ArtifactName: PostBuilLogs + ArtifactName: PostBuildLogs continueOnError: true condition: always() diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 09c3a3325eac..d3a432878e21 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -98,6 +98,9 @@ function Exec-Process([string]$command, [string]$commandArgs) { } } +# createSdkLocationFile parameter enables a file being generated under the toolset directory +# which writes the sdk's location into. This is only necessary for cmd --> powershell invocations +# as dot sourcing isn't possible. function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { if (Test-Path variable:global:_DotNetInstallDir) { return $global:_DotNetInstallDir @@ -146,21 +149,23 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { } $env:DOTNET_INSTALL_DIR = $dotnetRoot + } - if ($createSdkLocationFile) { - # Create a temporary file under the toolset dir and rename it to sdk.txt to avoid races. - do { - $sdkCacheFileTemp = Join-Path $ToolsetDir $([System.IO.Path]::GetRandomFileName()) - } - until (!(Test-Path $sdkCacheFileTemp)) - Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot - - try { - Rename-Item -Force -Path $sdkCacheFileTemp 'sdk.txt' - } catch { - # Somebody beat us - Remove-Item -Path $sdkCacheFileTemp - } + # Creates a temporary file under the toolset dir. + # The following code block is protecting against concurrent access so that this function can + # be called in parallel. + if ($createSdkLocationFile) { + do { + $sdkCacheFileTemp = Join-Path $ToolsetDir $([System.IO.Path]::GetRandomFileName()) + } + until (!(Test-Path $sdkCacheFileTemp)) + Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot + + try { + Rename-Item -Force -Path $sdkCacheFileTemp 'sdk.txt' + } catch { + # Somebody beat us + Remove-Item -Path $sdkCacheFileTemp } } diff --git a/global.json b/global.json index bc3abbd6dcb1..aed2268c51df 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19615.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19616.4" } } From da04c59f35f0bb5bcbc8598791d58e3df6025575 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2019 13:34:04 +0000 Subject: [PATCH 0766/2702] Update dependencies from https://github.com/dotnet/arcade build 20191217.1 (#462) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19617.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7ae86fad50f0..6e06a86cd723 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 4736ddca60a4040447b450437cf3767c9045edc0 + 66175ebd3756697a3ca515e16cd5ffddc30582cd diff --git a/global.json b/global.json index aed2268c51df..5f40d78db44b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19616.4" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19617.1" } } From 7e2ea509df47d60e54802be6c9b4a0dca81d3083 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2019 13:29:53 +0000 Subject: [PATCH 0767/2702] Update dependencies from https://github.com/dotnet/arcade build 20191219.10 (#463) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19619.10 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6e06a86cd723..e8c5bf40eeb5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 66175ebd3756697a3ca515e16cd5ffddc30582cd + 154d5981c6d2fe19f80e71a654ceddeba76ba7b5 diff --git a/global.json b/global.json index 5f40d78db44b..79a6f19244e0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19617.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19619.10" } } From bab0407107bd3aab1284b383662b10ccea96b5e0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2019 13:33:28 +0000 Subject: [PATCH 0768/2702] Update dependencies from https://github.com/dotnet/arcade build 20191220.1 (#464) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19620.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e8c5bf40eeb5..534a32fdb6b5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 154d5981c6d2fe19f80e71a654ceddeba76ba7b5 + d0fecb826dee1a24c0d2c9136476a79bed22ed41 diff --git a/global.json b/global.json index 79a6f19244e0..dbdf7b813250 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19619.10" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19620.1" } } From 8e1a53cd52721f6b0ae18eacc9543d70c7bc5291 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 22 Dec 2019 13:42:23 +0000 Subject: [PATCH 0769/2702] Update dependencies from https://github.com/dotnet/arcade build 20191221.1 (#465) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19621.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 534a32fdb6b5..67f4f9a7739f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - d0fecb826dee1a24c0d2c9136476a79bed22ed41 + 67fdc011dac2750c6a5374a78539091c1806b8a4 diff --git a/global.json b/global.json index dbdf7b813250..85b62042090c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19620.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19621.1" } } From dc8ef4c1456ea70b99389c8478f72364d446764c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2019 13:30:27 +0000 Subject: [PATCH 0770/2702] Update dependencies from https://github.com/dotnet/arcade build 20191222.1 (#466) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19622.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 67f4f9a7739f..1d9d03aa1bec 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 67fdc011dac2750c6a5374a78539091c1806b8a4 + 163d551438aa5a1fdae12b8405651f894e841211 diff --git a/global.json b/global.json index 85b62042090c..3e187f59ae1a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19621.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19622.1" } } From 49d2169501e52b5426daa83d005e5c27cae311ef Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 Dec 2019 13:42:09 +0000 Subject: [PATCH 0771/2702] Update dependencies from https://github.com/dotnet/arcade build 20191223.1 (#467) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19623.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1d9d03aa1bec..3bcee719ac85 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 163d551438aa5a1fdae12b8405651f894e841211 + 84f3b4a8520b9e6d50afece47fa1adf4de8ec292 diff --git a/global.json b/global.json index 3e187f59ae1a..1c7a329ea079 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19622.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19623.1" } } From c075ee01989edf6b341cbef52e97712e002fa5f6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 25 Dec 2019 13:35:04 +0000 Subject: [PATCH 0772/2702] Update dependencies from https://github.com/dotnet/arcade build 20191224.1 (#468) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19624.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3bcee719ac85..055c8b3ce389 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 84f3b4a8520b9e6d50afece47fa1adf4de8ec292 + b7573607e81dd496c0270ba724f5ece5568bd311 diff --git a/global.json b/global.json index 1c7a329ea079..447ef8f819c0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19623.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19624.1" } } From da9cd1e57e6964c7726bad6d1c4d2a30c450e5af Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 26 Dec 2019 13:48:55 +0000 Subject: [PATCH 0773/2702] Update dependencies from https://github.com/dotnet/arcade build 20191225.1 (#469) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19625.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 055c8b3ce389..93bbd298e8b1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - b7573607e81dd496c0270ba724f5ece5568bd311 + 4808b9983dea4d99e40df6215233ea78d396df6f diff --git a/global.json b/global.json index 447ef8f819c0..35ffe51db090 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19624.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19625.1" } } From a39cb8040f55fd37377ce4ce874ee359dac9d97e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 27 Dec 2019 13:44:07 +0000 Subject: [PATCH 0774/2702] Update dependencies from https://github.com/dotnet/arcade build 20191226.1 (#470) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19626.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 93bbd298e8b1..faa2a227628d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 4808b9983dea4d99e40df6215233ea78d396df6f + ade7c8cb46ba88f5e698c91da9e7605619e34b6c diff --git a/global.json b/global.json index 35ffe51db090..69a6665c1de2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19625.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19626.1" } } From 153061ed73b0476a021be0a3d01e7c0461e96a5e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2019 13:48:51 +0000 Subject: [PATCH 0775/2702] Update dependencies from https://github.com/dotnet/arcade build 20191227.1 (#471) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19627.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index faa2a227628d..9d47b613d403 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - ade7c8cb46ba88f5e698c91da9e7605619e34b6c + d2d025c1de37b1258f147851cb3e7373ad5ff09d diff --git a/global.json b/global.json index 69a6665c1de2..5eaf9c28ef2f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19626.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19627.1" } } From 4f16ba123633ea4e4ba3c6afd0c780b415dad16d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 29 Dec 2019 13:42:30 +0000 Subject: [PATCH 0776/2702] Update dependencies from https://github.com/dotnet/arcade build 20191228.1 (#472) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19628.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9d47b613d403..94c1e18a2fc0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - d2d025c1de37b1258f147851cb3e7373ad5ff09d + 44a53c66de431dbd54b4277d6338d2b103d6852d diff --git a/global.json b/global.json index 5eaf9c28ef2f..97e9ff5b559f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19627.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19628.1" } } From bd065b287fae55e90e62df57c62b83776bb33585 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2019 13:34:05 +0000 Subject: [PATCH 0777/2702] Update dependencies from https://github.com/dotnet/arcade build 20191229.1 (#473) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19629.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 94c1e18a2fc0..5184aad9bb43 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 44a53c66de431dbd54b4277d6338d2b103d6852d + f40849c5bbdfd1f1b99801f5a40343f8d4a192c9 diff --git a/global.json b/global.json index 97e9ff5b559f..7509420c8798 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19628.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19629.1" } } From 0483de15a63d8a9d19c7f2fcf910c607c535062f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2019 13:31:05 +0000 Subject: [PATCH 0778/2702] Update dependencies from https://github.com/dotnet/arcade build 20191230.1 (#474) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19630.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5184aad9bb43..8952b8eb4c72 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - f40849c5bbdfd1f1b99801f5a40343f8d4a192c9 + 01d0b636bfb96edf62a77912de25aa5cef143946 diff --git a/global.json b/global.json index 7509420c8798..5aa88ae595ec 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19629.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19630.1" } } From bf868fdd5033e0b9e9a2aed386c794c7bf0dbd18 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2020 13:41:10 +0000 Subject: [PATCH 0779/2702] Update dependencies from https://github.com/dotnet/arcade build 20191231.1 (#475) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19631.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8952b8eb4c72..374a4cd02942 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 01d0b636bfb96edf62a77912de25aa5cef143946 + cc596c55ac68c952d0e052e6ed50334ed170b53a diff --git a/global.json b/global.json index 5aa88ae595ec..341cce90e7e0 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19630.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19631.1" } } From bd120e8550388f61b700671768e9124f5e9eae75 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2020 13:49:10 +0000 Subject: [PATCH 0780/2702] Update dependencies from https://github.com/dotnet/arcade build 20200101.1 (#476) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20051.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 374a4cd02942..d88fadd9f57e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - cc596c55ac68c952d0e052e6ed50334ed170b53a + bbd4a95d4bcb6e06f88a8590e18e499a6169b66e diff --git a/global.json b/global.json index 341cce90e7e0..b43cc3f6791c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19631.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20051.1" } } From 7eee86675ec0e1a33587543ad34eecb75369f086 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2020 13:34:10 +0000 Subject: [PATCH 0781/2702] Update dependencies from https://github.com/dotnet/arcade build 20200102.1 (#477) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20052.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d88fadd9f57e..4d7b6462e240 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - bbd4a95d4bcb6e06f88a8590e18e499a6169b66e + 98cc270f5e08096729fc7d54ffafa9e3c6576316 diff --git a/global.json b/global.json index b43cc3f6791c..e34e2f1873ef 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20051.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20052.1" } } From 1d669302a904b865dde81afa259f7e9b91992c6b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 4 Jan 2020 13:35:57 +0000 Subject: [PATCH 0782/2702] Update dependencies from https://github.com/dotnet/arcade build 20200103.2 (#478) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20053.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4d7b6462e240..731e9049e60e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 98cc270f5e08096729fc7d54ffafa9e3c6576316 + b49ab5e13eb7c5678d6720ef041dc675cf8e9307 diff --git a/global.json b/global.json index e34e2f1873ef..9da5afacc59f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20052.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20053.2" } } From 1353828ad2dcf93036dbab481cec810ba9e2621b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 5 Jan 2020 13:32:54 +0000 Subject: [PATCH 0783/2702] Update dependencies from https://github.com/dotnet/arcade build 20200104.1 (#479) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20054.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 731e9049e60e..d67cbfbe3e68 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - b49ab5e13eb7c5678d6720ef041dc675cf8e9307 + 96ab522b32ff4d0f7bfc18074fd5ae3673c59d0a diff --git a/global.json b/global.json index 9da5afacc59f..6f425671661b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20053.2" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20054.1" } } From 8da450449322e914d3eb0338d4d3014996c2a413 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2020 13:43:42 +0000 Subject: [PATCH 0784/2702] Update dependencies from https://github.com/dotnet/arcade build 20200105.1 (#480) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20055.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d67cbfbe3e68..73a56a8a166d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 96ab522b32ff4d0f7bfc18074fd5ae3673c59d0a + 111d78c79ac38f596688af152779d7a39e4bf973 diff --git a/global.json b/global.json index 6f425671661b..82f48ac2d371 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20054.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20055.1" } } From d4e9304a005562b5ff7c7ba59e68c6206d055d85 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2020 13:52:33 +0000 Subject: [PATCH 0785/2702] Update dependencies from https://github.com/dotnet/arcade build 20200106.6 (#481) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20056.6 --- eng/Version.Details.xml | 4 +- .../channels/generic-internal-channel.yml | 38 +++++++----------- .../channels/generic-public-channel.yml | 39 +++++++------------ global.json | 2 +- 4 files changed, 33 insertions(+), 50 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 73a56a8a166d..989b62f1e677 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 111d78c79ac38f596688af152779d7a39e4bf973 + 5cbca575e9002cc2d9814c3471d38882df2fcc8e diff --git a/eng/common/templates/post-build/channels/generic-internal-channel.yml b/eng/common/templates/post-build/channels/generic-internal-channel.yml index 3a8755fbbb76..700211049b5b 100644 --- a/eng/common/templates/post-build/channels/generic-internal-channel.yml +++ b/eng/common/templates/post-build/channels/generic-internal-channel.yml @@ -30,16 +30,15 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - artifactName: 'BlobArtifacts' + displayName: Download Build Assets continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download PDB Artifacts inputs: - artifactName: 'PDBArtifacts' - continueOnError: true + buildType: 'current' + downloadType: 'specific' + itemPattern: | + PDBArtifacts/** + BlobArtifacts/** + downloadPath: '$(Build.ArtifactStagingDirectory)' # This is necessary whenever we want to publish/restore to an AzDO private feed # Since sdk-task.ps1 tries to restore packages we need to do this authentication here @@ -85,23 +84,16 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts + displayName: Download Build Assets continueOnError: true - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests inputs: - buildType: current - artifactName: AssetManifests + buildType: 'current' + downloadType: 'specific' + itemPattern: | + PackageArtifacts/** + BlobArtifacts/** + AssetManifests/** + downloadPath: '$(Build.ArtifactStagingDirectory)' - task: NuGetToolInstaller@1 displayName: 'Install NuGet.exe' diff --git a/eng/common/templates/post-build/channels/generic-public-channel.yml b/eng/common/templates/post-build/channels/generic-public-channel.yml index 3f572f8b12f5..fbb5a19b6776 100644 --- a/eng/common/templates/post-build/channels/generic-public-channel.yml +++ b/eng/common/templates/post-build/channels/generic-public-channel.yml @@ -30,16 +30,15 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - artifactName: 'BlobArtifacts' + displayName: Download Build Assets continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download PDB Artifacts inputs: - artifactName: 'PDBArtifacts' - continueOnError: true + buildType: 'current' + downloadType: 'specific' + itemPattern: | + PDBArtifacts/** + BlobArtifacts/** + downloadPath: '$(Build.ArtifactStagingDirectory)' # This is necessary whenever we want to publish/restore to an AzDO private feed # Since sdk-task.ps1 tries to restore packages we need to do this authentication here @@ -84,24 +83,16 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts + displayName: Download Build Assets continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests inputs: - buildType: current - artifactName: AssetManifests + buildType: 'current' + downloadType: 'specific' + itemPattern: | + PackageArtifacts/** + BlobArtifacts/** + AssetManifests/** + downloadPath: '$(Build.ArtifactStagingDirectory)' - task: NuGetToolInstaller@1 displayName: 'Install NuGet.exe' diff --git a/global.json b/global.json index 82f48ac2d371..42219747fb19 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20055.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20056.6" } } From 73de07c68b7c817ccb857d5e0e453b4f3a5d3907 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2020 13:31:56 +0000 Subject: [PATCH 0786/2702] Update dependencies from https://github.com/dotnet/arcade build 20200107.5 (#482) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20057.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 989b62f1e677..6527cca76757 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 5cbca575e9002cc2d9814c3471d38882df2fcc8e + d0833c8e5e58cfc507ce3c8da364e55931190263 diff --git a/global.json b/global.json index 42219747fb19..8c12a1ea6fda 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20056.6" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20057.5" } } From 6f7a071baf5289511f84fa1b95ee7e9377ef078d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2020 13:34:02 +0000 Subject: [PATCH 0787/2702] Update dependencies from https://github.com/dotnet/arcade build 20200108.1 (#483) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20058.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6527cca76757..b613dbf27f18 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - d0833c8e5e58cfc507ce3c8da364e55931190263 + 48bae09d7d8ec0e6879fe2b8d08872cd87f084ca diff --git a/global.json b/global.json index 8c12a1ea6fda..012813dd412e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20057.5" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20058.1" } } From 5bdb2f2be558820dcdce79e497c2ceb24e41646f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2020 13:30:33 +0000 Subject: [PATCH 0788/2702] Update dependencies from https://github.com/dotnet/arcade build 20200109.3 (#484) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20059.3 --- eng/Version.Details.xml | 4 ++-- eng/common/performance/performance-setup.ps1 | 3 ++- eng/common/performance/performance-setup.sh | 2 +- global.json | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b613dbf27f18..c8f12172af53 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 48bae09d7d8ec0e6879fe2b8d08872cd87f084ca + 96a4497b2c38c6b7e19c39e4cb8fe5adac299fb4 diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index ec41965fc895..f6e878297dbb 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -49,7 +49,8 @@ if ($Internal) { $HelixSourcePrefix = "official" } -$CommonSetupArguments="--frameworks $Framework --queue $Queue --build-number $BuildNumber --build-configs $Configurations" +# FIX ME: This is a workaround until we get this from the actual pipeline +$CommonSetupArguments="--channel master --queue $Queue --build-number $BuildNumber --build-configs $Configurations" $SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments" if ($RunFromPerformanceRepo) { diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 2f2092166e43..7ef15514e525 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -164,7 +164,7 @@ if [[ "$internal" == true ]]; then fi fi -common_setup_arguments="--frameworks $framework --queue $queue --build-number $build_number --build-configs $configurations" +common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations" setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" if [[ "$run_from_perf_repo" = true ]]; then diff --git a/global.json b/global.json index 012813dd412e..6da4ee20f72c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20058.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20059.3" } } From 4916d6fe0aabecbdcc4788902607afa6f534a7ce Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 11 Jan 2020 13:33:35 +0000 Subject: [PATCH 0789/2702] Update dependencies from https://github.com/dotnet/arcade build 20200110.4 (#485) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20060.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c8f12172af53..3aca785968b3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 96a4497b2c38c6b7e19c39e4cb8fe5adac299fb4 + 384a4bfab9ea05bff33790d21cb7e1d863e4e599 diff --git a/global.json b/global.json index 6da4ee20f72c..73fee9d9fe9a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20059.3" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20060.4" } } From b133419713feaeb53d652d702e5bd112060f55bb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 12 Jan 2020 13:39:21 +0000 Subject: [PATCH 0790/2702] Update dependencies from https://github.com/dotnet/arcade build 20200111.1 (#487) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20061.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3aca785968b3..5b0697c95420 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 384a4bfab9ea05bff33790d21cb7e1d863e4e599 + b1f4549e88a136ed8ae657a39f8316b98b9bf80a diff --git a/global.json b/global.json index 73fee9d9fe9a..3c64afc224b3 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20060.4" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20061.1" } } From 24bd5f5b962fe508e9077270f943ad79ec81aef1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 15 Jan 2020 13:33:34 +0000 Subject: [PATCH 0791/2702] [master] Update dependencies from dotnet/arcade (#488) * Update dependencies from https://github.com/dotnet/arcade build 20200112.1 - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20062.1 * Update dependencies from https://github.com/dotnet/arcade build 20200113.2 - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20063.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5b0697c95420..211fd2735393 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - b1f4549e88a136ed8ae657a39f8316b98b9bf80a + be2d4ae34b4fcfe35beb9bdaeb7b7990c1147740 diff --git a/global.json b/global.json index 3c64afc224b3..cca9ab38a97b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20061.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20063.2" } } From 57b864910577250eae78ef39e227a7ef62fcd43f Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Wed, 15 Jan 2020 06:15:01 -0800 Subject: [PATCH 0792/2702] use newer task type --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 28270f94a647..219a921fe994 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,7 +26,7 @@ jobs: steps: - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine displayName: Build and Test - - task: PublishTestResults@1 + - task: PublishTestResults@2 inputs: testRunner: XUnit testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml' From 0ecd2159dcf1c63f5c5956d1c7efb1a5ecdaaa4e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2020 13:29:58 +0000 Subject: [PATCH 0793/2702] Update dependencies from https://github.com/dotnet/arcade build 20200115.5 (#491) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20065.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 211fd2735393..5188a3aa51e7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - be2d4ae34b4fcfe35beb9bdaeb7b7990c1147740 + 39220c078e22f4b5a053e0de5c616a567446a0eb diff --git a/global.json b/global.json index cca9ab38a97b..fb4733f337c5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20063.2" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20065.5" } } From 5aa43120a9d749c5e0b2e14c3639affdf75a15d1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2020 13:29:21 +0000 Subject: [PATCH 0794/2702] Update dependencies from https://github.com/dotnet/arcade build 20200116.1 (#492) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20066.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5188a3aa51e7..42eede3eb2f3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 39220c078e22f4b5a053e0de5c616a567446a0eb + bca68c2df2c6230389f10def3880a61db266c6c1 diff --git a/global.json b/global.json index fb4733f337c5..40b36183a752 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20065.5" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20066.1" } } From 86e0b6e7f3210f57ad4826fe080f945d86f8606d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 18 Jan 2020 13:33:25 +0000 Subject: [PATCH 0795/2702] Update dependencies from https://github.com/dotnet/arcade build 20200117.2 (#493) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20067.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 42eede3eb2f3..1594b8877edd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - bca68c2df2c6230389f10def3880a61db266c6c1 + 514e47a844ea7fe193978725c15e67ec16bff572 diff --git a/global.json b/global.json index 40b36183a752..c9183d97730c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20066.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20067.2" } } From 5c787a99209ba6f8e52dba5887e0347789455f03 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 19 Jan 2020 13:29:37 +0000 Subject: [PATCH 0796/2702] Update dependencies from https://github.com/dotnet/arcade build 20200118.1 (#494) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20068.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1594b8877edd..31062f11f41e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 514e47a844ea7fe193978725c15e67ec16bff572 + ebc71292545adda514c1e6a5657cd9ab753240bc diff --git a/global.json b/global.json index c9183d97730c..51eb1928cf93 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20067.2" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20068.1" } } From 6005b1b82cc95198dcd94e86aa4e4980a8d373a5 Mon Sep 17 00:00:00 2001 From: jpshrader <46694288+jpshrader@users.noreply.github.com> Date: Mon, 20 Jan 2020 23:07:08 -0500 Subject: [PATCH 0797/2702] format-379-report: Add `--report` command line argument to produce a json report of which files have/would have been formatted --- eng/Versions.props | 1 + src/CodeFormatter.cs | 28 ++++++++++--- src/FileChange.cs | 21 ++++++++++ src/FormatOptions.cs | 9 +++- src/FormattedFile.cs | 23 ++++++++++ src/Formatters/DocumentFormatter.cs | 49 +++++++++++++--------- src/Formatters/ICodeFormatter.cs | 3 +- src/Program.cs | 6 ++- src/Resources.resx | 6 +++ src/dotnet-format.csproj | 3 +- src/xlf/Resources.cs.xlf | 10 +++++ src/xlf/Resources.de.xlf | 10 +++++ src/xlf/Resources.es.xlf | 10 +++++ src/xlf/Resources.fr.xlf | 10 +++++ src/xlf/Resources.it.xlf | 10 +++++ src/xlf/Resources.ja.xlf | 10 +++++ src/xlf/Resources.ko.xlf | 10 +++++ src/xlf/Resources.pl.xlf | 10 +++++ src/xlf/Resources.pt-BR.xlf | 10 +++++ src/xlf/Resources.ru.xlf | 10 +++++ src/xlf/Resources.tr.xlf | 10 +++++ src/xlf/Resources.zh-Hans.xlf | 10 +++++ src/xlf/Resources.zh-Hant.xlf | 10 +++++ tests/CodeFormatterTests.cs | 3 +- tests/Formatters/AbstractFormatterTests.cs | 13 +++++- 25 files changed, 261 insertions(+), 34 deletions(-) create mode 100644 src/FileChange.cs create mode 100644 src/FormattedFile.cs diff --git a/eng/Versions.props b/eng/Versions.props index acdeea81aa60..a80e7c27cc4a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -23,6 +23,7 @@ 1.1.20180503.2 2.9.6 $(MicrosoftNETCoreCompilersPackageVersion) + 12.0.3 true diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 33bbf55c946c..42d7f5f67279 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -15,6 +15,8 @@ using Microsoft.CodeAnalysis.Tools.Workspaces; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.CodingConventions; +using System.Text; +using Newtonsoft.Json; namespace Microsoft.CodeAnalysis.Tools { @@ -33,7 +35,7 @@ public static async Task FormatWorkspaceAsync( ILogger logger, CancellationToken cancellationToken) { - var (workspaceFilePath, workspaceType, logLevel, saveFormattedFiles, _, filesToFormat) = options; + var (workspaceFilePath, workspaceType, logLevel, saveFormattedFiles, _, filesToFormat, reportPath) = options; var logWorkspaceWarnings = logLevel == LogLevel.Trace; logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, workspaceFilePath)); @@ -72,7 +74,7 @@ public static async Task FormatWorkspaceAsync( var formatterRanMS = workspaceStopwatch.ElapsedMilliseconds - loadWorkspaceMS - determineFilesMS; logger.LogTrace(Resources.Complete_in_0_ms, formatterRanMS); - var solutionChanges = formattedSolution.GetChanges(solution); + var solutionChanges = formattedSolution.Solution.GetChanges(solution); var filesFormatted = 0; foreach (var projectChanges in solutionChanges.GetProjectChanges()) @@ -87,12 +89,24 @@ public static async Task FormatWorkspaceAsync( var exitCode = 0; - if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution)) + if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution.Solution)) { logger.LogError(Resources.Failed_to_save_formatting_changes); exitCode = 1; } + if (exitCode == 0 && !string.IsNullOrWhiteSpace(reportPath)) + { + var reportName = "format-report.json"; + var reportFilePath = new StringBuilder(reportPath); + reportFilePath = reportPath.EndsWith('\\') ? reportFilePath.Append(reportName) : reportFilePath.Append($"\\{reportName}"); + + logger.LogInformation(Resources.Writing_formatting_report_to_0, reportFilePath); + var formattedFilesJson = JsonConvert.SerializeObject(formattedSolution.FormattedFiles, Newtonsoft.Json.Formatting.Indented); + + File.WriteAllText(reportFilePath.ToString(), formattedFilesJson); + } + logger.LogDebug(Resources.Formatted_0_of_1_files, filesFormatted, fileCount); logger.LogInformation(Resources.Format_complete_in_0_ms, workspaceStopwatch.ElapsedMilliseconds); @@ -187,18 +201,20 @@ private static void LogWorkspaceDiagnostics(ILogger logger, bool logWorkspaceWar } } - private static async Task RunCodeFormattersAsync( + private static async Task<(Solution Solution, List FormattedFiles)> RunCodeFormattersAsync( Solution solution, ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, FormatOptions options, ILogger logger, CancellationToken cancellationToken) { - var formattedSolution = solution; + var formattedSolution = (Solution: solution, FormattedFiles: new List()); foreach (var codeFormatter in s_codeFormatters) { - formattedSolution = await codeFormatter.FormatAsync(formattedSolution, formattableDocuments, options, logger, cancellationToken).ConfigureAwait(false); + var formatterResponse = await codeFormatter.FormatAsync(formattedSolution.Solution, formattableDocuments, options, logger, cancellationToken).ConfigureAwait(false); + formattedSolution.Solution = formatterResponse.Solution; + formattedSolution.FormattedFiles.AddRange(formatterResponse.FormattedFiles); } return formattedSolution; diff --git a/src/FileChange.cs b/src/FileChange.cs new file mode 100644 index 000000000000..96f1a4db2145 --- /dev/null +++ b/src/FileChange.cs @@ -0,0 +1,21 @@ +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Tools +{ + public class FileChange + { + public int LineNumber { get; set; } + + public int CharNumber { get; set; } + + public string FormatDescription { get; set; } + + public FileChange(LinePosition changePosition, string formatDescription) + { + // LinePosition is zero based so we need to increment to report numbers people expect. + LineNumber = changePosition.Line + 1; + CharNumber = changePosition.Character + 1; + FormatDescription = formatDescription; + } + } +} diff --git a/src/FormatOptions.cs b/src/FormatOptions.cs index 0c4a27a35809..ec2d2a8fbdf0 100644 --- a/src/FormatOptions.cs +++ b/src/FormatOptions.cs @@ -13,6 +13,7 @@ internal class FormatOptions public bool SaveFormattedFiles { get; } public bool ChangesAreErrors { get; } public ImmutableHashSet FilesToFormat { get; } + public string ReportPath { get; } public FormatOptions( string workspaceFilePath, @@ -20,7 +21,8 @@ public FormatOptions( LogLevel logLevel, bool saveFormattedFiles, bool changesAreErrors, - ImmutableHashSet filesToFormat) + ImmutableHashSet filesToFormat, + string reportPath) { WorkspaceFilePath = workspaceFilePath; WorkspaceType = workspaceType; @@ -28,6 +30,7 @@ public FormatOptions( SaveFormattedFiles = saveFormattedFiles; ChangesAreErrors = changesAreErrors; FilesToFormat = filesToFormat; + ReportPath = reportPath; } public void Deconstruct( @@ -36,7 +39,8 @@ public void Deconstruct( out LogLevel logLevel, out bool saveFormattedFiles, out bool changesAreErrors, - out ImmutableHashSet filesToFormat) + out ImmutableHashSet filesToFormat, + out string reportPath) { workspaceFilePath = WorkspaceFilePath; workspaceType = WorkspaceType; @@ -44,6 +48,7 @@ public void Deconstruct( saveFormattedFiles = SaveFormattedFiles; changesAreErrors = ChangesAreErrors; filesToFormat = FilesToFormat; + reportPath = ReportPath; } } } diff --git a/src/FormattedFile.cs b/src/FormattedFile.cs new file mode 100644 index 000000000000..12a2903c1902 --- /dev/null +++ b/src/FormattedFile.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Microsoft.CodeAnalysis.Tools +{ + public class FormattedFile + { + public DocumentId DocumentId { get; set; } + + public string FileName { get; set; } + + public string FilePath { get; set; } + + public IEnumerable FileChanges { get; set; } + + public FormattedFile(Document document, IEnumerable fileChanges) + { + DocumentId = document.Id; + FileName = document.Name; + FilePath = document.FilePath; + FileChanges = fileChanges; + } + } +} diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index 279ba2fc6943..b17113d63ebf 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using System.Threading; @@ -21,7 +22,7 @@ internal abstract class DocumentFormatter : ICodeFormatter /// /// Applies formatting and returns a formatted /// - public async Task FormatAsync( + public async Task<(Solution Solution, List FormattedFiles)> FormatAsync( Solution solution, ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, FormatOptions formatOptions, @@ -89,20 +90,21 @@ protected abstract Task FormatFileAsync( /// /// Applies the changed to each formatted . /// - private async Task ApplyFileChangesAsync( - Solution solution, + private async Task<(Solution Solution, List FormattedFiles)> ApplyFileChangesAsync( + Solution solution, ImmutableArray<(Document, Task<(SourceText originalText, SourceText formattedText)>)> formattedDocuments, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { + var formattedFiles = new List(); var formattedSolution = solution; foreach (var (document, formatTask) in formattedDocuments) { if (cancellationToken.IsCancellationRequested) { - return formattedSolution; + return (formattedSolution, formattedFiles); } var (originalText, formattedText) = await formatTask.ConfigureAwait(false); @@ -111,38 +113,47 @@ private async Task ApplyFileChangesAsync( continue; } - if (!formatOptions.SaveFormattedFiles || formatOptions.LogLevel == LogLevel.Trace) - { - // Log formatting changes as errors when we are doing a dry-run. - LogFormattingChanges(formatOptions.WorkspaceFilePath, document.FilePath, originalText, formattedText, formatOptions.ChangesAreErrors, logger); - } + var fileChanges = GetFileChanges(formatOptions, formatOptions.WorkspaceFilePath, document.FilePath, originalText, formattedText, formatOptions.ChangesAreErrors, logger); + formattedFiles.Add(new FormattedFile(document, fileChanges)); formattedSolution = formattedSolution.WithDocumentText(document.Id, formattedText, PreservationMode.PreserveIdentity); } - return formattedSolution; + return (formattedSolution, formattedFiles); } - private void LogFormattingChanges(string workspacePath, string filePath, SourceText originalText, SourceText formattedText, bool changesAreErrors, ILogger logger) + private IEnumerable GetFileChanges(FormatOptions formatOptions, string workspacePath, string filePath, SourceText originalText, SourceText formattedText, bool changesAreErrors, ILogger logger) { + var fileChanges = new List(); var workspaceFolder = Path.GetDirectoryName(workspacePath); var changes = formattedText.GetChangeRanges(originalText); foreach (var change in changes) { - // LinePosition is zero based so we need to increment to report numbers people expect. var changePosition = originalText.Lines.GetLinePosition(change.Span.Start); - var formatMessage = $"{Path.GetRelativePath(workspaceFolder, filePath)}({changePosition.Line + 1},{changePosition.Character + 1}): {FormatWarningDescription}"; + var fileChange = new FileChange(changePosition, FormatWarningDescription); + fileChanges.Add(fileChange); - if (changesAreErrors) - { - logger.LogError(formatMessage); - } - else + if (!formatOptions.SaveFormattedFiles || formatOptions.LogLevel == LogLevel.Trace) { - logger.LogWarning(formatMessage); + LogFormattingChanges(filePath, changesAreErrors, logger, workspaceFolder, fileChange); } } + + return fileChanges; + } + + private static void LogFormattingChanges(string filePath, bool changesAreErrors, ILogger logger, string workspaceFolder, FileChange fileChange) + { + var formatMessage = $"{Path.GetRelativePath(workspaceFolder, filePath)}({fileChange.LineNumber},{fileChange.CharNumber}): {fileChange.FormatDescription}"; + if (changesAreErrors) + { + logger.LogError(formatMessage); + } + else + { + logger.LogWarning(formatMessage); + } } } } diff --git a/src/Formatters/ICodeFormatter.cs b/src/Formatters/ICodeFormatter.cs index 85e301af9f51..1333471d4640 100644 --- a/src/Formatters/ICodeFormatter.cs +++ b/src/Formatters/ICodeFormatter.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; @@ -14,7 +15,7 @@ internal interface ICodeFormatter /// /// Applies formatting and returns a formatted . /// - Task FormatAsync( + Task<(Solution Solution, List FormattedFiles)> FormatAsync( Solution solution, ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, FormatOptions options, diff --git a/src/Program.cs b/src/Program.cs index 270b231b9e41..d3bc20acabab 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -36,13 +36,14 @@ private static async Task Main(string[] args) .AddOption(new Option(new[] { "--dry-run" }, Resources.Format_files_but_do_not_save_changes_to_disk, new Argument())) .AddOption(new Option(new[] { "--check" }, Resources.Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted, new Argument())) .AddOption(new Option(new[] { "--files" }, Resources.A_comma_separated_list_of_relative_file_paths_to_format_All_files_are_formatted_if_empty, new Argument(() => null))) + .AddOption(new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory, new Argument(() => null))) .UseVersionOption() .Build(); return await parser.InvokeAsync(args).ConfigureAwait(false); } - public static async Task Run(string folder, string workspace, string verbosity, bool dryRun, bool check, string files, IConsole console = null) + public static async Task Run(string folder, string workspace, string verbosity, bool dryRun, bool check, string files, string report, IConsole console = null) { // Setup logging. var serviceCollection = new ServiceCollection(); @@ -120,7 +121,8 @@ public static async Task Run(string folder, string workspace, string verbos logLevel, saveFormattedFiles: !dryRun, changesAreErrors: check, - filesToFormat); + filesToFormat, + reportPath: report); var formatResult = await CodeFormatter.FormatWorkspaceAsync( formatOptions, diff --git a/src/Resources.resx b/src/Resources.resx index a7331817aa39..046c06dfe0f1 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -210,4 +210,10 @@ Cannot specify both folder and workspace options. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + + Writing formatting report to: '{0}'. + \ No newline at end of file diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 0db3144261da..34684397f84c 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -29,6 +29,7 @@ + @@ -45,7 +46,7 @@ - + diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 1ec437e41c82..8a4995885ef7 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index b356ce8fd4a5..46e5e82748ab 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 8b37b5fcd2b3..d1b8fefe94be 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 5345117728a3..9a68ffd1279f 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index d472a97f7fdb..c4fbe23b3a4b 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 53f5fe83e05a..72ac5cee2e6c 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index a7ef72901607..edef42c2be6b 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 069c24b4fe1a..73b8d53b4a5d 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 26e4a79595b6..c65b367b7837 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 5192bf177992..df65c24acb42 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index fcf937673db6..91453c504773 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index c978ddb51c79..72a3de9d47ab 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 05476acc1666..145ff3a05884 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -7,6 +7,11 @@ A comma separated list of relative file paths to format. All files are formatted if empty. + + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + Accepts a file path, which if provided, will produce a `format-report.json` file in the given directory. + + Add final newline. Add final newline. @@ -157,6 +162,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + Writing formatting report to: '{0}'. + Writing formatting report to: '{0}'. + + \ No newline at end of file diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index fc61b206140c..1bd6acf41365 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -260,7 +260,8 @@ public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEn LogLevel.Trace, saveFormattedFiles: false, changesAreErrors: false, - filesToFormat); + filesToFormat, + reportPath: string.Empty); var formatResult = await CodeFormatter.FormatWorkspaceAsync(formatOptions, logger, CancellationToken.None); Assert.Equal(expectedExitCode, formatResult.ExitCode); diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 436aa720ceb5..41dce7c75bc2 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -91,16 +91,25 @@ private protected async Task TestAsync(string testCode, string expec logLevel: LogLevel.Trace, saveFormattedFiles: false, changesAreErrors: false, - filesToFormat: ImmutableHashSet.Create(document.FilePath)); + filesToFormat: ImmutableHashSet.Create(document.FilePath), + reportPath: string.Empty); var filesToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); var formattedSolution = await Formatter.FormatAsync(solution, filesToFormat, formatOptions, Logger, default); - var formattedDocument = GetOnlyDocument(formattedSolution); + var formattedDocument = GetOnlyDocument(formattedSolution.Solution); var formattedText = await formattedDocument.GetTextAsync(); Assert.Equal(expectedCode, formattedText.ToString()); + if (testCode != expectedCode) + { + var formattedFile = formattedSolution.FormattedFiles.Single(); + Assert.Equal(formattedDocument.Name, formattedFile.FileName); + Assert.Equal(formattedDocument.FilePath, formattedFile.FilePath); + Assert.Equal(formattedDocument.Id, formattedFile.DocumentId); + } + return formattedText; } From 541d7a8dd0dc721cc9bba2d52ff359f044bbd70c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2020 13:38:20 +0000 Subject: [PATCH 0798/2702] Update dependencies from https://github.com/dotnet/arcade build 20200121.3 (#497) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20071.3 --- eng/Version.Details.xml | 4 ++-- eng/common/cross/build-rootfs.sh | 19 +++++++++++++++---- global.json | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 31062f11f41e..c9913f435401 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - ebc71292545adda514c1e6a5657cd9ab753240bc + e06e2807048b6bc7b3549b401a1833bed3bcd8c3 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 8d61377a871c..a23f895ba1c3 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -25,8 +25,9 @@ __UbuntuPackages="build-essential" __AlpinePackages="alpine-base" __AlpinePackages+=" build-base" __AlpinePackages+=" linux-headers" -__AlpinePackages+=" lldb-dev" -__AlpinePackages+=" llvm-dev" +__AlpinePackagesEdgeTesting=" lldb-dev" +__AlpinePackagesEdgeMain=" llvm9-libs" +__AlpinePackagesEdgeMain+=" python3" # symlinks fixer __UbuntuPackages+=" symlinks" @@ -199,13 +200,23 @@ if [[ "$__LinuxCodeName" == "alpine" ]]; then tar -xf $__ApkToolsDir/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -C $__ApkToolsDir mkdir -p $__RootfsDir/usr/bin cp -v /usr/bin/qemu-$__QEMUArch-static $__RootfsDir/usr/bin + $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/main \ -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/community \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/main \ -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ add $__AlpinePackages + + $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ + -X http://dl-cdn.alpinelinux.org/alpine/edge/main \ + -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ + add $__AlpinePackagesEdgeMain + + $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ + -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ + add $__AlpinePackagesEdgeTesting + rm -r $__ApkToolsDir elif [[ -n $__LinuxCodeName ]]; then qemu-debootstrap --arch $__UbuntuArch $__LinuxCodeName $__RootfsDir $__UbuntuRepo diff --git a/global.json b/global.json index 51eb1928cf93..eef1d536f24c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20068.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20071.3" } } From 3610852a2afbfd441f9640b927b4f6f6869ac70b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2020 13:34:06 +0000 Subject: [PATCH 0799/2702] Update dependencies from https://github.com/dotnet/arcade build 20200122.3 (#498) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20072.3 --- eng/Version.Details.xml | 4 ++-- eng/common/enable-cross-org-publishing.ps1 | 9 +++++++-- global.json | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c9913f435401..cb471ced8b55 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - e06e2807048b6bc7b3549b401a1833bed3bcd8c3 + 0fb5c992a80a6fb52bfb1d2b726f75157c1ce210 diff --git a/eng/common/enable-cross-org-publishing.ps1 b/eng/common/enable-cross-org-publishing.ps1 index efa26621db04..da09da4f1fc4 100644 --- a/eng/common/enable-cross-org-publishing.ps1 +++ b/eng/common/enable-cross-org-publishing.ps1 @@ -2,7 +2,12 @@ param( [string] $token ) + . $PSScriptRoot\pipeline-logging-functions.ps1 -Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token -Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/' +# Write-PipelineSetVariable will no-op if a variable named $ci is not defined +# Since this script is only ever called in AzDO builds, just universally set it +$ci = $true + +Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/' -IsMultiJobVariable $false diff --git a/global.json b/global.json index eef1d536f24c..8dedc3d1e558 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20071.3" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20072.3" } } From 9390e592b8dba57a5a4a07a9a06074efb2653148 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2020 13:41:28 +0000 Subject: [PATCH 0800/2702] Update dependencies from https://github.com/dotnet/arcade build 20200123.17 (#499) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20073.17 --- eng/Version.Details.xml | 4 +-- .../templates/post-build/post-build.yml | 26 +++++++++++++++++++ global.json | 2 +- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cb471ced8b55..3b09bca5d8ef 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 0fb5c992a80a6fb52bfb1d2b726f75157c1ce210 + 82031ff8d9a40204c774fcc1b0f93ace906cee88 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 8a8d84f20265..33295ba125bb 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -221,3 +221,29 @@ stages: transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'Net_Eng_Services_Int_Publish' + channelName: '.NET Eng Services - Int' + channelId: 678 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' + +- template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'Net_Eng_Services_Prod_Publish' + channelName: '.NET Eng Services - Prod' + channelId: 679 + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' diff --git a/global.json b/global.json index 8dedc3d1e558..4e46bbfe1bfa 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20072.3" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20073.17" } } From 9b921257370ff230c221a7672bd58340473e3536 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 25 Jan 2020 13:41:06 +0000 Subject: [PATCH 0801/2702] Update dependencies from https://github.com/dotnet/arcade build 20200124.6 (#501) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20074.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3b09bca5d8ef..137458160504 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 82031ff8d9a40204c774fcc1b0f93ace906cee88 + 841c83d8a5b8d8a6bd427f6798b086780138aa9a diff --git a/global.json b/global.json index 4e46bbfe1bfa..265a70646bdf 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20073.17" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20074.6" } } From 9d906c9a0dd4cb544780e6ec787adca852764044 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 26 Jan 2020 13:39:54 +0000 Subject: [PATCH 0802/2702] Update dependencies from https://github.com/dotnet/arcade build 20200125.3 (#502) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20075.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 137458160504..be805b37f8f6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 841c83d8a5b8d8a6bd427f6798b086780138aa9a + 0fcbdf1444ade7228ae0d179bb23d08ea3df13eb diff --git a/global.json b/global.json index 265a70646bdf..fa853a8f4b60 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20074.6" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20075.3" } } From b1d821afd21903653bafa36a3acdd96a0cddec4c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2020 13:51:56 +0000 Subject: [PATCH 0803/2702] Update dependencies from https://github.com/dotnet/arcade build 20200126.3 (#503) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20076.3 --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 3 +++ global.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index be805b37f8f6..62e62d1bf785 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 0fcbdf1444ade7228ae0d179bb23d08ea3df13eb + cc8fe69635c7c6e791c87540851aea75946945fa diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index d3a432878e21..23a3fd53d7a5 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -655,6 +655,9 @@ Write-PipelineSetVariable -Name 'Artifacts.Log' -Value $LogDir Write-PipelineSetVariable -Name 'TEMP' -Value $TempDir Write-PipelineSetVariable -Name 'TMP' -Value $TempDir +$env:TEMP=$TempDir +$env:TMP=$TempDir + # Import custom tools configuration, if present in the repo. # Note: Import in global scope so that the script set top-level variables without qualification. if (!$disableConfigureToolsetImport) { diff --git a/global.json b/global.json index fa853a8f4b60..3d6b07d1938d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20075.3" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20076.3" } } From 8110c2bef99dff1d437e7093f8d90d95e9584560 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 27 Jan 2020 10:00:01 -0800 Subject: [PATCH 0804/2702] Bump the version to 3.2 --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index acdeea81aa60..292cdba5aa92 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,7 +2,7 @@ 3 - 1 + 2 From eaf04f20c0e42bce690d355cc8326e265d529efe Mon Sep 17 00:00:00 2001 From: jpshrader <46694288+jpshrader@users.noreply.github.com> Date: Tue, 28 Jan 2020 01:02:40 -0500 Subject: [PATCH 0805/2702] PR feedback 1. Add unit tests for Formatted Files behaviour 2. Use System.Text.Json 3. Path.Combine/StringBuilder and pathing options 4. Pass ref to list instead of returning tuple --- README.md | 2 + eng/Versions.props | 2 +- src/CodeFormatter.cs | 52 +++++++++++------ src/FileChange.cs | 6 +- src/FormattedFile.cs | 8 +-- src/Formatters/DocumentFormatter.cs | 17 +++--- src/Formatters/ICodeFormatter.cs | 5 +- src/dotnet-format.csproj | 2 +- tests/Formatters/AbstractFormatterTests.cs | 14 +---- tests/Formatters/FormattedFilesTests.cs | 68 ++++++++++++++++++++++ 10 files changed, 129 insertions(+), 47 deletions(-) create mode 100644 tests/Formatters/FormattedFilesTests.cs diff --git a/README.md b/README.md index dcc20622b80f..5fcdde9fc5b7 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Options: --check Terminates with a non-zero exit code if any files were formatted. --files A comma separated list of relative file paths to format. All files are formatted if empty. --version Display version information + --report Writes a json file to the given directory. Defaults to 'format-report.json' if no filename given. ``` Add `format` after `dotnet` and before the command arguments that you want to run: @@ -62,6 +63,7 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | dotnet **format** -v diag | Formats with very verbose logging. | | dotnet **format** --files Programs.cs,Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | | dotnet **format** --check --dry-run | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | +| dotnet **format** --report <report-path> | Formats and saves a json report file to the given directory. | ### How To Uninstall diff --git a/eng/Versions.props b/eng/Versions.props index a80e7c27cc4a..7d40e5a2fde6 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -23,7 +23,7 @@ 1.1.20180503.2 2.9.6 $(MicrosoftNETCoreCompilersPackageVersion) - 12.0.3 + 4.7.0 true diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 42d7f5f67279..f680c5fe56dd 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -6,17 +6,16 @@ using System.Diagnostics; using System.IO; using System.Linq; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.MSBuild; using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.CodeAnalysis.Tools.Formatters; +using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.CodeAnalysis.Tools.Workspaces; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.CodingConventions; -using System.Text; -using Newtonsoft.Json; namespace Microsoft.CodeAnalysis.Tools { @@ -68,13 +67,14 @@ public static async Task FormatWorkspaceAsync( logger.LogTrace(Resources.Running_formatters); + var formattedFiles = new List(); var formattedSolution = await RunCodeFormattersAsync( - solution, formatableFiles, options, logger, cancellationToken).ConfigureAwait(false); + solution, formatableFiles, options, logger, cancellationToken, formattedFiles).ConfigureAwait(false); var formatterRanMS = workspaceStopwatch.ElapsedMilliseconds - loadWorkspaceMS - determineFilesMS; logger.LogTrace(Resources.Complete_in_0_ms, formatterRanMS); - var solutionChanges = formattedSolution.Solution.GetChanges(solution); + var solutionChanges = formattedSolution.GetChanges(solution); var filesFormatted = 0; foreach (var projectChanges in solutionChanges.GetProjectChanges()) @@ -89,7 +89,7 @@ public static async Task FormatWorkspaceAsync( var exitCode = 0; - if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution.Solution)) + if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution)) { logger.LogError(Resources.Failed_to_save_formatting_changes); exitCode = 1; @@ -97,14 +97,16 @@ public static async Task FormatWorkspaceAsync( if (exitCode == 0 && !string.IsNullOrWhiteSpace(reportPath)) { - var reportName = "format-report.json"; - var reportFilePath = new StringBuilder(reportPath); - reportFilePath = reportPath.EndsWith('\\') ? reportFilePath.Append(reportName) : reportFilePath.Append($"\\{reportName}"); + var reportFilePath = GetReportFilePath(reportPath); logger.LogInformation(Resources.Writing_formatting_report_to_0, reportFilePath); - var formattedFilesJson = JsonConvert.SerializeObject(formattedSolution.FormattedFiles, Newtonsoft.Json.Formatting.Indented); + var seralizerOptions = new JsonSerializerOptions + { + WriteIndented = true + }; + var formattedFilesJson = JsonSerializer.Serialize(formattedFiles, seralizerOptions); - File.WriteAllText(reportFilePath.ToString(), formattedFilesJson); + File.WriteAllText(reportFilePath, formattedFilesJson); } logger.LogDebug(Resources.Formatted_0_of_1_files, filesFormatted, fileCount); @@ -115,6 +117,23 @@ public static async Task FormatWorkspaceAsync( } } + private static string GetReportFilePath(string reportPath) + { + var defaultReportName = "format-report.json"; + if (reportPath.EndsWith(".json")) + { + return reportPath; + } + else if (reportPath == ".") + { + return Path.Combine(Environment.CurrentDirectory, defaultReportName); + } + else + { + return Path.Combine(reportPath, defaultReportName); + } + } + private static async Task OpenWorkspaceAsync( string workspacePath, WorkspaceType workspaceType, @@ -201,20 +220,19 @@ private static void LogWorkspaceDiagnostics(ILogger logger, bool logWorkspaceWar } } - private static async Task<(Solution Solution, List FormattedFiles)> RunCodeFormattersAsync( + private static async Task RunCodeFormattersAsync( Solution solution, ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, FormatOptions options, ILogger logger, - CancellationToken cancellationToken) + CancellationToken cancellationToken, + List formattedFiles) { - var formattedSolution = (Solution: solution, FormattedFiles: new List()); + var formattedSolution = solution; foreach (var codeFormatter in s_codeFormatters) { - var formatterResponse = await codeFormatter.FormatAsync(formattedSolution.Solution, formattableDocuments, options, logger, cancellationToken).ConfigureAwait(false); - formattedSolution.Solution = formatterResponse.Solution; - formattedSolution.FormattedFiles.AddRange(formatterResponse.FormattedFiles); + formattedSolution = await codeFormatter.FormatAsync(formattedSolution, formattableDocuments, options, logger, cancellationToken, formattedFiles).ConfigureAwait(false); } return formattedSolution; diff --git a/src/FileChange.cs b/src/FileChange.cs index 96f1a4db2145..d149ee224080 100644 --- a/src/FileChange.cs +++ b/src/FileChange.cs @@ -4,11 +4,11 @@ namespace Microsoft.CodeAnalysis.Tools { public class FileChange { - public int LineNumber { get; set; } + public int LineNumber { get; } - public int CharNumber { get; set; } + public int CharNumber { get; } - public string FormatDescription { get; set; } + public string FormatDescription { get; } public FileChange(LinePosition changePosition, string formatDescription) { diff --git a/src/FormattedFile.cs b/src/FormattedFile.cs index 12a2903c1902..b68a88ccaf50 100644 --- a/src/FormattedFile.cs +++ b/src/FormattedFile.cs @@ -4,13 +4,13 @@ namespace Microsoft.CodeAnalysis.Tools { public class FormattedFile { - public DocumentId DocumentId { get; set; } + public DocumentId DocumentId { get; } - public string FileName { get; set; } + public string FileName { get; } - public string FilePath { get; set; } + public string FilePath { get; } - public IEnumerable FileChanges { get; set; } + public IEnumerable FileChanges { get; } public FormattedFile(Document document, IEnumerable fileChanges) { diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index b17113d63ebf..9e5ef1883b1e 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -22,15 +22,16 @@ internal abstract class DocumentFormatter : ICodeFormatter /// /// Applies formatting and returns a formatted /// - public async Task<(Solution Solution, List FormattedFiles)> FormatAsync( + public async Task FormatAsync( Solution solution, ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, FormatOptions formatOptions, ILogger logger, - CancellationToken cancellationToken) + CancellationToken cancellationToken, + List formattedFiles) { var formattedDocuments = FormatFiles(solution, formattableDocuments, formatOptions, logger, cancellationToken); - return await ApplyFileChangesAsync(solution, formattedDocuments, formatOptions, logger, cancellationToken).ConfigureAwait(false); + return await ApplyFileChangesAsync(solution, formattedDocuments, formatOptions, logger, cancellationToken, formattedFiles).ConfigureAwait(false); } /// @@ -90,21 +91,21 @@ protected abstract Task FormatFileAsync( /// /// Applies the changed to each formatted . /// - private async Task<(Solution Solution, List FormattedFiles)> ApplyFileChangesAsync( + private async Task ApplyFileChangesAsync( Solution solution, ImmutableArray<(Document, Task<(SourceText originalText, SourceText formattedText)>)> formattedDocuments, FormatOptions formatOptions, ILogger logger, - CancellationToken cancellationToken) + CancellationToken cancellationToken, + List formattedFiles) { - var formattedFiles = new List(); var formattedSolution = solution; foreach (var (document, formatTask) in formattedDocuments) { if (cancellationToken.IsCancellationRequested) { - return (formattedSolution, formattedFiles); + return formattedSolution; } var (originalText, formattedText) = await formatTask.ConfigureAwait(false); @@ -119,7 +120,7 @@ protected abstract Task FormatFileAsync( formattedSolution = formattedSolution.WithDocumentText(document.Id, formattedText, PreservationMode.PreserveIdentity); } - return (formattedSolution, formattedFiles); + return formattedSolution; } private IEnumerable GetFileChanges(FormatOptions formatOptions, string workspacePath, string filePath, SourceText originalText, SourceText formattedText, bool changesAreErrors, ILogger logger) diff --git a/src/Formatters/ICodeFormatter.cs b/src/Formatters/ICodeFormatter.cs index 1333471d4640..f5485cad276b 100644 --- a/src/Formatters/ICodeFormatter.cs +++ b/src/Formatters/ICodeFormatter.cs @@ -15,11 +15,12 @@ internal interface ICodeFormatter /// /// Applies formatting and returns a formatted . /// - Task<(Solution Solution, List FormattedFiles)> FormatAsync( + Task FormatAsync( Solution solution, ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, FormatOptions options, ILogger logger, - CancellationToken cancellationToken); + CancellationToken cancellationToken, + List formattedFiles); } } diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 34684397f84c..2117266fc2b6 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -29,7 +29,6 @@ - @@ -38,6 +37,7 @@ + diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 41dce7c75bc2..7b39065c419e 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -96,20 +96,12 @@ private protected async Task TestAsync(string testCode, string expec var filesToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); - var formattedSolution = await Formatter.FormatAsync(solution, filesToFormat, formatOptions, Logger, default); - var formattedDocument = GetOnlyDocument(formattedSolution.Solution); + var formattedSolution = await Formatter.FormatAsync(solution, filesToFormat, formatOptions, Logger, default, new List()); + var formattedDocument = GetOnlyDocument(formattedSolution); var formattedText = await formattedDocument.GetTextAsync(); Assert.Equal(expectedCode, formattedText.ToString()); - if (testCode != expectedCode) - { - var formattedFile = formattedSolution.FormattedFiles.Single(); - Assert.Equal(formattedDocument.Name, formattedFile.FileName); - Assert.Equal(formattedDocument.FilePath, formattedFile.FilePath); - Assert.Equal(formattedDocument.Id, formattedFile.DocumentId); - } - return formattedText; } @@ -160,7 +152,7 @@ private protected async Task TestAsync(string testCode, string expec /// Additional documents to include in the project. /// Additional metadata references to include in the project. /// A solution containing a project with the specified sources and additional files. - private Solution GetSolution((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences) + private protected Solution GetSolution((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences) { var project = CreateProject(sources, additionalFiles, additionalMetadataReferences, Language); return project.Solution; diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs new file mode 100644 index 000000000000..83cebd328cd6 --- /dev/null +++ b/tests/Formatters/FormattedFilesTests.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Text; +using Microsoft.CodeAnalysis.Tools.Formatters; +using Microsoft.CodeAnalysis.Tools.Tests.Utilities; +using Microsoft.Extensions.Logging; +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters +{ + public class FormattedFilesTests : CSharpFormatterTests + { + private protected override ICodeFormatter Formatter => new FinalNewlineFormatter(); + + [Fact] + public async Task ReturnsItem_WhenFileFormatted() + { + var testCode = "class C\n{\n}"; + + var result = await TestFormattedFiles(testCode); + + Assert.Single(result); + } + + [Fact] + public async Task ReturnsEmptyList_WhenNoFilesFormatted() + { + var testCode = "class C\n{\n}\n"; + + var result = await TestFormattedFiles(testCode); + + Assert.Empty(result); + } + + private async Task> TestFormattedFiles(string testCode) + { + var text = SourceText.From(testCode, Encoding.UTF8); + TestState.Sources.Add(text); + + var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray()); + var project = solution.Projects.Single(); + var document = project.Documents.Single(); + var formatOptions = new FormatOptions( + workspaceFilePath: project.FilePath, + workspaceType: WorkspaceType.Folder, + logLevel: LogLevel.Trace, + saveFormattedFiles: false, + changesAreErrors: false, + filesToFormat: ImmutableHashSet.Create(document.FilePath), + reportPath: string.Empty); + var editorConfig = new Dictionary() + { + ["insert_final_newline"] = "true", + ["end_of_line"] = "lf", + }; + + var filesToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); + + var formattedFiles = new List(); + await Formatter.FormatAsync(solution, filesToFormat, formatOptions, new TestLogger(), default, formattedFiles); + + return formattedFiles; + } + } +} From 02eecde19e2da928d754d4eb7b9523eb4b226688 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 28 Jan 2020 19:03:24 +0000 Subject: [PATCH 0806/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200128.4 - Microsoft.NETCore.Compilers - 3.5.0-beta3-20078-04 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 62e62d1bf785..30795132657d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 82f2e2541478e239dc4b04f231e90dc2b3dcb422 + 72769efbac95288c92689d0a6d64c5f75cfca70e diff --git a/eng/Versions.props b/eng/Versions.props index 292cdba5aa92..e829f98c402d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.4.0-beta4-19569-03 + 3.5.0-beta3-20078-04 - 3.5.0-beta3-20078-04 + 3.5.0-beta3-20079-02 - 3.5.0-beta3-20079-02 + 3.5.0-beta3-20081-01 - 3.5.0-beta3-20081-01 + 3.5.0-beta3-20081-07 - 3.5.0-beta3-20081-07 + 3.6.0-beta1-20105-01 - 3.6.0-beta1-20105-01 + 3.6.0-beta1-20110-05 - 3.6.0-beta1-20110-05 + 3.6.0-beta1-20111-06 @@ -174,8 +174,8 @@ Terminates with a non-zero exit code if any files were formatted. - - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. Formatted code file '{0}'. @@ -217,6 +217,6 @@ Writing formatting report to: '{0}'. - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. \ No newline at end of file diff --git a/src/Workspaces/FolderWorkspace.cs b/src/Workspaces/FolderWorkspace.cs index 1f8a068ac8dc..815fbda5bb0e 100644 --- a/src/Workspaces/FolderWorkspace.cs +++ b/src/Workspaces/FolderWorkspace.cs @@ -32,7 +32,7 @@ public static FolderWorkspace Create(HostServices hostServices) return new FolderWorkspace(hostServices); } - public async Task OpenFolder(string folderPath, ImmutableHashSet filesToInclude, CancellationToken cancellationToken) + public async Task OpenFolder(string folderPath, ImmutableHashSet pathsToInclude, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(folderPath) || !Directory.Exists(folderPath)) { @@ -41,7 +41,7 @@ public async Task OpenFolder(string folderPath, ImmutableHashSet ProjectLoaders => ImmutableArray.Create(new CSharpProjectLoader(), new VisualBasicProjectLoader()); - public static async Task LoadSolutionInfoAsync(string folderPath, ImmutableHashSet filesToInclude, CancellationToken cancellationToken) + public static async Task LoadSolutionInfoAsync(string folderPath, ImmutableHashSet pathsToInclude, CancellationToken cancellationToken) { var absoluteFolderPath = Path.IsPathFullyQualified(folderPath) ? folderPath @@ -25,7 +25,7 @@ public static async Task LoadSolutionInfoAsync(string folderPath, // Create projects for each of the supported languages. foreach (var loader in ProjectLoaders) { - var projectInfo = await loader.LoadProjectInfoAsync(folderPath, filesToInclude, cancellationToken); + var projectInfo = await loader.LoadProjectInfoAsync(folderPath, pathsToInclude, cancellationToken); if (projectInfo is null) { continue; diff --git a/src/Workspaces/FolderWorkspace_ProjectLoader.cs b/src/Workspaces/FolderWorkspace_ProjectLoader.cs index 8ed30b1d756e..6bfd8674d19c 100644 --- a/src/Workspaces/FolderWorkspace_ProjectLoader.cs +++ b/src/Workspaces/FolderWorkspace_ProjectLoader.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using System.IO; using System.Linq; @@ -16,11 +17,11 @@ private abstract class ProjectLoader public abstract string FileExtension { get; } public virtual string ProjectName => $"{Language}{FileExtension}proj"; - public virtual async Task LoadProjectInfoAsync(string folderPath, ImmutableHashSet filesToInclude, CancellationToken cancellationToken) + public virtual async Task LoadProjectInfoAsync(string folderPath, ImmutableHashSet pathsToInclude, CancellationToken cancellationToken) { var projectId = ProjectId.CreateNewId(debugName: folderPath); - var documents = await LoadDocumentInfosAsync(projectId, folderPath, FileExtension, filesToInclude); + var documents = await LoadDocumentInfosAsync(projectId, folderPath, FileExtension, pathsToInclude); if (documents.IsDefaultOrEmpty) { return null; @@ -36,19 +37,15 @@ public virtual async Task LoadProjectInfoAsync(string folderPath, I documents: documents); } - private static Task> LoadDocumentInfosAsync(ProjectId projectId, string folderPath, string fileExtension, ImmutableHashSet filesToInclude) + private static Task> LoadDocumentInfosAsync(ProjectId projectId, string folderPath, string fileExtension, ImmutableHashSet pathsToInclude) { return Task.Run(() => { - string[] filePaths; - if (filesToInclude.Count == 0) + var filePaths = Directory.GetFiles(folderPath, $"*{fileExtension}", SearchOption.AllDirectories); + if (!pathsToInclude.IsEmpty) { - filePaths = Directory.GetFiles(folderPath, $"*{fileExtension}", SearchOption.AllDirectories); - } - else - { - filePaths = filesToInclude.Where( - filePath => filePath.EndsWith(fileExtension) && File.Exists(filePath)).ToArray(); + filePaths = filePaths.Where(filePath => + pathsToInclude.Any(path => filePath.StartsWith(path, StringComparison.OrdinalIgnoreCase))).ToArray(); } if (filePaths.Length == 0) diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index cb119b35747b..48aafa99bef1 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 15076bf91e0d..5bc1d9370286 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index ee02effb0d8b..c4eda7fc10cf 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 5d21567927fc..4c8d65dd7f83 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 08f6bc534b4c..0a9060b6f7b2 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index b753caf1288d..24e00eb24a2c 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index ff7ed4adb248..5e384cc60d99 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 8088e93b180d..cfea55f73379 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index f3f7f59b3e7a..295e1d078438 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 3e44041d7ab9..d406ace10c72 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 5f759d0f74ec..aeb17ea83a69 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 3be21a3fe0bf..c7c969c98615 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 0574ba5e5c14..2d8f1a6ab79c 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -3,13 +3,13 @@ - A comma separated list of relative file or folder paths to exclude from formatting - A comma separated list of relative file or folder paths to exclude from formatting + A comma separated list of relative file or folder paths to exclude from formatting. + A comma separated list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file paths to format. All files are formatted if empty. - A comma separated list of relative file paths to format. All files are formatted if empty. + + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 465a562b9c56..027e610a4e81 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.Diagnostics; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -44,7 +43,7 @@ public async Task NoFilesFormattedInFormattedProject() { await TestFormatWorkspaceAsync( FormattedProjectFilePath, - files: EmptyFilesList, + include: EmptyFilesList, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 0, @@ -56,7 +55,7 @@ public async Task NoFilesFormattedInFormattedSolution() { await TestFormatWorkspaceAsync( FormattedSolutionFilePath, - files: EmptyFilesList, + include: EmptyFilesList, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 0, @@ -68,7 +67,7 @@ public async Task FilesFormattedInUnformattedProject() { await TestFormatWorkspaceAsync( UnformattedProjectFilePath, - files: EmptyFilesList, + include: EmptyFilesList, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 2, @@ -80,21 +79,20 @@ public async Task FilesFormattedInUnformattedSolution() { await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, - files: EmptyFilesList, + include: EmptyFilesList, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 2, expectedFileCount: 5); } - [Fact] public async Task FilesFormattedInUnformattedProjectFolder() { // Since the code files are beneath the project folder, files are found and formatted. await TestFormatWorkspaceAsync( Path.GetDirectoryName(UnformattedProjectFilePath), - files: EmptyFilesList, + include: EmptyFilesList, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 2, @@ -107,7 +105,7 @@ public async Task NoFilesFormattedInUnformattedSolutionFolder() // Since the code files are outside the solution folder, no files are found or formatted. await TestFormatWorkspaceAsync( Path.GetDirectoryName(UnformattedSolutionFilePath), - files: EmptyFilesList, + include: EmptyFilesList, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 0, @@ -119,7 +117,7 @@ public async Task FSharpProjectsDoNotCreateException() { var log = await TestFormatWorkspaceAsync( FSharpProjectFilePath, - files: EmptyFilesList, + include: EmptyFilesList, exclude: EmptyFilesList, expectedExitCode: 1, expectedFilesFormatted: 0, @@ -132,14 +130,28 @@ public async Task FSharpProjectsDoNotCreateException() Assert.Equal(match.Groups[1].Value, Path.GetFullPath(FSharpProjectFilePath)); } + [Fact] + public async Task OnlyFormatPathsFromList() + { + var include = new[] { UnformattedProjectPath }; + + await TestFormatWorkspaceAsync( + UnformattedProjectFilePath, + include, + exclude: EmptyFilesList, + expectedExitCode: 0, + expectedFilesFormatted: 2, + expectedFileCount: 5); + } + [Fact] public async Task OnlyFormatFilesFromList() { - var filesToFormat = new[] { UnformattedProgramFilePath }; + var include = new[] { UnformattedProgramFilePath }; await TestFormatWorkspaceAsync( UnformattedProjectFilePath, - filesToFormat, + include, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 1, @@ -149,11 +161,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task NoFilesFormattedWhenNotInList() { - var files = new[] { Path.Combine(UnformattedProjectPath, "does_not_exist.cs") }; + var include = new[] { Path.Combine(UnformattedProjectPath, "does_not_exist.cs") }; await TestFormatWorkspaceAsync( UnformattedProjectFilePath, - files, + include, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 0, @@ -163,11 +175,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task OnlyLogFormattedFiles() { - var files = new[] { UnformattedProgramFilePath }; + var include = new[] { UnformattedProgramFilePath }; var log = await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, - files, + include, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 1, @@ -185,7 +197,7 @@ public async Task FormatLocationsLoggedInUnformattedProject() { var log = await TestFormatWorkspaceAsync( UnformattedProjectFilePath, - files: EmptyFilesList, + include: EmptyFilesList, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 2, @@ -235,7 +247,7 @@ public async Task FormatLocationsNotLoggedInFormattedProject() { var log = await TestFormatWorkspaceAsync( FormattedProjectFilePath, - files: EmptyFilesList, + include: EmptyFilesList, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 0, @@ -250,12 +262,11 @@ public async Task FormatLocationsNotLoggedInFormattedProject() [Fact] public async Task LogFilesThatDontMatchExclude() { - var files = new[] { UnformattedProgramFilePath }; - var exclude = new[] { FormattedProjectPath }; + var include = new[] { UnformattedProgramFilePath }; var log = await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, - files, + include, exclude: EmptyFilesList, expectedExitCode: 0, expectedFilesFormatted: 1, @@ -275,7 +286,7 @@ public async Task IgnoreFileWhenListedInExcludeList() var log = await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, - files: files, + include: files, exclude: files, expectedExitCode: 0, expectedFilesFormatted: 0, @@ -295,7 +306,7 @@ public async Task IgnoreFileWhenContainingFolderListedInExcludeList() var log = await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, - files: files, + include: files, exclude: exclude, expectedExitCode: 0, expectedFilesFormatted: 0, @@ -307,7 +318,7 @@ public async Task IgnoreFileWhenContainingFolderListedInExcludeList() Assert.False(match.Success, log); } - public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEnumerable files, IEnumerable exclude, int expectedExitCode, int expectedFilesFormatted, int expectedFileCount) + public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEnumerable include, IEnumerable exclude, int expectedExitCode, int expectedFilesFormatted, int expectedFileCount) { var workspacePath = Path.GetFullPath(workspaceFilePath); @@ -323,8 +334,8 @@ public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEn : WorkspaceType.Project; } - var filesToFormat = files.Select(Path.GetFullPath).ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); - var filesToIgnore = exclude.Select(Path.GetFullPath).ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); + var pathsToInclude = include.Select(Path.GetFullPath).ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); + var pathsToExclude = exclude.Select(Path.GetFullPath).ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); var logger = new TestLogger(); var formatOptions = new FormatOptions( @@ -333,8 +344,8 @@ public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEn LogLevel.Trace, saveFormattedFiles: false, changesAreErrors: false, - filesToFormat, - filesToIgnore, + pathsToInclude, + pathsToExclude, reportPath: string.Empty); var formatResult = await CodeFormatter.FormatWorkspaceAsync(formatOptions, logger, CancellationToken.None); diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index b069f0e7996c..8e8064937163 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -91,13 +91,13 @@ private protected async Task TestAsync(string testCode, string expec logLevel: LogLevel.Trace, saveFormattedFiles: false, changesAreErrors: false, - filesToFormat: ImmutableHashSet.Create(document.FilePath), - filesToIgnore: ImmutableHashSet.Create(), + pathsToInclude: ImmutableHashSet.Create(document.FilePath), + pathsToExclude: ImmutableHashSet.Create(), reportPath: string.Empty); - var filesToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); + var pathsToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); - var formattedSolution = await Formatter.FormatAsync(solution, filesToFormat, formatOptions, Logger, new List(), default); + var formattedSolution = await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, Logger, new List(), default); var formattedDocument = GetOnlyDocument(formattedSolution); var formattedText = await formattedDocument.GetTextAsync(); diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index 782209fa1d23..d2ce6b4cb190 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -55,14 +55,14 @@ private async Task> TestFormattedFiles(string testCode) logLevel: LogLevel.Trace, saveFormattedFiles: false, changesAreErrors: false, - filesToFormat: ImmutableHashSet.Create(document.FilePath), - filesToIgnore: ImmutableHashSet.Create(), + pathsToInclude: ImmutableHashSet.Create(document.FilePath), + pathsToExclude: ImmutableHashSet.Create(), reportPath: string.Empty); - var filesToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); + var pathsToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); var formattedFiles = new List(); - await Formatter.FormatAsync(solution, filesToFormat, formatOptions, new TestLogger(), formattedFiles, default); + await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, new TestLogger(), formattedFiles, default); return formattedFiles; } diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 9808d1201b7b..b95a2aaf46ed 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -38,10 +38,10 @@ public void ExitCodeIsSameWithoutCheck() public void FilesFormattedDirectorySeparatorInsensitive() { var filePath = $"other_items{Path.DirectorySeparatorChar}OtherClass.cs"; - var files = Program.GetFiles(filePath, folder: null); + var files = Program.GetRootedPaths(filePath, folder: null); var filePathAlt = $"other_items{Path.AltDirectorySeparatorChar}OtherClass.cs"; - var filesAlt = Program.GetFiles(filePathAlt, folder: null); + var filesAlt = Program.GetRootedPaths(filePathAlt, folder: null); Assert.True(files.IsSubsetOf(filesAlt)); } From 8e4fe8cef7c7773010b1f38c5518cdb2dc8bfbc5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 12 Feb 2020 13:38:04 +0000 Subject: [PATCH 0842/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200212.1 (#535) - Microsoft.NETCore.Compilers - 3.6.0-1.20112.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c1c96a538bf2..dbe23545efde 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 8929f7e852b492ee9934d06e20ea0b6b1472d0aa + 658e26cedcaa1aa55e89a0d6fa5af502557086ab diff --git a/eng/Versions.props b/eng/Versions.props index 747d3621f7ea..31652da9f21b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.6.0-beta1-20111-06 + 3.6.0-1.20112.1 - 3.6.0-1.20112.1 + 3.6.0-1.20113.5 From c297b7e5a644e33648d9143434c6c620f9bc4dee Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 13 Feb 2020 09:43:48 -0800 Subject: [PATCH 0850/2702] Add what's new in 3.3 to readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 611ad13383b2..14fb93828460 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,12 @@ `dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](https://github.com/dotnet/format/wiki/Supported-.editorconfig-options). +### New in v3.3.111304 +- [Enhance --files option to support folder paths and add --include alias (533)](https://github.com/dotnet/format/pull/533) +- [format-500: Add `--exclude` option to ignore given files/folders (529)](https://github.com/dotnet/format/pull/529) +- [format-379: Add `--report` command line argument to export json format report to given directory (495)](https://github.com/dotnet/format/pull/495) +- [Update charset formatter to check for equivalent encodings (508)](https://github.com/dotnet/format/pull/508) + ### How To Install The `dotnet-format` nuget package is [published to nuget.org](https://www.nuget.org/packages/dotnet-format/). From 10b45a93f9694c807b5651e9644124912918afed Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Thu, 13 Feb 2020 09:48:32 -0800 Subject: [PATCH 0851/2702] moving to the docs folder --- Home.md => docs/Home.md | 0 .../Supported-.editorconfig-options.md | 0 .../Unsupported-Code-Style-options.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename Home.md => docs/Home.md (100%) rename Supported-.editorconfig-options.md => docs/Supported-.editorconfig-options.md (100%) rename Unsupported-Code-Style-options.md => docs/Unsupported-Code-Style-options.md (100%) diff --git a/Home.md b/docs/Home.md similarity index 100% rename from Home.md rename to docs/Home.md diff --git a/Supported-.editorconfig-options.md b/docs/Supported-.editorconfig-options.md similarity index 100% rename from Supported-.editorconfig-options.md rename to docs/Supported-.editorconfig-options.md diff --git a/Unsupported-Code-Style-options.md b/docs/Unsupported-Code-Style-options.md similarity index 100% rename from Unsupported-Code-Style-options.md rename to docs/Unsupported-Code-Style-options.md From 3df51e190340f422724205bf0beaf5ab0eb70615 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Thu, 13 Feb 2020 09:51:26 -0800 Subject: [PATCH 0852/2702] rename Home to Readme --- docs/{Home.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{Home.md => README.md} (100%) diff --git a/docs/Home.md b/docs/README.md similarity index 100% rename from docs/Home.md rename to docs/README.md From f642c85a78535abdc0db9196cbc817dd6ecb3f47 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 13 Feb 2020 11:25:12 -0800 Subject: [PATCH 0853/2702] Added changelog and updated docs --- CHANGELOG.md | 37 +++++++++++++++++++++++++ docs/README.md | 6 +++- docs/Supported-.editorconfig-options.md | 13 +++++---- 3 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000000..5d1a255f9ae0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,37 @@ +# Changelog +All changes to the project will be documented in this file. + +## [3.3.111304] - 2020-02-13 +[View Complete Diff of Changes](https://github.com/dotnet/format/compare/3ecea99de4bb82b724bf11134279b5aaf8dd1f2f...7c8f67a570f5fde6a247704733d6742f93c0fa48) +### Merged PRs: +- [Enhance --files option to support folder paths. Add --include alias. (533)](https://github.com/dotnet/format/pull/533) +- [format-500: Add `--exclude` option to ignore given files/folders (529)](https://github.com/dotnet/format/pull/529) +- [format-379: Add `--report` command line argument to export json format report to given directory (495)](https://github.com/dotnet/format/pull/495) +- [Update charset formatter to check for equivalent encodings (508)](https://github.com/dotnet/format/pull/508) + +## [3.2.107702] - 2020-01-27 +[View Complete Diff of Changes](https://github.com/dotnet/format/compare/256f37159dc60b29f76999749f57f4338324f102...3ecea99de4bb82b724bf11134279b5aaf8dd1f2f) +### Merged PRs: +- [Add FolderWorkspace and -f options to load files by folder (335)](https://github.com/dotnet/format/pull/335) +- [Add formatter for the charset .editorconfig option (330)](https://github.com/dotnet/format/pull/330) + +## [3.1.37601] - 2019-07-26 +[View Complete Diff of Changes](https://github.com/dotnet/format/compare/211cab024c37fdffa5955c5855f9d62a14703452...256f37159dc60b29f76999749f57f4338324f102) +### Merged PRs: +- [Add end_of_line formatter (169)](https://github.com/dotnet/format/pull/169) +- [Log formatting change details when in dry-run mode (249)](https://github.com/dotnet/format/pull/249) +- [Added final newline formatter (133)](https://github.com/dotnet/format/pull/133) +- [Check that code files excluded by .editorconfig are not formatted (130)](https://github.com/dotnet/format/pull/130) + +## [3.0.4] - 2019-04-02 +[View Complete Diff of Changes](https://github.com/dotnet/format/compare/658b525df6382ed33b20345ba5b037c8515c9a71...211cab024c37fdffa5955c5855f9d62a14703452) +### Merged PRs: +- [Added --files option (52)](https://github.com/dotnet/format/pull/52) +- [Add new CLI '--check' option (48)](https://github.com/dotnet/format/pull/48) +- [Avoiding exception when redirect stdout(#21) (23)](https://github.com/dotnet/format/pull/23) + +## [3.0.2] - 2019-02-28 +### Initial Release +- Partial support for core .editorconfig options +- Support for .NET whitespace formatting options +- Support for --dry-run option \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 9dfce6579be5..0752580db18e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1 +1,5 @@ -Welcome to the format wiki! +Welcome to the dotnet-format docs! +--- + +- [Supported .editorconfig options](./Supported-.editorconfig-options.md) +- [Unsupported Code Style options](./Unsupported-Code-Style-options.md) \ No newline at end of file diff --git a/docs/Supported-.editorconfig-options.md b/docs/Supported-.editorconfig-options.md index 13b0fd56c3c8..8e6514400bbd 100644 --- a/docs/Supported-.editorconfig-options.md +++ b/docs/Supported-.editorconfig-options.md @@ -1,9 +1,10 @@ -The dotnet-format global tool supports the following core set of EditorConfig properties: +The dotnet-format global tool supports the core set of EditorConfig properties: - indent_style - indent_size - tab_width - end_of_line +- charset - insert_final_newline - trim_trailing_whitespace - root @@ -17,10 +18,10 @@ Most of the rules for formatting conventions have the following format: You specify either `true` (prefer this style) or `false` (do not prefer this style). You do not specify a severity. For a few rules, instead of `true` or `false`, you specify other values to describe when and where to apply the rule. -## C# formatting settings +## C# formatting settings The formatting rules in this section apply only to C# code. -**Newline options** +**Newline options** These formatting rules concern the use of new lines to format code. - csharp_new_line_before_open_brace (default value: `all`) @@ -31,14 +32,14 @@ These formatting rules concern the use of new lines to format code. - csharp_new_line_before_members_in_anonymous_types (default value: `true`) - csharp_new_line_between_query_expression_clauses (default value: `true`) -**Indentation options** +**Indentation options** These formatting rules concern the use of indentation to format code. - csharp_indent_case_contents (default value: `true`) - csharp_indent_switch_labels (default value: `true`) - csharp_indent_labels (default value: `no_change`) -**Spacing options** +**Spacing options** These formatting rules concern the use of space characters to format code. - csharp_space_after_cast (default value: `false`) @@ -53,7 +54,7 @@ These formatting rules concern the use of space characters to format code. - csharp_space_between_method_call_name_and_opening_parenthesis (default value: `false`) - csharp_space_between_method_call_empty_parameter_list_parentheses (default value: `false`) -**Wrapping options** +**Wrapping options** These formatting rules concern the use of single lines versus separate lines for statements and code blocks. - csharp_preserve_single_line_statements (default value: `true`) From 682dae8dc14eb9b6dc7c391676c894a9e3488c9d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 13 Feb 2020 14:15:06 -0800 Subject: [PATCH 0854/2702] Bump version number to 3.4 for next release --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index c8bfd1408fcd..4bfffc588e2c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,7 +2,7 @@ 3 - 3 + 4 From 9a4cf3866aaf1b2a57bba04891686b78588dda17 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 13 Feb 2020 14:21:59 -0800 Subject: [PATCH 0855/2702] Make major version bump because breaking change to --dry-run --- eng/Versions.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 4bfffc588e2c..0d344d003e81 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,8 +1,8 @@ - 3 - 4 + 4 + 0 From a8a0312fc6ace974d9fe932a3a4f3284a1fc2de1 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 13 Feb 2020 14:36:59 -0800 Subject: [PATCH 0856/2702] Add 4.0.x entry to changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d1a255f9ae0..41c44513c61c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to the project will be documented in this file. +## [4.0.x] - Not Yet Released +### Merged PRs: + ## [3.3.111304] - 2020-02-13 [View Complete Diff of Changes](https://github.com/dotnet/format/compare/3ecea99de4bb82b724bf11134279b5aaf8dd1f2f...7c8f67a570f5fde6a247704733d6742f93c0fa48) ### Merged PRs: @@ -34,4 +37,4 @@ All changes to the project will be documented in this file. ### Initial Release - Partial support for core .editorconfig options - Support for .NET whitespace formatting options -- Support for --dry-run option \ No newline at end of file +- Support for --dry-run option From 032c515c3ee70fc522414d41d51a8607a609017b Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 13 Feb 2020 21:11:25 -0800 Subject: [PATCH 0857/2702] Combine --check and --dry-run into a single option. (#541) --- README.md | 6 +++--- eng/format-verifier.ps1 | 16 ++++++++++------ src/Program.cs | 15 ++++++++------- src/Resources.resx | 4 ++-- src/xlf/Resources.cs.xlf | 10 +++++----- src/xlf/Resources.de.xlf | 10 +++++----- src/xlf/Resources.es.xlf | 10 +++++----- src/xlf/Resources.fr.xlf | 10 +++++----- src/xlf/Resources.it.xlf | 10 +++++----- src/xlf/Resources.ja.xlf | 10 +++++----- src/xlf/Resources.ko.xlf | 10 +++++----- src/xlf/Resources.pl.xlf | 10 +++++----- src/xlf/Resources.pt-BR.xlf | 10 +++++----- src/xlf/Resources.ru.xlf | 10 +++++----- src/xlf/Resources.tr.xlf | 10 +++++----- src/xlf/Resources.zh-Hans.xlf | 10 +++++----- src/xlf/Resources.zh-Hant.xlf | 10 +++++----- tests/ProgramTests.cs | 2 +- 18 files changed, 89 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index 14fb93828460..d6a41891a355 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ Options: the current directory for one. --verbosity, -v Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - --dry-run Format files, but do not save changes to disk. - --check Terminates with a non-zero exit code if any files were formatted. + --check, --dry-run Formats files without saving changes to disk. Terminates with a non-zero exit code if any files + were formatted. --include, --files A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. --exclude A comma separated list of relative file or folder paths to exclude from formatting. @@ -70,7 +70,7 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | dotnet **format** -w <workspace> | Formats a specific project or solution. | | dotnet **format** -v diag | Formats with very verbose logging. | | dotnet **format** --include Programs.cs,Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | -| dotnet **format** --check --dry-run | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | +| dotnet **format** --check | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | | dotnet **format** --report <report-path> | Formats and saves a json report file to the given directory. | ### How To Uninstall diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index 00227bab75d8..e6f5ca68c4c1 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -58,12 +58,13 @@ try { Write-Output "$(Get-Date) - $solutionFile - Formatting Workspace" $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- -w $solution -v d --dry-run | Out-String Write-Output $output.TrimEnd() - - if ($LastExitCode -ne 0) { + + # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. + if ($LastExitCode -ne 0 -and $LastExitCode -ne 2) { Write-Output "$(Get-Date) - Formatting failed with error code $LastExitCode." exit -1 } - + if (($output -notmatch "(?m)Formatted \d+ of (\d+) files") -or ($Matches[1] -eq "0")) { Write-Output "$(Get-Date) - No files found for solution." exit -1 @@ -78,12 +79,13 @@ try { Write-Output "$(Get-Date) - $folderName - Formatting Folder" $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- -f $repoPath -v d --dry-run | Out-String Write-Output $output.TrimEnd() - - if ($LastExitCode -ne 0) { + + # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. + if ($LastExitCode -ne 0 -and $LastExitCode -ne 2) { Write-Output "$(Get-Date) - Formatting failed with error code $LastExitCode." exit -1 } - + if (($output -notmatch "(?m)Formatted \d+ of (\d+) files") -or ($Matches[1] -eq "0")) { Write-Output "$(Get-Date) - No files found for solution." exit -1 @@ -91,6 +93,8 @@ try { Write-Output "$(Get-Date) - $folderName - Complete" } + + exit 0 } catch { exit -1 diff --git a/src/Program.cs b/src/Program.cs index eda7703d7ba1..910ca39e64e5 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -19,6 +19,8 @@ namespace Microsoft.CodeAnalysis.Tools internal class Program { private static readonly string[] _verbosityLevels = new[] { "q", "quiet", "m", "minimal", "n", "normal", "d", "detailed", "diag", "diagnostic" }; + internal const int UnhandledExceptionExitCode = 1; + internal const int CheckFailedExitCode = 2; private static async Task Main(string[] args) { @@ -33,8 +35,7 @@ private static async Task Main(string[] args) .AddOption(new Option(new[] { "--folder", "-f" }, Resources.The_folder_to_operate_on_Cannot_be_used_with_the_workspace_option, new Argument(() => null))) .AddOption(new Option(new[] { "--workspace", "-w" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one, new Argument(() => null))) .AddOption(new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) - .AddOption(new Option(new[] { "--dry-run" }, Resources.Format_files_but_do_not_save_changes_to_disk, new Argument())) - .AddOption(new Option(new[] { "--check" }, Resources.Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted, new Argument())) + .AddOption(new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted, new Argument())) .AddOption(new Option(new[] { "--include", "--files" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty, new Argument(() => null))) .AddOption(new Option(new[] { "--exclude" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_exclude_from_formatting, new Argument(() => null))) .AddOption(new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory, new Argument(() => null))) @@ -44,7 +45,7 @@ private static async Task Main(string[] args) return await parser.InvokeAsync(args).ConfigureAwait(false); } - public static async Task Run(string folder, string workspace, string verbosity, bool dryRun, bool check, string include, string exclude, string report, IConsole console = null) + public static async Task Run(string folder, string workspace, string verbosity, bool check, string include, string exclude, string report, IConsole console = null) { // Setup logging. var serviceCollection = new ServiceCollection(); @@ -121,7 +122,7 @@ public static async Task Run(string folder, string workspace, string verbos workspacePath, workspaceType, logLevel, - saveFormattedFiles: !dryRun, + saveFormattedFiles: !check, changesAreErrors: check, pathsToInclude, pathsToExclude, @@ -137,11 +138,11 @@ public static async Task Run(string folder, string workspace, string verbos catch (FileNotFoundException fex) { logger.LogError(fex.Message); - return 1; + return UnhandledExceptionExitCode; } catch (OperationCanceledException) { - return 1; + return UnhandledExceptionExitCode; } finally { @@ -159,7 +160,7 @@ internal static int GetExitCode(WorkspaceFormatResult formatResult, bool check) return formatResult.ExitCode; } - return formatResult.FilesFormatted == 0 ? 0 : 1; + return formatResult.FilesFormatted == 0 ? 0 : CheckFailedExitCode; } internal static LogLevel GetLogLevel(string verbosity) diff --git a/src/Resources.resx b/src/Resources.resx index ffc9fbfe11fa..0c586f74cd13 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -171,8 +171,8 @@ Format files, but do not save changes to disk. - - Terminates with a non-zero exit code if any files were formatted. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 48aafa99bef1..947ed0435991 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -82,6 +82,11 @@ Soubory se naformátují, ale změny se neuloží na disk. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ Přeskočí se odkazovaný projekt {0}. - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. Soubor {0} zřejmě není platný soubor projektu nebo řešení. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 5bc1d9370286..24b879d30f25 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -82,6 +82,11 @@ Dateien formatieren, Änderungen aber nicht auf Festplatte speichern. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ Überspringen von referenziertem Projekt "{0}". - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index c4eda7fc10cf..d385fd579763 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -82,6 +82,11 @@ Formato de archivos, pero no guardar los cambios al disco. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ Omitiendo projecto al que se hace referencia "{0}". - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. El archivo "{0}" no parece ser un proyecto o archivo de solución válido. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 4c8d65dd7f83..0d8b6de879ff 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -82,6 +82,11 @@ Mettez en forme les fichiers, mais n'enregistrez pas les changements sur le disque. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ Saut du projet référencé '{0}'. - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 0a9060b6f7b2..4130242296c5 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -82,6 +82,11 @@ Formatta i file, ma non salvare le modifiche sul disco. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ Il progetto di riferimento '{0}' verrà ignorato. - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. Il file '{0}' non sembra essere un file di progetto o di soluzione valido. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 24e00eb24a2c..f529430ddc0f 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -82,6 +82,11 @@ ファイルを書式設定しますが、変更をディスクに保存しません。 + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ 参照プロジェクト '{0}' をスキップしています。 - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 5e384cc60d99..7a1e25a5a34f 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -82,6 +82,11 @@ 파일의 형식을 지정하지만 변경 내용을 디스크에 저장하지 않습니다. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ 참조된 프로젝트 '{0}'을(를) 건너뜁니다. - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index cfea55f73379..70b7604a23e5 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -82,6 +82,11 @@ Formatuj pliki, ale nie zapisuj zmian na dysku. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ Pomijanie przywoływanego projektu „{0}”. - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 295e1d078438..c9e44764d020 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -82,6 +82,11 @@ Arquivos de formato, mas não salva as alterações para o disco. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ Ignorando o projeto referenciado '{0}'. - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index d406ace10c72..dfec1ca123b1 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -82,6 +82,11 @@ Форматировать файлы без сохранения изменений на диск. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ Пропуск указанного проекта "{0}". - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. Файл "{0}" не является допустимым файлом проекта или решения. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index aeb17ea83a69..eba1831c46e4 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -82,6 +82,11 @@ Dosyaları biçimlendir, ancak değişiklikleri diske kaydetme. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ Atlama projesi '{0}' başvuru. - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index c7c969c98615..6d722a554d4c 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -82,6 +82,11 @@ 格式化文件, 但不将更改保存到磁盘。 + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ 正在跳过引用的项目“{0}”。 - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. 文件“{0}”似乎不是有效的项目或解决方案文件。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 2d8f1a6ab79c..4da8da5916a4 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -82,6 +82,11 @@ 將檔案格式化,但不儲存變更到磁碟。 + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + + Formatted {0} of {1} files. Formatted {0} of {1} files. @@ -127,11 +132,6 @@ 跳過參考的專案 '{0}’。 - - Terminates with a non-zero exit code if any files were formatted. - Terminates with a non-zero exit code if any files were formatted. - - The file '{0}' does not appear to be a valid project or solution file. 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index b95a2aaf46ed..5bb22a3339a9 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -13,7 +13,7 @@ public void ExitCodeIsOneWithCheckAndAnyFilesFormatted() var formatResult = new WorkspaceFormatResult(filesFormatted: 1, fileCount: 0, exitCode: 0); var exitCode = Program.GetExitCode(formatResult, check: true); - Assert.Equal(1, exitCode); + Assert.Equal(Program.CheckFailedExitCode, exitCode); } [Fact] From 918ceef6e6dc8edae7d9d0c88c23ddd3618f54cb Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 13 Feb 2020 21:47:00 -0800 Subject: [PATCH 0858/2702] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41c44513c61c..020ca5fda691 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All changes to the project will be documented in this file. ## [4.0.x] - Not Yet Released ### Merged PRs: +- [Combine --check and --dry-run into a single option. (541)](https://github.com/dotnet/format/pull/541g) ## [3.3.111304] - 2020-02-13 [View Complete Diff of Changes](https://github.com/dotnet/format/compare/3ecea99de4bb82b724bf11134279b5aaf8dd1f2f...7c8f67a570f5fde6a247704733d6742f93c0fa48) From 9645140f50c73e5ad2cd2194074f39e8846fffa0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 13 Feb 2020 22:07:54 -0800 Subject: [PATCH 0859/2702] Update documentation (#544) --- CHANGELOG.md | 2 +- README.md | 20 ++++++------ docs/README.md | 42 +++++++++++++++++++++++-- docs/Supported-.editorconfig-options.md | 5 +-- src/Program.cs | 4 +-- 5 files changed, 55 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 020ca5fda691..9bc25ca4170a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All changes to the project will be documented in this file. ## [4.0.x] - Not Yet Released ### Merged PRs: -- [Combine --check and --dry-run into a single option. (541)](https://github.com/dotnet/format/pull/541g) +- [Combine --check and --dry-run into a single option. (541)](https://github.com/dotnet/format/pull/541) ## [3.3.111304] - 2020-02-13 [View Complete Diff of Changes](https://github.com/dotnet/format/compare/3ecea99de4bb82b724bf11134279b5aaf8dd1f2f...7c8f67a570f5fde6a247704733d6742f93c0fa48) diff --git a/README.md b/README.md index d6a41891a355..6ef1b35bd3fd 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ Development builds of `dotnet-format` are being hosted on myget. You can visit t You can install the tool using the following command. ```console -dotnet tool install -g dotnet-format --version 3.0.5-prerelease.19203.5 --add-source https://dotnet.myget.org/F/format/api/v3/index.json +dotnet tool install -g dotnet-format --version 4.0.111308 --add-source https://dotnet.myget.org/F/format/api/v3/index.json ``` ### How To Use -By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory you will need to specify the workspace to format using the `-w` option. You can control how verbose the output will be by using the `-v` option. +By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory you will need to specify the workspace to format using the `-w` or `-f` options. You can control how verbose the output will be by using the `-v` option. ``` Usage: @@ -50,15 +50,15 @@ Options: --folder, -f The folder to operate on. Cannot be used with the `--workspace` option. --workspace, -w The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - --verbosity, -v Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and - diag[nostic] - --check, --dry-run Formats files without saving changes to disk. Terminates with a non-zero exit code if any files - were formatted. - --include, --files A comma separated list of relative file or folder paths to include in formatting. All files are + --include A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. --exclude A comma separated list of relative file or folder paths to exclude from formatting. - --version Display version information + --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files + were formatted. --report Writes a json file to the given directory. Defaults to 'format-report.json' if no filename given. + --verbosity, -v Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and + diag[nostic] + --version Display version information ``` Add `format` after `dotnet` and before the command arguments that you want to run: @@ -88,8 +88,8 @@ You can build and package the tool using the following commands. The instruction ```console build -pack # The final line from the build will read something like -# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.3.0.0-dev.nupkg'. -# Use the value that is in the form `3.2.0-dev` as the version in the next command. +# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.4.0.0-dev.nupkg'. +# Use the value that is in the form `4.0.0-dev` as the version in the next command. dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version dotnet format ``` diff --git a/docs/README.md b/docs/README.md index 0752580db18e..d46ad96c027b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,41 @@ -Welcome to the dotnet-format docs! ---- +# Welcome to the dotnet-format docs! +## .editorconfig options - [Supported .editorconfig options](./Supported-.editorconfig-options.md) -- [Unsupported Code Style options](./Unsupported-Code-Style-options.md) \ No newline at end of file +- [Unsupported Code Style options](./Unsupported-Code-Style-options.md) + +## CLI options + +### Specify a workspace (Required) + +It is required to specify a workspace when running dotnet-format. Choosing a workspace determines which code files are considered for formatting. + +- `--folder` - The folder to operate on. Cannot be used with the `--workspace` option. +- `--workspace` - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + +### Filter files to format + +You can further narrow the list of files to be formatted by limiting to set of included files that are not excluded. + +- `--include` - A comma separated list of relative file or folder paths to include in formatting. +- `--exclude` - A comma separated list of relative file or folder paths to exclude from formatting. + +*Example:* + +Other repos built as part of your project can be included using git submodules. These submodules likely contain their own .editorconfig files that are set as `root = true`. This +makes it difficult to validate formatting for your project as formatting mistakes in submodules are treated as errors. + +The following command sets the repo folder as the workspace. It then includes the `./src` and `./tests` folders for formatting. The `submodule-a` folder is excluded from the formatting validation. + +```console +dotnet format -f . --include ./src,./tests --exclude ./src/submodule-a --check +``` + +### Logging and Reports + +- `--verbosity` - Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] +- `--report` - Writes a json file to the given directory. Defaults to 'format-report.json' if no filename given. + +### Validate formatting + +- `--check` - Formats files without saving changes to disk. Terminates with a non-zero exit code (`2`) if any files were formatted. \ No newline at end of file diff --git a/docs/Supported-.editorconfig-options.md b/docs/Supported-.editorconfig-options.md index 8e6514400bbd..d01427be0503 100644 --- a/docs/Supported-.editorconfig-options.md +++ b/docs/Supported-.editorconfig-options.md @@ -1,4 +1,4 @@ -The dotnet-format global tool supports the core set of EditorConfig properties: +The dotnet-format global tool supports the core set of EditorConfig options*: - indent_style - indent_size @@ -6,9 +6,10 @@ The dotnet-format global tool supports the core set of EditorConfig properties: - end_of_line - charset - insert_final_newline -- trim_trailing_whitespace - root +[*] The option trim_trailing_whitespace is not supported. Currently insignificant whitespace is **always** removed by the formatter. + In addition dotnet-format supports a subset of the [.NET coding convention settings for EditorConfig](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017). # Formatting conventions diff --git a/src/Program.cs b/src/Program.cs index 910ca39e64e5..8691130480ba 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -34,11 +34,11 @@ private static async Task Main(string[] args) .UseExceptionHandler() .AddOption(new Option(new[] { "--folder", "-f" }, Resources.The_folder_to_operate_on_Cannot_be_used_with_the_workspace_option, new Argument(() => null))) .AddOption(new Option(new[] { "--workspace", "-w" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one, new Argument(() => null))) - .AddOption(new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) - .AddOption(new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted, new Argument())) .AddOption(new Option(new[] { "--include", "--files" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty, new Argument(() => null))) .AddOption(new Option(new[] { "--exclude" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_exclude_from_formatting, new Argument(() => null))) + .AddOption(new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted, new Argument())) .AddOption(new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory, new Argument(() => null))) + .AddOption(new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) .UseVersionOption() .Build(); From eca9897dac25a94b1c7460c623ef38521d2a64bd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 14 Feb 2020 13:29:06 +0000 Subject: [PATCH 0860/2702] Update dependencies from https://github.com/dotnet/arcade build 20200213.6 (#547) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20113.6 --- eng/Version.Details.xml | 4 +- eng/common/post-build/darc-gather-drop.ps1 | 44 ------------------- eng/common/post-build/nuget-validation.ps1 | 2 +- .../templates/post-build/darc-gather-drop.yml | 23 ---------- global.json | 2 +- 5 files changed, 4 insertions(+), 71 deletions(-) delete mode 100644 eng/common/post-build/darc-gather-drop.ps1 delete mode 100644 eng/common/templates/post-build/darc-gather-drop.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a1fd6c3c831f..0125e50e6a57 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 951ea7430678b2682ff861fe1149b8a2f55887ca + ba6bfb25914e3434264352dd24ba00b406d23393 diff --git a/eng/common/post-build/darc-gather-drop.ps1 b/eng/common/post-build/darc-gather-drop.ps1 deleted file mode 100644 index 81ff2a437769..000000000000 --- a/eng/common/post-build/darc-gather-drop.ps1 +++ /dev/null @@ -1,44 +0,0 @@ -param( - [Parameter(Mandatory=$true)][int] $BarBuildId, # ID of the build which assets should be downloaded - [Parameter(Mandatory=$true)][string] $DropLocation, # Where the assets should be downloaded to - [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, # Token used to access Maestro API - [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', # Maestro API URL - [Parameter(Mandatory=$false)][string] $MaestroApiVersion = '2019-01-16' # Version of Maestro API to use -) - -try { - . $PSScriptRoot\post-build-utils.ps1 - - Write-Host 'Installing DARC ...' - - . $PSScriptRoot\..\darc-init.ps1 - $exitCode = $LASTEXITCODE - - if ($exitCode -ne 0) { - Write-PipelineTelemetryError -Category "Darc" -Message "Something failed while running 'darc-init.ps1'. Check for errors above. Exiting now..." - ExitWithExitCode $exitCode - } - - # For now, only use a dry run. - # Ideally we would change darc to enable a quick request that - # would check whether the file exists that you can download it, - # and that it won't conflict with other files. - # https://github.com/dotnet/arcade/issues/3674 - # Right now we can't remove continue-on-error because we ocassionally will have - # dependencies that have no associated builds (e.g. an old dependency). - # We need to add an option to baseline specific dependencies away, or add them manually - # to the BAR. - darc gather-drop --non-shipping ` - --dry-run ` - --continue-on-error ` - --id $BarBuildId ` - --output-dir $DropLocation ` - --bar-uri $MaestroApiEndpoint ` - --password $MaestroApiAccessToken ` - --latest-location -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category "Darc" -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/post-build/nuget-validation.ps1 b/eng/common/post-build/nuget-validation.ps1 index 3d6129d72b07..dab3534ab538 100644 --- a/eng/common/post-build/nuget-validation.ps1 +++ b/eng/common/post-build/nuget-validation.ps1 @@ -9,7 +9,7 @@ param( try { . $PSScriptRoot\post-build-utils.ps1 - $url = 'https://raw.githubusercontent.com/NuGet/NuGetGallery/jver-verify/src/VerifyMicrosoftPackage/verify.ps1' + $url = 'https://raw.githubusercontent.com/NuGet/NuGetGallery/3e25ad135146676bcab0050a516939d9958bfa5d/src/VerifyMicrosoftPackage/verify.ps1' New-Item -ItemType 'directory' -Path ${ToolDestinationPath} -Force diff --git a/eng/common/templates/post-build/darc-gather-drop.yml b/eng/common/templates/post-build/darc-gather-drop.yml deleted file mode 100644 index 3268ccaa5513..000000000000 --- a/eng/common/templates/post-build/darc-gather-drop.yml +++ /dev/null @@ -1,23 +0,0 @@ -parameters: - ChannelId: 0 - -jobs: -- job: gatherDrop - displayName: Gather Drop - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.ChannelId }})) - variables: - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Darc gather-drop - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/darc-gather-drop.ps1 - arguments: -BarBuildId $(BARBuildId) - -DropLocation $(Agent.BuildDirectory)/Temp/Drop/ - -MaestroApiAccessToken $(MaestroApiAccessToken) - -MaestroApiEndPoint $(MaestroApiEndPoint) - -MaestroApiVersion $(MaestroApiVersion) diff --git a/global.json b/global.json index 688d33b2f61e..636ca0f8b6ce 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20112.7" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20113.6" } } From 67261ebfbee0b2af78b389b65351c7043c6f791e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 14 Feb 2020 13:35:55 +0000 Subject: [PATCH 0861/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200214.6 (#548) - Microsoft.NETCore.Compilers - 3.6.0-1.20114.6 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0125e50e6a57..340a43d8d007 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - a5fe26adf9e1710044fa55c9e0a2f6e84ff31338 + b352609f6d26d934d54ee683cd284cd7858a3b5f diff --git a/eng/Versions.props b/eng/Versions.props index 0d344d003e81..5660034e7e94 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.6.0-1.20113.5 + 3.6.0-1.20114.6 3.6.0-1.20114.6 + 3.1.1 - 0.1.0-alpha-63729-01 - 0.1.0-alpha-63729-01 - 1.2.2 - 1.0.0-beta1-63812-02 - 2.1.1 - 2.1.1 + 2.0.0-beta1.20104.2 + 0.3.0-alpha.20104.2 + 1.2.6 + 1.0.1-beta1.20114.4 + $(MicrosoftExtensionsVersion) + $(MicrosoftExtensionsVersion) 1.1.20180503.2 - 3.0.0-beta2.20077.2 + 3.0.0-beta2.20114.1 $(MicrosoftNETCoreCompilersPackageVersion) 4.7.0 diff --git a/src/Logging/NullScope.cs b/src/Logging/NullScope.cs new file mode 100644 index 000000000000..c725014212c3 --- /dev/null +++ b/src/Logging/NullScope.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.CodeAnalysis.Tools.Logging +{ + internal class NullScope : IDisposable + { + public static NullScope Instance { get; } = new NullScope(); + + private NullScope() + { + } + + public void Dispose() + { + } + } +} diff --git a/src/Logging/SimpleConsoleLogger.cs b/src/Logging/SimpleConsoleLogger.cs index 9920bd56b085..1d483c4624d2 100644 --- a/src/Logging/SimpleConsoleLogger.cs +++ b/src/Logging/SimpleConsoleLogger.cs @@ -6,7 +6,6 @@ using System.CommandLine; using System.CommandLine.Rendering; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions.Internal; namespace Microsoft.CodeAnalysis.Tools.Logging { @@ -71,13 +70,13 @@ void LogToTerminal(string message, LogLevel logLevel) { var messageColor = _logLevelColorMap[logLevel]; _terminal.ForegroundColor = messageColor; - _terminal.Out.WriteLine($" {message}"); + _terminal.Out.Write($" {message}{Environment.NewLine}"); _terminal.ResetColor(); } void LogToConsole(string message) { - _console.Out.WriteLine($" {message}"); + _console.Out.Write($" {message}{Environment.NewLine}"); } } } diff --git a/src/Program.cs b/src/Program.cs index 8691130480ba..fac116523825 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Immutable; using System.CommandLine; -using System.CommandLine.Builder; using System.CommandLine.Invocation; using System.IO; using System.Linq; @@ -24,25 +23,43 @@ internal class Program private static async Task Main(string[] args) { - var parser = new CommandLineBuilder(new Command("dotnet-format", handler: CommandHandler.Create(typeof(Program).GetMethod(nameof(Run))))) - .UseParseDirective() - .UseHelp() - .UseDebugDirective() - .UseSuggestDirective() - .RegisterWithDotnetSuggest() - .UseParseErrorReporting() - .UseExceptionHandler() - .AddOption(new Option(new[] { "--folder", "-f" }, Resources.The_folder_to_operate_on_Cannot_be_used_with_the_workspace_option, new Argument(() => null))) - .AddOption(new Option(new[] { "--workspace", "-w" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one, new Argument(() => null))) - .AddOption(new Option(new[] { "--include", "--files" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty, new Argument(() => null))) - .AddOption(new Option(new[] { "--exclude" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_exclude_from_formatting, new Argument(() => null))) - .AddOption(new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted, new Argument())) - .AddOption(new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory, new Argument(() => null))) - .AddOption(new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic, new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels))) - .UseVersionOption() - .Build(); - - return await parser.InvokeAsync(args).ConfigureAwait(false); + var rootCommand = new RootCommand + { + new Option(new[] { "--folder", "-f" }, Resources.The_folder_to_operate_on_Cannot_be_used_with_the_workspace_option) + { + Argument = new Argument(() => null) + }, + new Option(new[] { "--workspace", "-w" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one) + { + Argument = new Argument(() => null) + }, + new Option(new[] { "--include", "--files" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) + { + Argument = new Argument(() => null) + }, + new Option(new[] { "--exclude" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) + { + Argument = new Argument(() => null) + }, + new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted) + { + Argument = new Argument() + }, + new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory) + { + Argument = new Argument(() => null) + }, + new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic) + { + Argument = new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels) + }, + }; + + rootCommand.Description = "dotnet-format"; + rootCommand.Handler = CommandHandler.Create(typeof(Program).GetMethod(nameof(Run))); + + // Parse the incoming args and invoke the handler + return await rootCommand.InvokeAsync(args); } public static async Task Run(string folder, string workspace, string verbosity, bool check, string include, string exclude, string report, IConsole console = null) diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 134a7176db94..e5f4e9c410ca 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -23,7 +23,7 @@ - + diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 8e8064937163..0ba94d898725 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Testing; @@ -15,6 +16,7 @@ using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; using Microsoft.CodeAnalysis.Tools.Utilities; +using Microsoft.CodeAnalysis.VisualBasic; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.CodingConventions; using Microsoft.VisualStudio.Composition; @@ -24,6 +26,14 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { public abstract class AbstractFormatterTest { + private static readonly MetadataReference CorlibReference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location).WithAliases(ImmutableArray.Create("global", "corlib")); + private static readonly MetadataReference SystemReference = MetadataReference.CreateFromFile(typeof(System.Diagnostics.Debug).Assembly.Location).WithAliases(ImmutableArray.Create("global", "system")); + private static readonly MetadataReference SystemCoreReference = MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location); + private static readonly MetadataReference CodeAnalysisReference = MetadataReference.CreateFromFile(typeof(Compilation).Assembly.Location); + + private static readonly MetadataReference SystemCollectionsImmutableReference = MetadataReference.CreateFromFile(typeof(ImmutableArray).Assembly.Location); + private static readonly MetadataReference MicrosoftVisualBasicReference = MetadataReference.CreateFromFile(typeof(Microsoft.VisualBasic.Strings).Assembly.Location); + private static readonly Lazy ExportProviderFactory; static AbstractFormatterTest() @@ -235,15 +245,15 @@ protected virtual Solution CreateSolution(ProjectId projectId, string language) .CurrentSolution .AddProject(ProjectInfo.Create(projectId, VersionStamp.Create(), DefaultTestProjectName, DefaultTestProjectName, language, filePath: DefaultTestProjectPath)) .WithProjectCompilationOptions(projectId, compilationOptions) - .AddMetadataReference(projectId, MetadataReferences.CorlibReference) - .AddMetadataReference(projectId, MetadataReferences.SystemReference) - .AddMetadataReference(projectId, MetadataReferences.SystemCoreReference) - .AddMetadataReference(projectId, MetadataReferences.CodeAnalysisReference) - .AddMetadataReference(projectId, MetadataReferences.SystemCollectionsImmutableReference); + .AddMetadataReference(projectId, CorlibReference) + .AddMetadataReference(projectId, SystemReference) + .AddMetadataReference(projectId, SystemCoreReference) + .AddMetadataReference(projectId, CodeAnalysisReference) + .AddMetadataReference(projectId, SystemCollectionsImmutableReference); if (language == LanguageNames.VisualBasic) { - solution = solution.AddMetadataReference(projectId, MetadataReferences.MicrosoftVisualBasicReference); + solution = solution.AddMetadataReference(projectId, MicrosoftVisualBasicReference); } foreach (var transform in OptionsTransforms) diff --git a/tests/Utilities/TestLogger.cs b/tests/Utilities/TestLogger.cs index 199469259124..3e01b696a7fc 100644 --- a/tests/Utilities/TestLogger.cs +++ b/tests/Utilities/TestLogger.cs @@ -2,8 +2,8 @@ using System; using System.Text; +using Microsoft.CodeAnalysis.Tools.Logging; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions.Internal; namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities { From 93383a23d87c9eb1c20a4c1564c1f57f12ebfd8f Mon Sep 17 00:00:00 2001 From: Adeel Mujahid Date: Sun, 16 Feb 2020 21:41:38 +0200 Subject: [PATCH 0866/2702] Use space-separated paths instead of comma-separated (#551) * Use space-separated paths instead of comma-separated * Update --help output in README.md * Update usage of --include option in README.md * Change argument type to string[] Co-authored-by: Joey Robichaud --- README.md | 24 ++++++++++-------------- src/CodeFormatter.cs | 2 +- src/Program.cs | 22 +++++++++++----------- src/Resources.resx | 10 +++++----- src/xlf/Resources.cs.xlf | 12 ++++++------ src/xlf/Resources.de.xlf | 12 ++++++------ src/xlf/Resources.es.xlf | 12 ++++++------ src/xlf/Resources.fr.xlf | 12 ++++++------ src/xlf/Resources.it.xlf | 12 ++++++------ src/xlf/Resources.ja.xlf | 12 ++++++------ src/xlf/Resources.ko.xlf | 12 ++++++------ src/xlf/Resources.pl.xlf | 12 ++++++------ src/xlf/Resources.pt-BR.xlf | 12 ++++++------ src/xlf/Resources.ru.xlf | 12 ++++++------ src/xlf/Resources.tr.xlf | 12 ++++++------ src/xlf/Resources.zh-Hans.xlf | 12 ++++++------ src/xlf/Resources.zh-Hant.xlf | 12 ++++++------ tests/CodeFormatterTests.cs | 4 ++-- tests/ProgramTests.cs | 4 ++-- 19 files changed, 109 insertions(+), 113 deletions(-) diff --git a/README.md b/README.md index 6ef1b35bd3fd..5deae2ed5d21 100644 --- a/README.md +++ b/README.md @@ -42,23 +42,19 @@ dotnet tool install -g dotnet-format --version 4.0.111308 --add-source https://d By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory you will need to specify the workspace to format using the `-w` or `-f` options. You can control how verbose the output will be by using the `-v` option. -``` +```sh Usage: dotnet-format [options] Options: - --folder, -f The folder to operate on. Cannot be used with the `--workspace` option. - --workspace, -w The solution or project file to operate on. If a file is not specified, the command will search - the current directory for one. - --include A comma separated list of relative file or folder paths to include in formatting. All files are - formatted if empty. - --exclude A comma separated list of relative file or folder paths to exclude from formatting. - --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files - were formatted. - --report Writes a json file to the given directory. Defaults to 'format-report.json' if no filename given. - --verbosity, -v Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and - diag[nostic] - --version Display version information + -f, --folder The folder to operate on. Cannot be used with the `--workspace` option. + -w, --workspace The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + --files, --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. + --exclude A list of relative file or folder paths to exclude from formatting. + --check, --dry-run Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + --report Accepts a file path, which if provided, will produce a json report in the given directory. + -v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + --version Display version information ``` Add `format` after `dotnet` and before the command arguments that you want to run: @@ -69,7 +65,7 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | dotnet **format** -f <folder> | Formats a particular folder and subfolders. | | dotnet **format** -w <workspace> | Formats a specific project or solution. | | dotnet **format** -v diag | Formats with very verbose logging. | -| dotnet **format** --include Programs.cs,Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | +| dotnet **format** --include Programs.cs Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | | dotnet **format** --check | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | | dotnet **format** --report <report-path> | Formats and saves a json report file to the given directory. | diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 7915d34b6272..7012c6736c56 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -82,7 +82,7 @@ public static async Task FormatWorkspaceAsync( foreach (var changedDocumentId in projectChanges.GetChangedDocuments()) { var changedDocument = solution.GetDocument(changedDocumentId); - logger.LogInformation(Resources.Formatted_code_file_0, Path.GetFileName(changedDocument.FilePath)); + logger.LogInformation(Resources.Formatted_code_file_0, changedDocument.FilePath); filesFormatted++; } } diff --git a/src/Program.cs b/src/Program.cs index fac116523825..2422845de4d2 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -33,13 +33,13 @@ private static async Task Main(string[] args) { Argument = new Argument(() => null) }, - new Option(new[] { "--include", "--files" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) + new Option(new[] { "--include", "--files" }, Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) { - Argument = new Argument(() => null) + Argument = new Argument(() => null) }, - new Option(new[] { "--exclude" }, Resources.A_comma_separated_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) + new Option(new[] { "--exclude" }, Resources.A_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) { - Argument = new Argument(() => null) + Argument = new Argument(() => null) }, new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted) { @@ -62,7 +62,7 @@ private static async Task Main(string[] args) return await rootCommand.InvokeAsync(args); } - public static async Task Run(string folder, string workspace, string verbosity, bool check, string include, string exclude, string report, IConsole console = null) + public static async Task Run(string folder, string workspace, string verbosity, bool check, string[] include, string[] exclude, string report, IConsole console = null) { // Setup logging. var serviceCollection = new ServiceCollection(); @@ -211,24 +211,24 @@ private static void ConfigureServices(ServiceCollection serviceCollection, ICons } /// - /// Converts a comma-separated list of relative file paths to a hashmap of full file paths. + /// Converts array of relative file paths to a hashmap of full file paths. /// - internal static ImmutableHashSet GetRootedPaths(string paths, string folder) + internal static ImmutableHashSet GetRootedPaths(string[] paths, string folder) { - if (string.IsNullOrEmpty(paths)) + if (paths == null) { - return ImmutableHashSet.Create(); + return ImmutableHashSet.Empty; } if (string.IsNullOrEmpty(folder)) { - return paths.Split(',') + return paths .Select(path => Path.GetFullPath(path, Environment.CurrentDirectory)) .ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); } else { - return paths.Split(',') + return paths .Select(path => Path.GetFullPath(path, Environment.CurrentDirectory)) .Where(path => path.StartsWith(folder)) .ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); diff --git a/src/Resources.resx b/src/Resources.resx index 0c586f74cd13..8e25b61c730e 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -174,8 +174,8 @@ Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. Formatted code file '{0}'. @@ -216,7 +216,7 @@ Writing formatting report to: '{0}'. - - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. - \ No newline at end of file + diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 947ed0435991..fc4dac93ddff 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 24b879d30f25..e060569068d7 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index d385fd579763..1b2a2a01e912 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 0d8b6de879ff..84dc09990ad1 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 4130242296c5..b1dad16dff2d 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index f529430ddc0f..bdc69b5c9341 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 7a1e25a5a34f..78fb2bab3ce1 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 70b7604a23e5..303f09da7477 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index c9e44764d020..cbed71e93c1d 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index dfec1ca123b1..080a55d76dc4 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index eba1831c46e4..a85d1262a060 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 6d722a554d4c..e5c2c06b734c 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 4da8da5916a4..1cb6f71aa843 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -2,14 +2,14 @@ - - A comma separated list of relative file or folder paths to exclude from formatting. - A comma separated list of relative file or folder paths to exclude from formatting. + + A list of relative file or folder paths to exclude from formatting. + A list of relative file or folder paths to exclude from formatting. - - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. - A comma separated list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A list of relative file or folder paths to include in formatting. All files are formatted if empty. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 027e610a4e81..ff175fd7da51 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -189,7 +189,7 @@ public async Task OnlyLogFormattedFiles() var match = new Regex(pattern, RegexOptions.Multiline).Match(log); Assert.True(match.Success, log); - Assert.Equal("Program.cs", match.Groups[1].Value); + Assert.EndsWith("Program.cs", match.Groups[1].Value); } [Fact] @@ -276,7 +276,7 @@ public async Task LogFilesThatDontMatchExclude() var match = new Regex(pattern, RegexOptions.Multiline).Match(log); Assert.True(match.Success, log); - Assert.Equal("Program.cs", match.Groups[1].Value); + Assert.EndsWith("Program.cs", match.Groups[1].Value); } [Fact] diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 5bb22a3339a9..f8ce0f5860e5 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -38,10 +38,10 @@ public void ExitCodeIsSameWithoutCheck() public void FilesFormattedDirectorySeparatorInsensitive() { var filePath = $"other_items{Path.DirectorySeparatorChar}OtherClass.cs"; - var files = Program.GetRootedPaths(filePath, folder: null); + var files = Program.GetRootedPaths(new[] { filePath }, folder: null); var filePathAlt = $"other_items{Path.AltDirectorySeparatorChar}OtherClass.cs"; - var filesAlt = Program.GetRootedPaths(filePathAlt, folder: null); + var filesAlt = Program.GetRootedPaths(new[] { filePathAlt }, folder: null); Assert.True(files.IsSubsetOf(filesAlt)); } From 3556f2c9b03c7bc4c69f73142ad4e01bfe30c4c3 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 16 Feb 2020 17:02:30 -0800 Subject: [PATCH 0867/2702] Support file globbing in --include and --exclude options (#555) * Update --include and --exclude to support file globs * Fixup performance tests * Fix formatting issues * Fix include and exclude defaults * Add CI formatting check * Create report folder * Update CI task name * Update changelog and docs * Code cleanup --- CHANGELOG.md | 3 ++ azure-pipelines.yml | 21 ++++++-- docs/README.md | 13 +++-- eng/Versions.props | 1 + perf/FormattedFiles.cs | 23 ++++---- perf/NoFilesFormatted.cs | 22 ++++---- perf/RealWorldSolution.cs | 19 ++++--- perf/Utilities/EmptyLogger.cs | 14 ++--- perf/Utilities/MSBuildRegister.cs | 4 +- perf/Utilities/SolutionPathSetter.cs | 4 +- perf/Utilities/WorkspacePathHelper.cs | 4 +- src/CodeFormatter.cs | 37 +++++++------ src/FormatOptions.cs | 17 +++--- src/Logging/NullScope.cs | 2 +- src/Program.cs | 39 +++----------- src/Utilities/SourceFileMatcher.cs | 22 ++++++++ src/Workspaces/FolderWorkspace.cs | 5 +- .../FolderWorkspace_FolderSolutionLoader.cs | 5 +- .../FolderWorkspace_ProjectLoader.cs | 16 +++--- src/dotnet-format.csproj | 1 + tests/CodeFormatterTests.cs | 53 ++++++++++++------- tests/Formatters/AbstractFormatterTests.cs | 6 +-- tests/Formatters/FormattedFilesTests.cs | 9 ++-- tests/ProgramTests.cs | 12 ----- 24 files changed, 186 insertions(+), 166 deletions(-) create mode 100644 src/Utilities/SourceFileMatcher.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bc25ca4170a..bd7c8b3f84d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All changes to the project will be documented in this file. ## [4.0.x] - Not Yet Released ### Merged PRs: - [Combine --check and --dry-run into a single option. (541)](https://github.com/dotnet/format/pull/541) +- [Use space-separated paths instead of comma-separated for --include and --exclude (551)](https://github.com/dotnet/format/pull/551) +- [Support loading commandline options from response files (552)](https://github.com/dotnet/format/pull/552) +- [Support file globbing in --include and --exclude options (555)](https://github.com/dotnet/format/pull/555) ## [3.3.111304] - 2020-02-13 [View Complete Diff of Changes](https://github.com/dotnet/format/compare/3ecea99de4bb82b724bf11134279b5aaf8dd1f2f...7c8f67a570f5fde6a247704733d6742f93c0fa48) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 219a921fe994..3dbcd5218990 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -42,7 +42,7 @@ jobs: condition: not(succeeded()) - job: Linux - pool: + pool: name: NetCorePublic-Pool queue: BuildPool.Ubuntu.1604.Amd64.Open variables: @@ -73,9 +73,9 @@ jobs: ArtifactName: '$(_os) $(_configuration)' continueOnError: true condition: not(succeeded()) - + - job: Windows_Spanish - pool: + pool: name: NetCorePublic-Pool queue: buildpool.windows.10.amd64.es.vs2017.open variables: @@ -105,3 +105,18 @@ jobs: ArtifactName: 'Spanish $(_os) $(_configuration)' continueOnError: true condition: not(succeeded()) + +- job: Formatting_Check + pool: + vmImage: 'vs2017-win2016' + timeoutInMinutes: 5 + steps: + - script: dotnet run --project ./src/dotnet-format.csproj -- --folder . --exclude ./tests/projects/ --check --report ./artifacts/log/ -v diag + displayName: Run dotnet-format + - task: PublishBuildArtifacts@1 + displayName: Publish Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\' + ArtifactName: 'Formatting Check' + continueOnError: true + condition: not(succeeded()) diff --git a/docs/README.md b/docs/README.md index d46ad96c027b..dfc494ce4262 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,20 +15,19 @@ It is required to specify a workspace when running dotnet-format. Choosing a wor ### Filter files to format -You can further narrow the list of files to be formatted by limiting to set of included files that are not excluded. +You can further narrow the list of files to be formatted by limiting to set of included files that are not excluded. File globbing is supported. -- `--include` - A comma separated list of relative file or folder paths to include in formatting. -- `--exclude` - A comma separated list of relative file or folder paths to exclude from formatting. +- `--include` - A list of relative file or folder paths to include in formatting. +- `--exclude` - A list of relative file or folder paths to exclude from formatting. *Example:* -Other repos built as part of your project can be included using git submodules. These submodules likely contain their own .editorconfig files that are set as `root = true`. This -makes it difficult to validate formatting for your project as formatting mistakes in submodules are treated as errors. +Other repos built as part of your project can be included using git submodules. These submodules likely contain their own .editorconfig files that are set as `root = true`. This makes it difficult to validate formatting for your project as formatting mistakes in submodules are treated as errors. -The following command sets the repo folder as the workspace. It then includes the `./src` and `./tests` folders for formatting. The `submodule-a` folder is excluded from the formatting validation. +The following command sets the repo folder as the workspace. It then includes the `src` and `tests` folders for formatting. The `submodule-a` folder is excluded from the formatting validation. ```console -dotnet format -f . --include ./src,./tests --exclude ./src/submodule-a --check +dotnet format -f . --include ./src/ ./tests/ --exclude ./src/submodule-a/ --check ``` ### Logging and Reports diff --git a/eng/Versions.props b/eng/Versions.props index f21a4a823c22..7fbc18b3ef3f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -20,6 +20,7 @@ 1.2.6 1.0.1-beta1.20114.4 $(MicrosoftExtensionsVersion) + $(MicrosoftExtensionsVersion) $(MicrosoftExtensionsVersion) 1.1.20180503.2 3.0.0-beta2.20114.1 diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index 8c67f10b3187..e3f573c75e50 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -1,6 +1,10 @@ -using System.Collections.Immutable; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; +using Microsoft.CodeAnalysis.Tools.Utilities; +using Microsoft.Extensions.FileSystemGlobbing; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Perf @@ -8,10 +12,12 @@ namespace Microsoft.CodeAnalysis.Tools.Perf [SimpleJob(RuntimeMoniker.NetCoreApp21)] public class FormattedFiles { - private const string UnformattedProjectPath = "tests/projects/for_code_formatter/unformatted_project"; - private const string UnformattedProjectFilePath = UnformattedProjectPath + "/unformatted_project.csproj"; + private const string UnformattedProjectPath = "tests/projects/for_code_formatter/unformatted_project/"; + private const string UnformattedProjectFilePath = UnformattedProjectPath + "unformatted_project.csproj"; private const string UnformattedSolutionFilePath = "tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln"; - private static EmptyLogger EmptyLogger = new EmptyLogger(); + + private static readonly EmptyLogger EmptyLogger = new EmptyLogger(); + private static readonly Matcher AllFileMatcher = SourceFileMatcher.CreateMatcher(Array.Empty(), Array.Empty()); [IterationSetup] public void NoFilesFormattedSetup() @@ -30,8 +36,7 @@ public void FilesFormattedFolder() LogLevel.Error, saveFormattedFiles: false, changesAreErrors: false, - ImmutableHashSet.Empty, - ImmutableHashSet.Empty, + AllFileMatcher, reportPath: string.Empty); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -46,8 +51,7 @@ public void FilesFormattedProject() LogLevel.Error, saveFormattedFiles: false, changesAreErrors: false, - ImmutableHashSet.Empty, - ImmutableHashSet.Empty, + AllFileMatcher, reportPath: string.Empty); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -62,8 +66,7 @@ public void FilesFormattedSolution() LogLevel.Error, saveFormattedFiles: false, changesAreErrors: false, - ImmutableHashSet.Empty, - ImmutableHashSet.Empty, + AllFileMatcher, reportPath: string.Empty); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index 3e5948dbaa77..bf9e8b417325 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -1,6 +1,10 @@ -using System.Collections.Immutable; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; +using Microsoft.CodeAnalysis.Tools.Utilities; +using Microsoft.Extensions.FileSystemGlobbing; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Perf @@ -8,11 +12,12 @@ namespace Microsoft.CodeAnalysis.Tools.Perf [SimpleJob(RuntimeMoniker.NetCoreApp21)] public class NoFilesFormatted { - private const string FormattedProjectPath = "tests/projects/for_code_formatter/formatted_project"; - private const string FormattedProjectFilePath = FormattedProjectPath + "/formatted_project.csproj"; + private const string FormattedProjectPath = "tests/projects/for_code_formatter/formatted_project/"; + private const string FormattedProjectFilePath = FormattedProjectPath + "formatted_project.csproj"; private const string FormattedSolutionFilePath = "tests/projects/for_code_formatter/formatted_solution/formatted_solution.sln"; - private static EmptyLogger EmptyLogger = new EmptyLogger(); + private static readonly EmptyLogger EmptyLogger = new EmptyLogger(); + private static readonly Matcher AllFileMatcher = SourceFileMatcher.CreateMatcher(Array.Empty(), Array.Empty()); [IterationSetup] public void NoFilesFormattedSetup() @@ -31,8 +36,7 @@ public void NoFilesFormattedFolder() LogLevel.Error, saveFormattedFiles: false, changesAreErrors: false, - ImmutableHashSet.Empty, - ImmutableHashSet.Empty, + AllFileMatcher, reportPath: string.Empty); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -47,8 +51,7 @@ public void NoFilesFormattedProject() LogLevel.Error, saveFormattedFiles: false, changesAreErrors: false, - ImmutableHashSet.Empty, - ImmutableHashSet.Empty, + AllFileMatcher, reportPath: string.Empty); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -63,8 +66,7 @@ public void NoFilesFormattedSolution() LogLevel.Error, saveFormattedFiles: false, changesAreErrors: false, - ImmutableHashSet.Empty, - ImmutableHashSet.Empty, + AllFileMatcher, reportPath: string.Empty); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index 5702a660c4d5..218f40ece77c 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -1,10 +1,13 @@ -using System.Collections.Immutable; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; using BenchmarkDotNet.Diagnosers; using BenchmarkDotNet.Environments; -using BenchmarkDotNet.Horology; using BenchmarkDotNet.Jobs; +using Microsoft.CodeAnalysis.Tools.Utilities; +using Microsoft.Extensions.FileSystemGlobbing; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Perf @@ -12,9 +15,11 @@ namespace Microsoft.CodeAnalysis.Tools.Perf [Config(typeof(RealWorldConfig))] public class RealWorldSolution { - private const string UnformattedSolutionFilePath = "temp/project-system/ProjectSystem.sln"; - private const string UnformattedFolderFilePath = "temp/project-system"; + private const string UnformattedFolderFilePath = "temp/project-system/"; + private const string UnformattedSolutionFilePath = UnformattedFolderFilePath + "ProjectSystem.sln"; + private static EmptyLogger EmptyLogger = new EmptyLogger(); + private static readonly Matcher AllFileMatcher = SourceFileMatcher.CreateMatcher(Array.Empty(), Array.Empty()); [IterationSetup] public void RealWorldSolutionIterationSetup() @@ -33,8 +38,7 @@ public void FilesFormattedSolution() LogLevel.Error, saveFormattedFiles: false, changesAreErrors: false, - ImmutableHashSet.Empty, - ImmutableHashSet.Empty, + AllFileMatcher, reportPath: string.Empty); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -49,8 +53,7 @@ public void FilesFormattedFolder() LogLevel.Error, saveFormattedFiles: false, changesAreErrors: false, - ImmutableHashSet.Empty, - ImmutableHashSet.Empty, + AllFileMatcher, reportPath: string.Empty); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } diff --git a/perf/Utilities/EmptyLogger.cs b/perf/Utilities/EmptyLogger.cs index 415b61aee850..196e7ca1cf1a 100644 --- a/perf/Utilities/EmptyLogger.cs +++ b/perf/Utilities/EmptyLogger.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using Microsoft.CodeAnalysis.Tools.Logging; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Perf @@ -16,13 +19,6 @@ public void Log(LogLevel logLevel, public bool IsEnabled(LogLevel logLevel) => false; - public IDisposable BeginScope(TState state) => new EmptyScope(); - - private class EmptyScope : IDisposable - { - public void Dispose() - { - } - } + public IDisposable BeginScope(TState state) => NullScope.Instance; } } diff --git a/perf/Utilities/MSBuildRegister.cs b/perf/Utilities/MSBuildRegister.cs index 9fd2e86f37d4..eb7eb1663eaf 100644 --- a/perf/Utilities/MSBuildRegister.cs +++ b/perf/Utilities/MSBuildRegister.cs @@ -1,4 +1,6 @@ -using System.Linq; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.Tools.MSBuild; diff --git a/perf/Utilities/SolutionPathSetter.cs b/perf/Utilities/SolutionPathSetter.cs index 40a7408ef7b6..f569ef22997a 100644 --- a/perf/Utilities/SolutionPathSetter.cs +++ b/perf/Utilities/SolutionPathSetter.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; using System.IO; using System.Threading; diff --git a/perf/Utilities/WorkspacePathHelper.cs b/perf/Utilities/WorkspacePathHelper.cs index 47567f782a00..28c53d17ff47 100644 --- a/perf/Utilities/WorkspacePathHelper.cs +++ b/perf/Utilities/WorkspacePathHelper.cs @@ -1,4 +1,6 @@ -using System.IO; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.IO; namespace Microsoft.CodeAnalysis.Tools.Perf { diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 7012c6736c56..c687fca9bcbc 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -14,6 +14,7 @@ using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.CodeAnalysis.Tools.Workspaces; +using Microsoft.Extensions.FileSystemGlobbing; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.CodingConventions; @@ -34,7 +35,7 @@ public static async Task FormatWorkspaceAsync( ILogger logger, CancellationToken cancellationToken) { - var (workspaceFilePath, workspaceType, logLevel, saveFormattedFiles, _, pathsToInclude, pathsToExclude, reportPath) = options; + var (workspaceFilePath, workspaceType, logLevel, saveFormattedFiles, _, fileMatcher, reportPath) = options; var logWorkspaceWarnings = logLevel == LogLevel.Trace; logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, workspaceFilePath)); @@ -44,7 +45,7 @@ public static async Task FormatWorkspaceAsync( var workspaceStopwatch = Stopwatch.StartNew(); using (var workspace = await OpenWorkspaceAsync( - workspaceFilePath, workspaceType, pathsToInclude, logWorkspaceWarnings, logger, cancellationToken).ConfigureAwait(false)) + workspaceFilePath, workspaceType, fileMatcher, logWorkspaceWarnings, logger, cancellationToken).ConfigureAwait(false)) { if (workspace is null) { @@ -60,7 +61,7 @@ public static async Task FormatWorkspaceAsync( logger.LogTrace(Resources.Determining_formattable_files); var (fileCount, formatableFiles) = await DetermineFormattableFiles( - solution, projectPath, pathsToInclude, pathsToExclude, logger, cancellationToken).ConfigureAwait(false); + solution, projectPath, fileMatcher, logger, cancellationToken).ConfigureAwait(false); var determineFilesMS = workspaceStopwatch.ElapsedMilliseconds - loadWorkspaceMS; logger.LogTrace(Resources.Complete_in_0_ms, determineFilesMS); @@ -98,6 +99,12 @@ public static async Task FormatWorkspaceAsync( if (exitCode == 0 && !string.IsNullOrWhiteSpace(reportPath)) { var reportFilePath = GetReportFilePath(reportPath); + var reportFolderPath = Path.GetDirectoryName(reportFilePath); + + if (!Directory.Exists(reportFolderPath)) + { + Directory.CreateDirectory(reportFolderPath); + } logger.LogInformation(Resources.Writing_formatting_report_to_0, reportFilePath); var seralizerOptions = new JsonSerializerOptions @@ -137,7 +144,7 @@ private static string GetReportFilePath(string reportPath) private static async Task OpenWorkspaceAsync( string workspacePath, WorkspaceType workspaceType, - ImmutableHashSet pathsToInclude, + Matcher fileMatcher, bool logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken) @@ -145,7 +152,7 @@ private static async Task OpenWorkspaceAsync( if (workspaceType == WorkspaceType.Folder) { var folderWorkspace = FolderWorkspace.Create(); - await folderWorkspace.OpenFolder(workspacePath, pathsToInclude, cancellationToken); + await folderWorkspace.OpenFolder(workspacePath, fileMatcher, cancellationToken); return folderWorkspace; } @@ -241,8 +248,7 @@ private static async Task RunCodeFormattersAsync( internal static async Task<(int, ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)>)> DetermineFormattableFiles( Solution solution, string projectPath, - ImmutableHashSet pathsToInclude, - ImmutableHashSet pathsToExclude, + Matcher fileMatcher, ILogger logger, CancellationToken cancellationToken) { @@ -272,7 +278,7 @@ private static async Task RunCodeFormattersAsync( // Get project documents and options with .editorconfig settings applied. var getProjectDocuments = project.DocumentIds.Select(documentId => GetDocumentAndOptions( - project, documentId, pathsToInclude, pathsToExclude, codingConventionsManager, optionsApplier, cancellationToken)); + project, documentId, fileMatcher, codingConventionsManager, optionsApplier, cancellationToken)); getDocumentsAndOptions.AddRange(getProjectDocuments); } @@ -310,15 +316,14 @@ private static async Task RunCodeFormattersAsync( private static async Task<(Document, OptionSet, ICodingConventionsSnapshot, bool)> GetDocumentAndOptions( Project project, DocumentId documentId, - ImmutableHashSet pathsToInclude, - ImmutableHashSet pathsToExclude, + Matcher fileMatcher, ICodingConventionsManager codingConventionsManager, EditorConfigOptionsApplier optionsApplier, CancellationToken cancellationToken) { var document = project.Solution.GetDocument(documentId); - if (await ShouldIgnoreDocument(document, pathsToInclude, pathsToExclude, cancellationToken)) + if (await ShouldIgnoreDocument(document, fileMatcher, cancellationToken)) { return (null, null, null, false); } @@ -340,11 +345,10 @@ private static async Task RunCodeFormattersAsync( private static async Task ShouldIgnoreDocument( Document document, - ImmutableHashSet pathsToInclude, - ImmutableHashSet pathsToExclude, + Matcher fileMatcher, CancellationToken cancellationToken) { - if (!pathsToInclude.IsEmpty && !pathsToInclude.Any(path => document.FilePath.StartsWith(path, StringComparison.OrdinalIgnoreCase))) + if (!fileMatcher.Match(document.FilePath).HasMatches) { // If a files list was passed in, then ignore files not present in the list. return true; @@ -358,11 +362,6 @@ private static async Task ShouldIgnoreDocument( // Ignore generated code files. return true; } - else if (!pathsToExclude.IsEmpty && pathsToExclude.Any(path => document.FilePath.StartsWith(path, StringComparison.OrdinalIgnoreCase))) - { - // Ignore file in, or under a folder in the list to exclude - return true; - } else { return false; diff --git a/src/FormatOptions.cs b/src/FormatOptions.cs index e98708691d40..81284f9e4647 100644 --- a/src/FormatOptions.cs +++ b/src/FormatOptions.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Immutable; +using Microsoft.Extensions.FileSystemGlobbing; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools @@ -12,8 +12,7 @@ internal class FormatOptions public LogLevel LogLevel { get; } public bool SaveFormattedFiles { get; } public bool ChangesAreErrors { get; } - public ImmutableHashSet PathsToInclude { get; } - public ImmutableHashSet PathsToExclude { get; } + public Matcher FileMatcher { get; } public string ReportPath { get; } public FormatOptions( @@ -22,8 +21,7 @@ public FormatOptions( LogLevel logLevel, bool saveFormattedFiles, bool changesAreErrors, - ImmutableHashSet pathsToInclude, - ImmutableHashSet pathsToExclude, + Matcher fileMatcher, string reportPath) { WorkspaceFilePath = workspaceFilePath; @@ -31,8 +29,7 @@ public FormatOptions( LogLevel = logLevel; SaveFormattedFiles = saveFormattedFiles; ChangesAreErrors = changesAreErrors; - PathsToInclude = pathsToInclude; - PathsToExclude = pathsToExclude; + FileMatcher = fileMatcher; ReportPath = reportPath; } @@ -42,8 +39,7 @@ public void Deconstruct( out LogLevel logLevel, out bool saveFormattedFiles, out bool changesAreErrors, - out ImmutableHashSet pathsToInclude, - out ImmutableHashSet pathsToExclude, + out Matcher fileMatcher, out string reportPath) { workspaceFilePath = WorkspaceFilePath; @@ -51,8 +47,7 @@ public void Deconstruct( logLevel = LogLevel; saveFormattedFiles = SaveFormattedFiles; changesAreErrors = ChangesAreErrors; - pathsToInclude = PathsToInclude; - pathsToExclude = PathsToExclude; + fileMatcher = FileMatcher; reportPath = ReportPath; } } diff --git a/src/Logging/NullScope.cs b/src/Logging/NullScope.cs index c725014212c3..31399713e466 100644 --- a/src/Logging/NullScope.cs +++ b/src/Logging/NullScope.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; diff --git a/src/Program.cs b/src/Program.cs index 2422845de4d2..96e7a9785d31 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Immutable; using System.CommandLine; using System.CommandLine.Invocation; using System.IO; @@ -10,6 +9,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Logging; using Microsoft.CodeAnalysis.Tools.MSBuild; +using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -35,11 +35,11 @@ private static async Task Main(string[] args) }, new Option(new[] { "--include", "--files" }, Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) { - Argument = new Argument(() => null) + Argument = new Argument(() => Array.Empty()) }, new Option(new[] { "--exclude" }, Resources.A_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) { - Argument = new Argument(() => null) + Argument = new Argument(() => Array.Empty()) }, new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted) { @@ -120,9 +120,6 @@ public static async Task Run(string folder, string workspace, string verbos Environment.CurrentDirectory = workspaceDirectory; - var pathsToInclude = GetRootedPaths(include, folder); - var pathsToExclude = GetRootedPaths(exclude, folder); - // Since we are running as a dotnet tool we should be able to find an instance of // MSBuild in a .NET Core SDK. var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); @@ -135,14 +132,15 @@ public static async Task Run(string folder, string workspace, string verbos Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); + var fileMatcher = SourceFileMatcher.CreateMatcher(include, exclude); + var formatOptions = new FormatOptions( workspacePath, workspaceType, logLevel, saveFormattedFiles: !check, changesAreErrors: check, - pathsToInclude, - pathsToExclude, + fileMatcher, reportPath: report); var formatResult = await CodeFormatter.FormatWorkspaceAsync( @@ -209,30 +207,5 @@ private static void ConfigureServices(ServiceCollection serviceCollection, ICons serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, logLevel)); serviceCollection.AddLogging(); } - - /// - /// Converts array of relative file paths to a hashmap of full file paths. - /// - internal static ImmutableHashSet GetRootedPaths(string[] paths, string folder) - { - if (paths == null) - { - return ImmutableHashSet.Empty; - } - - if (string.IsNullOrEmpty(folder)) - { - return paths - .Select(path => Path.GetFullPath(path, Environment.CurrentDirectory)) - .ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); - } - else - { - return paths - .Select(path => Path.GetFullPath(path, Environment.CurrentDirectory)) - .Where(path => path.StartsWith(folder)) - .ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); - } - } } } diff --git a/src/Utilities/SourceFileMatcher.cs b/src/Utilities/SourceFileMatcher.cs new file mode 100644 index 000000000000..504d5da65a60 --- /dev/null +++ b/src/Utilities/SourceFileMatcher.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Extensions.FileSystemGlobbing; + +namespace Microsoft.CodeAnalysis.Tools.Utilities +{ + internal static class SourceFileMatcher + { + private static IEnumerable AllFilesList => new[] { @"**/*.*" }; + + public static Matcher CreateMatcher(IEnumerable include, IEnumerable exclude) + { + var fileMatcher = new Matcher(StringComparison.OrdinalIgnoreCase); + fileMatcher.AddIncludePatterns(include.Any() ? include : AllFilesList); + fileMatcher.AddExcludePatterns(exclude); + return fileMatcher; + } + } +} diff --git a/src/Workspaces/FolderWorkspace.cs b/src/Workspaces/FolderWorkspace.cs index 815fbda5bb0e..bae48549637c 100644 --- a/src/Workspaces/FolderWorkspace.cs +++ b/src/Workspaces/FolderWorkspace.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Text; +using Microsoft.Extensions.FileSystemGlobbing; namespace Microsoft.CodeAnalysis.Tools.Workspaces { @@ -32,7 +33,7 @@ public static FolderWorkspace Create(HostServices hostServices) return new FolderWorkspace(hostServices); } - public async Task OpenFolder(string folderPath, ImmutableHashSet pathsToInclude, CancellationToken cancellationToken) + public async Task OpenFolder(string folderPath, Matcher fileMatcher, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(folderPath) || !Directory.Exists(folderPath)) { @@ -41,7 +42,7 @@ public async Task OpenFolder(string folderPath, ImmutableHashSet ProjectLoaders => ImmutableArray.Create(new CSharpProjectLoader(), new VisualBasicProjectLoader()); - public static async Task LoadSolutionInfoAsync(string folderPath, ImmutableHashSet pathsToInclude, CancellationToken cancellationToken) + public static async Task LoadSolutionInfoAsync(string folderPath, Matcher fileMatcher, CancellationToken cancellationToken) { var absoluteFolderPath = Path.IsPathFullyQualified(folderPath) ? folderPath @@ -25,7 +26,7 @@ public static async Task LoadSolutionInfoAsync(string folderPath, // Create projects for each of the supported languages. foreach (var loader in ProjectLoaders) { - var projectInfo = await loader.LoadProjectInfoAsync(folderPath, pathsToInclude, cancellationToken); + var projectInfo = await loader.LoadProjectInfoAsync(folderPath, fileMatcher, cancellationToken); if (projectInfo is null) { continue; diff --git a/src/Workspaces/FolderWorkspace_ProjectLoader.cs b/src/Workspaces/FolderWorkspace_ProjectLoader.cs index 6bfd8674d19c..9e9f8c89f602 100644 --- a/src/Workspaces/FolderWorkspace_ProjectLoader.cs +++ b/src/Workspaces/FolderWorkspace_ProjectLoader.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Immutable; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.FileSystemGlobbing; namespace Microsoft.CodeAnalysis.Tools.Workspaces { @@ -17,11 +17,11 @@ private abstract class ProjectLoader public abstract string FileExtension { get; } public virtual string ProjectName => $"{Language}{FileExtension}proj"; - public virtual async Task LoadProjectInfoAsync(string folderPath, ImmutableHashSet pathsToInclude, CancellationToken cancellationToken) + public virtual async Task LoadProjectInfoAsync(string folderPath, Matcher fileMatcher, CancellationToken cancellationToken) { var projectId = ProjectId.CreateNewId(debugName: folderPath); - var documents = await LoadDocumentInfosAsync(projectId, folderPath, FileExtension, pathsToInclude); + var documents = await LoadDocumentInfosAsync(projectId, folderPath, FileExtension, fileMatcher); if (documents.IsDefaultOrEmpty) { return null; @@ -37,16 +37,12 @@ public virtual async Task LoadProjectInfoAsync(string folderPath, I documents: documents); } - private static Task> LoadDocumentInfosAsync(ProjectId projectId, string folderPath, string fileExtension, ImmutableHashSet pathsToInclude) + private static Task> LoadDocumentInfosAsync(ProjectId projectId, string folderPath, string fileExtension, Matcher fileMatcher) { return Task.Run(() => { - var filePaths = Directory.GetFiles(folderPath, $"*{fileExtension}", SearchOption.AllDirectories); - if (!pathsToInclude.IsEmpty) - { - filePaths = filePaths.Where(filePath => - pathsToInclude.Any(path => filePath.StartsWith(path, StringComparison.OrdinalIgnoreCase))).ToArray(); - } + var filePaths = Directory.GetFiles(folderPath, $"*{fileExtension}", SearchOption.AllDirectories) + .Where(filePath => fileMatcher.Match(filePath).HasMatches).ToArray(); if (filePaths.Length == 0) { diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index e5f4e9c410ca..383963ff08d4 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -27,6 +27,7 @@ + diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index ff175fd7da51..2234157f7620 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -2,12 +2,12 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; using Microsoft.Extensions.Logging; using Xunit; @@ -16,17 +16,17 @@ namespace Microsoft.CodeAnalysis.Tools.Tests { public class CodeFormatterTests : IClassFixture, IClassFixture { - private const string FormattedProjectPath = "tests/projects/for_code_formatter/formatted_project"; - private const string FormattedProjectFilePath = FormattedProjectPath + "/formatted_project.csproj"; + private const string FormattedProjectPath = "tests/projects/for_code_formatter/formatted_project/"; + private const string FormattedProjectFilePath = FormattedProjectPath + "formatted_project.csproj"; private const string FormattedSolutionFilePath = "tests/projects/for_code_formatter/formatted_solution/formatted_solution.sln"; - private const string UnformattedProjectPath = "tests/projects/for_code_formatter/unformatted_project"; - private const string UnformattedProjectFilePath = UnformattedProjectPath + "/unformatted_project.csproj"; - private const string UnformattedProgramFilePath = UnformattedProjectPath + "/program.cs"; + private const string UnformattedProjectPath = "tests/projects/for_code_formatter/unformatted_project/"; + private const string UnformattedProjectFilePath = UnformattedProjectPath + "unformatted_project.csproj"; + private const string UnformattedProgramFilePath = UnformattedProjectPath + "program.cs"; private const string UnformattedSolutionFilePath = "tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln"; - private const string FSharpProjectPath = "tests/projects/for_code_formatter/fsharp_project"; - private const string FSharpProjectFilePath = FSharpProjectPath + "/fsharp_project.fsproj"; + private const string FSharpProjectPath = "tests/projects/for_code_formatter/fsharp_project/"; + private const string FSharpProjectFilePath = FSharpProjectPath + "fsharp_project.fsproj"; private static IEnumerable EmptyFilesList => Array.Empty(); @@ -282,12 +282,12 @@ public async Task LogFilesThatDontMatchExclude() [Fact] public async Task IgnoreFileWhenListedInExcludeList() { - var files = new[] { UnformattedProgramFilePath }; + var include = new[] { UnformattedProgramFilePath }; var log = await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, - include: files, - exclude: files, + include: include, + exclude: include, expectedExitCode: 0, expectedFilesFormatted: 0, expectedFileCount: 5); @@ -301,12 +301,32 @@ public async Task IgnoreFileWhenListedInExcludeList() [Fact] public async Task IgnoreFileWhenContainingFolderListedInExcludeList() { - var files = new[] { UnformattedProgramFilePath }; + var include = new[] { UnformattedProgramFilePath }; var exclude = new[] { UnformattedProjectPath }; var log = await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, - include: files, + include: include, + exclude: exclude, + expectedExitCode: 0, + expectedFilesFormatted: 0, + expectedFileCount: 5); + + var pattern = string.Format(Resources.Formatted_code_file_0, @"(.*)"); + var match = new Regex(pattern, RegexOptions.Multiline).Match(log); + + Assert.False(match.Success, log); + } + + [Fact] + public async Task IgnoreAllFileWhenExcludingAllFiles() + { + var include = new[] { UnformattedProgramFilePath }; + var exclude = new[] { "**/*.*" }; + + var log = await TestFormatWorkspaceAsync( + UnformattedSolutionFilePath, + include: include, exclude: exclude, expectedExitCode: 0, expectedFilesFormatted: 0, @@ -334,9 +354,7 @@ public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEn : WorkspaceType.Project; } - var pathsToInclude = include.Select(Path.GetFullPath).ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); - var pathsToExclude = exclude.Select(Path.GetFullPath).ToImmutableHashSet(StringComparer.OrdinalIgnoreCase); - + var fileMatcher = SourceFileMatcher.CreateMatcher(include, exclude); var logger = new TestLogger(); var formatOptions = new FormatOptions( workspacePath, @@ -344,8 +362,7 @@ public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEn LogLevel.Trace, saveFormattedFiles: false, changesAreErrors: false, - pathsToInclude, - pathsToExclude, + fileMatcher, reportPath: string.Empty); var formatResult = await CodeFormatter.FormatWorkspaceAsync(formatOptions, logger, CancellationToken.None); diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 0ba94d898725..82d86a335bf2 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -8,7 +8,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Testing; @@ -16,7 +15,6 @@ using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; using Microsoft.CodeAnalysis.Tools.Utilities; -using Microsoft.CodeAnalysis.VisualBasic; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.CodingConventions; using Microsoft.VisualStudio.Composition; @@ -95,14 +93,14 @@ private protected async Task TestAsync(string testCode, string expec var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray()); var project = solution.Projects.Single(); var document = project.Documents.Single(); + var fileMatcher = SourceFileMatcher.CreateMatcher(new[] { document.FilePath }, exclude: Array.Empty()); var formatOptions = new FormatOptions( workspaceFilePath: project.FilePath, workspaceType: WorkspaceType.Folder, logLevel: LogLevel.Trace, saveFormattedFiles: false, changesAreErrors: false, - pathsToInclude: ImmutableHashSet.Create(document.FilePath), - pathsToExclude: ImmutableHashSet.Create(), + fileMatcher, reportPath: string.Empty); var pathsToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index d2ce6b4cb190..239592066bcf 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -1,11 +1,12 @@ -using System.Collections.Generic; -using System.Collections.Immutable; +using System; +using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; +using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; using Xunit; @@ -49,14 +50,14 @@ private async Task> TestFormattedFiles(string testCode) var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray()); var project = solution.Projects.Single(); var document = project.Documents.Single(); + var fileMatcher = SourceFileMatcher.CreateMatcher(new[] { document.FilePath }, exclude: Array.Empty()); var formatOptions = new FormatOptions( workspaceFilePath: project.FilePath, workspaceType: WorkspaceType.Folder, logLevel: LogLevel.Trace, saveFormattedFiles: false, changesAreErrors: false, - pathsToInclude: ImmutableHashSet.Create(document.FilePath), - pathsToExclude: ImmutableHashSet.Create(), + fileMatcher, reportPath: string.Empty); var pathsToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index f8ce0f5860e5..cf81ef22fc8d 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -33,17 +33,5 @@ public void ExitCodeIsSameWithoutCheck() Assert.Equal(formatResult.ExitCode, exitCode); } - - [Fact] - public void FilesFormattedDirectorySeparatorInsensitive() - { - var filePath = $"other_items{Path.DirectorySeparatorChar}OtherClass.cs"; - var files = Program.GetRootedPaths(new[] { filePath }, folder: null); - - var filePathAlt = $"other_items{Path.AltDirectorySeparatorChar}OtherClass.cs"; - var filesAlt = Program.GetRootedPaths(new[] { filePathAlt }, folder: null); - - Assert.True(files.IsSubsetOf(filesAlt)); - } } } From 94e607d595664194d0d9e04a07f554a45d9520af Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2020 13:33:57 +0000 Subject: [PATCH 0868/2702] Update dependencies from https://github.com/dotnet/arcade build 20200216.1 (#556) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20116.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e69296295a75..07645f62b457 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - e133be6cf759f6badf7bc4052118ad8197eb03bf + 2086e534f12e6116889ee480646ef54c1f781887 diff --git a/global.json b/global.json index 8141ff152d9d..8e1fc8cf1a4c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20115.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20116.1" } } From 2ad1841591eb3d87d12a0dcfcd27fd59b5c86bb5 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 17 Feb 2020 07:46:45 -0800 Subject: [PATCH 0869/2702] Remove verbosity value check from option --- src/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Program.cs b/src/Program.cs index 96e7a9785d31..f02f25297d70 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -51,7 +51,7 @@ private static async Task Main(string[] args) }, new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic) { - Argument = new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(_verbosityLevels) + Argument = new Argument() { Arity = ArgumentArity.ExactlyOne } }, }; From d8e3a133493387215bb26c2357fd214f17954fde Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 18 Feb 2020 13:28:45 +0000 Subject: [PATCH 0870/2702] Update dependencies from https://github.com/dotnet/arcade build 20200217.3 (#558) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20117.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 07645f62b457..7f291943adfa 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 2086e534f12e6116889ee480646ef54c1f781887 + bd2a2b09716ddb54cb1e40f087beaaeeef859118 diff --git a/global.json b/global.json index 8e1fc8cf1a4c..3ae82b369184 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20116.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20117.3" } } From 6ed976403d01de346aa9cc4bf38cdb6e31c75b7f Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 18 Feb 2020 09:45:23 -0800 Subject: [PATCH 0871/2702] Use response file for CI formatting check (#557) --- azure-pipelines.yml | 2 +- validate.rsp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 validate.rsp diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3dbcd5218990..2ee8396e1a4b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -111,7 +111,7 @@ jobs: vmImage: 'vs2017-win2016' timeoutInMinutes: 5 steps: - - script: dotnet run --project ./src/dotnet-format.csproj -- --folder . --exclude ./tests/projects/ --check --report ./artifacts/log/ -v diag + - script: dotnet run --project ./src/dotnet-format.csproj -- @validate.rsp displayName: Run dotnet-format - task: PublishBuildArtifacts@1 displayName: Publish Logs diff --git a/validate.rsp b/validate.rsp new file mode 100644 index 000000000000..0288aac78333 --- /dev/null +++ b/validate.rsp @@ -0,0 +1,9 @@ +--folder +. +--exclude +./tests/projects/ +--check +--report +./artifacts/log/ +-v +diag \ No newline at end of file From d6fd6f257a04fc34695a84f16827e9626ee8435f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2020 13:33:29 +0000 Subject: [PATCH 0872/2702] Update dependencies from https://github.com/dotnet/arcade build 20200218.1 (#559) - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20118.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7f291943adfa..19911f3d08c5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - bd2a2b09716ddb54cb1e40f087beaaeeef859118 + b40d0c89c230189b4c6aeb32c0a43218b4bc3359 diff --git a/global.json b/global.json index 3ae82b369184..5db44eb6bc8f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20117.3" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20118.1" } } From 4713bda4cb32c85271b8e4018c44246dab6fad4a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 19 Feb 2020 13:33:34 +0000 Subject: [PATCH 0873/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200219.4 (#560) - Microsoft.NETCore.Compilers - 3.6.0-1.20119.4 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 19911f3d08c5..e9b03d0126df 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - b352609f6d26d934d54ee683cd284cd7858a3b5f + b4ccbd51744a00d6db85ea1c1a1db8241cc62e28 diff --git a/eng/Versions.props b/eng/Versions.props index 7fbc18b3ef3f..b7af4b49fd73 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.6.0-1.20114.6 + 3.6.0-1.20119.4 3.1.1 - 3.6.0-1.20119.4 + 3.6.0-1.20120.6 3.1.1 - 3.6.0-1.20120.6 + 3.6.0-1.20121.6 3.1.1 - - - - - netcoreapp2.1 - - - - - - - - - - - - - - - - - - - - - - - - - https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json - https://dotnetfeed.blob.core.windows.net/arcade-validation/index.json - https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json - https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json - https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json - https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json - https://dotnetfeed.blob.core.windows.net/dotnet-coreclr/index.json - https://dotnetfeed.blob.core.windows.net/dotnet-sdk/index.json - https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json - https://dotnetfeed.blob.core.windows.net/dotnet-toolset/index.json - https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json - https://dotnetfeed.blob.core.windows.net/nuget-nugetclient/index.json - https://dotnetfeed.blob.core.windows.net/aspnet-entityframework6/index.json - https://dotnetfeed.blob.core.windows.net/aspnet-blazor/index.json - - - - - - - - - - - - diff --git a/eng/common/PublishToSymbolServers.proj b/eng/common/PublishToSymbolServers.proj deleted file mode 100644 index 311e2bbe0f68..000000000000 --- a/eng/common/PublishToSymbolServers.proj +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - netcoreapp2.1 - - - - - - - - - - - - - - - - 3650 - true - true - true - false - - - - - - - - - - - - - - - - - diff --git a/eng/common/SourceLinkValidation.ps1 b/eng/common/SourceLinkValidation.ps1 deleted file mode 100644 index 0e4c349e00c6..000000000000 --- a/eng/common/SourceLinkValidation.ps1 +++ /dev/null @@ -1,195 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored - [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation - [Parameter(Mandatory=$true)][string] $SourceLinkToolPath, # Full path to directory where dotnet SourceLink CLI was installed - [Parameter(Mandatory=$true)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade - [Parameter(Mandatory=$true)][string] $GHCommit # GitHub commit SHA used to build the packages -) - -function ValidateSourceLinkLinks { - if (!($GHRepoName -Match "^[^\s\/]+/[^\s\/]+$")) { - Write-PipelineTelemetryError -Category "Build" -Message "GHRepoName should be in the format /" - $global:LASTEXITCODE = 1 - return - } - - if (!($GHCommit -Match "^[0-9a-fA-F]{40}$")) { - Write-PipelineTelemetryError -Category "Build" -Message "GHCommit should be a 40 chars hexadecimal string" - $global:LASTEXITCODE = 1 - return - } - - $RepoTreeURL = -Join("https://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1") - $CodeExtensions = @(".cs", ".vb", ".fs", ".fsi", ".fsx", ".fsscript") - - try { - # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash - $Data = Invoke-WebRequest $RepoTreeURL | ConvertFrom-Json | Select-Object -ExpandProperty tree - - foreach ($file in $Data) { - $Extension = [System.IO.Path]::GetExtension($file.path) - - if ($CodeExtensions.Contains($Extension)) { - $RepoFiles[$file.path] = 1 - } - } - } - catch { - Write-PipelineTelemetryError -Category "Build" -Message "Problems downloading the list of files from the repo. Url used: $RepoTreeURL" - $global:LASTEXITCODE = 1 - return - } - - if (Test-Path $ExtractPath) { - Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue - } - - # Process each NuGet package in parallel - $Jobs = @() - Get-ChildItem "$InputPath\*.symbols.nupkg" | - ForEach-Object { - $Jobs += Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName - } - - foreach ($Job in $Jobs) { - Wait-Job -Id $Job.Id | Receive-Job - } -} - -try { - . $PSScriptRoot\pipeline-logging-functions.ps1 - - # Cache/HashMap (File -> Exist flag) used to consult whether a file exist - # in the repository at a specific commit point. This is populated by inserting - # all files present in the repo at a specific commit point. - $global:RepoFiles = @{} - - $ValidatePackage = { - param( - [string] $PackagePath # Full path to a Symbols.NuGet package - ) - - # Ensure input file exist - if (!(Test-Path $PackagePath)) { - throw "Input file does not exist: $PackagePath" - } - - # Extensions for which we'll look for SourceLink information - # For now we'll only care about Portable & Embedded PDBs - $RelevantExtensions = @(".dll", ".exe", ".pdb") - - Write-Host -NoNewLine "Validating" ([System.IO.Path]::GetFileName($PackagePath)) "... " - - $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) - $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId - $FailedFiles = 0 - - Add-Type -AssemblyName System.IO.Compression.FileSystem - - [System.IO.Directory]::CreateDirectory($ExtractPath); - - $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) - - $zip.Entries | - Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | - ForEach-Object { - $FileName = $_.FullName - $Extension = [System.IO.Path]::GetExtension($_.Name) - $FakeName = -Join((New-Guid), $Extension) - $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName - - # We ignore resource DLLs - if ($FileName.EndsWith(".resources.dll")) { - return - } - - [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) - - $ValidateFile = { - param( - [string] $FullPath, # Full path to the module that has to be checked - [string] $RealPath, - [ref] $FailedFiles - ) - - # Makes easier to reference `sourcelink cli` - Push-Location $using:SourceLinkToolPath - - $SourceLinkInfos = .\sourcelink.exe print-urls $FullPath | Out-String - - if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) { - $NumFailedLinks = 0 - - # We only care about Http addresses - $Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches - - if ($Matches.Count -ne 0) { - $Matches.Value | - ForEach-Object { - $Link = $_ - $CommitUrl = -Join("https://raw.githubusercontent.com/", $using:GHRepoName, "/", $using:GHCommit, "/") - $FilePath = $Link.Replace($CommitUrl, "") - $Status = 200 - $Cache = $using:RepoFiles - - if ( !($Cache.ContainsKey($FilePath)) ) { - try { - $Uri = $Link -as [System.URI] - - # Only GitHub links are valid - if ($Uri.AbsoluteURI -ne $null -and $Uri.Host -match "github") { - $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode - } - else { - $Status = 0 - } - } - catch { - $Status = 0 - } - } - - if ($Status -ne 200) { - if ($NumFailedLinks -eq 0) { - if ($FailedFiles.Value -eq 0) { - Write-Host - } - - Write-Host "`tFile $RealPath has broken links:" - } - - Write-Host "`t`tFailed to retrieve $Link" - - $NumFailedLinks++ - } - } - } - - if ($NumFailedLinks -ne 0) { - $FailedFiles.value++ - $global:LASTEXITCODE = 1 - } - } - - Pop-Location - } - - &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) - } - - $zip.Dispose() - - if ($FailedFiles -eq 0) { - Write-Host "Passed." - } - } - - Measure-Command { ValidateSourceLinkLinks } -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'SourceLink' -Message $_ - ExitWithExitCode 1 -} - - diff --git a/global.json b/global.json index f4ff6ca9570b..01d47c74a864 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.0.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20120.2" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20121.6" } } From 1bfe14bde7aca9f3f8a21e3fbc22600b17ee8652 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2020 13:33:10 +0000 Subject: [PATCH 0880/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200221.21 (#567) - Microsoft.NETCore.Compilers - 3.6.0-1.20121.21 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 97cbadd25465..acb24996534e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 407c789247daf40bca00a20ad11fd07e492c9e1d + 5ac41c782b94bf2d417186382035757b649a23a9 diff --git a/eng/Versions.props b/eng/Versions.props index a485c3d7c79b..2e091b58a40e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.6.0-1.20121.6 + 3.6.0-1.20121.21 3.1.1 - 3.6.0-1.20121.21 + 3.6.0-1.20122.3 3.1.1 - 3.6.0-1.20122.3 + 3.6.0-1.20124.1 3.1.1 - 3.6.0-1.20124.1 + 3.6.0-1.20125.6 3.1.1 - 3.6.0-1.20125.6 + 3.6.0-2.20126.7 3.1.1 - 3.6.0-2.20126.7 + 3.6.0-2.20127.7 3.1.1 - 3.6.0-2.20127.7 + 3.6.0-2.20127.9 3.1.1 - 3.6.0-2.20127.9 + 3.6.0-2.20129.4 3.1.1 - 3.6.0-2.20129.4 + 3.6.0-2.20152.4 3.1.1 - 3.6.0-2.20152.4 + 3.6.0-2.20153.4 3.1.1 - 3.6.0-2.20153.4 + 3.6.0-2.20153.8 3.1.1 - - - - - netcoreapp2.1 - - - - - - - - $(NuGetPackageRoot)Microsoft.DotNet.SignCheck\$(SignCheckVersion)\tools\Microsoft.DotNet.SignCheck.exe - - $(PackageBasePath) - signcheck.log - signcheck.errors.log - signcheck.exclusions.txt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 2a30ccfd7463..435e7641341b 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -7,7 +7,7 @@ param ( . $PSScriptRoot\tools.ps1 -function InstallDarcCli ($darcVersion) { +function InstallDarcCli ($darcVersion, $toolpath) { $darcCliPackageName = 'microsoft.dotnet.darc' $dotnetRoot = InitializeDotNetCli -install:$true @@ -32,13 +32,13 @@ function InstallDarcCli ($darcVersion) { Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g }else { - Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g --tool-path '$toolpath'" + Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity --tool-path '$toolpath'" & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath" } } try { - InstallDarcCli $darcVersion + InstallDarcCli $darcVersion $toolpath } catch { Write-Host $_.ScriptStackTrace diff --git a/eng/common/templates/post-build/channels/generic-public-channel.yml b/eng/common/templates/post-build/channels/generic-public-channel.yml index 29bc1a941ad4..08853ec45e0c 100644 --- a/eng/common/templates/post-build/channels/generic-public-channel.yml +++ b/eng/common/templates/post-build/channels/generic-public-channel.yml @@ -10,6 +10,8 @@ parameters: transportFeed: '' shippingFeed: '' symbolsFeed: '' + # If the channel name is empty, no links will be generated + akaMSChannelName: '' stages: - stage: ${{ parameters.stageName }} @@ -161,6 +163,9 @@ stages: /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' /p:AzureDevOpsStaticSymbolsFeed='${{ parameters.symbolsFeed }}' /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:LatestLinkShortUrlPrefix=dotnet/'${{ parameters.akaMSChannelName }}' + /p:AkaMSClientId=$(akams-client-id) + /p:AkaMSClientSecret=$(akams-client-secret) ${{ parameters.artifactsPublishingAdditionalParameters }} - template: ../../steps/publish-logs.yml diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 05ff3561fc9a..7be5b0bfad4e 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -199,6 +199,7 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} stageName: 'NetCore_Dev5_Publish' channelName: '.NET Core 5 Dev' + akaMSChannelName: 'net5/dev' channelId: ${{ parameters.NetCoreDev5ChannelId }} transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' @@ -212,6 +213,7 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} stageName: 'Net5_Preview1_Publish' channelName: '.NET 5 Preview 1' + akaMSChannelName: 'net5/preview1' channelId: ${{ parameters.Net5Preview1ChannelId }} transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' @@ -225,6 +227,7 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} stageName: 'Net5_Preview2_Publish' channelName: '.NET 5 Preview 2' + akaMSChannelName: 'net5/preview2' channelId: ${{ parameters.Net5Preview2ChannelId }} transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' @@ -238,6 +241,7 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} stageName: 'Net_Eng_Latest_Publish' channelName: '.NET Eng - Latest' + akaMSChannelName: 'eng/daily' channelId: ${{ parameters.NetEngLatestChannelId }} transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' @@ -251,6 +255,7 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} stageName: 'Net_Eng_Validation_Publish' channelName: '.NET Eng - Validation' + akaMSChannelName: 'eng/validation' channelId: ${{ parameters.NetEngValidationChannelId }} transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' @@ -264,6 +269,7 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} stageName: 'General_Testing_Publish' channelName: 'General Testing' + akaMSChannelName: 'generaltesting' channelId: ${{ parameters.GeneralTestingChannelId }} transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' diff --git a/global.json b/global.json index 405350bddd64..f75d53aa9ee6 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "3.1.101" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20153.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20154.1" } } From ea64788acd8744d85742c1775b068e6182be5434 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2020 13:32:29 +0000 Subject: [PATCH 0904/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200305.6 (#594) - Microsoft.NETCore.Compilers - 3.6.0-2.20155.6 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7ad792f24e99..423778cc269e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 0c057298dced958bb83e6335200249563e5b2a1c + 3a6e99414ed903c670a8e5c1d1da9c45660f8479 diff --git a/eng/Versions.props b/eng/Versions.props index 35cc785a15eb..9fecbe1e2c21 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.6.0-2.20153.8 + 3.6.0-2.20155.6 3.1.1 - 3.6.0-2.20155.6 + 3.6.0-2.20155.9 3.1.1 - 3.6.0-2.20155.9 + 3.6.0-2.20157.5 3.1.1 - 3.6.0-2.20157.5 + 3.6.0-2.20158.1 3.1.1 - 3.6.0-2.20158.1 + 3.6.0-2.20158.2 3.1.1 @@ -219,4 +219,7 @@ A list of relative file or folder paths to exclude from formatting. - + + Using MSBuild.exe located in '{0}' + + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index fc4dac93ddff..438fb2081608 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index e060569068d7..e86206598d5d 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 1b2a2a01e912..0dbb098f59ff 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 84dc09990ad1..9bdb3a39cc86 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index b1dad16dff2d..ad6b320c4fd1 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index bdc69b5c9341..0fdd27f4818c 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 78fb2bab3ce1..487f0b633968 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 303f09da7477..e895209f31ac 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index cbed71e93c1d..4179eb144cff 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 080a55d76dc4..d9690137d9bc 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index a85d1262a060..f82fb77985ae 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index e5c2c06b734c..dd7cb72b3e44 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 1cb6f71aa843..292ee80bddae 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Using MSBuild.exe located in '{0}' + Using MSBuild.exe located in '{0}' + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. From 831c849628461d1a67d9e8a3f896d64d82c4647f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2020 12:32:04 +0000 Subject: [PATCH 0913/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200310.3 (#604) - Microsoft.NETCore.Compilers - 3.6.0-2.20160.3 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b945205e24b5..610240a2ab5e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ccef677ead2a68189a4e9439d858cab57485dd77 + 9c29a833139d5ebc91d801d60b4619b7af5205d5 diff --git a/eng/Versions.props b/eng/Versions.props index abf005070dd9..1830495f7494 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ - 3.6.0-2.20158.2 + 3.6.0-2.20160.3 3.1.1 - 3.6.0-2.20160.3 + 3.6.0-2.20164.4 3.1.1 - 3.6.0-2.20164.4 + 3.6.0-2.20165.1 3.1.1 - 3.6.0-2.20165.1 + 3.6.0-2.20166.2 3.1.1 - 3.6.0-2.20166.2 + 3.6.0-2.20167.1 3.1.1 - 3.6.0-2.20167.1 + 3.6.0-3.20168.1 3.1.1 - 3.6.0-3.20168.1 + 3.6.0-3.20168.4 3.1.1 - 3.6.0-3.20168.4 + 3.6.0-3.20170.19 3.1.1 - 3.6.0-3.20170.19 + 3.6.0-3.20173.6 3.1.1 - 3.6.0-3.20173.6 + 3.6.0-3.20174.4 3.1.1 - 3.6.0-3.20174.4 + 3.6.0-3.20175.5 3.1.1 - 3.6.0-3.20175.5 + 3.6.0-3.20177.4 3.1.1 - 3.6.0-3.20177.4 + 3.6.0-3.20177.6 3.1.1 - 3.6.0-3.20177.6 + 3.6.0-3.20181.2 3.1.1 - 3.6.0-3.20181.2 + 3.6.0-3.20181.5 3.1.1 3.6.0-3.20181.5 3.1.1 @@ -17,13 +18,14 @@ 2.0.0-beta1.20104.2 0.3.0-alpha.20104.2 + $(MicrosoftBuildVersion) 1.2.6 1.0.1-beta1.20114.4 $(MicrosoftExtensionsVersion) $(MicrosoftExtensionsVersion) $(MicrosoftExtensionsVersion) 1.1.20180503.2 - 3.0.0-beta2.20114.1 + 3.0.0-beta2.20169.3 $(MicrosoftNETCoreCompilersPackageVersion) 4.7.0 diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 383963ff08d4..86b4494a74e0 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -25,6 +25,7 @@ + From 91e1cbead24f8bde475433f3d62dda403c13feb2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2020 12:28:40 +0000 Subject: [PATCH 0939/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200401.6 (#626) - Microsoft.NETCore.Compilers - 3.6.0-3.20201.6 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d51259eac4d2..c8c64d52855e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c48bd2c060bce381a165e928af66449da48dea22 + 8167e4880190407325d6cf7282f6bb62267abc56 diff --git a/eng/Versions.props b/eng/Versions.props index 468d5dcc2b8e..9454a75e31b4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.6.0-3.20181.5 + 3.6.0-3.20201.6 3.1.1 - 3.6.0-3.20201.6 + 3.6.0-3.20202.4 3.1.1 - 3.6.0-3.20202.4 + 3.6.0-3.20203.4 3.1.1 - 3.6.0-3.20203.4 + 3.6.0-3.20207.1 3.1.1 - 3.6.0-3.20207.1 + 3.7.0-1.20208.4 3.1.1 - 3.7.0-1.20208.4 + 3.7.0-1.20208.15 3.1.1 - 3.7.0-1.20208.15 + 3.7.0-1.20210.7 3.1.1 - 3.7.0-1.20210.7 + 3.7.0-1.20216.3 3.1.1 - 3.7.0-1.20216.3 + 3.7.0-1.20217.1 3.1.1 - 3.7.0-1.20217.1 + 3.7.0-1.20223.1 3.1.1 - 3.7.0-1.20223.1 + 3.7.0-1.20224.1 3.1.1 - 3.7.0-1.20224.1 + 3.7.0-1.20225.2 3.1.1 - 3.7.0-1.20225.2 + 3.7.0-1.20226.2 3.1.1 - 3.7.0-1.20226.2 + 3.7.0-1.20226.3 3.1.1 @@ -222,4 +222,7 @@ Using MSBuild.exe located in '{0}' + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index de44bdf1dfe8..e6b48524e2f2 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 7ad6fcb9545f..30d89107c987 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 56841203cee9..5eae9beb2836 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index a846f6a0f655..246507577c7e 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 5d72ecde7afe..eafd6efb5eca 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 0b593b35bb51..10cf4718cfc4 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index fe73ce60cd93..81756f1572ae 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 297097bb6da3..b2e0b85cd69b 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index a462ebe638e6..34f76c4d87e4 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index f97c9b72e499..12acd55d34b5 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index b7693219dfca..d04366c7845b 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 3ec4683b643f..10e535db827b 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index ea98b57492dd..1a8d96ffa5fa 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -162,6 +162,11 @@ Formatted code file '{0}'. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + + Using MSBuild.exe located in '{0}' Using MSBuild.exe located in '{0}' From 609811e9a0f7103ccc03dcff3410b6227b41b72f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 29 Apr 2020 12:30:07 +0000 Subject: [PATCH 0966/2702] [master] Update dependencies from dotnet/roslyn (#659) * Update dependencies from https://github.com/dotnet/roslyn build 20200428.3 - Microsoft.NETCore.Compilers: 3.7.0-1.20226.3 -> 3.7.0-1.20228.3 * Update dependencies from https://github.com/dotnet/roslyn build 20200428.6 - Microsoft.NETCore.Compilers: 3.7.0-1.20226.3 -> 3.7.0-1.20228.6 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3498831c7b9b..01c3de0dc515 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 165c98a27a6004ac23fd511fa950a379d8b3f034 + 2f66ec89c2c1e43f9322429dba10f8dc275a8792 diff --git a/eng/Versions.props b/eng/Versions.props index 97f936cbca0e..739caeeb72f2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.7.0-1.20226.3 + 3.7.0-1.20228.6 3.1.1 - 3.7.0-1.20228.6 + 3.7.0-1.20230.2 3.1.1 - 3.7.0-1.20230.2 + 3.7.0-1.20251.6 3.1.1 - 3.7.0-1.20251.6 + 3.7.0-1.20252.1 3.1.1 - 3.7.0-1.20252.1 + 3.7.0-1.20253.3 3.1.1 - 3.7.0-1.20253.3 + 3.7.0-1.20254.1 3.1.1 - 3.7.0-1.20254.1 + 3.7.0-2.20256.6 3.1.1 - 3.7.0-2.20256.6 + 3.7.0-2.20257.5 3.1.1 - 3.7.0-2.20257.5 + 3.7.0-2.20258.1 3.1.1 - 3.7.0-2.20258.1 + 3.7.0-2.20259.1 3.1.1 - 3.7.0-2.20259.1 + 3.7.0-2.20262.1 3.1.1 - 3.7.0-2.20262.1 + 3.7.0-2.20262.4 3.1.1 - 3.7.0-2.20262.4 + 3.7.0-2.20264.2 3.1.1 - 3.7.0-2.20264.2 + 3.7.0-2.20265.2 3.1.1 - 3.7.0-2.20265.2 + 3.7.0-2.20267.1 3.1.1 - 3.7.0-2.20267.1 + 3.7.0-3.20269.8 3.1.1 - 3.7.0-3.20269.8 + 3.7.0-3.20269.11 3.1.1 - 3.7.0-3.20269.11 + 3.7.0-3.20271.4 3.1.1 @@ -234,4 +234,10 @@ The dotnet CLI version is '{0}'. + + Cannot specify both project argument and workspace option. + + + "workspace" option is deprecated. Use the project argument instead. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index ae6ac2d79f6d..3e0ea4e2fb89 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 6e524c1c5ba9..c002af29d864 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 0d5fd2ceffc9..dd55f6a8833b 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 1bd4f227b659..e78052a4f000 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index c2371d58b488..5fde3e23052b 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 8da60c6309dc..3af542732198 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 1e9553e73504..417aef6441a2 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index ba19dff83a67..f5ee0bc6311a 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 1780f9863b6d..8ebce8474ff9 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 0bac117581d1..d28272e9eaa5 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index e6f31a149a37..5010f8c7ef08 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 7ec1a3059ff8..5db30bd2127f 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index ed6ee9459736..33098b38f85c 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and workspace option. + Cannot specify both project argument and workspace option. + + Complete in {0}ms. Complete in {0}ms. diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 443c551351bf..c4bbd7c99f7c 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -59,7 +59,7 @@ public void CommandLine_OptionsAreParsedCorrectly() "--include-generated"}); // Assert - Assert.Equal(0, result.Errors.Count); + Assert.Equal(1, result.Errors.Count); // folder and workspace can not be combined Assert.Equal(0, result.UnmatchedTokens.Count); Assert.Equal(0, result.UnparsedTokens.Count); Assert.Equal("folder", result.ValueForOption("folder")); @@ -151,5 +151,44 @@ public void CommandLine_ProjectArgument_FailesIfSpecifiedTwice() // Assert Assert.Equal(1, result.Errors.Count); } + + [Fact] + public void CommandLine_ProjectArgumentAndWorkspaceCanNotBeCombined() + { + // Arrange + var sut = Program.CreateCommandLineOptions(); + + // Act + var result = sut.Parse(new[] { "projectValue", "--workspace", "workspace"}); + + // Assert + Assert.Equal(1, result.Errors.Count); + } + + [Fact] + public void CommandLine_ProjectWorkspaceAndFolderCanNotBeCombined1() + { + // Arrange + var sut = Program.CreateCommandLineOptions(); + + // Act + var result = sut.Parse(new[] { "projectValue", "--folder", "folder" }); + + // Assert + Assert.Equal(1, result.Errors.Count); + } + + [Fact] + public void CommandLine_ProjectWorkspaceAndFolderCanNotBeCombined2() + { + // Arrange + var sut = Program.CreateCommandLineOptions(); + + // Act + var result = sut.Parse(new[] { "--workspace", "workspace", "--folder", "folder" }); + + // Assert + Assert.Equal(1, result.Errors.Count); + } } } From d777a669d8a84468a8d1940dd701ede0bc334695 Mon Sep 17 00:00:00 2001 From: Martin Strecker Date: Thu, 21 May 2020 21:00:50 +0100 Subject: [PATCH 0997/2702] translations --- src/xlf/Resources.cs.xlf | 5 +++++ src/xlf/Resources.de.xlf | 5 +++++ src/xlf/Resources.es.xlf | 5 +++++ src/xlf/Resources.fr.xlf | 5 +++++ src/xlf/Resources.it.xlf | 5 +++++ src/xlf/Resources.ja.xlf | 5 +++++ src/xlf/Resources.ko.xlf | 5 +++++ src/xlf/Resources.pl.xlf | 5 +++++ src/xlf/Resources.pt-BR.xlf | 5 +++++ src/xlf/Resources.ru.xlf | 5 +++++ src/xlf/Resources.tr.xlf | 5 +++++ src/xlf/Resources.zh-Hans.xlf | 5 +++++ src/xlf/Resources.zh-Hant.xlf | 5 +++++ 13 files changed, 65 insertions(+) diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 3e0ea4e2fb89..e77701a0622d 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index c002af29d864..c89fe9cdd5d5 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index dd55f6a8833b..30d93848c7bb 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index e78052a4f000..c50b964546b5 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 5fde3e23052b..f592257e3d6a 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 3af542732198..1e3c6d8fcfe9 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 417aef6441a2..c086e84dfbec 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index f5ee0bc6311a..0cef89e07d7e 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 8ebce8474ff9..b0de230f094b 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index d28272e9eaa5..ba8244ab21bb 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 5010f8c7ef08..720d24b878ae 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 5db30bd2127f..70e9f1f00cf9 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 33098b38f85c..4afa4f5dee16 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -197,6 +197,11 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + + "workspace" option is deprecated. Use the project argument instead. + "workspace" option is deprecated. Use the project argument instead. + + Writing formatting report to: '{0}'. Writing formatting report to: '{0}'. From 7f66636a518794ad1dfa699bd7c86b22f6d4f8a1 Mon Sep 17 00:00:00 2001 From: Martin Strecker Date: Thu, 21 May 2020 21:25:45 +0100 Subject: [PATCH 0998/2702] Make validation more robust and add test for exceptions in the validators. --- src/Program.cs | 32 ++++++++++++++++++++++---------- tests/ProgramTests.cs | 24 ++++++++++++++++++++---- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/Program.cs b/src/Program.cs index d1e7e628a6fe..1de1f623b0d0 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -88,11 +88,17 @@ public static RootCommand CreateCommandLineOptions() private static string? ValidateProjectArgumentAndWorkspace(CommandResult symbolResult) { - var project = symbolResult.GetArgumentValueOrDefault("project"); - var workspace = symbolResult.OptionResult("workspace").GetValueOrDefault(); - if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(workspace)) + try + { + var project = symbolResult.GetArgumentValueOrDefault("project"); + var workspace = symbolResult.ValueForOption("workspace"); + if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(workspace)) + { + return Resources.Cannot_specify_both_project_argument_and_workspace_option; + } + } + catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. { - return Resources.Cannot_specify_both_project_argument_and_workspace_option; } return null; @@ -100,13 +106,19 @@ public static RootCommand CreateCommandLineOptions() private static string? ValidateWorkspaceAndFolder(CommandResult symbolResult) { - var project = symbolResult.GetArgumentValueOrDefault("project"); - var workspace = symbolResult.OptionResult("workspace").GetValueOrDefault(); - var folder = symbolResult.OptionResult("folder").GetValueOrDefault(); - project ??= workspace; - if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(folder)) + try + { + var project = symbolResult.GetArgumentValueOrDefault("project"); + var workspace = symbolResult.ValueForOption("workspace"); + var folder = symbolResult.ValueForOption("folder"); + project ??= workspace; + if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(folder)) + { + return Resources.Cannot_specify_both_folder_and_workspace_options; + } + } + catch (InvalidOperationException)// Parsing of arguments failed. This will be reported later. { - return Resources.Cannot_specify_both_folder_and_workspace_options; } return null; diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index c4bbd7c99f7c..df97503af4e6 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -11,7 +11,6 @@ namespace Microsoft.CodeAnalysis.Tools.Tests public class ProgramTests { // Should be kept in sync with Program.Run - // private delegate void TestCommandHandlerDelegate(string project, string folder, string workspace, string verbosity, bool check, string[] include, string[] exclude, string report, bool includeGenerated); [Fact] @@ -64,8 +63,12 @@ public void CommandLine_OptionsAreParsedCorrectly() Assert.Equal(0, result.UnparsedTokens.Count); Assert.Equal("folder", result.ValueForOption("folder")); Assert.Equal("workspace", result.ValueForOption("workspace")); - Assert.Collection(result.ValueForOption>("include"), i0 => Assert.Equal("include1", i0), i1 => Assert.Equal("include2", i1)); - Assert.Collection(result.ValueForOption>("exclude"), i0 => Assert.Equal("exclude1", i0), i1 => Assert.Equal("exclude2", i1)); + Assert.Collection(result.ValueForOption>("include"), + i0 => Assert.Equal("include1", i0), + i1 => Assert.Equal("include2", i1)); + Assert.Collection(result.ValueForOption>("exclude"), + i0 => Assert.Equal("exclude1", i0), + i1 => Assert.Equal("exclude2", i1)); Assert.True(result.ValueForOption("check")); Assert.Equal("report", result.ValueForOption("report")); Assert.Equal("verbosity", result.ValueForOption("verbosity")); @@ -159,7 +162,7 @@ public void CommandLine_ProjectArgumentAndWorkspaceCanNotBeCombined() var sut = Program.CreateCommandLineOptions(); // Act - var result = sut.Parse(new[] { "projectValue", "--workspace", "workspace"}); + var result = sut.Parse(new[] { "projectValue", "--workspace", "workspace" }); // Assert Assert.Equal(1, result.Errors.Count); @@ -190,5 +193,18 @@ public void CommandLine_ProjectWorkspaceAndFolderCanNotBeCombined2() // Assert Assert.Equal(1, result.Errors.Count); } + + [Fact] + public void CommandLine_InvalidArgumentsDontCrashTheValidators() + { + // Arrange + var sut = Program.CreateCommandLineOptions(); + + // Act + var result = sut.Parse(new[] { "--workspace", "workspace1", "--workspace", "workspace2" }); + + // Assert + Assert.Equal(1, result.Errors.Count); + } } } From d67a64d2dd7046c074bbfc0c56217fb23a7d7039 Mon Sep 17 00:00:00 2001 From: Martin Strecker Date: Thu, 21 May 2020 21:38:33 +0100 Subject: [PATCH 0999/2702] Re-factor validators to local functions. --- src/Program.cs | 56 +++++++++++++++++++++---------------------- tests/ProgramTests.cs | 7 +++--- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/Program.cs b/src/Program.cs index 1de1f623b0d0..3de0b3ef8a34 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -84,44 +84,44 @@ public static RootCommand CreateCommandLineOptions() rootCommand.AddValidator(ValidateWorkspaceAndFolder); rootCommand.Handler = CommandHandler.Create(typeof(Program).GetMethod(nameof(Run))); return rootCommand; - } - private static string? ValidateProjectArgumentAndWorkspace(CommandResult symbolResult) - { - try + static string? ValidateProjectArgumentAndWorkspace(CommandResult symbolResult) { - var project = symbolResult.GetArgumentValueOrDefault("project"); - var workspace = symbolResult.ValueForOption("workspace"); - if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(workspace)) + try + { + var project = symbolResult.GetArgumentValueOrDefault("project"); + var workspace = symbolResult.ValueForOption("workspace"); + if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(workspace)) + { + return Resources.Cannot_specify_both_project_argument_and_workspace_option; + } + } + catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. { - return Resources.Cannot_specify_both_project_argument_and_workspace_option; } - } - catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. - { - } - return null; - } + return null; + } - private static string? ValidateWorkspaceAndFolder(CommandResult symbolResult) - { - try + static string? ValidateWorkspaceAndFolder(CommandResult symbolResult) { - var project = symbolResult.GetArgumentValueOrDefault("project"); - var workspace = symbolResult.ValueForOption("workspace"); - var folder = symbolResult.ValueForOption("folder"); - project ??= workspace; - if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(folder)) + try + { + var project = symbolResult.GetArgumentValueOrDefault("project"); + var workspace = symbolResult.ValueForOption("workspace"); + var folder = symbolResult.ValueForOption("folder"); + project ??= workspace; + if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(folder)) + { + return Resources.Cannot_specify_both_folder_and_workspace_options; + } + } + catch (InvalidOperationException)// Parsing of arguments failed. This will be reported later. { - return Resources.Cannot_specify_both_folder_and_workspace_options; } - } - catch (InvalidOperationException)// Parsing of arguments failed. This will be reported later. - { - } - return null; + return null; + } } public static async Task Run(string? project, string? folder, string? workspace, string? verbosity, bool check, string[] include, string[] exclude, string? report, bool includeGenerated, IConsole console = null!) diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index df97503af4e6..dabcc0bb728d 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -11,7 +11,8 @@ namespace Microsoft.CodeAnalysis.Tools.Tests public class ProgramTests { // Should be kept in sync with Program.Run - private delegate void TestCommandHandlerDelegate(string project, string folder, string workspace, string verbosity, bool check, string[] include, string[] exclude, string report, bool includeGenerated); + private delegate void TestCommandHandlerDelegate(string project, string folder, string workspace, string verbosity, bool check, + string[] include, string[] exclude, string report, bool includeGenerated); [Fact] public void ExitCodeIsOneWithCheckAndAnyFilesFormatted() @@ -127,7 +128,8 @@ public void CommandLine_ProjectArgument_GetsPassedToHandler() var handlerWasCalled = false; sut.Handler = CommandHandler.Create(new TestCommandHandlerDelegate(TestCommandHandler)); - void TestCommandHandler(string project, string folder, string workspace, string verbosity, bool check, string[] include, string[] exclude, string report, bool includeGenerated) + void TestCommandHandler(string project, string folder, string workspace, string verbosity, bool check, + string[] include, string[] exclude, string report, bool includeGenerated) { handlerWasCalled = true; Assert.Equal("projectValue", project); @@ -141,7 +143,6 @@ void TestCommandHandler(string project, string folder, string workspace, string Assert.True(handlerWasCalled); } - [Fact] public void CommandLine_ProjectArgument_FailesIfSpecifiedTwice() { From 877bb9cd9084a6e80b00939e415fafb6f2fc4e0a Mon Sep 17 00:00:00 2001 From: Martin Strecker Date: Thu, 21 May 2020 21:49:22 +0100 Subject: [PATCH 1000/2702] Make CreateCommandLineOptions internal. --- src/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Program.cs b/src/Program.cs index 3de0b3ef8a34..07cb52b920d2 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -35,7 +35,7 @@ private static async Task Main(string[] args) return await rootCommand.InvokeAsync(args); } - public static RootCommand CreateCommandLineOptions() + internal static RootCommand CreateCommandLineOptions() { var rootCommand = new RootCommand { From 1a469261299c16bf0cfe5ab76c87ecb9aae8d256 Mon Sep 17 00:00:00 2001 From: Martin Strecker Date: Thu, 21 May 2020 22:09:10 +0100 Subject: [PATCH 1001/2702] Formatting --- tests/ProgramTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index dabcc0bb728d..a400b8923302 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Tools.Tests public class ProgramTests { // Should be kept in sync with Program.Run - private delegate void TestCommandHandlerDelegate(string project, string folder, string workspace, string verbosity, bool check, + private delegate void TestCommandHandlerDelegate(string project, string folder, string workspace, string verbosity, bool check, string[] include, string[] exclude, string report, bool includeGenerated); [Fact] @@ -128,7 +128,7 @@ public void CommandLine_ProjectArgument_GetsPassedToHandler() var handlerWasCalled = false; sut.Handler = CommandHandler.Create(new TestCommandHandlerDelegate(TestCommandHandler)); - void TestCommandHandler(string project, string folder, string workspace, string verbosity, bool check, + void TestCommandHandler(string project, string folder, string workspace, string verbosity, bool check, string[] include, string[] exclude, string report, bool includeGenerated) { handlerWasCalled = true; From dfa942e4721e90d838ff4c80235f30fd5996890f Mon Sep 17 00:00:00 2001 From: Martin Strecker Date: Fri, 22 May 2020 09:05:01 +0100 Subject: [PATCH 1002/2702] Remove duplicate check for folder and workspace both being set --- src/Program.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Program.cs b/src/Program.cs index 07cb52b920d2..69fe8e57e26e 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -157,12 +157,7 @@ public static async Task Run(string? project, string? folder, string? works } workspace ??= project; - if (!string.IsNullOrEmpty(folder) && !string.IsNullOrEmpty(workspace)) - { - logger.LogWarning(Resources.Cannot_specify_both_folder_and_workspace_options); - return 1; - } - else if (!string.IsNullOrEmpty(workspace)) + if (!string.IsNullOrEmpty(workspace)) { var (isSolution, workspaceFilePath) = MSBuildWorkspaceFinder.FindWorkspace(currentDirectory, workspace); @@ -176,7 +171,10 @@ public static async Task Run(string? project, string? folder, string? works // a global.json if present. var directoryName = Path.GetDirectoryName(workspacePath); if (directoryName is null) + { throw new Exception($"Unable to find folder at '{workspacePath}'"); + } + workspaceDirectory = directoryName; } else From 1c03fa2fbc365aa9be8303e546ba71724a454c68 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 22 May 2020 15:09:08 -0700 Subject: [PATCH 1003/2702] Move to Roslyn's .editorconfig support. --- .vscode/launch.json | 19 ++ NuGet.config | 1 - eng/Versions.props | 4 +- eng/format-verifier.ps1 | 6 +- src/CodeFormatter.cs | 234 +++++++++--------- src/DocumentWithOptions.cs | 31 +++ src/Formatters/CharsetFormatter.cs | 13 +- src/Formatters/DocumentFormatter.cs | 23 +- src/Formatters/EndOfLineFormatter.cs | 13 +- src/Formatters/FinalNewlineFormatter.cs | 12 +- src/Formatters/ICodeFormatter.cs | 4 +- src/Formatters/WhitespaceFormatter.cs | 20 +- src/Utilities/EditorConfigFinder.cs | 40 +++ src/Utilities/EditorConfigOptions.cs | 21 ++ src/Utilities/EditorConfigOptionsApplier.cs | 92 ------- src/Utilities/GeneratedCodeUtilities.cs | 29 +-- .../FolderWorkspace_ProjectLoader.cs | 14 +- src/dotnet-format.csproj | 3 +- tests/Formatters/AbstractFormatterTests.cs | 11 +- .../TestCodingConventionsSnapshot.cs | 45 ---- 20 files changed, 310 insertions(+), 325 deletions(-) create mode 100644 src/DocumentWithOptions.cs create mode 100644 src/Utilities/EditorConfigFinder.cs create mode 100644 src/Utilities/EditorConfigOptions.cs delete mode 100644 src/Utilities/EditorConfigOptionsApplier.cs delete mode 100644 tests/Utilities/TestCodingConventionsSnapshot.cs diff --git a/.vscode/launch.json b/.vscode/launch.json index fe7ff94eb025..9f35c31f9ba7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,25 @@ // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md "version": "0.2.0", "configurations": [ + { + "name": "dotnet-format -f ../roslyn --dry-run", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/dotnet-format.dll", + "args": [ + "-f", + "../roslyn/src", + "-v", + "diag", + "--dry-run" + ], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, { "name": "dotnet-format -f . --dry-run", "type": "coreclr", diff --git a/NuGet.config b/NuGet.config index 52f3364eff0e..1412dcd82ffa 100644 --- a/NuGet.config +++ b/NuGet.config @@ -5,7 +5,6 @@ - diff --git a/eng/Versions.props b/eng/Versions.props index 7b597b094f11..1745e0ee4294 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -24,10 +24,12 @@ $(MicrosoftExtensionsVersion) $(MicrosoftExtensionsVersion) $(MicrosoftExtensionsVersion) - 1.1.20180503.2 3.0.0 $(MicrosoftNETCoreCompilersPackageVersion) 4.7.0 + + + 12.0.2 true diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index e6f5ca68c4c1..6a6f4235a679 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -19,7 +19,7 @@ try { if ($stage -eq "prepare") { Write-Output "$(Get-Date) - Cloning $repoName." - git.exe clone $repo $repoPath + git.exe clone $repo $repoPath --single-branch --no-tags } Set-Location $repoPath @@ -56,7 +56,7 @@ try { if ($stage -eq "format-workspace") { Write-Output "$(Get-Date) - $solutionFile - Formatting Workspace" - $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- -w $solution -v d --dry-run | Out-String + $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- -w $solution -v diag --check | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. @@ -77,7 +77,7 @@ try { if ($stage -eq "format-folder") { Write-Output "$(Get-Date) - $folderName - Formatting Folder" - $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- -f $repoPath -v d --dry-run | Out-String + $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- -f $repoPath -v diag --check | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 06e954324aab..6a8e6cb8d74c 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -10,14 +10,13 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Build.Logging; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.MSBuild; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.CodeAnalysis.Tools.Workspaces; using Microsoft.Extensions.FileSystemGlobbing; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; namespace Microsoft.CodeAnalysis.Tools { @@ -31,6 +30,9 @@ internal static class CodeFormatter new CharsetFormatter(), }.ToImmutableArray(); + private static readonly Dictionary s_analyzerConfigSets = new Dictionary(); + private static readonly Dictionary s_editorConfigOptions = new Dictionary(); + public static async Task FormatWorkspaceAsync( FormatOptions options, ILogger logger, @@ -46,8 +48,10 @@ public static async Task FormatWorkspaceAsync( var workspaceStopwatch = Stopwatch.StartNew(); - using var workspace = await OpenWorkspaceAsync( - workspaceFilePath, workspaceType, fileMatcher, logWorkspaceWarnings, logger, cancellationToken, createBinaryLog).ConfigureAwait(false); + using var workspace = workspaceType == WorkspaceType.Folder + ? await OpenFolderWorkspaceAsync(workspaceFilePath, fileMatcher, cancellationToken).ConfigureAwait(false) + : await OpenMSBuildWorkspaceAsync(workspaceFilePath, workspaceType, createBinaryLog, logWorkspaceWarnings, logger, cancellationToken).ConfigureAwait(false); + if (workspace is null) { return new WorkspaceFormatResult(filesFormatted: 0, fileCount: 0, exitCode: 1); @@ -61,7 +65,7 @@ public static async Task FormatWorkspaceAsync( logger.LogTrace(Resources.Determining_formattable_files); - var (fileCount, formatableFiles) = await DetermineFormattableFiles( + var (fileCount, formatableFiles) = await DetermineFormattableFilesAsync( solution, projectPath, fileMatcher, includeGeneratedFiles, logger, cancellationToken).ConfigureAwait(false); var determineFilesMS = workspaceStopwatch.ElapsedMilliseconds - loadWorkspaceMS; @@ -144,32 +148,20 @@ private static string GetReportFilePath(string reportPath) } } - private static async Task OpenWorkspaceAsync( - string workspacePath, - WorkspaceType workspaceType, - Matcher fileMatcher, - bool logWorkspaceWarnings, - ILogger logger, - CancellationToken cancellationToken, - bool createBinaryLog = false) + private static async Task OpenFolderWorkspaceAsync(string workspacePath, Matcher fileMatcher, CancellationToken cancellationToken) { - if (workspaceType == WorkspaceType.Folder) - { - var folderWorkspace = FolderWorkspace.Create(); - await folderWorkspace.OpenFolder(workspacePath, fileMatcher, cancellationToken); - return folderWorkspace; - } - - return await OpenMSBuildWorkspaceAsync(workspacePath, workspaceType, logWorkspaceWarnings, logger, cancellationToken, createBinaryLog); + var folderWorkspace = FolderWorkspace.Create(); + await folderWorkspace.OpenFolder(workspacePath, fileMatcher, cancellationToken).ConfigureAwait(false); + return folderWorkspace; } private static async Task OpenMSBuildWorkspaceAsync( string solutionOrProjectPath, WorkspaceType workspaceType, + bool createBinaryLog, bool logWorkspaceWarnings, ILogger logger, - CancellationToken cancellationToken, - bool createBinaryLog = false) + CancellationToken cancellationToken) { var properties = new Dictionary(StringComparer.Ordinal) { @@ -215,36 +207,36 @@ private static string GetReportFilePath(string reportPath) LogWorkspaceDiagnostics(logger, logWorkspaceWarnings, workspace.Diagnostics); return workspace; - } - private static void LogWorkspaceDiagnostics(ILogger logger, bool logWorkspaceWarnings, ImmutableList diagnostics) - { - if (!logWorkspaceWarnings) + static void LogWorkspaceDiagnostics(ILogger logger, bool logWorkspaceWarnings, ImmutableList diagnostics) { - if (diagnostics.Count > 0) + if (!logWorkspaceWarnings) { - logger.LogWarning(Resources.Warnings_were_encountered_while_loading_the_workspace_Set_the_verbosity_option_to_the_diagnostic_level_to_log_warnings); - } - - return; - } + if (diagnostics.Count > 0) + { + logger.LogWarning(Resources.Warnings_were_encountered_while_loading_the_workspace_Set_the_verbosity_option_to_the_diagnostic_level_to_log_warnings); + } - foreach (var diagnostic in diagnostics) - { - if (diagnostic.Kind == WorkspaceDiagnosticKind.Failure) - { - logger.LogError(diagnostic.Message); + return; } - else + + foreach (var diagnostic in diagnostics) { - logger.LogWarning(diagnostic.Message); + if (diagnostic.Kind == WorkspaceDiagnosticKind.Failure) + { + logger.LogError(diagnostic.Message); + } + else + { + logger.LogWarning(diagnostic.Message); + } } } } private static async Task RunCodeFormattersAsync( Solution solution, - ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, + ImmutableArray formattableDocuments, FormatOptions options, ILogger logger, List formattedFiles, @@ -260,7 +252,7 @@ private static async Task RunCodeFormattersAsync( return formattedSolution; } - internal static async Task<(int, ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)>)> DetermineFormattableFiles( + internal static async Task<(int, ImmutableArray)> DetermineFormattableFilesAsync( Solution solution, string projectPath, Matcher fileMatcher, @@ -268,16 +260,20 @@ private static async Task RunCodeFormattersAsync( ILogger logger, CancellationToken cancellationToken) { - var codingConventionsManager = CodingConventionsManagerFactory.CreateCodingConventionsManager(); - var optionsApplier = new EditorConfigOptionsApplier(); + var totalFileCount = solution.Projects.Sum(project => project.DocumentIds.Count); + int projectFileCount = 0; - var fileCount = 0; - var getDocumentsAndOptions = new List>(solution.Projects.Sum(project => project.DocumentIds.Count)); + var documentsCoveredByEditorConfig = ImmutableArray.CreateBuilder(totalFileCount); + var documentsNotCoveredByEditorConfig = ImmutableArray.CreateBuilder(totalFileCount); + + var addedFilePaths = new HashSet(totalFileCount); foreach (var project in solution.Projects) { - if (project.FilePath is null) + if (project?.FilePath is null) + { continue; + } // If a project is used as a workspace, then ignore other referenced projects. if (!string.IsNullOrEmpty(projectPath) && !project.FilePath.Equals(projectPath, StringComparison.OrdinalIgnoreCase)) @@ -293,99 +289,105 @@ private static async Task RunCodeFormattersAsync( continue; } - fileCount += project.DocumentIds.Count; + projectFileCount += project.DocumentIds.Count; - // Get project documents and options with .editorconfig settings applied. - var getProjectDocuments = project.DocumentIds.Select(documentId => GetDocumentAndOptions( - project, documentId, fileMatcher, includeGeneratedFiles, codingConventionsManager, optionsApplier, cancellationToken)); - getDocumentsAndOptions.AddRange(getProjectDocuments); - } + foreach (var document in project.Documents) + { + // If we've already added this document, either via a link or multi-targeted framework, then ignore. + if (document?.FilePath is null || + addedFilePaths.Contains(document.FilePath)) + { + continue; + } - var documentsAndOptions = await Task.WhenAll(getDocumentsAndOptions).ConfigureAwait(false); - var foundEditorConfig = documentsAndOptions.Any(documentAndOptions => documentAndOptions.Item4); + addedFilePaths.Add(document.FilePath); - var addedFilePaths = new HashSet(documentsAndOptions.Length); - var formattableFiles = ImmutableArray.CreateBuilder<(DocumentId, OptionSet, ICodingConventionsSnapshot)>(documentsAndOptions.Length); - foreach (var (document, options, codingConventions, hasEditorConfig) in documentsAndOptions) - { - if (document?.FilePath is null) - { - continue; - } + if (!fileMatcher.Match(document.FilePath).HasMatches || + !document.SupportsSyntaxTree) + { + continue; + } - // If any code file has an .editorconfig, then we should ignore files without an .editorconfig entry. - if (foundEditorConfig && !hasEditorConfig) - { - continue; - } + var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + if (syntaxTree is null) + { + throw new Exception($"Unable to get a syntax tree for '{document.Name}'"); + } - // If we've already added this document, either via a link or multi-targeted framework, then ignore. - if (addedFilePaths.Contains(document.FilePath)) - { - continue; + if (!includeGeneratedFiles && + await GeneratedCodeUtilities.IsGeneratedCodeAsync(syntaxTree, cancellationToken).ConfigureAwait(false)) + { + continue; + } + + var analyzerConfigOptions = await GetAnalyzerConfigOptionsAsync(document, cancellationToken).ConfigureAwait(false); + var optionSet = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); + + var formattableDocument = new DocumentWithOptions(document, optionSet, analyzerConfigOptions); + + // Track files covered by and editorconfig and those not covered. + if (formattableDocument.AnalyzerConfigOptions is object) + { + documentsCoveredByEditorConfig.Add(formattableDocument); + } + else + { + documentsNotCoveredByEditorConfig.Add(formattableDocument); + } } - - addedFilePaths.Add(document.FilePath); - formattableFiles.Add((document.Id, options, codingConventions)); } - return (fileCount, formattableFiles.ToImmutableArray()); + // If no files are covered by an editorconfig, then return them all. Otherwise only return + // files that are covered by an editorconfig. + return documentsCoveredByEditorConfig.Count == 0 + ? (projectFileCount, documentsNotCoveredByEditorConfig.ToImmutableArray()) + : (projectFileCount, documentsCoveredByEditorConfig.ToImmutableArray()); } - private static async Task<(Document?, OptionSet?, ICodingConventionsSnapshot?, bool)> GetDocumentAndOptions( - Project project, - DocumentId documentId, - Matcher fileMatcher, - bool includeGeneratedFiles, - ICodingConventionsManager codingConventionsManager, - EditorConfigOptionsApplier optionsApplier, - CancellationToken cancellationToken) + private static async Task GetAnalyzerConfigOptionsAsync(Document document, CancellationToken cancellationToken) { - var document = project.Solution.GetDocument(documentId); + // Once https://github.com/dotnet/roslyn/issues/42154 is fixed we should be able to request + // options from document.Project directly. For now we will create AnalyzerConfigSets ourselves + // and return our own AnalyzerConfigOptions class. + var configSet = await GetAnalyzerConfigSetAsync(document.Project, cancellationToken).ConfigureAwait(false); + var result = configSet.GetOptionsForSourcePath(document.FilePath!); - if (document is null || await ShouldIgnoreDocument(document, fileMatcher, includeGeneratedFiles, cancellationToken)) + if (result.AnalyzerOptions.Count == 0) { - return (null, null, null, false); + return null; } - var context = await codingConventionsManager.GetConventionContextAsync( - document.FilePath, cancellationToken).ConfigureAwait(false); - - OptionSet options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); - - // Check whether an .editorconfig was found for this document. - if (context?.CurrentConventions is null) + // The compiler will reuse the same instance of AnalyzerOptions if matched .editorconfig sections + // for multiple files are the same. + if (s_editorConfigOptions.TryGetValue(result, out var editorConfigOptions)) { - return (document, options, null, false); + return editorConfigOptions; } - options = optionsApplier.ApplyConventions(options, context.CurrentConventions, project.Language); - return (document, options, context.CurrentConventions, true); + var configOptions = new EditorConfigOptions(result.AnalyzerOptions); + s_editorConfigOptions[result] = configOptions; + return configOptions; } - private static async Task ShouldIgnoreDocument( - Document document, - Matcher fileMatcher, - bool includeGeneratedFiles, - CancellationToken cancellationToken) + private static async Task GetAnalyzerConfigSetAsync(Project project, CancellationToken cancellationToken) { - if (!fileMatcher.Match(document.FilePath).HasMatches) - { - // If a files list was passed in, then ignore files not present in the list. - return true; - } - else if (!document.SupportsSyntaxTree) + if (s_analyzerConfigSets.TryGetValue(project.Id, out var configSet)) { - return true; + return configSet; } - else if (!includeGeneratedFiles && await GeneratedCodeUtilities.IsGeneratedCodeAsync(document, cancellationToken).ConfigureAwait(false)) - { - // Ignore generated code files. - return true; - } - else + + var parseConfigs = project.AnalyzerConfigDocuments.Select(ParseAnalyzerConfigAsync); + var configs = await Task.WhenAll(parseConfigs); + configSet = AnalyzerConfigSet.Create(configs); + + s_analyzerConfigSets[project.Id] = configSet; + + return configSet; + + async Task ParseAnalyzerConfigAsync(AnalyzerConfigDocument document) { - return false; + var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); + return AnalyzerConfig.Parse(text, document.FilePath!); } } } diff --git a/src/DocumentWithOptions.cs b/src/DocumentWithOptions.cs new file mode 100644 index 000000000000..1a9f195d7b50 --- /dev/null +++ b/src/DocumentWithOptions.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Options; + +namespace Microsoft.CodeAnalysis.Tools +{ + internal struct DocumentWithOptions + { + public Document Document { get; } + public OptionSet OptionSet { get; } + public AnalyzerConfigOptions? AnalyzerConfigOptions { get; } + + public DocumentWithOptions(Document document, OptionSet optionSet, AnalyzerConfigOptions? analyzerConfigOptions) + { + Document = document; + OptionSet = optionSet; + AnalyzerConfigOptions = analyzerConfigOptions; + } + + public void Deconstruct( + out Document document, + out OptionSet optionSet, + out AnalyzerConfigOptions? analyzerConfigOptions) + { + document = Document; + optionSet = OptionSet; + analyzerConfigOptions = AnalyzerConfigOptions; + } + } +} diff --git a/src/Formatters/CharsetFormatter.cs b/src/Formatters/CharsetFormatter.cs index 5efc5d1fb5da..439d3b63e9bd 100644 --- a/src/Formatters/CharsetFormatter.cs +++ b/src/Formatters/CharsetFormatter.cs @@ -6,10 +6,10 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; namespace Microsoft.CodeAnalysis.Tools.Formatters { @@ -23,15 +23,15 @@ internal sealed class CharsetFormatter : DocumentFormatter protected override Task FormatFileAsync( Document document, SourceText sourceText, - OptionSet options, - ICodingConventionsSnapshot codingConventions, + OptionSet optionSet, + AnalyzerConfigOptions? analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { return Task.Run(() => { - if (!TryGetCharset(codingConventions, out var encoding) + if (!TryGetCharset(analyzerConfigOptions, out var encoding) || sourceText.Encoding?.Equals(encoding) == true || IsEncodingEquivalent(sourceText, encoding)) { @@ -67,9 +67,10 @@ private static byte[] GetEncodedBytes(string text, Encoding encoding) return stream.ToArray(); } - private static bool TryGetCharset(ICodingConventionsSnapshot codingConventions, [NotNullWhen(true)] out Encoding? encoding) + private static bool TryGetCharset(AnalyzerConfigOptions? analyzerConfigOptions, [NotNullWhen(true)] out Encoding? encoding) { - if (codingConventions.TryGetConventionValue("charset", out string charsetOption)) + if (analyzerConfigOptions is object && + analyzerConfigOptions.TryGetValue("charset", out var charsetOption)) { encoding = GetCharset(charsetOption); return true; diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index d3f17323258f..8e3a560dc2ae 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -6,10 +6,10 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; namespace Microsoft.CodeAnalysis.Tools.Formatters { @@ -25,7 +25,7 @@ internal abstract class DocumentFormatter : ICodeFormatter /// public async Task FormatAsync( Solution solution, - ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, + ImmutableArray formattableDocuments, FormatOptions formatOptions, ILogger logger, List formattedFiles, @@ -41,8 +41,8 @@ public async Task FormatAsync( protected abstract Task FormatFileAsync( Document document, SourceText sourceText, - OptionSet options, - ICodingConventionsSnapshot codingConventions, + OptionSet optionSet, + AnalyzerConfigOptions? analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken); @@ -52,20 +52,21 @@ protected abstract Task FormatFileAsync( /// private ImmutableArray<(Document, Task<(SourceText originalText, SourceText? formattedText)>)> FormatFiles( Solution solution, - ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, + ImmutableArray formattableDocuments, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { var formattedDocuments = ImmutableArray.CreateBuilder<(Document, Task<(SourceText originalText, SourceText? formattedText)>)>(formattableDocuments.Length); - foreach (var (documentId, options, codingConventions) in formattableDocuments) + foreach (var formattableDocument in formattableDocuments) { - var document = solution.GetDocument(documentId); + var document = solution.GetDocument(formattableDocument.Document.Id); if (document is null) continue; - var formatTask = Task.Run(async () => await GetFormattedSourceTextAsync(document, options, codingConventions, formatOptions, logger, cancellationToken).ConfigureAwait(false), cancellationToken); + var formatTask = Task.Run(async () + => await GetFormattedSourceTextAsync(document, formattableDocument.OptionSet, formattableDocument.AnalyzerConfigOptions, formatOptions, logger, cancellationToken).ConfigureAwait(false), cancellationToken); formattedDocuments.Add((document, formatTask)); } @@ -78,14 +79,14 @@ protected abstract Task FormatFileAsync( /// private async Task<(SourceText originalText, SourceText? formattedText)> GetFormattedSourceTextAsync( Document document, - OptionSet options, - ICodingConventionsSnapshot codingConventions, + OptionSet optionSet, + AnalyzerConfigOptions? analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { var originalSourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); - var formattedSourceText = await FormatFileAsync(document, originalSourceText, options, codingConventions, formatOptions, logger, cancellationToken).ConfigureAwait(false); + var formattedSourceText = await FormatFileAsync(document, originalSourceText, optionSet, analyzerConfigOptions, formatOptions, logger, cancellationToken).ConfigureAwait(false); return !formattedSourceText.ContentEquals(originalSourceText) || !formattedSourceText.Encoding?.Equals(originalSourceText.Encoding) == true ? (originalSourceText, formattedSourceText) diff --git a/src/Formatters/EndOfLineFormatter.cs b/src/Formatters/EndOfLineFormatter.cs index 3b95d3ec4e16..badfe19bffc4 100644 --- a/src/Formatters/EndOfLineFormatter.cs +++ b/src/Formatters/EndOfLineFormatter.cs @@ -4,10 +4,10 @@ using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; namespace Microsoft.CodeAnalysis.Tools.Formatters { @@ -18,15 +18,15 @@ internal sealed class EndOfLineFormatter : DocumentFormatter protected override Task FormatFileAsync( Document document, SourceText sourceText, - OptionSet options, - ICodingConventionsSnapshot codingConventions, + OptionSet optionSet, + AnalyzerConfigOptions? analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { return Task.Run(() => { - if (!TryGetEndOfLine(codingConventions, out var endOfLine)) + if (!TryGetEndOfLine(analyzerConfigOptions, out var endOfLine)) { return sourceText; } @@ -58,9 +58,10 @@ protected override Task FormatFileAsync( }); } - public static bool TryGetEndOfLine(ICodingConventionsSnapshot codingConventions, [NotNullWhen(true)] out string? endOfLine) + public static bool TryGetEndOfLine(AnalyzerConfigOptions? analyzerConfigOptions, [NotNullWhen(true)] out string? endOfLine) { - if (codingConventions.TryGetConventionValue("end_of_line", out string endOfLineOption)) + if (analyzerConfigOptions is object && + analyzerConfigOptions.TryGetValue("end_of_line", out var endOfLineOption)) { endOfLine = GetEndOfLine(endOfLineOption); return true; diff --git a/src/Formatters/FinalNewlineFormatter.cs b/src/Formatters/FinalNewlineFormatter.cs index 68d84a27da0c..f0f3179cf382 100644 --- a/src/Formatters/FinalNewlineFormatter.cs +++ b/src/Formatters/FinalNewlineFormatter.cs @@ -4,10 +4,10 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; namespace Microsoft.CodeAnalysis.Tools.Formatters { @@ -18,18 +18,20 @@ internal sealed class FinalNewlineFormatter : DocumentFormatter protected override async Task FormatFileAsync( Document document, SourceText sourceText, - OptionSet options, - ICodingConventionsSnapshot codingConventions, + OptionSet optionSet, + AnalyzerConfigOptions? analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { - if (!codingConventions.TryGetConventionValue("insert_final_newline", out bool insertFinalNewline)) + if (analyzerConfigOptions is null || + !analyzerConfigOptions.TryGetValue("insert_final_newline", out var insertFinalNewlineValue) || + !bool.TryParse(insertFinalNewlineValue, out var insertFinalNewline)) { return await document.GetTextAsync(cancellationToken); } - if (!EndOfLineFormatter.TryGetEndOfLine(codingConventions, out var endOfLine)) + if (!EndOfLineFormatter.TryGetEndOfLine(analyzerConfigOptions, out var endOfLine)) { endOfLine = Environment.NewLine; } diff --git a/src/Formatters/ICodeFormatter.cs b/src/Formatters/ICodeFormatter.cs index 6770875d991c..6d68164c4c4d 100644 --- a/src/Formatters/ICodeFormatter.cs +++ b/src/Formatters/ICodeFormatter.cs @@ -4,9 +4,7 @@ using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Options; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; namespace Microsoft.CodeAnalysis.Tools.Formatters { @@ -17,7 +15,7 @@ internal interface ICodeFormatter /// Task FormatAsync( Solution solution, - ImmutableArray<(DocumentId, OptionSet, ICodingConventionsSnapshot)> formattableDocuments, + ImmutableArray formattableDocuments, FormatOptions options, ILogger logger, List formattedFiles, diff --git a/src/Formatters/WhitespaceFormatter.cs b/src/Formatters/WhitespaceFormatter.cs index 2c73ba1ad86d..fa2afe6c6b7f 100644 --- a/src/Formatters/WhitespaceFormatter.cs +++ b/src/Formatters/WhitespaceFormatter.cs @@ -1,14 +1,12 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System.Buffers; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; namespace Microsoft.CodeAnalysis.Tools.Formatters { @@ -22,38 +20,38 @@ internal sealed class WhitespaceFormatter : DocumentFormatter protected override async Task FormatFileAsync( Document document, SourceText sourceText, - OptionSet options, - ICodingConventionsSnapshot codingConventions, + OptionSet optionSet, + AnalyzerConfigOptions? analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { if (formatOptions.SaveFormattedFiles) { - return await GetFormattedDocument(document, options, cancellationToken); + return await GetFormattedDocument(document, optionSet, cancellationToken); } else { - return await GetFormattedDocumentWithDetailedChanges(document, sourceText, options, cancellationToken); + return await GetFormattedDocumentWithDetailedChanges(document, sourceText, optionSet, cancellationToken); } } /// /// Returns a formatted with a single that encompasses the entire document. /// - private static async Task GetFormattedDocument(Document document, OptionSet options, CancellationToken cancellationToken) + private static async Task GetFormattedDocument(Document document, OptionSet optionSet, CancellationToken cancellationToken) { - var formattedDocument = await Formatter.FormatAsync(document, options, cancellationToken).ConfigureAwait(false); + var formattedDocument = await Formatter.FormatAsync(document, optionSet, cancellationToken).ConfigureAwait(false); return await formattedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); } /// /// Returns a formatted with multiple s for each formatting change. /// - private static async Task GetFormattedDocumentWithDetailedChanges(Document document, SourceText sourceText, OptionSet options, CancellationToken cancellationToken) + private static async Task GetFormattedDocumentWithDetailedChanges(Document document, SourceText sourceText, OptionSet optionSet, CancellationToken cancellationToken) { var root = await document.GetSyntaxRootAsync(cancellationToken); - var formattingTextChanges = Formatter.GetFormattedTextChanges(root, document.Project.Solution.Workspace, options, cancellationToken); + var formattingTextChanges = Formatter.GetFormattedTextChanges(root, document.Project.Solution.Workspace, optionSet, cancellationToken); return sourceText.WithChanges(formattingTextChanges); } diff --git a/src/Utilities/EditorConfigFinder.cs b/src/Utilities/EditorConfigFinder.cs new file mode 100644 index 000000000000..59f6418ffb74 --- /dev/null +++ b/src/Utilities/EditorConfigFinder.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.IO; +using System.Collections.Immutable; +using System.Linq; + +namespace Microsoft.CodeAnalysis.Tools.Utilities +{ + internal static class EditorConfigFinder + { + public static ImmutableArray GetEditorConfigPaths(string path) + { + var startPath = Directory.Exists(path) + ? path + : Path.GetDirectoryName(path); + + if (!Directory.Exists(startPath)) + { + return ImmutableArray.Empty; + } + + var directory = new DirectoryInfo(path); + + var editorConfigPaths = directory.GetFiles(".editorconfig", SearchOption.AllDirectories) + .Select(file => file.FullName) + .ToList(); + + while (directory.Parent is object) + { + directory = directory.Parent; + + editorConfigPaths.AddRange( + directory.GetFiles(".editorconfig", SearchOption.TopDirectoryOnly) + .Select(file => file.FullName)); + } + + return editorConfigPaths.ToImmutableArray(); + } + } +} diff --git a/src/Utilities/EditorConfigOptions.cs b/src/Utilities/EditorConfigOptions.cs new file mode 100644 index 000000000000..deea5a0ee02d --- /dev/null +++ b/src/Utilities/EditorConfigOptions.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using Microsoft.CodeAnalysis.Diagnostics; + +namespace Microsoft.CodeAnalysis.Tools.Utilities +{ + internal sealed class EditorConfigOptions : AnalyzerConfigOptions + { + private readonly IReadOnlyDictionary _backing; + + public EditorConfigOptions(IReadOnlyDictionary backing) + { + _backing = backing; + } + + public override bool TryGetValue(string key, [NotNullWhen(true)] out string? value) + => _backing.TryGetValue(key, out value); + } +} diff --git a/src/Utilities/EditorConfigOptionsApplier.cs b/src/Utilities/EditorConfigOptionsApplier.cs deleted file mode 100644 index a04fabd9cf57..000000000000 --- a/src/Utilities/EditorConfigOptionsApplier.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Immutable; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Reflection; -using Microsoft.CodeAnalysis.Options; -using Microsoft.VisualStudio.CodingConventions; - -namespace Microsoft.CodeAnalysis.Tools.Utilities -{ - internal class EditorConfigOptionsApplier - { - private readonly ImmutableArray<(IOption?, OptionStorageLocation?, MethodInfo?)> _formattingOptionsWithStorage; - - public EditorConfigOptionsApplier() - { - var commonOptionsType = typeof(Formatting.FormattingOptions); - var csharpOptionsType = typeof(CSharp.Formatting.CSharpFormattingOptions); - _formattingOptionsWithStorage = GetOptionsWithStorageFromTypes(new[] { commonOptionsType, csharpOptionsType }); - } - - /// - /// Apply .editorconfig settings to the . - /// - public OptionSet ApplyConventions(OptionSet optionSet, ICodingConventionsSnapshot codingConventions, string languageName) - { - foreach (var optionWithStorage in _formattingOptionsWithStorage) - { - if (TryGetConventionValue(optionWithStorage, codingConventions, out var value)) - { - var option = optionWithStorage.Item1; - if (option is null) - continue; - - var optionKey = new OptionKey(option, option?.IsPerLanguage == true ? languageName : null); - optionSet = optionSet.WithChangedOption(optionKey, value); - } - } - - return optionSet; - } - - internal ImmutableArray<(IOption?, OptionStorageLocation?, MethodInfo?)> GetOptionsWithStorageFromTypes(params Type[] formattingOptionTypes) - { - var optionType = typeof(IOption); - return formattingOptionTypes - .SelectMany(t => t.GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty)) - .Where(p => optionType.IsAssignableFrom(p.PropertyType)) - .Select(p => (IOption?)p.GetValue(null)) - .Select(GetOptionWithStorage) - .Where(ows => ows.Item2 != null) - .ToImmutableArray(); - } - - internal (IOption?, OptionStorageLocation?, MethodInfo?) GetOptionWithStorage(IOption? option) - { - var editorConfigStorage = !(option?.StorageLocations.IsDefaultOrEmpty == true) - ? option?.StorageLocations.FirstOrDefault(IsEditorConfigStorage) - : null; - var tryGetOptionMethod = editorConfigStorage?.GetType().GetMethod("TryGetOption"); - return (option, editorConfigStorage, tryGetOptionMethod); - } - - internal static bool IsEditorConfigStorage(OptionStorageLocation storageLocation) - { - return storageLocation.GetType().FullName?.StartsWith("Microsoft.CodeAnalysis.Options.EditorConfigStorageLocation") == true; - } - - internal static bool TryGetConventionValue((IOption?, OptionStorageLocation?, MethodInfo?) optionWithStorage, ICodingConventionsSnapshot codingConventions, [NotNullWhen(true)] out object? value) - { - var (option, editorConfigStorage, tryGetOptionMethod) = optionWithStorage; - - value = null; - if (option is null || editorConfigStorage is null || tryGetOptionMethod is null) - { - return false; - } - - // EditorConfigStorageLocation no longer accepts a IReadOnlyDictionary. All values should - // be string so we can convert it into a Dictionary - var adjustedConventions = codingConventions.AllRawConventions.ToDictionary(kvp => kvp.Key, kvp => (string)kvp.Value); - var args = new object[] { adjustedConventions, option.Type, value! }; - - var isOptionPresent = tryGetOptionMethod.Invoke(editorConfigStorage, args) as bool?; - value = args[2]; - - return isOptionPresent == true; - } - } -} diff --git a/src/Utilities/GeneratedCodeUtilities.cs b/src/Utilities/GeneratedCodeUtilities.cs index 969408845a58..848e5132a7cc 100644 --- a/src/Utilities/GeneratedCodeUtilities.cs +++ b/src/Utilities/GeneratedCodeUtilities.cs @@ -21,23 +21,22 @@ internal static class GeneratedCodeUtilities (syntaxTrivia) => syntaxTrivia.IsKind(VisualBasic.SyntaxKind.CommentTrivia) || syntaxTrivia.IsKind(VisualBasic.SyntaxKind.DocumentationCommentTrivia); - internal static async Task IsGeneratedCodeAsync(Document document, CancellationToken cancellationToken) + internal static async Task IsGeneratedCodeAsync(SyntaxTree syntaxTree, CancellationToken cancellationToken) { - var isCommentTrivia = document.Project.Language == LanguageNames.CSharp - ? s_isCSharpCommentTrivia - : s_isVisualBasicCommentTrivia; - - var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - if (syntaxTree is null) + if (IsGeneratedCodeFileName(syntaxTree.FilePath)) { - throw new Exception($"Unable to get a syntax tree for '{document.Name}'"); + return true; } - return IsGeneratedCodeFile(syntaxTree.FilePath) || - BeginsWithAutoGeneratedComment(syntaxTree, isCommentTrivia, cancellationToken); + var isCommentTrivia = syntaxTree.Options.Language == LanguageNames.CSharp + ? s_isCSharpCommentTrivia + : s_isVisualBasicCommentTrivia; + + var syntaxRoot = await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); + return BeginsWithAutoGeneratedComment(syntaxRoot, isCommentTrivia); } - private static bool IsGeneratedCodeFile(string? filePath) + private static bool IsGeneratedCodeFileName(string? filePath) { if (!string.IsNullOrEmpty(filePath)) { @@ -64,13 +63,11 @@ private static bool IsGeneratedCodeFile(string? filePath) return false; } - private static bool BeginsWithAutoGeneratedComment( - SyntaxTree tree, Func isComment, CancellationToken cancellationToken) + private static bool BeginsWithAutoGeneratedComment(SyntaxNode syntaxRoot, Func isComment) { - var root = tree.GetRoot(cancellationToken); - if (root.HasLeadingTrivia) + if (syntaxRoot.HasLeadingTrivia) { - var leadingTrivia = root.GetLeadingTrivia(); + var leadingTrivia = syntaxRoot.GetLeadingTrivia(); foreach (var trivia in leadingTrivia) { diff --git a/src/Workspaces/FolderWorkspace_ProjectLoader.cs b/src/Workspaces/FolderWorkspace_ProjectLoader.cs index 1a5e689bbe3c..1a98130f7145 100644 --- a/src/Workspaces/FolderWorkspace_ProjectLoader.cs +++ b/src/Workspaces/FolderWorkspace_ProjectLoader.cs @@ -3,8 +3,10 @@ using System.Collections.Immutable; using System.IO; using System.Linq; +using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.FileSystemGlobbing; namespace Microsoft.CodeAnalysis.Tools.Workspaces @@ -27,6 +29,15 @@ private abstract class ProjectLoader return null; } + var editorConfigDocuments = EditorConfigFinder.GetEditorConfigPaths(folderPath) + .Select(path => + DocumentInfo.Create( + DocumentId.CreateNewId(projectId), + name: ".editorconfig", + loader: new FileTextLoader(path, Encoding.UTF8), + filePath: path)) + .ToImmutableArray(); + return ProjectInfo.Create( projectId, version: default, @@ -34,7 +45,8 @@ private abstract class ProjectLoader assemblyName: folderPath, Language, filePath: folderPath, - documents: documents); + documents: documents) + .WithAnalyzerConfigDocuments(editorConfigDocuments); } private static Task> LoadDocumentInfosAsync(ProjectId projectId, string folderPath, string fileExtension, Matcher fileMatcher) diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index d950cb65f6a8..83d94000f5b4 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -32,7 +32,6 @@ - @@ -42,6 +41,8 @@ + + diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index b87d75d4435d..23ea30bfacea 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Testing; @@ -16,7 +17,6 @@ using Microsoft.CodeAnalysis.Tools.Tests.Utilities; using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; using Microsoft.VisualStudio.Composition; using Xunit; @@ -76,7 +76,6 @@ protected AbstractFormatterTest() public abstract string Language { get; } private static ILogger Logger => new TestLogger(); - private static EditorConfigOptionsApplier OptionsApplier => new EditorConfigOptionsApplier(); public SolutionState TestState { get; } @@ -121,15 +120,13 @@ private protected async Task TestAsync(string testCode, string expec /// A Solution containing a single Project containing a single Document. /// The editorconfig to apply to the documents options set. /// The document contained within along with option set and coding conventions. - protected async Task> GetOnlyFileToFormatAsync(Solution solution, IReadOnlyDictionary editorConfig) + internal async Task> GetOnlyFileToFormatAsync(Solution solution, IReadOnlyDictionary editorConfig) { var document = GetOnlyDocument(solution); var options = (OptionSet)await document.GetOptionsAsync(); + AnalyzerConfigOptions analyzerConfigOptions = new EditorConfigOptions(editorConfig); - ICodingConventionsSnapshot codingConventions = new TestCodingConventionsSnapshot(editorConfig); - options = OptionsApplier.ApplyConventions(options, codingConventions, Language); - - return ImmutableArray.Create((document.Id, options, codingConventions)); + return ImmutableArray.Create(new DocumentWithOptions(document, options, analyzerConfigOptions)); } /// diff --git a/tests/Utilities/TestCodingConventionsSnapshot.cs b/tests/Utilities/TestCodingConventionsSnapshot.cs deleted file mode 100644 index fffcdf15c771..000000000000 --- a/tests/Utilities/TestCodingConventionsSnapshot.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.CodingConventions; - -namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities -{ - public class TestCodingConventionsSnapshot : ICodingConventionsSnapshot - { - public IUniversalCodingConventions UniversalConventions => throw new NotImplementedException(); - - public IReadOnlyDictionary AllRawConventions { get; } - - public int Version => 1; - - public TestCodingConventionsSnapshot(IReadOnlyDictionary conventions) - { - AllRawConventions = conventions.ToDictionary(kvp => kvp.Key, kvp => (object)kvp.Value); - } - - public bool TryGetConventionValue(string conventionName, out T conventionValue) - { - if (!AllRawConventions.ContainsKey(conventionName)) - { - conventionValue = default; - return false; - } - - var value = AllRawConventions[conventionName]; - - if (typeof(T) == typeof(bool)) - { - conventionValue = (T)(object)Convert.ToBoolean(value); - } - else - { - conventionValue = (T)value; - } - - return true; - } - } -} From 0bd43460fd2932f9d8eba158c0c364dd4eb06e26 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 22 May 2020 15:27:01 -0700 Subject: [PATCH 1004/2702] Fix integration tests --- eng/format-verifier.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index 6a6f4235a679..1b76388f4b36 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -19,7 +19,7 @@ try { if ($stage -eq "prepare") { Write-Output "$(Get-Date) - Cloning $repoName." - git.exe clone $repo $repoPath --single-branch --no-tags + git.exe clone $repo $repoPath -b master --single-branch --no-tags } Set-Location $repoPath @@ -56,7 +56,7 @@ try { if ($stage -eq "format-workspace") { Write-Output "$(Get-Date) - $solutionFile - Formatting Workspace" - $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- -w $solution -v diag --check | Out-String + $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- $solution -v diag --check | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. From 53d4713c365bd55d57b7304db79ba37f6e4e4610 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 22 May 2020 16:59:09 -0700 Subject: [PATCH 1005/2702] Fix launch.json args --- .vscode/launch.json | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 9f35c31f9ba7..2e15c9ebdb51 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,26 +5,7 @@ "version": "0.2.0", "configurations": [ { - "name": "dotnet-format -f ../roslyn --dry-run", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "build", - // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/dotnet-format.dll", - "args": [ - "-f", - "../roslyn/src", - "-v", - "diag", - "--dry-run" - ], - "cwd": "${workspaceFolder}", - // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console - "console": "internalConsole", - "stopAtEntry": false - }, - { - "name": "dotnet-format -f . --dry-run", + "name": "format -f . --check", "type": "coreclr", "request": "launch", "preLaunchTask": "build", @@ -35,7 +16,7 @@ ".", "-v", "diag", - "--dry-run" + "--check" ], "cwd": "${workspaceFolder}/src", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console @@ -43,18 +24,17 @@ "stopAtEntry": false }, { - "name": "dotnet-format -w format.sln --dry-run", + "name": "format format.sln --check", "type": "coreclr", "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/dotnet-format.dll", "args": [ - "-w", "format.sln", "-v", "diag", - "--dry-run" + "--check" ], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console From e12a99105833d9582c37554336b7cc573301aef9 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 25 May 2020 09:16:37 -0700 Subject: [PATCH 1006/2702] Added option checks to warn about deprecations. --- .vscode/launch.json | 10 +- README.md | 15 ++- docs/README.md | 8 +- src/FormatCommand.cs | 130 ++++++++++++++++++++++++++ src/Program.cs | 167 +++++++++++----------------------- src/Resources.resx | 76 +++++++++------- src/xlf/Resources.cs.xlf | 34 +++++-- src/xlf/Resources.de.xlf | 34 +++++-- src/xlf/Resources.es.xlf | 34 +++++-- src/xlf/Resources.fr.xlf | 34 +++++-- src/xlf/Resources.it.xlf | 34 +++++-- src/xlf/Resources.ja.xlf | 34 +++++-- src/xlf/Resources.ko.xlf | 34 +++++-- src/xlf/Resources.pl.xlf | 34 +++++-- src/xlf/Resources.pt-BR.xlf | 34 +++++-- src/xlf/Resources.ru.xlf | 34 +++++-- src/xlf/Resources.tr.xlf | 34 +++++-- src/xlf/Resources.zh-Hans.xlf | 34 +++++-- src/xlf/Resources.zh-Hant.xlf | 34 +++++-- tests/ProgramTests.cs | 22 ++--- 20 files changed, 604 insertions(+), 266 deletions(-) create mode 100644 src/FormatCommand.cs diff --git a/.vscode/launch.json b/.vscode/launch.json index fe7ff94eb025..7b2124c2c33c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "version": "0.2.0", "configurations": [ { - "name": "dotnet-format -f . --dry-run", + "name": "dotnet-format -f --check", "type": "coreclr", "request": "launch", "preLaunchTask": "build", @@ -13,10 +13,9 @@ "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/dotnet-format.dll", "args": [ "-f", - ".", "-v", "diag", - "--dry-run" + "--check", ], "cwd": "${workspaceFolder}/src", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console @@ -24,18 +23,17 @@ "stopAtEntry": false }, { - "name": "dotnet-format -w format.sln --dry-run", + "name": "dotnet-format format.sln --check", "type": "coreclr", "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/dotnet-format.dll", "args": [ - "-w", "format.sln", "-v", "diag", - "--dry-run" + "--check" ], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console diff --git a/README.md b/README.md index c8c8c7ce1a19..2fc4ae6ff671 100644 --- a/README.md +++ b/README.md @@ -44,16 +44,15 @@ By default `dotnet-format` will look in the current directory for a project or s ```sh Usage: - dotnet-format [options] + dotnet-format [options] Options: - -f, --folder The folder to operate on. Cannot be used with the `--workspace` option. - -w, --workspace The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - --files, --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. + --folder, -f Whether to treat the `` path as a folder of files. + --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. --exclude A list of relative file or folder paths to exclude from formatting. - --check, --dry-run Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. --report Accepts a file path, which if provided, will produce a json report in the given directory. - -v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + --verbosity, -v Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] --version Display version information ``` @@ -62,8 +61,8 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | Examples | Description | | ---------------------------------------------------------- |---------------------------------------------------------------------------------------------- | | dotnet **format** | Formats the project or solution in the current directory. | -| dotnet **format** -f <folder> | Formats a particular folder and subfolders. | -| dotnet **format** -w <workspace> | Formats a specific project or solution. | +| dotnet **format** <workspace> | Formats a specific project or solution. | +| dotnet **format** <folder> -f | Formats a particular folder and subfolders. | | dotnet **format** -v diag | Formats with very verbose logging. | | dotnet **format** --include Programs.cs Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | | dotnet **format** --check | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | diff --git a/docs/README.md b/docs/README.md index dfc494ce4262..509fc2ed0469 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,10 +8,10 @@ ### Specify a workspace (Required) -It is required to specify a workspace when running dotnet-format. Choosing a workspace determines which code files are considered for formatting. +A project path is needed when running dotnet-format. By default, the current folder will be used as the project path. The project path and type of project determines which code files are considered for formatting. -- `--folder` - The folder to operate on. Cannot be used with the `--workspace` option. -- `--workspace` - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. +- Solutions and Projects - By default dotnet-format will open the project path as a MSBuild solution or project. +- `--folder` - When the folder options is specified the project path will be treated as a folder of code files. ### Filter files to format @@ -27,7 +27,7 @@ Other repos built as part of your project can be included using git submodules. The following command sets the repo folder as the workspace. It then includes the `src` and `tests` folders for formatting. The `submodule-a` folder is excluded from the formatting validation. ```console -dotnet format -f . --include ./src/ ./tests/ --exclude ./src/submodule-a/ --check +dotnet format -f --include ./src/ ./tests/ --exclude ./src/submodule-a/ --check ``` ### Logging and Reports diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs new file mode 100644 index 000000000000..574126586824 --- /dev/null +++ b/src/FormatCommand.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.CommandLine; +using System.CommandLine.Parsing; +using System.Linq; + +namespace Microsoft.CodeAnalysis.Tools +{ + internal static class FormatCommand + { + internal static RootCommand CreateCommandLineOptions() + { + var rootCommand = new RootCommand + { + new Argument("project") + { + Arity = ArgumentArity.ZeroOrOne, + Description = Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one + }, + new Option(new[] { "--folder", "-f" }, Resources.Whether_to_treat_the_project_path_as_a_folder_of_files) + { + Argument = new Argument(() => null) { Arity = ArgumentArity.ZeroOrOne }, + }, + new Option(new[] { "--workspace", "-w" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one) + { + Argument = new Argument(() => null), + IsHidden = true + }, + new Option(new[] { "--include", "--files" }, Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) + { + Argument = new Argument(() => Array.Empty()) + }, + new Option(new[] { "--exclude" }, Resources.A_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) + { + Argument = new Argument(() => Array.Empty()) + }, + new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminates_with_a_non_zero_exit_code_if_any_files_were_formatted) + { + Argument = new Argument() + }, + new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory) + { + Argument = new Argument(() => null) + }, + new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic) + { + Argument = new Argument() { Arity = ArgumentArity.ExactlyOne } + }, + new Option(new[] { "--include-generated" }, Resources.Include_generated_code_files_in_formatting_operations) + { + Argument = new Argument(), + IsHidden = true + }, + }; + + rootCommand.Description = "dotnet-format"; + rootCommand.AddValidator(ValidateProjectArgumentAndWorkspace); + rootCommand.AddValidator(ValidateProjectArgumentAndFolder); + rootCommand.AddValidator(ValidateWorkspaceAndFolder); + + return rootCommand; + } + + private static string? ValidateProjectArgumentAndWorkspace(CommandResult symbolResult) + { + try + { + var project = symbolResult.GetArgumentValueOrDefault("project"); + var workspace = symbolResult.ValueForOption("workspace"); + + if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(workspace)) + { + return Resources.Cannot_specify_both_project_argument_and_workspace_option; + } + } + catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. + { + } + + return null; + } + + private static string? ValidateProjectArgumentAndFolder(CommandResult symbolResult) + { + try + { + var project = symbolResult.GetArgumentValueOrDefault("project"); + var folder = symbolResult.ValueForOption("folder"); + + if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(folder)) + { + return Resources.Cannot_specify_both_project_argument_and_folder_options; + } + } + catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. + { + } + + return null; + } + + private static string? ValidateWorkspaceAndFolder(CommandResult symbolResult) + { + try + { + var workspace = symbolResult.ValueForOption("workspace"); + var folder = symbolResult.ValueForOption("folder"); + + + if (!string.IsNullOrEmpty(workspace) && !string.IsNullOrEmpty(folder)) + { + return Resources.Cannot_specify_both_folder_and_workspace_options; + } + } + catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. + { + } + + return null; + } + + internal static bool WasOptionUsed(this ParseResult result, params string[] aliases) + { + return result.Tokens + .Where(token => token.Type == TokenType.Option) + .Any(token => aliases.Contains(token.Value)); + } + } +} diff --git a/src/Program.cs b/src/Program.cs index 69fe8e57e26e..9cc670d1fb39 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.Parsing; @@ -27,112 +26,29 @@ internal class Program internal const int UnableToLocateMSBuildExitCode = 3; internal const int UnableToLocateDotNetCliExitCode = 4; + private static ParseResult? s_parseResult; + private static async Task Main(string[] args) { - var rootCommand = CreateCommandLineOptions(); + var rootCommand = FormatCommand.CreateCommandLineOptions(); + rootCommand.Handler = CommandHandler.Create(typeof(Program).GetMethod(nameof(Run))); + + // Parse the incoming args so we can give warnings when deprecated options are used. + s_parseResult = rootCommand.Parse(args); - // Parse the incoming args and invoke the handler return await rootCommand.InvokeAsync(args); } - internal static RootCommand CreateCommandLineOptions() + public static async Task Run(string? project, string? folder, string? workspace, string? verbosity, bool check, string[] include, string[] exclude, string? report, bool includeGenerated, IConsole console = null!) { - var rootCommand = new RootCommand + if (s_parseResult == null) { - new Argument("project") - { - Arity = ArgumentArity.ZeroOrOne, - Description = Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one - }, - new Option(new[] { "--folder", "-f" }, Resources.The_folder_to_operate_on_Cannot_be_used_with_the_workspace_option) - { - Argument = new Argument(() => null) - }, - new Option(new[] { "--workspace", "-w" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one) - { - Argument = new Argument(() => null) - }, - new Option(new[] { "--include", "--files" }, Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) - { - Argument = new Argument(() => Array.Empty()) - }, - new Option(new[] { "--exclude" }, Resources.A_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) - { - Argument = new Argument(() => Array.Empty()) - }, - new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminate_with_a_non_zero_exit_code_if_any_files_were_formatted) - { - Argument = new Argument() - }, - new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory) - { - Argument = new Argument(() => null) - }, - new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic) - { - Argument = new Argument() { Arity = ArgumentArity.ExactlyOne } - }, - new Option(new[] { "--include-generated" }, Resources.Include_generated_code_files_in_formatting_operations) - { - Argument = new Argument(), - IsHidden = true - }, - }; - - rootCommand.Description = "dotnet-format"; - rootCommand.AddValidator(ValidateProjectArgumentAndWorkspace); - rootCommand.AddValidator(ValidateWorkspaceAndFolder); - rootCommand.Handler = CommandHandler.Create(typeof(Program).GetMethod(nameof(Run))); - return rootCommand; - - static string? ValidateProjectArgumentAndWorkspace(CommandResult symbolResult) - { - try - { - var project = symbolResult.GetArgumentValueOrDefault("project"); - var workspace = symbolResult.ValueForOption("workspace"); - if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(workspace)) - { - return Resources.Cannot_specify_both_project_argument_and_workspace_option; - } - } - catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. - { - } - - return null; - } - - static string? ValidateWorkspaceAndFolder(CommandResult symbolResult) - { - try - { - var project = symbolResult.GetArgumentValueOrDefault("project"); - var workspace = symbolResult.ValueForOption("workspace"); - var folder = symbolResult.ValueForOption("folder"); - project ??= workspace; - if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(folder)) - { - return Resources.Cannot_specify_both_folder_and_workspace_options; - } - } - catch (InvalidOperationException)// Parsing of arguments failed. This will be reported later. - { - } - - return null; + return 1; } - } - public static async Task Run(string? project, string? folder, string? workspace, string? verbosity, bool check, string[] include, string[] exclude, string? report, bool includeGenerated, IConsole console = null!) - { // Setup logging. - var serviceCollection = new ServiceCollection(); var logLevel = GetLogLevel(verbosity); - ConfigureServices(serviceCollection, console, logLevel); - - var serviceProvider = serviceCollection.BuildServiceProvider(); - var logger = serviceProvider.GetService>(); + var logger = SetupLogging(console, logLevel); // Hook so we can cancel and exit when ctrl+c is pressed. var cancellationTokenSource = new CancellationTokenSource(); @@ -148,18 +64,44 @@ public static async Task Run(string? project, string? folder, string? works { currentDirectory = Environment.CurrentDirectory; + // Check for deprecated options and assign package if specified via `-w | -f` options. + if (!string.IsNullOrEmpty(workspace) && string.IsNullOrEmpty(project)) + { + logger.LogWarning(Resources.The_workspace_option_is_deprecated_Use_the_project_argument_instead); + project = workspace; + } + else if (!string.IsNullOrEmpty(folder) && string.IsNullOrEmpty(project)) + { + logger.LogWarning(Resources.The_folder_option_is_deprecated_for_specifying_the_path_Pass_the_folder_option_but_specify_the_path_with_the_project_argument_instead); + project = folder; + } + + if (s_parseResult.WasOptionUsed("--files")) + { + logger.LogWarning(Resources.The_files_option_is_deprecated_Use_the_include_option_instead); + } + + if (s_parseResult.WasOptionUsed("--dry-run")) + { + logger.LogWarning(Resources.The_dry_run_option_is_deprecated_Use_the_check_option_instead); + } + string workspaceDirectory; string workspacePath; WorkspaceType workspaceType; - if (!string.IsNullOrEmpty(workspace) && string.IsNullOrEmpty(project)) + + // The presence of the folder token means we should treat the project path as a folder path. + // This will change in the following version so that the folder option is a bool flag. + if (s_parseResult.WasOptionUsed("-f", "--folder")) { - logger.LogWarning(Resources.Workspace_option_is_deprecated_Use_the_project_argument_instead); + // If folder isn't populated, then use the current directory + workspacePath = Path.GetFullPath(project ?? ".", Environment.CurrentDirectory); + workspaceDirectory = workspacePath; + workspaceType = WorkspaceType.Folder; } - - workspace ??= project; - if (!string.IsNullOrEmpty(workspace)) + else { - var (isSolution, workspaceFilePath) = MSBuildWorkspaceFinder.FindWorkspace(currentDirectory, workspace); + var (isSolution, workspaceFilePath) = MSBuildWorkspaceFinder.FindWorkspace(currentDirectory, project); workspacePath = workspaceFilePath; workspaceType = isSolution @@ -169,23 +111,14 @@ public static async Task Run(string? project, string? folder, string? works // To ensure we get the version of MSBuild packaged with the dotnet SDK used by the // workspace, use its directory as our working directory which will take into account // a global.json if present. - var directoryName = Path.GetDirectoryName(workspacePath); - if (directoryName is null) + workspaceDirectory = Path.GetDirectoryName(workspacePath); + if (workspaceDirectory is null) { throw new Exception($"Unable to find folder at '{workspacePath}'"); } - - workspaceDirectory = directoryName; - } - else - { - // If folder isn't populated, then use the current directory - folder = Path.GetFullPath(folder ?? ".", Environment.CurrentDirectory); - workspacePath = folder; - workspaceDirectory = workspacePath; - workspaceType = WorkspaceType.Folder; } + // Load MSBuild Environment.CurrentDirectory = workspaceDirectory; if (!TryGetDotNetCliVersion(out var dotnetVersion)) @@ -276,10 +209,16 @@ internal static LogLevel GetLogLevel(string? verbosity) } } - private static void ConfigureServices(ServiceCollection serviceCollection, IConsole console, LogLevel logLevel) + private static ILogger SetupLogging(IConsole console, LogLevel logLevel) { + var serviceCollection = new ServiceCollection(); serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, logLevel)); serviceCollection.AddLogging(); + + var serviceProvider = serviceCollection.BuildServiceProvider(); + var logger = serviceProvider.GetService>(); + + return logger; } private static bool TryGetDotNetCliVersion([NotNullWhen(returnValue: true)] out string? dotnetVersion) diff --git a/src/Resources.resx b/src/Resources.resx index 78260aa6f4f2..e977f445caa7 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -1,17 +1,17 @@  - @@ -171,7 +171,7 @@ Format files, but do not save changes to disk. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -204,8 +204,8 @@ Fix file encoding. - - The folder to operate on. Cannot be used with the `--workspace` option. + + Whether to treat the `<project>` path as a folder of files. Cannot specify both folder and workspace options. @@ -237,7 +237,19 @@ Cannot specify both project argument and workspace option. - - "workspace" option is deprecated. Use the project argument instead. + + Cannot specify both project argument and folder options. + + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + + + The `--files` option is deprecated. Use the `--include` option instead. + + + The `--dry-run` option is deprecated. Use the `--check` option instead. \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index e77701a0622d..ae26993e41b5 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ Soubory se naformátují, ale změny se neuloží na disk. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. Soubor {0} zřejmě není platný soubor projektu nebo řešení. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index c89fe9cdd5d5..e607824cf2bc 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ Dateien formatieren, Änderungen aber nicht auf Festplatte speichern. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 30d93848c7bb..ae2c9872d637 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ Formato de archivos, pero no guardar los cambios al disco. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. El archivo "{0}" no parece ser un proyecto o archivo de solución válido. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index c50b964546b5..2a350099b8f3 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ Mettez en forme les fichiers, mais n'enregistrez pas les changements sur le disque. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index f592257e3d6a..c714da206682 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ Formatta i file, ma non salvare le modifiche sul disco. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. Il file '{0}' non sembra essere un file di progetto o di soluzione valido. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 1e3c6d8fcfe9..2364c1738b92 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ ファイルを書式設定しますが、変更をディスクに保存しません。 - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index c086e84dfbec..20e0cb76b7cd 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ 파일의 형식을 지정하지만 변경 내용을 디스크에 저장하지 않습니다. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 0cef89e07d7e..d307ebfec04f 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ Formatuj pliki, ale nie zapisuj zmian na dysku. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index b0de230f094b..b422689aac25 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ Arquivos de formato, mas não salva as alterações para o disco. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index ba8244ab21bb..b88c81d4cd8e 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ Форматировать файлы без сохранения изменений на диск. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. Файл "{0}" не является допустимым файлом проекта или решения. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 720d24b878ae..1ed8b16b3036 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ Dosyaları biçimlendir, ancak değişiklikleri diske kaydetme. - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 70e9f1f00cf9..822ef42b53f5 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ 格式化文件, 但不将更改保存到磁盘。 - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. 文件“{0}”似乎不是有效的项目或解决方案文件。 - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 4afa4f5dee16..c5af7a0825fd 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -27,6 +27,11 @@ Cannot specify both folder and workspace options. + + Cannot specify both project argument and folder options. + Cannot specify both project argument and folder options. + + Cannot specify both project argument and workspace option. Cannot specify both project argument and workspace option. @@ -87,7 +92,7 @@ 將檔案格式化,但不儲存變更到磁碟。 - + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -147,14 +152,24 @@ The dotnet CLI version is '{0}'. + + The `--dry-run` option is deprecated. Use the `--check` option instead. + The `--dry-run` option is deprecated. Use the `--check` option instead. + + The file '{0}' does not appear to be a valid project or solution file. 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 - - The folder to operate on. Cannot be used with the `--workspace` option. - The folder to operate on. Cannot be used with the `--workspace` option. + + The `--files` option is deprecated. Use the `--include` option instead. + The `--files` option is deprecated. Use the `--include` option instead. + + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -177,6 +192,11 @@ Formatted code file '{0}'. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. @@ -197,9 +217,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - "workspace" option is deprecated. Use the project argument instead. - "workspace" option is deprecated. Use the project argument instead. + + Whether to treat the `<project>` path as a folder of files. + Whether to treat the `<project>` path as a folder of files. diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index a400b8923302..32250b123491 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -45,7 +45,7 @@ public void ExitCodeIsSameWithoutCheck() public void CommandLine_OptionsAreParsedCorrectly() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); // Act var result = sut.Parse(new[] { @@ -80,7 +80,7 @@ public void CommandLine_OptionsAreParsedCorrectly() public void CommandLine_ProjectArgument_Simple() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); // Act var result = sut.Parse(new[] { "projectValue" }); @@ -94,7 +94,7 @@ public void CommandLine_ProjectArgument_Simple() public void CommandLine_ProjectArgument_WithOption_AfterArgument() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); // Act var result = sut.Parse(new[] { "projectValue", "--verbosity", "verbosity" }); @@ -109,7 +109,7 @@ public void CommandLine_ProjectArgument_WithOption_AfterArgument() public void CommandLine_ProjectArgument_WithOption_BeforeArgument() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); // Act var result = sut.Parse(new[] { "--verbosity", "verbosity", "projectValue" }); @@ -124,7 +124,7 @@ public void CommandLine_ProjectArgument_WithOption_BeforeArgument() public void CommandLine_ProjectArgument_GetsPassedToHandler() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); var handlerWasCalled = false; sut.Handler = CommandHandler.Create(new TestCommandHandlerDelegate(TestCommandHandler)); @@ -147,7 +147,7 @@ void TestCommandHandler(string project, string folder, string workspace, string public void CommandLine_ProjectArgument_FailesIfSpecifiedTwice() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); // Act var result = sut.Parse(new[] { "projectValue1", "projectValue2" }); @@ -160,7 +160,7 @@ public void CommandLine_ProjectArgument_FailesIfSpecifiedTwice() public void CommandLine_ProjectArgumentAndWorkspaceCanNotBeCombined() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); // Act var result = sut.Parse(new[] { "projectValue", "--workspace", "workspace" }); @@ -170,10 +170,10 @@ public void CommandLine_ProjectArgumentAndWorkspaceCanNotBeCombined() } [Fact] - public void CommandLine_ProjectWorkspaceAndFolderCanNotBeCombined1() + public void CommandLine_ProjectArgumentAndFolderCanNotBeCombined1() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); // Act var result = sut.Parse(new[] { "projectValue", "--folder", "folder" }); @@ -186,7 +186,7 @@ public void CommandLine_ProjectWorkspaceAndFolderCanNotBeCombined1() public void CommandLine_ProjectWorkspaceAndFolderCanNotBeCombined2() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); // Act var result = sut.Parse(new[] { "--workspace", "workspace", "--folder", "folder" }); @@ -199,7 +199,7 @@ public void CommandLine_ProjectWorkspaceAndFolderCanNotBeCombined2() public void CommandLine_InvalidArgumentsDontCrashTheValidators() { // Arrange - var sut = Program.CreateCommandLineOptions(); + var sut = FormatCommand.CreateCommandLineOptions(); // Act var result = sut.Parse(new[] { "--workspace", "workspace1", "--workspace", "workspace2" }); From 1ebd2ea369c5074ffca044000f9742fc81f65c0d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 26 May 2020 10:29:03 -0700 Subject: [PATCH 1007/2702] Wrap Run parameters --- src/Program.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Program.cs b/src/Program.cs index 9cc670d1fb39..b5c0535eb63e 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -39,7 +39,17 @@ private static async Task Main(string[] args) return await rootCommand.InvokeAsync(args); } - public static async Task Run(string? project, string? folder, string? workspace, string? verbosity, bool check, string[] include, string[] exclude, string? report, bool includeGenerated, IConsole console = null!) + public static async Task Run( + string? project, + string? folder, + string? workspace, + string? verbosity, + bool check, + string[] include, + string[] exclude, + string? report, + bool includeGenerated, + IConsole console = null!) { if (s_parseResult == null) { From 8161648113118cf524eae257db4d58a2d13a8ee2 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 26 May 2020 18:23:06 -0700 Subject: [PATCH 1008/2702] Use Project.AnalyzerOptions directly to get options. --- src/CodeFormatter.cs | 53 +------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 6a8e6cb8d74c..3e24fcae14b3 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -10,7 +10,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Build.Logging; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.MSBuild; using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Utilities; @@ -30,9 +29,6 @@ internal static class CodeFormatter new CharsetFormatter(), }.ToImmutableArray(); - private static readonly Dictionary s_analyzerConfigSets = new Dictionary(); - private static readonly Dictionary s_editorConfigOptions = new Dictionary(); - public static async Task FormatWorkspaceAsync( FormatOptions options, ILogger logger, @@ -320,7 +316,7 @@ await GeneratedCodeUtilities.IsGeneratedCodeAsync(syntaxTree, cancellationToken) continue; } - var analyzerConfigOptions = await GetAnalyzerConfigOptionsAsync(document, cancellationToken).ConfigureAwait(false); + var analyzerConfigOptions = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree); var optionSet = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); var formattableDocument = new DocumentWithOptions(document, optionSet, analyzerConfigOptions); @@ -343,52 +339,5 @@ await GeneratedCodeUtilities.IsGeneratedCodeAsync(syntaxTree, cancellationToken) ? (projectFileCount, documentsNotCoveredByEditorConfig.ToImmutableArray()) : (projectFileCount, documentsCoveredByEditorConfig.ToImmutableArray()); } - - private static async Task GetAnalyzerConfigOptionsAsync(Document document, CancellationToken cancellationToken) - { - // Once https://github.com/dotnet/roslyn/issues/42154 is fixed we should be able to request - // options from document.Project directly. For now we will create AnalyzerConfigSets ourselves - // and return our own AnalyzerConfigOptions class. - var configSet = await GetAnalyzerConfigSetAsync(document.Project, cancellationToken).ConfigureAwait(false); - var result = configSet.GetOptionsForSourcePath(document.FilePath!); - - if (result.AnalyzerOptions.Count == 0) - { - return null; - } - - // The compiler will reuse the same instance of AnalyzerOptions if matched .editorconfig sections - // for multiple files are the same. - if (s_editorConfigOptions.TryGetValue(result, out var editorConfigOptions)) - { - return editorConfigOptions; - } - - var configOptions = new EditorConfigOptions(result.AnalyzerOptions); - s_editorConfigOptions[result] = configOptions; - return configOptions; - } - - private static async Task GetAnalyzerConfigSetAsync(Project project, CancellationToken cancellationToken) - { - if (s_analyzerConfigSets.TryGetValue(project.Id, out var configSet)) - { - return configSet; - } - - var parseConfigs = project.AnalyzerConfigDocuments.Select(ParseAnalyzerConfigAsync); - var configs = await Task.WhenAll(parseConfigs); - configSet = AnalyzerConfigSet.Create(configs); - - s_analyzerConfigSets[project.Id] = configSet; - - return configSet; - - async Task ParseAnalyzerConfigAsync(AnalyzerConfigDocument document) - { - var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); - return AnalyzerConfig.Parse(text, document.FilePath!); - } - } } } From ed246cc4686762fe21e8bc9557d66bb6ecb22c1d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 26 May 2020 19:04:50 -0700 Subject: [PATCH 1009/2702] Add link to issue tracking .NET NuGetSDKResolver bug --- eng/Versions.props | 5 ++++- src/dotnet-format.csproj | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 1745e0ee4294..0d0676b084d0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -28,7 +28,10 @@ $(MicrosoftNETCoreCompilersPackageVersion) 4.7.0 - + 12.0.2 diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 83d94000f5b4..ef450fb7e1dc 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -42,6 +42,10 @@ + From 9d7b838ed9a1a1774bf9d430560bd2ffecdacc83 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 26 May 2020 19:06:05 -0700 Subject: [PATCH 1010/2702] Add comment explaining how formattable files are determined --- src/CodeFormatter.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 3e24fcae14b3..a5ff61eb796c 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -321,8 +321,8 @@ await GeneratedCodeUtilities.IsGeneratedCodeAsync(syntaxTree, cancellationToken) var formattableDocument = new DocumentWithOptions(document, optionSet, analyzerConfigOptions); - // Track files covered by and editorconfig and those not covered. - if (formattableDocument.AnalyzerConfigOptions is object) + // Track files covered by an editorconfig separately from those not covered. + if (analyzerConfigOptions is object) { documentsCoveredByEditorConfig.Add(formattableDocument); } @@ -333,6 +333,12 @@ await GeneratedCodeUtilities.IsGeneratedCodeAsync(syntaxTree, cancellationToken) } } + // Initially we would format all documents in a workspace, even if some files weren't covered by an + // .editorconfig and would have defaults applied. This behavior was an early requested change since + // users were surprised to have files not specified by the .editorconfig modified. The assumption is + // that users without an .editorconfig still wanted formatting (they did run a formatter after all), + // so we run on all files with defaults. + // If no files are covered by an editorconfig, then return them all. Otherwise only return // files that are covered by an editorconfig. return documentsCoveredByEditorConfig.Count == 0 From 3c3c344ca29918e8d3b27a404c5e4f2506913723 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 26 May 2020 19:06:35 -0700 Subject: [PATCH 1011/2702] Use the full path as the filename for editorconfig files --- src/Workspaces/FolderWorkspace_ProjectLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Workspaces/FolderWorkspace_ProjectLoader.cs b/src/Workspaces/FolderWorkspace_ProjectLoader.cs index 1a98130f7145..6b4567e5d4e9 100644 --- a/src/Workspaces/FolderWorkspace_ProjectLoader.cs +++ b/src/Workspaces/FolderWorkspace_ProjectLoader.cs @@ -33,7 +33,7 @@ private abstract class ProjectLoader .Select(path => DocumentInfo.Create( DocumentId.CreateNewId(projectId), - name: ".editorconfig", + name: path, loader: new FileTextLoader(path, Encoding.UTF8), filePath: path)) .ToImmutableArray(); From df2d85fae7d0a81dedbce8f9336a7541dd8c34a7 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 29 May 2020 15:44:40 -0700 Subject: [PATCH 1012/2702] Add ImportFormatter's fix message to resources --- src/Resources.resx | 5 ++++- src/xlf/Resources.cs.xlf | 5 +++++ src/xlf/Resources.de.xlf | 5 +++++ src/xlf/Resources.es.xlf | 5 +++++ src/xlf/Resources.fr.xlf | 5 +++++ src/xlf/Resources.it.xlf | 5 +++++ src/xlf/Resources.ja.xlf | 5 +++++ src/xlf/Resources.ko.xlf | 5 +++++ src/xlf/Resources.pl.xlf | 5 +++++ src/xlf/Resources.pt-BR.xlf | 5 +++++ src/xlf/Resources.ru.xlf | 5 +++++ src/xlf/Resources.tr.xlf | 5 +++++ src/xlf/Resources.zh-Hans.xlf | 5 +++++ src/xlf/Resources.zh-Hant.xlf | 5 +++++ 14 files changed, 69 insertions(+), 1 deletion(-) diff --git a/src/Resources.resx b/src/Resources.resx index e977f445caa7..b9b7c7c6bd83 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -249,7 +249,10 @@ The `--files` option is deprecated. Use the `--include` option instead. - + The `--dry-run` option is deprecated. Use the `--check` option instead. + + Fix imports ordering. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index ae26993e41b5..eb532b1dba1f 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index e607824cf2bc..4e5dee9d6300 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index ae2c9872d637..00ab98623628 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 2a350099b8f3..22a26f62360a 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index c714da206682..6638c7a1a5b2 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 2364c1738b92..3b3c16c70fd5 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 20e0cb76b7cd..5b929defe926 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index d307ebfec04f..5c4f4f7a6b7e 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index b422689aac25..5a22cef43602 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index b88c81d4cd8e..90f966fd3142 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 1ed8b16b3036..46023d5d889d 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 822ef42b53f5..0528442a127d 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index c5af7a0825fd..71ea26ba0e19 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -77,6 +77,11 @@ Fix final newline. + + Fix imports ordering. + Fix imports ordering. + + Fix whitespace formatting. Fix whitespace formatting. From 2441c82d8c605c0e3690138e167803bbd6256e3d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 29 May 2020 15:45:39 -0700 Subject: [PATCH 1013/2702] Port ImportFormatter changes from features/analyzers --- src/Formatters/CharsetFormatter.cs | 2 +- src/Formatters/DocumentFormatter.cs | 2 +- src/Formatters/EndOfLineFormatter.cs | 13 ++++++++++++- src/Formatters/FinalNewlineFormatter.cs | 2 +- src/Formatters/ImportsFormatter.cs | 26 ++++++++++++++++--------- src/Formatters/WhitespaceFormatter.cs | 2 +- 6 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/Formatters/CharsetFormatter.cs b/src/Formatters/CharsetFormatter.cs index 439d3b63e9bd..3851da7fbf53 100644 --- a/src/Formatters/CharsetFormatter.cs +++ b/src/Formatters/CharsetFormatter.cs @@ -20,7 +20,7 @@ internal sealed class CharsetFormatter : DocumentFormatter private static Encoding Utf8 => new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); private static Encoding Latin1 => Encoding.GetEncoding("iso-8859-1"); - protected override Task FormatFileAsync( + internal override Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index 8e3a560dc2ae..6da703b846ea 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -38,7 +38,7 @@ public async Task FormatAsync( /// /// Applies formatting and returns the changed for a . /// - protected abstract Task FormatFileAsync( + internal abstract Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, diff --git a/src/Formatters/EndOfLineFormatter.cs b/src/Formatters/EndOfLineFormatter.cs index badfe19bffc4..0537e1c20935 100644 --- a/src/Formatters/EndOfLineFormatter.cs +++ b/src/Formatters/EndOfLineFormatter.cs @@ -15,7 +15,7 @@ internal sealed class EndOfLineFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_end_of_line_marker; - protected override Task FormatFileAsync( + internal override Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, @@ -81,5 +81,16 @@ private static string GetEndOfLine(string endOfLineOption) _ => Environment.NewLine, }; } + + internal static string GetEndOfLineOption(string newLine) + { + return newLine switch + { + "\n" => "lf", + "\r" => "cr", + "\r\n" => "crlf", + _ => GetEndOfLineOption(Environment.NewLine), + }; + } } } diff --git a/src/Formatters/FinalNewlineFormatter.cs b/src/Formatters/FinalNewlineFormatter.cs index f0f3179cf382..d439f2b57c72 100644 --- a/src/Formatters/FinalNewlineFormatter.cs +++ b/src/Formatters/FinalNewlineFormatter.cs @@ -15,7 +15,7 @@ internal sealed class FinalNewlineFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_final_newline; - protected override async Task FormatFileAsync( + internal override async Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/ImportsFormatter.cs index 78f1d9d90e0a..e6a22c3d9575 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/ImportsFormatter.cs @@ -1,11 +1,12 @@ - +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.Logging; -using Microsoft.VisualStudio.CodingConventions; namespace Microsoft.CodeAnalysis.Tools.Formatters { @@ -14,20 +15,27 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters /// internal sealed class ImportsFormatter : DocumentFormatter { - // TODO: Use warning from Resources. - protected override string FormatWarningDescription => "Fix imports."; + protected override string FormatWarningDescription => Resources.Fix_imports_ordering; + private readonly DocumentFormatter _endOfLineFormatter = new EndOfLineFormatter(); - protected override async Task FormatFileAsync( + internal override async Task FormatFileAsync( Document document, SourceText sourceText, - OptionSet options, - ICodingConventionsSnapshot codingConventions, + OptionSet optionSet, + AnalyzerConfigOptions? analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { - var formattedDocument = await Formatter.OrganizeImportsAsync(document, cancellationToken).ConfigureAwait(false); - return await formattedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + var organizedDocument = await Formatter.OrganizeImportsAsync(document, cancellationToken); + if (organizedDocument == document) + { + return sourceText; + } + + // Because the Formatter does not abide the `end_of_line` option we have to fix up the ends of the organized lines. + var organizedSourceText = await organizedDocument.GetTextAsync(cancellationToken); + return await _endOfLineFormatter.FormatFileAsync(organizedDocument, organizedSourceText, optionSet, analyzerConfigOptions, formatOptions, logger, cancellationToken); } } } diff --git a/src/Formatters/WhitespaceFormatter.cs b/src/Formatters/WhitespaceFormatter.cs index fa2afe6c6b7f..ed7800a8f9c6 100644 --- a/src/Formatters/WhitespaceFormatter.cs +++ b/src/Formatters/WhitespaceFormatter.cs @@ -17,7 +17,7 @@ internal sealed class WhitespaceFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_whitespace_formatting; - protected override async Task FormatFileAsync( + internal override async Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, From c8dbf9bce4f0f368f7ceefdc70a76cf76b01f065 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 29 May 2020 16:02:37 -0700 Subject: [PATCH 1014/2702] Update FormatterTests to add AnalyzerConfig to test workspace --- tests/Formatters/AbstractFormatterTests.cs | 87 +++++++++++++++++----- tests/Formatters/FormattedFilesTests.cs | 9 ++- 2 files changed, 74 insertions(+), 22 deletions(-) diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 23ea30bfacea..1a8711e59f62 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -8,7 +8,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Testing; @@ -50,13 +49,17 @@ static AbstractFormatterTest() LazyThreadSafetyMode.ExecutionAndPublication); } - protected virtual string DefaultFilePathPrefix { get; } = "Test"; + protected virtual string DefaultFilePathPrefix => "Test"; - protected virtual string DefaultTestProjectName { get; } = "TestProject"; + protected virtual string DefaultTestProjectName => "TestProject"; - protected virtual string DefaultTestProjectPath => "." + Path.DirectorySeparatorChar + DefaultTestProjectName + "." + DefaultFileExt + "proj"; + protected virtual string DefaultFolderPath => Path.DirectorySeparatorChar + DefaultTestProjectName + Path.DirectorySeparatorChar; - protected virtual string DefaultFilePath => DefaultFilePathPrefix + 0 + "." + DefaultFileExt; + protected virtual string DefaultTestProjectPath => DefaultFolderPath + DefaultTestProjectName + "." + DefaultFileExt + "proj"; + + protected virtual string DefaultEditorConfigPath => DefaultFolderPath + ".editorconfig"; + + protected virtual string DefaultFilePath => DefaultFolderPath + DefaultFilePathPrefix + 0 + "." + DefaultFileExt; protected abstract string DefaultFileExt { get; } @@ -64,7 +67,7 @@ static AbstractFormatterTest() protected AbstractFormatterTest() { - TestState = new SolutionState(DefaultFilePathPrefix, DefaultFileExt); + TestState = new SolutionState(DefaultFolderPath + DefaultFilePathPrefix, DefaultFileExt); } /// @@ -79,19 +82,36 @@ protected AbstractFormatterTest() public SolutionState TestState { get; } + private protected string ToEditorConfig(IReadOnlyDictionary editorConfig) => $@"root = true + +[*.{DefaultFileExt}] +{ string.Join(Environment.NewLine, editorConfig.Select(kvp => $"{kvp.Key} = {kvp.Value}")) } +"; + private protected Task TestAsync(string testCode, string expectedCode, IReadOnlyDictionary editorConfig) { return TestAsync(testCode, expectedCode, editorConfig, Encoding.UTF8); } - private protected async Task TestAsync(string testCode, string expectedCode, IReadOnlyDictionary editorConfig, Encoding encoding) + private protected Task TestAsync(string testCode, string expectedCode, string editorConfigText) + { + return TestAsync(testCode, expectedCode, editorConfigText, Encoding.UTF8); + } + + private protected Task TestAsync(string testCode, string expectedCode, IReadOnlyDictionary editorConfig, Encoding encoding) + { + return TestAsync(testCode, expectedCode, ToEditorConfig(editorConfig), encoding); + } + + private protected async Task TestAsync(string testCode, string expectedCode, string editorConfig, Encoding encoding) { var text = SourceText.From(testCode, encoding); TestState.Sources.Add(text); - var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray()); + var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), editorConfig); var project = solution.Projects.Single(); var document = project.Documents.Single(); + var fileMatcher = SourceFileMatcher.CreateMatcher(new[] { document.FilePath }, exclude: Array.Empty()); var formatOptions = new FormatOptions( workspaceFilePath: project.FilePath, @@ -103,7 +123,7 @@ private protected async Task TestAsync(string testCode, string expec reportPath: string.Empty, includeGeneratedFiles: false); - var pathsToFormat = await GetOnlyFileToFormatAsync(solution, editorConfig); + var pathsToFormat = await GetOnlyFileToFormatAsync(solution); var formattedSolution = await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, Logger, new List(), default); var formattedDocument = GetOnlyDocument(formattedSolution); @@ -120,11 +140,13 @@ private protected async Task TestAsync(string testCode, string expec /// A Solution containing a single Project containing a single Document. /// The editorconfig to apply to the documents options set. /// The document contained within along with option set and coding conventions. - internal async Task> GetOnlyFileToFormatAsync(Solution solution, IReadOnlyDictionary editorConfig) + internal async Task> GetOnlyFileToFormatAsync(Solution solution) { var document = GetOnlyDocument(solution); var options = (OptionSet)await document.GetOptionsAsync(); - AnalyzerConfigOptions analyzerConfigOptions = new EditorConfigOptions(editorConfig); + + var syntaxTree = await document.GetSyntaxTreeAsync(); + var analyzerConfigOptions = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree); return ImmutableArray.Create(new DocumentWithOptions(document, options, analyzerConfigOptions)); } @@ -158,10 +180,25 @@ internal async Task> GetOnlyFileToFormatAsyn /// Classes in the form of strings. /// Additional documents to include in the project. /// Additional metadata references to include in the project. + /// The .editorconfig to apply to this solution. /// A solution containing a project with the specified sources and additional files. - private protected Solution GetSolution((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences) + private protected Solution GetSolution((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, IReadOnlyDictionary editorConfig) { - var project = CreateProject(sources, additionalFiles, additionalMetadataReferences, Language); + return GetSolution(sources, additionalFiles, additionalMetadataReferences, ToEditorConfig(editorConfig)); + } + + /// + /// Given an array of strings as sources and a language, turn them into a and return the + /// solution. + /// + /// Classes in the form of strings. + /// Additional documents to include in the project. + /// Additional metadata references to include in the project. + /// The .editorconfig to apply to this solution. + /// A solution containing a project with the specified sources and additional files. + private protected Solution GetSolution((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string editorConfig) + { + var project = CreateProject(sources, additionalFiles, additionalMetadataReferences, Language, SourceText.From(editorConfig, Encoding.UTF8)); return project.Solution; } @@ -177,12 +214,13 @@ private protected Solution GetSolution((string filename, SourceText content)[] s /// Additional metadata references to include in the project. /// The language the source classes are in. Values may be taken from the /// class. + /// The .editorconfig to apply to this project. /// A created out of the s created from the source /// strings. - protected Project CreateProject((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language) + protected Project CreateProject((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language, SourceText editorConfigText) { language ??= Language; - return CreateProjectImpl(sources, additionalFiles, additionalMetadataReferences, language); + return CreateProjectImpl(sources, additionalFiles, additionalMetadataReferences, language, editorConfigText); } /// @@ -193,12 +231,13 @@ protected Project CreateProject((string filename, SourceText content)[] sources, /// Additional metadata references to include in the project. /// The language the source classes are in. Values may be taken from the /// class. + /// The .editorconfig to apply to this project. /// A created out of the s created from the source /// strings. - protected virtual Project CreateProjectImpl((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language) + protected virtual Project CreateProjectImpl((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language, SourceText editorConfigText) { var projectId = ProjectId.CreateNewId(debugName: DefaultTestProjectName); - var solution = CreateSolution(projectId, language); + var solution = CreateSolution(projectId, language, editorConfigText); solution = solution.AddMetadataReferences(projectId, additionalMetadataReferences); @@ -224,8 +263,9 @@ protected virtual Project CreateProjectImpl((string filename, SourceText content /// /// The project identifier to use. /// The language for which the solution is being created. + /// The .editorconfig to apply to this solution. /// The created solution. - protected virtual Solution CreateSolution(ProjectId projectId, string language) + protected virtual Solution CreateSolution(ProjectId projectId, string language, SourceText editorConfigText) { var compilationOptions = CreateCompilationOptions(); @@ -237,9 +277,18 @@ protected virtual Solution CreateSolution(ProjectId projectId, string language) compilationOptions = compilationOptions.WithXmlReferenceResolver(xmlReferenceResolver); + var editorConfigDocument = DocumentInfo.Create( + DocumentId.CreateNewId(projectId, DefaultEditorConfigPath), + name: DefaultEditorConfigPath, + loader: TextLoader.From(TextAndVersion.Create(editorConfigText, VersionStamp.Create())), + filePath: DefaultEditorConfigPath); + + var projectInfo = ProjectInfo.Create(projectId, VersionStamp.Create(), DefaultTestProjectName, DefaultTestProjectName, language, filePath: DefaultTestProjectPath) + .WithAnalyzerConfigDocuments(ImmutableArray.Create(editorConfigDocument)); + var solution = CreateWorkspace() .CurrentSolution - .AddProject(ProjectInfo.Create(projectId, VersionStamp.Create(), DefaultTestProjectName, DefaultTestProjectName, language, filePath: DefaultTestProjectPath)) + .AddProject(projectInfo) .WithProjectCompilationOptions(projectId, compilationOptions) .AddMetadataReference(projectId, CorlibReference) .AddMetadataReference(projectId, SystemReference) diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index 0ae409d13af3..b859152af033 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -47,9 +49,10 @@ private async Task> TestFormattedFiles(string testCode) var text = SourceText.From(testCode, Encoding.UTF8); TestState.Sources.Add(text); - var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray()); + var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), EditorConfig); var project = solution.Projects.Single(); var document = project.Documents.Single(); + var fileMatcher = SourceFileMatcher.CreateMatcher(new[] { document.FilePath }, exclude: Array.Empty()); var formatOptions = new FormatOptions( workspaceFilePath: project.FilePath, @@ -61,7 +64,7 @@ private async Task> TestFormattedFiles(string testCode) reportPath: string.Empty, includeGeneratedFiles: false); - var pathsToFormat = await GetOnlyFileToFormatAsync(solution, EditorConfig); + var pathsToFormat = await GetOnlyFileToFormatAsync(solution); var formattedFiles = new List(); await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, new TestLogger(), formattedFiles, default); From 22961df92d30c9a01a1ae0eff1882f92b65e87cf Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 29 May 2020 16:02:51 -0700 Subject: [PATCH 1015/2702] Port ImportsFormatter tests from features/analyzers --- tests/Formatters/ImportsFormatterTests.cs | 141 ++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 tests/Formatters/ImportsFormatterTests.cs diff --git a/tests/Formatters/ImportsFormatterTests.cs b/tests/Formatters/ImportsFormatterTests.cs new file mode 100644 index 000000000000..658cbddc11dc --- /dev/null +++ b/tests/Formatters/ImportsFormatterTests.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Formatters; +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters +{ + public class ImportsFormatterTests : CSharpFormatterTests + { + private protected override ICodeFormatter Formatter => new ImportsFormatter(); + + [Fact] + public async Task WhenOptionsDisabled_AndImportsNotSorted_ImportsSorted() + { + var testCode = @" +using Microsoft.CodeAnalysis; +using System.Linq; +using System; + +class C +{ +}"; + + var expectedCode = @" +using Microsoft.CodeAnalysis; +using System; +using System.Linq; + +class C +{ +}"; + + var editorConfig = new Dictionary() + { + ["end_of_line"] = EndOfLineFormatter.GetEndOfLineOption(Environment.NewLine), + ["dotnet_sort_system_directives_first"] = "false", + ["dotnet_separate_import_directive_groups"] = "false" + }; + + await TestAsync(testCode, expectedCode, editorConfig); + } + + [Fact] + public async Task WhenSystemDirectivesFirst_AndImportsNotSorted_ImportsSorted() + { + var testCode = @" +using Microsoft.CodeAnalysis; +using System.Linq; +using System; + +class C +{ +}"; + + var expectedCode = @" +using System; +using System.Linq; +using Microsoft.CodeAnalysis; + +class C +{ +}"; + + var editorConfig = new Dictionary() + { + ["end_of_line"] = EndOfLineFormatter.GetEndOfLineOption(Environment.NewLine), + ["dotnet_sort_system_directives_first"] = "true", + ["dotnet_separate_import_directive_groups"] = "false" + }; + + await TestAsync(testCode, expectedCode, editorConfig); + } + + [Fact] + public async Task WhenImportGroupsSeparated_AndImportsNotSeparated_ImportsSeparated() + { + var testCode = @" +using Microsoft.CodeAnalysis; +using System.Linq; +using System; + +class C +{ +}"; + + var expectedCode = @" +using Microsoft.CodeAnalysis; + +using System; +using System.Linq; + +class C +{ +}"; + + var editorConfig = new Dictionary() + { + ["end_of_line"] = EndOfLineFormatter.GetEndOfLineOption(Environment.NewLine), + ["dotnet_sort_system_directives_first"] = "false", + ["dotnet_separate_import_directive_groups"] = "true" + }; + + await TestAsync(testCode, expectedCode, editorConfig); + } + + [Fact] + public async Task WhenBothOptionsEnabled_AndImportsNotSortedOrSeparated_ImportsSortedAndSeparated() + { + var testCode = @" +using Microsoft.CodeAnalysis; +using System.Linq; +using System; + +class C +{ +}"; + + var expectedCode = @" +using System; +using System.Linq; + +using Microsoft.CodeAnalysis; + +class C +{ +}"; + + var editorConfig = new Dictionary() + { + ["end_of_line"] = EndOfLineFormatter.GetEndOfLineOption(Environment.NewLine), + ["dotnet_sort_system_directives_first"] = "true", + ["dotnet_separate_import_directive_groups"] = "true" + }; + + await TestAsync(testCode, expectedCode, editorConfig); + } + } +} From 0a2626e8709f9bf6fe443dd976c32e356c9f5b8d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 29 May 2020 16:21:56 -0700 Subject: [PATCH 1016/2702] Run format against format.sln --- src/Logging/SimpleConsoleLoggerFactoryExtensions.cs | 2 +- src/Logging/SimpleConsoleLoggerProvider.cs | 2 +- src/Utilities/EditorConfigFinder.cs | 2 +- tests/CodeFormatterTests.cs | 2 +- tests/Formatters/ImportsFormatterTests.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs index f4b2405ac223..0f75b1557c0d 100644 --- a/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs +++ b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using Microsoft.Extensions.Logging; using System.CommandLine; +using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Logging { diff --git a/src/Logging/SimpleConsoleLoggerProvider.cs b/src/Logging/SimpleConsoleLoggerProvider.cs index 3a01da83afaa..81516f0fe728 100644 --- a/src/Logging/SimpleConsoleLoggerProvider.cs +++ b/src/Logging/SimpleConsoleLoggerProvider.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using Microsoft.Extensions.Logging; using System.CommandLine; +using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Logging { diff --git a/src/Utilities/EditorConfigFinder.cs b/src/Utilities/EditorConfigFinder.cs index 59f6418ffb74..04ee7f34bcab 100644 --- a/src/Utilities/EditorConfigFinder.cs +++ b/src/Utilities/EditorConfigFinder.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System.IO; using System.Collections.Immutable; +using System.IO; using System.Linq; namespace Microsoft.CodeAnalysis.Tools.Utilities diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 67bcd5dadfb8..c31c3569b615 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -7,8 +7,8 @@ using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; +using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; using Xunit; diff --git a/tests/Formatters/ImportsFormatterTests.cs b/tests/Formatters/ImportsFormatterTests.cs index 658cbddc11dc..6e83f86615a0 100644 --- a/tests/Formatters/ImportsFormatterTests.cs +++ b/tests/Formatters/ImportsFormatterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; From f1b14e33169895d66e7c6083e0b92e2565425882 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sat, 30 May 2020 09:30:15 -0700 Subject: [PATCH 1017/2702] Add catch for imports organizer --- src/Formatters/ImportsFormatter.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/ImportsFormatter.cs index e6a22c3d9575..5fbb8bae3776 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/ImportsFormatter.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; @@ -27,15 +28,24 @@ internal override async Task FormatFileAsync( ILogger logger, CancellationToken cancellationToken) { - var organizedDocument = await Formatter.OrganizeImportsAsync(document, cancellationToken); - if (organizedDocument == document) + try { + var organizedDocument = await Formatter.OrganizeImportsAsync(document, cancellationToken); + if (organizedDocument == document) + { + return sourceText; + } + + // Because the Formatter does not abide the `end_of_line` option we have to fix up the ends of the organized lines. + var organizedSourceText = await organizedDocument.GetTextAsync(cancellationToken); + return await _endOfLineFormatter.FormatFileAsync(organizedDocument, organizedSourceText, optionSet, analyzerConfigOptions, formatOptions, logger, cancellationToken); + } + catch (InsufficientExecutionStackException) + { + // This case is normally not hit when running against a handwritten code file. + // https://github.com/dotnet/roslyn/issues/44710#issuecomment-636253053 return sourceText; } - - // Because the Formatter does not abide the `end_of_line` option we have to fix up the ends of the organized lines. - var organizedSourceText = await organizedDocument.GetTextAsync(cancellationToken); - return await _endOfLineFormatter.FormatFileAsync(organizedDocument, organizedSourceText, optionSet, analyzerConfigOptions, formatOptions, logger, cancellationToken); } } } From 686fc1efbe07d0a2d47147e36677ffcb09a74edc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 30 May 2020 17:31:06 +0000 Subject: [PATCH 1018/2702] [master] Update dependencies from dotnet/arcade (#690) * Update dependencies from https://github.com/dotnet/arcade build 20200511.9 Microsoft.DotNet.Arcade.Sdk From Version 5.0.0-beta.20201.2 -> To Version 5.0.0-beta.20261.9 * Update dependencies from https://github.com/dotnet/arcade build 20200528.4 Microsoft.DotNet.Arcade.Sdk From Version 5.0.0-beta.20201.2 -> To Version 5.0.0-beta.20278.4 * Update nuget.config * Try to rollforward test running Co-authored-by: dotnet-maestro[bot] Co-authored-by: Joey Robichaud --- NuGet.config | 2 + eng/Version.Details.xml | 4 +- eng/common/SetupNugetSources.ps1 | 14 +- eng/common/build.ps1 | 6 +- eng/common/build.sh | 9 +- eng/common/cross/build-rootfs.sh | 30 +- eng/common/internal/Tools.csproj | 1 + eng/common/native/CommonLibrary.psm1 | 24 +- eng/common/native/find-native-compiler.sh | 121 +++ eng/common/performance/perfhelixpublish.proj | 8 + eng/common/performance/performance-setup.ps1 | 32 +- eng/common/performance/performance-setup.sh | 36 +- eng/common/pipeline-logging-functions.sh | 21 +- .../post-build/check-channel-consistency.ps1 | 7 +- eng/common/post-build/publish-using-darc.ps1 | 71 ++ eng/common/post-build/symbols-validation.ps1 | 194 +++-- eng/common/sdk-task.ps1 | 13 + eng/common/sdl/execute-all-sdl-tools.ps1 | 8 +- eng/common/sdl/extract-artifact-packages.ps1 | 4 +- eng/common/sdl/init-sdl.ps1 | 2 +- eng/common/sdl/packages.config | 2 +- eng/common/templates/job/execute-sdl.yml | 34 +- eng/common/templates/job/job.yml | 14 +- .../channels/generic-internal-channel.yml | 4 +- .../channels/generic-public-channel.yml | 4 +- .../templates/post-build/common-variables.yml | 2 +- .../templates/post-build/post-build.yml | 771 ++++++++++-------- .../post-build/setup-maestro-vars.yml | 26 +- eng/common/templates/steps/send-to-helix.yml | 6 +- eng/common/tools.ps1 | 53 +- eng/common/tools.sh | 39 +- global.json | 4 +- tests/runtimeconfig.template.json | 3 + 33 files changed, 1053 insertions(+), 516 deletions(-) create mode 100644 eng/common/native/find-native-compiler.sh create mode 100644 eng/common/post-build/publish-using-darc.ps1 create mode 100644 tests/runtimeconfig.template.json diff --git a/NuGet.config b/NuGet.config index 1412dcd82ffa..3bf99081046b 100644 --- a/NuGet.config +++ b/NuGet.config @@ -3,6 +3,8 @@ + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 11e635859613..b22160bc79a0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - bce0a98620c1c5a110b2bba9912f3d5929069c6b + 96c65ad967d2abbbd8e770ba752a6b64255ec669 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index a5a1e711d79c..c3c473eb83e6 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -83,7 +83,7 @@ function AddCredential($creds, $source, $username, $password) { $passwordElement.SetAttribute("value", $Password) } -function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Password) { +function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Password) { $maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]") Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds." @@ -123,19 +123,21 @@ if ($creds -eq $null) { $doc.DocumentElement.AppendChild($creds) | Out-Null } +$userName = "dn-bot" + # Insert credential nodes for Maestro's private feeds -InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password +InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -Password $Password $dotnet3Source = $sources.SelectSingleNode("add[@key='dotnet3']") if ($dotnet3Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password } $dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']") if ($dotnet31Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password } $doc.Save($filename) diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 813d440d2a83..67ee6d28d3fa 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -20,6 +20,7 @@ Param( [switch] $publish, [switch] $clean, [switch][Alias('bl')]$binaryLog, + [switch][Alias('nobl')]$excludeCIBinarylog, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -58,6 +59,7 @@ function Print-Usage() { Write-Host "Advanced settings:" Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" Write-Host " -ci Set when running on CI server" + Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." @@ -134,7 +136,9 @@ try { } if ($ci) { - $binaryLog = $true + if (-not $excludeCIBinarylog) { + $binaryLog = $true + } $nodeReuse = $false } diff --git a/eng/common/build.sh b/eng/common/build.sh index 36f9aa0462ee..6d7c5a1f69c2 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -32,6 +32,7 @@ usage() echo "Advanced settings:" echo " --projects Project or solution file(s) to build" echo " --ci Set when running on CI server" + echo " --excludeCIBinarylog Don't output binary log (short: -nobl)" echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" @@ -68,6 +69,7 @@ clean=false warn_as_error=true node_reuse=true binary_log=false +exclude_ci_binary_log=false pipelines_log=false projects='' @@ -98,6 +100,9 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; + -excludeCIBinarylog|-nobl) + exclude_ci_binary_log=true + ;; -pipelineslog|-pl) pipelines_log=true ;; @@ -156,8 +161,10 @@ done if [[ "$ci" == true ]]; then pipelines_log=true - binary_log=true node_reuse=false + if [[ "$exclude_ci_binary_log" == false ]]; then + binary_log=true + fi fi . "$scriptroot/tools.sh" diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 2cdd82d30df6..d780fefb5414 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + usage() { echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [--skipunmount] --rootfsdir ]" @@ -15,6 +17,8 @@ __CodeName=xenial __CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) __InitialDir=$PWD __BuildArch=arm +__AlpineArch=armv7 +__QEMUArch=arm __UbuntuArch=armhf __UbuntuRepo="http://ports.ubuntu.com/" __LLDB_Package="liblldb-3.9-dev" @@ -26,9 +30,10 @@ __UbuntuPackages="build-essential" __AlpinePackages="alpine-base" __AlpinePackages+=" build-base" __AlpinePackages+=" linux-headers" -__AlpinePackagesEdgeTesting=" lldb-dev" -__AlpinePackagesEdgeMain=" llvm9-libs" +__AlpinePackagesEdgeCommunity=" lldb-dev" +__AlpinePackagesEdgeMain=" llvm10-libs" __AlpinePackagesEdgeMain+=" python3" +__AlpinePackagesEdgeMain+=" libedit" # symlinks fixer __UbuntuPackages+=" symlinks" @@ -55,12 +60,11 @@ __AlpinePackages+=" openssl-dev" __AlpinePackages+=" zlib-dev" __FreeBSDBase="12.1-RELEASE" -__FreeBSDPkg="1.10.5" +__FreeBSDPkg="1.12.0" __FreeBSDPackages="libunwind" __FreeBSDPackages+=" icu" __FreeBSDPackages+=" libinotify" __FreeBSDPackages+=" lttng-ust" -__FreeBSDPackages+=" llvm-90" __FreeBSDPackages+=" krb5" __UnprocessedBuildArgs= @@ -78,7 +82,7 @@ while :; do arm) __BuildArch=arm __UbuntuArch=armhf - __AlpineArch=armhf + __AlpineArch=armv7 __QEMUArch=arm ;; arm64) @@ -205,7 +209,7 @@ fi if [ -d "$__RootfsDir" ]; then if [ $__SkipUnmount == 0 ]; then - umount $__RootfsDir/* + umount $__RootfsDir/* || true fi rm -rf $__RootfsDir fi @@ -231,9 +235,9 @@ if [[ "$__CodeName" == "alpine" ]]; then add $__AlpinePackagesEdgeMain $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + -X http://dl-cdn.alpinelinux.org/alpine/edge/community \ -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ - add $__AlpinePackagesEdgeTesting + add $__AlpinePackagesEdgeCommunity rm -r $__ApkToolsDir elif [[ "$__CodeName" == "freebsd" ]]; then @@ -246,11 +250,13 @@ elif [[ "$__CodeName" == "freebsd" ]]; then # get and build package manager wget -O - https://github.com/freebsd/pkg/archive/${__FreeBSDPkg}.tar.gz | tar -C $__RootfsDir/tmp -zxf - cd $__RootfsDir/tmp/pkg-${__FreeBSDPkg} - ./autogen.sh && ./configure --prefix=$__RootfsDir/host && make install + # needed for install to succeed + mkdir -p $__RootfsDir/host/etc + ./autogen.sh && ./configure --prefix=$__RootfsDir/host && make && make install rm -rf $__RootfsDir/tmp/pkg-${__FreeBSDPkg} # install packages we need. - $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf update - $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf install --yes $__FreeBSDPackages + INSTALL_AS_USER=$(whoami) $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf update + INSTALL_AS_USER=$(whoami) $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf install --yes $__FreeBSDPackages elif [[ -n $__CodeName ]]; then qemu-debootstrap --arch $__UbuntuArch $__CodeName $__RootfsDir $__UbuntuRepo cp $__CrossDir/$__BuildArch/sources.list.$__CodeName $__RootfsDir/etc/apt/sources.list @@ -260,7 +266,7 @@ elif [[ -n $__CodeName ]]; then chroot $__RootfsDir symlinks -cr /usr if [ $__SkipUnmount == 0 ]; then - umount $__RootfsDir/* + umount $__RootfsDir/* || true fi if [[ "$__BuildArch" == "arm" && "$__CodeName" == "trusty" ]]; then diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index 1a39a7ef3f67..f46d5efe2e32 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -4,6 +4,7 @@ net472 false + false diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index 41416862d913..d7d1a6510949 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -145,9 +145,12 @@ function Get-File { New-Item -path $DownloadDirectory -force -itemType "Directory" | Out-Null } + $TempPath = "$Path.tmp" if (Test-Path -IsValid -Path $Uri) { - Write-Verbose "'$Uri' is a file path, copying file to '$Path'" - Copy-Item -Path $Uri -Destination $Path + Write-Verbose "'$Uri' is a file path, copying temporarily to '$TempPath'" + Copy-Item -Path $Uri -Destination $TempPath + Write-Verbose "Moving temporary file to '$Path'" + Move-Item -Path $TempPath -Destination $Path return $? } else { @@ -157,8 +160,10 @@ function Get-File { while($Attempt -Lt $DownloadRetries) { try { - Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $Path - Write-Verbose "Downloaded to '$Path'" + Invoke-WebRequest -UseBasicParsing -Uri $Uri -OutFile $TempPath + Write-Verbose "Downloaded to temporary location '$TempPath'" + Move-Item -Path $TempPath -Destination $Path + Write-Verbose "Moved temporary file to '$Path'" return $True } catch { @@ -359,16 +364,21 @@ function Expand-Zip { return $False } } - if (-Not (Test-Path $OutputDirectory)) { - New-Item -path $OutputDirectory -Force -itemType "Directory" | Out-Null + + $TempOutputDirectory = Join-Path "$(Split-Path -Parent $OutputDirectory)" "$(Split-Path -Leaf $OutputDirectory).tmp" + if (Test-Path $TempOutputDirectory) { + Remove-Item $TempOutputDirectory -Force -Recurse } + New-Item -Path $TempOutputDirectory -Force -ItemType "Directory" | Out-Null Add-Type -assembly "system.io.compression.filesystem" - [io.compression.zipfile]::ExtractToDirectory("$ZipPath", "$OutputDirectory") + [io.compression.zipfile]::ExtractToDirectory("$ZipPath", "$TempOutputDirectory") if ($? -Eq $False) { Write-Error "Unable to extract '$ZipPath'" return $False } + + Move-Item -Path $TempOutputDirectory -Destination $OutputDirectory } catch { Write-Host $_ diff --git a/eng/common/native/find-native-compiler.sh b/eng/common/native/find-native-compiler.sh new file mode 100644 index 000000000000..aed19d07d506 --- /dev/null +++ b/eng/common/native/find-native-compiler.sh @@ -0,0 +1,121 @@ +#!/usr/bin/env bash +# +# This file locates the native compiler with the given name and version and sets the environment variables to locate it. +# + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +if [ $# -lt 0 ] +then + echo "Usage..." + echo "find-native-compiler.sh " + echo "Specify the name of compiler (clang or gcc)." + echo "Specify the major version of compiler." + echo "Specify the minor version of compiler." + exit 1 +fi + +. $scriptroot/../pipeline-logging-functions.sh + +compiler="$1" +cxxCompiler="$compiler++" +majorVersion="$2" +minorVersion="$3" + +if [ "$compiler" = "gcc" ]; then cxxCompiler="g++"; fi + +check_version_exists() { + desired_version=-1 + + # Set up the environment to be used for building with the desired compiler. + if command -v "$compiler-$1.$2" > /dev/null; then + desired_version="-$1.$2" + elif command -v "$compiler$1$2" > /dev/null; then + desired_version="$1$2" + elif command -v "$compiler-$1$2" > /dev/null; then + desired_version="-$1$2" + fi + + echo "$desired_version" +} + +if [ -z "$CLR_CC" ]; then + + # Set default versions + if [ -z "$majorVersion" ]; then + # note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero. + if [ "$compiler" = "clang" ]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) + elif [ "$compiler" = "gcc" ]; then versions=( 9 8 7 6 5 4.9 ); fi + + for version in "${versions[@]}"; do + parts=(${version//./ }) + desired_version="$(check_version_exists "${parts[0]}" "${parts[1]}")" + if [ "$desired_version" != "-1" ]; then majorVersion="${parts[0]}"; break; fi + done + + if [ -z "$majorVersion" ]; then + if command -v "$compiler" > /dev/null; then + if [ "$(uname)" != "Darwin" ]; then + Write-PipelineTelemetryError -category "Build" -type "warning" "Specific version of $compiler not found, falling back to use the one in PATH." + fi + export CC="$(command -v "$compiler")" + export CXX="$(command -v "$cxxCompiler")" + else + Write-PipelineTelemetryError -category "Build" "No usable version of $compiler found." + exit 1 + fi + else + if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then + if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then + if command -v "$compiler" > /dev/null; then + Write-PipelineTelemetryError -category "Build" -type "warning" "Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH." + export CC="$(command -v "$compiler")" + export CXX="$(command -v "$cxxCompiler")" + else + Write-PipelineTelemetryError -category "Build" "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH." + exit 1 + fi + fi + fi + fi + else + desired_version="$(check_version_exists "$majorVersion" "$minorVersion")" + if [ "$desired_version" = "-1" ]; then + Write-PipelineTelemetryError -category "Build" "Could not find specific version of $compiler: $majorVersion $minorVersion." + exit 1 + fi + fi + + if [ -z "$CC" ]; then + export CC="$(command -v "$compiler$desired_version")" + export CXX="$(command -v "$cxxCompiler$desired_version")" + if [ -z "$CXX" ]; then export CXX="$(command -v "$cxxCompiler")"; fi + fi +else + if [ ! -f "$CLR_CC" ]; then + Write-PipelineTelemetryError -category "Build" "CLR_CC is set but path '$CLR_CC' does not exist" + exit 1 + fi + export CC="$CLR_CC" + export CXX="$CLR_CXX" +fi + +if [ -z "$CC" ]; then + Write-PipelineTelemetryError -category "Build" "Unable to find $compiler." + exit 1 +fi + +export CCC_CC="$CC" +export CCC_CXX="$CXX" +export SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")" diff --git a/eng/common/performance/perfhelixpublish.proj b/eng/common/performance/perfhelixpublish.proj index cf5941e1b645..1db5e8a84d75 100644 --- a/eng/common/performance/perfhelixpublish.proj +++ b/eng/common/performance/perfhelixpublish.proj @@ -6,6 +6,7 @@ py -3 %HELIX_CORRELATION_PAYLOAD%\Core_Root\CoreRun.exe %HELIX_CORRELATION_PAYLOAD%\Baseline_Core_Root\CoreRun.exe + $(HelixPreCommands);call %HELIX_CORRELATION_PAYLOAD%\performance\tools\machine-setup.cmd;set PYTHONPATH=%HELIX_WORKITEM_PAYLOAD%\scripts%3B%HELIX_WORKITEM_PAYLOAD% %HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts %HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts_Baseline @@ -40,6 +41,13 @@ $HELIX_WORKITEM_ROOT/testResults.xml + + --corerun %HELIX_CORRELATION_PAYLOAD%\dotnet-mono\shared\Microsoft.NETCore.App\5.0.0\corerun.exe + + + --corerun $(BaseDirectory)/dotnet-mono/shared/Microsoft.NETCore.App/5.0.0/corerun + + --corerun $(CoreRun) diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index 1763a1a97b0e..31a99e49015f 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -3,7 +3,7 @@ Param( [string] $CoreRootDirectory, [string] $BaselineCoreRootDirectory, [string] $Architecture="x64", - [string] $Framework="netcoreapp5.0", + [string] $Framework="net5.0", [string] $CompilationMode="Tiered", [string] $Repository=$env:BUILD_REPOSITORY_NAME, [string] $Branch=$env:BUILD_SOURCEBRANCH, @@ -12,8 +12,12 @@ Param( [string] $RunCategories="Libraries Runtime", [string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj", [string] $Kind="micro", + [switch] $LLVM, + [switch] $MonoInterpreter, + [switch] $MonoAOT, [switch] $Internal, [switch] $Compare, + [string] $MonoDotnet="", [string] $Configurations="CompilationMode=$CompilationMode RunKind=$Kind" ) @@ -31,7 +35,8 @@ $HelixSourcePrefix = "pr" $Queue = "Windows.10.Amd64.ClientRS4.DevEx.15.8.Open" -if ($Framework.StartsWith("netcoreapp")) { +# TODO: Implement a better logic to determine if Framework is .NET Core or >= .NET 5. +if ($Framework.StartsWith("netcoreapp") -or ($Framework -eq "net5.0")) { $Queue = "Windows.10.Amd64.ClientRS5.Open" } @@ -49,6 +54,21 @@ if ($Internal) { $HelixSourcePrefix = "official" } +if($MonoDotnet -ne "") +{ + $Configurations += " LLVM=$LLVM MonoInterpreter=$MonoInterpreter MonoAOT=$MonoAOT" + if($ExtraBenchmarkDotNetArguments -eq "") + { + #FIX ME: We need to block these tests as they don't run on mono for now + $ExtraBenchmarkDotNetArguments = "--exclusion-filter *Perf_Image* *Perf_NamedPipeStream*" + } + else + { + #FIX ME: We need to block these tests as they don't run on mono for now + $ExtraBenchmarkDotNetArguments += " --exclusion-filter *Perf_Image* *Perf_NamedPipeStream*" + } +} + # FIX ME: This is a workaround until we get this from the actual pipeline $CommonSetupArguments="--channel master --queue $Queue --build-number $BuildNumber --build-configs $Configurations --architecture $Architecture" $SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments" @@ -69,6 +89,13 @@ else { git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $PerformanceDirectory } +if($MonoDotnet -ne "") +{ + $UsingMono = "true" + $MonoDotnetPath = (Join-Path $PayloadDirectory "dotnet-mono") + Move-Item -Path $MonoDotnet -Destination $MonoDotnetPath +} + if ($UseCoreRun) { $NewCoreRoot = (Join-Path $PayloadDirectory "Core_Root") Move-Item -Path $CoreRootDirectory -Destination $NewCoreRoot @@ -104,6 +131,7 @@ Write-PipelineSetVariable -Name 'UseCoreRun' -Value "$UseCoreRun" -IsMultiJobVar Write-PipelineSetVariable -Name 'UseBaselineCoreRun' -Value "$UseBaselineCoreRun" -IsMultiJobVariable $false Write-PipelineSetVariable -Name 'RunFromPerfRepo' -Value "$RunFromPerformanceRepo" -IsMultiJobVariable $false Write-PipelineSetVariable -Name 'Compare' -Value "$Compare" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'MonoDotnet' -Value "$UsingMono" -IsMultiJobVariable $false # Helix Arguments Write-PipelineSetVariable -Name 'Creator' -Value "$Creator" -IsMultiJobVariable $false diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index b9eecf94bd01..9409e4d85e92 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -4,7 +4,7 @@ source_directory=$BUILD_SOURCESDIRECTORY core_root_directory= baseline_core_root_directory= architecture=x64 -framework=netcoreapp5.0 +framework=net5.0 compilation_mode=tiered repository=$BUILD_REPOSITORY_NAME branch=$BUILD_SOURCEBRANCH @@ -12,13 +12,18 @@ commit_sha=$BUILD_SOURCEVERSION build_number=$BUILD_BUILDNUMBER internal=false compare=false +mono_dotnet= kind="micro" +llvm=false +monointerpreter=false +monoaot=false run_categories="Libraries Runtime" csproj="src\benchmarks\micro\MicroBenchmarks.csproj" configurations="CompliationMode=$compilation_mode RunKind=$kind" run_from_perf_repo=false use_core_run=true use_baseline_core_run=true +using_mono=false while (($# > 0)); do lowerI="$(echo $1 | awk '{print tolower($0)}')" @@ -65,6 +70,7 @@ while (($# > 0)); do ;; --kind) kind=$2 + configurations="CompliationMode=$compilation_mode RunKind=$kind" shift 2 ;; --runcategories) @@ -79,6 +85,22 @@ while (($# > 0)); do internal=true shift 1 ;; + --llvm) + llvm=true + shift 1 + ;; + --monointerpreter) + monointerpreter=true + shift 1 + ;; + --monoaot) + monoaot=true + shift 1 + ;; + --monodotnet) + mono_dotnet=$2 + shift 2 + ;; --compare) compare=true shift 1 @@ -107,6 +129,7 @@ while (($# > 0)); do echo " --kind Related to csproj. The kind of benchmarks that should be run. Defaults to micro" echo " --runcategories Related to csproj. Categories of benchmarks to run. Defaults to \"coreclr corefx\"" echo " --internal If the benchmarks are running as an official job." + echo " --monodotnet Pass the path to the mono dotnet for mono performance testing." echo "" exit 0 ;; @@ -164,6 +187,10 @@ if [[ "$internal" == true ]]; then fi fi +if [[ "$mono_dotnet" != "" ]]; then + configurations="$configurations LLVM=$llvm MonoInterpreter=$monointerpreter MonoAOT=$monoaot" +fi + common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture" setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" @@ -186,6 +213,12 @@ else mv $docs_directory $workitem_directory fi +if [[ "$mono_dotnet" != "" ]]; then + using_mono=true + mono_dotnet_path=$payload_directory/dotnet-mono + mv $mono_dotnet $mono_dotnet_path +fi + if [[ "$use_core_run" = true ]]; then new_core_root=$payload_directory/Core_Root mv $core_root_directory $new_core_root @@ -221,3 +254,4 @@ Write-PipelineSetVariable -name "HelixSourcePrefix" -value "$helix_source_prefix Write-PipelineSetVariable -name "Kind" -value "$kind" -is_multi_job_variable false Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false Write-PipelineSetVariable -name "Compare" -value "$compare" -is_multi_job_variable false +Write-PipelineSetVariable -name "MonoDotnet" -value "$using_mono" -is_multi_job_variable false diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh index 33c3f0d8072a..6cd0a3400e61 100755 --- a/eng/common/pipeline-logging-functions.sh +++ b/eng/common/pipeline-logging-functions.sh @@ -31,26 +31,21 @@ function Write-PipelineTelemetryError { return fi - message="(NETCORE_ENGINEERING_TELEMETRY=$telemetry_category) $message" - function_args+=("$message") if [[ $force == true ]]; then function_args+=("-force") fi - - Write-PipelineTaskError $function_args + message="(NETCORE_ENGINEERING_TELEMETRY=$telemetry_category) $message" + function_args+=("$message") + Write-PipelineTaskError ${function_args[@]} } function Write-PipelineTaskError { - if [[ $force != true ]] && [[ "$ci" != true ]]; then - echo "$@" >&2 - return - fi - local message_type="error" local sourcepath='' local linenumber='' local columnnumber='' local error_code='' + local force=false while [[ $# -gt 0 ]]; do opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" @@ -75,6 +70,9 @@ function Write-PipelineTaskError { error_code=$2 shift ;; + -force|-f) + force=true + ;; *) break ;; @@ -83,6 +81,11 @@ function Write-PipelineTaskError { shift done + if [[ $force != true ]] && [[ "$ci" != true ]]; then + echo "$@" >&2 + return + fi + local message="##vso[task.logissue" message="$message type=$message_type" diff --git a/eng/common/post-build/check-channel-consistency.ps1 b/eng/common/post-build/check-channel-consistency.ps1 index 7e6618d64ad9..38abc5392dc7 100644 --- a/eng/common/post-build/check-channel-consistency.ps1 +++ b/eng/common/post-build/check-channel-consistency.ps1 @@ -6,13 +6,18 @@ param( try { . $PSScriptRoot\post-build-utils.ps1 + if ($PromoteToChannels -eq "") { + Write-PipelineTaskError -Type 'warning' -Message "This build won't publish assets as it's not configured to any Maestro channel. If that wasn't intended use Darc to configure a default channel using add-default-channel for this branch or to promote it to a channel using add-build-to-channel. See https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#assigning-an-individual-build-to-a-channel for more info." + ExitWithExitCode 0 + } + # Check that every channel that Maestro told to promote the build to # is available in YAML $PromoteToChannelsIds = $PromoteToChannels -split "\D" | Where-Object { $_ } foreach ($id in $PromoteToChannelsIds) { if (($id -ne 0) -and ($id -notin $AvailableChannelIds)) { - Write-PipelineTaskError -Type 'warning' -Message "Channel $id is not present in the post-build YAML configuration!" + Write-PipelineTaskError -Message "Channel $id is not present in the post-build YAML configuration! This is an error scenario. Please contact @dnceng." } } diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 new file mode 100644 index 000000000000..d22eb439c486 --- /dev/null +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -0,0 +1,71 @@ +param( + [Parameter(Mandatory=$true)][int] $BuildId, + [Parameter(Mandatory=$true)][string] $AzdoToken, + [Parameter(Mandatory=$true)][string] $MaestroToken, + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com', + [Parameter(Mandatory=$true)][string] $WaitPublishingFinish, + [Parameter(Mandatory=$true)][string] $EnableSourceLinkValidation, + [Parameter(Mandatory=$true)][string] $EnableSigningValidation, + [Parameter(Mandatory=$true)][string] $EnableNugetValidation, + [Parameter(Mandatory=$true)][string] $PublishInstallersAndChecksums, + [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, + [Parameter(Mandatory=$false)][string] $SigningValidationAdditionalParameters +) + +try { + . $PSScriptRoot\post-build-utils.ps1 + . $PSScriptRoot\..\darc-init.ps1 + + $optionalParams = [System.Collections.ArrayList]::new() + + if ("" -ne $ArtifactsPublishingAdditionalParameters) { + $optionalParams.Add("artifact-publishing-parameters") | Out-Null + $optionalParams.Add($ArtifactsPublishingAdditionalParameters) | Out-Null + } + + if ("false" -eq $WaitPublishingFinish) { + $optionalParams.Add("--no-wait") | Out-Null + } + + if ("true" -eq $PublishInstallersAndChecksums) { + $optionalParams.Add("--publish-installers-and-checksums") | Out-Null + } + + if ("true" -eq $EnableNugetValidation) { + $optionalParams.Add("--validate-nuget") | Out-Null + } + + if ("true" -eq $EnableSourceLinkValidation) { + $optionalParams.Add("--validate-sourcelinkchecksums") | Out-Null + } + + if ("true" -eq $EnableSigningValidation) { + $optionalParams.Add("--validate-signingchecksums") | Out-Null + + if ("" -ne $SigningValidationAdditionalParameters) { + $optionalParams.Add("--signing-validation-parameters") | Out-Null + $optionalParams.Add($SigningValidationAdditionalParameters) | Out-Null + } + } + + & darc add-build-to-channel ` + --id $buildId ` + --default-channels ` + --source-branch master ` + --azdev-pat $AzdoToken ` + --bar-uri $MaestroApiEndPoint ` + --password $MaestroToken ` + @optionalParams + + if ($LastExitCode -ne 0) { + Write-Host "Problems using Darc to promote build ${buildId} to default channels. Stopping execution..." + exit 1 + } + + Write-Host 'done.' +} +catch { + Write-Host $_ + Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to publish build '$BuildId' to default channels." + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 index f7cfe986ddd3..e108bf6c5f68 100644 --- a/eng/common/post-build/symbols-validation.ps1 +++ b/eng/common/post-build/symbols-validation.ps1 @@ -1,72 +1,30 @@ param( [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation - [Parameter(Mandatory=$true)][string] $DotnetSymbolVersion # Version of dotnet symbol to use + [Parameter(Mandatory=$true)][string] $DotnetSymbolVersion, # Version of dotnet symbol to use + [Parameter(Mandatory=$false)][switch] $ContinueOnError, # If we should keep checking symbols after an error + [Parameter(Mandatory=$false)][switch] $Clean # Clean extracted symbols directory after checking symbols ) -function FirstMatchingSymbolDescriptionOrDefault { - param( - [string] $FullPath, # Full path to the module that has to be checked - [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols - [string] $SymbolsPath - ) - - $FileName = [System.IO.Path]::GetFileName($FullPath) - $Extension = [System.IO.Path]::GetExtension($FullPath) - - # Those below are potential symbol files that the `dotnet symbol` might - # return. Which one will be returned depend on the type of file we are - # checking and which type of file was uploaded. - - # The file itself is returned - $SymbolPath = $SymbolsPath + '\' + $FileName - - # PDB file for the module - $PdbPath = $SymbolPath.Replace($Extension, '.pdb') - - # PDB file for R2R module (created by crossgen) - $NGenPdb = $SymbolPath.Replace($Extension, '.ni.pdb') - - # DBG file for a .so library - $SODbg = $SymbolPath.Replace($Extension, '.so.dbg') +# Maximum number of jobs to run in parallel +$MaxParallelJobs = 6 - # DWARF file for a .dylib - $DylibDwarf = $SymbolPath.Replace($Extension, '.dylib.dwarf') - - $dotnetSymbolExe = "$env:USERPROFILE\.dotnet\tools" - $dotnetSymbolExe = Resolve-Path "$dotnetSymbolExe\dotnet-symbol.exe" - - & $dotnetSymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null - - if (Test-Path $PdbPath) { - return 'PDB' - } - elseif (Test-Path $NGenPdb) { - return 'NGen PDB' - } - elseif (Test-Path $SODbg) { - return 'DBG for SO' - } - elseif (Test-Path $DylibDwarf) { - return 'Dwarf for Dylib' - } - elseif (Test-Path $SymbolPath) { - return 'Module' - } - else { - return $null - } -} +# Wait time between check for system load +$SecondsBetweenLoadChecks = 10 -function CountMissingSymbols { +$CountMissingSymbols = { param( [string] $PackagePath # Path to a NuGet package ) + . $using:PSScriptRoot\..\tools.ps1 + + Add-Type -AssemblyName System.IO.Compression.FileSystem + # Ensure input file exist if (!(Test-Path $PackagePath)) { Write-PipelineTaskError "Input file does not exist: $PackagePath" - ExitWithExitCode 1 + return 1 } # Extensions for which we'll look for symbols @@ -77,23 +35,85 @@ function CountMissingSymbols { $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) $PackageGuid = New-Guid - $ExtractPath = Join-Path -Path $ExtractPath -ChildPath $PackageGuid + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageGuid $SymbolsPath = Join-Path -Path $ExtractPath -ChildPath 'Symbols' - [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) + try { + [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) + } + catch { + Write-Host "Something went wrong extracting $PackagePath" + Write-Host $_ + return -1 + } Get-ChildItem -Recurse $ExtractPath | Where-Object {$RelevantExtensions -contains $_.Extension} | ForEach-Object { - if ($_.FullName -Match '\\ref\\') { - Write-Host "`t Ignoring reference assembly file " $_.FullName + $FileName = $_.FullName + if ($FileName -Match '\\ref\\') { + Write-Host "`t Ignoring reference assembly file " $FileName return } - $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName '--microsoft-symbol-server' $SymbolsPath - $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName '--internal-server' $SymbolsPath + $FirstMatchingSymbolDescriptionOrDefault = { + param( + [string] $FullPath, # Full path to the module that has to be checked + [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + [string] $SymbolsPath + ) + + $FileName = [System.IO.Path]::GetFileName($FullPath) + $Extension = [System.IO.Path]::GetExtension($FullPath) + + # Those below are potential symbol files that the `dotnet symbol` might + # return. Which one will be returned depend on the type of file we are + # checking and which type of file was uploaded. + + # The file itself is returned + $SymbolPath = $SymbolsPath + '\' + $FileName + + # PDB file for the module + $PdbPath = $SymbolPath.Replace($Extension, '.pdb') + + # PDB file for R2R module (created by crossgen) + $NGenPdb = $SymbolPath.Replace($Extension, '.ni.pdb') + + # DBG file for a .so library + $SODbg = $SymbolPath.Replace($Extension, '.so.dbg') + + # DWARF file for a .dylib + $DylibDwarf = $SymbolPath.Replace($Extension, '.dylib.dwarf') + + $dotnetSymbolExe = "$env:USERPROFILE\.dotnet\tools" + $dotnetSymbolExe = Resolve-Path "$dotnetSymbolExe\dotnet-symbol.exe" + + & $dotnetSymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null - Write-Host -NoNewLine "`t Checking file " $_.FullName "... " + if (Test-Path $PdbPath) { + return 'PDB' + } + elseif (Test-Path $NGenPdb) { + return 'NGen PDB' + } + elseif (Test-Path $SODbg) { + return 'DBG for SO' + } + elseif (Test-Path $DylibDwarf) { + return 'Dwarf for Dylib' + } + elseif (Test-Path $SymbolPath) { + return 'Module' + } + else { + return $null + } + } + + $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault $FileName '--microsoft-symbol-server' $SymbolsPath + $SymbolsOnSymWeb = & $FirstMatchingSymbolDescriptionOrDefault $FileName '--internal-server' $SymbolsPath + + Write-Host -NoNewLine "`t Checking file " $FileName "... " if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { Write-Host "Symbols found on MSDL ($SymbolsOnMSDL) and SymWeb ($SymbolsOnSymWeb)" @@ -115,6 +135,15 @@ function CountMissingSymbols { } } + if ($using:Clean) { + Remove-Item $ExtractPath -Recurse -Force + } + + if ($MissingSymbols -ne 0) + { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $MissingSymbols modules in the package $FileName" + } + Pop-Location return $MissingSymbols @@ -125,9 +154,12 @@ function CheckSymbolsAvailable { Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue } + $TotalFailures = 0 + Get-ChildItem "$InputPath\*.nupkg" | ForEach-Object { $FileName = $_.Name + $FullName = $_.FullName # These packages from Arcade-Services include some native libraries that # our current symbol uploader can't handle. Below is a workaround until @@ -144,15 +176,39 @@ function CheckSymbolsAvailable { } Write-Host "Validating $FileName " - $Status = CountMissingSymbols "$InputPath\$FileName" - if ($Status -ne 0) { - Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $Status modules in the package $FileName" - ExitWithExitCode $exitCode + Start-Job -ScriptBlock $CountMissingSymbols -ArgumentList $FullName | Out-Null + + $NumJobs = @(Get-Job -State 'Running').Count + Write-Host $NumJobs + + while ($NumJobs -ge $MaxParallelJobs) { + Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." + sleep $SecondsBetweenLoadChecks + $NumJobs = @(Get-Job -State 'Running').Count } + foreach ($Job in @(Get-Job -State 'Completed')) { + Receive-Job -Id $Job.Id + } Write-Host } + + foreach ($Job in @(Get-Job)) { + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + + if ($jobResult -ne '0') { + $TotalFailures++ + } + } + + if ($TotalFailures -gt 0) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Symbols missing for $TotalFailures packages" + ExitWithExitCode 1 + } + else { + Write-Host "All symbols validated!" + } } function InstallDotnetSymbol { @@ -174,11 +230,13 @@ function InstallDotnetSymbol { try { . $PSScriptRoot\post-build-utils.ps1 - - Add-Type -AssemblyName System.IO.Compression.FileSystem InstallDotnetSymbol + foreach ($Job in @(Get-Job)) { + Remove-Job -Id $Job.Id + } + CheckSymbolsAvailable } catch { diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index 3872af59b972..f997be4331d2 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -57,6 +57,19 @@ try { ExitWithExitCode 1 } + if( $msbuildEngine -eq "vs") { + # Ensure desktop MSBuild is available for sdk tasks. + if( -not ($GlobalJson.tools.PSObject.Properties.Name -contains "vs" )) { + $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty + } + if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { + $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "16.5.0-alpha" -MemberType NoteProperty + } + + $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true + $global:_MSBuildExe = "$($xcopyMSBuildToolsFolder)\MSBuild\Current\Bin\MSBuild.exe" + } + $taskProject = GetSdkTaskProject $task if (!(Test-Path $taskProject)) { Write-PipelineTelemetryError -Category 'Build' -Message "Unknown task: $task" -ForegroundColor Red diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index b7f61f9a2f1c..b681d797cdae 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -24,7 +24,8 @@ Param( [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. [string] $GuardianLoggerLevel='Standard', # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error [string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1") - [string[]] $PoliCheckAdditionalRunConfigParams # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1") + [string[]] $PoliCheckAdditionalRunConfigParams, # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1") + [bool] $BreakOnFailure=$False # Optional: Fail the build if there were errors during the run ) try { @@ -106,6 +107,11 @@ try { ExitWithExitCode 1 } } + + if ($BreakOnFailure) { + Write-Host "Failing the build in case of breaking results..." + & $guardianCliLocation break + } } catch { Write-Host $_.ScriptStackTrace diff --git a/eng/common/sdl/extract-artifact-packages.ps1 b/eng/common/sdl/extract-artifact-packages.ps1 index 9e5f3cb43c7e..7f28d9c59ec6 100644 --- a/eng/common/sdl/extract-artifact-packages.ps1 +++ b/eng/common/sdl/extract-artifact-packages.ps1 @@ -63,7 +63,7 @@ try { } } catch { - Write-Host $_.ScriptStackTrace + Write-Host $_ Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ ExitWithExitCode 1 } @@ -74,7 +74,7 @@ try { Measure-Command { ExtractArtifacts } } catch { - Write-Host $_.ScriptStackTrace + Write-Host $_ Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ ExitWithExitCode 1 } diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 index 1a91bbbc5a9a..a68bf0b88ea6 100644 --- a/eng/common/sdl/init-sdl.ps1 +++ b/eng/common/sdl/init-sdl.ps1 @@ -24,7 +24,7 @@ $ProgressPreference = 'SilentlyContinue' # Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file $encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$AzureDevOpsAccessToken")) $escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") -$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0-preview.1" +$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0" $zipFile = "$WorkingDirectory/gdn.zip" Add-Type -AssemblyName System.IO.Compression.FileSystem diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config index 256ffbfb93a3..968b39bef5f1 100644 --- a/eng/common/sdl/packages.config +++ b/eng/common/sdl/packages.config @@ -1,4 +1,4 @@ - + diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 640f2b04e240..c64c4f5686cb 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -6,6 +6,7 @@ parameters: # 'continueOnError', the parameter value is not correctly picked up. # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter sdlContinueOnError: false # optional: determines whether to continue the build if the step errors; + downloadArtifacts: true # optional: determines if the artifacts should be dowloaded dependsOn: '' # Optional: dependencies of the job artifactNames: '' # Optional: patterns supplied to DownloadBuildArtifacts # Usage: @@ -31,8 +32,20 @@ jobs: steps: - checkout: self clean: true - - ${{ if ne(parameters.artifactNames, '') }}: - - ${{ each artifactName in parameters.artifactNames }}: + - ${{ if ne(parameters.downloadArtifacts, 'false')}}: + - ${{ if ne(parameters.artifactNames, '') }}: + - ${{ each artifactName in parameters.artifactNames }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Build Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: ${{ artifactName }} + downloadPath: $(Build.ArtifactStagingDirectory)\artifacts + - ${{ if eq(parameters.artifactNames, '') }}: - task: DownloadBuildArtifacts@0 displayName: Download Build Artifacts inputs: @@ -41,20 +54,9 @@ jobs: project: $(AzDOProjectName) pipeline: $(AzDOPipelineId) buildId: $(AzDOBuildId) - artifactName: ${{ artifactName }} + downloadType: specific files + itemPattern: "**" downloadPath: $(Build.ArtifactStagingDirectory)\artifacts - - ${{ if eq(parameters.artifactNames, '') }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Build Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - downloadType: specific files - itemPattern: "**" - downloadPath: $(Build.ArtifactStagingDirectory)\artifacts - powershell: eng/common/sdl/extract-artifact-packages.ps1 -InputPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts @@ -81,7 +83,7 @@ jobs: continueOnError: ${{ parameters.sdlContinueOnError }} - ${{ if eq(parameters.overrideParameters, '') }}: - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 - -GuardianPackageName Microsoft.Guardian.Cli.0.7.2 + -GuardianPackageName Microsoft.Guardian.Cli.win10-x64.0.20.1 -NugetPackageDirectory $(Build.SourcesDirectory)\.packages -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) ${{ parameters.additionalParameters }} diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 536c15c4641c..c08bb416d562 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -24,8 +24,9 @@ parameters: enablePublishBuildAssets: false enablePublishTestResults: false enablePublishUsingPipelines: false + useBuildManifest: false mergeTestResults: false - testRunTitle: $(AgentOsName)-$(BuildConfiguration)-xunit + testRunTitle: '' name: '' preSteps: [] runAsPublic: false @@ -196,7 +197,7 @@ jobs: testResultsFormat: 'xUnit' testResultsFiles: '*.xml' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' - testRunTitle: ${{ parameters.testRunTitle }} + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-xunit mergeTestResults: ${{ parameters.mergeTestResults }} continueOnError: true condition: always() @@ -218,3 +219,12 @@ jobs: ArtifactName: AssetManifests continueOnError: ${{ parameters.continueOnError }} condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - ${{ if eq(parameters.useBuildManifest, true) }}: + - task: PublishBuildArtifacts@1 + displayName: Publish Build Manifest + inputs: + PathToPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/manifest.props' + PublishLocation: Container + ArtifactName: BuildManifests + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates/post-build/channels/generic-internal-channel.yml b/eng/common/templates/post-build/channels/generic-internal-channel.yml index dde27800c3f2..258ba4b7706d 100644 --- a/eng/common/templates/post-build/channels/generic-internal-channel.yml +++ b/eng/common/templates/post-build/channels/generic-internal-channel.yml @@ -23,7 +23,7 @@ stages: - job: publish_symbols displayName: Symbol Publishing dependsOn: setupMaestroVars - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }})) + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} )) variables: - group: DotNet-Symbol-Server-Pats - name: AzDOProjectName @@ -96,7 +96,7 @@ stages: value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - name: AzDOBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }})) + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} )) pool: vmImage: 'windows-2019' steps: diff --git a/eng/common/templates/post-build/channels/generic-public-channel.yml b/eng/common/templates/post-build/channels/generic-public-channel.yml index 08853ec45e0c..bf98d990e88e 100644 --- a/eng/common/templates/post-build/channels/generic-public-channel.yml +++ b/eng/common/templates/post-build/channels/generic-public-channel.yml @@ -25,7 +25,7 @@ stages: - job: publish_symbols displayName: Symbol Publishing dependsOn: setupMaestroVars - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }})) + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} )) variables: - group: DotNet-Symbol-Server-Pats - name: AzDOProjectName @@ -99,7 +99,7 @@ stages: value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - name: ArtifactsCategory value: ${{ coalesce(variables._DotNetArtifactsCategory, '.NETCore') }} - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} )), eq(dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'], ${{ parameters.channelId }})) + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} )) pool: vmImage: 'windows-2019' steps: diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 867f37cd8758..c99fd7503767 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -63,7 +63,7 @@ variables: - name: MaestroApiAccessToken value: $(MaestroAccessToken) - name: MaestroApiVersion - value: "2019-01-16" + value: "2020-02-20" - name: SourceLinkCLIVersion value: 3.0.0 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index fbab4cb5dce0..75890b373cef 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -1,4 +1,13 @@ parameters: + # When set to true the publishing templates from the repo will be used + # otherwise Darc add-build-to-channel will be used to trigger the promotion pipeline + inline: true + + # Only used if inline==false. When set to true will stall the current build until + # the Promotion Pipeline build finishes. Otherwise, the current build continue + # execution concurrently with the promotion build. + waitPublishingFinish: true + enableSourceLinkValidation: false enableSigningValidation: true enableSymbolValidation: false @@ -9,12 +18,14 @@ parameters: continueOnError: false params: '' artifactNames: '' + downloadArtifacts: true # These parameters let the user customize the call to sdk-task.ps1 for publishing # symbols & general artifacts as well as for signing validation symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' signingValidationAdditionalParameters: '' + useBuildManifest: false # Which stages should finish execution before post-build stages start validateDependsOn: @@ -35,348 +46,436 @@ parameters: NETCoreExperimentalChannelId: 562 NetEngServicesIntChannelId: 678 NetEngServicesProdChannelId: 679 - Net5Preview2ChannelId: 738 - Net5Preview3ChannelId: 739 + Net5Preview5ChannelId: 857 + Net5Preview6ChannelId: 1013 + Net5Preview7ChannelId: 1014 NetCoreSDK313xxChannelId: 759 NetCoreSDK313xxInternalChannelId: 760 + NetCoreSDK314xxChannelId: 921 + NetCoreSDK314xxInternalChannelId: 922 stages: -- stage: Validate - dependsOn: ${{ parameters.validateDependsOn }} - displayName: Validate - variables: - - template: common-variables.yml - jobs: - - template: setup-maestro-vars.yml - - - job: - displayName: Post-build Checks - dependsOn: setupMaestroVars - variables: - - name: InitialChannels - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'] ] - - name: PromoteToMaestroChannelId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.PromoteToMaestroChannelId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Maestro Channels Consistency - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 - arguments: -PromoteToChannels "$(InitialChannels)[$(PromoteToMaestroChannelId)]" - -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview2ChannelId}},${{parameters.Net5Preview3ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}} - - - job: - displayName: NuGet Validation - dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableNugetValidation }}, 'true') - pool: - vmImage: 'windows-2019' - variables: - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 - arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ - -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ - - - job: - displayName: Signing Validation - dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableSigningValidation }}, 'true') +- ${{ if ne(parameters.inline, 'true') }}: + - stage: publish_using_darc + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Publish using Darc variables: - template: common-variables.yml - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - - # This is necessary whenever we want to publish/restore to an AzDO private feed - # Since sdk-task.ps1 tries to restore packages we need to do this authentication here - # otherwise it'll complain about accessing a private feed. - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task SigningValidation -restore -msbuildEngine dotnet - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' - /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' - ${{ parameters.signingValidationAdditionalParameters }} - - - template: ../steps/publish-logs.yml - parameters: - StageLabel: 'Validation' - JobLabel: 'Signing' - - - job: - displayName: SourceLink Validation - dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') + jobs: + - template: setup-maestro-vars.yml + + - job: + displayName: Publish Using Darc + dependsOn: setupMaestroVars + variables: + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Publish Using Darc + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: -BuildId $(BARBuildId) + -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -MaestroToken '$(MaestroApiAccessToken)' + -WaitPublishingFinish ${{ parameters.waitPublishingFinish }} + -EnableSourceLinkValidation ${{ parameters.enableSourceLinkValidation }} + -EnableSigningValidation ${{ parameters.enableSourceLinkValidation }} + -EnableNugetValidation ${{ parameters.enableSourceLinkValidation }} + -PublishInstallersAndChecksums ${{ parameters.publishInstallersAndChecksums }} + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SigningValidationAdditionalParameters '${{ parameters.signingValidationAdditionalParameters }}' + +- ${{ if eq(parameters.inline, 'true') }}: + - stage: Validate + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Validate Build Assets variables: - template: common-variables.yml - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: BlobArtifacts - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -ExtractPath $(Agent.BuildDirectory)/Extract/ - -GHRepoName $(Build.Repository.Name) - -GHCommit $(Build.SourceVersion) - -SourcelinkCliVersion $(SourceLinkCLIVersion) - continueOnError: true - - - template: /eng/common/templates/job/execute-sdl.yml - parameters: - enable: ${{ parameters.SDLValidationParameters.enable }} + jobs: + - template: setup-maestro-vars.yml + + - job: + displayName: Post-build Checks + dependsOn: setupMaestroVars + variables: + - name: TargetChannels + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'] ] + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Maestro Channels Consistency + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 + arguments: -PromoteToChannels "$(TargetChannels)" + -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview5ChannelId}},${{parameters.Net5Preview6ChannelId}},${{parameters.Net5Preview7ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}} + + - job: + displayName: NuGet Validation + dependsOn: setupMaestroVars + condition: eq( ${{ parameters.enableNugetValidation }}, 'true') + pool: + vmImage: 'windows-2019' + variables: + - name: AzDOProjectName + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] + - name: AzDOPipelineId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] + - name: AzDOBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ + + - job: + displayName: Signing Validation dependsOn: setupMaestroVars - additionalParameters: ${{ parameters.SDLValidationParameters.params }} - continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} - artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }} - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NetCore_Dev5_Publish' - channelName: '.NET 5 Dev' - akaMSChannelName: 'net5/dev' - channelId: ${{ parameters.NetDev5ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_Preview2_Publish' - channelName: '.NET 5 Preview 2' - akaMSChannelName: 'net5/preview2' - channelId: ${{ parameters.Net5Preview2ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_Preview3_Publish' - channelName: '.NET 5 Preview 3' - akaMSChannelName: 'net5/preview3' - channelId: ${{ parameters.Net5Preview3ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net_Eng_Latest_Publish' - channelName: '.NET Eng - Latest' - akaMSChannelName: 'eng/daily' - channelId: ${{ parameters.NetEngLatestChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net_Eng_Validation_Publish' - channelName: '.NET Eng - Validation' - akaMSChannelName: 'eng/validation' - channelId: ${{ parameters.NetEngValidationChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'General_Testing_Publish' - channelName: 'General Testing' - akaMSChannelName: 'generaltesting' - channelId: ${{ parameters.GeneralTestingChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_Tooling_Dev_Publishing' - channelName: '.NET Core Tooling Dev' - channelId: ${{ parameters.NETCoreToolingDevChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_Tooling_Release_Publishing' - channelName: '.NET Core Tooling Release' - channelId: ${{ parameters.NETCoreToolingReleaseChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-internal-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NET_Internal_Tooling_Publishing' - channelName: '.NET Internal Tooling' - channelId: ${{ parameters.NETInternalToolingChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_Experimental_Publishing' - channelName: '.NET Core Experimental' - channelId: ${{ parameters.NETCoreExperimentalChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net_Eng_Services_Int_Publish' - channelName: '.NET Eng Services - Int' - channelId: ${{ parameters.NetEngServicesIntChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net_Eng_Services_Prod_Publish' - channelName: '.NET Eng Services - Prod' - channelId: ${{ parameters.NetEngServicesProdChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_SDK_313xx_Publishing' - channelName: '.NET Core SDK 3.1.3xx' - channelId: ${{ parameters.NetCoreSDK313xxChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json' - -- template: \eng\common\templates\post-build\channels\generic-internal-channel.yml - parameters: - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'NETCore_SDK_313xx_Internal_Publishing' - channelName: '.NET Core SDK 3.1.3xx Internal' - channelId: ${{ parameters.NetCoreSDK313xxInternalChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-symbols/nuget/v3/index.json' + condition: eq( ${{ parameters.enableSigningValidation }}, 'true') + variables: + - template: common-variables.yml + - name: AzDOProjectName + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] + - name: AzDOPipelineId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] + - name: AzDOBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] + pool: + vmImage: 'windows-2019' + steps: + - ${{ if eq(parameters.useBuildManifest, true) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download build manifest + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BuildManifests + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + + # Signing validation will optionally work with the buildmanifest file which is downloaded from + # Azure DevOps above. + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task SigningValidation -restore -msbuildEngine vs + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' + /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' + ${{ parameters.signingValidationAdditionalParameters }} + + - template: ../steps/publish-logs.yml + parameters: + StageLabel: 'Validation' + JobLabel: 'Signing' + + - job: + displayName: SourceLink Validation + dependsOn: setupMaestroVars + condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') + variables: + - template: common-variables.yml + - name: AzDOProjectName + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] + - name: AzDOPipelineId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] + - name: AzDOBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BlobArtifacts + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) + -GHCommit $(Build.SourceVersion) + -SourcelinkCliVersion $(SourceLinkCLIVersion) + continueOnError: true + + - template: /eng/common/templates/job/execute-sdl.yml + parameters: + enable: ${{ parameters.SDLValidationParameters.enable }} + dependsOn: setupMaestroVars + additionalParameters: ${{ parameters.SDLValidationParameters.params }} + continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} + artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }} + downloadArtifacts: ${{ parameters.SDLValidationParameters.downloadArtifacts }} + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NetCore_Dev5_Publish' + channelName: '.NET 5 Dev' + akaMSChannelName: 'net5/dev' + channelId: ${{ parameters.NetDev5ChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'Net5_Preview5_Publish' + channelName: '.NET 5 Preview 5' + akaMSChannelName: 'net5/preview5' + channelId: ${{ parameters.Net5Preview5ChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'Net5_Preview6_Publish' + channelName: '.NET 5 Preview 6' + akaMSChannelName: 'net5/preview6' + channelId: ${{ parameters.Net5Preview6ChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'Net5_Preview7_Publish' + channelName: '.NET 5 Preview 7' + akaMSChannelName: 'net5/preview7' + channelId: ${{ parameters.Net5Preview7ChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'Net_Eng_Latest_Publish' + channelName: '.NET Eng - Latest' + akaMSChannelName: 'eng/daily' + channelId: ${{ parameters.NetEngLatestChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'Net_Eng_Validation_Publish' + channelName: '.NET Eng - Validation' + akaMSChannelName: 'eng/validation' + channelId: ${{ parameters.NetEngValidationChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'General_Testing_Publish' + channelName: 'General Testing' + akaMSChannelName: 'generaltesting' + channelId: ${{ parameters.GeneralTestingChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NETCore_Tooling_Dev_Publishing' + channelName: '.NET Core Tooling Dev' + channelId: ${{ parameters.NETCoreToolingDevChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NETCore_Tooling_Release_Publishing' + channelName: '.NET Core Tooling Release' + channelId: ${{ parameters.NETCoreToolingReleaseChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-internal-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NET_Internal_Tooling_Publishing' + channelName: '.NET Internal Tooling' + channelId: ${{ parameters.NETInternalToolingChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NETCore_Experimental_Publishing' + channelName: '.NET Core Experimental' + channelId: ${{ parameters.NETCoreExperimentalChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'Net_Eng_Services_Int_Publish' + channelName: '.NET Eng Services - Int' + channelId: ${{ parameters.NetEngServicesIntChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'Net_Eng_Services_Prod_Publish' + channelName: '.NET Eng Services - Prod' + channelId: ${{ parameters.NetEngServicesProdChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NETCore_SDK_314xx_Publishing' + channelName: '.NET Core SDK 3.1.4xx' + channelId: ${{ parameters.NetCoreSDK314xxChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-internal-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NETCore_SDK_314xx_Internal_Publishing' + channelName: '.NET Core SDK 3.1.4xx Internal' + channelId: ${{ parameters.NetCoreSDK314xxInternalChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NETCore_SDK_313xx_Publishing' + channelName: '.NET Core SDK 3.1.3xx' + channelId: ${{ parameters.NetCoreSDK313xxChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-internal-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'NETCore_SDK_313xx_Internal_Publishing' + channelName: '.NET Core SDK 3.1.3xx Internal' + channelId: ${{ parameters.NetCoreSDK313xxInternalChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-symbols/nuget/v3/index.json' diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 05e611edb68a..b3d29d4498e3 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -5,7 +5,9 @@ jobs: - template: common-variables.yml - name: BuildId value: $[ coalesce(variables.BARBuildId, 0) ] - - name: PromoteToChannelId + - name: PromoteToMaestroChannels + value: $[ coalesce(variables.PromoteToChannelIds, 0) ] + - name: PromoteToMaestroChannel value: $[ coalesce(variables.PromoteToMaestroChannelId, 0) ] pool: vmImage: 'windows-2019' @@ -14,7 +16,7 @@ jobs: - task: DownloadBuildArtifacts@0 displayName: Download Release Configs - condition: eq(variables.PromoteToChannelId, 0) + condition: and(eq(variables.PromoteToMaestroChannels, 0), eq(variables.PromoteToMaestroChannel, 0)) inputs: buildType: current artifactName: ReleaseConfigs @@ -26,20 +28,16 @@ jobs: targetType: inline script: | try { - if ($Env:PromoteToChannelId -eq 0) { + if ($Env:PromoteToMaestroChannels -eq 0 -and $Env:PromoteToMaestroChannel -eq 0) { $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt $BarId = $Content | Select -Index 0 - - $Channels = "" - $Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," } - + $Channels = $Content | Select -Index 1 $IsStableBuild = $Content | Select -Index 2 $AzureDevOpsProject = $Env:System_TeamProject $AzureDevOpsBuildDefinitionId = $Env:System_DefinitionId $AzureDevOpsBuildId = $Env:Build_BuildId - $PromoteToMaestroChannelId = 0 } else { $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" @@ -51,25 +49,23 @@ jobs: $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } $BarId = $Env:BARBuildId - $Channels = 'None' - - #TODO: Fix this once this issue is done: https://github.com/dotnet/arcade/issues/3834 - $IsStableBuild = 'False' + $Channels = $Env:PromoteToMaestroChannels -split "," + $Channels = $Channels -join "][" + $Channels = "[$Channels][$Env:PromoteToMaestroChannel]" + $IsStableBuild = $buildInfo.stable $AzureDevOpsProject = $buildInfo.azureDevOpsProject $AzureDevOpsBuildDefinitionId = $buildInfo.azureDevOpsBuildDefinitionId $AzureDevOpsBuildId = $buildInfo.azureDevOpsBuildId - $PromoteToMaestroChannelId = $Env:PromoteToMaestroChannelId } Write-Host "##vso[task.setvariable variable=BARBuildId;isOutput=true]$BarId" - Write-Host "##vso[task.setvariable variable=InitialChannels;isOutput=true]$Channels" + Write-Host "##vso[task.setvariable variable=TargetChannels;isOutput=true]$Channels" Write-Host "##vso[task.setvariable variable=IsStableBuild;isOutput=true]$IsStableBuild" Write-Host "##vso[task.setvariable variable=AzDOProjectName;isOutput=true]$AzureDevOpsProject" Write-Host "##vso[task.setvariable variable=AzDOPipelineId;isOutput=true]$AzureDevOpsBuildDefinitionId" Write-Host "##vso[task.setvariable variable=AzDOBuildId;isOutput=true]$AzureDevOpsBuildId" - Write-Host "##vso[task.setvariable variable=PromoteToMaestroChannelId;isOutput=true]$PromoteToMaestroChannelId" } catch { Write-Host $_ diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 30becf01ea55..5eceb48725dc 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -10,7 +10,7 @@ parameters: HelixPostCommands: '' # optional -- commands to run after Helix work item execution WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects - WorkItemTimeout: '' # optional -- a timeout in seconds for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects + WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects @@ -18,8 +18,8 @@ parameters: XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion - DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json - DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 60c1cd897587..9f6e75f7e226 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -7,9 +7,11 @@ # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. [string]$configuration = if (Test-Path variable:configuration) { $configuration } else { 'Debug' } +# Set to true to opt out of outputting binary log while running in CI +[bool]$excludeCIBinarylog = if (Test-Path variable:excludeCIBinarylog) { $excludeCIBinarylog } else { $false } + # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -# Binary log must be enabled on CI. -[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci } +[bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$excludeCIBinarylog } # Set to true to use the pipelines logger which will enable Azure logging output. # https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md @@ -55,10 +57,8 @@ set-strictmode -version 2.0 $ErrorActionPreference = 'Stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -function Create-Directory([string[]] $path) { - if (!(Test-Path $path)) { - New-Item -path $path -force -itemType 'Directory' | Out-Null - } +function Create-Directory ([string[]] $path) { + New-Item -Path $path -Force -ItemType 'Directory' | Out-Null } function Unzip([string]$zipfile, [string]$outpath) { @@ -124,7 +124,9 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { # Find the first path on %PATH% that contains the dotnet.exe if ($useInstalledDotNetCli -and (-not $globalJsonHasRuntimes) -and ($env:DOTNET_INSTALL_DIR -eq $null)) { - $dotnetCmd = Get-Command 'dotnet.exe' -ErrorAction SilentlyContinue + $dotnetExecutable = GetExecutableFileName 'dotnet' + $dotnetCmd = Get-Command $dotnetExecutable -ErrorAction SilentlyContinue + if ($dotnetCmd -ne $null) { $env:DOTNET_INSTALL_DIR = Split-Path $dotnetCmd.Path -Parent } @@ -283,6 +285,10 @@ function InstallDotNet([string] $dotnetRoot, # Throws on failure. # function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $null) { + if (-not (IsWindowsPlatform)) { + throw "Cannot initialize Visual Studio on non-Windows" + } + if (Test-Path variable:global:_MSBuildExe) { return $global:_MSBuildExe } @@ -387,6 +393,10 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { # or $null if no instance meeting the requirements is found on the machine. # function LocateVisualStudio([object]$vsRequirements = $null){ + if (-not (IsWindowsPlatform)) { + throw "Cannot run vswhere on non-Windows platforms." + } + if (Get-Member -InputObject $GlobalJson.tools -Name 'vswhere') { $vswhereVersion = $GlobalJson.tools.vswhere } else { @@ -452,7 +462,8 @@ function InitializeBuildTool() { Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "/global.json must specify 'tools.dotnet'." ExitWithExitCode 1 } - $buildTool = @{ Path = Join-Path $dotnetRoot 'dotnet.exe'; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp2.1' } + $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') + $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp2.1' } } elseif ($msbuildEngine -eq "vs") { try { $msbuildPath = InitializeVisualStudioMSBuild -install:$restore @@ -488,10 +499,11 @@ function GetNuGetPackageCachePath() { if ($env:NUGET_PACKAGES -eq $null) { # Use local cache on CI to ensure deterministic build, # use global cache in dev builds to avoid cost of downloading packages. + # For directory normalization, see also: https://github.com/NuGet/Home/issues/7968 if ($useGlobalNuGetCache) { - $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages' + $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\' } else { - $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages' + $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\' } } @@ -546,7 +558,7 @@ function InitializeToolset() { MSBuild-Core $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile - $path = Get-Content $toolsetLocationFile -TotalCount 1 + $path = Get-Content $toolsetLocationFile -Encoding UTF8 -TotalCount 1 if (!(Test-Path $path)) { throw "Invalid toolset path: $path" } @@ -604,8 +616,8 @@ function MSBuild() { # function MSBuild-Core() { if ($ci) { - if (!$binaryLog) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build.' + if (!$binaryLog -and !$excludeCIBinarylog) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -excludeCIBinarylog switch.' ExitWithExitCode 1 } @@ -632,6 +644,8 @@ function MSBuild-Core() { } } + $env:ARCADE_BUILD_TOOL_COMMAND = "$($buildTool.Path) $cmdArgs" + $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { @@ -663,6 +677,19 @@ function GetMSBuildBinaryLogCommandLineArgument($arguments) { return $null } +function GetExecutableFileName($baseName) { + if (IsWindowsPlatform) { + return "$baseName.exe" + } + else { + return $baseName + } +} + +function IsWindowsPlatform() { + return [environment]::OSVersion.Platform -eq [PlatformID]::Win32NT +} + . $PSScriptRoot\pipeline-logging-functions.ps1 $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..') diff --git a/eng/common/tools.sh b/eng/common/tools.sh index caae1dbdb273..e94fce22ec37 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -18,9 +18,17 @@ fi # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. configuration=${configuration:-'Debug'} +# Set to true to opt out of outputting binary log while running in CI +exclude_ci_binary_log=${exclude_ci_binary_log:-false} + +if [[ "$ci" == true && "$exclude_ci_binary_log" == false ]]; then + binary_log_default=true +else + binary_log_default=false +fi + # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. -# Binary log must be enabled on CI. -binary_log=${binary_log:-$ci} +binary_log=${binary_log:-$binary_log_default} # Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). prepare_machine=${prepare_machine:-false} @@ -201,7 +209,14 @@ function InstallDotNet { local runtimeSourceFeedKey='' if [[ -n "${7:-}" ]]; then - decodedFeedKey=`echo $7 | base64 --decode` + # The 'base64' binary on alpine uses '-d' and doesn't support '--decode' + # '-d'. To work around this, do a simple detection and switch the parameter + # accordingly. + decodeArg="--decode" + if base64 --help 2>&1 | grep -q "BusyBox"; then + decodeArg="-d" + fi + decodedFeedKey=`echo $7 | base64 $decodeArg` runtimeSourceFeedKey="--feed-credential $decodedFeedKey" fi @@ -397,8 +412,8 @@ function MSBuild { function MSBuild-Core { if [[ "$ci" == true ]]; then - if [[ "$binary_log" != true ]]; then - Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build." + if [[ "$binary_log" != true && "$exclude_ci_binary_log" != true ]]; then + Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build, or explicitly opted-out from with the -noBinaryLog switch." ExitWithExitCode 1 fi @@ -415,11 +430,17 @@ function MSBuild-Core { warnaserror_switch="/warnaserror" fi - "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" || { - local exit_code=$? - Write-PipelineTelemetryError -category 'Build' "Build failed (exit code '$exit_code')." - ExitWithExitCode $exit_code + function RunBuildTool { + export ARCADE_BUILD_TOOL_COMMAND="$_InitializeBuildTool $@" + + "$_InitializeBuildTool" "$@" || { + local exit_code=$? + Write-PipelineTaskError "Build failed (exit code '$exit_code')." + ExitWithExitCode $exit_code + } } + + RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } ResolvePath "${BASH_SOURCE[0]}" diff --git a/global.json b/global.json index 57a28d4c9b41..c58886cfd886 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,8 @@ { "tools": { - "dotnet": "3.1.101" + "dotnet": "5.0.100-preview.6.20266.3" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20201.2" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20278.4" } } diff --git a/tests/runtimeconfig.template.json b/tests/runtimeconfig.template.json new file mode 100644 index 000000000000..f022b7ffce12 --- /dev/null +++ b/tests/runtimeconfig.template.json @@ -0,0 +1,3 @@ +{ + "rollForwardOnNoCandidateFx": 2 +} \ No newline at end of file From 7a5df81d357992e66bf88b6dd664d70569bd7f21 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sat, 30 May 2020 10:35:04 -0700 Subject: [PATCH 1019/2702] Always run on the latest Runtime --- src/dotnet-format.csproj | 3 +++ src/runtimeconfig.template.json | 3 --- tests/runtimeconfig.template.json | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 src/runtimeconfig.template.json delete mode 100644 tests/runtimeconfig.template.json diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index ef450fb7e1dc..1d64022071be 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -12,6 +12,9 @@ Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings. + + LatestMajor + true true packageicon.png diff --git a/src/runtimeconfig.template.json b/src/runtimeconfig.template.json deleted file mode 100644 index f022b7ffce12..000000000000 --- a/src/runtimeconfig.template.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "rollForwardOnNoCandidateFx": 2 -} \ No newline at end of file diff --git a/tests/runtimeconfig.template.json b/tests/runtimeconfig.template.json deleted file mode 100644 index f022b7ffce12..000000000000 --- a/tests/runtimeconfig.template.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "rollForwardOnNoCandidateFx": 2 -} \ No newline at end of file From e07b6751a4fdfb4d80fc8b88614f1b9f708d382b Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sat, 30 May 2020 14:08:10 -0700 Subject: [PATCH 1020/2702] Add RollForward to test project --- tests/dotnet-format.UnitTests.csproj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index a20cdcfc0c5b..75cf04bc3cfe 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -1,10 +1,13 @@  - netcoreapp3.0 + netcoreapp2.1 8.0 false Microsoft.CodeAnalysis.Tools.Tests + + + LatestMajor From e6c1b57755c18ff4a34ee65c09d3349ca31f2f75 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 31 May 2020 14:41:33 -0700 Subject: [PATCH 1021/2702] Bump integration repo shas --- azure-pipelines-integration.yml | 40 ++++++++++++++++----------------- eng/format-verifier.ps1 | 3 ++- eng/restore-toolset.ps1 | 36 ----------------------------- 3 files changed, 22 insertions(+), 57 deletions(-) delete mode 100644 eng/restore-toolset.ps1 diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index 729e38006b58..4c25d3df5bf7 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -19,35 +19,35 @@ jobs: format: _repo: "https://github.com/dotnet/format" _repoName: "dotnet/format" - _sha: "4ff73616469a2aaa5ff07d11b7f6951eca83d76e" + _sha: "686fc1efbe07d0a2d47147e36677ffcb09a74edc" roslyn: _repo: "https://github.com/dotnet/roslyn" _repoName: "dotnet/roslyn" - _sha: "1bd191ea896b19e3b06a152f815f3a998e87049a" - cli: - _repo: "https://github.com/dotnet/cli" - _repoName: "dotnet/cli" - _sha: "45f1c5f7f3275ff483c804e7c90bf61731a83e97" + _sha: "686fc1efbe07d0a2d47147e36677ffcb09a74edc" + sdk: + _repo: "https://github.com/dotnet/sdk" + _repoName: "dotnet/sdk" + _sha: "d03f6695c294a7c0dd4d46a292e650b7a6f6b667" project-system: _repo: "https://github.com/dotnet/project-system" _repoName: "dotnet/project-system" - _sha: "fc3b12e47adaad6e4813dc600acf190156fecc24" + _sha: "e7baa11d85b75c1871e866c240ca4aa4240d7818" msbuild: _repo: "https://github.com/Microsoft/msbuild" _repoName: "Microsoft/msbuild" - _sha: "e92633a735b0e23e2cbf818d02ba89dd7a426f89" - Blazor: - _repo: "https://github.com/aspnet/Blazor" - _repoName: "aspnet/Blazor" - _sha: "7eeab316fa122b69a9bd777c93dcc78bc6a68905" - EntityFrameworkCore: - _repo: "https://github.com/aspnet/EntityFrameworkCore" - _repoName: "aspnet/EntityFrameworkCore" - _sha: "94f5bdf081f9a774f5d7f01bfa279bac26dab303" - EntityFramework6: - _repo: "https://github.com/aspnet/EntityFramework6" - _repoName: "aspnet/EntityFramework6" - _sha: "9099ad2f6e5936ecdf549f88394b5a59fa75c869" + _sha: "a936b97e30679dcea4d99c362efa6f732c9d3587" + blazor: + _repo: "https://github.com/aspnet/blazor" + _repoName: "aspnet/blazor" + _sha: "cc449601d638ffaab58ae9487f0fd010bb178a12" + efcore: + _repo: "https://github.com/dotnet/efcore" + _repoName: "dotnet/efcore" + _sha: "0afeb9279ca72d0a5aa6738adf902fe6a30ba5c4" + ef6: + _repo: "https://github.com/dotnet/ef6" + _repoName: "dotnet/ef6" + _sha: "603c30382a5aec6677b4d90043694ac412cbb426" timeoutInMinutes: 20 steps: - script: eng\integration-test.cmd -repo '$(_repo)' -sha '$(_sha)' -testPath '$(Build.SourcesDirectory)\temp' -stage 'prepare' diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index 1b76388f4b36..665c9492264e 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -67,7 +67,8 @@ try { if (($output -notmatch "(?m)Formatted \d+ of (\d+) files") -or ($Matches[1] -eq "0")) { Write-Output "$(Get-Date) - No files found for solution." - exit -1 + # The dotnet/sdk has a toolset solution with no files. + # exit -1 } } diff --git a/eng/restore-toolset.ps1 b/eng/restore-toolset.ps1 deleted file mode 100644 index f3935227144e..000000000000 --- a/eng/restore-toolset.ps1 +++ /dev/null @@ -1,36 +0,0 @@ -function InitializeCustomSDKToolset { - if (-not $restore) { - return - } - - # Turn off MSBuild Node re-use - $env:MSBUILDDISABLENODEREUSE=1 - - # Workaround for the sockets issue when restoring with many nuget feeds. - $env:DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 - - # Enable vs test console logging - $env:VSTEST_BUILD_TRACE=1 - $env:VSTEST_TRACE_BUILD=1 - - $env:DOTNET_CLI_TELEMETRY_PROFILE='$env:DOTNET_CLI_TELEMETRY_PROFILE;https://github.com/dotnet/format' - - $cli = InitializeDotnetCli -install:$true - InstallDotNetSharedFramework "2.1.15" - } - - function InstallDotNetSharedFramework([string]$version) { - $dotnetRoot = $env:DOTNET_INSTALL_DIR - $fxDir = Join-Path $dotnetRoot "shared\Microsoft.NETCore.App\$version" - - if (!(Test-Path $fxDir)) { - $installScript = GetDotNetInstallScript $dotnetRoot - & $installScript -Version $version -InstallDir $dotnetRoot -Runtime "dotnet" - - if($lastExitCode -ne 0) { - Write-Output "Failed to install Shared Framework $version. Ignoring failure as not all distros carrie all versions of the framework." - } - } - } - - InitializeCustomSDKToolset \ No newline at end of file From 33b340d71d673b0c324cb2b3dfef18522c4b1d76 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 31 May 2020 16:37:56 -0700 Subject: [PATCH 1022/2702] Add issue link to ImportsFormatter workaround --- src/Formatters/ImportsFormatter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/ImportsFormatter.cs index 5fbb8bae3776..5685990f0347 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/ImportsFormatter.cs @@ -37,6 +37,7 @@ internal override async Task FormatFileAsync( } // Because the Formatter does not abide the `end_of_line` option we have to fix up the ends of the organized lines. + // See https://github.com/dotnet/roslyn/issues/44136 var organizedSourceText = await organizedDocument.GetTextAsync(cancellationToken); return await _endOfLineFormatter.FormatFileAsync(organizedDocument, organizedSourceText, optionSet, analyzerConfigOptions, formatOptions, logger, cancellationToken); } From c50d846d89618921bc797e1abfb4dab94cbe40b4 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Jun 2020 11:47:42 -0700 Subject: [PATCH 1023/2702] Log warning when unable to organize imports --- src/Formatters/ImportsFormatter.cs | 24 +++++++++++++++++++++++- src/Resources.resx | 3 +++ src/xlf/Resources.cs.xlf | 5 +++++ src/xlf/Resources.de.xlf | 5 +++++ src/xlf/Resources.es.xlf | 5 +++++ src/xlf/Resources.fr.xlf | 5 +++++ src/xlf/Resources.it.xlf | 5 +++++ src/xlf/Resources.ja.xlf | 5 +++++ src/xlf/Resources.ko.xlf | 5 +++++ src/xlf/Resources.pl.xlf | 5 +++++ src/xlf/Resources.pt-BR.xlf | 5 +++++ src/xlf/Resources.ru.xlf | 5 +++++ src/xlf/Resources.tr.xlf | 5 +++++ src/xlf/Resources.zh-Hans.xlf | 5 +++++ src/xlf/Resources.zh-Hant.xlf | 5 +++++ 15 files changed, 91 insertions(+), 1 deletion(-) diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/ImportsFormatter.cs index 5685990f0347..80853d676dae 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/ImportsFormatter.cs @@ -8,6 +8,7 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.Logging; +using System.IO; namespace Microsoft.CodeAnalysis.Tools.Formatters { @@ -31,7 +32,9 @@ internal override async Task FormatFileAsync( try { var organizedDocument = await Formatter.OrganizeImportsAsync(document, cancellationToken); - if (organizedDocument == document) + + var isSameVersion = await IsSameDocumentAndVersionAsync(document, organizedDocument, cancellationToken).ConfigureAwait(false); + if (isSameVersion) { return sourceText; } @@ -45,9 +48,28 @@ internal override async Task FormatFileAsync( { // This case is normally not hit when running against a handwritten code file. // https://github.com/dotnet/roslyn/issues/44710#issuecomment-636253053 + logger.LogWarning(Resources.Unable_to_organize_imports_for_0_The_document_is_too_complex, Path.GetFileName(document.FilePath)); return sourceText; } } + + private static async Task IsSameDocumentAndVersionAsync(Document a, Document b, CancellationToken cancellationToken) + { + if (a == b) + { + return true; + } + + if (a.Id != b.Id) + { + return false; + } + + var aVersion = await a.GetTextVersionAsync(cancellationToken); + var bVersion = await b.GetTextVersionAsync(cancellationToken); + + return aVersion == bVersion; + } } } diff --git a/src/Resources.resx b/src/Resources.resx index b9b7c7c6bd83..10030bb251cf 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -255,4 +255,7 @@ Fix imports ordering. + + Unable to organize imports for '{0}'. The document is too complex. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index eb532b1dba1f..fd12d2314bb6 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 4e5dee9d6300..2cb6bb7d5d79 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 00ab98623628..6cbaa1c311a4 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 22a26f62360a..8d9c2a00580d 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 6638c7a1a5b2..cf61c244caaa 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 3b3c16c70fd5..405d22abc8cc 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 5b929defe926..98f50c3ddee4 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 5c4f4f7a6b7e..aacc7eefb4a8 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 5a22cef43602..183818d3f743 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 90f966fd3142..ace3266ff96c 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 46023d5d889d..498431ef1070 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 0528442a127d..ba6c74980a90 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 71ea26ba0e19..b64a7e176635 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -212,6 +212,11 @@ Unable to locate dotnet CLI. Ensure that it is on the PATH. + + Unable to organize imports for '{0}'. The document is too complex. + Unable to organize imports for '{0}'. The document is too complex. + + Using MSBuild.exe located in '{0}'. Using MSBuild.exe located in '{0}'. From 8a1328ceb3775cc7aaadafd34723923de1f5481f Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Jun 2020 11:47:56 -0700 Subject: [PATCH 1024/2702] Use Path.Combine when building paths --- tests/Formatters/AbstractFormatterTests.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 1a8711e59f62..e7db3bc934b4 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -53,13 +53,15 @@ static AbstractFormatterTest() protected virtual string DefaultTestProjectName => "TestProject"; - protected virtual string DefaultFolderPath => Path.DirectorySeparatorChar + DefaultTestProjectName + Path.DirectorySeparatorChar; + // This folder path needs to appear rooted when adding the AnalyzerConfigDocument. + // We achieve this by prepending a directory separator. + protected virtual string DefaultFolderPath => Path.DirectorySeparatorChar + DefaultTestProjectName; - protected virtual string DefaultTestProjectPath => DefaultFolderPath + DefaultTestProjectName + "." + DefaultFileExt + "proj"; + protected virtual string DefaultTestProjectPath => Path.Combine(DefaultFolderPath, $"{DefaultTestProjectName}.{DefaultFileExt}proj"); - protected virtual string DefaultEditorConfigPath => DefaultFolderPath + ".editorconfig"; + protected virtual string DefaultEditorConfigPath => Path.Combine(DefaultFolderPath + ".editorconfig"); - protected virtual string DefaultFilePath => DefaultFolderPath + DefaultFilePathPrefix + 0 + "." + DefaultFileExt; + protected virtual string DefaultFilePath => Path.Combine(DefaultFolderPath, $"{DefaultFilePathPrefix}0.{DefaultFileExt}"); protected abstract string DefaultFileExt { get; } From e67f41f460ca53633474c676d09089bd9ca32c2d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Jun 2020 11:52:44 -0700 Subject: [PATCH 1025/2702] Run format against format.sln --- src/Formatters/ImportsFormatter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/ImportsFormatter.cs index 80853d676dae..9558db947b07 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/ImportsFormatter.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.IO; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; @@ -8,7 +9,6 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.Extensions.Logging; -using System.IO; namespace Microsoft.CodeAnalysis.Tools.Formatters { From 36ca2c034cc3c156e5a42704df60c981a2d31699 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Jun 2020 13:40:13 -0700 Subject: [PATCH 1026/2702] Remove DocumentWithOptions and pass around DocumentIds --- src/CodeFormatter.cs | 20 ++++++-------- src/DocumentWithOptions.cs | 31 ---------------------- src/Formatters/DocumentFormatter.cs | 23 +++++++++++----- src/Formatters/ICodeFormatter.cs | 2 +- tests/Formatters/AbstractFormatterTests.cs | 18 +++---------- tests/Formatters/FormattedFilesTests.cs | 2 +- 6 files changed, 31 insertions(+), 65 deletions(-) delete mode 100644 src/DocumentWithOptions.cs diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 64832dec0a2d..6e5b4fe5d9c7 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -233,7 +233,7 @@ static void LogWorkspaceDiagnostics(ILogger logger, bool logWorkspaceWarnings, I private static async Task RunCodeFormattersAsync( Solution solution, - ImmutableArray formattableDocuments, + ImmutableArray formattableDocuments, FormatOptions options, ILogger logger, List formattedFiles, @@ -249,7 +249,7 @@ private static async Task RunCodeFormattersAsync( return formattedSolution; } - internal static async Task<(int, ImmutableArray)> DetermineFormattableFilesAsync( + internal static async Task<(int, ImmutableArray)> DetermineFormattableFilesAsync( Solution solution, string projectPath, Matcher fileMatcher, @@ -258,10 +258,10 @@ private static async Task RunCodeFormattersAsync( CancellationToken cancellationToken) { var totalFileCount = solution.Projects.Sum(project => project.DocumentIds.Count); - int projectFileCount = 0; + var projectFileCount = 0; - var documentsCoveredByEditorConfig = ImmutableArray.CreateBuilder(totalFileCount); - var documentsNotCoveredByEditorConfig = ImmutableArray.CreateBuilder(totalFileCount); + var documentsCoveredByEditorConfig = ImmutableArray.CreateBuilder(totalFileCount); + var documentsNotCoveredByEditorConfig = ImmutableArray.CreateBuilder(totalFileCount); var addedFilePaths = new HashSet(totalFileCount); @@ -317,19 +317,15 @@ await GeneratedCodeUtilities.IsGeneratedCodeAsync(syntaxTree, cancellationToken) continue; } - var analyzerConfigOptions = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree); - var optionSet = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); - - var formattableDocument = new DocumentWithOptions(document, optionSet, analyzerConfigOptions); - // Track files covered by an editorconfig separately from those not covered. + var analyzerConfigOptions = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree); if (analyzerConfigOptions is object) { - documentsCoveredByEditorConfig.Add(formattableDocument); + documentsCoveredByEditorConfig.Add(document.Id); } else { - documentsNotCoveredByEditorConfig.Add(formattableDocument); + documentsNotCoveredByEditorConfig.Add(document.Id); } } } diff --git a/src/DocumentWithOptions.cs b/src/DocumentWithOptions.cs deleted file mode 100644 index 1a9f195d7b50..000000000000 --- a/src/DocumentWithOptions.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.CodeAnalysis.Options; - -namespace Microsoft.CodeAnalysis.Tools -{ - internal struct DocumentWithOptions - { - public Document Document { get; } - public OptionSet OptionSet { get; } - public AnalyzerConfigOptions? AnalyzerConfigOptions { get; } - - public DocumentWithOptions(Document document, OptionSet optionSet, AnalyzerConfigOptions? analyzerConfigOptions) - { - Document = document; - OptionSet = optionSet; - AnalyzerConfigOptions = analyzerConfigOptions; - } - - public void Deconstruct( - out Document document, - out OptionSet optionSet, - out AnalyzerConfigOptions? analyzerConfigOptions) - { - document = Document; - optionSet = OptionSet; - analyzerConfigOptions = AnalyzerConfigOptions; - } - } -} diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index 6da703b846ea..ae32adbf4226 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -25,7 +25,7 @@ internal abstract class DocumentFormatter : ICodeFormatter /// public async Task FormatAsync( Solution solution, - ImmutableArray formattableDocuments, + ImmutableArray formattableDocuments, FormatOptions formatOptions, ILogger logger, List formattedFiles, @@ -52,21 +52,32 @@ internal abstract Task FormatFileAsync( /// private ImmutableArray<(Document, Task<(SourceText originalText, SourceText? formattedText)>)> FormatFiles( Solution solution, - ImmutableArray formattableDocuments, + ImmutableArray formattableDocuments, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { var formattedDocuments = ImmutableArray.CreateBuilder<(Document, Task<(SourceText originalText, SourceText? formattedText)>)>(formattableDocuments.Length); - foreach (var formattableDocument in formattableDocuments) + foreach (var documentId in formattableDocuments) { - var document = solution.GetDocument(formattableDocument.Document.Id); + var document = solution.GetDocument(documentId); if (document is null) continue; - var formatTask = Task.Run(async () - => await GetFormattedSourceTextAsync(document, formattableDocument.OptionSet, formattableDocument.AnalyzerConfigOptions, formatOptions, logger, cancellationToken).ConfigureAwait(false), cancellationToken); + var formatTask = Task.Run(async () => + { + var originalSourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); + + var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + if (syntaxTree is null) + return (originalSourceText, null); + + var analyzerConfigOptions = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree); + var optionSet = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); + + return await GetFormattedSourceTextAsync(document, optionSet, analyzerConfigOptions, formatOptions, logger, cancellationToken).ConfigureAwait(false); + }, cancellationToken); formattedDocuments.Add((document, formatTask)); } diff --git a/src/Formatters/ICodeFormatter.cs b/src/Formatters/ICodeFormatter.cs index 6d68164c4c4d..fa0b67db69de 100644 --- a/src/Formatters/ICodeFormatter.cs +++ b/src/Formatters/ICodeFormatter.cs @@ -15,7 +15,7 @@ internal interface ICodeFormatter /// Task FormatAsync( Solution solution, - ImmutableArray formattableDocuments, + ImmutableArray formattableDocuments, FormatOptions options, ILogger logger, List formattedFiles, diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index e7db3bc934b4..929cfd13da10 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -125,7 +125,7 @@ private protected async Task TestAsync(string testCode, string expec reportPath: string.Empty, includeGeneratedFiles: false); - var pathsToFormat = await GetOnlyFileToFormatAsync(solution); + var pathsToFormat = GetOnlyFileToFormat(solution); var formattedSolution = await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, Logger, new List(), default); var formattedDocument = GetOnlyDocument(formattedSolution); @@ -137,21 +137,11 @@ private protected async Task TestAsync(string testCode, string expec } /// - /// Gets the only along with related options and conventions. + /// Gets the only . /// /// A Solution containing a single Project containing a single Document. - /// The editorconfig to apply to the documents options set. - /// The document contained within along with option set and coding conventions. - internal async Task> GetOnlyFileToFormatAsync(Solution solution) - { - var document = GetOnlyDocument(solution); - var options = (OptionSet)await document.GetOptionsAsync(); - - var syntaxTree = await document.GetSyntaxTreeAsync(); - var analyzerConfigOptions = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree); - - return ImmutableArray.Create(new DocumentWithOptions(document, options, analyzerConfigOptions)); - } + /// The only document id. + internal ImmutableArray GetOnlyFileToFormat(Solution solution) => ImmutableArray.Create(GetOnlyDocument(solution).Id); /// /// Gets the only contained within the only within the . diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index b859152af033..e689cb33fb7d 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -64,7 +64,7 @@ private async Task> TestFormattedFiles(string testCode) reportPath: string.Empty, includeGeneratedFiles: false); - var pathsToFormat = await GetOnlyFileToFormatAsync(solution); + var pathsToFormat = GetOnlyFileToFormat(solution); var formattedFiles = new List(); await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, new TestLogger(), formattedFiles, default); From 6e9b823ad1193fada093c26790d278689459de11 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Jun 2020 16:32:53 -0700 Subject: [PATCH 1027/2702] Update changelog and readme for 4.0 release --- CHANGELOG.md | 22 +++++++++++++++++++++- README.md | 31 ++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd7c8b3f84d2..5a1b57c8ea46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,28 @@ # Changelog All changes to the project will be documented in this file. -## [4.0.x] - Not Yet Released +## [4.0.130103] - 2020-06-01 +[View Complete Diff of Changes](https://www.github.com/dotnet/roslyn/compare/3f2b20c65d32a59ca6bbc68b788a31ed38576d8e...61e5536d636f5b13c74f710d658bb320b224026d) +### Breaking Changes: +- Added an imports formatter for sorting imports. +- Format now runs on the latest installed Runtime. +- `--check` and `--dry-run` have combined into a single option. +- `--include` and `--exclude` use space-separated paths instead of comma-separated. + +### Deprecations: +- Added warning to use the default argument instead of `--workspace` option. Use `dotnet format ./format.sln` instead of `dotnet format -w ./format.sln` +- Added warning to use the default argument to specify the folder path when using the `--folder` option. Use `dotnet format ./src -f` instead of `dotnet format -f ./src` +- Added warning to use `--include` instead of `--files` alias. +- Added warning to use `--check` instead of `--dry-run` alias. + ### Merged PRs: +- [Add Imports Formatter (693)](https://www.github.com/dotnet/roslyn/pull/693) +- [Always run on the latest Runtime (694)](https://www.github.com/dotnet/roslyn/pull/694) +- [Move to Roslyn's editorconfig support (590)](https://www.github.com/dotnet/roslyn/pull/590) +- [Command line argument for solution/project as positional argument (681)](https://www.github.com/dotnet/roslyn/pull/681) +- [Add option to format generated code files. (673)](https://www.github.com/dotnet/roslyn/pull/673) +- [Produce a binlog when verbosity is set to detailed (605)](https://www.github.com/dotnet/roslyn/pull/605) +- [Fix #581 - Add final newline false positive (633)](https://www.github.com/dotnet/roslyn/pull/633) - [Combine --check and --dry-run into a single option. (541)](https://github.com/dotnet/format/pull/541) - [Use space-separated paths instead of comma-separated for --include and --exclude (551)](https://github.com/dotnet/format/pull/551) - [Support loading commandline options from response files (552)](https://github.com/dotnet/format/pull/552) diff --git a/README.md b/README.md index 2fc4ae6ff671..dfd157255573 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,32 @@ `dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](./docs/Supported-.editorconfig-options.md). -### New in v3.3.111304 -- [Enhance --files option to support folder paths and add --include alias (533)](https://github.com/dotnet/format/pull/533) -- [format-500: Add `--exclude` option to ignore given files/folders (529)](https://github.com/dotnet/format/pull/529) -- [format-379: Add `--report` command line argument to export json format report to given directory (495)](https://github.com/dotnet/format/pull/495) -- [Update charset formatter to check for equivalent encodings (508)](https://github.com/dotnet/format/pull/508) +### New in v4.0.130103 +#### Breaking Changes: +- Added an imports formatter for sorting imports. +- Format now runs on the latest installed Runtime. +- `--check` and `--dry-run` have combined into a single option. +- `--include` and `--exclude` use space-separated paths instead of comma-separated. + +#### Deprecations: +- Added warning to use the default argument instead of `--workspace` option. Use `dotnet format ./format.sln` instead of `dotnet format -w ./format.sln` +- Added warning to use the default argument to specify the folder path when using the `--folder` option. Use `dotnet format ./src -f` instead of `dotnet format -f ./src` +- Added warning to use `--include` instead of `--files` alias. +- Added warning to use `--check` instead of `--dry-run` alias. + +#### Changes: +- [Add Imports Formatter (693)](https://www.github.com/dotnet/roslyn/pull/693) +- [Always run on the latest Runtime (694)](https://www.github.com/dotnet/roslyn/pull/694) +- [Move to Roslyn's editorconfig support (590)](https://www.github.com/dotnet/roslyn/pull/590) +- [Command line argument for solution/project as positional argument (681)](https://www.github.com/dotnet/roslyn/pull/681) +- [Add option to format generated code files. (673)](https://www.github.com/dotnet/roslyn/pull/673) +- [Produce a binlog when verbosity is set to detailed (605)](https://www.github.com/dotnet/roslyn/pull/605) +- [Fix #581 - Add final newline false positive (633)](https://www.github.com/dotnet/roslyn/pull/633) +- [Combine --check and --dry-run into a single option. (541)](https://github.com/dotnet/format/pull/541) +- [Use space-separated paths instead of comma-separated for --include and --exclude (551)](https://github.com/dotnet/format/pull/551) +- [Support loading commandline options from response files (552)](https://github.com/dotnet/format/pull/552) +- [Support file globbing in --include and --exclude options (555)](https://github.com/dotnet/format/pull/555) + ### How To Install From 2e76114924170fc82df6e32d78ca620c3534ba05 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Jun 2020 16:52:56 -0700 Subject: [PATCH 1028/2702] Fix changelog typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a1b57c8ea46..cf79c7a6bb58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All changes to the project will be documented in this file. ## [4.0.130103] - 2020-06-01 -[View Complete Diff of Changes](https://www.github.com/dotnet/roslyn/compare/3f2b20c65d32a59ca6bbc68b788a31ed38576d8e...61e5536d636f5b13c74f710d658bb320b224026d) +[View Complete Diff of Changes](https://www.github.com/dotnet/format/compare/3f2b20c65d32a59ca6bbc68b788a31ed38576d8e...61e5536d636f5b13c74f710d658bb320b224026d) ### Breaking Changes: - Added an imports formatter for sorting imports. - Format now runs on the latest installed Runtime. From f772fc306ff4b70cabebbea76beba9cdfd7ecb80 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Jun 2020 17:13:28 -0700 Subject: [PATCH 1029/2702] Fix packageicon packaging --- src/dotnet-format.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 1d64022071be..8639209e7394 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -59,7 +59,6 @@ - From a5dea3dbd12c9e32b4462f0612b832fbcbc23189 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 1 Jun 2020 17:32:01 -0700 Subject: [PATCH 1030/2702] Update version for release --- CHANGELOG.md | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf79c7a6bb58..6e4657e4a473 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Changelog All changes to the project will be documented in this file. -## [4.0.130103] - 2020-06-01 -[View Complete Diff of Changes](https://www.github.com/dotnet/format/compare/3f2b20c65d32a59ca6bbc68b788a31ed38576d8e...61e5536d636f5b13c74f710d658bb320b224026d) +## [4.0.130203] - 2020-06-01 +[View Complete Diff of Changes](https://www.github.com/dotnet/format/compare/3f2b20c65d32a59ca6bbc68b788a31ed38576d8e...f772fc306ff4b70cabebbea76beba9cdfd7ecb80) ### Breaking Changes: - Added an imports formatter for sorting imports. - Format now runs on the latest installed Runtime. diff --git a/README.md b/README.md index dfd157255573..3351e15dba19 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ `dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](./docs/Supported-.editorconfig-options.md). -### New in v4.0.130103 +### New in v4.0.130203 #### Breaking Changes: - Added an imports formatter for sorting imports. - Format now runs on the latest installed Runtime. From 6ef59689d30c4ed659e3cd7b080294cb16e8f26f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 2 Jun 2020 12:26:24 +0000 Subject: [PATCH 1031/2702] Update dependencies from https://github.com/dotnet/arcade build 20200530.1 (#697) Microsoft.DotNet.Arcade.Sdk From Version 5.0.0-beta.20278.4 -> To Version 5.0.0-beta.20280.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 1 - eng/common/sdk-task.ps1 | 7 ++++++- eng/common/tools.ps1 | 19 ++++++++++++++++--- global.json | 2 +- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b22160bc79a0..2fe73ca828a1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 96c65ad967d2abbbd8e770ba752a6b64255ec669 + fef373440d604c428950236fbc2b99ce0df368a9 diff --git a/eng/Versions.props b/eng/Versions.props index 0d0676b084d0..a13c25f0f9db 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -27,7 +27,6 @@ 3.0.0 $(MicrosoftNETCoreCompilersPackageVersion) 4.7.0 - + + + + + + + \ No newline at end of file diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 26e9b3d4fb79..0fd98d53a403 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -10,6 +10,7 @@ true Enable + $(NoWarn);8002 Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings. From 39f2981967c1016453bdc6ca663515b4e1b5e197 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 23 Jul 2019 12:16:04 -0700 Subject: [PATCH 1035/2702] Run code fixer after each analyzer. --- src/Analyzers/AnalyzerFormatter.cs | 31 ++++++---- src/Analyzers/CodeAnalysisResult.cs | 21 +++---- src/Analyzers/ConcurrentAnalyzerRunner.cs | 55 +++++++---------- src/Analyzers/IAnalyzerFinder.cs | 6 +- src/Analyzers/IAnalyzerRunner.cs | 9 +-- src/Analyzers/ICodeFixApplier.cs | 4 +- src/Analyzers/InternalRoslynAnalyzerFinder.cs | 47 ++++++++++++--- src/Analyzers/ParallelAsync.cs | 22 +++++++ src/Analyzers/PerDocumentCodeFixApplier.cs | 59 +++++++++++++++++-- src/CodeFormatter.cs | 2 + src/dotnet-format.csproj | 23 +++++--- tests/CodeFormatterTests.cs | 2 +- tests/Formatters/AbstractFormatterTests.cs | 2 +- 13 files changed, 191 insertions(+), 92 deletions(-) create mode 100644 src/Analyzers/ParallelAsync.cs diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index b78025a80237..b0f590649040 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.Immutable; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Formatters; @@ -38,17 +39,25 @@ public async Task FormatAsync( return solution; } - var analyzers = await _finder.FindAllAnalyzersAsync(logger, cancellationToken); -<<<<<<< HEAD - var result = await _runner.RunCodeAnalysisAsync(analyzers, formattableDocuments, logger, cancellationToken); -||||||| parent of 817ae5b... Added FormatType and--fix - style flag to options - var result = await _runner.RunCodeAnalysisAsync(analyzers, formattableDocuments, logger, cancellationToken); -======= - var result = await _runner.RunCodeAnalysisAsync(solution, analyzers, formattableDocuments, logger, cancellationToken); ->>>>>>> 817ae5b... Added FormatType and --fix-style flag to options - var codefixes = await _finder.FindAllCodeFixesAsync(logger, cancellationToken); - - return await _applier.ApplyCodeFixesAsync(solution, result, codefixes, formattableDocuments, logger, cancellationToken); + var paths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) + .OfType().ToImmutableArray(); + + var pairs = _finder.GetAnalyzersAndFixers(); + foreach (var (analyzer, codefix) in pairs) + { + var result = new CodeAnalysisResult(); + await solution.Projects.ForEachAsync(async (project, token) => + { + await _runner.RunCodeAnalysisAsync(result, analyzer, project, paths, logger, token); + }, cancellationToken); + + if (codefix is object) + { + solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); + } + } + + return solution; } } } diff --git a/src/Analyzers/CodeAnalysisResult.cs b/src/Analyzers/CodeAnalysisResult.cs index 2f87c1c35cae..0551ebb294b2 100644 --- a/src/Analyzers/CodeAnalysisResult.cs +++ b/src/Analyzers/CodeAnalysisResult.cs @@ -10,29 +10,26 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class CodeAnalysisResult { - private readonly ConcurrentDictionary> _dictionary - = new ConcurrentDictionary>(); + private readonly ConcurrentDictionary> _dictionary + = new ConcurrentDictionary>(); - internal void AddDiagnostic(Document document, Diagnostic diagnostic) + internal void AddDiagnostic(Project project, IEnumerable diagnostics) { - _ = _dictionary.AddOrUpdate(document.Id, - addValueFactory: (key) => - { - var list = new List { diagnostic }; - return list; - }, + _ = _dictionary.AddOrUpdate(project, + addValueFactory: (key) => diagnostics.ToList(), updateValueFactory: (key, list) => { - list.Add(diagnostic); + list.AddRange(diagnostics); return list; }); } - public IReadOnlyDictionary> Diagnostics - => new Dictionary>( + public IReadOnlyDictionary> Diagnostics + => new Dictionary>( _dictionary.Select( x => KeyValuePair.Create( x.Key, x.Value.ToImmutableArray()))); + } } diff --git a/src/Analyzers/ConcurrentAnalyzerRunner.cs b/src/Analyzers/ConcurrentAnalyzerRunner.cs index 0e1ed4181a7f..705d0a213ca4 100644 --- a/src/Analyzers/ConcurrentAnalyzerRunner.cs +++ b/src/Analyzers/ConcurrentAnalyzerRunner.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using System.Linq; using System.Threading; @@ -9,50 +10,34 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { - internal class ConcurrentAnalyzerRunner : IAnalyzerRunner + internal partial class ConcurrentAnalyzerRunner : IAnalyzerRunner { - private const string NoFormattableDocuments = "Unable to find solution when running code analysis."; - public static IAnalyzerRunner Instance { get; } = new ConcurrentAnalyzerRunner(); - public Task RunCodeAnalysisAsync( - Solution solution, - ImmutableArray analyzers, - ImmutableArray formattableDocuments, + public async Task RunCodeAnalysisAsync( + CodeAnalysisResult result, + DiagnosticAnalyzer analyzers, + Project project, + ImmutableArray formattableDocumentPaths, ILogger logger, CancellationToken cancellationToken) { - if (solution is null) + var compilation = await project.GetCompilationAsync(cancellationToken); + if (compilation is null) { - logger.LogError(NoFormattableDocuments); - throw new InvalidOperationException(NoFormattableDocuments); + return; } - var documents = formattableDocuments.Select(id => solution.GetDocument(id)).OfType().ToList(); - var result = new CodeAnalysisResult(); - Parallel.ForEach(solution.Projects, project => - { - var compilation = project.GetCompilationAsync(cancellationToken).GetAwaiter().GetResult(); - if (compilation is null) - { - return; - } - - // TODO: generate option set to ensure the analyzers run - // TODO: Ensure that the coding conventions snapshop gets passed to the analyzers somehow - var analyzerCompilation = compilation.WithAnalyzers(analyzers, options: null, cancellationToken); - var diagnosticResult = analyzerCompilation.GetAllDiagnosticsAsync(cancellationToken).GetAwaiter().GetResult(); - foreach (var diagnostic in diagnosticResult) - { - var doc = documents.Find(d => d.FilePath == diagnostic.Location.GetLineSpan().Path); - if (doc != null) - { - result.AddDiagnostic(doc, diagnostic); - } - } - }); - - return Task.FromResult(result); + var analyzerCompilation = compilation.WithAnalyzers( + ImmutableArray.Create(analyzers), + options: project.AnalyzerOptions, + cancellationToken); + var diagnostics = await analyzerCompilation.GetAllDiagnosticsAsync(cancellationToken); + // filter diagnostics + var filteredDiagnostics = diagnostics.Where( + x => x.Location.IsInSource && + formattableDocumentPaths.Contains(x.Location.SourceTree?.FilePath, StringComparer.OrdinalIgnoreCase)); + result.AddDiagnostic(project, filteredDiagnostics); } } } diff --git a/src/Analyzers/IAnalyzerFinder.cs b/src/Analyzers/IAnalyzerFinder.cs index 4e03680d23ad..81e5835d959b 100644 --- a/src/Analyzers/IAnalyzerFinder.cs +++ b/src/Analyzers/IAnalyzerFinder.cs @@ -1,17 +1,13 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Immutable; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Analyzers { interface IAnalyzerFinder { - Task> FindAllAnalyzersAsync(ILogger logger, CancellationToken cancellationToken); - Task> FindAllCodeFixesAsync(ILogger logger, CancellationToken cancellationToken); + ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers(); } } diff --git a/src/Analyzers/IAnalyzerRunner.cs b/src/Analyzers/IAnalyzerRunner.cs index 581f66ab762b..a574603a28b8 100644 --- a/src/Analyzers/IAnalyzerRunner.cs +++ b/src/Analyzers/IAnalyzerRunner.cs @@ -10,10 +10,11 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { interface IAnalyzerRunner { - Task RunCodeAnalysisAsync( - Solution solution, - ImmutableArray analyzers, - ImmutableArray formattableDocuments, + Task RunCodeAnalysisAsync( + CodeAnalysisResult result, + DiagnosticAnalyzer analyzers, + Project project, + ImmutableArray formattableDocumentPaths, ILogger logger, CancellationToken cancellationToken); } diff --git a/src/Analyzers/ICodeFixApplier.cs b/src/Analyzers/ICodeFixApplier.cs index 57038027f87b..af37b59c10e4 100644 --- a/src/Analyzers/ICodeFixApplier.cs +++ b/src/Analyzers/ICodeFixApplier.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; @@ -13,8 +12,7 @@ interface ICodeFixApplier Task ApplyCodeFixesAsync( Solution solution, CodeAnalysisResult result, - ImmutableArray codefixes, - ImmutableArray formattableDocuments, + CodeFixProvider codefixes, ILogger logger, CancellationToken cancellationToken); } diff --git a/src/Analyzers/InternalRoslynAnalyzerFinder.cs b/src/Analyzers/InternalRoslynAnalyzerFinder.cs index 085c9fc59051..a761cb8d5a3a 100644 --- a/src/Analyzers/InternalRoslynAnalyzerFinder.cs +++ b/src/Analyzers/InternalRoslynAnalyzerFinder.cs @@ -1,27 +1,58 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Immutable; -using System.Threading; -using System.Threading.Tasks; +using System.IO; +using System.Linq; +using System.Reflection; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class InternalRoslynAnalyzerFinder : IAnalyzerFinder { + private readonly static string s_executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); public static IAnalyzerFinder Instance { get; } = new InternalRoslynAnalyzerFinder(); - public Task> FindAllAnalyzersAsync(ILogger logger, CancellationToken cancellationToken) + private readonly string _featuresCSharpPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.CSharp.Features.dll"); + private readonly string _featuresVisualBasicPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.CSharp.VisualBasic.dll"); + + public ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers() + { + var analyzers = FindAllAnalyzers(); + + return analyzers.Select(analyzer => (analyzer, (CodeFixProvider?)null)).ToImmutableArray(); + } + + private ImmutableArray FindAllAnalyzers() + { + var featuresCSharpReference = new AnalyzerFileReference(_featuresCSharpPath, AssemblyLoader.Instance); + var csharpAnalyzers = featuresCSharpReference.GetAnalyzers(LanguageNames.CSharp); + + var featuresVisualBasicReference = new AnalyzerFileReference(_featuresVisualBasicPath, AssemblyLoader.Instance); + var visualBasicAnalyzers = featuresVisualBasicReference.GetAnalyzers(LanguageNames.VisualBasic); + + var allAnalyzers = csharpAnalyzers.Concat(visualBasicAnalyzers).ToImmutableArray(); + return allAnalyzers; + } + + private ImmutableArray FindAllCodeFixesAsync() { - throw new NotImplementedException(); + return ImmutableArray.Empty; } - public Task> FindAllCodeFixesAsync(ILogger logger, CancellationToken cancellationToken) + internal class AssemblyLoader : IAnalyzerAssemblyLoader { - throw new NotImplementedException(); + public static AssemblyLoader Instance = new AssemblyLoader(); + + public void AddDependencyLocation(string fullPath) + { + } + + public Assembly LoadFromPath(string fullPath) + { + return Assembly.LoadFrom(fullPath); + } } } } diff --git a/src/Analyzers/ParallelAsync.cs b/src/Analyzers/ParallelAsync.cs new file mode 100644 index 000000000000..c2e89bea450c --- /dev/null +++ b/src/Analyzers/ParallelAsync.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.Tools.Analyzers +{ + public static class ParallelAsync + { + public static Task ForEachAsync(this IEnumerable enumerable, + Func action, + CancellationToken cancellationToken = default) + => Task.WhenAll(enumerable + .AsParallel() + .WithDegreeOfParallelism(Environment.ProcessorCount) + .WithCancellation(cancellationToken) + .Select(x => action(x, cancellationToken))); + } +} diff --git a/src/Analyzers/PerDocumentCodeFixApplier.cs b/src/Analyzers/PerDocumentCodeFixApplier.cs index 06e363c77ecb..b58395d9a60c 100644 --- a/src/Analyzers/PerDocumentCodeFixApplier.cs +++ b/src/Analyzers/PerDocumentCodeFixApplier.cs @@ -1,25 +1,76 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Collections.Immutable; +using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Analyzers { + internal sealed class DiagnosticProvider : FixAllContext.DiagnosticProvider + { + private readonly IReadOnlyDictionary> _diagnosticsByProject; + + internal DiagnosticProvider(CodeAnalysisResult analysisResult) + { + _diagnosticsByProject = analysisResult.Diagnostics; + } + + public override Task> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) + { + return Task.FromResult>(_diagnosticsByProject[project]); + } + + public override Task> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public override Task> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken) + { + return Task.FromResult>(_diagnosticsByProject[project]); + } + } + internal class PerDocumentCodeFixApplier : ICodeFixApplier { - public Task ApplyCodeFixesAsync( + public async Task ApplyCodeFixesAsync( Solution solution, CodeAnalysisResult result, - ImmutableArray codefixes, - ImmutableArray formattableDocuments, + CodeFixProvider codeFix, ILogger logger, CancellationToken cancellationToken) { - throw new NotImplementedException(); + var fixAllProvider = codeFix.GetFixAllProvider(); + if (!fixAllProvider.GetSupportedFixAllScopes().Contains(FixAllScope.Solution)) + { + throw new InvalidOperationException($"Code fix {codeFix.GetType()} doesn't support Fix All in Solution"); + } + + var project = solution.Projects.FirstOrDefault(); + if (project == null) + { + throw new InvalidOperationException($"Solution {solution} has no projects"); + } + + var fixAllContext = new FixAllContext( + project: project, + codeFixProvider: codeFix, + scope: FixAllScope.Solution, + codeActionEquivalenceKey: null, + diagnosticIds: codeFix.FixableDiagnosticIds, + fixAllDiagnosticProvider: new DiagnosticProvider(result), + cancellationToken: cancellationToken); + + var action = await fixAllProvider.GetFixAsync(fixAllContext); + var operations = await (action?.GetOperationsAsync(cancellationToken) ?? Task.FromResult(ImmutableArray.Empty)); + var applyChangesOperation = operations.OfType().SingleOrDefault(); + return applyChangesOperation?.ChangedSolution ?? solution; } } } diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 795498e19a89..bebab7c3dac0 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using Microsoft.Build.Logging; using Microsoft.CodeAnalysis.MSBuild; +using Microsoft.CodeAnalysis.Tools.Analyzers; using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.CodeAnalysis.Tools.Workspaces; @@ -28,6 +29,7 @@ internal static class CodeFormatter new EndOfLineFormatter(), new CharsetFormatter(), new ImportsFormatter(), + new AnalyzerFormatter(new InternalRoslynAnalyzerFinder(), new ConcurrentAnalyzerRunner(), new PerDocumentCodeFixApplier()), }.ToImmutableArray(); public static async Task FormatWorkspaceAsync( diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 0fd98d53a403..77f4e1460893 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -30,27 +30,34 @@ + + + - - - - + - - - + + + + - + + + + + + + diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 279b58c82f11..edf68ba37dc9 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -394,7 +394,7 @@ public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEn workspacePath, workspaceType, LogLevel.Trace, - FormatType.All, + FormatType.Whitespace, saveFormattedFiles: false, changesAreErrors: false, fileMatcher, diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index b1740e19d1f8..ac5efd91fbc7 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -119,7 +119,7 @@ private protected async Task TestAsync(string testCode, string expec workspaceFilePath: project.FilePath, workspaceType: WorkspaceType.Folder, logLevel: LogLevel.Trace, - formatType: FormatType.All, + formatType: FormatType.Whitespace, saveFormattedFiles: false, changesAreErrors: false, fileMatcher, From 003c51cb97ee74f003b9620c3f409d203faafc24 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Tue, 23 Jul 2019 17:21:20 -0700 Subject: [PATCH 1036/2702] Refactor CodeFix Applier --- ...ixApplier.cs => SolutionCodeFixApplier.cs} | 52 +++++++++---------- src/CodeFormatter.cs | 2 +- 2 files changed, 27 insertions(+), 27 deletions(-) rename src/Analyzers/{PerDocumentCodeFixApplier.cs => SolutionCodeFixApplier.cs} (66%) diff --git a/src/Analyzers/PerDocumentCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs similarity index 66% rename from src/Analyzers/PerDocumentCodeFixApplier.cs rename to src/Analyzers/SolutionCodeFixApplier.cs index b58395d9a60c..2fb219338df5 100644 --- a/src/Analyzers/PerDocumentCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -12,32 +12,7 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { - internal sealed class DiagnosticProvider : FixAllContext.DiagnosticProvider - { - private readonly IReadOnlyDictionary> _diagnosticsByProject; - - internal DiagnosticProvider(CodeAnalysisResult analysisResult) - { - _diagnosticsByProject = analysisResult.Diagnostics; - } - - public override Task> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) - { - return Task.FromResult>(_diagnosticsByProject[project]); - } - - public override Task> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) - { - throw new NotImplementedException(); - } - - public override Task> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken) - { - return Task.FromResult>(_diagnosticsByProject[project]); - } - } - - internal class PerDocumentCodeFixApplier : ICodeFixApplier + internal class SolutionCodeFixApplier : ICodeFixApplier { public async Task ApplyCodeFixesAsync( Solution solution, @@ -72,5 +47,30 @@ public async Task ApplyCodeFixesAsync( var applyChangesOperation = operations.OfType().SingleOrDefault(); return applyChangesOperation?.ChangedSolution ?? solution; } + + private class DiagnosticProvider : FixAllContext.DiagnosticProvider + { + private readonly IReadOnlyDictionary> _diagnosticsByProject; + + internal DiagnosticProvider(CodeAnalysisResult analysisResult) + { + _diagnosticsByProject = analysisResult.Diagnostics; + } + + public override Task> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) + { + return Task.FromResult>(_diagnosticsByProject[project]); + } + + public override Task> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public override Task> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken) + { + return Task.FromResult>(_diagnosticsByProject[project]); + } + } } } diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index bebab7c3dac0..e8b095cbab63 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -29,7 +29,7 @@ internal static class CodeFormatter new EndOfLineFormatter(), new CharsetFormatter(), new ImportsFormatter(), - new AnalyzerFormatter(new InternalRoslynAnalyzerFinder(), new ConcurrentAnalyzerRunner(), new PerDocumentCodeFixApplier()), + new AnalyzerFormatter(new InternalRoslynAnalyzerFinder(), new ConcurrentAnalyzerRunner(), new SolutionCodeFixApplier()), }.ToImmutableArray(); public static async Task FormatWorkspaceAsync( From 2be158a403cd1587c1885c106a73cb706f5c1995 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 23 Jul 2019 17:44:43 -0700 Subject: [PATCH 1037/2702] Refactor AnalyzerRunner --- .../{ConcurrentAnalyzerRunner.cs => AnalyzerRunner.cs} | 10 +++++----- src/CodeFormatter.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) rename src/Analyzers/{ConcurrentAnalyzerRunner.cs => AnalyzerRunner.cs} (81%) diff --git a/src/Analyzers/ConcurrentAnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs similarity index 81% rename from src/Analyzers/ConcurrentAnalyzerRunner.cs rename to src/Analyzers/AnalyzerRunner.cs index 705d0a213ca4..366759fc5bcf 100644 --- a/src/Analyzers/ConcurrentAnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -10,10 +10,8 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { - internal partial class ConcurrentAnalyzerRunner : IAnalyzerRunner + internal partial class AnalyzerRunner : IAnalyzerRunner { - public static IAnalyzerRunner Instance { get; } = new ConcurrentAnalyzerRunner(); - public async Task RunCodeAnalysisAsync( CodeAnalysisResult result, DiagnosticAnalyzer analyzers, @@ -32,10 +30,12 @@ public async Task RunCodeAnalysisAsync( ImmutableArray.Create(analyzers), options: project.AnalyzerOptions, cancellationToken); - var diagnostics = await analyzerCompilation.GetAllDiagnosticsAsync(cancellationToken); + var diagnostics = await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken); // filter diagnostics var filteredDiagnostics = diagnostics.Where( - x => x.Location.IsInSource && + x => !x.IsSuppressed && + x.Severity >= DiagnosticSeverity.Warning && + x.Location.IsInSource && formattableDocumentPaths.Contains(x.Location.SourceTree?.FilePath, StringComparer.OrdinalIgnoreCase)); result.AddDiagnostic(project, filteredDiagnostics); } diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index e8b095cbab63..50b7e327e179 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -29,7 +29,7 @@ internal static class CodeFormatter new EndOfLineFormatter(), new CharsetFormatter(), new ImportsFormatter(), - new AnalyzerFormatter(new InternalRoslynAnalyzerFinder(), new ConcurrentAnalyzerRunner(), new SolutionCodeFixApplier()), + new AnalyzerFormatter(new InternalRoslynAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), }.ToImmutableArray(); public static async Task FormatWorkspaceAsync( From 0e2fc4b94a5393288b452d127c810c948670241a Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Wed, 24 Jul 2019 14:59:10 -0700 Subject: [PATCH 1038/2702] Run formatters based on FormatType --- src/Analyzers/AnalyzerFormatter.cs | 7 ++----- src/Analyzers/{ => Interfaces}/IAnalyzerFinder.cs | 0 src/Analyzers/{ => Interfaces}/IAnalyzerRunner.cs | 0 src/Analyzers/{ => Interfaces}/ICodeFixApplier.cs | 0 ...nAnalyzerFinder.cs => RoslynCodeStyleAnalyzerFinder.cs} | 3 +-- src/CodeFormatter.cs | 7 ++++++- src/Formatters/CharsetFormatter.cs | 1 + src/Formatters/DocumentFormatter.cs | 1 + src/Formatters/EndOfLineFormatter.cs | 1 + src/Formatters/FinalNewlineFormatter.cs | 1 + src/Formatters/ICodeFormatter.cs | 2 ++ src/Formatters/ImportsFormatter.cs | 1 + src/Formatters/WhitespaceFormatter.cs | 1 + 13 files changed, 17 insertions(+), 8 deletions(-) rename src/Analyzers/{ => Interfaces}/IAnalyzerFinder.cs (100%) rename src/Analyzers/{ => Interfaces}/IAnalyzerRunner.cs (100%) rename src/Analyzers/{ => Interfaces}/ICodeFixApplier.cs (100%) rename src/Analyzers/{InternalRoslynAnalyzerFinder.cs => RoslynCodeStyleAnalyzerFinder.cs} (93%) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index b0f590649040..283bddb62cca 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -12,6 +12,8 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class AnalyzerFormatter : ICodeFormatter { + public FormatType FormatType => FormatType.CodeStyle; + private readonly IAnalyzerFinder _finder; private readonly IAnalyzerRunner _runner; private readonly ICodeFixApplier _applier; @@ -34,11 +36,6 @@ public async Task FormatAsync( List formattedFiles, CancellationToken cancellationToken) { - if (!options.FormatType.HasFlag(FormatType.CodeStyle)) - { - return solution; - } - var paths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) .OfType().ToImmutableArray(); diff --git a/src/Analyzers/IAnalyzerFinder.cs b/src/Analyzers/Interfaces/IAnalyzerFinder.cs similarity index 100% rename from src/Analyzers/IAnalyzerFinder.cs rename to src/Analyzers/Interfaces/IAnalyzerFinder.cs diff --git a/src/Analyzers/IAnalyzerRunner.cs b/src/Analyzers/Interfaces/IAnalyzerRunner.cs similarity index 100% rename from src/Analyzers/IAnalyzerRunner.cs rename to src/Analyzers/Interfaces/IAnalyzerRunner.cs diff --git a/src/Analyzers/ICodeFixApplier.cs b/src/Analyzers/Interfaces/ICodeFixApplier.cs similarity index 100% rename from src/Analyzers/ICodeFixApplier.cs rename to src/Analyzers/Interfaces/ICodeFixApplier.cs diff --git a/src/Analyzers/InternalRoslynAnalyzerFinder.cs b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs similarity index 93% rename from src/Analyzers/InternalRoslynAnalyzerFinder.cs rename to src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs index a761cb8d5a3a..4b030f3a162f 100644 --- a/src/Analyzers/InternalRoslynAnalyzerFinder.cs +++ b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs @@ -9,10 +9,9 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { - internal class InternalRoslynAnalyzerFinder : IAnalyzerFinder + internal class RoslynCodeStyleAnalyzerFinder : IAnalyzerFinder { private readonly static string s_executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - public static IAnalyzerFinder Instance { get; } = new InternalRoslynAnalyzerFinder(); private readonly string _featuresCSharpPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.CSharp.Features.dll"); private readonly string _featuresVisualBasicPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.CSharp.VisualBasic.dll"); diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 50b7e327e179..a5308a0cb1b3 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -29,7 +29,7 @@ internal static class CodeFormatter new EndOfLineFormatter(), new CharsetFormatter(), new ImportsFormatter(), - new AnalyzerFormatter(new InternalRoslynAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), + new AnalyzerFormatter(new RoslynCodeStyleAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), }.ToImmutableArray(); public static async Task FormatWorkspaceAsync( @@ -245,6 +245,11 @@ private static async Task RunCodeFormattersAsync( foreach (var codeFormatter in s_codeFormatters) { + if (!options.FormatType.HasFlag(codeFormatter.FormatType)) + { + continue; + } + formattedSolution = await codeFormatter.FormatAsync(formattedSolution, formattableDocuments, options, logger, formattedFiles, cancellationToken).ConfigureAwait(false); } diff --git a/src/Formatters/CharsetFormatter.cs b/src/Formatters/CharsetFormatter.cs index 3851da7fbf53..45eaad25740b 100644 --- a/src/Formatters/CharsetFormatter.cs +++ b/src/Formatters/CharsetFormatter.cs @@ -15,6 +15,7 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { internal sealed class CharsetFormatter : DocumentFormatter { + public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_file_encoding; private static Encoding Utf8 => new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index ae32adbf4226..a313056b22e8 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -18,6 +18,7 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters /// internal abstract class DocumentFormatter : ICodeFormatter { + public abstract FormatType FormatType { get; } protected abstract string FormatWarningDescription { get; } /// diff --git a/src/Formatters/EndOfLineFormatter.cs b/src/Formatters/EndOfLineFormatter.cs index 0537e1c20935..69a1407e7373 100644 --- a/src/Formatters/EndOfLineFormatter.cs +++ b/src/Formatters/EndOfLineFormatter.cs @@ -13,6 +13,7 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { internal sealed class EndOfLineFormatter : DocumentFormatter { + public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_end_of_line_marker; internal override Task FormatFileAsync( diff --git a/src/Formatters/FinalNewlineFormatter.cs b/src/Formatters/FinalNewlineFormatter.cs index d439f2b57c72..16ba76488ac4 100644 --- a/src/Formatters/FinalNewlineFormatter.cs +++ b/src/Formatters/FinalNewlineFormatter.cs @@ -13,6 +13,7 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { internal sealed class FinalNewlineFormatter : DocumentFormatter { + public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_final_newline; internal override async Task FormatFileAsync( diff --git a/src/Formatters/ICodeFormatter.cs b/src/Formatters/ICodeFormatter.cs index fa0b67db69de..06bc7beff508 100644 --- a/src/Formatters/ICodeFormatter.cs +++ b/src/Formatters/ICodeFormatter.cs @@ -10,6 +10,8 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { internal interface ICodeFormatter { + FormatType FormatType { get; } + /// /// Applies formatting and returns a formatted . /// diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/ImportsFormatter.cs index 9558db947b07..149c61c9a34b 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/ImportsFormatter.cs @@ -17,6 +17,7 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters /// internal sealed class ImportsFormatter : DocumentFormatter { + public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_imports_ordering; private readonly DocumentFormatter _endOfLineFormatter = new EndOfLineFormatter(); diff --git a/src/Formatters/WhitespaceFormatter.cs b/src/Formatters/WhitespaceFormatter.cs index ed7800a8f9c6..7fe18550bd6d 100644 --- a/src/Formatters/WhitespaceFormatter.cs +++ b/src/Formatters/WhitespaceFormatter.cs @@ -15,6 +15,7 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters /// internal sealed class WhitespaceFormatter : DocumentFormatter { + public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_whitespace_formatting; internal override async Task FormatFileAsync( From abaa89b4882abe755f63545682ecb866c1a9fda9 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 25 Jul 2019 18:02:40 -0700 Subject: [PATCH 1039/2702] Log diagnostics and measure analysis time --- .editorconfig | 30 ++++++++++---------- src/Analyzers/AnalyzerFormatter.cs | 44 ++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 17 deletions(-) diff --git a/.editorconfig b/.editorconfig index 0884d2396901..794b0b9938f3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -35,14 +35,14 @@ indent_size = 2 # Sort using and Import directives with System.* appearing first dotnet_sort_system_directives_first = true # Avoid "this." and "Me." if not necessary -dotnet_style_qualification_for_field = false:suggestion -dotnet_style_qualification_for_property = false:suggestion -dotnet_style_qualification_for_method = false:suggestion -dotnet_style_qualification_for_event = false:suggestion +dotnet_style_qualification_for_field = false:error +dotnet_style_qualification_for_property = false:error +dotnet_style_qualification_for_method = false:error +dotnet_style_qualification_for_event = false:error # Use language keywords instead of framework type names for type references -dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion -dotnet_style_predefined_type_for_member_access = true:suggestion +dotnet_style_predefined_type_for_locals_parameters_members = true:error +dotnet_style_predefined_type_for_member_access = true:error # Suggest more modern language features when available dotnet_style_object_initializer = true:suggestion @@ -131,9 +131,9 @@ csharp_indent_switch_labels = true csharp_indent_labels = flush_left # Prefer "var" everywhere -csharp_style_var_for_built_in_types = true:suggestion -csharp_style_var_when_type_is_apparent = true:suggestion -csharp_style_var_elsewhere = true:suggestion +csharp_style_var_for_built_in_types = true:error +csharp_style_var_when_type_is_apparent = true:error +csharp_style_var_elsewhere = true:error # Prefer method-like constructs to have a block body csharp_style_expression_bodied_methods = false:none @@ -141,15 +141,15 @@ csharp_style_expression_bodied_constructors = false:none csharp_style_expression_bodied_operators = false:none # Prefer property-like constructs to have an expression-body -csharp_style_expression_bodied_properties = true:none -csharp_style_expression_bodied_indexers = true:none -csharp_style_expression_bodied_accessors = true:none +csharp_style_expression_bodied_properties = true:error +csharp_style_expression_bodied_indexers = true:error +csharp_style_expression_bodied_accessors = true:error # Suggest more modern language features when available -csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion -csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:error +csharp_style_pattern_matching_over_as_with_null_check = true:error csharp_style_inlined_variable_declaration = true:suggestion -csharp_style_throw_expression = true:suggestion +csharp_style_throw_expression = true:error csharp_style_conditional_delegate_call = true:suggestion # Newline settings diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 283bddb62cca..bbfa54d1ed66 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.Immutable; +using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -36,6 +37,9 @@ public async Task FormatAsync( List formattedFiles, CancellationToken cancellationToken) { + var analysisStopwatch = Stopwatch.StartNew(); + logger.LogTrace($"Analyzing code style."); + var paths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) .OfType().ToImmutableArray(); @@ -48,13 +52,49 @@ await solution.Projects.ForEachAsync(async (project, token) => await _runner.RunCodeAnalysisAsync(result, analyzer, project, paths, logger, token); }, cancellationToken); - if (codefix is object) + var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Length > 0); + if (hasDiagnostics) { - solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); + if (options.SaveFormattedFiles) + { + logger.LogTrace($"Applying fixes for {codefix.GetType().Name}"); + solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); + } + else + { + LogDiagnosticLocations(result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger); + } } } + logger.LogTrace("Analysis complete in {0}ms.", analysisStopwatch.ElapsedMilliseconds); + return solution; } + + private void LogDiagnosticLocations(IEnumerable diagnostics, string workspacePath, bool changesAreErrors, ILogger logger) + { + var workspaceFolder = Path.GetDirectoryName(workspacePath); + + foreach (var diagnostic in diagnostics) + { + var message = diagnostic.GetMessage(); + var filePath = diagnostic.Location.SourceTree.FilePath; + + var mappedLineSpan = diagnostic.Location.GetMappedLineSpan(); + var changePosition = mappedLineSpan.StartLinePosition; + + var formatMessage = $"{Path.GetRelativePath(workspaceFolder, filePath)}({changePosition.Line + 1},{changePosition.Character + 1}): {message}"; + + if (changesAreErrors) + { + logger.LogError(formatMessage); + } + else + { + logger.LogWarning(formatMessage); + } + } + } } } From 011d916a6df30d62a26edf92cac8251b09be6be8 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Fri, 26 Jul 2019 23:49:14 -0700 Subject: [PATCH 1040/2702] Update solution only if its been changed --- src/Analyzers/AnalyzerFormatter.cs | 5 +++++ src/Analyzers/{ParallelAsync.cs => Extensions.cs} | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) rename src/Analyzers/{ParallelAsync.cs => Extensions.cs} (80%) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index bbfa54d1ed66..71730cbe0396 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -59,6 +59,11 @@ await solution.Projects.ForEachAsync(async (project, token) => { logger.LogTrace($"Applying fixes for {codefix.GetType().Name}"); solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); + var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); + if (changedSolution.GetChanges(solution).Any()) + { + solution = changedSolution; + } } else { diff --git a/src/Analyzers/ParallelAsync.cs b/src/Analyzers/Extensions.cs similarity index 80% rename from src/Analyzers/ParallelAsync.cs rename to src/Analyzers/Extensions.cs index c2e89bea450c..c7976c95971f 100644 --- a/src/Analyzers/ParallelAsync.cs +++ b/src/Analyzers/Extensions.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { - public static class ParallelAsync + public static class Extensions { public static Task ForEachAsync(this IEnumerable enumerable, Func action, @@ -18,5 +18,8 @@ public static Task ForEachAsync(this IEnumerable enumerable, .WithDegreeOfParallelism(Environment.ProcessorCount) .WithCancellation(cancellationToken) .Select(x => action(x, cancellationToken))); + + public static bool Any(this SolutionChanges solutionChanges) + => solutionChanges.GetProjectChanges().Any(x => x.GetChangedDocuments().Any()); } } From 895e5832737f922c64b9f06b38b1f5044594956b Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Mon, 29 Jul 2019 18:44:22 -0700 Subject: [PATCH 1041/2702] Run diagnostics in parallel if in dry-run --- src/Analyzers/AnalyzerFormatter.cs | 30 ++++++++++++++------- src/Analyzers/AnalyzerRunner.cs | 13 +++++++-- src/Analyzers/Interfaces/IAnalyzerRunner.cs | 8 ++++++ src/Analyzers/SolutionCodeFixApplier.cs | 7 +++-- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 71730cbe0396..1a0e787baaff 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -44,18 +44,32 @@ public async Task FormatAsync( .OfType().ToImmutableArray(); var pairs = _finder.GetAnalyzersAndFixers(); - foreach (var (analyzer, codefix) in pairs) + + if (!options.SaveFormattedFiles) { + // no need to run codefixes as we won't persist the changes + var analyzers = pairs.Select(x => x.Analyzer).ToImmutableArray(); var result = new CodeAnalysisResult(); await solution.Projects.ForEachAsync(async (project, token) => { - await _runner.RunCodeAnalysisAsync(result, analyzer, project, paths, logger, token); + await _runner.RunCodeAnalysisAsync(result, analyzers, project, paths, logger, token); }, cancellationToken); - var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Length > 0); - if (hasDiagnostics) + LogDiagnosticLocations(result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger); + } + else + { + // we need to run each codefix iteratively so ensure that all diagnostics are found and fixed + foreach (var (analyzer, codefix) in pairs) { - if (options.SaveFormattedFiles) + var result = new CodeAnalysisResult(); + await solution.Projects.ForEachAsync(async (project, token) => + { + await _runner.RunCodeAnalysisAsync(result, analyzer, project, paths, logger, token); + }, cancellationToken); + + var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Length > 0); + if (hasDiagnostics && codefix is object) { logger.LogTrace($"Applying fixes for {codefix.GetType().Name}"); solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); @@ -65,10 +79,6 @@ await solution.Projects.ForEachAsync(async (project, token) => solution = changedSolution; } } - else - { - LogDiagnosticLocations(result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger); - } } } @@ -84,7 +94,7 @@ private void LogDiagnosticLocations(IEnumerable diagnostics, string foreach (var diagnostic in diagnostics) { var message = diagnostic.GetMessage(); - var filePath = diagnostic.Location.SourceTree.FilePath; + var filePath = diagnostic.Location.SourceTree?.FilePath; var mappedLineSpan = diagnostic.Location.GetMappedLineSpan(); var changePosition = mappedLineSpan.StartLinePosition; diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index 366759fc5bcf..b0eac7fc9084 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -12,13 +12,22 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal partial class AnalyzerRunner : IAnalyzerRunner { - public async Task RunCodeAnalysisAsync( + public Task RunCodeAnalysisAsync( CodeAnalysisResult result, DiagnosticAnalyzer analyzers, Project project, ImmutableArray formattableDocumentPaths, ILogger logger, CancellationToken cancellationToken) + => RunCodeAnalysisAsync(result, ImmutableArray.Create(analyzers), project, formattableDocumentPaths, logger, cancellationToken); + + public async Task RunCodeAnalysisAsync( + CodeAnalysisResult result, + ImmutableArray analyzers, + Project project, + ImmutableArray formattableDocumentPaths, + ILogger logger, + CancellationToken cancellationToken) { var compilation = await project.GetCompilationAsync(cancellationToken); if (compilation is null) @@ -27,7 +36,7 @@ public async Task RunCodeAnalysisAsync( } var analyzerCompilation = compilation.WithAnalyzers( - ImmutableArray.Create(analyzers), + analyzers, options: project.AnalyzerOptions, cancellationToken); var diagnostics = await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken); diff --git a/src/Analyzers/Interfaces/IAnalyzerRunner.cs b/src/Analyzers/Interfaces/IAnalyzerRunner.cs index a574603a28b8..68cf23c40211 100644 --- a/src/Analyzers/Interfaces/IAnalyzerRunner.cs +++ b/src/Analyzers/Interfaces/IAnalyzerRunner.cs @@ -17,5 +17,13 @@ Task RunCodeAnalysisAsync( ImmutableArray formattableDocumentPaths, ILogger logger, CancellationToken cancellationToken); + + Task RunCodeAnalysisAsync( + CodeAnalysisResult result, + ImmutableArray analyzers, + Project project, + ImmutableArray formattableDocumentPaths, + ILogger logger, + CancellationToken cancellationToken); } } diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index 2fb219338df5..afdad9a04210 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -50,6 +50,7 @@ public async Task ApplyCodeFixesAsync( private class DiagnosticProvider : FixAllContext.DiagnosticProvider { + private static readonly Task> EmptyDignosticResult = Task.FromResult(Enumerable.Empty()); private readonly IReadOnlyDictionary> _diagnosticsByProject; internal DiagnosticProvider(CodeAnalysisResult analysisResult) @@ -59,7 +60,7 @@ internal DiagnosticProvider(CodeAnalysisResult analysisResult) public override Task> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) { - return Task.FromResult>(_diagnosticsByProject[project]); + return GetProjectDiagnosticsAsync(project, cancellationToken); } public override Task> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) @@ -69,7 +70,9 @@ public override Task> GetDocumentDiagnosticsAsync(Docume public override Task> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken) { - return Task.FromResult>(_diagnosticsByProject[project]); + return _diagnosticsByProject.ContainsKey(project) + ? Task.FromResult>(_diagnosticsByProject[project]) + : EmptyDignosticResult; } } } From 28f738a29750fd06f50622e7dc01107c11a648cd Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 1 Aug 2019 17:18:44 -0700 Subject: [PATCH 1042/2702] Code cleanup and refactoring --- src/Analyzers/AnalyzerFormatter.cs | 112 ++++++++++-------- src/Analyzers/AnalyzerRunner.cs | 18 +-- src/Analyzers/CodeAnalysisResult.cs | 17 +-- .../RoslynCodeStyleAnalyzerFinder.cs | 4 +- src/Analyzers/SolutionCodeFixApplier.cs | 2 +- tests/Extensions/ExportProviderExtensions.cs | 25 +++- tests/Formatters/AbstractFormatterTests.cs | 7 +- tests/dotnet-format.UnitTests.csproj | 10 ++ 8 files changed, 117 insertions(+), 78 deletions(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 1a0e787baaff..8b1fb8d504f2 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; @@ -40,46 +41,13 @@ public async Task FormatAsync( var analysisStopwatch = Stopwatch.StartNew(); logger.LogTrace($"Analyzing code style."); - var paths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) - .OfType().ToImmutableArray(); - - var pairs = _finder.GetAnalyzersAndFixers(); - if (!options.SaveFormattedFiles) { - // no need to run codefixes as we won't persist the changes - var analyzers = pairs.Select(x => x.Analyzer).ToImmutableArray(); - var result = new CodeAnalysisResult(); - await solution.Projects.ForEachAsync(async (project, token) => - { - await _runner.RunCodeAnalysisAsync(result, analyzers, project, paths, logger, token); - }, cancellationToken); - - LogDiagnosticLocations(result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger); + await LogDiagnosticsAsync(solution, formattableDocuments, options, logger, cancellationToken); } else { - // we need to run each codefix iteratively so ensure that all diagnostics are found and fixed - foreach (var (analyzer, codefix) in pairs) - { - var result = new CodeAnalysisResult(); - await solution.Projects.ForEachAsync(async (project, token) => - { - await _runner.RunCodeAnalysisAsync(result, analyzer, project, paths, logger, token); - }, cancellationToken); - - var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Length > 0); - if (hasDiagnostics && codefix is object) - { - logger.LogTrace($"Applying fixes for {codefix.GetType().Name}"); - solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); - var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); - if (changedSolution.GetChanges(solution).Any()) - { - solution = changedSolution; - } - } - } + solution = await FixDiagnosticsAsync(solution, formattableDocuments, logger, cancellationToken); } logger.LogTrace("Analysis complete in {0}ms.", analysisStopwatch.ElapsedMilliseconds); @@ -87,29 +55,79 @@ await solution.Projects.ForEachAsync(async (project, token) => return solution; } - private void LogDiagnosticLocations(IEnumerable diagnostics, string workspacePath, bool changesAreErrors, ILogger logger) + private async Task LogDiagnosticsAsync(Solution solution, ImmutableArray formattableDocuments, FormatOptions options, ILogger logger, CancellationToken cancellationToken) { - var workspaceFolder = Path.GetDirectoryName(workspacePath); + var pairs = _finder.GetAnalyzersAndFixers(); + var paths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) + .OfType().ToImmutableArray(); - foreach (var diagnostic in diagnostics) + // no need to run codefixes as we won't persist the changes + var analyzers = pairs.Select(x => x.Analyzer).ToImmutableArray(); + var result = new CodeAnalysisResult(); + await solution.Projects.ForEachAsync(async (project, token) => { - var message = diagnostic.GetMessage(); - var filePath = diagnostic.Location.SourceTree?.FilePath; + await _runner.RunCodeAnalysisAsync(result, analyzers, project, paths, logger, token); + }, cancellationToken); + + LogDiagnosticLocations(result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger); - var mappedLineSpan = diagnostic.Location.GetMappedLineSpan(); - var changePosition = mappedLineSpan.StartLinePosition; + return; - var formatMessage = $"{Path.GetRelativePath(workspaceFolder, filePath)}({changePosition.Line + 1},{changePosition.Character + 1}): {message}"; + static void LogDiagnosticLocations(IEnumerable diagnostics, string workspacePath, bool changesAreErrors, ILogger logger) + { + var workspaceFolder = Path.GetDirectoryName(workspacePath); - if (changesAreErrors) + foreach (var diagnostic in diagnostics) { - logger.LogError(formatMessage); + var message = diagnostic.GetMessage(); + var filePath = diagnostic.Location.SourceTree?.FilePath; + + var mappedLineSpan = diagnostic.Location.GetMappedLineSpan(); + var changePosition = mappedLineSpan.StartLinePosition; + + var formatMessage = $"{Path.GetRelativePath(workspaceFolder, filePath)}({changePosition.Line + 1},{changePosition.Character + 1}): {message}"; + + if (changesAreErrors) + { + logger.LogError(formatMessage); + } + else + { + logger.LogWarning(formatMessage); + } } - else + } + } + + private async Task FixDiagnosticsAsync(Solution solution, ImmutableArray formattableDocuments, ILogger logger, CancellationToken cancellationToken) + { + var pairs = _finder.GetAnalyzersAndFixers(); + var paths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) + .OfType().ToImmutableArray(); + + // we need to run each codefix iteratively so ensure that all diagnostics are found and fixed + foreach (var (analyzer, codefix) in pairs) + { + var result = new CodeAnalysisResult(); + await solution.Projects.ForEachAsync(async (project, token) => { - logger.LogWarning(formatMessage); + await _runner.RunCodeAnalysisAsync(result, analyzer, project, paths, logger, token); + }, cancellationToken); + + var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Count > 0); + if (hasDiagnostics && codefix is object) + { + logger.LogTrace($"Applying fixes for {codefix.GetType().Name}"); + solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); + var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); + if (changedSolution.GetChanges(solution).Any()) + { + solution = changedSolution; + } } } + + return solution; } } } diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index b0eac7fc9084..c3f323082922 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Immutable; @@ -41,12 +41,16 @@ public async Task RunCodeAnalysisAsync( cancellationToken); var diagnostics = await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken); // filter diagnostics - var filteredDiagnostics = diagnostics.Where( - x => !x.IsSuppressed && - x.Severity >= DiagnosticSeverity.Warning && - x.Location.IsInSource && - formattableDocumentPaths.Contains(x.Location.SourceTree?.FilePath, StringComparer.OrdinalIgnoreCase)); - result.AddDiagnostic(project, filteredDiagnostics); + foreach (var diagnostic in diagnostics) + { + if (!diagnostic.IsSuppressed && + diagnostic.Severity >= DiagnosticSeverity.Warning && + diagnostic.Location.IsInSource && + formattableDocumentPaths.Contains(diagnostic.Location.SourceTree?.FilePath, StringComparer.OrdinalIgnoreCase)) + { + result.AddDiagnostic(project, diagnostic); + } + } } } } diff --git a/src/Analyzers/CodeAnalysisResult.cs b/src/Analyzers/CodeAnalysisResult.cs index 0551ebb294b2..5090f5a649d2 100644 --- a/src/Analyzers/CodeAnalysisResult.cs +++ b/src/Analyzers/CodeAnalysisResult.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; using NonBlocking; @@ -13,23 +11,18 @@ internal class CodeAnalysisResult private readonly ConcurrentDictionary> _dictionary = new ConcurrentDictionary>(); - internal void AddDiagnostic(Project project, IEnumerable diagnostics) + internal void AddDiagnostic(Project project, Diagnostic diagnostic) { _ = _dictionary.AddOrUpdate(project, - addValueFactory: (key) => diagnostics.ToList(), + addValueFactory: (key) => new List() { diagnostic }, updateValueFactory: (key, list) => { - list.AddRange(diagnostics); + list.Add(diagnostic); return list; }); } - public IReadOnlyDictionary> Diagnostics - => new Dictionary>( - _dictionary.Select( - x => KeyValuePair.Create( - x.Key, - x.Value.ToImmutableArray()))); - + public IReadOnlyDictionary> Diagnostics + => _dictionary; } } diff --git a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs index 4b030f3a162f..2ebf30efc05f 100644 --- a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs +++ b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs @@ -14,12 +14,13 @@ internal class RoslynCodeStyleAnalyzerFinder : IAnalyzerFinder private readonly static string s_executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); private readonly string _featuresCSharpPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.CSharp.Features.dll"); - private readonly string _featuresVisualBasicPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.CSharp.VisualBasic.dll"); + private readonly string _featuresVisualBasicPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.VisualBasic.Features.dll"); public ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers() { var analyzers = FindAllAnalyzers(); + // TODO: Match CodeFixes to the analyzers that produce the diagnostic ids they fix. return analyzers.Select(analyzer => (analyzer, (CodeFixProvider?)null)).ToImmutableArray(); } @@ -37,6 +38,7 @@ private ImmutableArray FindAllAnalyzers() private ImmutableArray FindAllCodeFixesAsync() { + // TODO: Discover CodeFixes return ImmutableArray.Empty; } diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index afdad9a04210..55652d0685f3 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -51,7 +51,7 @@ public async Task ApplyCodeFixesAsync( private class DiagnosticProvider : FixAllContext.DiagnosticProvider { private static readonly Task> EmptyDignosticResult = Task.FromResult(Enumerable.Empty()); - private readonly IReadOnlyDictionary> _diagnosticsByProject; + private readonly IReadOnlyDictionary> _diagnosticsByProject; internal DiagnosticProvider(CodeAnalysisResult analysisResult) { diff --git a/tests/Extensions/ExportProviderExtensions.cs b/tests/Extensions/ExportProviderExtensions.cs index a2ec704d2a50..1158612168d7 100644 --- a/tests/Extensions/ExportProviderExtensions.cs +++ b/tests/Extensions/ExportProviderExtensions.cs @@ -29,7 +29,7 @@ public CompositionContextShim(ExportProvider exportProvider) public override bool TryGetExport(CompositionContract contract, out object export) { var importMany = contract.MetadataConstraints.Contains(new KeyValuePair("IsImportMany", true)); - var (contractType, metadataType) = GetContractType(contract.ContractType, importMany); + var (contractType, metadataType, isArray) = GetContractType(contract.ContractType, importMany); if (metadataType != null) { @@ -41,7 +41,7 @@ where method.GetParameters().Length == 1 && method.GetParameters()[0].ParameterT var parameterizedMethod = methodInfo.MakeGenericMethod(contractType, metadataType); export = parameterizedMethod.Invoke(_exportProvider, new[] { contract.ContractName }); } - else + else if (!isArray) { var methodInfo = (from method in _exportProvider.GetType().GetTypeInfo().GetMethods() where method.Name == nameof(ExportProvider.GetExports) @@ -51,12 +51,27 @@ where method.GetParameters().Length == 1 && method.GetParameters()[0].ParameterT var parameterizedMethod = methodInfo.MakeGenericMethod(contractType); export = parameterizedMethod.Invoke(_exportProvider, new[] { contract.ContractName }); } + else + { + var methodInfo = (from method in _exportProvider.GetType().GetTypeInfo().GetMethods() + where method.Name == nameof(ExportProvider.GetExportedValues) + where method.IsGenericMethod && method.GetGenericArguments().Length == 1 + where method.GetParameters().Length == 0 + select method).Single(); + var parameterizedMethod = methodInfo.MakeGenericMethod(contractType); + export = parameterizedMethod.Invoke(_exportProvider, null); + } return true; } - private (Type exportType, Type metadataType) GetContractType(Type contractType, bool importMany) + private (Type exportType, Type metadataType, bool isArray) GetContractType(Type contractType, bool importMany) { + if (importMany && contractType.BaseType == typeof(Array)) + { + return (contractType.GetElementType(), null, true); + } + if (importMany && contractType.IsConstructedGenericType) { if (contractType.GetGenericTypeDefinition() == typeof(IList<>) @@ -71,11 +86,11 @@ where method.GetParameters().Length == 1 && method.GetParameters()[0].ParameterT { if (contractType.GetGenericTypeDefinition() == typeof(Lazy<>)) { - return (contractType.GenericTypeArguments[0], null); + return (contractType.GenericTypeArguments[0], null, false); } else if (contractType.GetGenericTypeDefinition() == typeof(Lazy<,>)) { - return (contractType.GenericTypeArguments[0], contractType.GenericTypeArguments[1]); + return (contractType.GenericTypeArguments[0], contractType.GenericTypeArguments[1], false); } else { diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index ac5efd91fbc7..69b7d8255e80 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -69,15 +69,12 @@ static AbstractFormatterTest() protected AbstractFormatterTest() { - TestState = new SolutionState(DefaultFolderPath + DefaultFilePathPrefix, DefaultFileExt); + TestState = new SolutionState(DefaultFilePathPrefix, DefaultFileExt); } /// /// Gets the language name used for the test. /// - /// - /// The language name used for the test. - /// public abstract string Language { get; } private static ILogger Logger => new TestLogger(); @@ -238,7 +235,7 @@ protected virtual Project CreateProjectImpl((string filename, SourceText content { (var newFileName, var source) = sources[i]; var documentId = DocumentId.CreateNewId(projectId, debugName: newFileName); - solution = solution.AddDocument(documentId, newFileName, source, filePath: newFileName); + solution = solution.AddDocument(documentId, newFileName, source, filePath: Path.Combine(DefaultTestProjectPath, newFileName)); } for (var i = 0; i < additionalFiles.Length; i++) diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 75cf04bc3cfe..d002e8609c02 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -17,6 +17,16 @@ + + + + + + + + + + From 49d01eb2c3d1adef3655d7b286d1a989fadb779b Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 3 Jun 2020 17:45:07 -0700 Subject: [PATCH 1043/2702] Added reflection based discovery of analyzers and fixes --- .vscode/launch.json | 19 ++++++ src/Analyzers/AnalyzerFormatter.cs | 20 +++--- src/Analyzers/Extensions.cs | 25 ++++++++ .../RoslynCodeStyleAnalyzerFinder.cs | 61 ++++++++++--------- 4 files changed, 87 insertions(+), 38 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7a7d90462eaf..e1bb23e96779 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -40,6 +40,25 @@ "console": "internalConsole", "stopAtEntry": false }, + { + "name": "format format.sln --fix-style --check", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "publish", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/publish/dotnet-format.dll", + "args": [ + "format.sln", + "--fix-style", + "-v", + "diag", + "--check" + ], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, { "name": ".NET Core Attach", "type": "coreclr", diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 8b1fb8d504f2..8838bb5ea177 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -43,7 +43,7 @@ public async Task FormatAsync( if (!options.SaveFormattedFiles) { - await LogDiagnosticsAsync(solution, formattableDocuments, options, logger, cancellationToken); + await LogDiagnosticsAsync(solution, formattableDocuments, options, logger, formattedFiles, cancellationToken); } else { @@ -55,7 +55,7 @@ public async Task FormatAsync( return solution; } - private async Task LogDiagnosticsAsync(Solution solution, ImmutableArray formattableDocuments, FormatOptions options, ILogger logger, CancellationToken cancellationToken) + private async Task LogDiagnosticsAsync(Solution solution, ImmutableArray formattableDocuments, FormatOptions options, ILogger logger, List formattedFiles, CancellationToken cancellationToken) { var pairs = _finder.GetAnalyzersAndFixers(); var paths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) @@ -66,14 +66,14 @@ private async Task LogDiagnosticsAsync(Solution solution, ImmutableArray { - await _runner.RunCodeAnalysisAsync(result, analyzers, project, paths, logger, token); - }, cancellationToken); + await _runner.RunCodeAnalysisAsync(result, analyzers, project, paths, logger, token).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false); - LogDiagnosticLocations(result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger); + LogDiagnosticLocations(result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger, formattedFiles); return; - static void LogDiagnosticLocations(IEnumerable diagnostics, string workspacePath, bool changesAreErrors, ILogger logger) + static void LogDiagnosticLocations(IEnumerable diagnostics, string workspacePath, bool changesAreErrors, ILogger logger, List formattedFiles) { var workspaceFolder = Path.GetDirectoryName(workspacePath); @@ -111,15 +111,15 @@ private async Task FixDiagnosticsAsync(Solution solution, ImmutableArr var result = new CodeAnalysisResult(); await solution.Projects.ForEachAsync(async (project, token) => { - await _runner.RunCodeAnalysisAsync(result, analyzer, project, paths, logger, token); - }, cancellationToken); + await _runner.RunCodeAnalysisAsync(result, analyzer, project, paths, logger, token).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false); var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Count > 0); if (hasDiagnostics && codefix is object) { logger.LogTrace($"Applying fixes for {codefix.GetType().Name}"); - solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); - var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken); + solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); + var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); if (changedSolution.GetChanges(solution).Any()) { solution = changedSolution; diff --git a/src/Analyzers/Extensions.cs b/src/Analyzers/Extensions.cs index c7976c95971f..8ed4de9b69e4 100644 --- a/src/Analyzers/Extensions.cs +++ b/src/Analyzers/Extensions.cs @@ -2,7 +2,9 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -21,5 +23,28 @@ public static Task ForEachAsync(this IEnumerable enumerable, public static bool Any(this SolutionChanges solutionChanges) => solutionChanges.GetProjectChanges().Any(x => x.GetChangedDocuments().Any()); + + public static bool TryCreateInstance(this Type type, [NotNullWhen(returnValue: true)] out T? instance) where T : class + { + try + { + var defaultCtor = type.GetConstructor(new Type[] { }); + + instance = defaultCtor != null + ? (T)Activator.CreateInstance( + type, + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, + binder: null, + args: null, + culture: null) + : null; + + return instance is object; + } + catch (Exception ex) + { + throw new InvalidOperationException($"Failed to create instrance of {type.FullName} in {type.AssemblyQualifiedName}.", ex); + } + } } } diff --git a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs index 2ebf30efc05f..63d6b9d4d675 100644 --- a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs +++ b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs @@ -18,42 +18,47 @@ internal class RoslynCodeStyleAnalyzerFinder : IAnalyzerFinder public ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers() { - var analyzers = FindAllAnalyzers(); - - // TODO: Match CodeFixes to the analyzers that produce the diagnostic ids they fix. - return analyzers.Select(analyzer => (analyzer, (CodeFixProvider?)null)).ToImmutableArray(); - } + var assemblies = new[] + { + _featuresCSharpPath, + _featuresVisualBasicPath + }.Select(path => Assembly.LoadFile(path)); - private ImmutableArray FindAllAnalyzers() - { - var featuresCSharpReference = new AnalyzerFileReference(_featuresCSharpPath, AssemblyLoader.Instance); - var csharpAnalyzers = featuresCSharpReference.GetAnalyzers(LanguageNames.CSharp); + // This is borrowed from omnisharp. + // see https://github.com/OmniSharp/omnisharp-roslyn/blob/62b3b52d01251fdc0564a600010936e677f24a2e/src/OmniSharp.Roslyn/Services/AbstractCodeActionProvider.cs#L26-L49 + var types = assemblies + .SelectMany(assembly => assembly.GetTypes() + .Where(type => !type.GetTypeInfo().IsInterface && + !type.GetTypeInfo().IsAbstract && + !type.GetTypeInfo().ContainsGenericParameters)); - var featuresVisualBasicReference = new AnalyzerFileReference(_featuresVisualBasicPath, AssemblyLoader.Instance); - var visualBasicAnalyzers = featuresVisualBasicReference.GetAnalyzers(LanguageNames.VisualBasic); + var codeFixProviders = types + .Where(t => typeof(CodeFixProvider).IsAssignableFrom(t)) + .Select(type => type.TryCreateInstance(out var instance) ? instance : null) + .OfType() + .ToImmutableArray(); - var allAnalyzers = csharpAnalyzers.Concat(visualBasicAnalyzers).ToImmutableArray(); - return allAnalyzers; - } + var diagnosticAnalyzers = types + .Where(t => typeof(DiagnosticAnalyzer).IsAssignableFrom(t)) + .Select(type => type.TryCreateInstance(out var instance) ? instance : null) + .OfType() + .ToImmutableArray(); - private ImmutableArray FindAllCodeFixesAsync() - { - // TODO: Discover CodeFixes - return ImmutableArray.Empty; - } + var builder = ImmutableArray.CreateBuilder<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)>(); + foreach (var diagnosticAnalyzer in diagnosticAnalyzers) + { + var diagnosticIds = diagnosticAnalyzer.SupportedDiagnostics.Select(diagnostic => diagnostic.Id).ToImmutableHashSet(); + var codeFixProvider = codeFixProviders.FirstOrDefault(codeFixProvider => codeFixProvider.FixableDiagnosticIds.Any(id => diagnosticIds.Contains(id))); - internal class AssemblyLoader : IAnalyzerAssemblyLoader - { - public static AssemblyLoader Instance = new AssemblyLoader(); + if (codeFixProvider is null) + { + continue; + } - public void AddDependencyLocation(string fullPath) - { + builder.Add((diagnosticAnalyzer, codeFixProvider)); } - public Assembly LoadFromPath(string fullPath) - { - return Assembly.LoadFrom(fullPath); - } + return builder.ToImmutableArray(); } } } From 4351b5a36c6913775b549d1e1fc6b6714ed31a97 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 4 Jun 2020 14:12:43 -0700 Subject: [PATCH 1044/2702] Bump version --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 0d0676b084d0..a2923f0c84f3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - 4 + 5 0 From 93a6396e86fb4c8a3e737ee1069e16dc562671d2 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 4 Jun 2020 17:59:15 -0700 Subject: [PATCH 1045/2702] Await refactoring --- src/FormatCommand.cs | 2 +- src/Formatters/FinalNewlineFormatter.cs | 2 +- src/Formatters/ImportsFormatter.cs | 10 +++++----- src/Formatters/WhitespaceFormatter.cs | 6 +++--- src/Workspaces/FolderWorkspace_FolderSolutionLoader.cs | 2 +- src/Workspaces/FolderWorkspace_ProjectLoader.cs | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index de44d51e7e7b..03fec21ffd7e 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -27,7 +27,7 @@ internal static RootCommand CreateCommandLineOptions() Argument = new Argument(() => null), IsHidden = true }, - new Option(new[] { "--fix-style", "-fs" }, Resources.Run_code_style_analyzer_and_apply_fixes) + new Option(new[] { "--fix-style" }, Resources.Run_code_style_analyzer_and_apply_fixes) { Argument = new Argument() }, diff --git a/src/Formatters/FinalNewlineFormatter.cs b/src/Formatters/FinalNewlineFormatter.cs index 16ba76488ac4..62678c1a7c63 100644 --- a/src/Formatters/FinalNewlineFormatter.cs +++ b/src/Formatters/FinalNewlineFormatter.cs @@ -29,7 +29,7 @@ internal override async Task FormatFileAsync( !analyzerConfigOptions.TryGetValue("insert_final_newline", out var insertFinalNewlineValue) || !bool.TryParse(insertFinalNewlineValue, out var insertFinalNewline)) { - return await document.GetTextAsync(cancellationToken); + return await document.GetTextAsync(cancellationToken).ConfigureAwait(false); } if (!EndOfLineFormatter.TryGetEndOfLine(analyzerConfigOptions, out var endOfLine)) diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/ImportsFormatter.cs index 149c61c9a34b..0bffd648696a 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/ImportsFormatter.cs @@ -32,7 +32,7 @@ internal override async Task FormatFileAsync( { try { - var organizedDocument = await Formatter.OrganizeImportsAsync(document, cancellationToken); + var organizedDocument = await Formatter.OrganizeImportsAsync(document, cancellationToken).ConfigureAwait(false); var isSameVersion = await IsSameDocumentAndVersionAsync(document, organizedDocument, cancellationToken).ConfigureAwait(false); if (isSameVersion) @@ -42,8 +42,8 @@ internal override async Task FormatFileAsync( // Because the Formatter does not abide the `end_of_line` option we have to fix up the ends of the organized lines. // See https://github.com/dotnet/roslyn/issues/44136 - var organizedSourceText = await organizedDocument.GetTextAsync(cancellationToken); - return await _endOfLineFormatter.FormatFileAsync(organizedDocument, organizedSourceText, optionSet, analyzerConfigOptions, formatOptions, logger, cancellationToken); + var organizedSourceText = await organizedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + return await _endOfLineFormatter.FormatFileAsync(organizedDocument, organizedSourceText, optionSet, analyzerConfigOptions, formatOptions, logger, cancellationToken).ConfigureAwait(false); } catch (InsufficientExecutionStackException) { @@ -66,8 +66,8 @@ private static async Task IsSameDocumentAndVersionAsync(Document a, Docume return false; } - var aVersion = await a.GetTextVersionAsync(cancellationToken); - var bVersion = await b.GetTextVersionAsync(cancellationToken); + var aVersion = await a.GetTextVersionAsync(cancellationToken).ConfigureAwait(false); + var bVersion = await b.GetTextVersionAsync(cancellationToken).ConfigureAwait(false); return aVersion == bVersion; } diff --git a/src/Formatters/WhitespaceFormatter.cs b/src/Formatters/WhitespaceFormatter.cs index 7fe18550bd6d..209149e84c22 100644 --- a/src/Formatters/WhitespaceFormatter.cs +++ b/src/Formatters/WhitespaceFormatter.cs @@ -29,11 +29,11 @@ internal override async Task FormatFileAsync( { if (formatOptions.SaveFormattedFiles) { - return await GetFormattedDocument(document, optionSet, cancellationToken); + return await GetFormattedDocument(document, optionSet, cancellationToken).ConfigureAwait(false); } else { - return await GetFormattedDocumentWithDetailedChanges(document, sourceText, optionSet, cancellationToken); + return await GetFormattedDocumentWithDetailedChanges(document, sourceText, optionSet, cancellationToken).ConfigureAwait(false); } } @@ -51,7 +51,7 @@ private static async Task GetFormattedDocument(Document document, Op /// private static async Task GetFormattedDocumentWithDetailedChanges(Document document, SourceText sourceText, OptionSet optionSet, CancellationToken cancellationToken) { - var root = await document.GetSyntaxRootAsync(cancellationToken); + var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var formattingTextChanges = Formatter.GetFormattedTextChanges(root, document.Project.Solution.Workspace, optionSet, cancellationToken); return sourceText.WithChanges(formattingTextChanges); diff --git a/src/Workspaces/FolderWorkspace_FolderSolutionLoader.cs b/src/Workspaces/FolderWorkspace_FolderSolutionLoader.cs index 3fa33eec8275..72afbba3402d 100644 --- a/src/Workspaces/FolderWorkspace_FolderSolutionLoader.cs +++ b/src/Workspaces/FolderWorkspace_FolderSolutionLoader.cs @@ -26,7 +26,7 @@ public static async Task LoadSolutionInfoAsync(string folderPath, // Create projects for each of the supported languages. foreach (var loader in ProjectLoaders) { - var projectInfo = await loader.LoadProjectInfoAsync(folderPath, fileMatcher, cancellationToken); + var projectInfo = await loader.LoadProjectInfoAsync(folderPath, fileMatcher, cancellationToken).ConfigureAwait(false); if (projectInfo is null) { continue; diff --git a/src/Workspaces/FolderWorkspace_ProjectLoader.cs b/src/Workspaces/FolderWorkspace_ProjectLoader.cs index 6b4567e5d4e9..f83619648039 100644 --- a/src/Workspaces/FolderWorkspace_ProjectLoader.cs +++ b/src/Workspaces/FolderWorkspace_ProjectLoader.cs @@ -23,7 +23,7 @@ private abstract class ProjectLoader { var projectId = ProjectId.CreateNewId(debugName: folderPath); - var documents = await LoadDocumentInfosAsync(projectId, folderPath, FileExtension, fileMatcher); + var documents = await LoadDocumentInfosAsync(projectId, folderPath, FileExtension, fileMatcher).ConfigureAwait(false); if (documents.IsDefaultOrEmpty) { return null; From 7b8edc8c54f32fee335b6f4a1296cb39018a6288 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 4 Jun 2020 18:07:19 -0700 Subject: [PATCH 1046/2702] Moved parallelism to the AnalyzerRunner --- eng/Signing.props | 11 ---- src/Analyzers/AnalyzerFormatter.cs | 75 +++++++++++++++++-------- src/Analyzers/AnalyzerRunner.cs | 16 ++++-- src/Analyzers/CodeAnalysisResult.cs | 21 ++++--- src/Analyzers/Extensions.cs | 12 ---- src/Analyzers/SolutionCodeFixApplier.cs | 6 +- src/dotnet-format.csproj | 1 - 7 files changed, 75 insertions(+), 67 deletions(-) delete mode 100644 eng/Signing.props diff --git a/eng/Signing.props b/eng/Signing.props deleted file mode 100644 index f8bf051e1b5c..000000000000 --- a/eng/Signing.props +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 8838bb5ea177..b71bdbb04636 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.Extensions.Logging; @@ -41,13 +43,25 @@ public async Task FormatAsync( var analysisStopwatch = Stopwatch.StartNew(); logger.LogTrace($"Analyzing code style."); - if (!options.SaveFormattedFiles) - { - await LogDiagnosticsAsync(solution, formattableDocuments, options, logger, formattedFiles, cancellationToken); - } - else + var analyzersAndFixers = _finder.GetAnalyzersAndFixers(); + var formattablePaths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) + .OfType().ToImmutableArray(); + + logger.LogTrace("Determining diagnostics."); + + var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, analyzersAndFixers, formattablePaths, options, logger, formattedFiles, cancellationToken).ConfigureAwait(false); + + var projectDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds; + logger.LogTrace(Resources.Complete_in_0_ms, projectDiagnosticsMS); + + if (options.SaveFormattedFiles) { - solution = await FixDiagnosticsAsync(solution, formattableDocuments, logger, cancellationToken); + logger.LogTrace("Fixing diagnostics."); + + solution = await FixDiagnosticsAsync(solution, analyzersAndFixers, projectDiagnostics, formattablePaths, logger, cancellationToken).ConfigureAwait(false); + + var fixDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds - projectDiagnosticsMS; + logger.LogTrace(Resources.Complete_in_0_ms, fixDiagnosticsMS); } logger.LogTrace("Analysis complete in {0}ms.", analysisStopwatch.ElapsedMilliseconds); @@ -55,23 +69,26 @@ public async Task FormatAsync( return solution; } - private async Task LogDiagnosticsAsync(Solution solution, ImmutableArray formattableDocuments, FormatOptions options, ILogger logger, List formattedFiles, CancellationToken cancellationToken) + private async Task>> GetProjectDiagnosticsAsync( + Solution solution, + ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> analyzersAndFixers, + ImmutableArray formattablePaths, + FormatOptions options, + ILogger logger, + List formattedFiles, + CancellationToken cancellationToken) { - var pairs = _finder.GetAnalyzersAndFixers(); - var paths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) - .OfType().ToImmutableArray(); + var analyzers = analyzersAndFixers.Select(pair => pair.Analyzer).ToImmutableArray(); - // no need to run codefixes as we won't persist the changes - var analyzers = pairs.Select(x => x.Analyzer).ToImmutableArray(); var result = new CodeAnalysisResult(); - await solution.Projects.ForEachAsync(async (project, token) => + foreach (var project in solution.Projects) { - await _runner.RunCodeAnalysisAsync(result, analyzers, project, paths, logger, token).ConfigureAwait(false); - }, cancellationToken).ConfigureAwait(false); + await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, logger, cancellationToken).ConfigureAwait(false); + } LogDiagnosticLocations(result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger, formattedFiles); - return; + return result.Diagnostics.ToImmutableDictionary(kvp => kvp.Key.Id, kvp => kvp.Value.Select(diagnostic => diagnostic.Id).ToImmutableHashSet()); static void LogDiagnosticLocations(IEnumerable diagnostics, string workspacePath, bool changesAreErrors, ILogger logger, List formattedFiles) { @@ -99,20 +116,30 @@ static void LogDiagnosticLocations(IEnumerable diagnostics, string w } } - private async Task FixDiagnosticsAsync(Solution solution, ImmutableArray formattableDocuments, ILogger logger, CancellationToken cancellationToken) + private async Task FixDiagnosticsAsync( + Solution solution, + ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> analyzersAndFixers, + ImmutableDictionary> projectDiagnostics, + ImmutableArray formattablePaths, + ILogger logger, + CancellationToken cancellationToken) { - var pairs = _finder.GetAnalyzersAndFixers(); - var paths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) - .OfType().ToImmutableArray(); + var analyzers = analyzersAndFixers.Select(pair => pair.Analyzer).ToImmutableArray(); // we need to run each codefix iteratively so ensure that all diagnostics are found and fixed - foreach (var (analyzer, codefix) in pairs) + foreach (var (analyzer, codefix) in analyzersAndFixers) { var result = new CodeAnalysisResult(); - await solution.Projects.ForEachAsync(async (project, token) => + foreach (var project in solution.Projects) { - await _runner.RunCodeAnalysisAsync(result, analyzer, project, paths, logger, token).ConfigureAwait(false); - }, cancellationToken).ConfigureAwait(false); + if (!projectDiagnostics.TryGetValue(project.Id, out var diagnosticIds) || + !analyzer.SupportedDiagnostics.Any(diagnostic => diagnosticIds.Contains(diagnostic.Id))) + { + continue; + } + + await _runner.RunCodeAnalysisAsync(result, analyzer, project, formattablePaths, logger, cancellationToken).ConfigureAwait(false); + } var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Count > 0); if (hasDiagnostics && codefix is object) diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index c3f323082922..c0a799cfea82 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -29,17 +29,21 @@ public async Task RunCodeAnalysisAsync( ILogger logger, CancellationToken cancellationToken) { - var compilation = await project.GetCompilationAsync(cancellationToken); + var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); if (compilation is null) { return; } - var analyzerCompilation = compilation.WithAnalyzers( - analyzers, - options: project.AnalyzerOptions, - cancellationToken); - var diagnostics = await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken); + var analyzerOptions = new CompilationWithAnalyzersOptions( + project.AnalyzerOptions, + onAnalyzerException: null, + concurrentAnalysis: true, + logAnalyzerExecutionTime: false, + reportSuppressedDiagnostics: false); + var analyzerCompilation = compilation.WithAnalyzers(analyzers, analyzerOptions); + var diagnostics = await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken).ConfigureAwait(false); + // filter diagnostics foreach (var diagnostic in diagnostics) { diff --git a/src/Analyzers/CodeAnalysisResult.cs b/src/Analyzers/CodeAnalysisResult.cs index 5090f5a649d2..71a91004808b 100644 --- a/src/Analyzers/CodeAnalysisResult.cs +++ b/src/Analyzers/CodeAnalysisResult.cs @@ -2,24 +2,23 @@ using System.Collections.Generic; -using NonBlocking; - namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class CodeAnalysisResult { - private readonly ConcurrentDictionary> _dictionary - = new ConcurrentDictionary>(); + private readonly Dictionary> _dictionary + = new Dictionary>(); internal void AddDiagnostic(Project project, Diagnostic diagnostic) { - _ = _dictionary.AddOrUpdate(project, - addValueFactory: (key) => new List() { diagnostic }, - updateValueFactory: (key, list) => - { - list.Add(diagnostic); - return list; - }); + if (!_dictionary.ContainsKey(project)) + { + _dictionary.Add(project, new List() { diagnostic }); + } + else + { + _dictionary[project].Add(diagnostic); + } } public IReadOnlyDictionary> Diagnostics diff --git a/src/Analyzers/Extensions.cs b/src/Analyzers/Extensions.cs index 8ed4de9b69e4..b7a0337a6670 100644 --- a/src/Analyzers/Extensions.cs +++ b/src/Analyzers/Extensions.cs @@ -1,26 +1,14 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; -using System.Threading; -using System.Threading.Tasks; namespace Microsoft.CodeAnalysis.Tools.Analyzers { public static class Extensions { - public static Task ForEachAsync(this IEnumerable enumerable, - Func action, - CancellationToken cancellationToken = default) - => Task.WhenAll(enumerable - .AsParallel() - .WithDegreeOfParallelism(Environment.ProcessorCount) - .WithCancellation(cancellationToken) - .Select(x => action(x, cancellationToken))); - public static bool Any(this SolutionChanges solutionChanges) => solutionChanges.GetProjectChanges().Any(x => x.GetChangedDocuments().Any()); diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index 55652d0685f3..2b478659f2cd 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -42,8 +42,10 @@ public async Task ApplyCodeFixesAsync( fixAllDiagnosticProvider: new DiagnosticProvider(result), cancellationToken: cancellationToken); - var action = await fixAllProvider.GetFixAsync(fixAllContext); - var operations = await (action?.GetOperationsAsync(cancellationToken) ?? Task.FromResult(ImmutableArray.Empty)); + var action = await fixAllProvider.GetFixAsync(fixAllContext).ConfigureAwait(false); + var operations = action is object + ? await action.GetOperationsAsync(cancellationToken).ConfigureAwait(false) + : ImmutableArray.Empty; var applyChangesOperation = operations.OfType().SingleOrDefault(); return applyChangesOperation?.ChangedSolution ?? solution; } diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 77f4e1460893..7d5d17d059f4 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -57,7 +57,6 @@ https://github.com/microsoft/MSBuildLocator/issues/88 --> - From 3687dd50da157f89840ae4680bff224e07c075a3 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 5 Jun 2020 10:09:16 -0700 Subject: [PATCH 1047/2702] Update roslyn sha used for integration tests --- azure-pipelines-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index 4c25d3df5bf7..cc4da34a542a 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -23,7 +23,7 @@ jobs: roslyn: _repo: "https://github.com/dotnet/roslyn" _repoName: "dotnet/roslyn" - _sha: "686fc1efbe07d0a2d47147e36677ffcb09a74edc" + _sha: "da02b3ea3c539df05d82b362e57bbe085fc1abf7" sdk: _repo: "https://github.com/dotnet/sdk" _repoName: "dotnet/sdk" @@ -57,4 +57,4 @@ jobs: displayName: Run dotnet-format on $(_repoName) solution files - script: eng\integration-test.cmd -repo '$(_repo)' -sha '$(_sha)' -testPath '$(Build.SourcesDirectory)\temp' -stage 'format-folder' - displayName: Run dotnet-format on $(_repoName) repo folder \ No newline at end of file + displayName: Run dotnet-format on $(_repoName) repo folder From 128de98f1c9dd38856a6d22814f92f28708c3ad8 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 7 Jun 2020 11:05:24 -0700 Subject: [PATCH 1048/2702] Filter analyzers by severity before adding to compilation --- src/Analyzers/AnalyzerFormatter.cs | 48 +++++- src/Analyzers/AnalyzerOptionExtensions.cs | 118 ++++++++++++++ src/Analyzers/AnalyzerRunner.cs | 7 +- src/Analyzers/Extensions.cs | 166 +++++++++++++++++++- src/Analyzers/Interfaces/IAnalyzerRunner.cs | 4 +- 5 files changed, 329 insertions(+), 14 deletions(-) create mode 100644 src/Analyzers/AnalyzerOptionExtensions.cs diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index b71bdbb04636..90034b3b1188 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -45,11 +45,14 @@ public async Task FormatAsync( var analyzersAndFixers = _finder.GetAnalyzersAndFixers(); var formattablePaths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) - .OfType().ToImmutableArray(); + .OfType().ToImmutableHashSet(); logger.LogTrace("Determining diagnostics."); - var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, analyzersAndFixers, formattablePaths, options, logger, formattedFiles, cancellationToken).ConfigureAwait(false); + var allAnalyzers = analyzersAndFixers.Select(pair => pair.Analyzer).ToImmutableArray(); + var projectAnalyzers = await FilterBySeverityAsync(solution.Projects, allAnalyzers, formattablePaths, DiagnosticSeverity.Warning, cancellationToken).ConfigureAwait(false); + + var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, options, logger, formattedFiles, cancellationToken).ConfigureAwait(false); var projectDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds; logger.LogTrace(Resources.Complete_in_0_ms, projectDiagnosticsMS); @@ -67,22 +70,53 @@ public async Task FormatAsync( logger.LogTrace("Analysis complete in {0}ms.", analysisStopwatch.ElapsedMilliseconds); return solution; + + static async Task>> FilterBySeverityAsync( + IEnumerable projects, + ImmutableArray allAnalyzers, + ImmutableHashSet formattablePaths, + DiagnosticSeverity minimumSeverity, + CancellationToken cancellationToken) + { + var projectAnalyzers = ImmutableDictionary.CreateBuilder>(); + foreach (var project in projects) + { + var analyzers = ImmutableArray.CreateBuilder(); + + foreach (var analyzer in allAnalyzers) + { + var severity = await analyzer.GetSeverityAsync(project, formattablePaths, cancellationToken).ConfigureAwait(false); + if (severity >= minimumSeverity) + { + analyzers.Add(analyzer); + } + } + + projectAnalyzers.Add(project, analyzers.ToImmutableArray()); + } + + return projectAnalyzers.ToImmutableDictionary(); + } } private async Task>> GetProjectDiagnosticsAsync( Solution solution, - ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> analyzersAndFixers, - ImmutableArray formattablePaths, + ImmutableDictionary> projectAnalyzers, + ImmutableHashSet formattablePaths, FormatOptions options, ILogger logger, List formattedFiles, CancellationToken cancellationToken) { - var analyzers = analyzersAndFixers.Select(pair => pair.Analyzer).ToImmutableArray(); - var result = new CodeAnalysisResult(); foreach (var project in solution.Projects) { + var analyzers = projectAnalyzers[project]; + if (analyzers.Length == 0) + { + continue; + } + await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, logger, cancellationToken).ConfigureAwait(false); } @@ -120,7 +154,7 @@ private async Task FixDiagnosticsAsync( Solution solution, ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> analyzersAndFixers, ImmutableDictionary> projectDiagnostics, - ImmutableArray formattablePaths, + ImmutableHashSet formattablePaths, ILogger logger, CancellationToken cancellationToken) { diff --git a/src/Analyzers/AnalyzerOptionExtensions.cs b/src/Analyzers/AnalyzerOptionExtensions.cs new file mode 100644 index 000000000000..157a558e5a65 --- /dev/null +++ b/src/Analyzers/AnalyzerOptionExtensions.cs @@ -0,0 +1,118 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Linq; + +namespace Microsoft.CodeAnalysis.Diagnostics +{ + internal static class AnalyzerOptionsExtensions + { + private const string DotnetAnalyzerDiagnosticPrefix = "dotnet_analyzer_diagnostic"; + private const string CategoryPrefix = "category"; + private const string SeveritySuffix = "severity"; + + private const string DotnetAnalyzerDiagnosticSeverityKey = DotnetAnalyzerDiagnosticPrefix + "." + SeveritySuffix; + + private static string GetCategoryBasedDotnetAnalyzerDiagnosticSeverityKey(string category) + => $"{DotnetAnalyzerDiagnosticPrefix}.{CategoryPrefix}-{category}.{SeveritySuffix}"; + + /// + /// Tries to get configured severity for the given + /// for the given from bulk configuration analyzer config options, i.e. + /// 'dotnet_analyzer_diagnostic.category-%RuleCategory%.severity = %severity%' + /// or + /// 'dotnet_analyzer_diagnostic.severity = %severity%' + /// + public static bool TryGetSeverityFromBulkConfiguration( + this AnalyzerOptions? analyzerOptions, + SyntaxTree tree, + Compilation compilation, + DiagnosticDescriptor descriptor, + out ReportDiagnostic severity) + { + // Analyzer bulk configuration does not apply to: + // 1. Disabled by default diagnostics + // 2. Compiler diagnostics + // 3. Non-configurable diagnostics + if (analyzerOptions == null || + !descriptor.IsEnabledByDefault || + descriptor.CustomTags.Any(tag => tag == WellKnownDiagnosticTags.Compiler || tag == WellKnownDiagnosticTags.NotConfigurable)) + { + severity = default; + return false; + } + + // If user has explicitly configured severity for this diagnostic ID, that should be respected and + // bulk configuration should not be applied. + // For example, 'dotnet_diagnostic.CA1000.severity = error' + if (compilation.Options.SpecificDiagnosticOptions.ContainsKey(descriptor.Id) || + tree.DiagnosticOptions.ContainsKey(descriptor.Id)) + { + severity = default; + return false; + } + + var analyzerConfigOptions = analyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(tree); + + // If user has explicitly configured default severity for the diagnostic category, that should be respected. + // For example, 'dotnet_analyzer_diagnostic.category-security.severity = error' + var categoryBasedKey = GetCategoryBasedDotnetAnalyzerDiagnosticSeverityKey(descriptor.Category); + if (analyzerConfigOptions.TryGetValue(categoryBasedKey, out var value) && + TryParseSeverity(value, out severity)) + { + return true; + } + + // Otherwise, if user has explicitly configured default severity for all analyzer diagnostics, that should be respected. + // For example, 'dotnet_analyzer_diagnostic.severity = error' + if (analyzerConfigOptions.TryGetValue(DotnetAnalyzerDiagnosticSeverityKey, out value) && + TryParseSeverity(value, out severity)) + { + return true; + } + + severity = default; + return false; + } + + internal static bool TryParseSeverity(string value, out ReportDiagnostic severity) + { + var comparer = StringComparer.OrdinalIgnoreCase; + if (comparer.Equals(value, "default")) + { + severity = ReportDiagnostic.Default; + return true; + } + else if (comparer.Equals(value, "error")) + { + severity = ReportDiagnostic.Error; + return true; + } + else if (comparer.Equals(value, "warning")) + { + severity = ReportDiagnostic.Warn; + return true; + } + else if (comparer.Equals(value, "suggestion")) + { + severity = ReportDiagnostic.Info; + return true; + } + else if (comparer.Equals(value, "silent") || comparer.Equals(value, "refactoring")) + { + severity = ReportDiagnostic.Hidden; + return true; + } + else if (comparer.Equals(value, "none")) + { + severity = ReportDiagnostic.Suppress; + return true; + } + + severity = default; + return false; + } + } +} diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index c0a799cfea82..21d8f239a37b 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -16,7 +16,7 @@ public Task RunCodeAnalysisAsync( CodeAnalysisResult result, DiagnosticAnalyzer analyzers, Project project, - ImmutableArray formattableDocumentPaths, + ImmutableHashSet formattableDocumentPaths, ILogger logger, CancellationToken cancellationToken) => RunCodeAnalysisAsync(result, ImmutableArray.Create(analyzers), project, formattableDocumentPaths, logger, cancellationToken); @@ -25,7 +25,7 @@ public async Task RunCodeAnalysisAsync( CodeAnalysisResult result, ImmutableArray analyzers, Project project, - ImmutableArray formattableDocumentPaths, + ImmutableHashSet formattableDocumentPaths, ILogger logger, CancellationToken cancellationToken) { @@ -50,7 +50,8 @@ public async Task RunCodeAnalysisAsync( if (!diagnostic.IsSuppressed && diagnostic.Severity >= DiagnosticSeverity.Warning && diagnostic.Location.IsInSource && - formattableDocumentPaths.Contains(diagnostic.Location.SourceTree?.FilePath, StringComparer.OrdinalIgnoreCase)) + diagnostic.Location.SourceTree is object && + formattableDocumentPaths.Contains(diagnostic.Location.SourceTree.FilePath)) { result.AddDiagnostic(project, diagnostic); } diff --git a/src/Analyzers/Extensions.cs b/src/Analyzers/Extensions.cs index b7a0337a6670..d56e7b5c6ed7 100644 --- a/src/Analyzers/Extensions.cs +++ b/src/Analyzers/Extensions.cs @@ -1,22 +1,43 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections; +using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.Tools.Analyzers { public static class Extensions { + private static Assembly MicrosoftCodeAnalysisFeaturesAssembly { get; } + private static Type IDEDiagnosticIdToOptionMappingHelperType { get; } + private static MethodInfo TryGetMappedOptionsMethod { get; } + + static Extensions() + { + MicrosoftCodeAnalysisFeaturesAssembly = Assembly.Load(new AssemblyName("Microsoft.CodeAnalysis.Features")); + IDEDiagnosticIdToOptionMappingHelperType = MicrosoftCodeAnalysisFeaturesAssembly.GetType("Microsoft.CodeAnalysis.Diagnostics.IDEDiagnosticIdToOptionMappingHelper"); + TryGetMappedOptionsMethod = IDEDiagnosticIdToOptionMappingHelperType.GetMethod("TryGetMappedOptions", BindingFlags.Static | BindingFlags.Public); + } + public static bool Any(this SolutionChanges solutionChanges) - => solutionChanges.GetProjectChanges().Any(x => x.GetChangedDocuments().Any()); + => solutionChanges.GetProjectChanges().Any(x => x.GetChangedDocuments().Any()); public static bool TryCreateInstance(this Type type, [NotNullWhen(returnValue: true)] out T? instance) where T : class { try { - var defaultCtor = type.GetConstructor(new Type[] { }); + var defaultCtor = type.GetConstructor( + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, + binder: null, + new Type[] { }, + modifiers: null); instance = defaultCtor != null ? (T)Activator.CreateInstance( @@ -34,5 +55,146 @@ public static bool TryCreateInstance(this Type type, [NotNullWhen(returnValue throw new InvalidOperationException($"Failed to create instrance of {type.FullName} in {type.AssemblyQualifiedName}.", ex); } } + + /// + /// Get the highest possible severity for any formattable document in the project. + /// + public static async Task GetSeverityAsync( + this DiagnosticAnalyzer analyzer, + Project project, + ImmutableHashSet formattablePaths, + CancellationToken cancellationToken) + { + var severity = DiagnosticSeverity.Hidden; + var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); + if (compilation is null) + { + return severity; + } + + foreach (var document in project.Documents) + { + // Is the document formattable? + if (document.FilePath is null || !formattablePaths.Contains(document.FilePath)) + { + continue; + } + + var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); + + var documentSeverity = analyzer.GetSeverity(document, project.AnalyzerOptions, options, compilation); + if (documentSeverity > severity) + { + severity = documentSeverity; + } + } + + return severity; + } + + private static DiagnosticSeverity GetSeverity( + this DiagnosticAnalyzer analyzer, + Document document, + AnalyzerOptions? analyzerOptions, + OptionSet options, + Compilation compilation) + { + var severity = DiagnosticSeverity.Hidden; + + if (!document.TryGetSyntaxTree(out var tree)) + { + return severity; + } + + foreach (var descriptor in analyzer.SupportedDiagnostics) + { + if (severity == DiagnosticSeverity.Error) + { + break; + } + + if (analyzerOptions.TryGetSeverityFromBulkConfiguration(tree, compilation, descriptor, out var reportDiagnostic)) + { + var configuredSeverity = ToSeverity(reportDiagnostic); + if (configuredSeverity > severity) + { + severity = configuredSeverity; + } + continue; + } + + if (TryGetSeverityFromCodeStyleOption(descriptor, compilation, options, out var codeStyleSeverity)) + { + if (codeStyleSeverity > severity) + { + severity = codeStyleSeverity; + } + continue; + } + + if (descriptor.DefaultSeverity > severity) + { + severity = descriptor.DefaultSeverity; + } + } + + return severity; + + static DiagnosticSeverity ToSeverity(ReportDiagnostic reportDiagnostic) + { + return reportDiagnostic switch + { + ReportDiagnostic.Error => DiagnosticSeverity.Error, + ReportDiagnostic.Warn => DiagnosticSeverity.Warning, + ReportDiagnostic.Info => DiagnosticSeverity.Info, + _ => DiagnosticSeverity.Hidden + }; + } + + static bool TryGetSeverityFromCodeStyleOption( + DiagnosticDescriptor descriptor, + Compilation compilation, + OptionSet options, + out DiagnosticSeverity severity) + { + severity = DiagnosticSeverity.Hidden; + + var parameters = new object?[] { descriptor.Id, compilation.Language, null }; + var result = (bool)TryGetMappedOptionsMethod.Invoke(null, parameters); + + if (!result) + { + return false; + } + + var codeStyleOptions = (IEnumerable)parameters[2]!; + foreach (var codeStyleOptionObj in codeStyleOptions) + { + IOption codeStyleOption = (IOption)codeStyleOptionObj; + var option = options.GetOption(new OptionKey(codeStyleOption, codeStyleOption.IsPerLanguage ? compilation.Language : null)); + if (option is null) + { + continue; + } + + var notificationProperty = option.GetType().GetProperty("Notification"); + if (notificationProperty is null) + { + continue; + } + + var notification = notificationProperty.GetValue(option); + var reportDiagnostic = (ReportDiagnostic)notification.GetType().GetProperty("Severity").GetValue(notification); + var codeStyleSeverity = ToSeverity(reportDiagnostic); + + if (codeStyleSeverity > severity) + { + severity = codeStyleSeverity; + } + } + + return true; + } + } } } diff --git a/src/Analyzers/Interfaces/IAnalyzerRunner.cs b/src/Analyzers/Interfaces/IAnalyzerRunner.cs index 68cf23c40211..2d264ac13493 100644 --- a/src/Analyzers/Interfaces/IAnalyzerRunner.cs +++ b/src/Analyzers/Interfaces/IAnalyzerRunner.cs @@ -14,7 +14,7 @@ Task RunCodeAnalysisAsync( CodeAnalysisResult result, DiagnosticAnalyzer analyzers, Project project, - ImmutableArray formattableDocumentPaths, + ImmutableHashSet formattableDocumentPaths, ILogger logger, CancellationToken cancellationToken); @@ -22,7 +22,7 @@ Task RunCodeAnalysisAsync( CodeAnalysisResult result, ImmutableArray analyzers, Project project, - ImmutableArray formattableDocumentPaths, + ImmutableHashSet formattableDocumentPaths, ILogger logger, CancellationToken cancellationToken); } From 577fbd194072e36a9e009365fc6db26ac91e96f0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 7 Jun 2020 14:48:23 -0700 Subject: [PATCH 1049/2702] Validate Roslyn CodeStyle. --- azure-pipelines.yml | 4 +++- validate.rsp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2ee8396e1a4b..15b01af22864 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -111,7 +111,9 @@ jobs: vmImage: 'vs2017-win2016' timeoutInMinutes: 5 steps: - - script: dotnet run --project ./src/dotnet-format.csproj -- @validate.rsp + - script: dotnet publish ./src/dotnet-format.csproj -c Release + displayName: Publish dotnet-format + - script: dotnet ./artifacts/bin/dotnet-format/Release/netcoreapp2.1/publish/dotnet-format.dll @validate.rsp displayName: Run dotnet-format - task: PublishBuildArtifacts@1 displayName: Publish Logs diff --git a/validate.rsp b/validate.rsp index 0288aac78333..a73c2fd40bb3 100644 --- a/validate.rsp +++ b/validate.rsp @@ -1,5 +1,5 @@ ---folder -. +./format.sln +--fix-style --exclude ./tests/projects/ --check From f14c03f0a5de9be22b8d4f74f19207d0fe189142 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 7 Jun 2020 17:23:21 -0700 Subject: [PATCH 1050/2702] Run DiagnosticAnalyzers from references --- .vscode/launch.json | 20 +++++ .vscode/tasks.json | 82 +++++++++--------- perf/FormattedFiles.cs | 15 +++- perf/NoFilesFormatted.cs | 15 +++- perf/RealWorldSolution.cs | 10 ++- src/Analyzers/AnalyzerFinderHelpers.cs | 83 +++++++++++++++++++ src/Analyzers/AnalyzerFormatter.cs | 71 +++++----------- .../AnalyzerReferenceAnalyzerFinder.cs | 46 ++++++++++ src/Analyzers/AnalyzerRunner.cs | 1 - src/Analyzers/Interfaces/IAnalyzerFinder.cs | 16 +++- .../RoslynCodeStyleAnalyzerFinder.cs | 62 ++++++-------- src/Analyzers/SolutionCodeFixApplier.cs | 29 +++++-- src/CodeFormatter.cs | 51 ++++++------ src/FormatCommand.cs | 6 +- src/FormatOptions.cs | 25 ++++-- src/FormatType.cs | 12 --- src/Formatters/CharsetFormatter.cs | 1 - src/Formatters/DocumentFormatter.cs | 1 - src/Formatters/EndOfLineFormatter.cs | 1 - src/Formatters/FinalNewlineFormatter.cs | 1 - src/Formatters/ICodeFormatter.cs | 2 - src/Formatters/ImportsFormatter.cs | 1 - src/Formatters/WhitespaceFormatter.cs | 1 - src/Program.cs | 19 ++++- src/dotnet-format.csproj | 5 ++ tests/CodeFormatterTests.cs | 5 +- tests/Formatters/AbstractFormatterTests.cs | 5 +- tests/Formatters/FormattedFilesTests.cs | 5 +- 28 files changed, 389 insertions(+), 202 deletions(-) create mode 100644 src/Analyzers/AnalyzerFinderHelpers.cs create mode 100644 src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs delete mode 100644 src/FormatType.cs diff --git a/.vscode/launch.json b/.vscode/launch.json index e1bb23e96779..a2d619556ab0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -59,6 +59,26 @@ "console": "internalConsole", "stopAtEntry": false }, + { + "name": "format format.sln --fix-analyzers warn --check", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "publish", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/publish/dotnet-format.dll", + "args": [ + "format.sln", + "--fix-analyzers", + "warn", + "-v", + "diag", + "--check" + ], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, { "name": ".NET Core Attach", "type": "coreclr", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 121f98c008fc..42e5fa8037b3 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,42 +1,44 @@ { - "version": "2.0.0", - "tasks": [ - { - "label": "build", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/src/dotnet-format.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "publish", - "command": "dotnet", - "type": "process", - "args": [ - "publish", - "${workspaceFolder}/src/dotnet-format.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "watch", - "command": "dotnet", - "type": "process", - "args": [ - "watch", - "run", - "${workspaceFolder}/src/dotnet-format.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - } - ] + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/src/dotnet-format.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/src/dotnet-format.csproj", + "-c", + "Debug", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/src/dotnet-format.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] } \ No newline at end of file diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index 8ba5783c7014..b5d57b377f6c 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -34,7 +34,10 @@ public void FilesFormattedFolder() workspacePath, workspaceType, LogLevel.Error, - FormatType.All, + fixCodeStyle: false, + codeStyleSeverity: DiagnosticSeverity.Error, + fixAnalyzers: false, + analyerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -51,7 +54,10 @@ public void FilesFormattedProject() workspacePath, workspaceType, LogLevel.Error, - FormatType.All, + fixCodeStyle: false, + codeStyleSeverity: DiagnosticSeverity.Error, + fixAnalyzers: false, + analyerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -68,7 +74,10 @@ public void FilesFormattedSolution() workspacePath, workspaceType, LogLevel.Error, - FormatType.All, + fixCodeStyle: false, + codeStyleSeverity: DiagnosticSeverity.Error, + fixAnalyzers: false, + analyerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index a88f05f667ad..2d66554efd9c 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -34,7 +34,10 @@ public void NoFilesFormattedFolder() workspacePath, workspaceType, LogLevel.Error, - FormatType.All, + fixCodeStyle: false, + codeStyleSeverity: DiagnosticSeverity.Error, + fixAnalyzers: false, + analyerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -51,7 +54,10 @@ public void NoFilesFormattedProject() workspacePath, workspaceType, LogLevel.Error, - FormatType.All, + fixCodeStyle: false, + codeStyleSeverity: DiagnosticSeverity.Error, + fixAnalyzers: false, + analyerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -68,7 +74,10 @@ public void NoFilesFormattedSolution() workspacePath, workspaceType, LogLevel.Error, - FormatType.All, + fixCodeStyle: false, + codeStyleSeverity: DiagnosticSeverity.Error, + fixAnalyzers: false, + analyerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index c7358d7539b9..999ba730e52b 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -36,7 +36,10 @@ public void FilesFormattedSolution() workspacePath, workspaceType, LogLevel.Error, - FormatType.All, + fixCodeStyle: false, + codeStyleSeverity: DiagnosticSeverity.Error, + fixAnalyzers: false, + analyerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -53,7 +56,10 @@ public void FilesFormattedFolder() workspacePath, workspaceType, LogLevel.Error, - FormatType.All, + fixCodeStyle: false, + codeStyleSeverity: DiagnosticSeverity.Error, + fixAnalyzers: false, + analyerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, diff --git a/src/Analyzers/AnalyzerFinderHelpers.cs b/src/Analyzers/AnalyzerFinderHelpers.cs new file mode 100644 index 000000000000..2bd8b1d3e119 --- /dev/null +++ b/src/Analyzers/AnalyzerFinderHelpers.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.Extensions.Logging; + +namespace Microsoft.CodeAnalysis.Tools.Analyzers +{ + internal static class AnalyzerFinderHelpers + { + public static ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> LoadAnalyzersAndFixers( + IEnumerable assemblies, + ILogger logger) + { + var types = assemblies + .SelectMany(assembly => assembly.GetTypes() + .Where(type => !type.GetTypeInfo().IsInterface && + !type.GetTypeInfo().IsAbstract && + !type.GetTypeInfo().ContainsGenericParameters)); + + var codeFixProviders = types + .Where(t => typeof(CodeFixProvider).IsAssignableFrom(t)) + .Select(type => type.TryCreateInstance(out var instance) ? instance : null) + .OfType() + .ToImmutableArray(); + + var diagnosticAnalyzers = types + .Where(t => typeof(DiagnosticAnalyzer).IsAssignableFrom(t)) + .Select(type => type.TryCreateInstance(out var instance) ? instance : null) + .OfType() + .ToImmutableArray(); + + var builder = ImmutableArray.CreateBuilder<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)>(); + foreach (var diagnosticAnalyzer in diagnosticAnalyzers) + { + var diagnosticIds = diagnosticAnalyzer.SupportedDiagnostics.Select(diagnostic => diagnostic.Id).ToImmutableHashSet(); + var codeFixProvider = codeFixProviders.FirstOrDefault(codeFixProvider => codeFixProvider.FixableDiagnosticIds.Any(id => diagnosticIds.Contains(id))); + + if (codeFixProvider is null) + { + continue; + } + + builder.Add((diagnosticAnalyzer, codeFixProvider)); + } + + return builder.ToImmutableArray(); + } + + public static async Task>> FilterBySeverityAsync( + IEnumerable projects, + ImmutableArray allAnalyzers, + ImmutableHashSet formattablePaths, + DiagnosticSeverity minimumSeverity, + CancellationToken cancellationToken) + { + var projectAnalyzers = ImmutableDictionary.CreateBuilder>(); + foreach (var project in projects) + { + var analyzers = ImmutableArray.CreateBuilder(); + + foreach (var analyzer in allAnalyzers) + { + var severity = await analyzer.GetSeverityAsync(project, formattablePaths, cancellationToken).ConfigureAwait(false); + if (severity >= minimumSeverity) + { + analyzers.Add(analyzer); + } + } + + projectAnalyzers.Add(project, analyzers.ToImmutableArray()); + } + + return projectAnalyzers.ToImmutableDictionary(); + } + } +} diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 90034b3b1188..461830f265bd 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -16,17 +16,18 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class AnalyzerFormatter : ICodeFormatter { - public FormatType FormatType => FormatType.CodeStyle; - + private readonly string _name; private readonly IAnalyzerFinder _finder; private readonly IAnalyzerRunner _runner; private readonly ICodeFixApplier _applier; public AnalyzerFormatter( + string name, IAnalyzerFinder finder, IAnalyzerRunner runner, ICodeFixApplier applier) { + _name = name; _finder = finder; _runner = runner; _applier = applier; @@ -35,68 +36,43 @@ public AnalyzerFormatter( public async Task FormatAsync( Solution solution, ImmutableArray formattableDocuments, - FormatOptions options, + FormatOptions formatOptions, ILogger logger, List formattedFiles, CancellationToken cancellationToken) { + var analyzersAndFixers = _finder.GetAnalyzersAndFixers(solution, formatOptions, logger); + if (analyzersAndFixers.Length == 0) + { + return solution; + } + var analysisStopwatch = Stopwatch.StartNew(); - logger.LogTrace($"Analyzing code style."); + logger.LogTrace($"Running {_name} analysis."); - var analyzersAndFixers = _finder.GetAnalyzersAndFixers(); var formattablePaths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) - .OfType().ToImmutableHashSet(); + .OfType().ToImmutableHashSet(); - logger.LogTrace("Determining diagnostics."); + logger.LogTrace("Determining diagnostics..."); var allAnalyzers = analyzersAndFixers.Select(pair => pair.Analyzer).ToImmutableArray(); - var projectAnalyzers = await FilterBySeverityAsync(solution.Projects, allAnalyzers, formattablePaths, DiagnosticSeverity.Warning, cancellationToken).ConfigureAwait(false); + var projectAnalyzers = await _finder.FilterBySeverityAsync(solution.Projects, allAnalyzers, formattablePaths, formatOptions, cancellationToken).ConfigureAwait(false); - var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, options, logger, formattedFiles, cancellationToken).ConfigureAwait(false); + var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, formatOptions, logger, formattedFiles, cancellationToken).ConfigureAwait(false); var projectDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds; logger.LogTrace(Resources.Complete_in_0_ms, projectDiagnosticsMS); - if (options.SaveFormattedFiles) - { - logger.LogTrace("Fixing diagnostics."); + logger.LogTrace("Fixing diagnostics..."); - solution = await FixDiagnosticsAsync(solution, analyzersAndFixers, projectDiagnostics, formattablePaths, logger, cancellationToken).ConfigureAwait(false); + solution = await FixDiagnosticsAsync(solution, analyzersAndFixers, projectDiagnostics, formattablePaths, logger, cancellationToken).ConfigureAwait(false); - var fixDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds - projectDiagnosticsMS; - logger.LogTrace(Resources.Complete_in_0_ms, fixDiagnosticsMS); - } + var fixDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds - projectDiagnosticsMS; + logger.LogTrace(Resources.Complete_in_0_ms, fixDiagnosticsMS); logger.LogTrace("Analysis complete in {0}ms.", analysisStopwatch.ElapsedMilliseconds); return solution; - - static async Task>> FilterBySeverityAsync( - IEnumerable projects, - ImmutableArray allAnalyzers, - ImmutableHashSet formattablePaths, - DiagnosticSeverity minimumSeverity, - CancellationToken cancellationToken) - { - var projectAnalyzers = ImmutableDictionary.CreateBuilder>(); - foreach (var project in projects) - { - var analyzers = ImmutableArray.CreateBuilder(); - - foreach (var analyzer in allAnalyzers) - { - var severity = await analyzer.GetSeverityAsync(project, formattablePaths, cancellationToken).ConfigureAwait(false); - if (severity >= minimumSeverity) - { - analyzers.Add(analyzer); - } - } - - projectAnalyzers.Add(project, analyzers.ToImmutableArray()); - } - - return projectAnalyzers.ToImmutableDictionary(); - } } private async Task>> GetProjectDiagnosticsAsync( @@ -120,11 +96,11 @@ private async Task>> Get await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, logger, cancellationToken).ConfigureAwait(false); } - LogDiagnosticLocations(result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger, formattedFiles); + LogDiagnosticLocations(solution, result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger, formattedFiles); return result.Diagnostics.ToImmutableDictionary(kvp => kvp.Key.Id, kvp => kvp.Value.Select(diagnostic => diagnostic.Id).ToImmutableHashSet()); - static void LogDiagnosticLocations(IEnumerable diagnostics, string workspacePath, bool changesAreErrors, ILogger logger, List formattedFiles) + static void LogDiagnosticLocations(Solution solution, IEnumerable diagnostics, string workspacePath, bool changesAreErrors, ILogger logger, List formattedFiles) { var workspaceFolder = Path.GetDirectoryName(workspacePath); @@ -132,11 +108,13 @@ static void LogDiagnosticLocations(IEnumerable diagnostics, string w { var message = diagnostic.GetMessage(); var filePath = diagnostic.Location.SourceTree?.FilePath; + var document = solution.GetDocument(diagnostic.Location.SourceTree); var mappedLineSpan = diagnostic.Location.GetMappedLineSpan(); var changePosition = mappedLineSpan.StartLinePosition; var formatMessage = $"{Path.GetRelativePath(workspaceFolder, filePath)}({changePosition.Line + 1},{changePosition.Character + 1}): {message}"; + formattedFiles.Add(new FormattedFile(document!, new[] { new FileChange(changePosition, message) })); if (changesAreErrors) { @@ -158,8 +136,6 @@ private async Task FixDiagnosticsAsync( ILogger logger, CancellationToken cancellationToken) { - var analyzers = analyzersAndFixers.Select(pair => pair.Analyzer).ToImmutableArray(); - // we need to run each codefix iteratively so ensure that all diagnostics are found and fixed foreach (var (analyzer, codefix) in analyzersAndFixers) { @@ -178,7 +154,6 @@ private async Task FixDiagnosticsAsync( var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Count > 0); if (hasDiagnostics && codefix is object) { - logger.LogTrace($"Applying fixes for {codefix.GetType().Name}"); solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); if (changedSolution.GetChanges(solution).Any()) diff --git a/src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs b/src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs new file mode 100644 index 000000000000..74edc62eb525 --- /dev/null +++ b/src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.Extensions.Logging; + +namespace Microsoft.CodeAnalysis.Tools.Analyzers +{ + internal class AnalyzerReferenceAnalyzerFinder : IAnalyzerFinder + { + public ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers( + Solution solution, + FormatOptions formatOptions, + ILogger logger) + { + if (!formatOptions.FixAnalyzers) + { + return ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)>.Empty; + } + + var assemblies = solution.Projects + .SelectMany(project => project.AnalyzerReferences.Select(reference => reference.FullPath)) + .Distinct() + .Select(path => Assembly.LoadFrom(path)); + + return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies, logger); + } + + public Task>> FilterBySeverityAsync( + IEnumerable projects, + ImmutableArray allAnalyzers, + ImmutableHashSet formattablePaths, + FormatOptions formatOptions, + CancellationToken cancellationToken) + { + return AnalyzerFinderHelpers.FilterBySeverityAsync(projects, allAnalyzers, formattablePaths, formatOptions.AnalyzerSeverity, cancellationToken); + } + } +} diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index 21d8f239a37b..df15f858ab3e 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Immutable; using System.Linq; using System.Threading; diff --git a/src/Analyzers/Interfaces/IAnalyzerFinder.cs b/src/Analyzers/Interfaces/IAnalyzerFinder.cs index 81e5835d959b..fe6a7f3bc63c 100644 --- a/src/Analyzers/Interfaces/IAnalyzerFinder.cs +++ b/src/Analyzers/Interfaces/IAnalyzerFinder.cs @@ -1,13 +1,27 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System.Collections.Generic; using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Analyzers { interface IAnalyzerFinder { - ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers(); + ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers( + Solution solution, + FormatOptions formatOptions, + ILogger logger); + + Task>> FilterBySeverityAsync( + IEnumerable projects, + ImmutableArray allAnalyzers, + ImmutableHashSet formattablePaths, + FormatOptions formatOptions, + CancellationToken cancellationToken); } } diff --git a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs index 63d6b9d4d675..fea651ba5f14 100644 --- a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs +++ b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs @@ -1,64 +1,52 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using System.Linq; using System.Reflection; +using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class RoslynCodeStyleAnalyzerFinder : IAnalyzerFinder { - private readonly static string s_executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + private static readonly string s_executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); private readonly string _featuresCSharpPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.CSharp.Features.dll"); private readonly string _featuresVisualBasicPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.VisualBasic.Features.dll"); - public ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers() + public ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers( + Solution solution, + FormatOptions options, + ILogger logger) { + if (!options.FixCodeStyle) + { + return ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)>.Empty; + } + var assemblies = new[] { _featuresCSharpPath, _featuresVisualBasicPath - }.Select(path => Assembly.LoadFile(path)); - - // This is borrowed from omnisharp. - // see https://github.com/OmniSharp/omnisharp-roslyn/blob/62b3b52d01251fdc0564a600010936e677f24a2e/src/OmniSharp.Roslyn/Services/AbstractCodeActionProvider.cs#L26-L49 - var types = assemblies - .SelectMany(assembly => assembly.GetTypes() - .Where(type => !type.GetTypeInfo().IsInterface && - !type.GetTypeInfo().IsAbstract && - !type.GetTypeInfo().ContainsGenericParameters)); - - var codeFixProviders = types - .Where(t => typeof(CodeFixProvider).IsAssignableFrom(t)) - .Select(type => type.TryCreateInstance(out var instance) ? instance : null) - .OfType() - .ToImmutableArray(); - - var diagnosticAnalyzers = types - .Where(t => typeof(DiagnosticAnalyzer).IsAssignableFrom(t)) - .Select(type => type.TryCreateInstance(out var instance) ? instance : null) - .OfType() - .ToImmutableArray(); + }.Select(path => Assembly.LoadFrom(path)); - var builder = ImmutableArray.CreateBuilder<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)>(); - foreach (var diagnosticAnalyzer in diagnosticAnalyzers) - { - var diagnosticIds = diagnosticAnalyzer.SupportedDiagnostics.Select(diagnostic => diagnostic.Id).ToImmutableHashSet(); - var codeFixProvider = codeFixProviders.FirstOrDefault(codeFixProvider => codeFixProvider.FixableDiagnosticIds.Any(id => diagnosticIds.Contains(id))); - - if (codeFixProvider is null) - { - continue; - } - - builder.Add((diagnosticAnalyzer, codeFixProvider)); - } + return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies, logger); + } - return builder.ToImmutableArray(); + public Task>> FilterBySeverityAsync( + IEnumerable projects, + ImmutableArray allAnalyzers, + ImmutableHashSet formattablePaths, + FormatOptions formatOptions, + CancellationToken cancellationToken) + { + return AnalyzerFinderHelpers.FilterBySeverityAsync(projects, allAnalyzers, formattablePaths, formatOptions.CodeStyleSeverity, cancellationToken); } } } diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index 2b478659f2cd..83e93669d2c1 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -21,10 +21,13 @@ public async Task ApplyCodeFixesAsync( ILogger logger, CancellationToken cancellationToken) { + var diagnosticId = result.Diagnostics.FirstOrDefault().Value.FirstOrDefault()?.Id; + var fixAllProvider = codeFix.GetFixAllProvider(); - if (!fixAllProvider.GetSupportedFixAllScopes().Contains(FixAllScope.Solution)) + if (fixAllProvider?.GetSupportedFixAllScopes()?.Contains(FixAllScope.Solution) != true) { - throw new InvalidOperationException($"Code fix {codeFix.GetType()} doesn't support Fix All in Solution"); + logger.LogWarning($"Unable to fix {diagnosticId}. Code fix {codeFix.GetType().Name} doesn't support Fix All in Solution."); + return solution; } var project = solution.Projects.FirstOrDefault(); @@ -42,17 +45,25 @@ public async Task ApplyCodeFixesAsync( fixAllDiagnosticProvider: new DiagnosticProvider(result), cancellationToken: cancellationToken); - var action = await fixAllProvider.GetFixAsync(fixAllContext).ConfigureAwait(false); - var operations = action is object - ? await action.GetOperationsAsync(cancellationToken).ConfigureAwait(false) - : ImmutableArray.Empty; - var applyChangesOperation = operations.OfType().SingleOrDefault(); - return applyChangesOperation?.ChangedSolution ?? solution; + try + { + var action = await fixAllProvider.GetFixAsync(fixAllContext).ConfigureAwait(false); + var operations = action is object + ? await action.GetOperationsAsync(cancellationToken).ConfigureAwait(false) + : ImmutableArray.Empty; + var applyChangesOperation = operations.OfType().SingleOrDefault(); + return applyChangesOperation?.ChangedSolution ?? solution; + } + catch (Exception ex) + { + logger.LogWarning($"Failed to apply code fix {codeFix?.GetType().Name} for {diagnosticId}: {ex.Message}"); + return solution; + } } private class DiagnosticProvider : FixAllContext.DiagnosticProvider { - private static readonly Task> EmptyDignosticResult = Task.FromResult(Enumerable.Empty()); + private static Task> EmptyDignosticResult => Task.FromResult(Enumerable.Empty()); private readonly IReadOnlyDictionary> _diagnosticsByProject; internal DiagnosticProvider(CodeAnalysisResult analysisResult) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index a5308a0cb1b3..6dd7a76f0b0a 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -29,27 +29,27 @@ internal static class CodeFormatter new EndOfLineFormatter(), new CharsetFormatter(), new ImportsFormatter(), - new AnalyzerFormatter(new RoslynCodeStyleAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), + new AnalyzerFormatter("Code Style", new RoslynCodeStyleAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), + new AnalyzerFormatter("Analyzer Reference", new AnalyzerReferenceAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), }.ToImmutableArray(); public static async Task FormatWorkspaceAsync( - FormatOptions options, + FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, bool createBinaryLog = false) { - var (workspaceFilePath, workspaceType, logLevel, _, saveFormattedFiles, _, fileMatcher, reportPath, includeGeneratedFiles) = options; - var logWorkspaceWarnings = logLevel == LogLevel.Trace; + var logWorkspaceWarnings = formatOptions.LogLevel == LogLevel.Trace; - logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, workspaceFilePath)); + logger.LogInformation(string.Format(Resources.Formatting_code_files_in_workspace_0, formatOptions.WorkspaceFilePath)); logger.LogTrace(Resources.Loading_workspace); var workspaceStopwatch = Stopwatch.StartNew(); - using var workspace = workspaceType == WorkspaceType.Folder - ? await OpenFolderWorkspaceAsync(workspaceFilePath, fileMatcher, cancellationToken).ConfigureAwait(false) - : await OpenMSBuildWorkspaceAsync(workspaceFilePath, workspaceType, createBinaryLog, logWorkspaceWarnings, logger, cancellationToken).ConfigureAwait(false); + using var workspace = formatOptions.WorkspaceType == WorkspaceType.Folder + ? await OpenFolderWorkspaceAsync(formatOptions.WorkspaceFilePath, formatOptions.FileMatcher, cancellationToken).ConfigureAwait(false) + : await OpenMSBuildWorkspaceAsync(formatOptions.WorkspaceFilePath, formatOptions.WorkspaceType, createBinaryLog, logWorkspaceWarnings, logger, cancellationToken).ConfigureAwait(false); if (workspace is null) { @@ -59,13 +59,13 @@ public static async Task FormatWorkspaceAsync( var loadWorkspaceMS = workspaceStopwatch.ElapsedMilliseconds; logger.LogTrace(Resources.Complete_in_0_ms, workspaceStopwatch.ElapsedMilliseconds); - var projectPath = workspaceType == WorkspaceType.Project ? workspaceFilePath : string.Empty; + var projectPath = formatOptions.WorkspaceType == WorkspaceType.Project ? formatOptions.WorkspaceFilePath : string.Empty; var solution = workspace.CurrentSolution; logger.LogTrace(Resources.Determining_formattable_files); var (fileCount, formatableFiles) = await DetermineFormattableFilesAsync( - solution, projectPath, fileMatcher, includeGeneratedFiles, logger, cancellationToken).ConfigureAwait(false); + solution, projectPath, formatOptions.FileMatcher, formatOptions.IncludeGeneratedFiles, logger, cancellationToken).ConfigureAwait(false); var determineFilesMS = workspaceStopwatch.ElapsedMilliseconds - loadWorkspaceMS; logger.LogTrace(Resources.Complete_in_0_ms, determineFilesMS); @@ -74,7 +74,7 @@ public static async Task FormatWorkspaceAsync( var formattedFiles = new List(); var formattedSolution = await RunCodeFormattersAsync( - solution, formatableFiles, options, logger, formattedFiles, cancellationToken).ConfigureAwait(false); + solution, formatableFiles, formatOptions, logger, formattedFiles, cancellationToken).ConfigureAwait(false); var formatterRanMS = workspaceStopwatch.ElapsedMilliseconds - loadWorkspaceMS - determineFilesMS; logger.LogTrace(Resources.Complete_in_0_ms, formatterRanMS); @@ -88,7 +88,9 @@ public static async Task FormatWorkspaceAsync( { var changedDocument = solution.GetDocument(changedDocumentId); if (changedDocument?.FilePath is null) + { continue; + } logger.LogInformation(Resources.Formatted_code_file_0, changedDocument.FilePath); filesFormatted++; @@ -97,15 +99,15 @@ public static async Task FormatWorkspaceAsync( var exitCode = 0; - if (saveFormattedFiles && !workspace.TryApplyChanges(formattedSolution)) + if (formatOptions.SaveFormattedFiles && !workspace.TryApplyChanges(formattedSolution)) { logger.LogError(Resources.Failed_to_save_formatting_changes); exitCode = 1; } - if (exitCode == 0 && !string.IsNullOrWhiteSpace(reportPath)) + if (exitCode == 0 && !string.IsNullOrWhiteSpace(formatOptions.ReportPath)) { - var reportFilePath = GetReportFilePath(reportPath!); // IsNullOrEmpty is not annotated on .NET Core 2.1 + var reportFilePath = GetReportFilePath(formatOptions.ReportPath!); // IsNullOrEmpty is not annotated on .NET Core 2.1 var reportFolderPath = Path.GetDirectoryName(reportFilePath); if (!Directory.Exists(reportFolderPath)) @@ -236,7 +238,7 @@ static void LogWorkspaceDiagnostics(ILogger logger, bool logWorkspaceWarnings, I private static async Task RunCodeFormattersAsync( Solution solution, ImmutableArray formattableDocuments, - FormatOptions options, + FormatOptions formatOptions, ILogger logger, List formattedFiles, CancellationToken cancellationToken) @@ -245,24 +247,19 @@ private static async Task RunCodeFormattersAsync( foreach (var codeFormatter in s_codeFormatters) { - if (!options.FormatType.HasFlag(codeFormatter.FormatType)) - { - continue; - } - - formattedSolution = await codeFormatter.FormatAsync(formattedSolution, formattableDocuments, options, logger, formattedFiles, cancellationToken).ConfigureAwait(false); + formattedSolution = await codeFormatter.FormatAsync(formattedSolution, formattableDocuments, formatOptions, logger, formattedFiles, cancellationToken).ConfigureAwait(false); } return formattedSolution; } internal static async Task<(int, ImmutableArray)> DetermineFormattableFilesAsync( - Solution solution, - string projectPath, - Matcher fileMatcher, - bool includeGeneratedFiles, - ILogger logger, - CancellationToken cancellationToken) + Solution solution, + string projectPath, + Matcher fileMatcher, + bool includeGeneratedFiles, + ILogger logger, + CancellationToken cancellationToken) { var totalFileCount = solution.Projects.Sum(project => project.DocumentIds.Count); var projectFileCount = 0; diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 03fec21ffd7e..97c0239b7c8d 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -29,7 +29,11 @@ internal static RootCommand CreateCommandLineOptions() }, new Option(new[] { "--fix-style" }, Resources.Run_code_style_analyzer_and_apply_fixes) { - Argument = new Argument() + Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne } + }, + new Option(new[] { "--fix-analyzers" }, Resources.Run_code_style_analyzer_and_apply_fixes) + { + Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne } }, new Option(new[] { "--include", "--files" }, Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) { diff --git a/src/FormatOptions.cs b/src/FormatOptions.cs index 07a14db45224..597fe4547b44 100644 --- a/src/FormatOptions.cs +++ b/src/FormatOptions.cs @@ -10,7 +10,10 @@ internal class FormatOptions public string WorkspaceFilePath { get; } public WorkspaceType WorkspaceType { get; } public LogLevel LogLevel { get; } - public FormatType FormatType { get; } + public bool FixCodeStyle { get; } + public DiagnosticSeverity CodeStyleSeverity { get; } + public bool FixAnalyzers { get; } + public DiagnosticSeverity AnalyzerSeverity { get; } public bool SaveFormattedFiles { get; } public bool ChangesAreErrors { get; } public Matcher FileMatcher { get; } @@ -21,7 +24,10 @@ public FormatOptions( string workspaceFilePath, WorkspaceType workspaceType, LogLevel logLevel, - FormatType formatType, + bool fixCodeStyle, + DiagnosticSeverity codeStyleSeverity, + bool fixAnalyzers, + DiagnosticSeverity analyerSeverity, bool saveFormattedFiles, bool changesAreErrors, Matcher fileMatcher, @@ -31,7 +37,10 @@ public FormatOptions( WorkspaceFilePath = workspaceFilePath; WorkspaceType = workspaceType; LogLevel = logLevel; - FormatType = formatType; + FixCodeStyle = fixCodeStyle; + CodeStyleSeverity = codeStyleSeverity; + FixAnalyzers = fixAnalyzers; + AnalyzerSeverity = analyerSeverity; SaveFormattedFiles = saveFormattedFiles; ChangesAreErrors = changesAreErrors; FileMatcher = fileMatcher; @@ -43,7 +52,10 @@ public void Deconstruct( out string workspaceFilePath, out WorkspaceType workspaceType, out LogLevel logLevel, - out FormatType formatType, + out bool fixCodeStyle, + out DiagnosticSeverity codeStyleSeverity, + out bool fixAnalyzers, + out DiagnosticSeverity analyerSeverity, out bool saveFormattedFiles, out bool changesAreErrors, out Matcher fileMatcher, @@ -53,7 +65,10 @@ public void Deconstruct( workspaceFilePath = WorkspaceFilePath; workspaceType = WorkspaceType; logLevel = LogLevel; - formatType = FormatType; + fixCodeStyle = FixCodeStyle; + codeStyleSeverity = CodeStyleSeverity; + fixAnalyzers = FixAnalyzers; + analyerSeverity = AnalyzerSeverity; saveFormattedFiles = SaveFormattedFiles; changesAreErrors = ChangesAreErrors; fileMatcher = FileMatcher; diff --git a/src/FormatType.cs b/src/FormatType.cs deleted file mode 100644 index b8638ab70549..000000000000 --- a/src/FormatType.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; - -[Flags] -public enum FormatType -{ - None = 0, - Whitespace = 1, - CodeStyle = 2, - All = Whitespace | CodeStyle -} diff --git a/src/Formatters/CharsetFormatter.cs b/src/Formatters/CharsetFormatter.cs index 45eaad25740b..3851da7fbf53 100644 --- a/src/Formatters/CharsetFormatter.cs +++ b/src/Formatters/CharsetFormatter.cs @@ -15,7 +15,6 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { internal sealed class CharsetFormatter : DocumentFormatter { - public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_file_encoding; private static Encoding Utf8 => new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index a313056b22e8..ae32adbf4226 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -18,7 +18,6 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters /// internal abstract class DocumentFormatter : ICodeFormatter { - public abstract FormatType FormatType { get; } protected abstract string FormatWarningDescription { get; } /// diff --git a/src/Formatters/EndOfLineFormatter.cs b/src/Formatters/EndOfLineFormatter.cs index 69a1407e7373..0537e1c20935 100644 --- a/src/Formatters/EndOfLineFormatter.cs +++ b/src/Formatters/EndOfLineFormatter.cs @@ -13,7 +13,6 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { internal sealed class EndOfLineFormatter : DocumentFormatter { - public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_end_of_line_marker; internal override Task FormatFileAsync( diff --git a/src/Formatters/FinalNewlineFormatter.cs b/src/Formatters/FinalNewlineFormatter.cs index 62678c1a7c63..10e8664e17f1 100644 --- a/src/Formatters/FinalNewlineFormatter.cs +++ b/src/Formatters/FinalNewlineFormatter.cs @@ -13,7 +13,6 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { internal sealed class FinalNewlineFormatter : DocumentFormatter { - public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_final_newline; internal override async Task FormatFileAsync( diff --git a/src/Formatters/ICodeFormatter.cs b/src/Formatters/ICodeFormatter.cs index 06bc7beff508..fa0b67db69de 100644 --- a/src/Formatters/ICodeFormatter.cs +++ b/src/Formatters/ICodeFormatter.cs @@ -10,8 +10,6 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { internal interface ICodeFormatter { - FormatType FormatType { get; } - /// /// Applies formatting and returns a formatted . /// diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/ImportsFormatter.cs index 0bffd648696a..76ab78af3498 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/ImportsFormatter.cs @@ -17,7 +17,6 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters /// internal sealed class ImportsFormatter : DocumentFormatter { - public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_imports_ordering; private readonly DocumentFormatter _endOfLineFormatter = new EndOfLineFormatter(); diff --git a/src/Formatters/WhitespaceFormatter.cs b/src/Formatters/WhitespaceFormatter.cs index 209149e84c22..382feb9615c9 100644 --- a/src/Formatters/WhitespaceFormatter.cs +++ b/src/Formatters/WhitespaceFormatter.cs @@ -15,7 +15,6 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters /// internal sealed class WhitespaceFormatter : DocumentFormatter { - public override FormatType FormatType => FormatType.Whitespace; protected override string FormatWarningDescription => Resources.Fix_whitespace_formatting; internal override async Task FormatFileAsync( diff --git a/src/Program.cs b/src/Program.cs index 8ed483cacaa0..af04275a3cee 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -43,7 +43,8 @@ public static async Task Run( string? project, string? folder, string? workspace, - bool fixStyle, + string? fixStyle, + string? fixAnalyzers, string? verbosity, bool check, string[] include, @@ -154,7 +155,10 @@ public static async Task Run( workspacePath, workspaceType, logLevel, - fixStyle ? FormatType.All : FormatType.Whitespace, + fixCodeStyle: s_parseResult.WasOptionUsed("--fix-style"), + codeStyleSeverity: GetSeverity(fixStyle ?? "error"), + fixAnalyzers: s_parseResult.WasOptionUsed("--fix-analyzers"), + analyerSeverity: GetSeverity(fixAnalyzers ?? "error"), saveFormattedFiles: !check, changesAreErrors: check, fileMatcher, @@ -221,6 +225,17 @@ internal static LogLevel GetLogLevel(string? verbosity) } } + internal static DiagnosticSeverity GetSeverity(string? severity) + { + return severity?.ToLowerInvariant() switch + { + "error" => DiagnosticSeverity.Error, + "warn" => DiagnosticSeverity.Warning, + "info" => DiagnosticSeverity.Info, + _ => throw new ArgumentOutOfRangeException(nameof(severity)), + }; + } + private static ILogger SetupLogging(IConsole console, LogLevel logLevel) { var serviceCollection = new ServiceCollection(); diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 7d5d17d059f4..27af88192de2 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -52,6 +52,11 @@ + + all + analyzers + + - 2.0.0-beta1.20104.2 - 0.3.0-alpha.20104.2 + 2.0.0-beta1.20303.1 + 0.3.0-alpha.20303.1 $(MicrosoftBuildVersion) 1.2.6 1.0.1-beta1.20114.4 From 06c079d4ad183e820a31fdedf03114981acc98f0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 8 Jun 2020 13:05:56 -0700 Subject: [PATCH 1054/2702] Expect an error for each --workspace option --- tests/ProgramTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 32250b123491..0360dd79e425 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -205,7 +205,7 @@ public void CommandLine_InvalidArgumentsDontCrashTheValidators() var result = sut.Parse(new[] { "--workspace", "workspace1", "--workspace", "workspace2" }); // Assert - Assert.Equal(1, result.Errors.Count); + Assert.Equal(2, result.Errors.Count); } } } From f0f1532dba15a58b965e63f55f4a3c65596168ed Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 8 Jun 2020 13:27:01 -0700 Subject: [PATCH 1055/2702] Only run Imports formatter when is has configuration in the .editorconfig --- CHANGELOG.md | 4 ++++ eng/Versions.props | 2 +- src/Formatters/CharsetFormatter.cs | 7 +++---- src/Formatters/DocumentFormatter.cs | 4 ++-- src/Formatters/EndOfLineFormatter.cs | 7 +++---- src/Formatters/FinalNewlineFormatter.cs | 5 ++--- src/Formatters/ImportsFormatter.cs | 9 ++++++++- src/Formatters/WhitespaceFormatter.cs | 2 +- tests/Formatters/ImportsFormatterTests.cs | 20 ++++++++++++++++++++ 9 files changed, 44 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e4657e4a473..4428428caa68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All changes to the project will be documented in this file. +## [4.1.x] - Not yet released +- [Remove the 255 argument limit for OneOrMany options such as --include and --exclude(700)](https://www.github.com/dotnet/roslyn/pull/700) +- [Only run Imports formatter when is has configuration in the .editorconfig(701)](https://www.github.com/dotnet/roslyn/pull/701) + ## [4.0.130203] - 2020-06-01 [View Complete Diff of Changes](https://www.github.com/dotnet/format/compare/3f2b20c65d32a59ca6bbc68b788a31ed38576d8e...f772fc306ff4b70cabebbea76beba9cdfd7ecb80) ### Breaking Changes: diff --git a/eng/Versions.props b/eng/Versions.props index a13c25f0f9db..26dc2a03b3e1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,7 +2,7 @@ 4 - 0 + 1 diff --git a/src/Formatters/CharsetFormatter.cs b/src/Formatters/CharsetFormatter.cs index 3851da7fbf53..07f13063ee9b 100644 --- a/src/Formatters/CharsetFormatter.cs +++ b/src/Formatters/CharsetFormatter.cs @@ -24,7 +24,7 @@ internal override Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, - AnalyzerConfigOptions? analyzerConfigOptions, + AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) @@ -67,10 +67,9 @@ private static byte[] GetEncodedBytes(string text, Encoding encoding) return stream.ToArray(); } - private static bool TryGetCharset(AnalyzerConfigOptions? analyzerConfigOptions, [NotNullWhen(true)] out Encoding? encoding) + private static bool TryGetCharset(AnalyzerConfigOptions analyzerConfigOptions, [NotNullWhen(true)] out Encoding? encoding) { - if (analyzerConfigOptions is object && - analyzerConfigOptions.TryGetValue("charset", out var charsetOption)) + if (analyzerConfigOptions.TryGetValue("charset", out var charsetOption)) { encoding = GetCharset(charsetOption); return true; diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index ae32adbf4226..412ca1a0f3e7 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -42,7 +42,7 @@ internal abstract Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, - AnalyzerConfigOptions? analyzerConfigOptions, + AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken); @@ -91,7 +91,7 @@ internal abstract Task FormatFileAsync( private async Task<(SourceText originalText, SourceText? formattedText)> GetFormattedSourceTextAsync( Document document, OptionSet optionSet, - AnalyzerConfigOptions? analyzerConfigOptions, + AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) diff --git a/src/Formatters/EndOfLineFormatter.cs b/src/Formatters/EndOfLineFormatter.cs index 0537e1c20935..746fb56f25a7 100644 --- a/src/Formatters/EndOfLineFormatter.cs +++ b/src/Formatters/EndOfLineFormatter.cs @@ -19,7 +19,7 @@ internal override Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, - AnalyzerConfigOptions? analyzerConfigOptions, + AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) @@ -58,10 +58,9 @@ internal override Task FormatFileAsync( }); } - public static bool TryGetEndOfLine(AnalyzerConfigOptions? analyzerConfigOptions, [NotNullWhen(true)] out string? endOfLine) + public static bool TryGetEndOfLine(AnalyzerConfigOptions analyzerConfigOptions, [NotNullWhen(true)] out string? endOfLine) { - if (analyzerConfigOptions is object && - analyzerConfigOptions.TryGetValue("end_of_line", out var endOfLineOption)) + if (analyzerConfigOptions.TryGetValue("end_of_line", out var endOfLineOption)) { endOfLine = GetEndOfLine(endOfLineOption); return true; diff --git a/src/Formatters/FinalNewlineFormatter.cs b/src/Formatters/FinalNewlineFormatter.cs index d439f2b57c72..ec1f5a7c2299 100644 --- a/src/Formatters/FinalNewlineFormatter.cs +++ b/src/Formatters/FinalNewlineFormatter.cs @@ -19,13 +19,12 @@ internal override async Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, - AnalyzerConfigOptions? analyzerConfigOptions, + AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { - if (analyzerConfigOptions is null || - !analyzerConfigOptions.TryGetValue("insert_final_newline", out var insertFinalNewlineValue) || + if (!analyzerConfigOptions.TryGetValue("insert_final_newline", out var insertFinalNewlineValue) || !bool.TryParse(insertFinalNewlineValue, out var insertFinalNewline)) { return await document.GetTextAsync(cancellationToken); diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/ImportsFormatter.cs index 9558db947b07..d06f49039d2d 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/ImportsFormatter.cs @@ -24,13 +24,20 @@ internal override async Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, - AnalyzerConfigOptions? analyzerConfigOptions, + AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { try { + // Only run formatter if the user has specifically configured one of the driving properties. + if (!analyzerConfigOptions.TryGetValue("dotnet_sort_system_directives_first", out _) && + !analyzerConfigOptions.TryGetValue("dotnet_separate_import_directive_groups", out _)) + { + return sourceText; + } + var organizedDocument = await Formatter.OrganizeImportsAsync(document, cancellationToken); var isSameVersion = await IsSameDocumentAndVersionAsync(document, organizedDocument, cancellationToken).ConfigureAwait(false); diff --git a/src/Formatters/WhitespaceFormatter.cs b/src/Formatters/WhitespaceFormatter.cs index ed7800a8f9c6..e71b84e562db 100644 --- a/src/Formatters/WhitespaceFormatter.cs +++ b/src/Formatters/WhitespaceFormatter.cs @@ -21,7 +21,7 @@ internal override async Task FormatFileAsync( Document document, SourceText sourceText, OptionSet optionSet, - AnalyzerConfigOptions? analyzerConfigOptions, + AnalyzerConfigOptions analyzerConfigOptions, FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) diff --git a/tests/Formatters/ImportsFormatterTests.cs b/tests/Formatters/ImportsFormatterTests.cs index 6e83f86615a0..f79ae04a8195 100644 --- a/tests/Formatters/ImportsFormatterTests.cs +++ b/tests/Formatters/ImportsFormatterTests.cs @@ -137,5 +137,25 @@ class C await TestAsync(testCode, expectedCode, editorConfig); } + + [Fact] + public async Task WhenNeitherOptionIsConfigured_AndImportsNotSortedOrSeparated_NoChange() + { + var code = @" +using Microsoft.CodeAnalysis; +using System.Linq; +using System; + +class C +{ +}"; + + var editorConfig = new Dictionary() + { + ["end_of_line"] = EndOfLineFormatter.GetEndOfLineOption(Environment.NewLine) + }; + + await TestAsync(code, code, editorConfig); + } } } From e2b7721e0f1e1051cd137b9524dd52f08721c73f Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 8 Jun 2020 17:48:46 -0700 Subject: [PATCH 1056/2702] Addressed PR feedback --- src/Analyzers/AnalyzerFormatter.cs | 4 ++-- src/Analyzers/AnalyzerRunner.cs | 2 +- src/Analyzers/Extensions.cs | 2 +- src/Analyzers/SolutionCodeFixApplier.cs | 2 +- src/CodeFormatter.cs | 14 +++++++------- src/FileChange.cs | 4 +++- src/FixSeverity.cs | 11 +++++++++++ src/FormatCommand.cs | 4 ++-- src/Formatters/CharsetFormatter.cs | 2 +- src/Formatters/EndOfLineFormatter.cs | 2 +- src/Program.cs | 14 +++++++------- src/Utilities/EditorConfigFinder.cs | 2 +- src/dotnet-format.csproj | 7 ------- 13 files changed, 38 insertions(+), 32 deletions(-) create mode 100644 src/FixSeverity.cs diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 461830f265bd..ffabcba3a454 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -50,7 +50,7 @@ public async Task FormatAsync( var analysisStopwatch = Stopwatch.StartNew(); logger.LogTrace($"Running {_name} analysis."); - var formattablePaths = formattableDocuments.Select(id => solution.GetDocument(id)?.FilePath) + var formattablePaths = formattableDocuments.Select(id => solution.GetDocument(id)!.FilePath) .OfType().ToImmutableHashSet(); logger.LogTrace("Determining diagnostics..."); @@ -152,7 +152,7 @@ private async Task FixDiagnosticsAsync( } var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Count > 0); - if (hasDiagnostics && codefix is object) + if (hasDiagnostics && codefix != null) { solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index df15f858ab3e..b5419a9fef4c 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -49,7 +49,7 @@ public async Task RunCodeAnalysisAsync( if (!diagnostic.IsSuppressed && diagnostic.Severity >= DiagnosticSeverity.Warning && diagnostic.Location.IsInSource && - diagnostic.Location.SourceTree is object && + diagnostic.Location.SourceTree != null && formattableDocumentPaths.Contains(diagnostic.Location.SourceTree.FilePath)) { result.AddDiagnostic(project, diagnostic); diff --git a/src/Analyzers/Extensions.cs b/src/Analyzers/Extensions.cs index c35e2172c7dd..57bf2f384bac 100644 --- a/src/Analyzers/Extensions.cs +++ b/src/Analyzers/Extensions.cs @@ -48,7 +48,7 @@ public static bool TryCreateInstance(this Type type, [NotNullWhen(returnValue culture: null) : null; - return instance is object; + return instance != null; } catch (Exception ex) { diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index 83e93669d2c1..f8a960cf4c38 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -48,7 +48,7 @@ public async Task ApplyCodeFixesAsync( try { var action = await fixAllProvider.GetFixAsync(fixAllContext).ConfigureAwait(false); - var operations = action is object + var operations = action != null ? await action.GetOperationsAsync(cancellationToken).ConfigureAwait(false) : ImmutableArray.Empty; var applyChangesOperation = operations.OfType().SingleOrDefault(); diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 6dd7a76f0b0a..a186a8af53b6 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -254,12 +254,12 @@ private static async Task RunCodeFormattersAsync( } internal static async Task<(int, ImmutableArray)> DetermineFormattableFilesAsync( - Solution solution, - string projectPath, - Matcher fileMatcher, - bool includeGeneratedFiles, - ILogger logger, - CancellationToken cancellationToken) + Solution solution, + string projectPath, + Matcher fileMatcher, + bool includeGeneratedFiles, + ILogger logger, + CancellationToken cancellationToken) { var totalFileCount = solution.Projects.Sum(project => project.DocumentIds.Count); var projectFileCount = 0; @@ -323,7 +323,7 @@ await GeneratedCodeUtilities.IsGeneratedCodeAsync(syntaxTree, cancellationToken) // Track files covered by an editorconfig separately from those not covered. var analyzerConfigOptions = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree); - if (analyzerConfigOptions is object) + if (analyzerConfigOptions != null) { documentsCoveredByEditorConfig.Add(document.Id); } diff --git a/src/FileChange.cs b/src/FileChange.cs index d149ee224080..6105b7911669 100644 --- a/src/FileChange.cs +++ b/src/FileChange.cs @@ -1,4 +1,6 @@ -using Microsoft.CodeAnalysis.Text; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Tools { diff --git a/src/FixSeverity.cs b/src/FixSeverity.cs new file mode 100644 index 000000000000..2a1489e131ec --- /dev/null +++ b/src/FixSeverity.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Tools +{ + public static class FixSeverity + { + public const string Error = "error"; + public const string Warn = "warn"; + public const string Info = "info"; + } +} diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 97c0239b7c8d..9ba8a9f0cd3f 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -27,11 +27,11 @@ internal static RootCommand CreateCommandLineOptions() Argument = new Argument(() => null), IsHidden = true }, - new Option(new[] { "--fix-style" }, Resources.Run_code_style_analyzer_and_apply_fixes) + new Option(new[] { "--fix-style", "-fs" }, Resources.Run_code_style_analyzer_and_apply_fixes) { Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne } }, - new Option(new[] { "--fix-analyzers" }, Resources.Run_code_style_analyzer_and_apply_fixes) + new Option(new[] { "--fix-analyzers", "-fa" }, Resources.Run_code_style_analyzer_and_apply_fixes) { Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne } }, diff --git a/src/Formatters/CharsetFormatter.cs b/src/Formatters/CharsetFormatter.cs index 3851da7fbf53..c8f509e06ee9 100644 --- a/src/Formatters/CharsetFormatter.cs +++ b/src/Formatters/CharsetFormatter.cs @@ -69,7 +69,7 @@ private static byte[] GetEncodedBytes(string text, Encoding encoding) private static bool TryGetCharset(AnalyzerConfigOptions? analyzerConfigOptions, [NotNullWhen(true)] out Encoding? encoding) { - if (analyzerConfigOptions is object && + if (analyzerConfigOptions != null && analyzerConfigOptions.TryGetValue("charset", out var charsetOption)) { encoding = GetCharset(charsetOption); diff --git a/src/Formatters/EndOfLineFormatter.cs b/src/Formatters/EndOfLineFormatter.cs index 0537e1c20935..160077bce1af 100644 --- a/src/Formatters/EndOfLineFormatter.cs +++ b/src/Formatters/EndOfLineFormatter.cs @@ -60,7 +60,7 @@ internal override Task FormatFileAsync( public static bool TryGetEndOfLine(AnalyzerConfigOptions? analyzerConfigOptions, [NotNullWhen(true)] out string? endOfLine) { - if (analyzerConfigOptions is object && + if (analyzerConfigOptions != null && analyzerConfigOptions.TryGetValue("end_of_line", out var endOfLineOption)) { endOfLine = GetEndOfLine(endOfLineOption); diff --git a/src/Program.cs b/src/Program.cs index af04275a3cee..4c80898b5b77 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -155,10 +155,10 @@ public static async Task Run( workspacePath, workspaceType, logLevel, - fixCodeStyle: s_parseResult.WasOptionUsed("--fix-style"), - codeStyleSeverity: GetSeverity(fixStyle ?? "error"), - fixAnalyzers: s_parseResult.WasOptionUsed("--fix-analyzers"), - analyerSeverity: GetSeverity(fixAnalyzers ?? "error"), + fixCodeStyle: s_parseResult.WasOptionUsed("--fix-style", "-fs"), + codeStyleSeverity: GetSeverity(fixStyle ?? FixSeverity.Error), + fixAnalyzers: s_parseResult.WasOptionUsed("--fix-analyzers", "-fa"), + analyerSeverity: GetSeverity(fixAnalyzers ?? FixSeverity.Error), saveFormattedFiles: !check, changesAreErrors: check, fileMatcher, @@ -229,9 +229,9 @@ internal static DiagnosticSeverity GetSeverity(string? severity) { return severity?.ToLowerInvariant() switch { - "error" => DiagnosticSeverity.Error, - "warn" => DiagnosticSeverity.Warning, - "info" => DiagnosticSeverity.Info, + FixSeverity.Error => DiagnosticSeverity.Error, + FixSeverity.Warn => DiagnosticSeverity.Warning, + FixSeverity.Info => DiagnosticSeverity.Info, _ => throw new ArgumentOutOfRangeException(nameof(severity)), }; } diff --git a/src/Utilities/EditorConfigFinder.cs b/src/Utilities/EditorConfigFinder.cs index 04ee7f34bcab..f7d5cea6e4ae 100644 --- a/src/Utilities/EditorConfigFinder.cs +++ b/src/Utilities/EditorConfigFinder.cs @@ -25,7 +25,7 @@ public static ImmutableArray GetEditorConfigPaths(string path) .Select(file => file.FullName) .ToList(); - while (directory.Parent is object) + while (directory.Parent != null) { directory = directory.Parent; diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 4bd56bb01b98..7d5d17d059f4 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -52,13 +52,6 @@ - - - 3.7.0-3.20271.4 + 3.7.0-3.20311.5 3.1.1 - 3.7.0-3.20311.5 + 3.7.0-3.20312.2 3.1.1 - 3.7.0-3.20312.2 + 3.7.0-3.20312.3 3.1.1 @@ -243,7 +243,7 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. - + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. @@ -255,10 +255,37 @@ Fix imports ordering. - + Unable to organize imports for '{0}'. The document is too complex. Run code style analyzers and apply fixes. + + Analyzer Reference + + + Code Style + + + Analysis complete in {0}ms. + + + Determining diagnostics... + + + Failed to apply code fix {0} for {1}: {2} + + + Fixing diagnostics... + + + Running {0} analysis. + + + Solution {0} has no projects + + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 120a6d2afd18..2051bdab395b 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ {0} nejde formátovat. Formátovat jde v současné době jenom projekty v jazycích C# a Visual Basic. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. Nepodařilo se uložit změny formátování. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ Přeskočí se odkazovaný projekt {0}. + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index ac6b07c594fe..b6b228498044 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappe gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ "{0}" konnte nicht formatiert werden. Derzeit wird die Formatierung nur für C#- und Visual Basic-Projekte unterstützt. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. Fehler beim Speichern von Formatierungsänderungen. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ Überspringen von referenziertem Projekt "{0}". + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 1a888586b889..87f3c6f4ba64 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. Se encontró un archivo de proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ No se pudo dar formato a "{0}". El formato admite solo proyectos de C# y Visual Basic en este momento. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. Error al guardar cambios de formato. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ Omitiendo projecto al que se hace referencia "{0}". + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 1f3dd39d6c97..f92284f72c45 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. Un fichier projet et un fichier solution MSBuild ont été trouvés dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ Impossible de mettre en forme '{0}'. L'opération Mettre en forme prend uniquement en charge les projets C# et Visual Basic pour le moment. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. L'enregistrement des changements de mise en forme a échoué. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ Saut du projet référencé '{0}'. + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index ecf5ef2c3486..f0752d5af9e6 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ Non è stato possibile formattare '{0}'. Il formato supporta attualmente solo progetti C# e Visual Basic. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. Non è stato possibile salvare le modifiche di formattazione. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ Il progetto di riferimento '{0}' verrà ignorato. + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index cce6cfbd54c8..5d7fad18a495 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. MSBuild プロジェクト ファイルとソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ '{0}' をフォーマットできませんでした。フォーマットは、C# および Visual Basic のプロジェクトでのみサポートされています。 + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. 書式変更を保存できませんでした。 @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ 参照プロジェクト '{0}' をスキップしています。 + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index cad257abe22a..712ced7a50ef 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ '{0}'의 서식을 지정할 수 없습니다. 서식 지정은 현재 C# 및 Visual Basic 프로젝트만 지원합니다. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. 서식 변경 내용을 저장하지 못했습니다. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ 참조된 프로젝트 '{0}'을(를) 건너뜁니다. + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 636c3c4617cc..dfec45a51535 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą opcji --workspace. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ Nie można sformatować elementu „{0}”. Obecnie format obsługuje tylko projekty C# i Visual Basic. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. Nie można zapisać zmian formatowania. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ Pomijanie przywoływanego projektu „{0}”. + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index c91388097af1..d0cf59e42be3 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. Foram encontrados um arquivo de solução e um arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ Não foi possível formatar '{0}'. O formato atualmente suporta apenas projetos do Visual Basic e C#. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. Falha ao salvar alterações de formatação. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ Ignorando o projeto referenciado '{0}'. + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index db622fd2edb7..3aa559f191b4 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью параметра --workspace. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ Не удалось отформатировать "{0}". Форматирование сейчас поддерживается только для проектов C# и Visual Basic. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. Не удалось сохранить изменения форматирования. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ Пропуск указанного проекта "{0}". + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 8f8afdd3a050..a3a9b05b50d9 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. Hem bir MSBuild proje dosyası ve çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ '{0}' biçiminde değil. Biçimi şu anda yalnızca C# ve Visual Basic projeleri desteklemektedir. + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. Biçimlendirme değişiklikleri kaydedilemedi. @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ Atlama projesi '{0}' başvuru. + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 3c196cefd520..0fb9804162bc 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要将哪一个文件用于 --workspace 选项。 @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ 无法设置“{0}”的格式。该格式当前仅支持 C# 和 Visual Basic 项目。 + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. 未能保存格式更改。 @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ 正在跳过引用的项目“{0}”。 + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 5df45261a401..574df84741a6 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -17,6 +17,16 @@ Accepts a file path, which if provided, will produce a json report in the given directory. + + Analysis complete in {0}ms. + Analysis complete in {0}ms. + + + + Analyzer Reference + Analyzer Reference + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. 在 '{0}' 中同時找到 MSBuild 專案檔和解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 @@ -37,6 +47,11 @@ Cannot specify both project argument and workspace option. + + Code Style + Code Style + + Complete in {0}ms. Complete in {0}ms. @@ -52,11 +67,21 @@ 無法將 '{0}' 格式化。格式化目前只支援 C# 和 Visual Basic 專案。 + + Determining diagnostics... + Determining diagnostics... + + Determining formattable files. Determining formattable files. + + Failed to apply code fix {0} for {1}: {2} + Failed to apply code fix {0} for {1}: {2} + + Failed to save formatting changes. 無法儲存格式化變更。 @@ -87,6 +112,11 @@ Fix whitespace formatting. + + Fixing diagnostics... + Fixing diagnostics... + + Format complete in {0}ms. Format complete in {0}ms. @@ -142,6 +172,11 @@ Run code style analyzers and apply fixes. + + Running {0} analysis. + Running {0} analysis. + + Running formatters. Running formatters. @@ -157,6 +192,11 @@ 跳過參考的專案 '{0}’。 + + Solution {0} has no projects + Solution {0} has no projects + + The dotnet CLI version is '{0}'. The dotnet CLI version is '{0}'. @@ -207,6 +247,11 @@ The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. From adf693c45dbc69c9dbbb2a3b3e889c8e9e5ce278 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 23 Jun 2020 07:57:39 -0700 Subject: [PATCH 1064/2702] add analyzer reflection tests --- src/Analyzers/AnalyzerFinderHelpers.cs | 6 +- .../AnalyzerReferenceAnalyzerFinder.cs | 2 +- .../RoslynCodeStyleAnalyzerFinder.cs | 2 +- tests/Analyzers/AnalyzerAssemblyGenerator.cs | 112 ++++++++++++++ tests/Analyzers/FilterDiagnosticsTests.cs | 83 +++++++++++ .../Analyzers/LoadAnalyzersAndFixersTests.cs | 141 ++++++++++++++++++ tests/dotnet-format.UnitTests.csproj | 3 + 7 files changed, 343 insertions(+), 6 deletions(-) create mode 100644 tests/Analyzers/AnalyzerAssemblyGenerator.cs create mode 100644 tests/Analyzers/FilterDiagnosticsTests.cs create mode 100644 tests/Analyzers/LoadAnalyzersAndFixersTests.cs diff --git a/src/Analyzers/AnalyzerFinderHelpers.cs b/src/Analyzers/AnalyzerFinderHelpers.cs index 21ab8eaa0995..cb069816c0dc 100644 --- a/src/Analyzers/AnalyzerFinderHelpers.cs +++ b/src/Analyzers/AnalyzerFinderHelpers.cs @@ -6,17 +6,15 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; + using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal static class AnalyzerFinderHelpers { - public static ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> LoadAnalyzersAndFixers( - IEnumerable assemblies, - ILogger logger) + public static ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> LoadAnalyzersAndFixers(IEnumerable assemblies) { var types = assemblies .SelectMany(assembly => assembly.GetTypes() diff --git a/src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs b/src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs index 7e4e053f0a4c..3d376abb1e3f 100644 --- a/src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs +++ b/src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs @@ -30,7 +30,7 @@ internal class AnalyzerReferenceAnalyzerFinder : IAnalyzerFinder .Distinct() .Select(path => Assembly.LoadFrom(path)); - return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies, logger); + return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); } public Task>> FilterBySeverityAsync( diff --git a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs index fea651ba5f14..40463d9022d5 100644 --- a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs +++ b/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs @@ -36,7 +36,7 @@ internal class RoslynCodeStyleAnalyzerFinder : IAnalyzerFinder _featuresVisualBasicPath }.Select(path => Assembly.LoadFrom(path)); - return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies, logger); + return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); } public Task>> FilterBySeverityAsync( diff --git a/tests/Analyzers/AnalyzerAssemblyGenerator.cs b/tests/Analyzers/AnalyzerAssemblyGenerator.cs new file mode 100644 index 000000000000..d0ae19429cf6 --- /dev/null +++ b/tests/Analyzers/AnalyzerAssemblyGenerator.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Composition; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; + +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Testing; + +namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers +{ + public static class AnalyzerAssemblyGenerator + { + public static SyntaxTree GenerateCodeFix(string typeName, string diagnosticId) + { + var codefix = $@" +using System; +using System.Collections.Immutable; +using System.Composition; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.Diagnostics; +[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof({typeName})), Shared] +public class {typeName} : CodeFixProvider +{{ + public const string DiagnosticId = ""{diagnosticId}""; + + public sealed override ImmutableArray FixableDiagnosticIds + => ImmutableArray.Create(DiagnosticId); + + public sealed override FixAllProvider GetFixAllProvider() + {{ + return WellKnownFixAllProviders.BatchFixer; + }} + + public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) + {{ + throw new NotImplementedException(); + }} +}}"; + return CSharpSyntaxTree.ParseText(codefix); + } + + public static SyntaxTree GenerateAnalyzerCode(string typeName, string diagnosticId) + { + var analyzer = $@" +using System.Collections.Immutable; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Diagnostics; +[DiagnosticAnalyzer(LanguageNames.CSharp)] +public class {typeName} : DiagnosticAnalyzer +{{ + public const string DiagnosticId = ""{diagnosticId}""; + internal static readonly LocalizableString Title = ""{typeName} Title""; + internal static readonly LocalizableString MessageFormat = ""{typeName} '{{0}}'""; + internal const string Category = ""{typeName} Category""; + internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, true); + public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(Rule); + public override void Initialize(AnalysisContext context) + {{ + }} +}}"; + return CSharpSyntaxTree.ParseText(analyzer); + } + + public static async Task GenerateAssemblyAsync(params SyntaxTree[] trees) + { + var assemblyName = Guid.NewGuid().ToString(); + var references = new List() + { + MetadataReference.CreateFromFile(typeof(ImmutableArray).Assembly.Location), + MetadataReference.CreateFromFile(typeof(SharedAttribute).Assembly.Location), + MetadataReference.CreateFromFile(typeof(CSharpCompilation).Assembly.Location), + MetadataReference.CreateFromFile(typeof(DiagnosticAnalyzer).Assembly.Location), + MetadataReference.CreateFromFile(typeof(CodeFixProvider).Assembly.Location), + }; + + var netstandardMetaDataReferences = await ReferenceAssemblies.NetStandard.NetStandard20.ResolveAsync(LanguageNames.CSharp, CancellationToken.None); + references.AddRange(netstandardMetaDataReferences); + var compilation = CSharpCompilation.Create(assemblyName, trees, references, + options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); + using (var ms = new MemoryStream()) + { + var result = compilation.Emit(ms); + if (!result.Success) + { + var failures = result.Diagnostics.Where(diagnostic => + diagnostic.IsWarningAsError || + diagnostic.Severity == DiagnosticSeverity.Error) + .Select(diagnostic => $"{diagnostic.Id}: {diagnostic.GetMessage()}"); + + throw new Exception(string.Join(Environment.NewLine, failures)); + } + else + { + ms.Seek(0, SeekOrigin.Begin); + var assembly = Assembly.Load(ms.ToArray()); + return assembly; + } + } + } + } +} diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs new file mode 100644 index 000000000000..65c4ae573e15 --- /dev/null +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Testing; +using Microsoft.CodeAnalysis.Text; +using Microsoft.CodeAnalysis.Tools.Analyzers; +using Microsoft.CodeAnalysis.Tools.Formatters; +using Microsoft.CodeAnalysis.Tools.Tests.Formatters; + +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers +{ + using static AnalyzerAssemblyGenerator; + + public class FilterDiagnosticsTests : CSharpFormatterTests + { + [Fact] + public async Task TestFilterWarning() + { + var projects = GetProjects(); + var allAnalyzers = await GetAnalyzersAsync(); + var formattablePaths = ImmutableHashSet.Create(projects.First().Documents.First().FilePath); + var minimumSeverity = DiagnosticSeverity.Warning; + var result = await AnalyzerFinderHelpers.FilterBySeverityAsync(projects, + allAnalyzers, + formattablePaths, + minimumSeverity, + CancellationToken.None); + var (_, analyzers) = Assert.Single(result); + Assert.Single(analyzers); + } + + [Fact] + public async Task TestFilterError() + { + var projects = GetProjects(); + var allAnalyzers = await GetAnalyzersAsync(); + var formattablePaths = ImmutableHashSet.Create(projects.First().Documents.First().FilePath); + var minimumSeverity = DiagnosticSeverity.Error; + var result = await AnalyzerFinderHelpers.FilterBySeverityAsync(projects, + allAnalyzers, + formattablePaths, + minimumSeverity, + CancellationToken.None); + var (_, analyzers) = Assert.Single(result); + Assert.Empty(analyzers); + } + + private async Task> GetAnalyzersAsync() + { + var assemblies = new[] + { + await GenerateAssemblyAsync( + GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId"), + GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId")) + }; + + var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + return ImmutableArray.Create(analyzersAndFixers[0].Analyzer); + } + + private IEnumerable GetProjects() + { + var text = SourceText.From(""); + TestState.Sources.Add(text); + + var solution = GetSolution(TestState.Sources.ToArray(), + TestState.AdditionalFiles.ToArray(), + TestState.AdditionalReferences.ToArray(), + "root = true"); + return solution.Projects; + } + + private protected override ICodeFormatter Formatter { get; } + } +} diff --git a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs new file mode 100644 index 000000000000..e844945853d6 --- /dev/null +++ b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Threading.Tasks; + +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Tools.Analyzers; + +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers +{ + using static AnalyzerAssemblyGenerator; + + public class LoadAnalyzersAndFixersTests + { + [Fact] + public static async Task TestSingleAnalyzerAndFixerAsync() + { + var assemblies = new[] + { + await GenerateAssemblyAsync( + GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId"), + GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId")) + }; + + var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + var (analyzer, fixer) = Assert.Single(analyzersAndFixers); + var analyzerDiagnosticDescriptor = Assert.Single(analyzer.SupportedDiagnostics); + var fixerDiagnosticId = Assert.Single(fixer.FixableDiagnosticIds); + Assert.Equal(analyzerDiagnosticDescriptor.Id, fixerDiagnosticId); + } + + [Fact] + public static async Task TestMultipleAnalyzersAndFixersAsync() + { + var assemblies = new[] + { + await GenerateAssemblyAsync( + GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId1"), + GenerateAnalyzerCode("DiagnosticAnalyzer2", "DiagnosticAnalyzerId2"), + GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId1"), + GenerateCodeFix("CodeFixProvider2", "DiagnosticAnalyzerId2")) + }; + + var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Equal(2, analyzersAndFixers.Length); + Assert.Collection(analyzersAndFixers, VerifyAnalyzerCodeFixTuple, VerifyAnalyzerCodeFixTuple); + } + + [Fact] + public static async Task TestMultipleAnalyzersAndFixersFromTwoAssembliesAsync() + { + var assemblies = new[] + { + await GenerateAssemblyAsync( + GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId1"), + GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId1")), + await GenerateAssemblyAsync( + GenerateAnalyzerCode("DiagnosticAnalyzer2", "DiagnosticAnalyzerId2"), + GenerateCodeFix("CodeFixProvider2", "DiagnosticAnalyzerId2")), + }; + var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Equal(2, analyzersAndFixers.Length); + Assert.Collection(analyzersAndFixers, VerifyAnalyzerCodeFixTuple, VerifyAnalyzerCodeFixTuple); + } + + [Fact] + public static async Task NonMatchingIdsAsync() + { + var assemblies = new[] + { + await GenerateAssemblyAsync( + GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId"), + GenerateCodeFix("CodeFixProvider1", "CodeFixProviderId")) + }; + + var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Empty(analyzersAndFixers); + } + + [Fact] + public static async Task SomeMatchingIdsAsync() + { + var assemblies = new[] + { + await GenerateAssemblyAsync( + GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId1"), + GenerateAnalyzerCode("DiagnosticAnalyzer2", "DiagnosticAnalyzerId2"), + GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId1"), + GenerateCodeFix("CodeFixProvider2", "CodeFixProviderId")) + }; + + var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + var (analyzer, fixer) = Assert.Single(analyzersAndFixers); + var analyzerDiagnosticDescriptor = Assert.Single(analyzer.SupportedDiagnostics); + var fixerDiagnosticId = Assert.Single(fixer.FixableDiagnosticIds); + Assert.Equal(analyzerDiagnosticDescriptor.Id, fixerDiagnosticId); + } + + [Fact] + public static async Task SingleIdMapstoMultipleFixersAsync() + { + var assemblies = new[] + { + await GenerateAssemblyAsync( + GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId1"), + GenerateAnalyzerCode("DiagnosticAnalyzer2", "DiagnosticAnalyzerId1"), + GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId1"), + GenerateCodeFix("CodeFixProvider2", "CodeFixProviderId")) + }; + + var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Equal(2, analyzersAndFixers.Length); + Assert.Collection(analyzersAndFixers, VerifyAnalyzerCodeFixTuple, VerifyAnalyzerCodeFixTuple); + } + + [Fact] + public static async Task MultipleIdsMaptoSingleFixerAsync() + { + var assemblies = new[] + { + await GenerateAssemblyAsync( + GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId1"), + GenerateAnalyzerCode("DiagnosticAnalyzer2", "DiagnosticAnalyzerId1"), + GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId1")) + }; + + var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Equal(2, analyzersAndFixers.Length); + Assert.Collection(analyzersAndFixers, VerifyAnalyzerCodeFixTuple, VerifyAnalyzerCodeFixTuple); + } + + private static void VerifyAnalyzerCodeFixTuple((DiagnosticAnalyzer Analyzer, CodeFixProvider Fixer) tuple) + { + var analyzerDiagnosticDescriptor = Assert.Single(tuple.Analyzer.SupportedDiagnostics); + var fixerDiagnosticId = Assert.Single(tuple.Fixer.FixableDiagnosticIds); + Assert.Equal(analyzerDiagnosticDescriptor.Id, fixerDiagnosticId); + } + } +} diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index d002e8609c02..0c3a8f02fd15 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -11,8 +11,11 @@ + + + From 67a3428bd1997631b60b789bac26c6ce97091986 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 25 Jun 2020 10:57:58 -0700 Subject: [PATCH 1065/2702] Remove deprecated options and aliases --- .vscode/launch.json | 3 +- src/FormatCommand.cs | 96 +++------------- src/MSBuild/MSBuildWorkspaceFinder.cs | 8 +- src/Program.cs | 34 +----- src/Resources.resx | 102 +++++++---------- src/xlf/Resources.cs.xlf | 80 ++++---------- src/xlf/Resources.de.xlf | 80 ++++---------- src/xlf/Resources.es.xlf | 80 ++++---------- src/xlf/Resources.fr.xlf | 80 ++++---------- src/xlf/Resources.it.xlf | 80 ++++---------- src/xlf/Resources.ja.xlf | 80 ++++---------- src/xlf/Resources.ko.xlf | 80 ++++---------- src/xlf/Resources.pl.xlf | 80 ++++---------- src/xlf/Resources.pt-BR.xlf | 80 ++++---------- src/xlf/Resources.ru.xlf | 80 ++++---------- src/xlf/Resources.tr.xlf | 80 ++++---------- src/xlf/Resources.zh-Hans.xlf | 80 ++++---------- src/xlf/Resources.zh-Hant.xlf | 80 ++++---------- tests/CodeFormatterTests.cs | 12 +- tests/MSBuild/MSBuildWorkspaceFinderTests.cs | 8 +- tests/ProgramTests.cs | 110 ++++++------------- tests/Utilities/MSBuildFixture.cs | 6 +- 22 files changed, 377 insertions(+), 1042 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a2d619556ab0..295ae46f022c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -52,7 +52,8 @@ "--fix-style", "-v", "diag", - "--check" + "--check", + "-?" ], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 9ba8a9f0cd3f..16f80888f4de 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -9,33 +9,28 @@ namespace Microsoft.CodeAnalysis.Tools { internal static class FormatCommand { + internal static string[] VerbosityLevels => new[] { "q", "quiet", "m", "minimal", "n", "normal", "d", "detailed", "diag", "diagnostic" }; + internal static string[] SeverityLevels => new[] { FixSeverity.Info, FixSeverity.Warn, FixSeverity.Error }; + internal static RootCommand CreateCommandLineOptions() { var rootCommand = new RootCommand { - new Argument("project") + new Argument("workspace") { Arity = ArgumentArity.ZeroOrOne, - Description = Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one - }, - new Option(new[] { "--folder", "-f" }, Resources.Whether_to_treat_the_project_path_as_a_folder_of_files) - { - Argument = new Argument(() => null) { Arity = ArgumentArity.ZeroOrOne }, - }, - new Option(new[] { "--workspace", "-w" }, Resources.The_solution_or_project_file_to_operate_on_If_a_file_is_not_specified_the_command_will_search_the_current_directory_for_one) - { - Argument = new Argument(() => null), - IsHidden = true - }, + Description = Resources.A_path_to_a_solution_file_a_project_file_or_a_folder_containing_a_solution_or_project_file_If_a_path_is_not_specified_then_the_current_directory_is_used + }.LegalFilePathsOnly(), + new Option(new[] { "--folder", "-f" }, Resources.Whether_to_treat_the_workspace_argument_as_a_simple_folder_of_files), new Option(new[] { "--fix-style", "-fs" }, Resources.Run_code_style_analyzer_and_apply_fixes) { - Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne } + Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne }.FromAmong(SeverityLevels) }, new Option(new[] { "--fix-analyzers", "-fa" }, Resources.Run_code_style_analyzer_and_apply_fixes) { - Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne } + Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne }.FromAmong(SeverityLevels) }, - new Option(new[] { "--include", "--files" }, Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) + new Option(new[] { "--include" }, Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) { Argument = new Argument(() => Array.Empty()) }, @@ -43,91 +38,26 @@ internal static RootCommand CreateCommandLineOptions() { Argument = new Argument(() => Array.Empty()) }, - new Option(new[] { "--check", "--dry-run" }, Resources.Formats_files_without_saving_changes_to_disk_Terminates_with_a_non_zero_exit_code_if_any_files_were_formatted) - { - Argument = new Argument() - }, + new Option(new[] { "--check" }, Resources.Formats_files_without_saving_changes_to_disk_Terminates_with_a_non_zero_exit_code_if_any_files_were_formatted), new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory) { - Argument = new Argument(() => null) + Argument = new Argument(() => null).LegalFilePathsOnly() }, new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic) { - Argument = new Argument() { Arity = ArgumentArity.ExactlyOne } + Argument = new Argument() { Arity = ArgumentArity.ExactlyOne }.FromAmong(VerbosityLevels) }, new Option(new[] { "--include-generated" }, Resources.Include_generated_code_files_in_formatting_operations) { - Argument = new Argument(), IsHidden = true }, }; rootCommand.Description = "dotnet-format"; - rootCommand.AddValidator(ValidateProjectArgumentAndWorkspace); - rootCommand.AddValidator(ValidateProjectArgumentAndFolder); - rootCommand.AddValidator(ValidateWorkspaceAndFolder); return rootCommand; } - private static string? ValidateProjectArgumentAndWorkspace(CommandResult symbolResult) - { - try - { - var project = symbolResult.GetArgumentValueOrDefault("project"); - var workspace = symbolResult.ValueForOption("workspace"); - - if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(workspace)) - { - return Resources.Cannot_specify_both_project_argument_and_workspace_option; - } - } - catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. - { - } - - return null; - } - - private static string? ValidateProjectArgumentAndFolder(CommandResult symbolResult) - { - try - { - var project = symbolResult.GetArgumentValueOrDefault("project"); - var folder = symbolResult.ValueForOption("folder"); - - if (!string.IsNullOrEmpty(project) && !string.IsNullOrEmpty(folder)) - { - return Resources.Cannot_specify_both_project_argument_and_folder_options; - } - } - catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. - { - } - - return null; - } - - private static string? ValidateWorkspaceAndFolder(CommandResult symbolResult) - { - try - { - var workspace = symbolResult.ValueForOption("workspace"); - var folder = symbolResult.ValueForOption("folder"); - - - if (!string.IsNullOrEmpty(workspace) && !string.IsNullOrEmpty(folder)) - { - return Resources.Cannot_specify_both_folder_and_workspace_options; - } - } - catch (InvalidOperationException) // Parsing of arguments failed. This will be reported later. - { - } - - return null; - } - internal static bool WasOptionUsed(this ParseResult result, params string[] aliases) { return result.Tokens diff --git a/src/MSBuild/MSBuildWorkspaceFinder.cs b/src/MSBuild/MSBuildWorkspaceFinder.cs index b286621d70b8..b119eae1d474 100644 --- a/src/MSBuild/MSBuildWorkspaceFinder.cs +++ b/src/MSBuild/MSBuildWorkspaceFinder.cs @@ -36,12 +36,12 @@ public static (bool isSolution, string workspacePath) FindWorkspace(string searc : FindFile(workspacePath!); // IsNullOrEmpty is not annotated on .NET Core 2.1 } - var foundSolution = FindMatchingFile(searchDirectory, FindSolutionFiles, Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option); - var foundProject = FindMatchingFile(searchDirectory, FindProjectFiles, Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option); + var foundSolution = FindMatchingFile(searchDirectory, FindSolutionFiles, Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_argument); + var foundProject = FindMatchingFile(searchDirectory, FindProjectFiles, Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_argument); if (!string.IsNullOrEmpty(foundSolution) && !string.IsNullOrEmpty(foundProject)) { - throw new FileNotFoundException(string.Format(Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, searchDirectory)); + throw new FileNotFoundException(string.Format(Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_argument, searchDirectory)); } if (!string.IsNullOrEmpty(foundSolution)) @@ -54,7 +54,7 @@ public static (bool isSolution, string workspacePath) FindWorkspace(string searc return (false, foundProject!); // IsNullOrEmpty is not annotated on .NET Core 2.1 } - throw new FileNotFoundException(string.Format(Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option, searchDirectory)); + throw new FileNotFoundException(string.Format(Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_argument, searchDirectory)); } private static (bool isSolution, string workspacePath) FindFile(string workspacePath) diff --git a/src/Program.cs b/src/Program.cs index 4c80898b5b77..3bdf8d471c7f 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -20,7 +20,6 @@ namespace Microsoft.CodeAnalysis.Tools { internal class Program { - private static string[] VerbosityLevels => new[] { "q", "quiet", "m", "minimal", "n", "normal", "d", "detailed", "diag", "diagnostic" }; internal const int UnhandledExceptionExitCode = 1; internal const int CheckFailedExitCode = 2; internal const int UnableToLocateMSBuildExitCode = 3; @@ -40,9 +39,8 @@ private static async Task Main(string[] args) } public static async Task Run( - string? project, - string? folder, string? workspace, + bool folder, string? fixStyle, string? fixAnalyzers, string? verbosity, @@ -76,44 +74,22 @@ public static async Task Run( { currentDirectory = Environment.CurrentDirectory; - // Check for deprecated options and assign package if specified via `-w | -f` options. - if (!string.IsNullOrEmpty(workspace) && string.IsNullOrEmpty(project)) - { - logger.LogWarning(Resources.The_workspace_option_is_deprecated_Use_the_project_argument_instead); - project = workspace; - } - else if (!string.IsNullOrEmpty(folder) && string.IsNullOrEmpty(project)) - { - logger.LogWarning(Resources.The_folder_option_is_deprecated_for_specifying_the_path_Pass_the_folder_option_but_specify_the_path_with_the_project_argument_instead); - project = folder; - } - - if (s_parseResult.WasOptionUsed("--files")) - { - logger.LogWarning(Resources.The_files_option_is_deprecated_Use_the_include_option_instead); - } - - if (s_parseResult.WasOptionUsed("--dry-run")) - { - logger.LogWarning(Resources.The_dry_run_option_is_deprecated_Use_the_check_option_instead); - } string workspaceDirectory; string workspacePath; WorkspaceType workspaceType; - // The presence of the folder token means we should treat the project path as a folder path. - // This will change in the following version so that the folder option is a bool flag. - if (s_parseResult.WasOptionUsed("-f", "--folder")) + // The folder option means we should treat the project path as a folder path. + if (folder) { // If folder isn't populated, then use the current directory - workspacePath = Path.GetFullPath(project ?? ".", Environment.CurrentDirectory); + workspacePath = Path.GetFullPath(workspace ?? ".", Environment.CurrentDirectory); workspaceDirectory = workspacePath; workspaceType = WorkspaceType.Folder; } else { - var (isSolution, workspaceFilePath) = MSBuildWorkspaceFinder.FindWorkspace(currentDirectory, project); + var (isSolution, workspaceFilePath) = MSBuildWorkspaceFinder.FindWorkspace(currentDirectory, workspace); workspacePath = workspaceFilePath; workspaceType = isSolution diff --git a/src/Resources.resx b/src/Resources.resx index 18954f9c5ada..ac8f7875ad4a 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -1,17 +1,17 @@  - @@ -123,11 +123,11 @@ The solution file '{0}' does not exist. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. Failed to save formatting changes. @@ -135,11 +135,11 @@ The file '{0}' does not appear to be a valid project or solution file. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. Format complete in {0}ms. @@ -165,11 +165,8 @@ Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - - - Format files, but do not save changes to disk. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -204,11 +201,8 @@ Fix file encoding. - - Whether to treat the `<project>` path as a folder of files. - - - Cannot specify both folder and workspace options. + + Whether to treat the `<workspace>` argument as a simple folder of files. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -234,24 +228,6 @@ The dotnet CLI version is '{0}'. - - Cannot specify both project argument and workspace option. - - - Cannot specify both project argument and folder options. - - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - - The `--files` option is deprecated. Use the `--include` option instead. - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - Fix imports ordering. diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 2051bdab395b..6cfe825c18bf 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - V adresáři {0} nešlo najít soubor projektu MSBuild nebo soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + V adresáři {0} nešlo najít soubor projektu MSBuild nebo soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - Soubory se naformátují, ale změny se neuloží na disk. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ Načítá se pracovní prostor. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - {0} obsahuje více souborů projektů MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. Soubor {0} zřejmě není platný soubor projektu nebo řešení. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. Soubor projektu {0} neexistuje. @@ -232,21 +202,11 @@ Soubor řešení {0} neexistuje. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Soubor řešení nebo projektu, se kterým se má operace provést. Pokud soubor není zadaný, příkaz ho bude hledat v aktuálním adresáři. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index b6b228498044..3c858a7bf577 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappe gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappe gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Kein MSBuild-Projektdatei oder Projektmappendatei in "{0}" gefunden. Geben Sie die zu verwendende Datei mit der Option "--workspace" an. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Kein MSBuild-Projektdatei oder Projektmappendatei in "{0}" gefunden. Geben Sie die zu verwendende Datei mit der Option "--workspace" an. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - Dateien formatieren, Änderungen aber nicht auf Festplatte speichern. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ Arbeitsbereich wird geladen. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Mehrere MSBuild-Projektdateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Mehrere MSBuild Projektmappendateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. Die Projektdatei "{0}" ist nicht vorhanden. @@ -232,21 +202,11 @@ Die Projektmappendatei "{0}" ist nicht vorhanden. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Die Projektmappe oder Projektdatei, die verwendet werden soll. Wenn keine Datei angegeben ist, durchsucht der Befehl das aktuelle Verzeichnis nach einer Datei. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 87f3c6f4ba64..7c9c26f29f5a 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - Se encontró un archivo de proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + Se encontró un archivo de proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - No se pudo encontrar un archivo de proyecto o archivo de solución MSBuild en "{0}". Especifique cuál debe utilizarse con la opción --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + No se pudo encontrar un archivo de proyecto o archivo de solución MSBuild en "{0}". Especifique cuál debe utilizarse con la opción --workspace. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - Formato de archivos, pero no guardar los cambios al disco. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ Cargando área de trabajo. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Se encontraron múltiples archivos de proyecto MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Se encontraron múltiples archivos de solución MSBuild en "{0}". Especifique cuáles se deben utilizar con la opción --workspace. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. El archivo "{0}" no parece ser un proyecto o archivo de solución válido. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. El archivo de proyecto "{0}" no existe. @@ -232,21 +202,11 @@ El archivo de solución "{0}" no existe. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - El archivo de solución o el proyecto para operar. Si no se especifica un archivo, el comando buscará uno en el directorio actual. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index f92284f72c45..96407b9ee9e4 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - Un fichier projet et un fichier solution MSBuild ont été trouvés dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + Un fichier projet et un fichier solution MSBuild ont été trouvés dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Fichier projet ou solution MSBuild introuvable dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Fichier projet ou solution MSBuild introuvable dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - Mettez en forme les fichiers, mais n'enregistrez pas les changements sur le disque. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ Chargement de l'espace de travail. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Plusieurs fichiers projet MSBuild dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Plusieurs fichiers solution MSBuild dans '{0}'. Spécifiez ceux à utiliser avec l'option --workspace. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. Le fichier projet '{0}' n'existe pas. @@ -232,21 +202,11 @@ Le fichier solution '{0}' n'existe pas. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Fichier solution ou projet à utiliser. Si un fichier n'est pas spécifié, la commande en recherche un dans le répertoire actuel. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index f0752d5af9e6..4cea5eaa8818 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - In '{0}' non è stato possibile trovare alcun file di progetto o di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + In '{0}' non è stato possibile trovare alcun file di progetto o di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - Formatta i file, ma non salvare le modifiche sul disco. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ Caricamento dell'area di lavoro. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - In '{0}' sono stati trovati più file di progetto MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. Il file '{0}' non sembra essere un file di progetto o di soluzione valido. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. Il file di progetto '{0}' non esiste. @@ -232,21 +202,11 @@ Il file di soluzione '{0}' non esiste. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - File di progetto o di soluzione su cui intervenire. Se non si specifica un file, il comando ne cercherà uno nella directory corrente. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 5d7fad18a495..5ee9c30208b1 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - MSBuild プロジェクト ファイルとソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + MSBuild プロジェクト ファイルとソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - '{0}' で MSBuild プロジェクト ファイルまたはソリューション ファイルが見つかりませんでした。使用するファイルを --workspace オプションで指定してください。 + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + '{0}' で MSBuild プロジェクト ファイルまたはソリューション ファイルが見つかりませんでした。使用するファイルを --workspace オプションで指定してください。 @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - ファイルを書式設定しますが、変更をディスクに保存しません。 - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ ワークスペースを読み込んでいます。 - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - 複数の MSBuild プロジェクト ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. プロジェクト ファイル '{0}' が存在しません。 @@ -232,21 +202,11 @@ ソリューション ファイル '{0}' が存在しません。 - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 操作対象のソリューション ファイルまたはプロジェクト ファイル。ファイルを指定しない場合、コマンドは現在のディレクトリを検索します。 - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 712ced7a50ef..af6fa13c8fa4 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - '{0}'에서 MSBuild 프로젝트 파일 또는 솔루션 파일을 찾을 수 없습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + '{0}'에서 MSBuild 프로젝트 파일 또는 솔루션 파일을 찾을 수 없습니다. --workspace 옵션에 사용할 파일을 지정하세요. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - 파일의 형식을 지정하지만 변경 내용을 디스크에 저장하지 않습니다. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ 작업 영역을 로드하는 중입니다. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - '{0}'에서 여러 MSBuild 프로젝트 파일을 찾았습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. 프로젝트 파일 '{0}'이(가) 없습니다. @@ -232,21 +202,11 @@ 솔루션 파일 '{0}'이(가) 없습니다. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 수행할 솔루션 또는 프로젝트 파일입니다. 파일을 지정하지 않으면 명령이 현재 디렉터리에서 파일을 검색합니다. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index dfec45a51535..72edec1e7800 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą opcji --workspace. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą opcji --workspace. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Nie można znaleźć pliku rozwiązania lub projektu MSBuild w elemencie „{0}”. Określ plik do użycia za pomocą opcji --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Nie można znaleźć pliku rozwiązania lub projektu MSBuild w elemencie „{0}”. Określ plik do użycia za pomocą opcji --workspace. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - Formatuj pliki, ale nie zapisuj zmian na dysku. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ Ładowanie obszaru roboczego. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - W elemencie „{0}” znaleziono wiele plików projektów MSBuild. Określ, którego użyć, za pomocą opcji --workspace. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą opcji --workspace. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. Plik projektu „{0}” nie istnieje. @@ -232,21 +202,11 @@ Plik rozwiązania „{0}” nie istnieje. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Plik rozwiązania lub projektu, względem którego operacja ma być wykonana. Jeśli plik nie zostanie określony, polecenie wyszuka go w bieżącym katalogu. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index d0cf59e42be3..36fe15137fa0 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - Foram encontrados um arquivo de solução e um arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + Foram encontrados um arquivo de solução e um arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Não foi possível encontrar um arquivo de solução ou arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Não foi possível encontrar um arquivo de solução ou arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - Arquivos de formato, mas não salva as alterações para o disco. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ Carregando espaço de trabalho. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Foram encontrados vários arquivos do projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Foram encontrados vários arquivos de solução MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. O arquivo de projeto '{0}' não existe. @@ -232,21 +202,11 @@ O arquivo de solução '{0}' não existe. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - O arquivo de projeto ou solução para operar. Se um arquivo não for especificado, o comando pesquisará o diretório atual para um. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 3aa559f191b4..4b50b46f4819 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью параметра --workspace. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью параметра --workspace. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Не удалось найти файл проекта или решения MSBuild в "{0}". Укажите используемый файл с параметром --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Не удалось найти файл проекта или решения MSBuild в "{0}". Укажите используемый файл с параметром --workspace. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - Форматировать файлы без сохранения изменений на диск. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ Загрузка рабочей области. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - В "{0}" обнаружено несколько файлов проектов MSBuild. Укажите используемый файл с помощью параметра --workspace. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - В "{0}" обнаружено несколько файлов решений MSBuild. Укажите используемый файл с параметром --workspace. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. Файл "{0}" не является допустимым файлом проекта или решения. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. Файл проекта "{0}" не существует. @@ -232,21 +202,11 @@ Файл решения "{0}" не существует. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Файл решения или проекта. Если файл не указан, команда будет искать этот файл в текущем каталоге. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index a3a9b05b50d9..b736f28bd331 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - Hem bir MSBuild proje dosyası ve çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + Hem bir MSBuild proje dosyası ve çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - Bir MSBuild proje dosyası veya çözüm dosyası '{0}' içinde bulunamadı. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Bir MSBuild proje dosyası veya çözüm dosyası '{0}' içinde bulunamadı. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - Dosyaları biçimlendir, ancak değişiklikleri diske kaydetme. - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ Çalışma alanı yükleniyor. - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - Birden fazla MSBuild proje dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - Birden fazla MSBuild çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. Proje dosyası '{0}' yok. @@ -232,21 +202,11 @@ Çözüm dosyası '{0}' yok. - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Ameliyat için çözüm ya da proje dosyasını. Bir dosya belirtilmezse, komut için bir geçerli dizini arar. - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 0fb9804162bc..9363b6f9fb03 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要将哪一个文件用于 --workspace 选项。 - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要将哪一个文件用于 --workspace 选项。 @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - 无法在“{0}”中找到 MSBuild 项目文件或解决方案文件。请指定要用于 --workspace 选项的文件。 + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + 无法在“{0}”中找到 MSBuild 项目文件或解决方案文件。请指定要用于 --workspace 选项的文件。 @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - 格式化文件, 但不将更改保存到磁盘。 - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ 正在加载工作区。 - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - 在“{0}”中找到多个 MSBuild 项目文件。请指定要将哪一个文件用于 --workspace 选项。 + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 --workspace 选项的文件。 + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. 文件“{0}”似乎不是有效的项目或解决方案文件。 - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. 项目文件“{0}” 不存在。 @@ -232,21 +202,11 @@ 解决方案文件“{0}”不存在。 - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 要操作的解决方案或项目文件。如果未指定文件,该命令将在当前目录中搜索一个文件。 - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 574df84741a6..becbf45db23c 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -12,6 +12,11 @@ A list of relative file or folder paths to include in formatting. All files are formatted if empty. + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepts a file path, which if provided, will produce a json report in the given directory. @@ -27,24 +32,9 @@ Analyzer Reference - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. - 在 '{0}' 中同時找到 MSBuild 專案檔和解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 - - - - Cannot specify both folder and workspace options. - Cannot specify both folder and workspace options. - - - - Cannot specify both project argument and folder options. - Cannot specify both project argument and folder options. - - - - Cannot specify both project argument and workspace option. - Cannot specify both project argument and workspace option. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + 在 '{0}' 中同時找到 MSBuild 專案檔和解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 @@ -57,9 +47,9 @@ Complete in {0}ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. - 在 '{0}' 中找不到 MSBuild 專案檔或解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + 在 '{0}' 中找不到 MSBuild 專案檔或解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 @@ -122,11 +112,6 @@ Format complete in {0}ms. - - Format files, but do not save changes to disk. - 將檔案格式化,但不儲存變更到磁碟。 - - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -157,14 +142,14 @@ 正在載入工作區。 - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. - 在 '{0}' 中找到多個 MSBuild 專案檔。請指定要搭配 --workspace 選項使用的檔案。 + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. - 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. @@ -202,26 +187,11 @@ The dotnet CLI version is '{0}'. - - The `--dry-run` option is deprecated. Use the `--check` option instead. - The `--dry-run` option is deprecated. Use the `--check` option instead. - - The file '{0}' does not appear to be a valid project or solution file. 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 - - The `--files` option is deprecated. Use the `--include` option instead. - The `--files` option is deprecated. Use the `--include` option instead. - - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - - The project file '{0}' does not exist. 專案檔 '{0}' 不存在。 @@ -232,21 +202,11 @@ 解決方案檔 '{0}' 不存在。 - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 要操作的解決方案或專案檔。若未指定檔案,該命令會在目前的目錄中搜尋一個檔案。 - - Formatted code file '{0}'. Formatted code file '{0}'. - - The `--workspace` option is deprecated. Use the `<project>` argument instead. - The `--workspace` option is deprecated. Use the `<project>` argument instead. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. @@ -277,9 +237,9 @@ Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - - Whether to treat the `<project>` path as a folder of files. - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Whether to treat the `<workspace>` argument as a simple folder of files. diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 1d7ce5851c33..35789f9afd34 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests { @@ -32,10 +33,15 @@ public class CodeFormatterTests : IClassFixture, IClassFixture new Regex(@"((.*)\(\d+,\d+\): (.*))\r|((.*)\(\d+,\d+\): (.*))"); - public CodeFormatterTests(MSBuildFixture msBuildFixture, SolutionPathFixture solutionPathFixture) + private readonly ITestOutputHelper _output; + + + public CodeFormatterTests(ITestOutputHelper output, MSBuildFixture msBuildFixture, SolutionPathFixture solutionPathFixture) { - msBuildFixture.RegisterInstance(); + _output = output; + solutionPathFixture.SetCurrentDirectory(); + msBuildFixture.RegisterInstance(_output); } [Fact] @@ -407,6 +413,8 @@ public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEn var log = logger.GetLog(); + _output.WriteLine(log); + Assert.Equal(expectedExitCode, formatResult.ExitCode); Assert.Equal(expectedFilesFormatted, formatResult.FilesFormatted); Assert.Equal(expectedFileCount, formatResult.FileCount); diff --git a/tests/MSBuild/MSBuildWorkspaceFinderTests.cs b/tests/MSBuild/MSBuildWorkspaceFinderTests.cs index 84862589c1f4..e50650d60c93 100644 --- a/tests/MSBuild/MSBuildWorkspaceFinderTests.cs +++ b/tests/MSBuild/MSBuildWorkspaceFinderTests.cs @@ -22,7 +22,7 @@ public void ThrowsException_CannotFindMSBuildProjectFile() { var workspacePath = "tests/projects/for_workspace_finder/no_project_or_solution/"; var exceptionMessageStart = string.Format( - Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_option, + Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_argument, Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); Assert.StartsWith(exceptionMessageStart, exception.Message); @@ -33,7 +33,7 @@ public void ThrowsException_MultipleMSBuildProjectFiles() { var workspacePath = "tests/projects/for_workspace_finder/multiple_projects/"; var exceptionMessageStart = string.Format( - Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_option, + Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_argument, Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); Assert.Equal(exceptionMessageStart, exception.Message); @@ -44,7 +44,7 @@ public void ThrowsException_MultipleMSBuildSolutionFiles() { var workspacePath = "tests/projects/for_workspace_finder/multiple_solutions/"; var exceptionMessageStart = string.Format( - Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_option, + Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_argument, Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); Assert.Equal(exceptionMessageStart, exception.Message); @@ -55,7 +55,7 @@ public void ThrowsException_SolutionAndProjectAmbiguity() { var workspacePath = "tests/projects/for_workspace_finder/project_and_solution/"; var exceptionMessageStart = string.Format( - Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_option, + Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_argument, Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); Assert.Equal(exceptionMessageStart, exception.Message); diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 32250b123491..cb26e80ed7bd 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -11,8 +11,15 @@ namespace Microsoft.CodeAnalysis.Tools.Tests public class ProgramTests { // Should be kept in sync with Program.Run - private delegate void TestCommandHandlerDelegate(string project, string folder, string workspace, string verbosity, bool check, - string[] include, string[] exclude, string report, bool includeGenerated); + private delegate void TestCommandHandlerDelegate( + string workspace, + bool folder, + string verbosity, + bool check, + string[] include, + string[] exclude, + string report, + bool includeGenerated); [Fact] public void ExitCodeIsOneWithCheckAndAnyFilesFormatted() @@ -49,21 +56,19 @@ public void CommandLine_OptionsAreParsedCorrectly() // Act var result = sut.Parse(new[] { - "--folder", "folder", - "--workspace", "workspace", + "--folder", "--include", "include1", "include2", "--exclude", "exclude1", "exclude2", "--check", "--report", "report", - "--verbosity", "verbosity", + "--verbosity", "detailed", "--include-generated"}); // Assert - Assert.Equal(1, result.Errors.Count); // folder and workspace can not be combined + Assert.Equal(0, result.Errors.Count); Assert.Equal(0, result.UnmatchedTokens.Count); Assert.Equal(0, result.UnparsedTokens.Count); - Assert.Equal("folder", result.ValueForOption("folder")); - Assert.Equal("workspace", result.ValueForOption("workspace")); + Assert.True(result.ValueForOption("folder")); Assert.Collection(result.ValueForOption>("include"), i0 => Assert.Equal("include1", i0), i1 => Assert.Equal("include2", i1)); @@ -72,7 +77,7 @@ public void CommandLine_OptionsAreParsedCorrectly() i1 => Assert.Equal("exclude2", i1)); Assert.True(result.ValueForOption("check")); Assert.Equal("report", result.ValueForOption("report")); - Assert.Equal("verbosity", result.ValueForOption("verbosity")); + Assert.Equal("detailed", result.ValueForOption("verbosity")); Assert.True(result.ValueForOption("include-generated")); } @@ -83,11 +88,11 @@ public void CommandLine_ProjectArgument_Simple() var sut = FormatCommand.CreateCommandLineOptions(); // Act - var result = sut.Parse(new[] { "projectValue" }); + var result = sut.Parse(new[] { "workspaceValue" }); // Assert Assert.Equal(0, result.Errors.Count); - Assert.Equal("projectValue", result.CommandResult.GetArgumentValueOrDefault("project")); + Assert.Equal("workspaceValue", result.CommandResult.GetArgumentValueOrDefault("workspace")); } [Fact] @@ -97,12 +102,12 @@ public void CommandLine_ProjectArgument_WithOption_AfterArgument() var sut = FormatCommand.CreateCommandLineOptions(); // Act - var result = sut.Parse(new[] { "projectValue", "--verbosity", "verbosity" }); + var result = sut.Parse(new[] { "workspaceValue", "--verbosity", "detailed" }); // Assert Assert.Equal(0, result.Errors.Count); - Assert.Equal("projectValue", result.CommandResult.GetArgumentValueOrDefault("project")); - Assert.Equal("verbosity", result.ValueForOption("verbosity")); + Assert.Equal("workspaceValue", result.CommandResult.GetArgumentValueOrDefault("workspace")); + Assert.Equal("detailed", result.ValueForOption("verbosity")); } [Fact] @@ -112,12 +117,12 @@ public void CommandLine_ProjectArgument_WithOption_BeforeArgument() var sut = FormatCommand.CreateCommandLineOptions(); // Act - var result = sut.Parse(new[] { "--verbosity", "verbosity", "projectValue" }); + var result = sut.Parse(new[] { "--verbosity", "detailed", "workspaceValue" }); // Assert Assert.Equal(0, result.Errors.Count); - Assert.Equal("projectValue", result.CommandResult.GetArgumentValueOrDefault("project")); - Assert.Equal("verbosity", result.ValueForOption("verbosity")); + Assert.Equal("workspaceValue", result.CommandResult.GetArgumentValueOrDefault("workspace")); + Assert.Equal("detailed", result.ValueForOption("verbosity")); } [Fact] @@ -128,16 +133,23 @@ public void CommandLine_ProjectArgument_GetsPassedToHandler() var handlerWasCalled = false; sut.Handler = CommandHandler.Create(new TestCommandHandlerDelegate(TestCommandHandler)); - void TestCommandHandler(string project, string folder, string workspace, string verbosity, bool check, - string[] include, string[] exclude, string report, bool includeGenerated) + void TestCommandHandler( + string workspace, + bool folder, + string verbosity, + bool check, + string[] include, + string[] exclude, + string report, + bool includeGenerated) { handlerWasCalled = true; - Assert.Equal("projectValue", project); - Assert.Equal("verbosity", verbosity); + Assert.Equal("workspaceValue", workspace); + Assert.Equal("detailed", verbosity); }; // Act - var result = sut.Invoke(new[] { "--verbosity", "verbosity", "projectValue" }); + var result = sut.Invoke(new[] { "--verbosity", "detailed", "workspace" }); // Assert Assert.True(handlerWasCalled); @@ -150,59 +162,7 @@ public void CommandLine_ProjectArgument_FailesIfSpecifiedTwice() var sut = FormatCommand.CreateCommandLineOptions(); // Act - var result = sut.Parse(new[] { "projectValue1", "projectValue2" }); - - // Assert - Assert.Equal(1, result.Errors.Count); - } - - [Fact] - public void CommandLine_ProjectArgumentAndWorkspaceCanNotBeCombined() - { - // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); - - // Act - var result = sut.Parse(new[] { "projectValue", "--workspace", "workspace" }); - - // Assert - Assert.Equal(1, result.Errors.Count); - } - - [Fact] - public void CommandLine_ProjectArgumentAndFolderCanNotBeCombined1() - { - // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); - - // Act - var result = sut.Parse(new[] { "projectValue", "--folder", "folder" }); - - // Assert - Assert.Equal(1, result.Errors.Count); - } - - [Fact] - public void CommandLine_ProjectWorkspaceAndFolderCanNotBeCombined2() - { - // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); - - // Act - var result = sut.Parse(new[] { "--workspace", "workspace", "--folder", "folder" }); - - // Assert - Assert.Equal(1, result.Errors.Count); - } - - [Fact] - public void CommandLine_InvalidArgumentsDontCrashTheValidators() - { - // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); - - // Act - var result = sut.Parse(new[] { "--workspace", "workspace1", "--workspace", "workspace2" }); + var result = sut.Parse(new[] { "workspaceValue1", "workspaceValue2" }); // Assert Assert.Equal(1, result.Errors.Count); diff --git a/tests/Utilities/MSBuildFixture.cs b/tests/Utilities/MSBuildFixture.cs index 0c6ce95c5811..d0771c952cb1 100644 --- a/tests/Utilities/MSBuildFixture.cs +++ b/tests/Utilities/MSBuildFixture.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.Tools.MSBuild; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities { @@ -14,11 +15,14 @@ public class MSBuildFixture : IDisposable { private static int s_registered = 0; - public void RegisterInstance() + public void RegisterInstance(ITestOutputHelper output) { if (Interlocked.Exchange(ref s_registered, 1) == 0) { var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); + + output.WriteLine(Resources.Using_msbuildexe_located_in_0, msBuildInstance.MSBuildPath); + LooseVersionAssemblyLoader.Register(msBuildInstance.MSBuildPath); Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); } From c0ca2c6b2c9336564540778b58385de82b2fe2e2 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 25 Jun 2020 14:46:56 -0700 Subject: [PATCH 1066/2702] Make unit tests more reliable --- .vscode/launch.json | 3 +-- src/MSBuild/LooseVersionAssemblyLoader.cs | 12 +++++++++- tests/CodeFormatterTests.cs | 23 +++++++++---------- tests/MSBuild/MSBuildWorkspaceFinderTests.cs | 22 +++++++++--------- ...hFixture.cs => TestProjectsPathFixture.cs} | 6 ++--- tests/projects/Directory.Build.props | 4 ++++ tests/projects/Directory.Build.targets | 4 ++++ .../unformatted_project/.editorconfig | 2 +- 8 files changed, 46 insertions(+), 30 deletions(-) rename tests/Utilities/{SolutionPathFixture.cs => TestProjectsPathFixture.cs} (83%) create mode 100644 tests/projects/Directory.Build.props create mode 100644 tests/projects/Directory.Build.targets diff --git a/.vscode/launch.json b/.vscode/launch.json index 295ae46f022c..a2d619556ab0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -52,8 +52,7 @@ "--fix-style", "-v", "diag", - "--check", - "-?" + "--check" ], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console diff --git a/src/MSBuild/LooseVersionAssemblyLoader.cs b/src/MSBuild/LooseVersionAssemblyLoader.cs index 4bf844d8f02a..8ec7b2c5e9ee 100644 --- a/src/MSBuild/LooseVersionAssemblyLoader.cs +++ b/src/MSBuild/LooseVersionAssemblyLoader.cs @@ -63,7 +63,17 @@ public static void Register(string searchPath) continue; } - return LoadAndCache(context, candidatePath); + try + { + return LoadAndCache(context, candidatePath); + } + catch + { + // We were unable to load the assembly from the file path. It is likely that + // a different version of the assembly has already been loaded into the context. + // Be forgiving and attempt to load assembly by name without specifying a version. + return context.LoadFromAssemblyName(new AssemblyName(assemblyName.Name)); + } } } diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 35789f9afd34..d1aa16673460 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -15,18 +15,18 @@ namespace Microsoft.CodeAnalysis.Tools.Tests { - public class CodeFormatterTests : IClassFixture, IClassFixture + public class CodeFormatterTests : IClassFixture, IClassFixture { - private const string FormattedProjectPath = "tests/projects/for_code_formatter/formatted_project/"; + private const string FormattedProjectPath = "for_code_formatter/formatted_project/"; private const string FormattedProjectFilePath = FormattedProjectPath + "formatted_project.csproj"; - private const string FormattedSolutionFilePath = "tests/projects/for_code_formatter/formatted_solution/formatted_solution.sln"; + private const string FormattedSolutionFilePath = "for_code_formatter/formatted_solution/formatted_solution.sln"; - private const string UnformattedProjectPath = "tests/projects/for_code_formatter/unformatted_project/"; + private const string UnformattedProjectPath = "for_code_formatter/unformatted_project/"; private const string UnformattedProjectFilePath = UnformattedProjectPath + "unformatted_project.csproj"; private const string UnformattedProgramFilePath = UnformattedProjectPath + "program.cs"; - private const string UnformattedSolutionFilePath = "tests/projects/for_code_formatter/unformatted_solution/unformatted_solution.sln"; + private const string UnformattedSolutionFilePath = "for_code_formatter/unformatted_solution/unformatted_solution.sln"; - private const string FSharpProjectPath = "tests/projects/for_code_formatter/fsharp_project/"; + private const string FSharpProjectPath = "for_code_formatter/fsharp_project/"; private const string FSharpProjectFilePath = FSharpProjectPath + "fsharp_project.fsproj"; private static IEnumerable EmptyFilesList => Array.Empty(); @@ -35,12 +35,11 @@ public class CodeFormatterTests : IClassFixture, IClassFixture line.Contains("unformatted_project.AssemblyInfo.cs(1,1): Fix file encoding.")); - Assert.Contains(logLines, line => line.Contains("NETCoreApp,Version=v3.0.AssemblyAttributes.cs(1,1): Fix file encoding.")); + Assert.Contains(logLines, line => line.Contains("unformatted_project.AssemblyInfo.cs")); + Assert.Contains(logLines, line => line.Contains("NETCoreApp,Version=v3.0.AssemblyAttributes.cs")); } [Fact] @@ -124,7 +123,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 2, - expectedFileCount: 3); + expectedFileCount: 5); } [Fact] diff --git a/tests/MSBuild/MSBuildWorkspaceFinderTests.cs b/tests/MSBuild/MSBuildWorkspaceFinderTests.cs index e50650d60c93..c4ccb2dbe625 100644 --- a/tests/MSBuild/MSBuildWorkspaceFinderTests.cs +++ b/tests/MSBuild/MSBuildWorkspaceFinderTests.cs @@ -8,19 +8,19 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.MSBuild { - public class MSBuildWorkspaceFinderTests : IClassFixture + public class MSBuildWorkspaceFinderTests : IClassFixture { private string SolutionPath => Environment.CurrentDirectory; - public MSBuildWorkspaceFinderTests(SolutionPathFixture solutionPathFixture) + public MSBuildWorkspaceFinderTests(TestProjectsPathFixture testProjectsPathFixture) { - solutionPathFixture.SetCurrentDirectory(); + testProjectsPathFixture.SetCurrentDirectory(); } [Fact] public void ThrowsException_CannotFindMSBuildProjectFile() { - var workspacePath = "tests/projects/for_workspace_finder/no_project_or_solution/"; + var workspacePath = "for_workspace_finder/no_project_or_solution/"; var exceptionMessageStart = string.Format( Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_argument, Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); @@ -31,7 +31,7 @@ public void ThrowsException_CannotFindMSBuildProjectFile() [Fact] public void ThrowsException_MultipleMSBuildProjectFiles() { - var workspacePath = "tests/projects/for_workspace_finder/multiple_projects/"; + var workspacePath = "for_workspace_finder/multiple_projects/"; var exceptionMessageStart = string.Format( Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_argument, Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); @@ -42,7 +42,7 @@ public void ThrowsException_MultipleMSBuildProjectFiles() [Fact] public void ThrowsException_MultipleMSBuildSolutionFiles() { - var workspacePath = "tests/projects/for_workspace_finder/multiple_solutions/"; + var workspacePath = "for_workspace_finder/multiple_solutions/"; var exceptionMessageStart = string.Format( Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_argument, Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); @@ -53,7 +53,7 @@ public void ThrowsException_MultipleMSBuildSolutionFiles() [Fact] public void ThrowsException_SolutionAndProjectAmbiguity() { - var workspacePath = "tests/projects/for_workspace_finder/project_and_solution/"; + var workspacePath = "for_workspace_finder/project_and_solution/"; var exceptionMessageStart = string.Format( Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_argument, Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); @@ -64,7 +64,7 @@ public void ThrowsException_SolutionAndProjectAmbiguity() [Fact] public void FindsSolutionByFolder() { - const string Path = "tests/projects/for_workspace_finder/single_solution/"; + const string Path = "for_workspace_finder/single_solution/"; var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); @@ -76,7 +76,7 @@ public void FindsSolutionByFolder() [Fact] public void FindsSolutionByFilePath() { - const string Path = "tests/projects/for_workspace_finder/multiple_solutions/solution_b.sln"; + const string Path = "for_workspace_finder/multiple_solutions/solution_b.sln"; var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); @@ -88,7 +88,7 @@ public void FindsSolutionByFilePath() [Fact] public void FindsProjectByFolder() { - const string Path = "tests/projects/for_workspace_finder/single_project/"; + const string Path = "for_workspace_finder/single_project/"; var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); @@ -100,7 +100,7 @@ public void FindsProjectByFolder() [Fact] public void FindsProjectByFilePath() { - const string Path = "tests/projects/for_workspace_finder/multiple_projects/project_b.csproj"; + const string Path = "for_workspace_finder/multiple_projects/project_b.csproj"; var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); diff --git a/tests/Utilities/SolutionPathFixture.cs b/tests/Utilities/TestProjectsPathFixture.cs similarity index 83% rename from tests/Utilities/SolutionPathFixture.cs rename to tests/Utilities/TestProjectsPathFixture.cs index 271159b7d8c8..567424e2d52f 100644 --- a/tests/Utilities/SolutionPathFixture.cs +++ b/tests/Utilities/TestProjectsPathFixture.cs @@ -7,9 +7,9 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities { /// - /// This test fixture sets the to the dotnet-format solution's path. + /// This test fixture sets the to the dotnet-format test projects folder path. /// - public class SolutionPathFixture : IDisposable + public class TestProjectsPathFixture : IDisposable { private static int s_registered = 0; private static string s_currentDirectory; @@ -20,7 +20,7 @@ public void SetCurrentDirectory() { s_currentDirectory = Environment.CurrentDirectory; var solutionPath = Directory.GetParent(s_currentDirectory).Parent.Parent.Parent.Parent.FullName; - Environment.CurrentDirectory = solutionPath; + Environment.CurrentDirectory = Path.Combine(solutionPath, "tests", "projects"); } } diff --git a/tests/projects/Directory.Build.props b/tests/projects/Directory.Build.props new file mode 100644 index 000000000000..1cd50ce64f1d --- /dev/null +++ b/tests/projects/Directory.Build.props @@ -0,0 +1,4 @@ + + + + diff --git a/tests/projects/Directory.Build.targets b/tests/projects/Directory.Build.targets new file mode 100644 index 000000000000..8f68664271be --- /dev/null +++ b/tests/projects/Directory.Build.targets @@ -0,0 +1,4 @@ + + + + diff --git a/tests/projects/for_code_formatter/unformatted_project/.editorconfig b/tests/projects/for_code_formatter/unformatted_project/.editorconfig index 8b5bebcf126c..68704aa414a4 100644 --- a/tests/projects/for_code_formatter/unformatted_project/.editorconfig +++ b/tests/projects/for_code_formatter/unformatted_project/.editorconfig @@ -2,7 +2,7 @@ root = true # C# files -[{Program.cs,other_items/*.cs}] +[{Program.cs,other_items/*.cs,obj/**/*.cs}] #### Core EditorConfig Options #### From a85d00d98ff0ea1e7738ec3d54ed0b838fa8537e Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 2 Jul 2020 09:35:08 -0700 Subject: [PATCH 1067/2702] Fix up workspace argument test --- tests/ProgramTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 5971439a26f8..e1ab397ea46a 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -156,7 +156,7 @@ void TestCommandHandler( } [Fact] - public void CommandLine_ProjectArgument_FailesIfSpecifiedTwice() + public void CommandLine_ProjectArgument_FailsIfSpecifiedTwice() { // Arrange var sut = FormatCommand.CreateCommandLineOptions(); @@ -165,7 +165,7 @@ public void CommandLine_ProjectArgument_FailesIfSpecifiedTwice() var result = sut.Parse(new[] { "workspaceValue1", "workspaceValue2" }); // Assert - Assert.Equal(2, result.Errors.Count); + Assert.Equal(1, result.Errors.Count); } } } From 0dcaf98d4ad5aeb4f3904f4df372dee72222159b Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 2 Jul 2020 10:54:24 -0700 Subject: [PATCH 1068/2702] Add validation when specifying --folder and analyzers --- src/FormatCommand.cs | 20 ++++++++++++++++++++ tests/ProgramTests.cs | 26 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 16f80888f4de..521ccf3b7853 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -54,10 +54,30 @@ internal static RootCommand CreateCommandLineOptions() }; rootCommand.Description = "dotnet-format"; + rootCommand.AddValidator(EnsureFolderNotSpecifiedWhenFixingStyle); + rootCommand.AddValidator(EnsureFolderNotSpecifiedWhenFixingAnalyzers); return rootCommand; } + internal static string? EnsureFolderNotSpecifiedWhenFixingAnalyzers(CommandResult symbolResult) + { + var folder = symbolResult.ValueForOption("--folder"); + var fixAnalyzers = symbolResult.OptionResult("--fix-analyzers"); + return folder && fixAnalyzers != null + ? "Cannot specify the '--folder' option when running analyzers." + : null; + } + + internal static string? EnsureFolderNotSpecifiedWhenFixingStyle(CommandResult symbolResult) + { + var folder = symbolResult.ValueForOption("--folder"); + var fixStyle = symbolResult.OptionResult("--fix-style"); + return folder && fixStyle != null + ? "Cannot specify the '--folder' option when fixing style." + : null; + } + internal static bool WasOptionUsed(this ParseResult result, params string[] aliases) { return result.Tokens diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index e1ab397ea46a..e3c712c0d7bb 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -167,5 +167,31 @@ public void CommandLine_ProjectArgument_FailsIfSpecifiedTwice() // Assert Assert.Equal(1, result.Errors.Count); } + + [Fact] + public void CommandLine_FolderValidation_FailsIfFixAnalyzersSpecified() + { + // Arrange + var sut = FormatCommand.CreateCommandLineOptions(); + + // Act + var result = sut.Parse(new[] { "--folder", "--fix-analyzers" }); + + // Assert + Assert.Equal(1, result.Errors.Count); + } + + [Fact] + public void CommandLine_FolderValidation_FailsIfFixStyleSpecified() + { + // Arrange + var sut = FormatCommand.CreateCommandLineOptions(); + + // Act + var result = sut.Parse(new[] { "--folder", "--fix-style" }); + + // Assert + Assert.Equal(1, result.Errors.Count); + } } } From b255ad16af715cae7bf2a80cc1db697742f46d96 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2020 23:56:13 +0000 Subject: [PATCH 1069/2702] Update dependencies from https://github.com/dotnet/arcade build 20200630.3 (#714) Microsoft.DotNet.Arcade.Sdk From Version 5.0.0-beta.20316.1 -> To Version 5.0.0-beta.20330.3 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 +- eng/common/cross/arm64/tizen-build-rootfs.sh | 35 ++++ eng/common/cross/arm64/tizen-fetch.sh | 170 ++++++++++++++++++ eng/common/cross/arm64/tizen/tizen.patch | 9 + eng/common/cross/build-rootfs.sh | 4 +- eng/common/cross/toolchain.cmake | 33 +++- eng/common/internal-feed-operations.ps1 | 1 + eng/common/internal-feed-operations.sh | 1 + eng/common/performance/perfhelixpublish.proj | 39 +++- .../post-build/check-channel-consistency.ps1 | 10 ++ eng/common/post-build/symbols-validation.ps1 | 45 +++-- .../templates/post-build/post-build.yml | 4 +- global.json | 2 +- 13 files changed, 331 insertions(+), 26 deletions(-) create mode 100644 eng/common/cross/arm64/tizen-build-rootfs.sh create mode 100644 eng/common/cross/arm64/tizen-fetch.sh create mode 100644 eng/common/cross/arm64/tizen/tizen.patch diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7b7e3a79e7e8..b63ea7802e0c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 71b580038fb704df63e03c6b7ae7d2c6a4fdd71d + 243cc92161ad44c2a07464425892daee19121c99 diff --git a/eng/common/cross/arm64/tizen-build-rootfs.sh b/eng/common/cross/arm64/tizen-build-rootfs.sh new file mode 100644 index 000000000000..13bfddb5e2a7 --- /dev/null +++ b/eng/common/cross/arm64/tizen-build-rootfs.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +set -e + +__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +__TIZEN_CROSSDIR="$__CrossDir/tizen" + +if [[ -z "$ROOTFS_DIR" ]]; then + echo "ROOTFS_DIR is not defined." + exit 1; +fi + +TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp +mkdir -p $TIZEN_TMP_DIR + +# Download files +echo ">>Start downloading files" +VERBOSE=1 $__CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR +echo "<>Start constructing Tizen rootfs" +TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm` +cd $ROOTFS_DIR +for f in $TIZEN_RPM_FILES; do + rpm2cpio $f | cpio -idm --quiet +done +echo "<>Start configuring Tizen rootfs" +ln -sfn asm-arm64 ./usr/include/asm +patch -p1 < $__TIZEN_CROSSDIR/tizen.patch +echo "</dev/null; then + VERBOSE=0 +fi + +Log() +{ + if [ $VERBOSE -ge $1 ]; then + echo ${@:2} + fi +} + +Inform() +{ + Log 1 -e "\x1B[0;34m$@\x1B[m" +} + +Debug() +{ + Log 2 -e "\x1B[0;32m$@\x1B[m" +} + +Error() +{ + >&2 Log 0 -e "\x1B[0;31m$@\x1B[m" +} + +Fetch() +{ + URL=$1 + FILE=$2 + PROGRESS=$3 + if [ $VERBOSE -ge 1 ] && [ $PROGRESS ]; then + CURL_OPT="--progress-bar" + else + CURL_OPT="--silent" + fi + curl $CURL_OPT $URL > $FILE +} + +hash curl 2> /dev/null || { Error "Require 'curl' Aborting."; exit 1; } +hash xmllint 2> /dev/null || { Error "Require 'xmllint' Aborting."; exit 1; } +hash sha256sum 2> /dev/null || { Error "Require 'sha256sum' Aborting."; exit 1; } + +TMPDIR=$1 +if [ ! -d $TMPDIR ]; then + TMPDIR=./tizen_tmp + Debug "Create temporary directory : $TMPDIR" + mkdir -p $TMPDIR +fi + +TIZEN_URL=http://download.tizen.org/snapshots/tizen/ +BUILD_XML=build.xml +REPOMD_XML=repomd.xml +PRIMARY_XML=primary.xml +TARGET_URL="http://__not_initialized" + +Xpath_get() +{ + XPATH_RESULT='' + XPATH=$1 + XML_FILE=$2 + RESULT=$(xmllint --xpath $XPATH $XML_FILE) + if [[ -z ${RESULT// } ]]; then + Error "Can not find target from $XML_FILE" + Debug "Xpath = $XPATH" + exit 1 + fi + XPATH_RESULT=$RESULT +} + +fetch_tizen_pkgs_init() +{ + TARGET=$1 + PROFILE=$2 + Debug "Initialize TARGET=$TARGET, PROFILE=$PROFILE" + + TMP_PKG_DIR=$TMPDIR/tizen_${PROFILE}_pkgs + if [ -d $TMP_PKG_DIR ]; then rm -rf $TMP_PKG_DIR; fi + mkdir -p $TMP_PKG_DIR + + PKG_URL=$TIZEN_URL/$PROFILE/latest + + BUILD_XML_URL=$PKG_URL/$BUILD_XML + TMP_BUILD=$TMP_PKG_DIR/$BUILD_XML + TMP_REPOMD=$TMP_PKG_DIR/$REPOMD_XML + TMP_PRIMARY=$TMP_PKG_DIR/$PRIMARY_XML + TMP_PRIMARYGZ=${TMP_PRIMARY}.gz + + Fetch $BUILD_XML_URL $TMP_BUILD + + Debug "fetch $BUILD_XML_URL to $TMP_BUILD" + + TARGET_XPATH="//build/buildtargets/buildtarget[@name=\"$TARGET\"]/repo[@type=\"binary\"]/text()" + Xpath_get $TARGET_XPATH $TMP_BUILD + TARGET_PATH=$XPATH_RESULT + TARGET_URL=$PKG_URL/$TARGET_PATH + + REPOMD_URL=$TARGET_URL/repodata/repomd.xml + PRIMARY_XPATH='string(//*[local-name()="data"][@type="primary"]/*[local-name()="location"]/@href)' + + Fetch $REPOMD_URL $TMP_REPOMD + + Debug "fetch $REPOMD_URL to $TMP_REPOMD" + + Xpath_get $PRIMARY_XPATH $TMP_REPOMD + PRIMARY_XML_PATH=$XPATH_RESULT + PRIMARY_URL=$TARGET_URL/$PRIMARY_XML_PATH + + Fetch $PRIMARY_URL $TMP_PRIMARYGZ + + Debug "fetch $PRIMARY_URL to $TMP_PRIMARYGZ" + + gunzip $TMP_PRIMARYGZ + + Debug "unzip $TMP_PRIMARYGZ to $TMP_PRIMARY" +} + +fetch_tizen_pkgs() +{ + ARCH=$1 + PACKAGE_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="location"]/@href)' + + PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())' + + for pkg in ${@:2} + do + Inform "Fetching... $pkg" + XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + PKG_PATH=$XPATH_RESULT + + XPATH=${PACKAGE_CHECKSUM_XPATH_TPL/_PKG_/$pkg} + XPATH=${XPATH/_ARCH_/$ARCH} + Xpath_get $XPATH $TMP_PRIMARY + CHECKSUM=$XPATH_RESULT + + PKG_URL=$TARGET_URL/$PKG_PATH + PKG_FILE=$(basename $PKG_PATH) + PKG_PATH=$TMPDIR/$PKG_FILE + + Debug "Download $PKG_URL to $PKG_PATH" + Fetch $PKG_URL $PKG_PATH true + + echo "$CHECKSUM $PKG_PATH" | sha256sum -c - > /dev/null + if [ $? -ne 0 ]; then + Error "Fail to fetch $PKG_URL to $PKG_PATH" + Debug "Checksum = $CHECKSUM" + exit 1 + fi + done +} + +Inform "Initialize arm base" +fetch_tizen_pkgs_init standard base +Inform "fetch common packages" +fetch_tizen_pkgs aarch64 gcc glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel +Inform "fetch coreclr packages" +fetch_tizen_pkgs aarch64 lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu +Inform "fetch corefx packages" +fetch_tizen_pkgs aarch64 libcom_err libcom_err-devel zlib zlib-devel libopenssl libopenssl1.1-devel krb5 krb5-devel + +Inform "Initialize standard unified" +fetch_tizen_pkgs_init standard unified +Inform "fetch corefx packages" +fetch_tizen_pkgs aarch64 gssdp gssdp-devel tizen-release + diff --git a/eng/common/cross/arm64/tizen/tizen.patch b/eng/common/cross/arm64/tizen/tizen.patch new file mode 100644 index 000000000000..af7c8be05906 --- /dev/null +++ b/eng/common/cross/arm64/tizen/tizen.patch @@ -0,0 +1,9 @@ +diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so +--- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 ++++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 +@@ -2,4 +2,4 @@ + Use the shared library, but some functions are only in + the static library, so try that secondarily. */ + OUTPUT_FORMAT(elf64-littleaarch64) +-GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-aarch64.so.1 ) ) ++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-aarch64.so.1 ) ) diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index d6ec94b73e06..ffdff38542e1 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -167,8 +167,8 @@ while :; do __LLDB_Package="liblldb-6.0-dev" ;; tizen) - if [ "$__BuildArch" != "armel" ]; then - echo "Tizen is available only for armel." + if [ "$__BuildArch" != "armel" ] && [ "$__BuildArch" != "arm64" ]; then + echo "Tizen is available only for armel and arm64." usage; exit 1; fi diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index ec512d012a1c..88a758afb19c 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -31,6 +31,9 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm64") else() set(TOOLCHAIN "aarch64-linux-gnu") endif() + if("$ENV{__DistroRid}" MATCHES "tizen.*") + set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu/9.2.0") + endif() elseif(TARGET_ARCH_NAME STREQUAL "x86") set(CMAKE_SYSTEM_PROCESSOR i686) set(TOOLCHAIN "i686-linux-gnu") @@ -49,11 +52,15 @@ if(DEFINED ENV{TOOLCHAIN}) endif() # Specify include paths -if(TARGET_ARCH_NAME STREQUAL "armel") - if(DEFINED TIZEN_TOOLCHAIN) +if(DEFINED TIZEN_TOOLCHAIN) + if(TARGET_ARCH_NAME STREQUAL "armel") include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi) endif() + if(TARGET_ARCH_NAME STREQUAL "arm64") + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) + include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/aarch64-tizen-linux-gnu) + endif() endif() if("$ENV{__DistroRid}" MATCHES "android.*") @@ -127,6 +134,17 @@ if(TARGET_ARCH_NAME STREQUAL "armel") add_link_options("-L${CROSS_ROOTFS}/usr/lib") add_link_options("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") endif() +elseif(TARGET_ARCH_NAME STREQUAL "arm64") + if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only + add_link_options("-B${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_link_options("-L${CROSS_ROOTFS}/lib64") + add_link_options("-L${CROSS_ROOTFS}/usr/lib64") + add_link_options("-L${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + + add_link_options("-Wl,--rpath-link=${CROSS_ROOTFS}/lib64") + add_link_options("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64") + add_link_options("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + endif() elseif(TARGET_ARCH_NAME STREQUAL "x86") add_link_options(-m32) elseif(ILLUMOS) @@ -157,16 +175,19 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") if(TARGET_ARCH_NAME STREQUAL "armel") add_compile_options(-mfloat-abi=softfp) - if(DEFINED TIZEN_TOOLCHAIN) - add_compile_options(-Wno-deprecated-declarations) # compile-time option - add_compile_options(-D__extern_always_inline=inline) # compile-time option - endif() endif() elseif(TARGET_ARCH_NAME STREQUAL "x86") add_compile_options(-m32) add_compile_options(-Wno-error=unused-command-line-argument) endif() +if(DEFINED TIZEN_TOOLCHAIN) + if(TARGET_ARCH_NAME MATCHES "^(armel|arm64)$") + add_compile_options(-Wno-deprecated-declarations) # compile-time option + add_compile_options(-D__extern_always_inline=inline) # compile-time option + endif() +endif() + # Set LLDB include and library paths for builds that need lldb. if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") if(TARGET_ARCH_NAME STREQUAL "x86") diff --git a/eng/common/internal-feed-operations.ps1 b/eng/common/internal-feed-operations.ps1 index db0baac9a445..b8f6529fdc87 100644 --- a/eng/common/internal-feed-operations.ps1 +++ b/eng/common/internal-feed-operations.ps1 @@ -63,6 +63,7 @@ function SetupCredProvider { } if (($endpoints | Measure-Object).Count -gt 0) { + # [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Endpoint code example with no real credentials.")] # Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}' $endpointCredentials = @{endpointCredentials=$endpoints} | ConvertTo-Json -Compress diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh index 5941ea283358..9ed225e7e559 100755 --- a/eng/common/internal-feed-operations.sh +++ b/eng/common/internal-feed-operations.sh @@ -62,6 +62,7 @@ function SetupCredProvider { endpoints+=']' if [ ${#endpoints} -gt 2 ]; then + # [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Endpoint code example with no real credentials.")] # Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}' local endpointCredentials="{\"endpointCredentials\": "$endpoints"}" diff --git a/eng/common/performance/perfhelixpublish.proj b/eng/common/performance/perfhelixpublish.proj index 47d3ba00f3f2..272366da95fc 100644 --- a/eng/common/performance/perfhelixpublish.proj +++ b/eng/common/performance/perfhelixpublish.proj @@ -63,6 +63,11 @@ $(WorkItemCommand) $(CliArguments) + + + 2:30 + 0:15 + @@ -71,7 +76,7 @@ - 5 + 30 @@ -79,6 +84,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -94,7 +124,7 @@ $(WorkItemCommand) --bdn-artifacts $(BaselineArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" $(WorkItemCommand) --bdn-artifacts $(ArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults);$(FinalCommand) - 4:00 + $(WorkItemTimeout) @@ -152,6 +182,11 @@ $(WorkItemDirectory)\ScenarioCorrelation $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\test.py crossgen2 --single System.Private.CoreLib.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root + + $(WorkItemDirectory)\ScenarioCorrelation + $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\test.py crossgen2 --composite %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\framework-r2r.dll.rsp --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root + 1:00 + \ No newline at end of file diff --git a/eng/common/post-build/check-channel-consistency.ps1 b/eng/common/post-build/check-channel-consistency.ps1 index 38abc5392dc7..63f3464c986a 100644 --- a/eng/common/post-build/check-channel-consistency.ps1 +++ b/eng/common/post-build/check-channel-consistency.ps1 @@ -15,12 +15,22 @@ try { # is available in YAML $PromoteToChannelsIds = $PromoteToChannels -split "\D" | Where-Object { $_ } + $hasErrors = $false + foreach ($id in $PromoteToChannelsIds) { if (($id -ne 0) -and ($id -notin $AvailableChannelIds)) { Write-PipelineTaskError -Message "Channel $id is not present in the post-build YAML configuration! This is an error scenario. Please contact @dnceng." + $hasErrors = $true } } + # The `Write-PipelineTaskError` doesn't error the script and we might report several errors + # in the previous lines. The check below makes sure that we return an error state from the + # script if we reported any validation error + if ($hasErrors) { + ExitWithExitCode 1 + } + Write-Host 'done.' } catch { diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 index bf7c15e79de1..495428ea2b51 100644 --- a/eng/common/post-build/symbols-validation.ps1 +++ b/eng/common/post-build/symbols-validation.ps1 @@ -24,7 +24,7 @@ $CountMissingSymbols = { # Ensure input file exist if (!(Test-Path $PackagePath)) { Write-PipelineTaskError "Input file does not exist: $PackagePath" - return 1 + return -2 } # Extensions for which we'll look for symbols @@ -44,7 +44,10 @@ $CountMissingSymbols = { catch { Write-Host "Something went wrong extracting $PackagePath" Write-Host $_ - return -1 + return [pscustomobject]@{ + result = -1 + packagePath = $PackagePath + } } Get-ChildItem -Recurse $ExtractPath | @@ -146,7 +149,24 @@ $CountMissingSymbols = { Pop-Location - return $MissingSymbols + return [pscustomobject]@{ + result = $MissingSymbols + packagePath = $PackagePath + } +} + +function CheckJobResult( + $result, + $packagePath, + [ref]$DupedSymbols, + [ref]$TotalFailures) { + if ($result -eq '-1') { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$packagePath has duplicated symbol files" + $DupedSymbols.Value++ + } + elseif ($jobResult.result -ne '0') { + $TotalFailures.Value++ + } } function CheckSymbolsAvailable { @@ -155,6 +175,7 @@ function CheckSymbolsAvailable { } $TotalFailures = 0 + $DupedSymbols = 0 Get-ChildItem "$InputPath\*.nupkg" | ForEach-Object { @@ -190,9 +211,7 @@ function CheckSymbolsAvailable { foreach ($Job in @(Get-Job -State 'Completed')) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job - if ($jobResult -ne '0') { - $TotalFailures++ - } + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$DupedSymbols) ([ref]$TotalFailures) Remove-Job -Id $Job.Id } Write-Host @@ -200,14 +219,18 @@ function CheckSymbolsAvailable { foreach ($Job in @(Get-Job)) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$DupedSymbols) ([ref]$TotalFailures) + } - if ($jobResult -ne '0') { - $TotalFailures++ + if ($TotalFailures -gt 0 -or $DupedSymbols -gt 0) { + if ($TotalFailures -gt 0) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Symbols missing for $TotalFailures packages" } - } - if ($TotalFailures -gt 0) { - Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Symbols missing for $TotalFailures packages" + if ($DupedSymbols -gt 0) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$DupedSymbols packages had duplicated symbol files" + } + ExitWithExitCode 1 } else { diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 514bfaa5ea0a..07fc2e982df1 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -114,7 +114,7 @@ stages: inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 arguments: -PromoteToChannels "$(TargetChannels)" - -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview5ChannelId}},${{parameters.Net5Preview6ChannelId}},${{parameters.Net5Preview7ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}}${{parameters.VS167ChannelId}},${{parameters.VSMasterChannelId}} + -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview5ChannelId}},${{parameters.Net5Preview6ChannelId}},${{parameters.Net5Preview7ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VSMasterChannelId}} - job: displayName: NuGet Validation @@ -520,4 +520,4 @@ stages: channelId: ${{ parameters.VSMasterChannelId }} transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' \ No newline at end of file + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' diff --git a/global.json b/global.json index 74627d3d40c7..c9bb4b4b2544 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-preview.6.20310.4" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20316.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20330.3" } } From 57e8aa5f1d5b5c0592ce227b9bfca23e78529231 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 3 Jul 2020 17:46:29 -0700 Subject: [PATCH 1070/2702] Copy NuGet packages to build directory. --- .vscode/launch.json | 8 ++++---- src/dotnet-format.csproj | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a2d619556ab0..ce09769c208d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -44,9 +44,9 @@ "name": "format format.sln --fix-style --check", "type": "coreclr", "request": "launch", - "preLaunchTask": "publish", + "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/publish/dotnet-format.dll", + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/dotnet-format.dll", "args": [ "format.sln", "--fix-style", @@ -63,9 +63,9 @@ "name": "format format.sln --fix-analyzers warn --check", "type": "coreclr", "request": "launch", - "preLaunchTask": "publish", + "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/publish/dotnet-format.dll", + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp2.1/dotnet-format.dll", "args": [ "format.sln", "--fix-analyzers", diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 7d5d17d059f4..e1ba6ea91212 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -13,6 +13,9 @@ $(NoWarn);8002 Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings. + + true + LatestMajor From 42d4fee4f5dc4f64ea1f71a6ab00624245daeaac Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 3 Jul 2020 17:50:57 -0700 Subject: [PATCH 1071/2702] Run NamingStyle analyzers --- src/Analyzers/AnalyzerFinderHelpers.cs | 29 --------- src/Analyzers/AnalyzerFormatter.cs | 65 ++++++++++++++++--- ...> AnalyzerReferenceInformationProvider.cs} | 15 +---- src/Analyzers/AnalyzerRunner.cs | 6 +- ...der.cs => CodeStyleInformationProvider.cs} | 17 ++--- ...der.cs => IAnalyzerInformationProvider.cs} | 14 +--- src/Analyzers/Interfaces/IAnalyzerRunner.cs | 2 + src/CodeFormatter.cs | 4 +- tests/Analyzers/FilterDiagnosticsTests.cs | 4 +- 9 files changed, 74 insertions(+), 82 deletions(-) rename src/Analyzers/{AnalyzerReferenceAnalyzerFinder.cs => AnalyzerReferenceInformationProvider.cs} (62%) rename src/Analyzers/{RoslynCodeStyleAnalyzerFinder.cs => CodeStyleInformationProvider.cs} (68%) rename src/Analyzers/Interfaces/{IAnalyzerFinder.cs => IAnalyzerInformationProvider.cs} (54%) diff --git a/src/Analyzers/AnalyzerFinderHelpers.cs b/src/Analyzers/AnalyzerFinderHelpers.cs index cb069816c0dc..f0e36f7e1142 100644 --- a/src/Analyzers/AnalyzerFinderHelpers.cs +++ b/src/Analyzers/AnalyzerFinderHelpers.cs @@ -4,8 +4,6 @@ using System.Collections.Immutable; using System.Linq; using System.Reflection; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; @@ -50,32 +48,5 @@ internal static class AnalyzerFinderHelpers return builder.ToImmutableArray(); } - - public static async Task>> FilterBySeverityAsync( - IEnumerable projects, - ImmutableArray allAnalyzers, - ImmutableHashSet formattablePaths, - DiagnosticSeverity minimumSeverity, - CancellationToken cancellationToken) - { - var projectAnalyzers = ImmutableDictionary.CreateBuilder>(); - foreach (var project in projects) - { - var analyzers = ImmutableArray.CreateBuilder(); - - foreach (var analyzer in allAnalyzers) - { - var severity = await analyzer.GetSeverityAsync(project, formattablePaths, cancellationToken).ConfigureAwait(false); - if (severity >= minimumSeverity) - { - analyzers.Add(analyzer); - } - } - - projectAnalyzers.Add(project, analyzers.ToImmutableArray()); - } - - return projectAnalyzers.ToImmutableDictionary(); - } } } diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index da3a8cb39790..7a64e4f00ebd 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -17,18 +17,18 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers internal class AnalyzerFormatter : ICodeFormatter { private readonly string _name; - private readonly IAnalyzerFinder _finder; + private readonly IAnalyzerInformationProvider _informationProvider; private readonly IAnalyzerRunner _runner; private readonly ICodeFixApplier _applier; public AnalyzerFormatter( string name, - IAnalyzerFinder finder, + IAnalyzerInformationProvider finder, IAnalyzerRunner runner, ICodeFixApplier applier) { _name = name; - _finder = finder; + _informationProvider = finder; _runner = runner; _applier = applier; } @@ -41,7 +41,7 @@ public async Task FormatAsync( List formattedFiles, CancellationToken cancellationToken) { - var analyzersAndFixers = _finder.GetAnalyzersAndFixers(solution, formatOptions, logger); + var analyzersAndFixers = _informationProvider.GetAnalyzersAndFixers(solution, formatOptions, logger); if (analyzersAndFixers.Length == 0) { return solution; @@ -56,16 +56,21 @@ public async Task FormatAsync( logger.LogTrace(Resources.Determining_diagnostics); var allAnalyzers = analyzersAndFixers.Select(pair => pair.Analyzer).ToImmutableArray(); - var projectAnalyzers = await _finder.FilterBySeverityAsync(solution.Projects, allAnalyzers, formattablePaths, formatOptions, cancellationToken).ConfigureAwait(false); + var severity = _informationProvider.GetSeverity(formatOptions); - var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, formatOptions, logger, formattedFiles, cancellationToken).ConfigureAwait(false); + // Filter to analyzers that report diagnostics with equal or greater severity. + var projectAnalyzers = await FilterBySeverityAsync(solution.Projects, allAnalyzers, formattablePaths, severity, cancellationToken).ConfigureAwait(false); + + // Determine which diagnostics are being reported for each project. + var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, formatOptions, severity, logger, formattedFiles, cancellationToken).ConfigureAwait(false); var projectDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds; logger.LogTrace(Resources.Complete_in_0_ms, projectDiagnosticsMS); logger.LogTrace(Resources.Fixing_diagnostics); - solution = await FixDiagnosticsAsync(solution, analyzersAndFixers, projectDiagnostics, formattablePaths, logger, cancellationToken).ConfigureAwait(false); + // Run each analyzer individually and apply fixes if possible. + solution = await FixDiagnosticsAsync(solution, analyzersAndFixers, projectDiagnostics, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); var fixDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds - projectDiagnosticsMS; logger.LogTrace(Resources.Complete_in_0_ms, fixDiagnosticsMS); @@ -80,6 +85,7 @@ private async Task>> Get ImmutableDictionary> projectAnalyzers, ImmutableHashSet formattablePaths, FormatOptions options, + DiagnosticSeverity severity, ILogger logger, List formattedFiles, CancellationToken cancellationToken) @@ -93,7 +99,8 @@ private async Task>> Get continue; } - await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, logger, cancellationToken).ConfigureAwait(false); + // Run all the filtered analyzers to determine which are reporting diagnostic. + await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); } LogDiagnosticLocations(solution, result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger, formattedFiles); @@ -133,10 +140,11 @@ private async Task FixDiagnosticsAsync( ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> analyzersAndFixers, ImmutableDictionary> projectDiagnostics, ImmutableHashSet formattablePaths, + DiagnosticSeverity severity, ILogger logger, CancellationToken cancellationToken) { - // we need to run each codefix iteratively so ensure that all diagnostics are found and fixed + // We need to run each codefix iteratively so ensure that all diagnostics are found and fixed. foreach (var (analyzer, codefix) in analyzersAndFixers) { var result = new CodeAnalysisResult(); @@ -148,7 +156,7 @@ private async Task FixDiagnosticsAsync( continue; } - await _runner.RunCodeAnalysisAsync(result, analyzer, project, formattablePaths, logger, cancellationToken).ConfigureAwait(false); + await _runner.RunCodeAnalysisAsync(result, analyzer, project, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); } var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Count > 0); @@ -165,5 +173,42 @@ private async Task FixDiagnosticsAsync( return solution; } + + internal static async Task>> FilterBySeverityAsync( + IEnumerable projects, + ImmutableArray allAnalyzers, + ImmutableHashSet formattablePaths, + DiagnosticSeverity minimumSeverity, + CancellationToken cancellationToken) + { + // We only want to run analyzers for each project that have the potential for reporting a diagnostic with + // a severity equal to or greater than specified. + var projectAnalyzers = ImmutableDictionary.CreateBuilder>(); + foreach (var project in projects) + { + var analyzers = ImmutableArray.CreateBuilder(); + + foreach (var analyzer in allAnalyzers) + { + // Always run naming style analyzers because we cannot determine potential severity. + // The reported diagnostics will be filtered by severity when they are run. + if (analyzer.GetType().FullName.EndsWith("NamingStyleDiagnosticAnalyzer")) + { + analyzers.Add(analyzer); + continue; + } + + var severity = await analyzer.GetSeverityAsync(project, formattablePaths, cancellationToken).ConfigureAwait(false); + if (severity >= minimumSeverity) + { + analyzers.Add(analyzer); + } + } + + projectAnalyzers.Add(project, analyzers.ToImmutableArray()); + } + + return projectAnalyzers.ToImmutableDictionary(); + } } } diff --git a/src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs b/src/Analyzers/AnalyzerReferenceInformationProvider.cs similarity index 62% rename from src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs rename to src/Analyzers/AnalyzerReferenceInformationProvider.cs index 3d376abb1e3f..484278f96255 100644 --- a/src/Analyzers/AnalyzerReferenceAnalyzerFinder.cs +++ b/src/Analyzers/AnalyzerReferenceInformationProvider.cs @@ -1,11 +1,8 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Reflection; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; @@ -13,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { - internal class AnalyzerReferenceAnalyzerFinder : IAnalyzerFinder + internal class AnalyzerReferenceInformationProvider : IAnalyzerInformationProvider { public ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers( Solution solution, @@ -33,14 +30,6 @@ internal class AnalyzerReferenceAnalyzerFinder : IAnalyzerFinder return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); } - public Task>> FilterBySeverityAsync( - IEnumerable projects, - ImmutableArray allAnalyzers, - ImmutableHashSet formattablePaths, - FormatOptions formatOptions, - CancellationToken cancellationToken) - { - return AnalyzerFinderHelpers.FilterBySeverityAsync(projects, allAnalyzers, formattablePaths, formatOptions.AnalyzerSeverity, cancellationToken); - } + public DiagnosticSeverity GetSeverity(FormatOptions formatOptions) => formatOptions.AnalyzerSeverity; } } diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index b5419a9fef4c..2cbba44170f5 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -16,15 +16,17 @@ public Task RunCodeAnalysisAsync( DiagnosticAnalyzer analyzers, Project project, ImmutableHashSet formattableDocumentPaths, + DiagnosticSeverity severity, ILogger logger, CancellationToken cancellationToken) - => RunCodeAnalysisAsync(result, ImmutableArray.Create(analyzers), project, formattableDocumentPaths, logger, cancellationToken); + => RunCodeAnalysisAsync(result, ImmutableArray.Create(analyzers), project, formattableDocumentPaths, severity, logger, cancellationToken); public async Task RunCodeAnalysisAsync( CodeAnalysisResult result, ImmutableArray analyzers, Project project, ImmutableHashSet formattableDocumentPaths, + DiagnosticSeverity severity, ILogger logger, CancellationToken cancellationToken) { @@ -47,7 +49,7 @@ public async Task RunCodeAnalysisAsync( foreach (var diagnostic in diagnostics) { if (!diagnostic.IsSuppressed && - diagnostic.Severity >= DiagnosticSeverity.Warning && + diagnostic.Severity >= severity && diagnostic.Location.IsInSource && diagnostic.Location.SourceTree != null && formattableDocumentPaths.Contains(diagnostic.Location.SourceTree.FilePath)) diff --git a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs b/src/Analyzers/CodeStyleInformationProvider.cs similarity index 68% rename from src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs rename to src/Analyzers/CodeStyleInformationProvider.cs index 40463d9022d5..aef3482d2413 100644 --- a/src/Analyzers/RoslynCodeStyleAnalyzerFinder.cs +++ b/src/Analyzers/CodeStyleInformationProvider.cs @@ -1,22 +1,20 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using System.Linq; using System.Reflection; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Analyzers { - internal class RoslynCodeStyleAnalyzerFinder : IAnalyzerFinder + internal class CodeStyleInformationProvider : IAnalyzerInformationProvider { private static readonly string s_executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + private readonly string _featuresPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.Features.dll"); private readonly string _featuresCSharpPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.CSharp.Features.dll"); private readonly string _featuresVisualBasicPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.VisualBasic.Features.dll"); @@ -32,6 +30,7 @@ internal class RoslynCodeStyleAnalyzerFinder : IAnalyzerFinder var assemblies = new[] { + _featuresPath, _featuresCSharpPath, _featuresVisualBasicPath }.Select(path => Assembly.LoadFrom(path)); @@ -39,14 +38,6 @@ internal class RoslynCodeStyleAnalyzerFinder : IAnalyzerFinder return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); } - public Task>> FilterBySeverityAsync( - IEnumerable projects, - ImmutableArray allAnalyzers, - ImmutableHashSet formattablePaths, - FormatOptions formatOptions, - CancellationToken cancellationToken) - { - return AnalyzerFinderHelpers.FilterBySeverityAsync(projects, allAnalyzers, formattablePaths, formatOptions.CodeStyleSeverity, cancellationToken); - } + public DiagnosticSeverity GetSeverity(FormatOptions formatOptions) => formatOptions.CodeStyleSeverity; } } diff --git a/src/Analyzers/Interfaces/IAnalyzerFinder.cs b/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs similarity index 54% rename from src/Analyzers/Interfaces/IAnalyzerFinder.cs rename to src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs index fe6a7f3bc63c..8a545b0b70df 100644 --- a/src/Analyzers/Interfaces/IAnalyzerFinder.cs +++ b/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs @@ -1,27 +1,19 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Generic; using System.Collections.Immutable; -using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Analyzers { - interface IAnalyzerFinder + interface IAnalyzerInformationProvider { + DiagnosticSeverity GetSeverity(FormatOptions formatOptions); + ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers( Solution solution, FormatOptions formatOptions, ILogger logger); - - Task>> FilterBySeverityAsync( - IEnumerable projects, - ImmutableArray allAnalyzers, - ImmutableHashSet formattablePaths, - FormatOptions formatOptions, - CancellationToken cancellationToken); } } diff --git a/src/Analyzers/Interfaces/IAnalyzerRunner.cs b/src/Analyzers/Interfaces/IAnalyzerRunner.cs index 2d264ac13493..a94cd6cfa8bc 100644 --- a/src/Analyzers/Interfaces/IAnalyzerRunner.cs +++ b/src/Analyzers/Interfaces/IAnalyzerRunner.cs @@ -15,6 +15,7 @@ Task RunCodeAnalysisAsync( DiagnosticAnalyzer analyzers, Project project, ImmutableHashSet formattableDocumentPaths, + DiagnosticSeverity severity, ILogger logger, CancellationToken cancellationToken); @@ -23,6 +24,7 @@ Task RunCodeAnalysisAsync( ImmutableArray analyzers, Project project, ImmutableHashSet formattableDocumentPaths, + DiagnosticSeverity severity, ILogger logger, CancellationToken cancellationToken); } diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 673ba300e11d..944c4a911f98 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -29,8 +29,8 @@ internal static class CodeFormatter new EndOfLineFormatter(), new CharsetFormatter(), new ImportsFormatter(), - new AnalyzerFormatter(Resources.Code_Style, new RoslynCodeStyleAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), - new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceAnalyzerFinder(), new AnalyzerRunner(), new SolutionCodeFixApplier()), + new AnalyzerFormatter(Resources.Code_Style, new CodeStyleInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier()), + new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier()), }.ToImmutableArray(); public static async Task FormatWorkspaceAsync( diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs index 65c4ae573e15..68b84d2fe1de 100644 --- a/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -28,7 +28,7 @@ public async Task TestFilterWarning() var allAnalyzers = await GetAnalyzersAsync(); var formattablePaths = ImmutableHashSet.Create(projects.First().Documents.First().FilePath); var minimumSeverity = DiagnosticSeverity.Warning; - var result = await AnalyzerFinderHelpers.FilterBySeverityAsync(projects, + var result = await AnalyzerFormatter.FilterBySeverityAsync(projects, allAnalyzers, formattablePaths, minimumSeverity, @@ -44,7 +44,7 @@ public async Task TestFilterError() var allAnalyzers = await GetAnalyzersAsync(); var formattablePaths = ImmutableHashSet.Create(projects.First().Documents.First().FilePath); var minimumSeverity = DiagnosticSeverity.Error; - var result = await AnalyzerFinderHelpers.FilterBySeverityAsync(projects, + var result = await AnalyzerFormatter.FilterBySeverityAsync(projects, allAnalyzers, formattablePaths, minimumSeverity, From c4c3ca04852fb7091f6896a5f2a88ce5e19e2b88 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 3 Jul 2020 18:09:53 -0700 Subject: [PATCH 1072/2702] Fix variable name --- src/Analyzers/AnalyzerFormatter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 7a64e4f00ebd..4bd5a64d837f 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -23,12 +23,12 @@ internal class AnalyzerFormatter : ICodeFormatter public AnalyzerFormatter( string name, - IAnalyzerInformationProvider finder, + IAnalyzerInformationProvider informationProvider, IAnalyzerRunner runner, ICodeFixApplier applier) { _name = name; - _informationProvider = finder; + _informationProvider = informationProvider; _runner = runner; _applier = applier; } From 02990426668c75a176778b56f76101977abe90b5 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sat, 4 Jul 2020 14:28:24 -0700 Subject: [PATCH 1073/2702] Add devcontainer to better support Codespaces --- .devcontainer/Dockerfile | 71 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 53 ++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..1f1d52514dad --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,71 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- +ARG VARIANT="3.1-bionic" +FROM mcr.microsoft.com/dotnet/core/sdk:${VARIANT} + +# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser" +# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs +# will be updated to match your local UID/GID (when using the dockerFile property). +# See https://aka.ms/vscode-remote/containers/non-root-user for details. +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Options for common package install script +ARG INSTALL_ZSH="true" +ARG UPGRADE_PACKAGES="true" +ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.126.0/script-library/common-debian.sh" +ARG COMMON_SCRIPT_SHA="a6bfacc5c9c6c3706adc8788bf70182729767955b7a5509598ac205ce6847e1e" + +# [Optional] Settings for installing Node.js. +ARG INSTALL_NODE="true" +ARG NODE_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/node-debian.sh" +ARG NODE_SCRIPT_SHA="dev-mode" +ARG NODE_VERSION="lts/*" +ENV NVM_DIR=/usr/local/share/nvm +# Have nvm create a "current" symlink and add to path to work around https://github.com/microsoft/vscode-remote-release/issues/3224 +ENV NVM_SYMLINK_CURRENT=true +ENV PATH=${NVM_DIR}/current/bin:${PATH} + +# [Optional] Install the Azure CLI +ARG INSTALL_AZURE_CLI="false" +ARG INSTALL_POSHGIT="true" + +# Configure apt and install packages +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + # + # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh + && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \ + && curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \ + && ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \ + && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \ + # + # [Optional] Install Node.js for ASP.NET Core Web Applicationss + && if [ "$INSTALL_NODE" = "true" ]; then \ + curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \ + && ([ "${NODE_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/node-setup.sh" | sha256sum -c -)) \ + && /bin/bash /tmp/node-setup.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; \ + fi \ + # + # [Optional] Install the Azure CLI + && if [ "$INSTALL_AZURE_CLI" = "true" ]; then \ + echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \ + && curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \ + && apt-get update \ + && apt-get install -y azure-cli; \ + fi \ + # + # [Optional] Install the Posh-Git + && if [ "$INSTALL_POSHGIT" = "true" ]; then \ + pwsh -command "PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force" \ + && pwsh -command "Add-PoshGitToProfile -AllHosts"; \ + fi \ + # + # Clean up + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -f /tmp/common-setup.sh /tmp/node-setup.sh \ + && rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..c74270b7c272 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,53 @@ +// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.126.0/containers/dotnetcore +{ + "name": "C# (.NET Core)", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update 'VARIANT' to pick a .NET Core version. Rebuild the container if + // it already exists to update. Example variants: 2.1-bionic, 3.1-bionic + "VARIANT": "3.1-bionic", + // Options + "INSTALL_NODE": "false", + "NODE_VERSION": "lts/*", + "INSTALL_ZSH": "false", + "INSTALL_AZURE_CLI": "false", + "UPGRADE_PACKAGES": "false", + "INSTALL_POSHGIT": "true" + } + }, + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/usr/bin/pwsh" + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-dotnettools.csharp", + "editorconfig.editorconfig", + "tintoy.msbuild-project-tools", + "ms-vscode.powershell" + ], + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [5000, 5001], + // [Optional] To reuse of your local HTTPS dev cert, first export it locally using this command: + // * Windows PowerShell: + // dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" + // * macOS/Linux terminal: + // dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" + // + // Next, after running the command above, uncomment lines in the 'mounts' and 'remoteEnv' lines below, + // and open / rebuild the container so the settings take effect. + // + "mounts": [ + // "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" + ], + "remoteEnv": { + // "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere", + // "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx", + }, + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "./restore.sh", + // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. + // "remoteUser": "vscode" +} \ No newline at end of file From 16a73114eceac17939dde8ca06fbf0a3b991c0f0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 5 Jul 2020 13:22:12 -0700 Subject: [PATCH 1074/2702] Add test explorer extension to the devcontainer --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c74270b7c272..42e6cee779e9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,6 +25,7 @@ "extensions": [ "ms-dotnettools.csharp", "editorconfig.editorconfig", + "formulahendry.dotnet-test-explorer", "tintoy.msbuild-project-tools", "ms-vscode.powershell" ], @@ -50,4 +51,4 @@ "postCreateCommand": "./restore.sh", // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. // "remoteUser": "vscode" -} \ No newline at end of file +} From 5d9254b81be904aacfd6185960cc0dff21524f12 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 5 Jul 2020 13:23:30 -0700 Subject: [PATCH 1075/2702] Update documentation for analyzers --- README.md | 37 ++++---- docs/3rd-party-analyzers.md | 39 +++++++++ docs/README.md | 61 ++++++++++++- docs/Supported-.editorconfig-options.md | 63 ++------------ docs/Unsupported-Code-Style-options.md | 108 ------------------------ src/FormatCommand.cs | 6 +- src/Resources.resx | 5 +- src/xlf/Resources.cs.xlf | 7 +- src/xlf/Resources.de.xlf | 7 +- src/xlf/Resources.es.xlf | 7 +- src/xlf/Resources.fr.xlf | 7 +- src/xlf/Resources.it.xlf | 7 +- src/xlf/Resources.ja.xlf | 7 +- src/xlf/Resources.ko.xlf | 7 +- src/xlf/Resources.pl.xlf | 7 +- src/xlf/Resources.pt-BR.xlf | 7 +- src/xlf/Resources.ru.xlf | 7 +- src/xlf/Resources.tr.xlf | 7 +- src/xlf/Resources.zh-Hans.xlf | 7 +- src/xlf/Resources.zh-Hant.xlf | 7 +- 20 files changed, 208 insertions(+), 202 deletions(-) create mode 100644 docs/3rd-party-analyzers.md delete mode 100644 docs/Unsupported-Code-Style-options.md diff --git a/README.md b/README.md index 3351e15dba19..b1831af0aef8 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,13 @@ |Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) | Localization (Debug) | Localization (Release) | |---|:--:|:--:|:--:|:--:|:--:|:--:| -[master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)| +[master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)| `dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](./docs/Supported-.editorconfig-options.md). ### New in v4.0.130203 + #### Breaking Changes: - Added an imports formatter for sorting imports. - Format now runs on the latest installed Runtime. @@ -38,7 +39,6 @@ - [Support loading commandline options from response files (552)](https://github.com/dotnet/format/pull/552) - [Support file globbing in --include and --exclude options (555)](https://github.com/dotnet/format/pull/555) - ### How To Install The `dotnet-format` nuget package is [published to nuget.org](https://www.nuget.org/packages/dotnet-format/). @@ -56,25 +56,30 @@ Development builds of `dotnet-format` are being hosted on myget. You can visit t You can install the tool using the following command. ```console -dotnet tool install -g dotnet-format --version 4.0.111308 --add-source https://dotnet.myget.org/F/format/api/v3/index.json +dotnet tool install -g dotnet-format --version 5.0.135301 --add-source https://dotnet.myget.org/F/format/api/v3/index.json ``` ### How To Use By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory you will need to specify the workspace to format using the `-w` or `-f` options. You can control how verbose the output will be by using the `-v` option. -```sh +```console Usage: - dotnet-format [options] + dotnet-format [options] [] + +Arguments: + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. Options: - --folder, -f Whether to treat the `` path as a folder of files. - --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. - --exclude A list of relative file or folder paths to exclude from formatting. - --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - --report Accepts a file path, which if provided, will produce a json report in the given directory. - --verbosity, -v Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - --version Display version information + --folder, -f Whether to treat the `` argument as a simple folder of files. + --fix-style, -fs Run code style analyzers and apply fixes. + --fix-analyzers, -fa Run 3rd party analyzers and apply fixes. + --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. + --exclude A list of relative file or folder paths to exclude from formatting. + --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + --report Accepts a file path, which if provided, will produce a json report in the given directory. + --verbosity, -v Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] + --version Show version information ``` Add `format` after `dotnet` and before the command arguments that you want to run: @@ -83,7 +88,9 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | ---------------------------------------------------------- |---------------------------------------------------------------------------------------------- | | dotnet **format** | Formats the project or solution in the current directory. | | dotnet **format** <workspace> | Formats a specific project or solution. | -| dotnet **format** <folder> -f | Formats a particular folder and subfolders. | +| dotnet **format** <workspace> -f | Formats a particular folder and subfolders. | +| dotnet **format** <workspace> --fix-style warn | Formats and fixes codestyle analyzer warnings. | +| dotnet **format** <workspace> --fix-analyzers | Formats and fixes 3rd party analyzer errors. | | dotnet **format** -v diag | Formats with very verbose logging. | | dotnet **format** --include Programs.cs Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | | dotnet **format** --check | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | @@ -104,8 +111,8 @@ You can build and package the tool using the following commands. The instruction ```console build -pack # The final line from the build will read something like -# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.4.0.0-dev.nupkg'. -# Use the value that is in the form `4.0.0-dev` as the version in the next command. +# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.5.0.0-dev.nupkg'. +# Use the value that is in the form `5.0.0-dev` as the version in the next command. dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version dotnet format ``` diff --git a/docs/3rd-party-analyzers.md b/docs/3rd-party-analyzers.md new file mode 100644 index 000000000000..c8b7b765a2fc --- /dev/null +++ b/docs/3rd-party-analyzers.md @@ -0,0 +1,39 @@ +# 3rd Party Analyzers + +## How to add analyzers to a project + +3rd party analyzers are discovered from the `` specified in the workspace project files. + +*Example:* + +Add the StyleCop analyzer package to a simple console project file. + +```diff + + + + Exe + netcoreapp3.1 + + ++ ++ ++ + + +``` + +## How to configure analyzer severity + +The options specified in .editorconfig files are recognized by the pattern `dotnet_diagnostic..severity = `. `` represents the diagnostic ID matched by the compiler, case-insensitively, to be configured. `` must be one of the following: error, warn, info, hidden, suppress. + +*Example:* + +Configure the StyleCop analyzer so that empty comments are errors. + +```ini +[*.{cs,vb}] + +# The C# comment does not contain any comment text. +dotnet_diagnostic.SA1120.severity = error +``` \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 509fc2ed0469..677485ff7a53 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,16 +2,69 @@ ## .editorconfig options - [Supported .editorconfig options](./Supported-.editorconfig-options.md) -- [Unsupported Code Style options](./Unsupported-Code-Style-options.md) ## CLI options ### Specify a workspace (Required) -A project path is needed when running dotnet-format. By default, the current folder will be used as the project path. The project path and type of project determines which code files are considered for formatting. +A workspace path is needed when running dotnet-format. By default, the current folder will be used as the workspace path. The workspace path and type of workspace determines which code files are considered for formatting. -- Solutions and Projects - By default dotnet-format will open the project path as a MSBuild solution or project. -- `--folder` - When the folder options is specified the project path will be treated as a folder of code files. +- Solutions and Projects - By default dotnet-format will open the workspace path as a MSBuild solution or project. +- `--folder` - When the folder options is specified the workspace path will be treated as a folder of code files. + +*Example:* + +Format the code files used in the format solution. + +```console +dotnet-format ./format.sln +``` + +Format the code files used in the dotnet-format project. + +```console +dotnet-format ./src/dotnet-format.csproj +``` + +Format the code files from the `./src` folder. + +```console +dotnet-format ./src --folder +``` + +### Running analysis + +#### CodeStyle analysis + +Running codestyle analysis requires the use of a MSBuild solution or project file as the workspace. Enforces the .NET [Language conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019) and [Naming conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2019). + +- `--fix-style ` - Runs analysis and attempts to fix issues with severity equal or greater than specified. If severity is not specified then severity defaults to error. + +*Example:* + +Run analysis against the format solution and fix errors. + +```console +dotnet-format ./format.sln --fix-style +``` + +Run analysis against the dotnet-format project and fix warnings and errors. + +```console +dotnet-format ./src/dotnet-format.csproj --fix-style warn +``` + +Errors when used with the `--folder` option. Analysis requires a MSBuild solution or project. + +```console +dotnet-format ./src --folder --fix-style +``` + +#### 3rd party analysis + +Running 3rd party analysis requires the use of a MSBuild solution or project file as the workspace. 3rd party analyzers are discovered from the `` specified in the workspace project files. + +- `--fix-analyzers ` - Runs analysis and attempts to fix issues with severity equal or greater than specified. If no severity is specified then this defaults to error. ### Filter files to format diff --git a/docs/Supported-.editorconfig-options.md b/docs/Supported-.editorconfig-options.md index 124055f1ebcf..aaa167dcc2e4 100644 --- a/docs/Supported-.editorconfig-options.md +++ b/docs/Supported-.editorconfig-options.md @@ -1,5 +1,7 @@ -The dotnet-format global tool supports the core set of EditorConfig options*: +# Supported .editorconfig options +The dotnet-format global tool supports the core set of [EditorConfig options](https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties)* as well as the [.NET coding convention settings for EditorConfig](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2019)**. +## Core options - indent_style - indent_size - tab_width @@ -8,61 +10,6 @@ The dotnet-format global tool supports the core set of EditorConfig options*: - insert_final_newline - root -[*] The option trim_trailing_whitespace is not supported. Currently insignificant whitespace is **always** removed by the formatter. +[*] The options `trim_trailing_whitespace` and `max_line_length` are not supported. Currently insignificant whitespace is **always** removed by the formatter. -In addition dotnet-format supports a subset of the [.NET coding convention settings for EditorConfig](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2017). - -# Formatting conventions -Most of the rules for formatting conventions have the following format: - -`rule_name = false|true` - -You specify either `true` (prefer this style) or `false` (do not prefer this style). You do not specify a severity. For a few rules, instead of `true` or `false`, you specify other values to describe when and where to apply the rule. - -## C# formatting settings -The formatting rules in this section apply only to C# code. - -**Newline options** -These formatting rules concern the use of new lines to format code. - -- csharp_new_line_before_open_brace (default value: `all`) -- csharp_new_line_before_else (default value: `true`) -- csharp_new_line_before_catch (default value: `true`) -- csharp_new_line_before_finally (default value: `true`) -- csharp_new_line_before_members_in_object_initializers (default value: `true`) -- csharp_new_line_before_members_in_anonymous_types (default value: `true`) -- csharp_new_line_between_query_expression_clauses (default value: `true`) - -**Indentation options** -These formatting rules concern the use of indentation to format code. - -- csharp_indent_case_contents (default value: `true`) -- csharp_indent_switch_labels (default value: `true`) -- csharp_indent_labels (default value: `no_change`) - -**Spacing options** -These formatting rules concern the use of space characters to format code. - -- csharp_space_after_cast (default value: `false`) -- csharp_space_after_keywords_in_control_flow_statements (default value: `true`) -- csharp_space_between_method_declaration_parameter_list_parentheses (default value: `false`) -- csharp_space_between_method_call_parameter_list_parentheses (default value: `false`) -- csharp_space_between_parentheses (default value: `false`) -- csharp_space_before_colon_in_inheritance_clause (default value: `true`) -- csharp_space_after_colon_in_inheritance_clause (default value: `true`) -- csharp_space_around_binary_operators (default value: `before_and_after`) -- csharp_space_between_method_declaration_empty_parameter_list_parentheses (default value: `false`) -- csharp_space_between_method_call_name_and_opening_parenthesis (default value: `false`) -- csharp_space_between_method_call_empty_parameter_list_parentheses (default value: `false`) - -**Wrapping options** -These formatting rules concern the use of single lines versus separate lines for statements and code blocks. - -- csharp_preserve_single_line_statements (default value: `true`) -- csharp_preserve_single_line_blocks (default value: `true`) - -**Organize using directives** -These formatting rules concern the sorting and display of using directives and Imports statements. - -- dotnet_sort_system_directives_first (default value: `true`) -- dotnet_separate_import_directive_groups (default value: `true`) \ No newline at end of file +[**] [Formatting conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-formatting-conventions?view=vs-2019) are enforced by default. Use the `--fix-style` option to enforce [Language conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019) and [Naming conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2019). diff --git a/docs/Unsupported-Code-Style-options.md b/docs/Unsupported-Code-Style-options.md deleted file mode 100644 index 1001f9892dba..000000000000 --- a/docs/Unsupported-Code-Style-options.md +++ /dev/null @@ -1,108 +0,0 @@ -There are 3 sections of editorconfig configuration options: Formatting, Code Style, and Naming. For the most part the Formatting options are covered by the Roslyn Formatter, which leaves the Code Style and Naming options to be implemented. Below is a list of Code Style options. Naming options will be handled separately. - -# .NET code style settings - -## "This." and "Me." qualifiers -Name | Base Class | Option | Diagnostic --|-|-|- -dotnet_style_qualification_for_field | AbstractQualifyMemberAccessDiagnosticAnalyzer | CodeStyleOptions.QualifyFieldAccess | AddQualificationDiagnosticId = "IDE0009" -dotnet_style_qualification_for_property | AbstractQualifyMemberAccessDiagnosticAnalyzer | CodeStyleOptions.QualifyPropertyAccess | AddQualificationDiagnosticId = "IDE0009" -dotnet_style_qualification_for_method | AbstractQualifyMemberAccessDiagnosticAnalyzer | CodeStyleOptions.QualifyMethodAccess | AddQualificationDiagnosticId = "IDE0009" -dotnet_style_qualification_for_event | AbstractQualifyMemberAccessDiagnosticAnalyzer | CodeStyleOptions.QualifyEventAccess | AddQualificationDiagnosticId = "IDE0009" - -## Language keywords instead of framework type names for type references -Name | Base Class | Option | Diagnostic --|-|-|- -dotnet_style_predefined_type_for_locals_parameters_members | PreferFrameworkTypeDiagnosticAnalyzerBase | CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInDeclaration | PreferBuiltInOrFrameworkTypeDiagnosticId = "IDE0049" -dotnet_style_predefined_type_for_member_access | PreferFrameworkTypeDiagnosticAnalyzerBase | CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess | PreferBuiltInOrFrameworkTypeDiagnosticId = "IDE0049" - -## Modifier preferences -Name | Base Class | Option | Diagnostic --|-|-|- -dotnet_style_require_accessibility_modifiers | AbstractAddAccessibilityModifiersDiagnosticAnalyzer | CodeStyleOptions.RequireAccessibilityModifiers | AddAccessibilityModifiersDiagnosticId = "IDE0040" -csharp_preferred_modifier_order | AbstractOrderModifiersDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferredModifierOrder | OrderModifiersDiagnosticId = "IDE0036" -visual_basic_preferred_modifier_order | AbstractOrderModifiersDiagnosticAnalyzer | VisualBasicCodeStyleOptions.PreferredModifierOrder | OrderModifiersDiagnosticId = "IDE0036" -dotnet_style_readonly_field | MakeFieldReadonlyDiagnosticAnalyzer | CodeStyleOption.PreferReadonly | MakeFieldReadonlyDiagnosticId = "IDE0044" - -## Parentheses preferences -Name | Base Class | Option | Diagnostic --|-|-|- -dotnet_style_parentheses_in_arithmetic_binary_operators | AbstractAddRequiredParenthesesDiagnosticAnalyzer
AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer | CodeStyleOption.ArithmeticBinaryParentheses | AddRequiredParenthesesDiagnosticId = "IDE0048"
RemoveUnnecessaryParenthesesDiagnosticId = "IDE0047" -dotnet_style_parentheses_in_other_binary_operators | AbstractAddRequiredParenthesesDiagnosticAnalyzer
AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer | CodeStyleOptions.OtherBinaryParentheses | AddRequiredParenthesesDiagnosticId = "IDE0048"
RemoveUnnecessaryParenthesesDiagnosticId = "IDE0047" -dotnet_style_parentheses_in_other_operators | AbstractAddRequiredParenthesesDiagnosticAnalyzer
AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer | CodeStyleOptions.OtherParentheses | AddRequiredParenthesesDiagnosticId = "IDE0048"
RemoveUnnecessaryParenthesesDiagnosticId = "IDE0047" -dotnet_style_parentheses_in_relational_binary_operators | AbstractAddRequiredParenthesesDiagnosticAnalyzer
AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer | CodeStyleOptions.RelationalBinaryParentheses | AddRequiredParenthesesDiagnosticId = "IDE0048"
RemoveUnnecessaryParenthesesDiagnosticId = "IDE0047" - -## Expression-level preferences -Name | Base Class | Option | Diagnostic --|-|-|- -dotnet_style_object_initializer | AbstractUseObjectInitializerDiagnosticAnalyzer | CodeStyleOptions.PreferObjectInitializer | UseObjectInitializerDiagnosticId = "IDE0017" -dotnet_style_collection_initializer | AbstractUseCollectionInitializerDiagnosticAnalyzer | CodeStyleOptions.PreferCollectionInitializer | UseCollectionInitializerDiagnosticId = "IDE0028" -dotnet_style_explicit_tuple_names | UseExplicitTupleNameDiagnosticAnalyzer | CodeStyleOptions.PreferExplicitTupleNames | UseExplicitTupleNameDiagnosticId = "IDE0033" -dotnet_style_prefer_inferred_tuple_names | AbstractUseInferredMemberNameDiagnosticAnalyzer | CodeStyleOptions.PreferInferredTupleNames | UseInferredMemberNameDiagnosticId = "IDE0037" -dotnet_style_prefer_inferred_anonymous_type_member_names | AbstractUseInferredMemberNameDiagnosticAnalyzer | CodeStyleOptions.PreferInferredAnonymousTypeMemberNames | UseInferredMemberNameDiagnosticId = "IDE0037" -dotnet_style_prefer_auto_properties | AbstractUseAutoPropertyAnalyzer | CodeStyleOptions.PreferAutoProperties | UseAutoPropertyDiagnosticId = "IDE0032" -dotnet_style_prefer_is_null_check_over_reference_equality_method | AbstractUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer | CodeStyleOptions.PreferIsNullCheckOverReferenceEqualityMethod | UseIsNullCheckDiagnosticId = "IDE0041" -dotnet_style_prefer_conditional_expression_over_assignment | AbstractUseConditionalExpressionForAssignmentDiagnosticAnalyzer | CodeStyleOptions.PreferConditionalExpressionOverAssignment | UseConditionalExpressionForAssignmentDiagnosticId = "IDE0045" -dotnet_style_prefer_conditional_expression_over_return | AbstractUseConditionalExpressionForReturnDiagnosticAnalyzer | CodeStyleOptions.PreferConditionalExpressionOverReturn | UseConditionalExpressionForReturnDiagnosticId = "IDE0046" -dotnet_style_prefer_compound_assignment | AbstractUseCompoundAssignmentDiagnosticAnalyzer | CodeStyleOptions.PreferCompoundAssignment | UseCompoundAssignmentDiagnosticId = "IDE0054" - -## "Null" checking preferences -Name | Base Class | Option | Diagnostic --|-|-|- -dotnet_style_coalesce_expression | AbstractUseCoalesceExpressionDiagnosticAnalyzer | CodeStyleOptions.PreferCoalesceExpression | UseCoalesceExpressionDiagnosticId = "IDE0029" -dotnet_style_null_propagation | AbstractUseNullPropagationDiagnosticAnalyzer | CodeStyleOptions.PreferNullPropagation | UseNullPropagationDiagnosticId = "IDE0031" - -# C# code style settings - -## Implicit and explicit types -Name | Base Class | Option | Diagnostic --|-|-|- -csharp_style_var_for_built_in_types | CSharpUseExplicitTypeDiagnosticAnalyzer
CSharpUseImplicitTypeDiagnosticAnalyzer | CSharpCodeStyleOptions.VarForBuiltInTypes | UseExplicitTypeDiagnosticId = "IDE0008"
UseImplicitTypeDiagnosticId = "IDE0007" -csharp_style_var_when_type_is_apparent | CSharpUseExplicitTypeDiagnosticAnalyzer
CSharpUseImplicitTypeDiagnosticAnalyzer | CSharpCodeStyleOptions.VarWhenTypeIsApparent | UseExplicitTypeDiagnosticId = "IDE0008"
UseImplicitTypeDiagnosticId = "IDE0007" -csharp_style_var_elsewhere | CSharpUseExplicitTypeDiagnosticAnalyzer
CSharpUseImplicitTypeDiagnosticAnalyzer | CSharpCodeStyleOptions.VarElsewhere | UseExplicitTypeDiagnosticId = "IDE0008"
UseImplicitTypeDiagnosticId = "IDE0007" - -## Expression-bodied members -Name | Base Class | Option | Diagnostic --|-|-|- -csharp_style_expression_bodied_methods | UseExpressionBodyForMethodsHelper | CSharpCodeStyleOptions.PreferExpressionBodiedMethods | UseExpressionBodyForMethodsDiagnosticId = "IDE0022" -csharp_style_expression_bodied_constructors | UseExpressionBodyForConstructorsHelper | CSharpCodeStyleOptions.PreferExpressionBodiedConstructors | UseExpressionBodyForConstructorsDiagnosticId = "IDE0021" -csharp_style_expression_bodied_operators | UseExpressionBodyForOperatorsHelper | CSharpCodeStyleOptions.PreferExpressionBodiedOperators | UseExpressionBodyForOperatorsDiagnosticId = "IDE0024" -csharp_style_expression_bodied_properties | UseExpressionBodyForPropertiesHelper | CSharpCodeStyleOptions.PreferExpressionBodiedProperties | UseExpressionBodyForPropertiesDiagnosticId = "IDE0025" -csharp_style_expression_bodied_indexers | UseExpressionBodyForIndexersHelper | CSharpCodeStyleOptions.PreferExpressionBodiedIndexers | UseExpressionBodyForIndexersDiagnosticId = "IDE0026" -csharp_style_expression_bodied_accessors | UseExpressionBodyForAccessorsHelper | CSharpCodeStyleOptions.PreferExpressionBodiedAccessors | UseExpressionBodyForAccessorsDiagnosticId = "IDE0027" -csharp_style_expression_bodied_lambdas | UseExpressionBodyForLambdaDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferExpressionBodiedLambdas | UseExpressionBodyForLambdaExpressionsDiagnosticId = "IDE0053" -csharp_style_expression_bodied_local_functions | UseExpressionBodyForLocalFunctionHelper | CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions | UseExpressionBodyForLocalFunctionsDiagnosticId = "IDE0061" - -## Pattern matching -Name | Base Class | Option | Diagnostic --|-|-|- -csharp_style_pattern_matching_over_is_with_cast_check | CSharpIsAndCastCheckDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferPatternMatchingOverIsWithCastCheck | InlineIsTypeCheckId = "IDE0020" -csharp_style_pattern_matching_over_as_with_null_check | CSharpAsAndNullCheckDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferPatternMatchingOverAsWithNullCheck | InlineAsTypeCheckId = "IDE0019" -csharp_style_prefer_switch_expression | ConvertSwitchStatementToExpressionDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferSwitchExpression | ConvertSwitchStatementToExpressionDiagnosticId = "IDE0066" - -## Inlined variable declarations -Name | Base Class | Option | Diagnostic --|-|-|- -csharp_style_inlined_variable_declaration | CSharpInlineDeclarationDiagnosticAnalyzer | CodeStyleOptions.PreferInlinedVariableDeclaration | InlineDeclarationDiagnosticId = "IDE0018" - -## Expression-level preferences -Name | Base Class | Option | Diagnostic --|-|-|- -csharp_prefer_simple_default_expression | CSharpUseDefaultLiteralDiagnosticAnalyzer | CSharpCodeStyleOptions.UseDefaultLiteralDiagnosticId | UseDefaultLiteralDiagnosticId = "IDE0034" -csharp_style_deconstructed_variable_declaration | CSharpUseDeconstructionDiagnosticAnalyzer | CodeStyleOptions.PreferDeconstructedVariableDeclaration | UseDeconstructionDiagnosticId = "IDE0042" -csharp_style_pattern_local_over_anonymous_function | CSharpUseLocalFunctionDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferLocalOverAnonymousFunction | UseLocalFunctionDiagnosticId = "IDE0039" -csharp_style_prefer_index_operator | CSharpUseIndexOperatorDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferIndexOperator | UseIndexOperatorDiagnosticId = "IDE0056" -csharp_style_prefer_range_operator | CSharpUseRangeOperatorDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferRangeOperator | UseRangeOperatorDiagnosticId = "IDE0057" -csharp_prefer_static_local_function | MakeLocalFunctionStaticDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferStaticLocalFunction | MakeLocalFunctionStaticDiagnosticId = "IDE0062" -csharp_prefer_simple_using_statement | UseSimpleUsingStatementDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferSimpleUsingStatement | UseSimpleUsingStatementDiagnosticId = "IDE0063" - -## "Null" checking preferences -Name | Base Class | Option | Diagnostic --|-|-|- -csharp_style_throw_expression | AbstractUseThrowExpressionDiagnosticAnalyzer | CodeStyleOptions.PreferThrowExpression | UseThrowExpressionDiagnosticId = "IDE0016" -csharp_style_conditional_delegate_call | InvokeDelegateWithConditionalAccessAnalyzer | CSharpCodeStyleOptions.PreferConditionalDelegateCall | InvokeDelegateWithConditionalAccessId = "IDE1005" - -## Code block preferences -Name | Base Class | Option | Diagnostic --|-|-|- -csharp_prefer_braces | CSharpAddBracesDiagnosticAnalyzer | CSharpCodeStyleOptions.PreferBraces | AddBracesDiagnosticId = "IDE0011" \ No newline at end of file diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 521ccf3b7853..51890f8f2b0e 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -22,11 +22,11 @@ internal static RootCommand CreateCommandLineOptions() Description = Resources.A_path_to_a_solution_file_a_project_file_or_a_folder_containing_a_solution_or_project_file_If_a_path_is_not_specified_then_the_current_directory_is_used }.LegalFilePathsOnly(), new Option(new[] { "--folder", "-f" }, Resources.Whether_to_treat_the_workspace_argument_as_a_simple_folder_of_files), - new Option(new[] { "--fix-style", "-fs" }, Resources.Run_code_style_analyzer_and_apply_fixes) + new Option(new[] { "--fix-style", "-fs" }, Resources.Run_code_style_analyzers_and_apply_fixes) { Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne }.FromAmong(SeverityLevels) }, - new Option(new[] { "--fix-analyzers", "-fa" }, Resources.Run_code_style_analyzer_and_apply_fixes) + new Option(new[] { "--fix-analyzers", "-fa" }, Resources.Run_3rd_party_analyzers_and_apply_fixes) { Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne }.FromAmong(SeverityLevels) }, @@ -41,7 +41,7 @@ internal static RootCommand CreateCommandLineOptions() new Option(new[] { "--check" }, Resources.Formats_files_without_saving_changes_to_disk_Terminates_with_a_non_zero_exit_code_if_any_files_were_formatted), new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory) { - Argument = new Argument(() => null).LegalFilePathsOnly() + Argument = new Argument(() => null) { Name = "report-path" }.LegalFilePathsOnly() }, new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic) { diff --git a/src/Resources.resx b/src/Resources.resx index ac8f7875ad4a..fafa41da8a89 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -234,9 +234,12 @@ Unable to organize imports for '{0}'. The document is too complex. - + Run code style analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. + Analyzer Reference diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 6cfe825c18bf..f9132057e5c7 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument.
- + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 3c858a7bf577..4e2ce18f3718 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 7c9c26f29f5a..0981af1b7603 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 96407b9ee9e4..080bd1e16051 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 4cea5eaa8818..25badd299108 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 5ee9c30208b1..877737f06855 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index af6fa13c8fa4..b09d01bc591d 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 72edec1e7800..97d947ba4104 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 36fe15137fa0..d639cfb878d9 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 4b50b46f4819..b1d1bc104deb 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index b736f28bd331..0877b6f5b9e2 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 9363b6f9fb03..470ea616e7f0 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index becbf45db23c..446c05807bdb 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -152,7 +152,12 @@ Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + + Run code style analyzers and apply fixes. Run code style analyzers and apply fixes. From c9862715aa5da7cf3e0c199d2dfcb0a7c4d8f155 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 5 Jul 2020 22:25:04 -0700 Subject: [PATCH 1076/2702] Run all analyzers regardless of whether a fixer is present. --- .editorconfig | 33 ++++++++ .vscode/launch.json | 3 +- src/Analyzers/AnalyzerFinderHelpers.cs | 23 ++---- src/Analyzers/AnalyzerFormatter.cs | 76 ++++++++++++++----- src/Analyzers/AnalyzerOptionExtensions.cs | 15 ++-- .../AnalyzerReferenceInformationProvider.cs | 4 +- src/Analyzers/AnalyzerRunner.cs | 40 ++++++++-- src/Analyzers/CodeStyleInformationProvider.cs | 4 +- .../IAnalyzerInformationProvider.cs | 2 +- src/CodeFormatter.cs | 4 +- src/Resources.resx | 3 + src/xlf/Resources.cs.xlf | 5 ++ src/xlf/Resources.de.xlf | 5 ++ src/xlf/Resources.es.xlf | 5 ++ src/xlf/Resources.fr.xlf | 5 ++ src/xlf/Resources.it.xlf | 5 ++ src/xlf/Resources.ja.xlf | 5 ++ src/xlf/Resources.ko.xlf | 5 ++ src/xlf/Resources.pl.xlf | 5 ++ src/xlf/Resources.pt-BR.xlf | 5 ++ src/xlf/Resources.ru.xlf | 5 ++ src/xlf/Resources.tr.xlf | 5 ++ src/xlf/Resources.zh-Hans.xlf | 5 ++ src/xlf/Resources.zh-Hant.xlf | 5 ++ tests/Analyzers/FilterDiagnosticsTests.cs | 4 +- .../Analyzers/LoadAnalyzersAndFixersTests.cs | 46 +++++------ 26 files changed, 238 insertions(+), 84 deletions(-) diff --git a/.editorconfig b/.editorconfig index 794b0b9938f3..5f28107762e9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -131,6 +131,7 @@ csharp_indent_switch_labels = true csharp_indent_labels = flush_left # Prefer "var" everywhere +dotnet_diagnostic.IDE0007.severity = error csharp_style_var_for_built_in_types = true:error csharp_style_var_when_type_is_apparent = true:error csharp_style_var_elsewhere = true:error @@ -178,3 +179,35 @@ csharp_space_between_parentheses = false csharp_prefer_braces = true:silent csharp_preserve_single_line_blocks = true csharp_preserve_single_line_statements = true + +# IDE0073: File header +dotnet_diagnostic.IDE0073.severity = warning +file_header_template = Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +# IDE0035: Remove unreachable code +dotnet_diagnostic.IDE0035.severity = warning + +# IDE0036: Order modifiers +dotnet_diagnostic.IDE0036.severity = warning + +# IDE0040: Add accessibility modifiers +dotnet_diagnostic.IDE0040.severity = warning + +# IDE0043: Format string contains invalid placeholder +dotnet_diagnostic.IDE0043.severity = warning + +# IDE0044: Make field readonly +dotnet_diagnostic.IDE0044.severity = warning + +# CONSIDER: Are IDE0051 and IDE0052 too noisy to be warnings for IDE editing scenarios? Should they be made build-only warnings? +# IDE0051: Remove unused private member +dotnet_diagnostic.IDE0051.severity = warning + +# IDE0052: Remove unread private member +dotnet_diagnostic.IDE0052.severity = warning + +# IDE0059: Unnecessary assignment to a value +dotnet_diagnostic.IDE0059.severity = warning + +# IDE0060: Remove unused parameter +dotnet_diagnostic.IDE0060.severity = warning \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index ce09769c208d..682aef749f1c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -41,7 +41,7 @@ "stopAtEntry": false }, { - "name": "format format.sln --fix-style --check", + "name": "format format.sln --fix-style warn --check", "type": "coreclr", "request": "launch", "preLaunchTask": "build", @@ -50,6 +50,7 @@ "args": [ "format.sln", "--fix-style", + "warn", "-v", "diag", "--check" diff --git a/src/Analyzers/AnalyzerFinderHelpers.cs b/src/Analyzers/AnalyzerFinderHelpers.cs index f0e36f7e1142..4d8530472fd7 100644 --- a/src/Analyzers/AnalyzerFinderHelpers.cs +++ b/src/Analyzers/AnalyzerFinderHelpers.cs @@ -12,7 +12,12 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal static class AnalyzerFinderHelpers { - public static ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> LoadAnalyzersAndFixers(IEnumerable assemblies) + public static DiagnosticAnalyzer? GetAnalyzer(string name) + { + return null; + } + + public static (ImmutableArray Analyzers, ImmutableArray Fixers) LoadAnalyzersAndFixers(IEnumerable assemblies) { var types = assemblies .SelectMany(assembly => assembly.GetTypes() @@ -32,21 +37,7 @@ internal static class AnalyzerFinderHelpers .OfType() .ToImmutableArray(); - var builder = ImmutableArray.CreateBuilder<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)>(); - foreach (var diagnosticAnalyzer in diagnosticAnalyzers) - { - var diagnosticIds = diagnosticAnalyzer.SupportedDiagnostics.Select(diagnostic => diagnostic.Id).ToImmutableHashSet(); - var codeFixProvider = codeFixProviders.FirstOrDefault(codeFixProvider => codeFixProvider.FixableDiagnosticIds.Any(id => diagnosticIds.Contains(id))); - - if (codeFixProvider is null) - { - continue; - } - - builder.Add((diagnosticAnalyzer, codeFixProvider)); - } - - return builder.ToImmutableArray(); + return (diagnosticAnalyzers, codeFixProviders); } } } diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 4bd5a64d837f..7af59308209d 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -41,11 +41,7 @@ public async Task FormatAsync( List formattedFiles, CancellationToken cancellationToken) { - var analyzersAndFixers = _informationProvider.GetAnalyzersAndFixers(solution, formatOptions, logger); - if (analyzersAndFixers.Length == 0) - { - return solution; - } + var (analyzers, fixers) = _informationProvider.GetAnalyzersAndFixers(solution, formatOptions, logger); var analysisStopwatch = Stopwatch.StartNew(); logger.LogTrace(Resources.Running_0_analysis, _name); @@ -55,11 +51,10 @@ public async Task FormatAsync( logger.LogTrace(Resources.Determining_diagnostics); - var allAnalyzers = analyzersAndFixers.Select(pair => pair.Analyzer).ToImmutableArray(); var severity = _informationProvider.GetSeverity(formatOptions); // Filter to analyzers that report diagnostics with equal or greater severity. - var projectAnalyzers = await FilterBySeverityAsync(solution.Projects, allAnalyzers, formattablePaths, severity, cancellationToken).ConfigureAwait(false); + var projectAnalyzers = await FilterBySeverityAsync(solution.Projects, analyzers, formattablePaths, severity, cancellationToken).ConfigureAwait(false); // Determine which diagnostics are being reported for each project. var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, formatOptions, severity, logger, formattedFiles, cancellationToken).ConfigureAwait(false); @@ -70,7 +65,7 @@ public async Task FormatAsync( logger.LogTrace(Resources.Fixing_diagnostics); // Run each analyzer individually and apply fixes if possible. - solution = await FixDiagnosticsAsync(solution, analyzersAndFixers, projectDiagnostics, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); + solution = await FixDiagnosticsAsync(solution, analyzers, fixers, projectDiagnostics, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); var fixDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds - projectDiagnosticsMS; logger.LogTrace(Resources.Complete_in_0_ms, fixDiagnosticsMS); @@ -113,7 +108,7 @@ static void LogDiagnosticLocations(Solution solution, IEnumerable di foreach (var diagnostic in diagnostics) { - var message = diagnostic.GetMessage(); + var message = $"{diagnostic.GetMessage()} ({diagnostic.Id})"; var filePath = diagnostic.Location.SourceTree?.FilePath; var document = solution.GetDocument(diagnostic.Location.SourceTree); @@ -137,41 +132,84 @@ static void LogDiagnosticLocations(Solution solution, IEnumerable di private async Task FixDiagnosticsAsync( Solution solution, - ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> analyzersAndFixers, + ImmutableArray allAnalyzers, + ImmutableArray allCodefixes, ImmutableDictionary> projectDiagnostics, ImmutableHashSet formattablePaths, DiagnosticSeverity severity, ILogger logger, CancellationToken cancellationToken) { + // Determine the reported diagnostic ids + var reportedDiagnostics = projectDiagnostics.SelectMany(kvp => kvp.Value).Distinct().ToImmutableArray(); + if (reportedDiagnostics.IsEmpty) + { + return solution; + } + + // Build maps between diagnostic id and the associated analyzers and codefixes + var analyzersById = CreateAnalyzerMap(reportedDiagnostics, allAnalyzers); + var fixersById = CreateFixerMap(reportedDiagnostics, allCodefixes); + // We need to run each codefix iteratively so ensure that all diagnostics are found and fixed. - foreach (var (analyzer, codefix) in analyzersAndFixers) + foreach (var diagnosticId in reportedDiagnostics) { + var analyzers = analyzersById[diagnosticId]; + var codefixes = fixersById[diagnosticId]; + + // If there is no codefix, there is no reason to run analysis again. + if (codefixes.IsEmpty) + { + logger.LogWarning(Resources.Unable_to_fix_0_No_associated_code_fix_found, diagnosticId); + continue; + } + var result = new CodeAnalysisResult(); foreach (var project in solution.Projects) { - if (!projectDiagnostics.TryGetValue(project.Id, out var diagnosticIds) || - !analyzer.SupportedDiagnostics.Any(diagnostic => diagnosticIds.Contains(diagnostic.Id))) + // Only run analysis on projects that had previously reported the diagnostic + if (!projectDiagnostics.TryGetValue(project.Id, out var diagnosticIds)) { continue; } - await _runner.RunCodeAnalysisAsync(result, analyzer, project, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); + await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); } var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Count > 0); - if (hasDiagnostics && codefix != null) + if (hasDiagnostics) { - solution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); - var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); - if (changedSolution.GetChanges(solution).Any()) + foreach (var codefix in codefixes) { - solution = changedSolution; + var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); + if (changedSolution.GetChanges(solution).Any()) + { + solution = changedSolution; + break; + } } } } return solution; + + static ImmutableDictionary> CreateAnalyzerMap( + ImmutableArray diagnosticIds, + ImmutableArray analyzers) + { + return diagnosticIds.ToImmutableDictionary( + id => id, + id => analyzers.Where(analyzer => analyzer.SupportedDiagnostics.Any(diagnostic => diagnostic.Id == id)).ToImmutableArray()); + } + + static ImmutableDictionary> CreateFixerMap( + ImmutableArray diagnosticIds, + ImmutableArray fixers) + { + return diagnosticIds.ToImmutableDictionary( + id => id, + id => fixers.Where(fixer => fixer.FixableDiagnosticIds.Contains(id)).ToImmutableArray()); + } } internal static async Task>> FilterBySeverityAsync( diff --git a/src/Analyzers/AnalyzerOptionExtensions.cs b/src/Analyzers/AnalyzerOptionExtensions.cs index 157a558e5a65..389f00c9de71 100644 --- a/src/Analyzers/AnalyzerOptionExtensions.cs +++ b/src/Analyzers/AnalyzerOptionExtensions.cs @@ -44,14 +44,17 @@ public static bool TryGetSeverityFromBulkConfiguration( return false; } - // If user has explicitly configured severity for this diagnostic ID, that should be respected and - // bulk configuration should not be applied. + // If user has explicitly configured severity for this diagnostic ID, that should be respected. + if (compilation.Options.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out severity)) + { + return true; + } + + // If user has explicitly configured severity for this diagnostic ID, that should be respected. // For example, 'dotnet_diagnostic.CA1000.severity = error' - if (compilation.Options.SpecificDiagnosticOptions.ContainsKey(descriptor.Id) || - tree.DiagnosticOptions.ContainsKey(descriptor.Id)) + if (tree.DiagnosticOptions.TryGetValue(descriptor.Id, out severity)) { - severity = default; - return false; + return true; } var analyzerConfigOptions = analyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(tree); diff --git a/src/Analyzers/AnalyzerReferenceInformationProvider.cs b/src/Analyzers/AnalyzerReferenceInformationProvider.cs index 484278f96255..48b3b9bb4898 100644 --- a/src/Analyzers/AnalyzerReferenceInformationProvider.cs +++ b/src/Analyzers/AnalyzerReferenceInformationProvider.cs @@ -12,14 +12,14 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class AnalyzerReferenceInformationProvider : IAnalyzerInformationProvider { - public ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers( + public (ImmutableArray Analyzers, ImmutableArray Fixers) GetAnalyzersAndFixers( Solution solution, FormatOptions formatOptions, ILogger logger) { if (!formatOptions.FixAnalyzers) { - return ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)>.Empty; + return (ImmutableArray.Empty, ImmutableArray.Empty); } var assemblies = solution.Projects diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index 2cbba44170f5..26631026659c 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -11,6 +11,13 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal partial class AnalyzerRunner : IAnalyzerRunner { + private bool _includeComplilerDiagnostics; + + public AnalyzerRunner(bool includeCompilerDiagnostics) + { + _includeComplilerDiagnostics = includeCompilerDiagnostics; + } + public Task RunCodeAnalysisAsync( CodeAnalysisResult result, DiagnosticAnalyzer analyzers, @@ -36,14 +43,31 @@ public async Task RunCodeAnalysisAsync( return; } - var analyzerOptions = new CompilationWithAnalyzersOptions( - project.AnalyzerOptions, - onAnalyzerException: null, - concurrentAnalysis: true, - logAnalyzerExecutionTime: false, - reportSuppressedDiagnostics: false); - var analyzerCompilation = compilation.WithAnalyzers(analyzers, analyzerOptions); - var diagnostics = await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken).ConfigureAwait(false); + // If are not running any analyzers and are not reporting compiler diagnostics, then there is + // nothing to report. + if (analyzers.IsEmpty && !_includeComplilerDiagnostics) + { + return; + } + + ImmutableArray diagnostics; + if (analyzers.IsEmpty) + { + diagnostics = compilation.GetDiagnostics(cancellationToken); + } + else + { + var analyzerOptions = new CompilationWithAnalyzersOptions( + project.AnalyzerOptions, + onAnalyzerException: null, + concurrentAnalysis: true, + logAnalyzerExecutionTime: false, + reportSuppressedDiagnostics: false); + var analyzerCompilation = compilation.WithAnalyzers(analyzers, analyzerOptions); + diagnostics = _includeComplilerDiagnostics + ? await analyzerCompilation.GetAllDiagnosticsAsync(cancellationToken).ConfigureAwait(false) + : await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken).ConfigureAwait(false); + } // filter diagnostics foreach (var diagnostic in diagnostics) diff --git a/src/Analyzers/CodeStyleInformationProvider.cs b/src/Analyzers/CodeStyleInformationProvider.cs index aef3482d2413..eb7cc8e0654d 100644 --- a/src/Analyzers/CodeStyleInformationProvider.cs +++ b/src/Analyzers/CodeStyleInformationProvider.cs @@ -18,14 +18,14 @@ internal class CodeStyleInformationProvider : IAnalyzerInformationProvider private readonly string _featuresCSharpPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.CSharp.Features.dll"); private readonly string _featuresVisualBasicPath = Path.Combine(s_executingPath, "Microsoft.CodeAnalysis.VisualBasic.Features.dll"); - public ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers( + public (ImmutableArray Analyzers, ImmutableArray Fixers) GetAnalyzersAndFixers( Solution solution, FormatOptions options, ILogger logger) { if (!options.FixCodeStyle) { - return ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)>.Empty; + return (ImmutableArray.Empty, ImmutableArray.Empty); } var assemblies = new[] diff --git a/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs b/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs index 8a545b0b70df..2b4f1e540ab7 100644 --- a/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs +++ b/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs @@ -11,7 +11,7 @@ interface IAnalyzerInformationProvider { DiagnosticSeverity GetSeverity(FormatOptions formatOptions); - ImmutableArray<(DiagnosticAnalyzer Analyzer, CodeFixProvider? Fixer)> GetAnalyzersAndFixers( + (ImmutableArray Analyzers, ImmutableArray Fixers) GetAnalyzersAndFixers( Solution solution, FormatOptions formatOptions, ILogger logger); diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 944c4a911f98..9bad74bd854c 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -29,8 +29,8 @@ internal static class CodeFormatter new EndOfLineFormatter(), new CharsetFormatter(), new ImportsFormatter(), - new AnalyzerFormatter(Resources.Code_Style, new CodeStyleInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier()), - new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier()), + new AnalyzerFormatter(Resources.Code_Style, new CodeStyleInformationProvider(), new AnalyzerRunner(includeCompilerDiagnostics: true), new SolutionCodeFixApplier()), + new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(includeCompilerDiagnostics: false), new SolutionCodeFixApplier()), }.ToImmutableArray(); public static async Task FormatWorkspaceAsync( diff --git a/src/Resources.resx b/src/Resources.resx index ac8f7875ad4a..413796afb622 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -264,4 +264,7 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 6cfe825c18bf..71cb1ad6c28d 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 3c858a7bf577..7e80b0d66e5a 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 7c9c26f29f5a..9b93d9839cc4 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 96407b9ee9e4..000a502cd0cd 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 4cea5eaa8818..09381b4ac008 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 5ee9c30208b1..ffea222aeb8a 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index af6fa13c8fa4..4243103f0988 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 72edec1e7800..96c6cc54d3c3 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 36fe15137fa0..68ed011ce5c0 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 4b50b46f4819..002490a8fa83 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index b736f28bd331..269a7641ef96 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 9363b6f9fb03..61ea6b9e8420 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index becbf45db23c..7d5c26d0b912 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -212,6 +212,11 @@ Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + Unable to fix {0}. No associated code fix found. + Unable to fix {0}. No associated code fix found. + + Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs index 68b84d2fe1de..9e1918e926bb 100644 --- a/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -62,8 +62,8 @@ await GenerateAssemblyAsync( GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId")) }; - var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - return ImmutableArray.Create(analyzersAndFixers[0].Analyzer); + var (analyzers, _) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + return analyzers; } private IEnumerable GetProjects() diff --git a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs index e844945853d6..6b28cdd95902 100644 --- a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs +++ b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs @@ -24,8 +24,9 @@ await GenerateAssemblyAsync( GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId")) }; - var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - var (analyzer, fixer) = Assert.Single(analyzersAndFixers); + var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + var analyzer = Assert.Single(analyzers); + var fixer = Assert.Single(fixers); var analyzerDiagnosticDescriptor = Assert.Single(analyzer.SupportedDiagnostics); var fixerDiagnosticId = Assert.Single(fixer.FixableDiagnosticIds); Assert.Equal(analyzerDiagnosticDescriptor.Id, fixerDiagnosticId); @@ -43,9 +44,9 @@ await GenerateAssemblyAsync( GenerateCodeFix("CodeFixProvider2", "DiagnosticAnalyzerId2")) }; - var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - Assert.Equal(2, analyzersAndFixers.Length); - Assert.Collection(analyzersAndFixers, VerifyAnalyzerCodeFixTuple, VerifyAnalyzerCodeFixTuple); + var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Equal(2, analyzers.Length); + Assert.Equal(2, fixers.Length); } [Fact] @@ -60,9 +61,9 @@ await GenerateAssemblyAsync( GenerateAnalyzerCode("DiagnosticAnalyzer2", "DiagnosticAnalyzerId2"), GenerateCodeFix("CodeFixProvider2", "DiagnosticAnalyzerId2")), }; - var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - Assert.Equal(2, analyzersAndFixers.Length); - Assert.Collection(analyzersAndFixers, VerifyAnalyzerCodeFixTuple, VerifyAnalyzerCodeFixTuple); + var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Equal(2, analyzers.Length); + Assert.Equal(2, fixers.Length); } [Fact] @@ -75,8 +76,9 @@ await GenerateAssemblyAsync( GenerateCodeFix("CodeFixProvider1", "CodeFixProviderId")) }; - var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - Assert.Empty(analyzersAndFixers); + var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Empty(analyzers); + Assert.Empty(fixers); } [Fact] @@ -91,8 +93,9 @@ await GenerateAssemblyAsync( GenerateCodeFix("CodeFixProvider2", "CodeFixProviderId")) }; - var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - var (analyzer, fixer) = Assert.Single(analyzersAndFixers); + var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + var analyzer = Assert.Single(analyzers); + var fixer = Assert.Single(fixers); var analyzerDiagnosticDescriptor = Assert.Single(analyzer.SupportedDiagnostics); var fixerDiagnosticId = Assert.Single(fixer.FixableDiagnosticIds); Assert.Equal(analyzerDiagnosticDescriptor.Id, fixerDiagnosticId); @@ -110,9 +113,9 @@ await GenerateAssemblyAsync( GenerateCodeFix("CodeFixProvider2", "CodeFixProviderId")) }; - var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - Assert.Equal(2, analyzersAndFixers.Length); - Assert.Collection(analyzersAndFixers, VerifyAnalyzerCodeFixTuple, VerifyAnalyzerCodeFixTuple); + var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Equal(2, analyzers.Length); + Assert.Equal(2, fixers.Length); } [Fact] @@ -126,16 +129,9 @@ await GenerateAssemblyAsync( GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId1")) }; - var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - Assert.Equal(2, analyzersAndFixers.Length); - Assert.Collection(analyzersAndFixers, VerifyAnalyzerCodeFixTuple, VerifyAnalyzerCodeFixTuple); - } - - private static void VerifyAnalyzerCodeFixTuple((DiagnosticAnalyzer Analyzer, CodeFixProvider Fixer) tuple) - { - var analyzerDiagnosticDescriptor = Assert.Single(tuple.Analyzer.SupportedDiagnostics); - var fixerDiagnosticId = Assert.Single(tuple.Fixer.FixableDiagnosticIds); - Assert.Equal(analyzerDiagnosticDescriptor.Id, fixerDiagnosticId); + var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); + Assert.Equal(2, analyzers.Length); + Assert.Equal(1, fixers.Length); } } } From 0db01ca2d05193b0c7a6bb6af3f9b50a993ee3f4 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 5 Jul 2020 22:25:42 -0700 Subject: [PATCH 1077/2702] Run dotnet-format to fix code style warnings. --- src/Analyzers/AnalyzerOptionExtensions.cs | 4 +--- src/Analyzers/AnalyzerRunner.cs | 2 +- src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs | 2 +- src/Analyzers/Interfaces/IAnalyzerRunner.cs | 2 +- src/Analyzers/Interfaces/ICodeFixApplier.cs | 2 +- src/FormattedFile.cs | 4 +++- src/Formatters/CharsetFormatter.cs | 2 +- src/Formatters/EndOfLineFormatter.cs | 2 +- src/Formatters/FinalNewlineFormatter.cs | 2 +- src/Logging/SimpleConsoleLogger.cs | 4 ++-- src/MSBuild/LooseVersionAssemblyLoader.cs | 2 +- tests/Analyzers/AnalyzerAssemblyGenerator.cs | 2 +- tests/Analyzers/FilterDiagnosticsTests.cs | 4 +++- tests/Analyzers/LoadAnalyzersAndFixersTests.cs | 2 +- tests/Extensions/ExportProviderExtensions.cs | 2 +- tests/Formatters/AbstractFormatterTests.cs | 2 +- tests/Formatters/CSharpFormatterTests.cs | 2 +- tests/Formatters/CharsetFormatterTests.cs | 2 +- tests/Formatters/EndOfLineFormatterTests.cs | 2 +- tests/Formatters/FinalNewlineFormatterTests.cs | 2 +- tests/Formatters/FormattedFilesTests.cs | 2 +- tests/Formatters/ImportsFormatterTests.cs | 2 +- tests/Utilities/XmlReferenceResolver.cs | 2 +- 23 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/Analyzers/AnalyzerOptionExtensions.cs b/src/Analyzers/AnalyzerOptionExtensions.cs index 389f00c9de71..a063ab6ec5df 100644 --- a/src/Analyzers/AnalyzerOptionExtensions.cs +++ b/src/Analyzers/AnalyzerOptionExtensions.cs @@ -1,6 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Linq; diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index 26631026659c..84195df248eb 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal partial class AnalyzerRunner : IAnalyzerRunner { - private bool _includeComplilerDiagnostics; + private readonly bool _includeComplilerDiagnostics; public AnalyzerRunner(bool includeCompilerDiagnostics) { diff --git a/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs b/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs index 2b4f1e540ab7..93412be47fe2 100644 --- a/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs +++ b/src/Analyzers/Interfaces/IAnalyzerInformationProvider.cs @@ -7,7 +7,7 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { - interface IAnalyzerInformationProvider + internal interface IAnalyzerInformationProvider { DiagnosticSeverity GetSeverity(FormatOptions formatOptions); diff --git a/src/Analyzers/Interfaces/IAnalyzerRunner.cs b/src/Analyzers/Interfaces/IAnalyzerRunner.cs index a94cd6cfa8bc..565b7fbd4af6 100644 --- a/src/Analyzers/Interfaces/IAnalyzerRunner.cs +++ b/src/Analyzers/Interfaces/IAnalyzerRunner.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { - interface IAnalyzerRunner + internal interface IAnalyzerRunner { Task RunCodeAnalysisAsync( CodeAnalysisResult result, diff --git a/src/Analyzers/Interfaces/ICodeFixApplier.cs b/src/Analyzers/Interfaces/ICodeFixApplier.cs index af37b59c10e4..7a6674f91a8b 100644 --- a/src/Analyzers/Interfaces/ICodeFixApplier.cs +++ b/src/Analyzers/Interfaces/ICodeFixApplier.cs @@ -7,7 +7,7 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { - interface ICodeFixApplier + internal interface ICodeFixApplier { Task ApplyCodeFixesAsync( Solution solution, diff --git a/src/FormattedFile.cs b/src/FormattedFile.cs index 3165b29cb6a2..9b02490a0c01 100644 --- a/src/FormattedFile.cs +++ b/src/FormattedFile.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; namespace Microsoft.CodeAnalysis.Tools { diff --git a/src/Formatters/CharsetFormatter.cs b/src/Formatters/CharsetFormatter.cs index ac8aacbf7a34..5f352a016c90 100644 --- a/src/Formatters/CharsetFormatter.cs +++ b/src/Formatters/CharsetFormatter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Diagnostics.CodeAnalysis; using System.IO; diff --git a/src/Formatters/EndOfLineFormatter.cs b/src/Formatters/EndOfLineFormatter.cs index c61c4fc27b3a..732d31ebdbab 100644 --- a/src/Formatters/EndOfLineFormatter.cs +++ b/src/Formatters/EndOfLineFormatter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Diagnostics.CodeAnalysis; diff --git a/src/Formatters/FinalNewlineFormatter.cs b/src/Formatters/FinalNewlineFormatter.cs index 9892b14f6517..f59c8482de28 100644 --- a/src/Formatters/FinalNewlineFormatter.cs +++ b/src/Formatters/FinalNewlineFormatter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Linq; diff --git a/src/Logging/SimpleConsoleLogger.cs b/src/Logging/SimpleConsoleLogger.cs index 322aa7af528f..e091fd5dc508 100644 --- a/src/Logging/SimpleConsoleLogger.cs +++ b/src/Logging/SimpleConsoleLogger.cs @@ -66,7 +66,7 @@ public IDisposable BeginScope(TState state) return NullScope.Instance; } - void LogToTerminal(string message, LogLevel logLevel) + private void LogToTerminal(string message, LogLevel logLevel) { var messageColor = LogLevelColorMap[logLevel]; _terminal.ForegroundColor = messageColor; @@ -74,7 +74,7 @@ void LogToTerminal(string message, LogLevel logLevel) _terminal.ResetColor(); } - void LogToConsole(string message) + private void LogToConsole(string message) { _console.Out.Write($" {message}{Environment.NewLine}"); } diff --git a/src/MSBuild/LooseVersionAssemblyLoader.cs b/src/MSBuild/LooseVersionAssemblyLoader.cs index 8ec7b2c5e9ee..6d7a6c5be3c7 100644 --- a/src/MSBuild/LooseVersionAssemblyLoader.cs +++ b/src/MSBuild/LooseVersionAssemblyLoader.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/tests/Analyzers/AnalyzerAssemblyGenerator.cs b/tests/Analyzers/AnalyzerAssemblyGenerator.cs index d0ae19429cf6..69130119f5c2 100644 --- a/tests/Analyzers/AnalyzerAssemblyGenerator.cs +++ b/tests/Analyzers/AnalyzerAssemblyGenerator.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs index 9e1918e926bb..d2ea931100d3 100644 --- a/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -1,4 +1,6 @@ -using System; +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; diff --git a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs index 6b28cdd95902..70248a0efcb3 100644 --- a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs +++ b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Threading.Tasks; diff --git a/tests/Extensions/ExportProviderExtensions.cs b/tests/Extensions/ExportProviderExtensions.cs index 1158612168d7..74bd2d8fa002 100644 --- a/tests/Extensions/ExportProviderExtensions.cs +++ b/tests/Extensions/ExportProviderExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 7c5dd22805b8..4c0b4e5e2a6f 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/tests/Formatters/CSharpFormatterTests.cs b/tests/Formatters/CSharpFormatterTests.cs index e633280a4561..255a0422b245 100644 --- a/tests/Formatters/CSharpFormatterTests.cs +++ b/tests/Formatters/CSharpFormatterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.CSharp; diff --git a/tests/Formatters/CharsetFormatterTests.cs b/tests/Formatters/CharsetFormatterTests.cs index b9b1cb233ee4..dbbcd81ede8b 100644 --- a/tests/Formatters/CharsetFormatterTests.cs +++ b/tests/Formatters/CharsetFormatterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; using System.Text; diff --git a/tests/Formatters/EndOfLineFormatterTests.cs b/tests/Formatters/EndOfLineFormatterTests.cs index 33439abbe69a..e5162afbf505 100644 --- a/tests/Formatters/EndOfLineFormatterTests.cs +++ b/tests/Formatters/EndOfLineFormatterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; using System.Threading.Tasks; diff --git a/tests/Formatters/FinalNewlineFormatterTests.cs b/tests/Formatters/FinalNewlineFormatterTests.cs index 019b859d3fde..01b71c860db2 100644 --- a/tests/Formatters/FinalNewlineFormatterTests.cs +++ b/tests/Formatters/FinalNewlineFormatterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; using System.Threading.Tasks; diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index 8732f120523a..6c7a8d2880bf 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/tests/Formatters/ImportsFormatterTests.cs b/tests/Formatters/ImportsFormatterTests.cs index f79ae04a8195..250d0785d1d8 100644 --- a/tests/Formatters/ImportsFormatterTests.cs +++ b/tests/Formatters/ImportsFormatterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Collections.Generic; diff --git a/tests/Utilities/XmlReferenceResolver.cs b/tests/Utilities/XmlReferenceResolver.cs index 26c6c3cab322..4712e7dd32e2 100644 --- a/tests/Utilities/XmlReferenceResolver.cs +++ b/tests/Utilities/XmlReferenceResolver.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; using System.IO; From e89105c4215452c4ab295efa82667b05c388d4d9 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 5 Jul 2020 22:27:41 -0700 Subject: [PATCH 1078/2702] Remove method used for analyzer testing --- src/Analyzers/AnalyzerFinderHelpers.cs | 5 ----- tests/Analyzers/LoadAnalyzersAndFixersTests.cs | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Analyzers/AnalyzerFinderHelpers.cs b/src/Analyzers/AnalyzerFinderHelpers.cs index 4d8530472fd7..eb9bef653392 100644 --- a/src/Analyzers/AnalyzerFinderHelpers.cs +++ b/src/Analyzers/AnalyzerFinderHelpers.cs @@ -12,11 +12,6 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal static class AnalyzerFinderHelpers { - public static DiagnosticAnalyzer? GetAnalyzer(string name) - { - return null; - } - public static (ImmutableArray Analyzers, ImmutableArray Fixers) LoadAnalyzersAndFixers(IEnumerable assemblies) { var types = assemblies diff --git a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs index 70248a0efcb3..056643a71eef 100644 --- a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs +++ b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs @@ -131,7 +131,7 @@ await GenerateAssemblyAsync( var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); Assert.Equal(2, analyzers.Length); - Assert.Equal(1, fixers.Length); + Assert.Single(fixers); } } } From 38fdc7dacfaee76ac8a5dbe27b4b993ef7429bb6 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 5 Jul 2020 22:58:33 -0700 Subject: [PATCH 1079/2702] Remove redundant tests --- .../Analyzers/LoadAnalyzersAndFixersTests.cs | 70 ------------------- 1 file changed, 70 deletions(-) diff --git a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs index 056643a71eef..f15d38a3dc18 100644 --- a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs +++ b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs @@ -2,8 +2,6 @@ using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CodeFixes; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Tools.Analyzers; using Xunit; @@ -65,73 +63,5 @@ await GenerateAssemblyAsync( Assert.Equal(2, analyzers.Length); Assert.Equal(2, fixers.Length); } - - [Fact] - public static async Task NonMatchingIdsAsync() - { - var assemblies = new[] - { - await GenerateAssemblyAsync( - GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId"), - GenerateCodeFix("CodeFixProvider1", "CodeFixProviderId")) - }; - - var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - Assert.Empty(analyzers); - Assert.Empty(fixers); - } - - [Fact] - public static async Task SomeMatchingIdsAsync() - { - var assemblies = new[] - { - await GenerateAssemblyAsync( - GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId1"), - GenerateAnalyzerCode("DiagnosticAnalyzer2", "DiagnosticAnalyzerId2"), - GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId1"), - GenerateCodeFix("CodeFixProvider2", "CodeFixProviderId")) - }; - - var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - var analyzer = Assert.Single(analyzers); - var fixer = Assert.Single(fixers); - var analyzerDiagnosticDescriptor = Assert.Single(analyzer.SupportedDiagnostics); - var fixerDiagnosticId = Assert.Single(fixer.FixableDiagnosticIds); - Assert.Equal(analyzerDiagnosticDescriptor.Id, fixerDiagnosticId); - } - - [Fact] - public static async Task SingleIdMapstoMultipleFixersAsync() - { - var assemblies = new[] - { - await GenerateAssemblyAsync( - GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId1"), - GenerateAnalyzerCode("DiagnosticAnalyzer2", "DiagnosticAnalyzerId1"), - GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId1"), - GenerateCodeFix("CodeFixProvider2", "CodeFixProviderId")) - }; - - var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - Assert.Equal(2, analyzers.Length); - Assert.Equal(2, fixers.Length); - } - - [Fact] - public static async Task MultipleIdsMaptoSingleFixerAsync() - { - var assemblies = new[] - { - await GenerateAssemblyAsync( - GenerateAnalyzerCode("DiagnosticAnalyzer1", "DiagnosticAnalyzerId1"), - GenerateAnalyzerCode("DiagnosticAnalyzer2", "DiagnosticAnalyzerId1"), - GenerateCodeFix("CodeFixProvider1", "DiagnosticAnalyzerId1")) - }; - - var (analyzers, fixers) = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); - Assert.Equal(2, analyzers.Length); - Assert.Single(fixers); - } } } From efd476790de03b9ef8c0d9249c5098abe2c41956 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 6 Jul 2020 10:59:51 -0700 Subject: [PATCH 1080/2702] Updated formatting based on comments --- src/CodeFormatter.cs | 2 +- tests/Analyzers/FilterDiagnosticsTests.cs | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 9bad74bd854c..6cfa0672a1e0 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -30,7 +30,7 @@ internal static class CodeFormatter new CharsetFormatter(), new ImportsFormatter(), new AnalyzerFormatter(Resources.Code_Style, new CodeStyleInformationProvider(), new AnalyzerRunner(includeCompilerDiagnostics: true), new SolutionCodeFixApplier()), - new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(includeCompilerDiagnostics: false), new SolutionCodeFixApplier()), + new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(includeCompilerDiagnostics: true), new SolutionCodeFixApplier()), }.ToImmutableArray(); public static async Task FormatWorkspaceAsync( diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs index d2ea931100d3..a874f6538c6d 100644 --- a/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -30,11 +30,12 @@ public async Task TestFilterWarning() var allAnalyzers = await GetAnalyzersAsync(); var formattablePaths = ImmutableHashSet.Create(projects.First().Documents.First().FilePath); var minimumSeverity = DiagnosticSeverity.Warning; - var result = await AnalyzerFormatter.FilterBySeverityAsync(projects, - allAnalyzers, - formattablePaths, - minimumSeverity, - CancellationToken.None); + var result = await AnalyzerFormatter.FilterBySeverityAsync( + projects, + allAnalyzers, + formattablePaths, + minimumSeverity, + CancellationToken.None); var (_, analyzers) = Assert.Single(result); Assert.Single(analyzers); } @@ -46,11 +47,12 @@ public async Task TestFilterError() var allAnalyzers = await GetAnalyzersAsync(); var formattablePaths = ImmutableHashSet.Create(projects.First().Documents.First().FilePath); var minimumSeverity = DiagnosticSeverity.Error; - var result = await AnalyzerFormatter.FilterBySeverityAsync(projects, - allAnalyzers, - formattablePaths, - minimumSeverity, - CancellationToken.None); + var result = await AnalyzerFormatter.FilterBySeverityAsync( + projects, + allAnalyzers, + formattablePaths, + minimumSeverity, + CancellationToken.None); var (_, analyzers) = Assert.Single(result); Assert.Empty(analyzers); } From 443fdfb9af327115f544e894a5cf49061b28345a Mon Sep 17 00:00:00 2001 From: Cristiano Suzuki Date: Mon, 6 Jul 2020 11:06:29 -0700 Subject: [PATCH 1081/2702] LOC CHECKIN 20200706 --- src/xlf/Resources.cs.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.de.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.es.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.fr.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.it.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.ja.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.ko.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.pl.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.pt-BR.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.ru.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.tr.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.zh-Hans.xlf | 178 ++++++++++++++++------------------ src/xlf/Resources.zh-Hant.xlf | 178 ++++++++++++++++------------------ 13 files changed, 1092 insertions(+), 1222 deletions(-) diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 6cfe825c18bf..d3032804364d 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + Seznam relativních cest k souborům nebo složkám, které se nemají formátovat A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Seznam relativních cest k souborům nebo složkám, které se mají formátovat. Pokud bude seznam prázdný, budou se formátovat všechny soubory. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + Přijímá cestu k souboru. Pokud se zadá, vytvoří se v daném adresáři sestava JSON. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + Možnosti složek a pracovních prostorů se nedají zadat najednou. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. + + Cannot specify both project argument and folder options. + Možnosti argumentů projektu a složek se nedají zadat najednou. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + Možnosti argumentů projektů a pracovních prostorů se nedají zadat najednou. Complete in {0}ms. - Complete in {0}ms. + Dokončeno za {0} ms - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - V adresáři {0} nešlo najít soubor projektu MSBuild nebo soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + V adresáři {0} nešlo najít soubor projektu MSBuild nebo soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - {0} nejde formátovat. Formátovat jde v současné době jenom projekty v jazycích C# a Visual Basic. - - - - Determining diagnostics... - Determining diagnostics... + {0} nejde formátovat. Formátovat jde v současné době jenom projekty v jazycích C# a Visual Basic. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + Určují se soubory, které se dají formátovat. Failed to save formatting changes. - Nepodařilo se uložit změny formátování. + Nepodařilo se uložit změny formátování. Fix end of line marker. - Fix end of line marker. + Opravte značku konce řádku. Fix file encoding. - Fix file encoding. + Opravte kódování souboru. Fix final newline. - Fix final newline. + Opravte odřádkování na konci. Fix imports ordering. - Fix imports ordering. + Opravte pořadí importů. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + Opravte formátování prázdných znaků. Format complete in {0}ms. - Format complete in {0}ms. + Formátování se dokončilo za {0} ms. + + + Format files, but do not save changes to disk. + + Soubory se naformátují, ale změny se neuloží na disk. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formátuje soubory bez toho, aby se změny ukládaly na disk. Pokud se nějaké soubory naformátovaly, ukončí se s nenulovým ukončovacím kódem. Formatted {0} of {1} files. - Formatted {0} of {1} files. + Naformátovali jsme {0} z {1} souborů. Formatting code file '{0}'. - Formátuje se soubor kódu {0}. + Formátuje se soubor kódu {0}. Formatting code files in workspace '{0}'. - Formátují se soubory kódu v pracovním prostoru {0}. + Formátují se soubory kódu v pracovním prostoru {0}. Include generated code files in formatting operations. - Include generated code files in formatting operations. + Zahrňte do operací formátování vygenerované soubory kódu. Loading workspace. - Načítá se pracovní prostor. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Načítá se pracovní prostor. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + {0} obsahuje více souborů projektů MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. Running formatters. - Running formatters. + Spouští se formátování. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Nastavte úroveň podrobností. Povolené hodnoty jsou: q[uiet], m[inimal], n[ormal], d[etailed] a diag[nostic] + Nastavte úroveň podrobností. Povolené hodnoty jsou: q[uiet], m[inimal], n[ormal], d[etailed] a diag[nostic] Skipping referenced project '{0}'. - Přeskočí se odkazovaný projekt {0}. - - - - Solution {0} has no projects - Solution {0} has no projects + Přeskočí se odkazovaný projekt {0}. The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + Verze .NET CLI je {0}. + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + Možnost --dry-run je zastaralá. Použijte místo ní možnost --check. The file '{0}' does not appear to be a valid project or solution file. + Soubor {0} zřejmě není platný soubor projektu nebo řešení. + + + The `--files` option is deprecated. Use the `--include` option instead. + + Možnost --files je zastaralá. Použijte místo ní možnost --include. + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + Pro zadávání cesty je možnost --folder zastaralá. Možnost --folder můžete předat, ale cestu zadejte pomocí argumentu projektu. The project file '{0}' does not exist. - Soubor projektu {0} neexistuje. + Soubor projektu {0} neexistuje. The solution file '{0}' does not exist. + Soubor řešení {0} neexistuje. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Soubor řešení nebo projektu, se kterým se má operace provést. Pokud soubor není zadaný, příkaz ho bude hledat v aktuálním adresáři. Formatted code file '{0}'. - Formatted code file '{0}'. + Naformátoval se soubor kódu {0}. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + Možnost --workspace je zastaralá. Použijte místo ní argument <project>. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Nepovedlo se najít MSBuild. Ujistěte se, že se sada .NET SDK nainstalovala pomocí oficiálního instalačního programu. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + Nepovedlo se najít .NET CLI. Ujistěte se, že se nachází v proměnné PATH. Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + Nepovedlo se uspořádat importy pro {0}. Dokument je příliš složitý. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + Používá se MSBuild.exe umístěný v {0}. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + Při načítání pracovního prostoru se vygenerovala upozornění. Pokud chcete upozornění protokolovat, nastavte možnost verbosity na úroveň diagnostic. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + Určuje, jestli se cesta <project> má považovat za složku, nebo soubory. Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + Sestava formátování se zapisuje do {0}. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 3c858a7bf577..f0bd702ab335 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + Eine Liste der relativen Datei- oder Ordnerpfade, die von der Formatierung ausgeschlossen werden sollen. A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Eine Liste der relativen Datei- oder Ordnerpfade, die in die Formatierung einbezogen werden sollen. Wenn diese Liste leer ist, werden alle Dateien formatiert. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + Akzeptiert einen Dateipfad, der bei Bereitstellung einen JSON-Bericht im angegebenen Verzeichnis erstellt. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappe gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + Die Optionen für einen Ordner und für einen Arbeitsbereich können nicht gleichzeitig angegeben werden. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappe gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. + + Cannot specify both project argument and folder options. + Die Optionen für ein Projektargument und für einen Ordner können nicht gleichzeitig angegeben werden. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + Die Optionen für ein Projektargument und für einen Arbeitsbereich können nicht gleichzeitig angegeben werden. Complete in {0}ms. - Complete in {0}ms. + Abgeschlossen in {0} ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - Kein MSBuild-Projektdatei oder Projektmappendatei in "{0}" gefunden. Geben Sie die zu verwendende Datei mit der Option "--workspace" an. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Kein MSBuild-Projektdatei oder Projektmappendatei in "{0}" gefunden. Geben Sie die zu verwendende Datei mit der Option "--workspace" an. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - "{0}" konnte nicht formatiert werden. Derzeit wird die Formatierung nur für C#- und Visual Basic-Projekte unterstützt. - - - - Determining diagnostics... - Determining diagnostics... + "{0}" konnte nicht formatiert werden. Derzeit wird die Formatierung nur für C#- und Visual Basic-Projekte unterstützt. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + Formatierbare Dateien werden ermittelt. Failed to save formatting changes. - Fehler beim Speichern von Formatierungsänderungen. + Fehler beim Speichern von Formatierungsänderungen. Fix end of line marker. - Fix end of line marker. + Korrigieren Sie den Zeilenendemarker. Fix file encoding. - Fix file encoding. + Korrigieren Sie die Dateicodierung. Fix final newline. - Fix final newline. + Korrigieren Sie den letzten Zeilenumbruch. Fix imports ordering. - Fix imports ordering. + Korrigieren Sie die Importreihenfolge. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + Korrigieren Sie die Leerraumformatierung. Format complete in {0}ms. - Format complete in {0}ms. + Die Formatierung wurde in {0} ms abgeschlossen. + + + Format files, but do not save changes to disk. + + Dateien formatieren, Änderungen aber nicht auf Festplatte speichern. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formatiert Dateien ohne Speichern der Änderungen auf dem Datenträger. Wird mit einem Exitcode ungleich Null beendet, wenn Dateien formatiert wurden. Formatted {0} of {1} files. - Formatted {0} of {1} files. + {0} von {1} Dateien wurden formatiert. Formatting code file '{0}'. - Codedatei "{0}" wird formatiert. + Codedatei "{0}" wird formatiert. Formatting code files in workspace '{0}'. - Codedateien im Arbeitsbereich "{0}" werden formatiert. + Codedateien im Arbeitsbereich "{0}" werden formatiert. Include generated code files in formatting operations. - Include generated code files in formatting operations. + Hiermit werden generierte Codedateien in Formatierungsvorgänge einbezogen. Loading workspace. - Arbeitsbereich wird geladen. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Arbeitsbereich wird geladen. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Mehrere MSBuild-Projektdateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Mehrere MSBuild Projektmappendateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. Running formatters. - Running formatters. + Formatierer werden ausgeführt. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Legen Sie den Ausführlichkeitsgrad fest. Zulässige Werte sind "q[uiet]", "m[inimal]", "n[ormal]", "d[etailed]" und "diag[nostic]". + Legen Sie den Ausführlichkeitsgrad fest. Zulässige Werte sind "q[uiet]", "m[inimal]", "n[ormal]", "d[etailed]" und "diag[nostic]". Skipping referenced project '{0}'. - Überspringen von referenziertem Projekt "{0}". - - - - Solution {0} has no projects - Solution {0} has no projects + Überspringen von referenziertem Projekt "{0}". The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + Die dotnet-CLI-Version ist "{0}". + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + Die Option "--dry-run" ist veraltet. Verwenden Sie stattdessen die Option "--check". The file '{0}' does not appear to be a valid project or solution file. + Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. + + + The `--files` option is deprecated. Use the `--include` option instead. + + Die Option "--files" ist veraltet. Verwenden Sie stattdessen die Option "--include". + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + Die Option "--folder" ist für die Angabe des Pfads veraltet. Übergeben Sie die Option "--folder", aber geben Sie stattdessen den Pfad mit dem Argument "project" an. The project file '{0}' does not exist. - Die Projektdatei "{0}" ist nicht vorhanden. + Die Projektdatei "{0}" ist nicht vorhanden. The solution file '{0}' does not exist. + Die Projektmappendatei "{0}" ist nicht vorhanden. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Die Projektmappe oder Projektdatei, die verwendet werden soll. Wenn keine Datei angegeben ist, durchsucht der Befehl das aktuelle Verzeichnis nach einer Datei. Formatted code file '{0}'. - Formatted code file '{0}'. + Codedatei "{0}" wurde formatiert. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + Die Option "--workspace" ist veraltet. Verwenden Sie stattdessen das Argument "<project>". Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + MSBuild wurde nicht gefunden. Stellen Sie sicher, dass das .NET SDK mit dem offiziellen Installationsprogramm installiert wurde. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + Die dotnet-CLI wurde nicht gefunden. Stellen Sie sicher, dass sie sich im Pfad befindet. Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + Importe für "{0}" können nicht organisiert werden. Das Dokument ist zu komplex. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + MSBuild.exe in "{0}" wird verwendet. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + Beim Laden des Arbeitsbereichs sind Warnungen aufgetreten. Legen Sie die Ausführlichkeitsoption auf "Diagnose" fest, um Warnungen zu protokollieren. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + Gibt an, ob der Pfad "<project>" als Ordner für Dateien behandelt werden soll. Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + Formatierungsbericht wird in "{0}" geschrieben. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 7c9c26f29f5a..a894e9dd2d00 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + Lista de rutas de acceso de carpeta o archivo relativas que se van a excluir del formato. A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Lista de rutas de acceso de carpeta o archivo relativas que se van a incluir en el formato. Se da formato a todos los archivos, si están vacíos. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + Acepta una ruta de acceso de archivo que, si se proporciona, generará un informe JSON en el directorio dado. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Se encontró un archivo de proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + No se pueden especificar las opciones de carpeta y de área de trabajo a la vez. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - Se encontró un archivo de proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. + + Cannot specify both project argument and folder options. + No se pueden especificar las opciones de carpeta y argumento de proyecto a la vez. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + No se pueden especificar las opciones de área de trabajo y argumento de proyecto a la vez. Complete in {0}ms. - Complete in {0}ms. + Completar en {0} ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - No se pudo encontrar un archivo de proyecto o archivo de solución MSBuild en "{0}". Especifique cuál debe utilizarse con la opción --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + No se pudo encontrar un archivo de proyecto o archivo de solución MSBuild en "{0}". Especifique cuál debe utilizarse con la opción --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - No se pudo dar formato a "{0}". El formato admite solo proyectos de C# y Visual Basic en este momento. - - - - Determining diagnostics... - Determining diagnostics... + No se pudo dar formato a "{0}". El formato admite solo proyectos de C# y Visual Basic en este momento. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + Determinando los archivos formateables. Failed to save formatting changes. - Error al guardar cambios de formato. + Error al guardar cambios de formato. Fix end of line marker. - Fix end of line marker. + Corrija el marcador de fin de línea. Fix file encoding. - Fix file encoding. + Corrija la codificación del archivo. Fix final newline. - Fix final newline. + Corrija la nueva línea final. Fix imports ordering. - Fix imports ordering. + Corrija el orden de las importaciones. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + Corrija el formato de espacio en blanco. Format complete in {0}ms. - Format complete in {0}ms. + Formato completado en {0} ms. + + + Format files, but do not save changes to disk. + + Formato de archivos, pero no guardar los cambios al disco. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Da formato a los archivos sin guardar los cambios en el disco. Termina con un código de salida distinto de cero si se ha dado formato a algún archivo. Formatted {0} of {1} files. - Formatted {0} of {1} files. + {0} de {1} archivos con formato aplicado. Formatting code file '{0}'. - Formato de archivo de código "{0}". + Formato de archivo de código "{0}". Formatting code files in workspace '{0}'. - Aplicar formato a archivos de código en espacio de trabajo "{0}". + Aplicar formato a archivos de código en espacio de trabajo "{0}". Include generated code files in formatting operations. - Include generated code files in formatting operations. + Incluya los archivos de código generados en las operaciones de formato. Loading workspace. - Cargando área de trabajo. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Cargando área de trabajo. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Se encontraron múltiples archivos de proyecto MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Se encontraron múltiples archivos de solución MSBuild en "{0}". Especifique cuáles se deben utilizar con la opción --workspace. Running formatters. - Running formatters. + Ejecutando los formateadores. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Establecer el nivel de detalle. Los valores permitidos son q[uiet], m[inimal], n[ormal], d[etailed]c y diag[nostic] + Establecer el nivel de detalle. Los valores permitidos son q[uiet], m[inimal], n[ormal], d[etailed]c y diag[nostic] Skipping referenced project '{0}'. - Omitiendo projecto al que se hace referencia "{0}". - - - - Solution {0} has no projects - Solution {0} has no projects + Omitiendo projecto al que se hace referencia "{0}". The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + La versión de la CLI de dotnet es "{0}". + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + La opción "--dry-run" está en desuso. Use la opción "--check" en su lugar. The file '{0}' does not appear to be a valid project or solution file. + El archivo "{0}" no parece ser un proyecto o archivo de solución válido. + + + The `--files` option is deprecated. Use the `--include` option instead. + + La opción "--files" está en desuso. Use la opción "--include" en su lugar. + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + La opción "--folder" está en desuso para especificar la ruta de acceso. Pase la opción "--folder", pero especifique la ruta de acceso con el argumento de proyecto en su lugar. The project file '{0}' does not exist. - El archivo de proyecto "{0}" no existe. + El archivo de proyecto "{0}" no existe. The solution file '{0}' does not exist. + El archivo de solución "{0}" no existe. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + El archivo de solución o el proyecto para operar. Si no se especifica un archivo, el comando buscará uno en el directorio actual. Formatted code file '{0}'. - Formatted code file '{0}'. + Archivo de código "{0}" con formato aplicado. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + La opción "--workspace" está en desuso. Use el argumento "<project>" en su lugar. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + No se encuentra MSBuild. Asegúrese de que el SDK de .NET se haya instalado con el instalador oficial. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + No se encuentra la CLI de dotnet. Asegúrese de que esté en la ruta de acceso (PATH). Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + No se pueden organizar las importaciones para "{0}". El documento es demasiado complejo. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + Se está usando el archivo MSBuild.exe ubicado en "{0}". Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + Se encontraron advertencias al cargar el área de trabajo. Establezca la opción de nivel de detalle en "diagnóstico" para registrar las advertencias. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + Indica si la ruta de acceso "<project>" debe tratarse como carpeta de archivos. Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + Escribiendo el informe de formato en "{0}". diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 96407b9ee9e4..1fffda836bb6 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + Liste des chemins relatifs de fichier ou de dossier à exclure de la mise en forme. A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Liste des chemins relatifs de fichier ou de dossier à inclure dans la mise en forme. Si non renseigné, tous les fichiers sont mis en forme. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + Accepte un chemin de fichier, qui, s'il est fourni, produit un rapport JSON dans le répertoire donné. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Un fichier projet et un fichier solution MSBuild ont été trouvés dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + Impossible de spécifier à la fois des options de dossier et d'espace de travail. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - Un fichier projet et un fichier solution MSBuild ont été trouvés dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + Cannot specify both project argument and folder options. + Impossible de spécifier à la fois un argument de projet et des options de dossier. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + Impossible de spécifier à la fois un argument de projet et une option d'espace de travail. Complete in {0}ms. - Complete in {0}ms. + Effectué en {0} ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - Fichier projet ou solution MSBuild introuvable dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Fichier projet ou solution MSBuild introuvable dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Impossible de mettre en forme '{0}'. L'opération Mettre en forme prend uniquement en charge les projets C# et Visual Basic pour le moment. - - - - Determining diagnostics... - Determining diagnostics... + Impossible de mettre en forme '{0}'. L'opération Mettre en forme prend uniquement en charge les projets C# et Visual Basic pour le moment. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + Identification des fichiers pouvant être mis en forme. Failed to save formatting changes. - L'enregistrement des changements de mise en forme a échoué. + L'enregistrement des changements de mise en forme a échoué. Fix end of line marker. - Fix end of line marker. + Corrigez le marqueur de fin de ligne. Fix file encoding. - Fix file encoding. + Corrigez l'encodage de fichier. Fix final newline. - Fix final newline. + Corrigez la nouvelle ligne de fin. Fix imports ordering. - Fix imports ordering. + Corrigez le classement des importations. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + Corrigez la mise en forme des espaces blancs. Format complete in {0}ms. - Format complete in {0}ms. + Mise en forme effectuée en {0} ms. + + + Format files, but do not save changes to disk. + + Mettez en forme les fichiers, mais n'enregistrez pas les changements sur le disque. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Met en forme les fichiers sans enregistrer les changements sur le disque. Se termine par un code de sortie non nul si des fichiers ont été mis en forme. Formatted {0} of {1} files. - Formatted {0} of {1} files. + {0} fichiers mis en forme sur {1}. Formatting code file '{0}'. - Mise en forme du fichier de code '{0}'. + Mise en forme du fichier de code '{0}'. Formatting code files in workspace '{0}'. - Mise en forme des fichiers de code dans l'espace de travail '{0}'. + Mise en forme des fichiers de code dans l'espace de travail '{0}'. Include generated code files in formatting operations. - Include generated code files in formatting operations. + Ajoutez des fichiers de code générés dans les opérations de mise en forme. Loading workspace. - Chargement de l'espace de travail. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Chargement de l'espace de travail. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Plusieurs fichiers projet MSBuild dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Plusieurs fichiers solution MSBuild dans '{0}'. Spécifiez ceux à utiliser avec l'option --workspace. Running formatters. - Running formatters. + Exécution des formateurs. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Définissez le niveau de détail. Les valeurs autorisées sont q[uiet], m[inimal], n[ormal], d[etailed] et diag[nostic] + Définissez le niveau de détail. Les valeurs autorisées sont q[uiet], m[inimal], n[ormal], d[etailed] et diag[nostic] Skipping referenced project '{0}'. - Saut du projet référencé '{0}'. - - - - Solution {0} has no projects - Solution {0} has no projects + Saut du projet référencé '{0}'. The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + La version de l'interface CLI dotnet est '{0}'. + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + L'option '--dry-run' est dépréciée. Utilisez l'option '--check' à la place. The file '{0}' does not appear to be a valid project or solution file. + Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. + + + The `--files` option is deprecated. Use the `--include` option instead. + + L'option '--files' est dépréciée. Utilisez l'option '--include' à la place. + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + L'option '--folder' est dépréciée pour spécifier le chemin. Passez l'option '--folder', mais spécifiez le chemin avec l'argument de projet à la place. The project file '{0}' does not exist. - Le fichier projet '{0}' n'existe pas. + Le fichier projet '{0}' n'existe pas. The solution file '{0}' does not exist. + Le fichier solution '{0}' n'existe pas. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Fichier solution ou projet à utiliser. Si un fichier n'est pas spécifié, la commande en recherche un dans le répertoire actuel. Formatted code file '{0}'. - Formatted code file '{0}'. + Fichier de code '{0}' mis en forme. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + L'option '--workspace' est dépréciée. Utilisez l'argument '<project>' à la place. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Impossible de localiser MSBuild. Vérifiez que le SDK .NET a été installé avec le programme d'installation officiel. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + Impossible de localiser l'interface CLI dotnet. Vérifiez qu'elle est dans le chemin. Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + Impossible d'organiser les importations pour '{0}'. Le document est trop complexe. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + Utilisation de MSBuild.exe dans '{0}'. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + Des avertissements ont été rencontrés pendant le chargement de l'espace de travail. Définissez l'option verbosity sur le niveau « diagnostic » pour journaliser les avertissements. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + Indique de traiter le chemin '<project>' comme un dossier de fichiers. Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + Écriture du rapport de mise en forme dans '{0}'. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 4cea5eaa8818..845eb3c0599f 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + Elenco di percorsi relativi di file o cartelle da escludere dalla formattazione. A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Elenco di percorsi relativi di file o cartelle da includere nella formattazione. Se è vuoto, tutti i file vengono formattati. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + Accetta un percorso file che, se specificato, produrrà un report JSON nella directory specificata. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + Non è possibile specificare entrambe le opzioni relative a cartella e area di lavoro. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + Cannot specify both project argument and folder options. + Non è possibile specificare sia l'argomento di progetto che le opzioni relative alla cartella. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + Non è possibile specificare sia l'argomento progetto che l'opzione relativa all'area di lavoro. Complete in {0}ms. - Complete in {0}ms. + Completata in {0} ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - In '{0}' non è stato possibile trovare alcun file di progetto o di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + In '{0}' non è stato possibile trovare alcun file di progetto o di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Non è stato possibile formattare '{0}'. Il formato supporta attualmente solo progetti C# e Visual Basic. - - - - Determining diagnostics... - Determining diagnostics... + Non è stato possibile formattare '{0}'. Il formato supporta attualmente solo progetti C# e Visual Basic. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + Determinazione dei file formattabili. Failed to save formatting changes. - Non è stato possibile salvare le modifiche di formattazione. + Non è stato possibile salvare le modifiche di formattazione. Fix end of line marker. - Fix end of line marker. + Correggere il marcatore di fine riga. Fix file encoding. - Fix file encoding. + Correggere la codifica dei file. Fix final newline. - Fix final newline. + Correggere il carattere di nuova riga finale. Fix imports ordering. - Fix imports ordering. + Correggere l'ordinamento delle importazioni. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + Correggere la formattazione degli spazi vuoti. Format complete in {0}ms. - Format complete in {0}ms. + La formattazione è stata completata in {0} ms. + + + Format files, but do not save changes to disk. + + Formatta i file, ma non salvare le modifiche sul disco. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formatta i file senza salvare le modifiche nel disco. Termina con un codice di uscita diverso da zero se sono stati formattati file. Formatted {0} of {1} files. - Formatted {0} of {1} files. + Sono stati formattati {0} di {1} file. Formatting code file '{0}'. - Formattazione del file di codice '{0}'. + Formattazione del file di codice '{0}'. Formatting code files in workspace '{0}'. - Formattazione del file di codice nell'area di lavoro '{0}'. + Formattazione del file di codice nell'area di lavoro '{0}'. Include generated code files in formatting operations. - Include generated code files in formatting operations. + Includere i file del codice generato nelle operazioni di formattazione. Loading workspace. - Caricamento dell'area di lavoro. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Caricamento dell'area di lavoro. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + In '{0}' sono stati trovati più file di progetto MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. Running formatters. - Running formatters. + Esecuzione dei formattatori. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Consente di impostare il livello di dettaglio. I valori consentiti sono q[uiet], m[inimal], n[ormal], d[etailed] e diag[nostic] + Consente di impostare il livello di dettaglio. I valori consentiti sono q[uiet], m[inimal], n[ormal], d[etailed] e diag[nostic] Skipping referenced project '{0}'. - Il progetto di riferimento '{0}' verrà ignorato. - - - - Solution {0} has no projects - Solution {0} has no projects + Il progetto di riferimento '{0}' verrà ignorato. The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + La versione dell'interfaccia della riga di comando di dotnet è '{0}'. + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + L'opzione `--dry-run` è deprecata. In alternativa, usare l'opzione `--check`. The file '{0}' does not appear to be a valid project or solution file. + Il file '{0}' non sembra essere un file di progetto o di soluzione valido. + + + The `--files` option is deprecated. Use the `--include` option instead. + + L'opzione `--files` è deprecata. In alternativa, usare l'opzione `--include`. + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + L'opzione `--folder` è deprecata per la specifica del percorso. Passare l'opzione `--folder`, ma specificare il percorso con l'argomento project. The project file '{0}' does not exist. - Il file di progetto '{0}' non esiste. + Il file di progetto '{0}' non esiste. The solution file '{0}' does not exist. + Il file di soluzione '{0}' non esiste. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + File di progetto o di soluzione su cui intervenire. Se non si specifica un file, il comando ne cercherà uno nella directory corrente. Formatted code file '{0}'. - Formatted code file '{0}'. + Il file di codice '{0}' è stato formattato. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + L'opzione `--workspace` è deprecata. In alternativa, usare l'argomento `<project>`. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Non è possibile individuare MSBuild. Assicurarsi che .NET SDK sia stato installato con il programma di installazione ufficiale. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + Non è possibile individuare l'interfaccia della riga di comando di dotnet. Assicurarsi che sia indicata in PATH. Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + Non è possibile organizzare le importazioni per '{0}'. Il documento è troppo complesso. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + Verrà usata la versione di MSBuild.exe disponibile in '{0}'. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + Sono stati rilevati avvisi durante il caricamento dell'area di lavoro. Impostare l'opzione del livello di dettaglio su 'diagnostic' per registrare gli avvisi. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + Indica se considerare il percorso di `<project>` come cartella di file. Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + Scrittura del report di formattazione in: '{0}'. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 5ee9c30208b1..e24ff7c4370b 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + 書式設定から除外するファイルまたはフォルダーの相対パスの一覧。 A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + 書式設定に含めるファイルまたはフォルダーの相対パスの一覧。空の場合、すべてのファイルが書式設定されます。 Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + ファイル パスを受け入れると (指定されている場合)、指定されたディレクトリに JSON レポートが生成されます。 - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + MSBuild プロジェクト ファイルとソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + フォルダーおよびワークスペースの両方のオプションを指定することはできません。 - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - MSBuild プロジェクト ファイルとソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 + + Cannot specify both project argument and folder options. + プロジェクト引数とフォルダー オプションの両方を指定することはできません。 - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + プロジェクト引数とワークスペース オプションの両方を指定することはできません。 Complete in {0}ms. - Complete in {0}ms. + {0} ミリ秒で完了します。 - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - '{0}' で MSBuild プロジェクト ファイルまたはソリューション ファイルが見つかりませんでした。使用するファイルを --workspace オプションで指定してください。 + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + '{0}' で MSBuild プロジェクト ファイルまたはソリューション ファイルが見つかりませんでした。使用するファイルを --workspace オプションで指定してください。 Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - '{0}' をフォーマットできませんでした。フォーマットは、C# および Visual Basic のプロジェクトでのみサポートされています。 - - - - Determining diagnostics... - Determining diagnostics... + '{0}' をフォーマットできませんでした。フォーマットは、C# および Visual Basic のプロジェクトでのみサポートされています。 Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + 書式設定可能なファイルを判定しています。 Failed to save formatting changes. - 書式変更を保存できませんでした。 + 書式変更を保存できませんでした。 Fix end of line marker. - Fix end of line marker. + 行末マーカーを修正します。 Fix file encoding. - Fix file encoding. + ファイルのエンコードを修正します。 Fix final newline. - Fix final newline. + 最後の改行を修正します。 Fix imports ordering. - Fix imports ordering. + インポートの順序を修正します。 Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + 空白の書式設定を修正します。 Format complete in {0}ms. - Format complete in {0}ms. + {0} ミリ秒で書式設定が完了します。 + + + Format files, but do not save changes to disk. + + ファイルを書式設定しますが、変更をディスクに保存しません。 Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + 変更をディスクに保存せずにファイルを書式設定します。いずれかのファイルが書式設定されている場合、0 以外の終了コードで終了します。 Formatted {0} of {1} files. - Formatted {0} of {1} files. + {1} 個中 {0} 個のファイルが書式設定されました。 Formatting code file '{0}'. - コード ファイル '{0}' をフォーマットしています。 + コード ファイル '{0}' をフォーマットしています。 Formatting code files in workspace '{0}'. - ワークスペース '{0}' でコード ファイルを書式設定します。 + ワークスペース '{0}' でコード ファイルを書式設定します。 Include generated code files in formatting operations. - Include generated code files in formatting operations. + 生成されたコード ファイルを書式設定操作に含めます。 Loading workspace. - ワークスペースを読み込んでいます。 - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + ワークスペースを読み込んでいます。 - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + 複数の MSBuild プロジェクト ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 Running formatters. - Running formatters. + フォーマッタを実行しています。 Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 詳細レベルを設定します。許可されている値: q[uiet]、m[inimal]、n[ormal]、d[etailed]、diag[nostic] + 詳細レベルを設定します。許可されている値: q[uiet]、m[inimal]、n[ormal]、d[etailed]、diag[nostic] Skipping referenced project '{0}'. - 参照プロジェクト '{0}' をスキップしています。 - - - - Solution {0} has no projects - Solution {0} has no projects + 参照プロジェクト '{0}' をスキップしています。 The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + dotnet CLI バージョンは '{0}' です。 + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + '--dry-run' オプションは非推奨です。代わりに '--check' オプションを使用してください。 The file '{0}' does not appear to be a valid project or solution file. + ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 + + + The `--files` option is deprecated. Use the `--include` option instead. + + '--files' オプションは非推奨です。代わりに '--include' オプションを使用してください。 + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + パスを指定するための '--folder' オプションは非推奨です。'--folder' オプションを渡しますが、パスは代わりにプロジェクト引数を使用して指定してください。 The project file '{0}' does not exist. - プロジェクト ファイル '{0}' が存在しません。 + プロジェクト ファイル '{0}' が存在しません。 The solution file '{0}' does not exist. + ソリューション ファイル '{0}' が存在しません。 + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 操作対象のソリューション ファイルまたはプロジェクト ファイル。ファイルを指定しない場合、コマンドは現在のディレクトリを検索します。 Formatted code file '{0}'. - Formatted code file '{0}'. + コード ファイル '{0}' が書式設定されました。 - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + '--workspace' オプションは非推奨です。代わりに '<project>' 引数を使用してください。 Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + MSBuild が見つかりません。.NET SDK が正式なインストーラーでインストールされたことを確認してください。 Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + dotnet CLI が見つかりません。PATH 上にあることを確認してください。 Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + '{0}' のインポートを整理できません。ドキュメントが複雑すぎます。 Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + '{0}' にある MSBuild.exe を使用しています。 Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + ワークスペースの読み込み中に警告が発生しました。詳細オプションを '診断' レベルに設定して、警告をログに記録してください。 - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + '<project>' パスをファイルのフォルダーとして扱うかどうかを指定します。 Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + 書式設定レポートを '{0}' に書き込んでいます。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index af6fa13c8fa4..14197361ada7 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + 서식 지정에서 제외할 상대 파일 또는 폴더 경로 목록입니다. A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + 서식 지정에 포함할 상대 파일 또는 폴더 경로 목록입니다. 비어 있으면 모든 파일의 서식이 지정됩니다. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + 제공된 경우 지정된 디렉터리에 json 보고서를 생성할 파일 경로를 허용합니다. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + 폴더 옵션과 작업 영역 옵션을 둘 다 지정할 수는 없습니다. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + Cannot specify both project argument and folder options. + 프로젝트 인수와 폴더 옵션을 둘 다 지정할 수는 없습니다. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + 프로젝트 인수와 작업 영역 옵션을 둘 다 지정할 수는 없습니다. Complete in {0}ms. - Complete in {0}ms. + {0}ms 후에 완료됩니다. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - '{0}'에서 MSBuild 프로젝트 파일 또는 솔루션 파일을 찾을 수 없습니다. --workspace 옵션에 사용할 파일을 지정하세요. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + '{0}'에서 MSBuild 프로젝트 파일 또는 솔루션 파일을 찾을 수 없습니다. --workspace 옵션에 사용할 파일을 지정하세요. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - '{0}'의 서식을 지정할 수 없습니다. 서식 지정은 현재 C# 및 Visual Basic 프로젝트만 지원합니다. - - - - Determining diagnostics... - Determining diagnostics... + '{0}'의 서식을 지정할 수 없습니다. 서식 지정은 현재 C# 및 Visual Basic 프로젝트만 지원합니다. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + 서식 지정 가능한 파일을 확인하는 중입니다. Failed to save formatting changes. - 서식 변경 내용을 저장하지 못했습니다. + 서식 변경 내용을 저장하지 못했습니다. Fix end of line marker. - Fix end of line marker. + 줄의 끝 마커를 수정하세요. Fix file encoding. - Fix file encoding. + 파일 인코딩을 수정하세요. Fix final newline. - Fix final newline. + 최종 줄 바꿈을 수정하세요. Fix imports ordering. - Fix imports ordering. + 가져오기 순서를 수정하세요. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + 공백 서식을 수정하세요. Format complete in {0}ms. - Format complete in {0}ms. + {0}ms 후 서식 지정이 완료됩니다. + + + Format files, but do not save changes to disk. + + 파일의 형식을 지정하지만 변경 내용을 디스크에 저장하지 않습니다. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + 디스크에 변경 내용을 저장하지 않고 파일의 서식을 지정합니다. 서식이 지정된 파일이 있는 경우 0이 아닌 종료 코드로 종료됩니다. Formatted {0} of {1} files. - Formatted {0} of {1} files. + {1}개 중 {0}개 파일의 서식을 지정했습니다. Formatting code file '{0}'. - 코드 파일 '{0}'의 서식을 지정합니다. + 코드 파일 '{0}'의 서식을 지정합니다. Formatting code files in workspace '{0}'. - '{0}' 작업 영역에서 코드 파일의 서식을 지정합니다. + '{0}' 작업 영역에서 코드 파일의 서식을 지정합니다. Include generated code files in formatting operations. - Include generated code files in formatting operations. + 서식 지정 작업에서 생성된 코드 파일을 포함합니다. Loading workspace. - 작업 영역을 로드하는 중입니다. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + 작업 영역을 로드하는 중입니다. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + '{0}'에서 여러 MSBuild 프로젝트 파일을 찾았습니다. --workspace 옵션에 사용할 파일을 지정하세요. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. Running formatters. - Running formatters. + 포맷터를 실행하는 중입니다. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 세부 정보 표시 수준을 설정합니다. 허용되는 값은 q[uiet], m[inimal], n[ormal], d[etailed] 및 diag[nostic]입니다. + 세부 정보 표시 수준을 설정합니다. 허용되는 값은 q[uiet], m[inimal], n[ormal], d[etailed] 및 diag[nostic]입니다. Skipping referenced project '{0}'. - 참조된 프로젝트 '{0}'을(를) 건너뜁니다. - - - - Solution {0} has no projects - Solution {0} has no projects + 참조된 프로젝트 '{0}'을(를) 건너뜁니다. The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + dotnet CLI 버전은 '{0}'입니다. + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + `--dry-run` 옵션은 사용되지 않습니다. 대신 `--dry-run` 옵션을 사용하세요. The file '{0}' does not appear to be a valid project or solution file. + '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. + + + The `--files` option is deprecated. Use the `--include` option instead. + + `--files` 옵션은 사용되지 않습니다. 대신 `--include` 옵션을 사용하세요. + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + `--folder` 옵션은 경로를 지정하는 데 사용되지 않습니다. `--folder` 옵션을 전달하되, 대신 프로젝트 인수를 사용하여 경로를 지정하세요. The project file '{0}' does not exist. - 프로젝트 파일 '{0}'이(가) 없습니다. + 프로젝트 파일 '{0}'이(가) 없습니다. The solution file '{0}' does not exist. + 솔루션 파일 '{0}'이(가) 없습니다. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 수행할 솔루션 또는 프로젝트 파일입니다. 파일을 지정하지 않으면 명령이 현재 디렉터리에서 파일을 검색합니다. Formatted code file '{0}'. - Formatted code file '{0}'. + 코드 파일 '{0}'의 서식을 지정했습니다. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + `--workspace` 옵션은 사용되지 않습니다. 대신 `<project>` 인수를 사용하세요. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + MSBuild를 찾을 수 없습니다. 공식 설치 관리자를 사용하여 .NET SDK를 설치했는지 확인하세요. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + dotnet CLI를 찾을 수 없습니다. PATH에 있는지 확인하세요. Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + '{0}'에 대한 가져오기를 구성할 수 없습니다. 문서가 너무 복잡합니다. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + '{0}'에 있는 MSBuild.exe를 사용합니다. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + 작업 영역을 로드하는 동안 경고가 발생했습니다. 경고를 기록하려면 세부 정보 표시 옵션을 '진단' 수준으로 설정하세요. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + `<project>` 경로를 파일 폴더로 처리할지 여부입니다. Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + 서식 지정 보고서를 '{0}'에 쓰는 중입니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 72edec1e7800..3a316070fb2e 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + Lista względnych ścieżek plików lub folderów, które mają zostać wykluczone z formatowania. A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Lista względnych ścieżek plików lub folderów do uwzględnienia w formatowaniu. Wszystkie pliki są formatowane, jeśli wartość jest pusta. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + Akceptuje ścieżkę pliku, która, jeśli zostanie podana, wygeneruje raport JSON w danym katalogu. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą opcji --workspace. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + Nie można określić zarówno opcji obszaru roboczego, jak i folderu. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą opcji --workspace. + + Cannot specify both project argument and folder options. + Nie można określić zarówno opcji folderu, jak i argumentu projektu. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + Nie można określić zarówno opcji obszaru roboczego, jak i argumentu projektu. Complete in {0}ms. - Complete in {0}ms. + Wykonaj w {0} ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - Nie można znaleźć pliku rozwiązania lub projektu MSBuild w elemencie „{0}”. Określ plik do użycia za pomocą opcji --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Nie można znaleźć pliku rozwiązania lub projektu MSBuild w elemencie „{0}”. Określ plik do użycia za pomocą opcji --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Nie można sformatować elementu „{0}”. Obecnie format obsługuje tylko projekty C# i Visual Basic. - - - - Determining diagnostics... - Determining diagnostics... + Nie można sformatować elementu „{0}”. Obecnie format obsługuje tylko projekty C# i Visual Basic. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + Określanie plików, które można formatować. Failed to save formatting changes. - Nie można zapisać zmian formatowania. + Nie można zapisać zmian formatowania. Fix end of line marker. - Fix end of line marker. + Napraw znacznik końca wiersza. Fix file encoding. - Fix file encoding. + Napraw kodowanie pliku. Fix final newline. - Fix final newline. + Napraw końcowy nowy wiersz. Fix imports ordering. - Fix imports ordering. + Napraw kolejność importowania. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + Napraw formatowanie odstępów. Format complete in {0}ms. - Format complete in {0}ms. + Formatowanie zakończono w {0} ms. + + + Format files, but do not save changes to disk. + + Formatuj pliki, ale nie zapisuj zmian na dysku. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formatuje pliki bez zapisywania zmian na dysku. Kończy się niezerowym kodem zakończenia, jeśli zostały sformatowane jakiekolwiek pliki. Formatted {0} of {1} files. - Formatted {0} of {1} files. + Sformatowano {0} z {1} plików. Formatting code file '{0}'. - Formatowanie pliku kodu „{0}”. + Formatowanie pliku kodu „{0}”. Formatting code files in workspace '{0}'. - Formatowanie plików kodu w obszarze roboczym „{0}”. + Formatowanie plików kodu w obszarze roboczym „{0}”. Include generated code files in formatting operations. - Include generated code files in formatting operations. + Uwzględnij wygenerowane pliki kodu w operacjach formatowania. Loading workspace. - Ładowanie obszaru roboczego. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Ładowanie obszaru roboczego. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + W elemencie „{0}” znaleziono wiele plików projektów MSBuild. Określ, którego użyć, za pomocą opcji --workspace. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą opcji --workspace. Running formatters. - Running formatters. + Uruchamianie elementów formatujących. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Ustaw poziom szczegółowości. Dozwolone wartości to q[uiet] (cicha), m[inimal] (minimalna), n[ormal] (normalna), d[etailed] (szczegółowa) i diag[nostic] (diagnostyczna) + Ustaw poziom szczegółowości. Dozwolone wartości to q[uiet] (cicha), m[inimal] (minimalna), n[ormal] (normalna), d[etailed] (szczegółowa) i diag[nostic] (diagnostyczna) Skipping referenced project '{0}'. - Pomijanie przywoływanego projektu „{0}”. - - - - Solution {0} has no projects - Solution {0} has no projects + Pomijanie przywoływanego projektu „{0}”. The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + Wersja interfejsu wiersza polecenia dotnet to „{0}”. + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + Opcja „--dry-run” jest przestarzała. Zamiast tego użyj opcji „--check”. The file '{0}' does not appear to be a valid project or solution file. + Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. + + + The `--files` option is deprecated. Use the `--include` option instead. + + Opcja „--files” jest przestarzała. Zamiast tego użyj opcji „--include”. + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + Opcja „--folder” jest przestarzała na potrzeby określania ścieżki. Przekaż opcję „--folder”, ale zamiast tego określ ścieżkę przy użyciu argumentu projektu. The project file '{0}' does not exist. - Plik projektu „{0}” nie istnieje. + Plik projektu „{0}” nie istnieje. The solution file '{0}' does not exist. + Plik rozwiązania „{0}” nie istnieje. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Plik rozwiązania lub projektu, względem którego operacja ma być wykonana. Jeśli plik nie zostanie określony, polecenie wyszuka go w bieżącym katalogu. Formatted code file '{0}'. - Formatted code file '{0}'. + Sformatowano plik kodu „{0}”. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + Opcja „--workspace” jest przestarzała. Zamiast tego użyj argumentu „<project>”. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Nie można zlokalizować programu MSBuild. Upewnij się, że zestaw .NET SDK został zainstalowany przy użyciu oficjalnego instalatora. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + Nie można zlokalizować wiersza polecenia dotnet. Upewnij się, że znajduje się on w ścieżce. Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + Nie można zorganizować importów dla elementu „{0}”. Dokument jest zbyt złożony. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + Używanie pliku MSBuild.exe znajdującego się w lokalizacji „{0}”. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + Podczas ładowania obszaru roboczego napotkano ostrzeżenia. Ustaw opcję poziomu szczegółowości na wartość „diagnostyka”, aby rejestrować ostrzeżenia. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + Określa, czy traktować ścieżkę „<project>” jako folder plików Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + Zapisywanie raportu formatowania w: „{0}”... diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 36fe15137fa0..a1b50cb0c31f 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + Uma lista de caminhos de arquivo ou pasta relativos para excluir da formatação. A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Uma lista de caminhos de arquivo ou pasta relativos para incluir na formatação. Todos os arquivos serão formatados se estiverem vazios. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + Aceita um caminho de arquivo, que, se fornecido, produzirá um relatório JSON no diretório especificado. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Foram encontrados um arquivo de solução e um arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + Não é possível especificar as opções pasta e workspace. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - Foram encontrados um arquivo de solução e um arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + Cannot specify both project argument and folder options. + Não é possível especificar as opções de argumento e de pasta do projeto. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + Não é possível especificar o argumento do projeto e a opção workspace. Complete in {0}ms. - Complete in {0}ms. + Concluir em {0} ms. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - Não foi possível encontrar um arquivo de solução ou arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Não foi possível encontrar um arquivo de solução ou arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Não foi possível formatar '{0}'. O formato atualmente suporta apenas projetos do Visual Basic e C#. - - - - Determining diagnostics... - Determining diagnostics... + Não foi possível formatar '{0}'. O formato atualmente suporta apenas projetos do Visual Basic e C#. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + Determinando arquivos formatáveis. Failed to save formatting changes. - Falha ao salvar alterações de formatação. + Falha ao salvar alterações de formatação. Fix end of line marker. - Fix end of line marker. + Corrigir o final do marcador de linha. Fix file encoding. - Fix file encoding. + Corrigir a codificação de arquivo. Fix final newline. - Fix final newline. + Corrigir a nova linha final. Fix imports ordering. - Fix imports ordering. + Corrigir a ordenação de importações. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + Corrigir a formatação de espaço em branco. Format complete in {0}ms. - Format complete in {0}ms. + Formatação concluída em {0} ms. + + + Format files, but do not save changes to disk. + + Arquivos de formato, mas não salva as alterações para o disco. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Formata arquivos sem salvar as alterações no disco. Termina com um código de saída diferente de zero se algum arquivo foi formatado. Formatted {0} of {1} files. - Formatted {0} of {1} files. + {0} de {1} arquivos formatados. Formatting code file '{0}'. - Arquivo de código de formatação '{0}'. + Arquivo de código de formatação '{0}'. Formatting code files in workspace '{0}'. - Formatação de arquivos de código no espaço de trabalho '{0}'. + Formatação de arquivos de código no espaço de trabalho '{0}'. Include generated code files in formatting operations. - Include generated code files in formatting operations. + Incluir arquivos de código gerados em operações de formatação. Loading workspace. - Carregando espaço de trabalho. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Carregando espaço de trabalho. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Foram encontrados vários arquivos do projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Foram encontrados vários arquivos de solução MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. Running formatters. - Running formatters. + Executando formatadores. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Defina o nível de detalhes. Os valores permitidos são q[uiet], m[inimal], n[ormal], d[etailed], e diag[nostic] + Defina o nível de detalhes. Os valores permitidos são q[uiet], m[inimal], n[ormal], d[etailed], e diag[nostic] Skipping referenced project '{0}'. - Ignorando o projeto referenciado '{0}'. - - - - Solution {0} has no projects - Solution {0} has no projects + Ignorando o projeto referenciado '{0}'. The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + A versão do CLI do dotnet é '{0}'. + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + A opção `--dry-run` foi preterida. Use a opção `--check` em vez disso. The file '{0}' does not appear to be a valid project or solution file. + O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. + + + The `--files` option is deprecated. Use the `--include` option instead. + + A opção `--files` foi preterida. Use a opção `--include` em vez disso. + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + A opção `--folder` foi preterida para especificar o caminho. Passe a opção `--folder`, mas especifique o caminho com o argumento do projeto. The project file '{0}' does not exist. - O arquivo de projeto '{0}' não existe. + O arquivo de projeto '{0}' não existe. The solution file '{0}' does not exist. + O arquivo de solução '{0}' não existe. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + O arquivo de projeto ou solução para operar. Se um arquivo não for especificado, o comando pesquisará o diretório atual para um. Formatted code file '{0}'. - Formatted code file '{0}'. + Arquivo de código '{0}' formatado. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + A opção `--workspace` foi preterida. Em vez disso, use o argumento `<project>`. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Não é possível localizar o MSBuild. Verifique se o SDK do .NET foi instalado com o instalador oficial. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + Não é possível localizar a CLI do dotnet. Verifique se está no CAMINHO. Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + Não é possível organizar importações para '{0}'. O documento é muito complexo. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + Usando MSBuild.exe localizado em '{0}'. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + Foram encontrados avisos ao carregar o workspace. Defina a opção de detalhamento para o nível de 'diagnóstico' para registrar avisos. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + Se o caminho `<project>` será tratado como uma pasta de arquivos. Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + Gravando relatório de formatação em '{0}'. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 4b50b46f4819..2c96718b7ea5 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + Список относительных путей к файлам и папкам, исключаемым из форматирования. A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Список относительных путей к файлам и папкам, включаемым в форматирование. Если список пуст, форматируются все файлы. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + Принимает путь к файлу. Если путь к файлу указан, создает отчет JSON в указанном каталоге. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью параметра --workspace. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + Невозможно одновременно указать параметры папки и рабочей области. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью параметра --workspace. + + Cannot specify both project argument and folder options. + Невозможно одновременно указать аргумент проекта и параметры папки. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + Невозможно одновременно указать аргумент проекта и параметр рабочей области. Complete in {0}ms. - Complete in {0}ms. + Завершено. Время выполнения: {0} мс. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - Не удалось найти файл проекта или решения MSBuild в "{0}". Укажите используемый файл с параметром --workspace. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Не удалось найти файл проекта или решения MSBuild в "{0}". Укажите используемый файл с параметром --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Не удалось отформатировать "{0}". Форматирование сейчас поддерживается только для проектов C# и Visual Basic. - - - - Determining diagnostics... - Determining diagnostics... + Не удалось отформатировать "{0}". Форматирование сейчас поддерживается только для проектов C# и Visual Basic. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + Определение форматируемых файлов. Failed to save formatting changes. - Не удалось сохранить изменения форматирования. + Не удалось сохранить изменения форматирования. Fix end of line marker. - Fix end of line marker. + Исправить маркер конца строки. Fix file encoding. - Fix file encoding. + Исправить кодировку файла. Fix final newline. - Fix final newline. + Исправить завершающий символ новой строки. Fix imports ordering. - Fix imports ordering. + Исправить порядок импорта. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + Исправить форматирование пробелов. Format complete in {0}ms. - Format complete in {0}ms. + Форматирование завершено. Время выполнения: {0} мс. + + + Format files, but do not save changes to disk. + + Форматировать файлы без сохранения изменений на диск. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Форматирует файлы без сохранения изменений на диск. Завершается с ненулевым кодом завершения, если были отформатированы какие-либо файлы. Formatted {0} of {1} files. - Formatted {0} of {1} files. + Отформатировано файлов: {0} из {1}. Formatting code file '{0}'. - Форматирование файла кода "{0}". + Форматирование файла кода "{0}". Formatting code files in workspace '{0}'. - Форматирование кода файлов в рабочей области "{0}". + Форматирование кода файлов в рабочей области "{0}". Include generated code files in formatting operations. - Include generated code files in formatting operations. + Включить созданные файлы кода в операции форматирования. Loading workspace. - Загрузка рабочей области. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Загрузка рабочей области. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + В "{0}" обнаружено несколько файлов проектов MSBuild. Укажите используемый файл с помощью параметра --workspace. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + В "{0}" обнаружено несколько файлов решений MSBuild. Укажите используемый файл с параметром --workspace. Running formatters. - Running formatters. + Запуск средств форматирования. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Задает уровень детализации. Допустимые значения: q (без вывода подробных сведений), m (минимальный), n (нормальный), d (подробный) и diag (диагностика) + Задает уровень детализации. Допустимые значения: q (без вывода подробных сведений), m (минимальный), n (нормальный), d (подробный) и diag (диагностика) Skipping referenced project '{0}'. - Пропуск указанного проекта "{0}". - - - - Solution {0} has no projects - Solution {0} has no projects + Пропуск указанного проекта "{0}". The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + Версия CLI dotnet: "{0}". + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + Параметр "--dry-run" устарел. Используйте вместо него параметр "--check". The file '{0}' does not appear to be a valid project or solution file. + Файл "{0}" не является допустимым файлом проекта или решения. + + + The `--files` option is deprecated. Use the `--include` option instead. + + Параметр "--files" устарел. Используйте вместо него параметр "--include". + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + Параметр "--folder" не рекомендуется использовать для указания пути. Передайте параметр "--folder", но укажите путь не в этом параметре, а в аргументе проекта. The project file '{0}' does not exist. - Файл проекта "{0}" не существует. + Файл проекта "{0}" не существует. The solution file '{0}' does not exist. + Файл решения "{0}" не существует. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Файл решения или проекта. Если файл не указан, команда будет искать этот файл в текущем каталоге. Formatted code file '{0}'. - Formatted code file '{0}'. + Отформатированный файл кода "{0}". - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + Параметр "--workspace" устарел. Используйте вместо него аргумент "<project>". Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + Не удается найти MSBuild. Убедитесь, что пакет SDK для .NET был установлен с официальным установщиком. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + Не удалось найти CLI dotnet. Убедитесь, что путь к нему добавлен в переменную среды PATH. Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + Не удается организовать импорты для "{0}". Слишком сложный документ. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + Используется файл MSBuild.exe, расположенный в каталоге "{0}". Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + При загрузке рабочей области были обнаружены предупреждения. Задайте для параметра уровня детализации значение "Диагностика", чтобы вести журнал предупреждений. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + Следует ли обрабатывать путь "<project>" как папку с файлами. Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + Запись отчета о форматировании в "{0}". diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index b736f28bd331..cb77a466464e 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + Biçimlendirmeden hariç tutulacak göreli dosya veya klasör yollarının listesi. A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Biçimlendirmeye dahil edilecek göreli dosya veya klasör yollarının listesi. Boşsa, tüm dosyalar biçimlendirilir. Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + Sağlanırsa, verilen dizinde json raporu oluşturacak bir dosya yolunu kabul eder. - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + Hem bir MSBuild proje dosyası ve çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + Hem klasör hem de çalışma alanı seçenekleri belirtilemez. - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - Hem bir MSBuild proje dosyası ve çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + Cannot specify both project argument and folder options. + Hem proje bağımsız değişkeni hem de klasör seçenekleri belirtilemez. - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + Hem proje bağımsız değişkeni hem de çalışma alanı seçeneği belirtilemez. Complete in {0}ms. - Complete in {0}ms. + {0} ms içinde tamamlayın. - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - Bir MSBuild proje dosyası veya çözüm dosyası '{0}' içinde bulunamadı. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + Bir MSBuild proje dosyası veya çözüm dosyası '{0}' içinde bulunamadı. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - '{0}' biçiminde değil. Biçimi şu anda yalnızca C# ve Visual Basic projeleri desteklemektedir. - - - - Determining diagnostics... - Determining diagnostics... + '{0}' biçiminde değil. Biçimi şu anda yalnızca C# ve Visual Basic projeleri desteklemektedir. Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + Biçimlendirilebilir dosyalar belirleniyor. Failed to save formatting changes. - Biçimlendirme değişiklikleri kaydedilemedi. + Biçimlendirme değişiklikleri kaydedilemedi. Fix end of line marker. - Fix end of line marker. + Satır sonu işaretçisini düzeltin. Fix file encoding. - Fix file encoding. + Dosya kodlamasını düzeltin. Fix final newline. - Fix final newline. + Son yeni satırı düzeltin. Fix imports ordering. - Fix imports ordering. + İçeri aktarma sıralamasını düzeltin. Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + Boşluk biçimlendirmesini düzeltin. Format complete in {0}ms. - Format complete in {0}ms. + Biçimlendirme {0} ms içinde tamamlandı. + + + Format files, but do not save changes to disk. + + Dosyaları biçimlendir, ancak değişiklikleri diske kaydetme. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + Değişiklikleri diske kaydetmeden dosyaları biçimlendirir. Herhangi bir dosya biçimlendirildiyse sıfır olmayan bir çıkış koduyla sonlandırılır. Formatted {0} of {1} files. - Formatted {0} of {1} files. + {1} dosya içinden {0} dosya biçimlendirildi. Formatting code file '{0}'. - Biçimlendirme kod dosyası '{0}'. + Biçimlendirme kod dosyası '{0}'. Formatting code files in workspace '{0}'. - Çalışma alanı '{0}' kod dosyalarında biçimlendirme. + Çalışma alanı '{0}' kod dosyalarında biçimlendirme. Include generated code files in formatting operations. - Include generated code files in formatting operations. + Biçimlendirme işlemlerinde oluşturulan kod dosyalarını ekleyin. Loading workspace. - Çalışma alanı yükleniyor. - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Çalışma alanı yükleniyor. - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + Birden fazla MSBuild proje dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + Birden fazla MSBuild çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. Running formatters. - Running formatters. + Biçimlendiriciler çalıştırılıyor. Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Ayrıntı düzeyini ayarlayın. İzin verilen değerler şunlardır: q [uiet], [inimal] m, n [nizamî], d [ayrıntılı] ve diag [nostic] + Ayrıntı düzeyini ayarlayın. İzin verilen değerler şunlardır: q [uiet], [inimal] m, n [nizamî], d [ayrıntılı] ve diag [nostic] Skipping referenced project '{0}'. - Atlama projesi '{0}' başvuru. - - - - Solution {0} has no projects - Solution {0} has no projects + Atlama projesi '{0}' başvuru. The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + dotnet CLI sürümü: '{0}'. + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + `--dry-run` seçeneği kullanım dışı bırakıldı. Bunun yerine `--check` seçeneğini kullanın. The file '{0}' does not appear to be a valid project or solution file. + '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. + + + The `--files` option is deprecated. Use the `--include` option instead. + + `--files` seçeneği kullanım dışı bırakıldı. Bunun yerine `--include` seçeneğini kullanın. + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + Yolu belirtmek için `--folder` seçeneği kullanım dışı bırakıldı. `--folder` seçeneğini geçirin ancak bunun yerine yolu, proje bağımsız değişkeniyle belirtin. The project file '{0}' does not exist. - Proje dosyası '{0}' yok. + Proje dosyası '{0}' yok. The solution file '{0}' does not exist. + Çözüm dosyası '{0}' yok. + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + Ameliyat için çözüm ya da proje dosyasını. Bir dosya belirtilmezse, komut için bir geçerli dizini arar. Formatted code file '{0}'. - Formatted code file '{0}'. + '{0}' kod dosyası biçimlendirildi. - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + `--workspace` seçeneği kullanım dışı bırakıldı. Bunun yerine `<project>` bağımsız değişkenini kullanın. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + MSBuild bulunamıyor. .NET SDK'nın resmi yükleyici kullanılarak yüklendiğinden emin olun. Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + dotnet CLI bulunamıyor. dotnet CLI'nin PATH üzerinde olduğundan emin olun. Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + '{0}' için içeri aktarmalar düzenlenemiyor. Belge çok karmaşık. Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + '{0}' içinde bulunan MSBuild.exe kullanılıyor. Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + Çalışma alanı yüklenirken uyarılarla karşılaşıldı. Uyarıları günlüğe kaydetmek için ayrıntı düzeyi seçeneğini 'tanılama' düzeyine ayarlayın. - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + `<project>` yolunun dosya klasörü olarak değerlendirilip değerlendirilmeyeceğini belirtir. Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + Biçimlendirme raporu '{0}' konumuna yazılıyor. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 9363b6f9fb03..f33f72f0183c 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + 不进行格式化的相对文件或文件夹路径的列表。 A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + 要进行格式化的相对文件或文件夹路径的列表。如果为空,则格式化所有文件。 Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + 接受文件路径(若提供)将在给定目录中生成 json 报表。 - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要将哪一个文件用于 --workspace 选项。 - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + 不能同时指定文件夹和工作区选项。 - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要将哪一个文件用于 --workspace 选项。 + + Cannot specify both project argument and folder options. + 不能同时指定项目参数和文件夹选项。 - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + 不能同时指定项目参数和工作区选项。 Complete in {0}ms. - Complete in {0}ms. + 在 {0} 毫秒后完成。 - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - 无法在“{0}”中找到 MSBuild 项目文件或解决方案文件。请指定要用于 --workspace 选项的文件。 + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + 无法在“{0}”中找到 MSBuild 项目文件或解决方案文件。请指定要用于 --workspace 选项的文件。 Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - 无法设置“{0}”的格式。该格式当前仅支持 C# 和 Visual Basic 项目。 - - - - Determining diagnostics... - Determining diagnostics... + 无法设置“{0}”的格式。该格式当前仅支持 C# 和 Visual Basic 项目。 Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + 正在确定可格式化的文件。 Failed to save formatting changes. - 未能保存格式更改。 + 未能保存格式更改。 Fix end of line marker. - Fix end of line marker. + 修复行尾标记。 Fix file encoding. - Fix file encoding. + 修复文件编码。 Fix final newline. - Fix final newline. + 修复最后一个换行符。 Fix imports ordering. - Fix imports ordering. + 修复导入顺序。 Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + 修复空格格式。 Format complete in {0}ms. - Format complete in {0}ms. + 将在 {0} 毫秒后完成格式化。 + + + Format files, but do not save changes to disk. + + 格式化文件, 但不将更改保存到磁盘。 Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + 将文件格式化且不将所作更改保存到磁盘中。如果有文件进行了格式化处理,则以非零退出代码终止。 Formatted {0} of {1} files. - Formatted {0} of {1} files. + 已将 {0} 个文件格式化(共 {1} 个)。 Formatting code file '{0}'. - 正在设置代码文件“{0}”的格式。 + 正在设置代码文件“{0}”的格式。 Formatting code files in workspace '{0}'. - 正在设置工作区“{0}”中代码文件的格式。 + 正在设置工作区“{0}”中代码文件的格式。 Include generated code files in formatting operations. - Include generated code files in formatting operations. + 在格式化操作中包含所生成的代码文件。 Loading workspace. - 正在加载工作区。 - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + 正在加载工作区。 - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + 在“{0}”中找到多个 MSBuild 项目文件。请指定要将哪一个文件用于 --workspace 选项。 - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 --workspace 选项的文件。 Running formatters. - Running formatters. + 正在运行格式化程序。 Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 设置详细级别。允许的值为 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] + 设置详细级别。允许的值为 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] Skipping referenced project '{0}'. - 正在跳过引用的项目“{0}”。 - - - - Solution {0} has no projects - Solution {0} has no projects + 正在跳过引用的项目“{0}”。 The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + dotnet CLI 版本为“{0}”。 + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + "--dry-run" 选项已被弃用。请改用 "--check" 选项。 The file '{0}' does not appear to be a valid project or solution file. + 文件“{0}”似乎不是有效的项目或解决方案文件。 + + + The `--files` option is deprecated. Use the `--include` option instead. + + "--files" 选项已被弃用。请改用 "--include" 选项。 + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + "--folder" 选项已被弃用,无法用于指定路径。请传递 "--folder" 选项,但改为使用项目参数指定路径。 The project file '{0}' does not exist. - 项目文件“{0}” 不存在。 + 项目文件“{0}” 不存在。 The solution file '{0}' does not exist. + 解决方案文件“{0}”不存在。 + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 要操作的解决方案或项目文件。如果未指定文件,该命令将在当前目录中搜索一个文件。 Formatted code file '{0}'. - Formatted code file '{0}'. + 已将代码文件“{0}”格式化。 - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + "--workspace" 选项已被弃用。请改用 "<project>" 参数。 Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + 无法找到 MSBuild。请确保 .NET SDK 是与官方安装程序一起安装的。 Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + 找不到 dotnet CLI。请确保它在路径上。 Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + 无法整理“{0}”的导入项。文档太复杂。 Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + 使用“{0}”中的 MSBuild.exe。 Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + 加载工作区时遇到警告。要记录警告,请将“详细级别”选项设置为“诊断”级别。 - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + 是否将 "<project>" 路径视为文件文件夹。 Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + 正在将格式报表写入:“{0}”。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index becbf45db23c..d06cfb80e934 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -1,251 +1,241 @@  - + A list of relative file or folder paths to exclude from formatting. - A list of relative file or folder paths to exclude from formatting. + 要從格式化作業中排除的檔案或資料夾相對路徑清單。 A list of relative file or folder paths to include in formatting. All files are formatted if empty. - A list of relative file or folder paths to include in formatting. All files are formatted if empty. - - - - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + 要包含在格式化作業中的檔案或資料夾相對路徑清單。若保留空白,則會將所有檔案格式化。 Accepts a file path, which if provided, will produce a json report in the given directory. - Accepts a file path, which if provided, will produce a json report in the given directory. + 接受檔案路徑 (如果有提供) 將在指定的目錄中產生 json 報告。 - - Analysis complete in {0}ms. - Analysis complete in {0}ms. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中同時找到 MSBuild 專案檔和解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 - - Analyzer Reference - Analyzer Reference + + Cannot specify both folder and workspace options. + 無法同時指定資料夾和工作區選項。 - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. - 在 '{0}' 中同時找到 MSBuild 專案檔和解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + Cannot specify both project argument and folder options. + 無法同時指定專案引數和資料夾選項。 - - Code Style - Code Style + + Cannot specify both project argument and workspace option. + 無法同時指定專案引數和工作區選項。 Complete in {0}ms. - Complete in {0}ms. + {0} 毫秒後完成。 - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. - 在 '{0}' 中找不到 MSBuild 專案檔或解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中找不到 MSBuild 專案檔或解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - 無法將 '{0}' 格式化。格式化目前只支援 C# 和 Visual Basic 專案。 - - - - Determining diagnostics... - Determining diagnostics... + 無法將 '{0}' 格式化。格式化目前只支援 C# 和 Visual Basic 專案。 Determining formattable files. - Determining formattable files. - - - - Failed to apply code fix {0} for {1}: {2} - Failed to apply code fix {0} for {1}: {2} + 正在判斷可格式化的檔案。 Failed to save formatting changes. - 無法儲存格式化變更。 + 無法儲存格式化變更。 Fix end of line marker. - Fix end of line marker. + 修正行結尾標記。 Fix file encoding. - Fix file encoding. + 修正檔案編碼。 Fix final newline. - Fix final newline. + 修正結尾換行。 Fix imports ordering. - Fix imports ordering. + 修正匯入排序。 Fix whitespace formatting. - Fix whitespace formatting. - - - - Fixing diagnostics... - Fixing diagnostics... + 修正空白字元格式化。 Format complete in {0}ms. - Format complete in {0}ms. + 格式化作業於 {0} 毫秒後完成。 + + + Format files, but do not save changes to disk. + + 將檔案格式化,但不儲存變更到磁碟。 Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. + 將檔案格式化,但不將變更儲存到磁碟。如果有任何檔案已格式化,則作業會終止,並產生非零的結束代碼。 Formatted {0} of {1} files. - Formatted {0} of {1} files. + 已將 {0}/{1} 個檔案格式化。 Formatting code file '{0}'. - 正在將程式碼檔案 '{0}' 格式化。 + 正在將程式碼檔案 '{0}' 格式化。 Formatting code files in workspace '{0}'. - 正在將工作區 '{0}' 中的程式碼檔案格式化。 + 正在將工作區 '{0}' 中的程式碼檔案格式化。 Include generated code files in formatting operations. - Include generated code files in formatting operations. + 在格式化作業中包含產生的程式碼檔案。 Loading workspace. - 正在載入工作區。 - - - - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. - - - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. - Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + 正在載入工作區。 - - Run code style analyzers and apply fixes. - Run code style analyzers and apply fixes. + + Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中找到多個 MSBuild 專案檔。請指定要搭配 --workspace 選項使用的檔案。 - - Running {0} analysis. - Running {0} analysis. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 Running formatters. - Running formatters. + 正在執行格式器。 Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 設定詳細資訊層級。允許的值為 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] + 設定詳細資訊層級。允許的值為 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] Skipping referenced project '{0}'. - 跳過參考的專案 '{0}’。 - - - - Solution {0} has no projects - Solution {0} has no projects + 跳過參考的專案 '{0}’。 The dotnet CLI version is '{0}'. - The dotnet CLI version is '{0}'. + dotnet CLI 版本為 '{0}'。 + + + The `--dry-run` option is deprecated. Use the `--check` option instead. + + `--dry-run` 選項已淘汰。請改用 `--check` 選項。 The file '{0}' does not appear to be a valid project or solution file. + 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 + + + The `--files` option is deprecated. Use the `--include` option instead. + + `--files` 選項已淘汰。請改用 `--include` 選項。 + + + The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. + 已淘汰使用 `--folder` 選項指定路徑的做法。請傳遞 `--folder` 選項,但改用專案引數指定路徑。 The project file '{0}' does not exist. - 專案檔 '{0}' 不存在。 + 專案檔 '{0}' 不存在。 The solution file '{0}' does not exist. + 解決方案檔 '{0}' 不存在。 + + + The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. + 要操作的解決方案或專案檔。若未指定檔案,該命令會在目前的目錄中搜尋一個檔案。 Formatted code file '{0}'. - Formatted code file '{0}'. + 正在將程式碼檔案 '{0}' 格式化。 - - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. - Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + + The `--workspace` option is deprecated. Use the `<project>` argument instead. + `--workspace` 選項已淘汰。請改用 `<project>` 引數。 Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. + 找不到 MSBuild。請確認已使用正式安裝程式安裝了 .NET SDK。 Unable to locate dotnet CLI. Ensure that it is on the PATH. - Unable to locate dotnet CLI. Ensure that it is on the PATH. + 找不到 dotnet CLI。請確認其位於 PATH 上。 Unable to organize imports for '{0}'. The document is too complex. - Unable to organize imports for '{0}'. The document is too complex. + 無法組織 '{0}' 的匯入。文件太複雜。 Using MSBuild.exe located in '{0}'. - Using MSBuild.exe located in '{0}'. + 正在使用位於 '{0}' 的 MSBuild.exe。 Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. + 載入工作區時發生警告。請將詳細程度選項設定為 [診斷] 層級以記錄警告。 - - Whether to treat the `<workspace>` argument as a simple folder of files. - Whether to treat the `<workspace>` argument as a simple folder of files. + + Whether to treat the `<project>` path as a folder of files. + 是否要將 `<project>` 路徑視為檔案的資料夾。 Writing formatting report to: '{0}'. - Writing formatting report to: '{0}'. + 正在將格式化報告寫入: '{0}'。 From 47e446cc3d5b80e6d722e6b14a238a628671747e Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 6 Jul 2020 14:46:27 -0700 Subject: [PATCH 1082/2702] Filter analyzers by project language before running --- src/Analyzers/AnalyzerFormatter.cs | 32 +++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 7af59308209d..6cd013c06a19 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -16,6 +16,8 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class AnalyzerFormatter : ICodeFormatter { + private static readonly ImmutableArray _supportedLanguages = ImmutableArray.Create(LanguageNames.CSharp, LanguageNames.VisualBasic); + private readonly string _name; private readonly IAnalyzerInformationProvider _informationProvider; private readonly IAnalyzerRunner _runner; @@ -42,6 +44,10 @@ public async Task FormatAsync( CancellationToken cancellationToken) { var (analyzers, fixers) = _informationProvider.GetAnalyzersAndFixers(solution, formatOptions, logger); + if (analyzers.IsEmpty && fixers.IsEmpty) + { + return solution; + } var analysisStopwatch = Stopwatch.StartNew(); logger.LogTrace(Resources.Running_0_analysis, _name); @@ -148,13 +154,13 @@ private async Task FixDiagnosticsAsync( } // Build maps between diagnostic id and the associated analyzers and codefixes - var analyzersById = CreateAnalyzerMap(reportedDiagnostics, allAnalyzers); + var analyzersByIdAndLanguage = CreateAnalyzerMap(reportedDiagnostics, allAnalyzers); var fixersById = CreateFixerMap(reportedDiagnostics, allCodefixes); // We need to run each codefix iteratively so ensure that all diagnostics are found and fixed. foreach (var diagnosticId in reportedDiagnostics) { - var analyzers = analyzersById[diagnosticId]; + var analyzersByLanguage = analyzersByIdAndLanguage[diagnosticId]; var codefixes = fixersById[diagnosticId]; // If there is no codefix, there is no reason to run analysis again. @@ -173,6 +179,7 @@ private async Task FixDiagnosticsAsync( continue; } + var analyzers = analyzersByLanguage[project.Language]; await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); } @@ -193,13 +200,18 @@ private async Task FixDiagnosticsAsync( return solution; - static ImmutableDictionary> CreateAnalyzerMap( + static ImmutableDictionary>> CreateAnalyzerMap( ImmutableArray diagnosticIds, ImmutableArray analyzers) { return diagnosticIds.ToImmutableDictionary( id => id, - id => analyzers.Where(analyzer => analyzer.SupportedDiagnostics.Any(diagnostic => diagnostic.Id == id)).ToImmutableArray()); + id => _supportedLanguages.ToImmutableDictionary( + language => language, + language => analyzers + .Where(analyzer => DoesAnalyzerSupportLanguage(analyzer, language)) + .Where(analyzer => analyzer.SupportedDiagnostics.Any(diagnostic => diagnostic.Id == id)) + .ToImmutableArray())); } static ImmutableDictionary> CreateFixerMap( @@ -226,7 +238,9 @@ internal static async Task(); - foreach (var analyzer in allAnalyzers) + // Filter analyzers by project's language + var filteredAnalyzer = allAnalyzers.Where(analyzer => DoesAnalyzerSupportLanguage(analyzer, project.Language)); + foreach (var analyzer in filteredAnalyzer) { // Always run naming style analyzers because we cannot determine potential severity. // The reported diagnostics will be filtered by severity when they are run. @@ -248,5 +262,13 @@ internal static async Task() + .Any(attribute => attribute.Languages.Contains(language)); + } } } From dafba6b6c70551d58c80dc97ac584cf3d3f144bb Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 6 Jul 2020 16:38:47 -0700 Subject: [PATCH 1083/2702] Pass diagnostic id being fixed into codefix applier --- src/Analyzers/AnalyzerFormatter.cs | 11 ++++++----- src/Analyzers/Interfaces/ICodeFixApplier.cs | 1 + src/Analyzers/SolutionCodeFixApplier.cs | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 6cd013c06a19..6f20a00762cb 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -16,7 +16,7 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class AnalyzerFormatter : ICodeFormatter { - private static readonly ImmutableArray _supportedLanguages = ImmutableArray.Create(LanguageNames.CSharp, LanguageNames.VisualBasic); + private static readonly ImmutableArray s_supportedLanguages = ImmutableArray.Create(LanguageNames.CSharp, LanguageNames.VisualBasic); private readonly string _name; private readonly IAnalyzerInformationProvider _informationProvider; @@ -188,11 +188,10 @@ private async Task FixDiagnosticsAsync( { foreach (var codefix in codefixes) { - var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, logger, cancellationToken).ConfigureAwait(false); + var changedSolution = await _applier.ApplyCodeFixesAsync(solution, result, codefix, diagnosticId, logger, cancellationToken).ConfigureAwait(false); if (changedSolution.GetChanges(solution).Any()) { solution = changedSolution; - break; } } } @@ -206,7 +205,7 @@ static ImmutableDictionary id, - id => _supportedLanguages.ToImmutableDictionary( + id => s_supportedLanguages.ToImmutableDictionary( language => language, language => analyzers .Where(analyzer => DoesAnalyzerSupportLanguage(analyzer, language)) @@ -220,7 +219,9 @@ static ImmutableDictionary> CreateFixerM { return diagnosticIds.ToImmutableDictionary( id => id, - id => fixers.Where(fixer => fixer.FixableDiagnosticIds.Contains(id)).ToImmutableArray()); + id => fixers + .Where(fixer => fixer.FixableDiagnosticIds.Contains(id)) + .ToImmutableArray()); } } diff --git a/src/Analyzers/Interfaces/ICodeFixApplier.cs b/src/Analyzers/Interfaces/ICodeFixApplier.cs index 7a6674f91a8b..b1425203d888 100644 --- a/src/Analyzers/Interfaces/ICodeFixApplier.cs +++ b/src/Analyzers/Interfaces/ICodeFixApplier.cs @@ -13,6 +13,7 @@ Task ApplyCodeFixesAsync( Solution solution, CodeAnalysisResult result, CodeFixProvider codefixes, + string diagnosticId, ILogger logger, CancellationToken cancellationToken); } diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index 316d4a347e67..af6f46057656 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -18,11 +18,10 @@ public async Task ApplyCodeFixesAsync( Solution solution, CodeAnalysisResult result, CodeFixProvider codeFix, + string diagnosticId, ILogger logger, CancellationToken cancellationToken) { - var diagnosticId = result.Diagnostics.FirstOrDefault().Value.FirstOrDefault()?.Id; - var fixAllProvider = codeFix.GetFixAllProvider(); if (fixAllProvider?.GetSupportedFixAllScopes()?.Contains(FixAllScope.Solution) != true) { From 3aae7ce413b36bbed09133cf789b3071331d2eba Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 6 Jul 2020 16:39:21 -0700 Subject: [PATCH 1084/2702] Do not debug "justMyCode" --- .vscode/launch.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 682aef749f1c..34e3ae0b615c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,7 +20,8 @@ "cwd": "${workspaceFolder}/src", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console "console": "internalConsole", - "stopAtEntry": false + "stopAtEntry": false, + "justMyCode": false }, { "name": "format format.sln --check", @@ -38,7 +39,8 @@ "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console "console": "internalConsole", - "stopAtEntry": false + "stopAtEntry": false, + "justMyCode": false }, { "name": "format format.sln --fix-style warn --check", @@ -58,7 +60,8 @@ "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console "console": "internalConsole", - "stopAtEntry": false + "stopAtEntry": false, + "justMyCode": false }, { "name": "format format.sln --fix-analyzers warn --check", @@ -78,7 +81,8 @@ "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console "console": "internalConsole", - "stopAtEntry": false + "stopAtEntry": false, + "justMyCode": false }, { "name": ".NET Core Attach", From 22e3cc2727c19383cd89fcfa273621528e249897 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 6 Jul 2020 16:39:39 -0700 Subject: [PATCH 1085/2702] Add remove unnecessary import to editorconfig --- .editorconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 5f28107762e9..882e0e6162c8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -210,4 +210,7 @@ dotnet_diagnostic.IDE0052.severity = warning dotnet_diagnostic.IDE0059.severity = warning # IDE0060: Remove unused parameter -dotnet_diagnostic.IDE0060.severity = warning \ No newline at end of file +dotnet_diagnostic.IDE0060.severity = warning + +# IDE0005: Using directive is unnecessary +dotnet_diagnostic.IDE0005.severity = warning From 8a32cb08b0a376fba217b700a727858d7a7de5d2 Mon Sep 17 00:00:00 2001 From: Cristiano Suzuki Date: Wed, 8 Jul 2020 08:33:05 -0700 Subject: [PATCH 1086/2702] LOC CHECKIN 20200708 --- src/xlf/Resources.cs.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.de.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.es.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.fr.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.it.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.ja.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.ko.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.pl.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.pt-BR.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.ru.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.tr.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.zh-Hans.xlf | 179 ++++++++++++++++++---------------- src/xlf/Resources.zh-Hant.xlf | 179 ++++++++++++++++++---------------- 13 files changed, 1261 insertions(+), 1066 deletions(-) diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index d3032804364d..7ea58dd03d4d 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - Seznam relativních cest k souborům nebo složkám, které se nemají formátovat + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - Seznam relativních cest k souborům nebo složkám, které se mají formátovat. Pokud bude seznam prázdný, budou se formátovat všechny soubory. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Cesta k souboru řešení, souboru projektu nebo složce obsahující soubor řešení nebo projektu. Pokud cesta není zadaná, použije se aktuální adresář. + Accepts a file path, which if provided, will produce a json report in the given directory. - Přijímá cestu k souboru. Pokud se zadá, vytvoří se v daném adresáři sestava JSON. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + Analýza se dokončila za {0} ms. - {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. - - Cannot specify both folder and workspace options. + + Analyzer Reference + Odkaz na analyzátor - Možnosti složek a pracovních prostorů se nedají zadat najednou. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí argumentu <workspace>. - Možnosti argumentů projektu a složek se nedají zadat najednou. - - Cannot specify both project argument and workspace option. + + Code Style + Styl kódu - Možnosti argumentů projektů a pracovních prostorů se nedají zadat najednou. Complete in {0}ms. - Dokončeno za {0} ms + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + V adresáři {0} nešlo najít soubor projektu MSBuild nebo soubor řešení. Určete, který soubor chcete použít, pomocí argumentu <workspace>. - V adresáři {0} nešlo najít soubor projektu MSBuild nebo soubor řešení. Určete, který soubor chcete použít, pomocí parametru --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - {0} nejde formátovat. Formátovat jde v současné době jenom projekty v jazycích C# a Visual Basic. + + + + Determining diagnostics... + Zjišťuje se diagnostika... + Determining formattable files. - Určují se soubory, které se dají formátovat. + + + + Failed to apply code fix {0} for {1}: {2} + Nepovedlo se použít opravu kódu {0} pro {1}: {2} + Failed to save formatting changes. - Nepodařilo se uložit změny formátování. + Fix end of line marker. - Opravte značku konce řádku. + Fix file encoding. - Opravte kódování souboru. + Fix final newline. - Opravte odřádkování na konci. + Fix imports ordering. - Opravte pořadí importů. + Fix whitespace formatting. - Opravte formátování prázdných znaků. + + + + Fixing diagnostics... + Opravuje se diagnostika... + Format complete in {0}ms. - Formátování se dokončilo za {0} ms. - - - Format files, but do not save changes to disk. - Soubory se naformátují, ale změny se neuloží na disk. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formátuje soubory bez toho, aby se změny ukládaly na disk. Pokud se nějaké soubory naformátovaly, ukončí se s nenulovým ukončovacím kódem. + Formatted {0} of {1} files. - Naformátovali jsme {0} z {1} souborů. + Formatting code file '{0}'. - Formátuje se soubor kódu {0}. + Formatting code files in workspace '{0}'. - Formátují se soubory kódu v pracovním prostoru {0}. + Include generated code files in formatting operations. - Zahrňte do operací formátování vygenerované soubory kódu. + Loading workspace. - Načítá se pracovní prostor. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + {0} obsahuje více souborů projektů MSBuild. Určete, který soubor chcete použít, pomocí argumentu <workspace>. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí argumentu <workspace>. - {0} obsahuje více souborů projektů MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + Spustit analyzátory třetích stran a použít opravy + + + + Run code style analyzers and apply fixes. + Spustit analyzátory stylu kódu a použít opravy + + + + Running {0} analysis. + Probíhá analýza {0}. - {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí parametru --workspace. Running formatters. - Spouští se formátování. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Nastavte úroveň podrobností. Povolené hodnoty jsou: q[uiet], m[inimal], n[ormal], d[etailed] a diag[nostic] + Skipping referenced project '{0}'. - Přeskočí se odkazovaný projekt {0}. + + + + Solution {0} has no projects + Řešení {0} nemá žádné projekty. + The dotnet CLI version is '{0}'. - Verze .NET CLI je {0}. - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - Možnost --dry-run je zastaralá. Použijte místo ní možnost --check. The file '{0}' does not appear to be a valid project or solution file. - Soubor {0} zřejmě není platný soubor projektu nebo řešení. - - - The `--files` option is deprecated. Use the `--include` option instead. - - Možnost --files je zastaralá. Použijte místo ní možnost --include. - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - Pro zadávání cesty je možnost --folder zastaralá. Možnost --folder můžete předat, ale cestu zadejte pomocí argumentu projektu. The project file '{0}' does not exist. - Soubor projektu {0} neexistuje. + The solution file '{0}' does not exist. - Soubor řešení {0} neexistuje. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Soubor řešení nebo projektu, se kterým se má operace provést. Pokud soubor není zadaný, příkaz ho bude hledat v aktuálním adresáři. Formatted code file '{0}'. - Naformátoval se soubor kódu {0}. + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Nepovedlo se opravit {0}. Oprava kódu {1} nepodporuje možnost Opravit vše v řešení. - Možnost --workspace je zastaralá. Použijte místo ní argument <project>. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Nepovedlo se najít MSBuild. Ujistěte se, že se sada .NET SDK nainstalovala pomocí oficiálního instalačního programu. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - Nepovedlo se najít .NET CLI. Ujistěte se, že se nachází v proměnné PATH. + Unable to organize imports for '{0}'. The document is too complex. - Nepovedlo se uspořádat importy pro {0}. Dokument je příliš složitý. + Using MSBuild.exe located in '{0}'. - Používá se MSBuild.exe umístěný v {0}. + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Při načítání pracovního prostoru se vygenerovala upozornění. Pokud chcete upozornění protokolovat, nastavte možnost verbosity na úroveň diagnostic. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Určuje, jestli se má argument <workspace> považovat za jednoduchou složku souborů. - Určuje, jestli se cesta <project> má považovat za složku, nebo soubory. Writing formatting report to: '{0}'. - Sestava formátování se zapisuje do {0}. + diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index f0bd702ab335..46ab5f6dec02 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - Eine Liste der relativen Datei- oder Ordnerpfade, die von der Formatierung ausgeschlossen werden sollen. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - Eine Liste der relativen Datei- oder Ordnerpfade, die in die Formatierung einbezogen werden sollen. Wenn diese Liste leer ist, werden alle Dateien formatiert. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Ein Pfad zu einer Projektmappendatei, einer Projektdatei oder einem Ordner, die bzw. der eine Projektmappe oder Projektdatei enthält. Wenn kein Pfad angegeben wird, wird das aktuelle Verzeichnis verwendet. + Accepts a file path, which if provided, will produce a json report in the given directory. - Akzeptiert einen Dateipfad, der bei Bereitstellung einen JSON-Bericht im angegebenen Verzeichnis erstellt. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + Die Analyse wurde in {0} ms abgeschlossen. - In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappe gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. - - Cannot specify both folder and workspace options. + + Analyzer Reference + Analysereferenz - Die Optionen für einen Ordner und für einen Arbeitsbereich können nicht gleichzeitig angegeben werden. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappendatei gefunden. Geben Sie die zu verwendende Datei mit dem <workspace>-Argument an. - Die Optionen für ein Projektargument und für einen Ordner können nicht gleichzeitig angegeben werden. - - Cannot specify both project argument and workspace option. + + Code Style + Codeformat - Die Optionen für ein Projektargument und für einen Arbeitsbereich können nicht gleichzeitig angegeben werden. Complete in {0}ms. - Abgeschlossen in {0} ms. + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + In "{0}" wurde weder eine MSBuild-Projektdatei noch eine Projektmappendatei gefunden. Geben Sie die zu verwendende Datei mit dem <workspace>-Argument an. - Kein MSBuild-Projektdatei oder Projektmappendatei in "{0}" gefunden. Geben Sie die zu verwendende Datei mit der Option "--workspace" an. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - "{0}" konnte nicht formatiert werden. Derzeit wird die Formatierung nur für C#- und Visual Basic-Projekte unterstützt. + + + + Determining diagnostics... + Diagnose wird ermittelt... + Determining formattable files. - Formatierbare Dateien werden ermittelt. + + + + Failed to apply code fix {0} for {1}: {2} + Fehler beim Anwenden der Codekorrektur "{0}" für "{1}": {2} + Failed to save formatting changes. - Fehler beim Speichern von Formatierungsänderungen. + Fix end of line marker. - Korrigieren Sie den Zeilenendemarker. + Fix file encoding. - Korrigieren Sie die Dateicodierung. + Fix final newline. - Korrigieren Sie den letzten Zeilenumbruch. + Fix imports ordering. - Korrigieren Sie die Importreihenfolge. + Fix whitespace formatting. - Korrigieren Sie die Leerraumformatierung. + + + + Fixing diagnostics... + Diagnose wird korrigiert... + Format complete in {0}ms. - Die Formatierung wurde in {0} ms abgeschlossen. - - - Format files, but do not save changes to disk. - Dateien formatieren, Änderungen aber nicht auf Festplatte speichern. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formatiert Dateien ohne Speichern der Änderungen auf dem Datenträger. Wird mit einem Exitcode ungleich Null beendet, wenn Dateien formatiert wurden. + Formatted {0} of {1} files. - {0} von {1} Dateien wurden formatiert. + Formatting code file '{0}'. - Codedatei "{0}" wird formatiert. + Formatting code files in workspace '{0}'. - Codedateien im Arbeitsbereich "{0}" werden formatiert. + Include generated code files in formatting operations. - Hiermit werden generierte Codedateien in Formatierungsvorgänge einbezogen. + Loading workspace. - Arbeitsbereich wird geladen. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + In "{0}" wurden mehrere MSBuild-Projektdateien gefunden. Geben Sie die zu verwendende Datei mit dem <workspace>-Argument an. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + In "{0}" wurden mehrere MSBuild-Projektmappendateien gefunden. Geben Sie die zu verwendende Datei mit dem <workspace>-Argument an. - Mehrere MSBuild-Projektdateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + Führen Sie Drittanbieter-Analysetools aus, und wenden Sie Korrekturen an. + + + + Run code style analyzers and apply fixes. + Führen Sie Codeformat-Analysetools aus, und wenden Sie Korrekturen an. + + + + Running {0} analysis. + Die Analyse für "{0}" wird ausgeführt. - Mehrere MSBuild Projektmappendateien in "{0}" gefunden. Geben Sie mit der Option "--workspace" an, welche verwendet werden soll. Running formatters. - Formatierer werden ausgeführt. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Legen Sie den Ausführlichkeitsgrad fest. Zulässige Werte sind "q[uiet]", "m[inimal]", "n[ormal]", "d[etailed]" und "diag[nostic]". + Skipping referenced project '{0}'. - Überspringen von referenziertem Projekt "{0}". + + + + Solution {0} has no projects + Die Projektmappe "{0}" enthält keine Projekte. + The dotnet CLI version is '{0}'. - Die dotnet-CLI-Version ist "{0}". - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - Die Option "--dry-run" ist veraltet. Verwenden Sie stattdessen die Option "--check". The file '{0}' does not appear to be a valid project or solution file. - Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. - - - The `--files` option is deprecated. Use the `--include` option instead. - - Die Option "--files" ist veraltet. Verwenden Sie stattdessen die Option "--include". - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - Die Option "--folder" ist für die Angabe des Pfads veraltet. Übergeben Sie die Option "--folder", aber geben Sie stattdessen den Pfad mit dem Argument "project" an. The project file '{0}' does not exist. - Die Projektdatei "{0}" ist nicht vorhanden. + The solution file '{0}' does not exist. - Die Projektmappendatei "{0}" ist nicht vorhanden. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Die Projektmappe oder Projektdatei, die verwendet werden soll. Wenn keine Datei angegeben ist, durchsucht der Befehl das aktuelle Verzeichnis nach einer Datei. Formatted code file '{0}'. - Codedatei "{0}" wurde formatiert. + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + "{0}" kann nicht korrigiert werden. Die Codekorrektur "{1}" unterstützt nicht das Korrigieren aller Fehler in einer Projektmappe. - Die Option "--workspace" ist veraltet. Verwenden Sie stattdessen das Argument "<project>". Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - MSBuild wurde nicht gefunden. Stellen Sie sicher, dass das .NET SDK mit dem offiziellen Installationsprogramm installiert wurde. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - Die dotnet-CLI wurde nicht gefunden. Stellen Sie sicher, dass sie sich im Pfad befindet. + Unable to organize imports for '{0}'. The document is too complex. - Importe für "{0}" können nicht organisiert werden. Das Dokument ist zu komplex. + Using MSBuild.exe located in '{0}'. - MSBuild.exe in "{0}" wird verwendet. + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Beim Laden des Arbeitsbereichs sind Warnungen aufgetreten. Legen Sie die Ausführlichkeitsoption auf "Diagnose" fest, um Warnungen zu protokollieren. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Gibt an, ob das <workspace>-Argument als einfacher Dateiordner behandelt werden soll. - Gibt an, ob der Pfad "<project>" als Ordner für Dateien behandelt werden soll. Writing formatting report to: '{0}'. - Formatierungsbericht wird in "{0}" geschrieben. + diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index a894e9dd2d00..6392ed6c31c2 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - Lista de rutas de acceso de carpeta o archivo relativas que se van a excluir del formato. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - Lista de rutas de acceso de carpeta o archivo relativas que se van a incluir en el formato. Se da formato a todos los archivos, si están vacíos. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Ruta de acceso a un archivo de solución, a un archivo del proyecto o a una carpeta que contiene archivo de proyecto o solución. Si no se especifica ninguna ruta de acceso, se usa el directorio actual. + Accepts a file path, which if provided, will produce a json report in the given directory. - Acepta una ruta de acceso de archivo que, si se proporciona, generará un informe JSON en el directorio dado. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + Análisis completado en {0} ms. - Se encontró un archivo de proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. - - Cannot specify both folder and workspace options. + + Analyzer Reference + Referencia de analizador - No se pueden especificar las opciones de carpeta y de área de trabajo a la vez. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + Se encontró un archivo del proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con el argumento <workspace>. - No se pueden especificar las opciones de carpeta y argumento de proyecto a la vez. - - Cannot specify both project argument and workspace option. + + Code Style + Estilo de código - No se pueden especificar las opciones de área de trabajo y argumento de proyecto a la vez. Complete in {0}ms. - Completar en {0} ms. + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + No se encontró ningún archivo del proyecto ni archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con el argumento <workspace>. - No se pudo encontrar un archivo de proyecto o archivo de solución MSBuild en "{0}". Especifique cuál debe utilizarse con la opción --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - No se pudo dar formato a "{0}". El formato admite solo proyectos de C# y Visual Basic en este momento. + + + + Determining diagnostics... + Determinando los diagnósticos... + Determining formattable files. - Determinando los archivos formateables. + + + + Failed to apply code fix {0} for {1}: {2} + No se pudo aplicar la corrección de código {0} para {1}: {2} + Failed to save formatting changes. - Error al guardar cambios de formato. + Fix end of line marker. - Corrija el marcador de fin de línea. + Fix file encoding. - Corrija la codificación del archivo. + Fix final newline. - Corrija la nueva línea final. + Fix imports ordering. - Corrija el orden de las importaciones. + Fix whitespace formatting. - Corrija el formato de espacio en blanco. + + + + Fixing diagnostics... + Corrigiendo los diagnósticos... + Format complete in {0}ms. - Formato completado en {0} ms. - - - Format files, but do not save changes to disk. - Formato de archivos, pero no guardar los cambios al disco. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Da formato a los archivos sin guardar los cambios en el disco. Termina con un código de salida distinto de cero si se ha dado formato a algún archivo. + Formatted {0} of {1} files. - {0} de {1} archivos con formato aplicado. + Formatting code file '{0}'. - Formato de archivo de código "{0}". + Formatting code files in workspace '{0}'. - Aplicar formato a archivos de código en espacio de trabajo "{0}". + Include generated code files in formatting operations. - Incluya los archivos de código generados en las operaciones de formato. + Loading workspace. - Cargando área de trabajo. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Se encontraron varios archivos del proyecto MSBuild en "{0}". Especifique cuál debe usarse con el argumento <workspace>. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Se encontraron varios archivos de solución MSBuild en "{0}". Especifique cuál debe usarse con el argumento <workspace>. - Se encontraron múltiples archivos de proyecto MSBuild en "{0}". Especifique cuál debe usarse con la opción --workspace. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + Ejecute analizadores de terceros y aplique las correcciones. + + + + Run code style analyzers and apply fixes. + Ejecute analizadores de estilo de código y aplique las correcciones. + + + + Running {0} analysis. + Ejecutando el análisis de {0}. - Se encontraron múltiples archivos de solución MSBuild en "{0}". Especifique cuáles se deben utilizar con la opción --workspace. Running formatters. - Ejecutando los formateadores. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Establecer el nivel de detalle. Los valores permitidos son q[uiet], m[inimal], n[ormal], d[etailed]c y diag[nostic] + Skipping referenced project '{0}'. - Omitiendo projecto al que se hace referencia "{0}". + + + + Solution {0} has no projects + La solución {0} no tiene ningún proyecto. + The dotnet CLI version is '{0}'. - La versión de la CLI de dotnet es "{0}". - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - La opción "--dry-run" está en desuso. Use la opción "--check" en su lugar. The file '{0}' does not appear to be a valid project or solution file. - El archivo "{0}" no parece ser un proyecto o archivo de solución válido. - - - The `--files` option is deprecated. Use the `--include` option instead. - - La opción "--files" está en desuso. Use la opción "--include" en su lugar. - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - La opción "--folder" está en desuso para especificar la ruta de acceso. Pase la opción "--folder", pero especifique la ruta de acceso con el argumento de proyecto en su lugar. The project file '{0}' does not exist. - El archivo de proyecto "{0}" no existe. + The solution file '{0}' does not exist. - El archivo de solución "{0}" no existe. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - El archivo de solución o el proyecto para operar. Si no se especifica un archivo, el comando buscará uno en el directorio actual. Formatted code file '{0}'. - Archivo de código "{0}" con formato aplicado. + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + No se puede corregir {0}. La corrección de código {1} no es compatible con la opción para corregir todo en la solución. - La opción "--workspace" está en desuso. Use el argumento "<project>" en su lugar. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - No se encuentra MSBuild. Asegúrese de que el SDK de .NET se haya instalado con el instalador oficial. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - No se encuentra la CLI de dotnet. Asegúrese de que esté en la ruta de acceso (PATH). + Unable to organize imports for '{0}'. The document is too complex. - No se pueden organizar las importaciones para "{0}". El documento es demasiado complejo. + Using MSBuild.exe located in '{0}'. - Se está usando el archivo MSBuild.exe ubicado en "{0}". + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Se encontraron advertencias al cargar el área de trabajo. Establezca la opción de nivel de detalle en "diagnóstico" para registrar las advertencias. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Indica si el argumento "<workspace>" debe tratarse como una simple carpeta de archivos. - Indica si la ruta de acceso "<project>" debe tratarse como carpeta de archivos. Writing formatting report to: '{0}'. - Escribiendo el informe de formato en "{0}". + diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 1fffda836bb6..71b6568e402d 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - Liste des chemins relatifs de fichier ou de dossier à exclure de la mise en forme. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - Liste des chemins relatifs de fichier ou de dossier à inclure dans la mise en forme. Si non renseigné, tous les fichiers sont mis en forme. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Chemin d'un fichier solution, d'un fichier projet ou d'un dossier contenant un fichier solution ou un fichier projet. Si aucun chemin n'est spécifié, le répertoire actif est utilisé. + Accepts a file path, which if provided, will produce a json report in the given directory. - Accepte un chemin de fichier, qui, s'il est fourni, produit un rapport JSON dans le répertoire donné. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + Analyse effectuée en {0} ms. - Un fichier projet et un fichier solution MSBuild ont été trouvés dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. - - Cannot specify both folder and workspace options. + + Analyzer Reference + Référence de l'analyseur - Impossible de spécifier à la fois des options de dossier et d'espace de travail. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + Fichier projet et fichier solution MSBuild trouvés dans '{0}'. Spécifiez celui qui doit être utilisé avec l'argument <espace de travail>. - Impossible de spécifier à la fois un argument de projet et des options de dossier. - - Cannot specify both project argument and workspace option. + + Code Style + Style de code - Impossible de spécifier à la fois un argument de projet et une option d'espace de travail. Complete in {0}ms. - Effectué en {0} ms. + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Le fichier projet ou le fichier solution MSBuild est introuvable dans '{0}'. Spécifiez celui qui doit être utilisé avec l'argument <espace de travail>. - Fichier projet ou solution MSBuild introuvable dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Impossible de mettre en forme '{0}'. L'opération Mettre en forme prend uniquement en charge les projets C# et Visual Basic pour le moment. + + + + Determining diagnostics... + Détermination des diagnostics... + Determining formattable files. - Identification des fichiers pouvant être mis en forme. + + + + Failed to apply code fix {0} for {1}: {2} + Échec de l'application du correctif de code {0} pour {1} : {2} + Failed to save formatting changes. - L'enregistrement des changements de mise en forme a échoué. + Fix end of line marker. - Corrigez le marqueur de fin de ligne. + Fix file encoding. - Corrigez l'encodage de fichier. + Fix final newline. - Corrigez la nouvelle ligne de fin. + Fix imports ordering. - Corrigez le classement des importations. + Fix whitespace formatting. - Corrigez la mise en forme des espaces blancs. + + + + Fixing diagnostics... + Correction des diagnostics... + Format complete in {0}ms. - Mise en forme effectuée en {0} ms. - - - Format files, but do not save changes to disk. - Mettez en forme les fichiers, mais n'enregistrez pas les changements sur le disque. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Met en forme les fichiers sans enregistrer les changements sur le disque. Se termine par un code de sortie non nul si des fichiers ont été mis en forme. + Formatted {0} of {1} files. - {0} fichiers mis en forme sur {1}. + Formatting code file '{0}'. - Mise en forme du fichier de code '{0}'. + Formatting code files in workspace '{0}'. - Mise en forme des fichiers de code dans l'espace de travail '{0}'. + Include generated code files in formatting operations. - Ajoutez des fichiers de code générés dans les opérations de mise en forme. + Loading workspace. - Chargement de l'espace de travail. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Plusieurs fichiers projet MSBuild trouvés dans '{0}'. Spécifiez celui qui doit être utilisé avec l'argument <espace de travail>. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Plusieurs fichiers solution MSBuild trouvés dans '{0}'. Spécifiez celui qui doit être utilisé avec l'argument <espace de travail>. - Plusieurs fichiers projet MSBuild dans '{0}'. Spécifiez celui à utiliser avec l'option --workspace. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + Exécutez des analyseurs tiers et appliquez des correctifs. + + + + Run code style analyzers and apply fixes. + Exécutez des analyseurs de style de code et appliquez des correctifs. + + + + Running {0} analysis. + Exécution de l'analyse de {0}. - Plusieurs fichiers solution MSBuild dans '{0}'. Spécifiez ceux à utiliser avec l'option --workspace. Running formatters. - Exécution des formateurs. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Définissez le niveau de détail. Les valeurs autorisées sont q[uiet], m[inimal], n[ormal], d[etailed] et diag[nostic] + Skipping referenced project '{0}'. - Saut du projet référencé '{0}'. + + + + Solution {0} has no projects + La solution {0} n'a aucun projet + The dotnet CLI version is '{0}'. - La version de l'interface CLI dotnet est '{0}'. - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - L'option '--dry-run' est dépréciée. Utilisez l'option '--check' à la place. The file '{0}' does not appear to be a valid project or solution file. - Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. - - - The `--files` option is deprecated. Use the `--include` option instead. - - L'option '--files' est dépréciée. Utilisez l'option '--include' à la place. - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - L'option '--folder' est dépréciée pour spécifier le chemin. Passez l'option '--folder', mais spécifiez le chemin avec l'argument de projet à la place. The project file '{0}' does not exist. - Le fichier projet '{0}' n'existe pas. + The solution file '{0}' does not exist. - Le fichier solution '{0}' n'existe pas. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Fichier solution ou projet à utiliser. Si un fichier n'est pas spécifié, la commande en recherche un dans le répertoire actuel. Formatted code file '{0}'. - Fichier de code '{0}' mis en forme. + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Impossible de corriger {0}. Le correctif de code {1} ne prend pas en charge la fonctionnalité Tout corriger dans la solution. - L'option '--workspace' est dépréciée. Utilisez l'argument '<project>' à la place. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Impossible de localiser MSBuild. Vérifiez que le SDK .NET a été installé avec le programme d'installation officiel. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - Impossible de localiser l'interface CLI dotnet. Vérifiez qu'elle est dans le chemin. + Unable to organize imports for '{0}'. The document is too complex. - Impossible d'organiser les importations pour '{0}'. Le document est trop complexe. + Using MSBuild.exe located in '{0}'. - Utilisation de MSBuild.exe dans '{0}'. + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Des avertissements ont été rencontrés pendant le chargement de l'espace de travail. Définissez l'option verbosity sur le niveau « diagnostic » pour journaliser les avertissements. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Indique si l'argument '<espace de travail>' doit être traité en tant que simple dossier de fichiers. - Indique de traiter le chemin '<project>' comme un dossier de fichiers. Writing formatting report to: '{0}'. - Écriture du rapport de mise en forme dans '{0}'. + diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 845eb3c0599f..30bf6945281a 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - Elenco di percorsi relativi di file o cartelle da escludere dalla formattazione. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - Elenco di percorsi relativi di file o cartelle da includere nella formattazione. Se è vuoto, tutti i file vengono formattati. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Percorso di un file di soluzione, un file di progetto o una cartella contenente una soluzione o un file di progetto. Se non si specifica alcun percorso, viene usata la directory corrente. + Accepts a file path, which if provided, will produce a json report in the given directory. - Accetta un percorso file che, se specificato, produrrà un report JSON nella directory specificata. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + L'analisi è stata completata in {0} ms. - In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. - - Cannot specify both folder and workspace options. + + Analyzer Reference + Riferimento ad analizzatore - Non è possibile specificare entrambe le opzioni relative a cartella e area di lavoro. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'argomento <workspace>. - Non è possibile specificare sia l'argomento di progetto che le opzioni relative alla cartella. - - Cannot specify both project argument and workspace option. + + Code Style + Stile codice - Non è possibile specificare sia l'argomento progetto che l'opzione relativa all'area di lavoro. Complete in {0}ms. - Completata in {0} ms. + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + In '{0}' non è stato possibile trovare alcun file di progetto o di soluzione MSBuild. Per specificare quello desiderato, usare l'argomento <workspace>. - In '{0}' non è stato possibile trovare alcun file di progetto o di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Non è stato possibile formattare '{0}'. Il formato supporta attualmente solo progetti C# e Visual Basic. + + + + Determining diagnostics... + Determinazione della diagnostica... + Determining formattable files. - Determinazione dei file formattabili. + + + + Failed to apply code fix {0} for {1}: {2} + Non è stato possibile applicare la correzione del codice {0} per {1}: {2} + Failed to save formatting changes. - Non è stato possibile salvare le modifiche di formattazione. + Fix end of line marker. - Correggere il marcatore di fine riga. + Fix file encoding. - Correggere la codifica dei file. + Fix final newline. - Correggere il carattere di nuova riga finale. + Fix imports ordering. - Correggere l'ordinamento delle importazioni. + Fix whitespace formatting. - Correggere la formattazione degli spazi vuoti. + + + + Fixing diagnostics... + Correzione della diagnostica... + Format complete in {0}ms. - La formattazione è stata completata in {0} ms. - - - Format files, but do not save changes to disk. - Formatta i file, ma non salvare le modifiche sul disco. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formatta i file senza salvare le modifiche nel disco. Termina con un codice di uscita diverso da zero se sono stati formattati file. + Formatted {0} of {1} files. - Sono stati formattati {0} di {1} file. + Formatting code file '{0}'. - Formattazione del file di codice '{0}'. + Formatting code files in workspace '{0}'. - Formattazione del file di codice nell'area di lavoro '{0}'. + Include generated code files in formatting operations. - Includere i file del codice generato nelle operazioni di formattazione. + Loading workspace. - Caricamento dell'area di lavoro. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + In '{0}' sono stati trovati più file di progetto MSBuild. Per specificare quello desiderato, usare l'argomento <workspace>. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'argomento <workspace>. - In '{0}' sono stati trovati più file di progetto MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + Esegue gli analizzatori di terze parti e applica le correzioni. + + + + Run code style analyzers and apply fixes. + Esegue gli analizzatori degli stili di codice e applica le correzioni. + + + + Running {0} analysis. + Esecuzione dell'analisi {0}. - In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'opzione --workspace. Running formatters. - Esecuzione dei formattatori. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Consente di impostare il livello di dettaglio. I valori consentiti sono q[uiet], m[inimal], n[ormal], d[etailed] e diag[nostic] + Skipping referenced project '{0}'. - Il progetto di riferimento '{0}' verrà ignorato. + + + + Solution {0} has no projects + La soluzione {0} non contiene progetti + The dotnet CLI version is '{0}'. - La versione dell'interfaccia della riga di comando di dotnet è '{0}'. - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - L'opzione `--dry-run` è deprecata. In alternativa, usare l'opzione `--check`. The file '{0}' does not appear to be a valid project or solution file. - Il file '{0}' non sembra essere un file di progetto o di soluzione valido. - - - The `--files` option is deprecated. Use the `--include` option instead. - - L'opzione `--files` è deprecata. In alternativa, usare l'opzione `--include`. - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - L'opzione `--folder` è deprecata per la specifica del percorso. Passare l'opzione `--folder`, ma specificare il percorso con l'argomento project. The project file '{0}' does not exist. - Il file di progetto '{0}' non esiste. + The solution file '{0}' does not exist. - Il file di soluzione '{0}' non esiste. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - File di progetto o di soluzione su cui intervenire. Se non si specifica un file, il comando ne cercherà uno nella directory corrente. Formatted code file '{0}'. - Il file di codice '{0}' è stato formattato. + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Non è possibile correggere {0}. La correzione del codice {1} non supporta l'opzione Correggi tutti nella soluzione. - L'opzione `--workspace` è deprecata. In alternativa, usare l'argomento `<project>`. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Non è possibile individuare MSBuild. Assicurarsi che .NET SDK sia stato installato con il programma di installazione ufficiale. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - Non è possibile individuare l'interfaccia della riga di comando di dotnet. Assicurarsi che sia indicata in PATH. + Unable to organize imports for '{0}'. The document is too complex. - Non è possibile organizzare le importazioni per '{0}'. Il documento è troppo complesso. + Using MSBuild.exe located in '{0}'. - Verrà usata la versione di MSBuild.exe disponibile in '{0}'. + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Sono stati rilevati avvisi durante il caricamento dell'area di lavoro. Impostare l'opzione del livello di dettaglio su 'diagnostic' per registrare gli avvisi. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Indica se considerare l'argomento `<workspace>` come una semplice cartella di file. - Indica se considerare il percorso di `<project>` come cartella di file. Writing formatting report to: '{0}'. - Scrittura del report di formattazione in: '{0}'. + diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index e24ff7c4370b..44f495fa9cea 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - 書式設定から除外するファイルまたはフォルダーの相対パスの一覧。 + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - 書式設定に含めるファイルまたはフォルダーの相対パスの一覧。空の場合、すべてのファイルが書式設定されます。 + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + ソリューション ファイル、プロジェクト ファイル、またはソリューション ファイルかプロジェクト ファイルを含むフォルダーへのパス。パスが指定されていない場合は、現在のディレクトリが使用されます。 + Accepts a file path, which if provided, will produce a json report in the given directory. - ファイル パスを受け入れると (指定されている場合)、指定されたディレクトリに JSON レポートが生成されます。 + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + {0} ミリ秒で分析が完了します。 - MSBuild プロジェクト ファイルとソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 - - Cannot specify both folder and workspace options. + + Analyzer Reference + アナライザー参照 - フォルダーおよびワークスペースの両方のオプションを指定することはできません。 - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + MSBuild のプロジェクト ファイルとソリューション ファイルの両方が '{0}' で見つかりました。使用するものを <workspace> 引数で指定してください。 - プロジェクト引数とフォルダー オプションの両方を指定することはできません。 - - Cannot specify both project argument and workspace option. + + Code Style + コード スタイル - プロジェクト引数とワークスペース オプションの両方を指定することはできません。 Complete in {0}ms. - {0} ミリ秒で完了します。 + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + '{0}' で MSBuild のプロジェクト ファイルもソリューション ファイルも見つかりませんでした。使用するものを <workspace> 引数で指定してください。 - '{0}' で MSBuild プロジェクト ファイルまたはソリューション ファイルが見つかりませんでした。使用するファイルを --workspace オプションで指定してください。 Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - '{0}' をフォーマットできませんでした。フォーマットは、C# および Visual Basic のプロジェクトでのみサポートされています。 + + + + Determining diagnostics... + 診断を決定しています... + Determining formattable files. - 書式設定可能なファイルを判定しています。 + + + + Failed to apply code fix {0} for {1}: {2} + {1} のコード修正プログラム {0} を適用できませんでした: {2} + Failed to save formatting changes. - 書式変更を保存できませんでした。 + Fix end of line marker. - 行末マーカーを修正します。 + Fix file encoding. - ファイルのエンコードを修正します。 + Fix final newline. - 最後の改行を修正します。 + Fix imports ordering. - インポートの順序を修正します。 + Fix whitespace formatting. - 空白の書式設定を修正します。 + + + + Fixing diagnostics... + 診断を修正しています... + Format complete in {0}ms. - {0} ミリ秒で書式設定が完了します。 - - - Format files, but do not save changes to disk. - ファイルを書式設定しますが、変更をディスクに保存しません。 Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - 変更をディスクに保存せずにファイルを書式設定します。いずれかのファイルが書式設定されている場合、0 以外の終了コードで終了します。 + Formatted {0} of {1} files. - {1} 個中 {0} 個のファイルが書式設定されました。 + Formatting code file '{0}'. - コード ファイル '{0}' をフォーマットしています。 + Formatting code files in workspace '{0}'. - ワークスペース '{0}' でコード ファイルを書式設定します。 + Include generated code files in formatting operations. - 生成されたコード ファイルを書式設定操作に含めます。 + Loading workspace. - ワークスペースを読み込んでいます。 + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + 複数の MSBuild プロジェクト ファイルが '{0}' で見つかりました。使用するものを <workspace> 引数で指定してください。 + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するものを <workspace> 引数で指定してください。 - 複数の MSBuild プロジェクト ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + サード パーティのアナライザーを実行し、修正プログラムを適用します。 + + + + Run code style analyzers and apply fixes. + コード スタイル アナライザーを実行し、修正プログラムを適用します。 + + + + Running {0} analysis. + {0} 分析を実行しています。 - 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するファイルを --workspace オプションで指定してください。 Running formatters. - フォーマッタを実行しています。 + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 詳細レベルを設定します。許可されている値: q[uiet]、m[inimal]、n[ormal]、d[etailed]、diag[nostic] + Skipping referenced project '{0}'. - 参照プロジェクト '{0}' をスキップしています。 + + + + Solution {0} has no projects + ソリューション {0} にプロジェクトがありません + The dotnet CLI version is '{0}'. - dotnet CLI バージョンは '{0}' です。 - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - '--dry-run' オプションは非推奨です。代わりに '--check' オプションを使用してください。 The file '{0}' does not appear to be a valid project or solution file. - ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 - - - The `--files` option is deprecated. Use the `--include` option instead. - - '--files' オプションは非推奨です。代わりに '--include' オプションを使用してください。 - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - パスを指定するための '--folder' オプションは非推奨です。'--folder' オプションを渡しますが、パスは代わりにプロジェクト引数を使用して指定してください。 The project file '{0}' does not exist. - プロジェクト ファイル '{0}' が存在しません。 + The solution file '{0}' does not exist. - ソリューション ファイル '{0}' が存在しません。 - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 操作対象のソリューション ファイルまたはプロジェクト ファイル。ファイルを指定しない場合、コマンドは現在のディレクトリを検索します。 Formatted code file '{0}'. - コード ファイル '{0}' が書式設定されました。 + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + {0} を修復できません。コード修正プログラム {1} は、ソリューションでの [すべて修正] をサポートしていません。 - '--workspace' オプションは非推奨です。代わりに '<project>' 引数を使用してください。 Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - MSBuild が見つかりません。.NET SDK が正式なインストーラーでインストールされたことを確認してください。 + Unable to locate dotnet CLI. Ensure that it is on the PATH. - dotnet CLI が見つかりません。PATH 上にあることを確認してください。 + Unable to organize imports for '{0}'. The document is too complex. - '{0}' のインポートを整理できません。ドキュメントが複雑すぎます。 + Using MSBuild.exe located in '{0}'. - '{0}' にある MSBuild.exe を使用しています。 + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - ワークスペースの読み込み中に警告が発生しました。詳細オプションを '診断' レベルに設定して、警告をログに記録してください。 + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + '<workspace>' 引数をファイルの単純なフォルダーとして扱うかどうかを指定します。 - '<project>' パスをファイルのフォルダーとして扱うかどうかを指定します。 Writing formatting report to: '{0}'. - 書式設定レポートを '{0}' に書き込んでいます。 + diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 14197361ada7..89ee7bb0650d 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - 서식 지정에서 제외할 상대 파일 또는 폴더 경로 목록입니다. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - 서식 지정에 포함할 상대 파일 또는 폴더 경로 목록입니다. 비어 있으면 모든 파일의 서식이 지정됩니다. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + 솔루션 파일, 프로젝트 파일이나 솔루션 또는 프로젝트 파일이 포함된 폴더의 경로입니다. 경로를 지정하지 않으면 현재 디렉터리가 사용됩니다. + Accepts a file path, which if provided, will produce a json report in the given directory. - 제공된 경우 지정된 디렉터리에 json 보고서를 생성할 파일 경로를 허용합니다. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + {0}밀리초 후 분석이 완료됩니다. - '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. - - Cannot specify both folder and workspace options. + + Analyzer Reference + 분석기 참조 - 폴더 옵션과 작업 영역 옵션을 둘 다 지정할 수는 없습니다. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. <workspace> 인수를 사용하여 사용할 파일을 지정하세요. - 프로젝트 인수와 폴더 옵션을 둘 다 지정할 수는 없습니다. - - Cannot specify both project argument and workspace option. + + Code Style + 코드 스타일 - 프로젝트 인수와 작업 영역 옵션을 둘 다 지정할 수는 없습니다. Complete in {0}ms. - {0}ms 후에 완료됩니다. + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + '{0}'에서 MSBuild 프로젝트 파일 또는 솔루션 파일을 찾을 수 없습니다. <workspace> 인수를 사용하여 사용할 파일을 지정하세요. - '{0}'에서 MSBuild 프로젝트 파일 또는 솔루션 파일을 찾을 수 없습니다. --workspace 옵션에 사용할 파일을 지정하세요. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - '{0}'의 서식을 지정할 수 없습니다. 서식 지정은 현재 C# 및 Visual Basic 프로젝트만 지원합니다. + + + + Determining diagnostics... + 진단을 확인하는 중... + Determining formattable files. - 서식 지정 가능한 파일을 확인하는 중입니다. + + + + Failed to apply code fix {0} for {1}: {2} + {1}에 대한 코드 수정 사항 {0}을(를) 적용하지 못했습니다. {2} + Failed to save formatting changes. - 서식 변경 내용을 저장하지 못했습니다. + Fix end of line marker. - 줄의 끝 마커를 수정하세요. + Fix file encoding. - 파일 인코딩을 수정하세요. + Fix final newline. - 최종 줄 바꿈을 수정하세요. + Fix imports ordering. - 가져오기 순서를 수정하세요. + Fix whitespace formatting. - 공백 서식을 수정하세요. + + + + Fixing diagnostics... + 진단을 수정하는 중... + Format complete in {0}ms. - {0}ms 후 서식 지정이 완료됩니다. - - - Format files, but do not save changes to disk. - 파일의 형식을 지정하지만 변경 내용을 디스크에 저장하지 않습니다. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - 디스크에 변경 내용을 저장하지 않고 파일의 서식을 지정합니다. 서식이 지정된 파일이 있는 경우 0이 아닌 종료 코드로 종료됩니다. + Formatted {0} of {1} files. - {1}개 중 {0}개 파일의 서식을 지정했습니다. + Formatting code file '{0}'. - 코드 파일 '{0}'의 서식을 지정합니다. + Formatting code files in workspace '{0}'. - '{0}' 작업 영역에서 코드 파일의 서식을 지정합니다. + Include generated code files in formatting operations. - 서식 지정 작업에서 생성된 코드 파일을 포함합니다. + Loading workspace. - 작업 영역을 로드하는 중입니다. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + '{0}'에 여러 MSBuild 프로젝트 파일이 있습니다. <workspace> 인수를 사용하여 사용할 파일을 지정하세요. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. <workspace> 인수를 사용하여 사용할 파일을 지정하세요. - '{0}'에서 여러 MSBuild 프로젝트 파일을 찾았습니다. --workspace 옵션에 사용할 파일을 지정하세요. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + 타사 분석기를 실행하고 수정 사항을 적용합니다. + + + + Run code style analyzers and apply fixes. + 코드 스타일 분석기를 실행하고 수정 사항을 적용합니다. + + + + Running {0} analysis. + {0} 분석을 실행하고 있습니다. - '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. --workspace 옵션에 사용할 파일을 지정하세요. Running formatters. - 포맷터를 실행하는 중입니다. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 세부 정보 표시 수준을 설정합니다. 허용되는 값은 q[uiet], m[inimal], n[ormal], d[etailed] 및 diag[nostic]입니다. + Skipping referenced project '{0}'. - 참조된 프로젝트 '{0}'을(를) 건너뜁니다. + + + + Solution {0} has no projects + {0} 솔루션에 프로젝트가 없습니다. + The dotnet CLI version is '{0}'. - dotnet CLI 버전은 '{0}'입니다. - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - `--dry-run` 옵션은 사용되지 않습니다. 대신 `--dry-run` 옵션을 사용하세요. The file '{0}' does not appear to be a valid project or solution file. - '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. - - - The `--files` option is deprecated. Use the `--include` option instead. - - `--files` 옵션은 사용되지 않습니다. 대신 `--include` 옵션을 사용하세요. - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - `--folder` 옵션은 경로를 지정하는 데 사용되지 않습니다. `--folder` 옵션을 전달하되, 대신 프로젝트 인수를 사용하여 경로를 지정하세요. The project file '{0}' does not exist. - 프로젝트 파일 '{0}'이(가) 없습니다. + The solution file '{0}' does not exist. - 솔루션 파일 '{0}'이(가) 없습니다. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 수행할 솔루션 또는 프로젝트 파일입니다. 파일을 지정하지 않으면 명령이 현재 디렉터리에서 파일을 검색합니다. Formatted code file '{0}'. - 코드 파일 '{0}'의 서식을 지정했습니다. + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + {0}을(를) 수정할 수 없습니다. 코드 수정 사항 {1}은(는) 솔루션에서 모두 수정을 지원하지 않습니다. - `--workspace` 옵션은 사용되지 않습니다. 대신 `<project>` 인수를 사용하세요. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - MSBuild를 찾을 수 없습니다. 공식 설치 관리자를 사용하여 .NET SDK를 설치했는지 확인하세요. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - dotnet CLI를 찾을 수 없습니다. PATH에 있는지 확인하세요. + Unable to organize imports for '{0}'. The document is too complex. - '{0}'에 대한 가져오기를 구성할 수 없습니다. 문서가 너무 복잡합니다. + Using MSBuild.exe located in '{0}'. - '{0}'에 있는 MSBuild.exe를 사용합니다. + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - 작업 영역을 로드하는 동안 경고가 발생했습니다. 경고를 기록하려면 세부 정보 표시 옵션을 '진단' 수준으로 설정하세요. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + `<workspace>` 인수를 단순 파일 폴더로 처리할지 여부입니다. - `<project>` 경로를 파일 폴더로 처리할지 여부입니다. Writing formatting report to: '{0}'. - 서식 지정 보고서를 '{0}'에 쓰는 중입니다. + diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 3a316070fb2e..f09ff1b3f370 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - Lista względnych ścieżek plików lub folderów, które mają zostać wykluczone z formatowania. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - Lista względnych ścieżek plików lub folderów do uwzględnienia w formatowaniu. Wszystkie pliki są formatowane, jeśli wartość jest pusta. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Ścieżka do pliku rozwiązania, pliku projektu albo folderu zawierającego plik rozwiązania lub plik projektu. Jeśli ścieżka nie zostanie określona, zostanie użyty bieżący katalog. + Accepts a file path, which if provided, will produce a json report in the given directory. - Akceptuje ścieżkę pliku, która, jeśli zostanie podana, wygeneruje raport JSON w danym katalogu. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + Analizę ukończono w {0} ms. - W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą opcji --workspace. - - Cannot specify both folder and workspace options. + + Analyzer Reference + Odwołanie do analizatora - Nie można określić zarówno opcji obszaru roboczego, jak i folderu. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą argumentu <workspace>. - Nie można określić zarówno opcji folderu, jak i argumentu projektu. - - Cannot specify both project argument and workspace option. + + Code Style + Styl kodu - Nie można określić zarówno opcji obszaru roboczego, jak i argumentu projektu. Complete in {0}ms. - Wykonaj w {0} ms. + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Nie można znaleźć pliku rozwiązania lub projektu MSBuild w elemencie „{0}”. Określ plik do użycia za pomocą argumentu <workspace>. - Nie można znaleźć pliku rozwiązania lub projektu MSBuild w elemencie „{0}”. Określ plik do użycia za pomocą opcji --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Nie można sformatować elementu „{0}”. Obecnie format obsługuje tylko projekty C# i Visual Basic. + + + + Determining diagnostics... + Trwa określanie diagnostyki... + Determining formattable files. - Określanie plików, które można formatować. + + + + Failed to apply code fix {0} for {1}: {2} + Nie można zastosować poprawki kodu {0} dla elementu {1}: {2} + Failed to save formatting changes. - Nie można zapisać zmian formatowania. + Fix end of line marker. - Napraw znacznik końca wiersza. + Fix file encoding. - Napraw kodowanie pliku. + Fix final newline. - Napraw końcowy nowy wiersz. + Fix imports ordering. - Napraw kolejność importowania. + Fix whitespace formatting. - Napraw formatowanie odstępów. + + + + Fixing diagnostics... + Trwa naprawianie diagnostyki... + Format complete in {0}ms. - Formatowanie zakończono w {0} ms. - - - Format files, but do not save changes to disk. - Formatuj pliki, ale nie zapisuj zmian na dysku. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formatuje pliki bez zapisywania zmian na dysku. Kończy się niezerowym kodem zakończenia, jeśli zostały sformatowane jakiekolwiek pliki. + Formatted {0} of {1} files. - Sformatowano {0} z {1} plików. + Formatting code file '{0}'. - Formatowanie pliku kodu „{0}”. + Formatting code files in workspace '{0}'. - Formatowanie plików kodu w obszarze roboczym „{0}”. + Include generated code files in formatting operations. - Uwzględnij wygenerowane pliki kodu w operacjach formatowania. + Loading workspace. - Ładowanie obszaru roboczego. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + W elemencie „{0}” znaleziono wiele plików projektów MSBuild. Określ, którego użyć, za pomocą argumentu <workspace>. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą argumentu <workspace>. - W elemencie „{0}” znaleziono wiele plików projektów MSBuild. Określ, którego użyć, za pomocą opcji --workspace. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + Uruchom analizatory innych firm i zastosuj poprawki. + + + + Run code style analyzers and apply fixes. + Uruchom analizatory stylu kodu i zastosuj poprawki. + + + + Running {0} analysis. + Uruchamianie analizy {0}. - W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą opcji --workspace. Running formatters. - Uruchamianie elementów formatujących. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Ustaw poziom szczegółowości. Dozwolone wartości to q[uiet] (cicha), m[inimal] (minimalna), n[ormal] (normalna), d[etailed] (szczegółowa) i diag[nostic] (diagnostyczna) + Skipping referenced project '{0}'. - Pomijanie przywoływanego projektu „{0}”. + + + + Solution {0} has no projects + Rozwiązanie {0} nie zawiera projektów + The dotnet CLI version is '{0}'. - Wersja interfejsu wiersza polecenia dotnet to „{0}”. - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - Opcja „--dry-run” jest przestarzała. Zamiast tego użyj opcji „--check”. The file '{0}' does not appear to be a valid project or solution file. - Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. - - - The `--files` option is deprecated. Use the `--include` option instead. - - Opcja „--files” jest przestarzała. Zamiast tego użyj opcji „--include”. - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - Opcja „--folder” jest przestarzała na potrzeby określania ścieżki. Przekaż opcję „--folder”, ale zamiast tego określ ścieżkę przy użyciu argumentu projektu. The project file '{0}' does not exist. - Plik projektu „{0}” nie istnieje. + The solution file '{0}' does not exist. - Plik rozwiązania „{0}” nie istnieje. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Plik rozwiązania lub projektu, względem którego operacja ma być wykonana. Jeśli plik nie zostanie określony, polecenie wyszuka go w bieżącym katalogu. Formatted code file '{0}'. - Sformatowano plik kodu „{0}”. + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Nie można naprawić elementu {0}. Poprawka kodu {1} nie obsługuje opcji naprawiania wszystkich wystąpień w rozwiązaniu. - Opcja „--workspace” jest przestarzała. Zamiast tego użyj argumentu „<project>”. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Nie można zlokalizować programu MSBuild. Upewnij się, że zestaw .NET SDK został zainstalowany przy użyciu oficjalnego instalatora. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - Nie można zlokalizować wiersza polecenia dotnet. Upewnij się, że znajduje się on w ścieżce. + Unable to organize imports for '{0}'. The document is too complex. - Nie można zorganizować importów dla elementu „{0}”. Dokument jest zbyt złożony. + Using MSBuild.exe located in '{0}'. - Używanie pliku MSBuild.exe znajdującego się w lokalizacji „{0}”. + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Podczas ładowania obszaru roboczego napotkano ostrzeżenia. Ustaw opcję poziomu szczegółowości na wartość „diagnostyka”, aby rejestrować ostrzeżenia. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Określa, czy traktować argument „<workspace>” jako prosty folder plików. - Określa, czy traktować ścieżkę „<project>” jako folder plików Writing formatting report to: '{0}'. - Zapisywanie raportu formatowania w: „{0}”... + diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index a1b50cb0c31f..b16adc0b0490 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - Uma lista de caminhos de arquivo ou pasta relativos para excluir da formatação. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - Uma lista de caminhos de arquivo ou pasta relativos para incluir na formatação. Todos os arquivos serão formatados se estiverem vazios. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Um caminho para um arquivo de solução, um arquivo de projeto ou uma pasta contendo um arquivo de solução ou de projeto. Se não for especificado um caminho, o diretório atual será usado. + Accepts a file path, which if provided, will produce a json report in the given directory. - Aceita um caminho de arquivo, que, se fornecido, produzirá um relatório JSON no diretório especificado. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + Análise concluída em {0} ms. - Foram encontrados um arquivo de solução e um arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. - - Cannot specify both folder and workspace options. + + Analyzer Reference + Referência do Analisador - Não é possível especificar as opções pasta e workspace. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + Foram encontrados um arquivo de solução e um arquivo de projeto do MSBuild em '{0}'. Especifique qual será usado com o argumento <workspace>. - Não é possível especificar as opções de argumento e de pasta do projeto. - - Cannot specify both project argument and workspace option. + + Code Style + Estilo do Código - Não é possível especificar o argumento do projeto e a opção workspace. Complete in {0}ms. - Concluir em {0} ms. + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Não foi possível encontrar um arquivo de solução nem um arquivo de projeto do MSBuild em '{0}'. Especifique qual será usado com o argumento <workspace>. - Não foi possível encontrar um arquivo de solução ou arquivo de projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Não foi possível formatar '{0}'. O formato atualmente suporta apenas projetos do Visual Basic e C#. + + + + Determining diagnostics... + Determinando os diagnósticos... + Determining formattable files. - Determinando arquivos formatáveis. + + + + Failed to apply code fix {0} for {1}: {2} + Falha ao aplicar a correção de código {0} para {1}: {2} + Failed to save formatting changes. - Falha ao salvar alterações de formatação. + Fix end of line marker. - Corrigir o final do marcador de linha. + Fix file encoding. - Corrigir a codificação de arquivo. + Fix final newline. - Corrigir a nova linha final. + Fix imports ordering. - Corrigir a ordenação de importações. + Fix whitespace formatting. - Corrigir a formatação de espaço em branco. + + + + Fixing diagnostics... + Corrigindo os diagnósticos... + Format complete in {0}ms. - Formatação concluída em {0} ms. - - - Format files, but do not save changes to disk. - Arquivos de formato, mas não salva as alterações para o disco. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Formata arquivos sem salvar as alterações no disco. Termina com um código de saída diferente de zero se algum arquivo foi formatado. + Formatted {0} of {1} files. - {0} de {1} arquivos formatados. + Formatting code file '{0}'. - Arquivo de código de formatação '{0}'. + Formatting code files in workspace '{0}'. - Formatação de arquivos de código no espaço de trabalho '{0}'. + Include generated code files in formatting operations. - Incluir arquivos de código gerados em operações de formatação. + Loading workspace. - Carregando espaço de trabalho. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + Foram encontrados vários arquivos de projeto do MSBuild em '{0}'. Especifique qual será usado com o argumento <workspace>. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + Foram encontrados vários arquivos de solução do MSBuild em '{0}'. Especifique qual será usado com o argumento <workspace>. - Foram encontrados vários arquivos do projeto MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + Executar analisadores de terceiros e aplicar correções. + + + + Run code style analyzers and apply fixes. + Executar analisadores de estilo de código e aplicar correções. + + + + Running {0} analysis. + Executando a análise de {0}. - Foram encontrados vários arquivos de solução MSBuild em '{0}'. Especifique qual usar com a opção --espaço de trabalho. Running formatters. - Executando formatadores. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Defina o nível de detalhes. Os valores permitidos são q[uiet], m[inimal], n[ormal], d[etailed], e diag[nostic] + Skipping referenced project '{0}'. - Ignorando o projeto referenciado '{0}'. + + + + Solution {0} has no projects + A solução {0} não tem nenhum projeto + The dotnet CLI version is '{0}'. - A versão do CLI do dotnet é '{0}'. - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - A opção `--dry-run` foi preterida. Use a opção `--check` em vez disso. The file '{0}' does not appear to be a valid project or solution file. - O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. - - - The `--files` option is deprecated. Use the `--include` option instead. - - A opção `--files` foi preterida. Use a opção `--include` em vez disso. - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - A opção `--folder` foi preterida para especificar o caminho. Passe a opção `--folder`, mas especifique o caminho com o argumento do projeto. The project file '{0}' does not exist. - O arquivo de projeto '{0}' não existe. + The solution file '{0}' does not exist. - O arquivo de solução '{0}' não existe. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - O arquivo de projeto ou solução para operar. Se um arquivo não for especificado, o comando pesquisará o diretório atual para um. Formatted code file '{0}'. - Arquivo de código '{0}' formatado. + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Não é possível corrigir {0}. A correção de código {1} não dá suporte à opção Corrigir Tudo na Solução. - A opção `--workspace` foi preterida. Em vez disso, use o argumento `<project>`. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Não é possível localizar o MSBuild. Verifique se o SDK do .NET foi instalado com o instalador oficial. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - Não é possível localizar a CLI do dotnet. Verifique se está no CAMINHO. + Unable to organize imports for '{0}'. The document is too complex. - Não é possível organizar importações para '{0}'. O documento é muito complexo. + Using MSBuild.exe located in '{0}'. - Usando MSBuild.exe localizado em '{0}'. + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Foram encontrados avisos ao carregar o workspace. Defina a opção de detalhamento para o nível de 'diagnóstico' para registrar avisos. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Se o argumento `<workspace>` será tratado como uma simples pasta de arquivos. - Se o caminho `<project>` será tratado como uma pasta de arquivos. Writing formatting report to: '{0}'. - Gravando relatório de formatação em '{0}'. + diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 2c96718b7ea5..c44466907acc 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - Список относительных путей к файлам и папкам, исключаемым из форматирования. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - Список относительных путей к файлам и папкам, включаемым в форматирование. Если список пуст, форматируются все файлы. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Путь к файлу решения, файлу проекта или папке, содержащей файл решения или проекта. Если путь не указан, используется текущий каталог. + Accepts a file path, which if provided, will produce a json report in the given directory. - Принимает путь к файлу. Если путь к файлу указан, создает отчет JSON в указанном каталоге. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + Анализ завершен. Время анализа: {0} мс. - В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью параметра --workspace. - - Cannot specify both folder and workspace options. + + Analyzer Reference + Ссылка на анализатор - Невозможно одновременно указать параметры папки и рабочей области. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью аргумента <workspace>. - Невозможно одновременно указать аргумент проекта и параметры папки. - - Cannot specify both project argument and workspace option. + + Code Style + Стиль кода - Невозможно одновременно указать аргумент проекта и параметр рабочей области. Complete in {0}ms. - Завершено. Время выполнения: {0} мс. + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + Не удалось найти файл проекта или решения MSBuild в "{0}". Укажите используемый файл с помощью аргумента <workspace>. - Не удалось найти файл проекта или решения MSBuild в "{0}". Укажите используемый файл с параметром --workspace. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - Не удалось отформатировать "{0}". Форматирование сейчас поддерживается только для проектов C# и Visual Basic. + + + + Determining diagnostics... + Определение диагностики… + Determining formattable files. - Определение форматируемых файлов. + + + + Failed to apply code fix {0} for {1}: {2} + Не удалось применить исправление кода {0} для {1}: {2} + Failed to save formatting changes. - Не удалось сохранить изменения форматирования. + Fix end of line marker. - Исправить маркер конца строки. + Fix file encoding. - Исправить кодировку файла. + Fix final newline. - Исправить завершающий символ новой строки. + Fix imports ordering. - Исправить порядок импорта. + Fix whitespace formatting. - Исправить форматирование пробелов. + + + + Fixing diagnostics... + Исправление диагностики… + Format complete in {0}ms. - Форматирование завершено. Время выполнения: {0} мс. - - - Format files, but do not save changes to disk. - Форматировать файлы без сохранения изменений на диск. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Форматирует файлы без сохранения изменений на диск. Завершается с ненулевым кодом завершения, если были отформатированы какие-либо файлы. + Formatted {0} of {1} files. - Отформатировано файлов: {0} из {1}. + Formatting code file '{0}'. - Форматирование файла кода "{0}". + Formatting code files in workspace '{0}'. - Форматирование кода файлов в рабочей области "{0}". + Include generated code files in formatting operations. - Включить созданные файлы кода в операции форматирования. + Loading workspace. - Загрузка рабочей области. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + В "{0}" обнаружено несколько файлов проекта MSBuild. Укажите используемый файл с помощью аргумента <workspace>. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + В "{0}" обнаружено несколько файлов решения MSBuild. Укажите используемый файл с помощью аргумента <workspace>. - В "{0}" обнаружено несколько файлов проектов MSBuild. Укажите используемый файл с помощью параметра --workspace. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + Запустите сторонние анализаторы и примените исправления. + + + + Run code style analyzers and apply fixes. + Запустите анализаторы стиля кода и примените исправления. + + + + Running {0} analysis. + Выполнение анализа {0}. - В "{0}" обнаружено несколько файлов решений MSBuild. Укажите используемый файл с параметром --workspace. Running formatters. - Запуск средств форматирования. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Задает уровень детализации. Допустимые значения: q (без вывода подробных сведений), m (минимальный), n (нормальный), d (подробный) и diag (диагностика) + Skipping referenced project '{0}'. - Пропуск указанного проекта "{0}". + + + + Solution {0} has no projects + Решение {0} не содержит проектов. + The dotnet CLI version is '{0}'. - Версия CLI dotnet: "{0}". - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - Параметр "--dry-run" устарел. Используйте вместо него параметр "--check". The file '{0}' does not appear to be a valid project or solution file. - Файл "{0}" не является допустимым файлом проекта или решения. - - - The `--files` option is deprecated. Use the `--include` option instead. - - Параметр "--files" устарел. Используйте вместо него параметр "--include". - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - Параметр "--folder" не рекомендуется использовать для указания пути. Передайте параметр "--folder", но укажите путь не в этом параметре, а в аргументе проекта. The project file '{0}' does not exist. - Файл проекта "{0}" не существует. + The solution file '{0}' does not exist. - Файл решения "{0}" не существует. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Файл решения или проекта. Если файл не указан, команда будет искать этот файл в текущем каталоге. Formatted code file '{0}'. - Отформатированный файл кода "{0}". + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + Не удалось исправить {0}. Исправление кода {1} не поддерживает функцию "Исправить все в решении". - Параметр "--workspace" устарел. Используйте вместо него аргумент "<project>". Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - Не удается найти MSBuild. Убедитесь, что пакет SDK для .NET был установлен с официальным установщиком. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - Не удалось найти CLI dotnet. Убедитесь, что путь к нему добавлен в переменную среды PATH. + Unable to organize imports for '{0}'. The document is too complex. - Не удается организовать импорты для "{0}". Слишком сложный документ. + Using MSBuild.exe located in '{0}'. - Используется файл MSBuild.exe, расположенный в каталоге "{0}". + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - При загрузке рабочей области были обнаружены предупреждения. Задайте для параметра уровня детализации значение "Диагностика", чтобы вести журнал предупреждений. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + Следует ли рассматривать аргумент "<workspace>" как простую папку с файлами. - Следует ли обрабатывать путь "<project>" как папку с файлами. Writing formatting report to: '{0}'. - Запись отчета о форматировании в "{0}". + diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index cb77a466464e..41cfc5b8aff0 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - Biçimlendirmeden hariç tutulacak göreli dosya veya klasör yollarının listesi. + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - Biçimlendirmeye dahil edilecek göreli dosya veya klasör yollarının listesi. Boşsa, tüm dosyalar biçimlendirilir. + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + Çözüm dosyasının, proje dosyasının veya çözüm ya da proje dosyasını içeren klasörün yolu. Yol belirtilmezse geçerli dizin kullanılır. + Accepts a file path, which if provided, will produce a json report in the given directory. - Sağlanırsa, verilen dizinde json raporu oluşturacak bir dosya yolunu kabul eder. + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + Analiz {0} ms içinde tamamlandı. - Hem bir MSBuild proje dosyası ve çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. - - Cannot specify both folder and workspace options. + + Analyzer Reference + Çözümleyici Başvurusu - Hem klasör hem de çalışma alanı seçenekleri belirtilemez. - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + '{0}' içinde hem MSBuild proje dosyası hem de çözüm dosyası bulundu. Hangisinin <çalışma alanı> bağımsız değişkeni ile kullanılacağını belirtin. - Hem proje bağımsız değişkeni hem de klasör seçenekleri belirtilemez. - - Cannot specify both project argument and workspace option. + + Code Style + Kod Stili - Hem proje bağımsız değişkeni hem de çalışma alanı seçeneği belirtilemez. Complete in {0}ms. - {0} ms içinde tamamlayın. + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + '{0}' içinde MSBuild proje dosyası veya çözüm dosyası bulunamadı. Hangisinin <çalışma alanı> bağımsız değişkeni ile kullanılacağını belirtin. - Bir MSBuild proje dosyası veya çözüm dosyası '{0}' içinde bulunamadı. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - '{0}' biçiminde değil. Biçimi şu anda yalnızca C# ve Visual Basic projeleri desteklemektedir. + + + + Determining diagnostics... + Tanılama belirleniyor... + Determining formattable files. - Biçimlendirilebilir dosyalar belirleniyor. + + + + Failed to apply code fix {0} for {1}: {2} + {1} için {0} kod düzeltmesi uygulanamadı: {2} + Failed to save formatting changes. - Biçimlendirme değişiklikleri kaydedilemedi. + Fix end of line marker. - Satır sonu işaretçisini düzeltin. + Fix file encoding. - Dosya kodlamasını düzeltin. + Fix final newline. - Son yeni satırı düzeltin. + Fix imports ordering. - İçeri aktarma sıralamasını düzeltin. + Fix whitespace formatting. - Boşluk biçimlendirmesini düzeltin. + + + + Fixing diagnostics... + Tanılama düzeltiliyor... + Format complete in {0}ms. - Biçimlendirme {0} ms içinde tamamlandı. - - - Format files, but do not save changes to disk. - Dosyaları biçimlendir, ancak değişiklikleri diske kaydetme. Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - Değişiklikleri diske kaydetmeden dosyaları biçimlendirir. Herhangi bir dosya biçimlendirildiyse sıfır olmayan bir çıkış koduyla sonlandırılır. + Formatted {0} of {1} files. - {1} dosya içinden {0} dosya biçimlendirildi. + Formatting code file '{0}'. - Biçimlendirme kod dosyası '{0}'. + Formatting code files in workspace '{0}'. - Çalışma alanı '{0}' kod dosyalarında biçimlendirme. + Include generated code files in formatting operations. - Biçimlendirme işlemlerinde oluşturulan kod dosyalarını ekleyin. + Loading workspace. - Çalışma alanı yükleniyor. + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + '{0}' içinde birden fazla MSBuild proje dosyası bulundu. Hangisinin <çalışma alanı> bağımsız değişkeni ile kullanılacağını belirtin. + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + '{0}' içinde birden fazla MSBuild çözüm dosyası bulundu. Hangisinin <çalışma alanı> bağımsız değişkeni ile kullanılacağını belirtin. - Birden fazla MSBuild proje dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + 3. taraf çözümleyicileri çalıştırıp düzeltmeleri uygulayın. + + + + Run code style analyzers and apply fixes. + Kod stili çözümleyicilerini çalıştırıp düzeltmeleri uygulayın. + + + + Running {0} analysis. + {0} analizi çalıştırılıyor. - Birden fazla MSBuild çözüm dosyası '{0}' içinde bulundu. Hangi--çalışma alanı seçeneği ile kullanmak için belirtin. Running formatters. - Biçimlendiriciler çalıştırılıyor. + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - Ayrıntı düzeyini ayarlayın. İzin verilen değerler şunlardır: q [uiet], [inimal] m, n [nizamî], d [ayrıntılı] ve diag [nostic] + Skipping referenced project '{0}'. - Atlama projesi '{0}' başvuru. + + + + Solution {0} has no projects + {0} çözümünde proje yok + The dotnet CLI version is '{0}'. - dotnet CLI sürümü: '{0}'. - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - `--dry-run` seçeneği kullanım dışı bırakıldı. Bunun yerine `--check` seçeneğini kullanın. The file '{0}' does not appear to be a valid project or solution file. - '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. - - - The `--files` option is deprecated. Use the `--include` option instead. - - `--files` seçeneği kullanım dışı bırakıldı. Bunun yerine `--include` seçeneğini kullanın. - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - Yolu belirtmek için `--folder` seçeneği kullanım dışı bırakıldı. `--folder` seçeneğini geçirin ancak bunun yerine yolu, proje bağımsız değişkeniyle belirtin. The project file '{0}' does not exist. - Proje dosyası '{0}' yok. + The solution file '{0}' does not exist. - Çözüm dosyası '{0}' yok. - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - Ameliyat için çözüm ya da proje dosyasını. Bir dosya belirtilmezse, komut için bir geçerli dizini arar. Formatted code file '{0}'. - '{0}' kod dosyası biçimlendirildi. + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + {0} düzeltilemiyor. {1} kod düzeltmesi Çözümdeki Tümünü Onar seçeneğini desteklemiyor. - `--workspace` seçeneği kullanım dışı bırakıldı. Bunun yerine `<project>` bağımsız değişkenini kullanın. Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - MSBuild bulunamıyor. .NET SDK'nın resmi yükleyici kullanılarak yüklendiğinden emin olun. + Unable to locate dotnet CLI. Ensure that it is on the PATH. - dotnet CLI bulunamıyor. dotnet CLI'nin PATH üzerinde olduğundan emin olun. + Unable to organize imports for '{0}'. The document is too complex. - '{0}' için içeri aktarmalar düzenlenemiyor. Belge çok karmaşık. + Using MSBuild.exe located in '{0}'. - '{0}' içinde bulunan MSBuild.exe kullanılıyor. + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - Çalışma alanı yüklenirken uyarılarla karşılaşıldı. Uyarıları günlüğe kaydetmek için ayrıntı düzeyi seçeneğini 'tanılama' düzeyine ayarlayın. + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + `<çalışma alanı>` bağımsız değişkeninin basit bir dosya klasörü olarak değerlendirilip değerlendirilmeyeceğini belirtir. - `<project>` yolunun dosya klasörü olarak değerlendirilip değerlendirilmeyeceğini belirtir. Writing formatting report to: '{0}'. - Biçimlendirme raporu '{0}' konumuna yazılıyor. + diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index f33f72f0183c..11639ad75471 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - 不进行格式化的相对文件或文件夹路径的列表。 + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - 要进行格式化的相对文件或文件夹路径的列表。如果为空,则格式化所有文件。 + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + 指向解决方案文件、项目文件或包含解决方案或项目文件的文件夹的路径。如果未指定路径,则使用当前目录。 + Accepts a file path, which if provided, will produce a json report in the given directory. - 接受文件路径(若提供)将在给定目录中生成 json 报表。 + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + 将在 {0} 毫秒后完成分析。 - 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要将哪一个文件用于 --workspace 选项。 - - Cannot specify both folder and workspace options. + + Analyzer Reference + 分析器引用 - 不能同时指定文件夹和工作区选项。 - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要用于 <workspace> 参数的文件。 - 不能同时指定项目参数和文件夹选项。 - - Cannot specify both project argument and workspace option. + + Code Style + 代码样式 - 不能同时指定项目参数和工作区选项。 Complete in {0}ms. - 在 {0} 毫秒后完成。 + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + 无法在“{0}”中找到 MSBuild 项目文件或解决方案文件。请指定要用于 <workspace> 参数的文件。 - 无法在“{0}”中找到 MSBuild 项目文件或解决方案文件。请指定要用于 --workspace 选项的文件。 Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - 无法设置“{0}”的格式。该格式当前仅支持 C# 和 Visual Basic 项目。 + + + + Determining diagnostics... + 正在确定诊断… + Determining formattable files. - 正在确定可格式化的文件。 + + + + Failed to apply code fix {0} for {1}: {2} + 未能对 {1} 应用代码修复 {0}: {2} + Failed to save formatting changes. - 未能保存格式更改。 + Fix end of line marker. - 修复行尾标记。 + Fix file encoding. - 修复文件编码。 + Fix final newline. - 修复最后一个换行符。 + Fix imports ordering. - 修复导入顺序。 + Fix whitespace formatting. - 修复空格格式。 + + + + Fixing diagnostics... + 正在修复诊断… + Format complete in {0}ms. - 将在 {0} 毫秒后完成格式化。 - - - Format files, but do not save changes to disk. - 格式化文件, 但不将更改保存到磁盘。 Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - 将文件格式化且不将所作更改保存到磁盘中。如果有文件进行了格式化处理,则以非零退出代码终止。 + Formatted {0} of {1} files. - 已将 {0} 个文件格式化(共 {1} 个)。 + Formatting code file '{0}'. - 正在设置代码文件“{0}”的格式。 + Formatting code files in workspace '{0}'. - 正在设置工作区“{0}”中代码文件的格式。 + Include generated code files in formatting operations. - 在格式化操作中包含所生成的代码文件。 + Loading workspace. - 正在加载工作区。 + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + 在“{0}”中找到多个 MSBuild 项目文件。请指定要用于 <workspace> 参数的文件。 + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 <workspace> 参数的文件。 - 在“{0}”中找到多个 MSBuild 项目文件。请指定要将哪一个文件用于 --workspace 选项。 - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + 运行第三方分析器并应用修补程序。 + + + + Run code style analyzers and apply fixes. + 运行代码样式分析器并应用修补程序。 + + + + Running {0} analysis. + 正在运行 {0} 分析。 - 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 --workspace 选项的文件。 Running formatters. - 正在运行格式化程序。 + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 设置详细级别。允许的值为 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] + Skipping referenced project '{0}'. - 正在跳过引用的项目“{0}”。 + + + + Solution {0} has no projects + 解决方案 {0} 不包含任何项目 + The dotnet CLI version is '{0}'. - dotnet CLI 版本为“{0}”。 - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - "--dry-run" 选项已被弃用。请改用 "--check" 选项。 The file '{0}' does not appear to be a valid project or solution file. - 文件“{0}”似乎不是有效的项目或解决方案文件。 - - - The `--files` option is deprecated. Use the `--include` option instead. - - "--files" 选项已被弃用。请改用 "--include" 选项。 - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - "--folder" 选项已被弃用,无法用于指定路径。请传递 "--folder" 选项,但改为使用项目参数指定路径。 The project file '{0}' does not exist. - 项目文件“{0}” 不存在。 + The solution file '{0}' does not exist. - 解决方案文件“{0}”不存在。 - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 要操作的解决方案或项目文件。如果未指定文件,该命令将在当前目录中搜索一个文件。 Formatted code file '{0}'. - 已将代码文件“{0}”格式化。 + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + 无法修复 {0}。代码修补程序 {1} 不支持修复解决方案中的所有内容。 - "--workspace" 选项已被弃用。请改用 "<project>" 参数。 Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - 无法找到 MSBuild。请确保 .NET SDK 是与官方安装程序一起安装的。 + Unable to locate dotnet CLI. Ensure that it is on the PATH. - 找不到 dotnet CLI。请确保它在路径上。 + Unable to organize imports for '{0}'. The document is too complex. - 无法整理“{0}”的导入项。文档太复杂。 + Using MSBuild.exe located in '{0}'. - 使用“{0}”中的 MSBuild.exe。 + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - 加载工作区时遇到警告。要记录警告,请将“详细级别”选项设置为“诊断”级别。 + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + 是否将 "<workspace>" 参数视为文件的简单文件夹。 - 是否将 "<project>" 路径视为文件文件夹。 Writing formatting report to: '{0}'. - 正在将格式报表写入:“{0}”。 + diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index d06cfb80e934..c9535cbcb536 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -1,241 +1,256 @@  - + A list of relative file or folder paths to exclude from formatting. - 要從格式化作業中排除的檔案或資料夾相對路徑清單。 + A list of relative file or folder paths to include in formatting. All files are formatted if empty. - 要包含在格式化作業中的檔案或資料夾相對路徑清單。若保留空白,則會將所有檔案格式化。 + + + + A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. + 解決方案檔、專案檔,或包含解決方案或專案檔之資料夾的路徑。若未指定路徑,就會使用目前的目錄。 + Accepts a file path, which if provided, will produce a json report in the given directory. - 接受檔案路徑 (如果有提供) 將在指定的目錄中產生 json 報告。 + - - Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the --workspace option. + + Analysis complete in {0}ms. + 分析將於 {0} 毫秒後完成。 - 在 '{0}' 中同時找到 MSBuild 專案檔和解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 - - Cannot specify both folder and workspace options. + + Analyzer Reference + 分析器參考 - 無法同時指定資料夾和工作區選項。 - - Cannot specify both project argument and folder options. + + Both a MSBuild project file and solution file found in '{0}'. Specify which to use with the <workspace> agrument. + 在 '{0}' 中同時找到 MSBuild 專案檔與解決方案檔。請指定要用於 <workspace> 引數的檔案。 - 無法同時指定專案引數和資料夾選項。 - - Cannot specify both project argument and workspace option. + + Code Style + 程式碼樣式 - 無法同時指定專案引數和工作區選項。 Complete in {0}ms. - {0} 毫秒後完成。 + - - Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the --workspace option. + + Could not find a MSBuild project file or solution file in '{0}'. Specify which to use with the <workspace> argument. + 在 '{0}' 中找不到 MSBuild 專案檔或解決方案檔。請指定要用於 <workspace> 引數的檔案。 - 在 '{0}' 中找不到 MSBuild 專案檔或解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 Could not format '{0}'. Format currently supports only C# and Visual Basic projects. - 無法將 '{0}' 格式化。格式化目前只支援 C# 和 Visual Basic 專案。 + + + + Determining diagnostics... + 正在判斷診斷... + Determining formattable files. - 正在判斷可格式化的檔案。 + + + + Failed to apply code fix {0} for {1}: {2} + 無法為 {1} 套用程式碼修正 {0}: {2} + Failed to save formatting changes. - 無法儲存格式化變更。 + Fix end of line marker. - 修正行結尾標記。 + Fix file encoding. - 修正檔案編碼。 + Fix final newline. - 修正結尾換行。 + Fix imports ordering. - 修正匯入排序。 + Fix whitespace formatting. - 修正空白字元格式化。 + + + + Fixing diagnostics... + 正在修正診斷... + Format complete in {0}ms. - 格式化作業於 {0} 毫秒後完成。 - - - Format files, but do not save changes to disk. - 將檔案格式化,但不儲存變更到磁碟。 Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - 將檔案格式化,但不將變更儲存到磁碟。如果有任何檔案已格式化,則作業會終止,並產生非零的結束代碼。 + Formatted {0} of {1} files. - 已將 {0}/{1} 個檔案格式化。 + Formatting code file '{0}'. - 正在將程式碼檔案 '{0}' 格式化。 + Formatting code files in workspace '{0}'. - 正在將工作區 '{0}' 中的程式碼檔案格式化。 + Include generated code files in formatting operations. - 在格式化作業中包含產生的程式碼檔案。 + Loading workspace. - 正在載入工作區。 + + + + Multiple MSBuild project files found in '{0}'. Specify which to use with the <workspace> argument. + 在 '{0}' 中找到多個 MSBuild 專案檔。請指定要用於 <workspace> 引數的檔案。 + - - Multiple MSBuild project files found in '{0}'. Specify which to use with the --workspace option. + + Multiple MSBuild solution files found in '{0}'. Specify which to use with the <workspace> argument. + 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要用於 <workspace> 引數的檔案。 - 在 '{0}' 中找到多個 MSBuild 專案檔。請指定要搭配 --workspace 選項使用的檔案。 - - Multiple MSBuild solution files found in '{0}'. Specify which to use with the --workspace option. + + Run 3rd party analyzers and apply fixes. + 執行協力廠商分析器並套用修正。 + + + + Run code style analyzers and apply fixes. + 執行程式碼樣式分析器並套用修正。 + + + + Running {0} analysis. + 正在執行 {0} 分析。 - 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要搭配 --workspace 選項使用的檔案。 Running formatters. - 正在執行格式器。 + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - 設定詳細資訊層級。允許的值為 q[uiet]、m[inimal]、n[ormal]、d[etailed] 和 diag[nostic] + Skipping referenced project '{0}'. - 跳過參考的專案 '{0}’。 + + + + Solution {0} has no projects + 解決方案 {0} 沒有任何專案 + The dotnet CLI version is '{0}'. - dotnet CLI 版本為 '{0}'。 - - - The `--dry-run` option is deprecated. Use the `--check` option instead. - `--dry-run` 選項已淘汰。請改用 `--check` 選項。 The file '{0}' does not appear to be a valid project or solution file. - 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 - - - The `--files` option is deprecated. Use the `--include` option instead. - - `--files` 選項已淘汰。請改用 `--include` 選項。 - - - The `--folder` option is deprecated for specifying the path. Pass the `--folder` option but specify the path with the project argument instead. - 已淘汰使用 `--folder` 選項指定路徑的做法。請傳遞 `--folder` 選項,但改用專案引數指定路徑。 The project file '{0}' does not exist. - 專案檔 '{0}' 不存在。 + The solution file '{0}' does not exist. - 解決方案檔 '{0}' 不存在。 - - - The solution or project file to operate on. If a file is not specified, the command will search the current directory for one. - 要操作的解決方案或專案檔。若未指定檔案,該命令會在目前的目錄中搜尋一個檔案。 Formatted code file '{0}'. - 正在將程式碼檔案 '{0}' 格式化。 + - - The `--workspace` option is deprecated. Use the `<project>` argument instead. + + Unable to fix {0}. Code fix {1} doesn't support Fix All in Solution. + 無法修正 {0}。程式碼修正 {1} 不支援 [在解決方案中全部修正]。 - `--workspace` 選項已淘汰。請改用 `<project>` 引數。 Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer. - 找不到 MSBuild。請確認已使用正式安裝程式安裝了 .NET SDK。 + Unable to locate dotnet CLI. Ensure that it is on the PATH. - 找不到 dotnet CLI。請確認其位於 PATH 上。 + Unable to organize imports for '{0}'. The document is too complex. - 無法組織 '{0}' 的匯入。文件太複雜。 + Using MSBuild.exe located in '{0}'. - 正在使用位於 '{0}' 的 MSBuild.exe。 + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. - 載入工作區時發生警告。請將詳細程度選項設定為 [診斷] 層級以記錄警告。 + - - Whether to treat the `<project>` path as a folder of files. + + Whether to treat the `<workspace>` argument as a simple folder of files. + 是否要將 `<workspace>` 引數視為檔案的簡易資料夾。 - 是否要將 `<project>` 路徑視為檔案的資料夾。 Writing formatting report to: '{0}'. - 正在將格式化報告寫入: '{0}'。 + From 85f6e3f636f56d3acf14a373f4c8b16047a55d9d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 8 Jul 2020 11:35:57 -0700 Subject: [PATCH 1087/2702] Add original attribute back to xlf files --- src/xlf/Resources.cs.xlf | 2 +- src/xlf/Resources.de.xlf | 2 +- src/xlf/Resources.es.xlf | 2 +- src/xlf/Resources.fr.xlf | 2 +- src/xlf/Resources.it.xlf | 2 +- src/xlf/Resources.ja.xlf | 2 +- src/xlf/Resources.ko.xlf | 2 +- src/xlf/Resources.pl.xlf | 2 +- src/xlf/Resources.pt-BR.xlf | 2 +- src/xlf/Resources.ru.xlf | 2 +- src/xlf/Resources.tr.xlf | 2 +- src/xlf/Resources.zh-Hans.xlf | 2 +- src/xlf/Resources.zh-Hant.xlf | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 6cd9f2fef429..e36838544388 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index d69fe88c874c..811907f1bded 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 7f4bac40449c..ccca3a188dba 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 1626cb3dd450..213e9a062a27 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 2b3e85a9fa04..e2a3c9a79cc8 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 760505041378..1632d727ff04 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 0aef38487910..42193129944e 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 157249e2ade7..636862d854b7 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index b6174c91189a..33b2404dbf12 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 4fa9ca87493d..bc2bfc0d7d09 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 47e5dccf42ae..3468b3970900 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 7bb4a6bec3df..edd07603b7b3 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 86d143cf97e6..351835105527 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -1,6 +1,6 @@  - + A list of relative file or folder paths to exclude from formatting. From 0aae0a6ff6e87c04f9fc23214762a38b1695689d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 15 Jul 2020 23:53:27 +0000 Subject: [PATCH 1088/2702] Update dependencies from https://github.com/dotnet/arcade build 20200714.3 (#733) Microsoft.DotNet.Arcade.Sdk From Version 5.0.0-beta.20330.3 -> To Version 5.0.0-beta.20364.3 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 +- eng/common/SetupNugetSources.ps1 | 12 ++-- eng/common/SetupNugetSources.sh | 41 +++++++------ eng/common/performance/performance-setup.ps1 | 5 ++ eng/common/performance/performance-setup.sh | 4 ++ eng/common/post-build/symbols-validation.ps1 | 2 +- eng/common/templates/job/job.yml | 12 ++++ .../channels/generic-internal-channel.yml | 4 ++ .../templates/post-build/post-build.yml | 60 ++++++++++++------- eng/common/tools.ps1 | 2 +- global.json | 2 +- 11 files changed, 93 insertions(+), 55 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b63ea7802e0c..2c0b67878f00 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 243cc92161ad44c2a07464425892daee19121c99 + ff5d4b6c8dbdaeacb6e6159d3f8185118dffd915 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index c3c473eb83e6..dc22178125a6 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -128,16 +128,16 @@ $userName = "dn-bot" # Insert credential nodes for Maestro's private feeds InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -Password $Password -$dotnet3Source = $sources.SelectSingleNode("add[@key='dotnet3']") -if ($dotnet3Source -ne $null) { - AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password - AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password -} - $dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']") if ($dotnet31Source -ne $null) { AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password } +$dotnet5Source = $sources.SelectSingleNode("add[@key='dotnet5']") +if ($dotnet5Source -ne $null) { + AddPackageSource -Sources $sources -SourceName "dotnet5-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password + AddPackageSource -Sources $sources -SourceName "dotnet5-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password +} + $doc.Save($filename) diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index 7d6fef27fe49..f33e37711e72 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -79,53 +79,52 @@ fi PackageSources=() -# Ensure dotnet3-internal and dotnet3-internal-transport are in the packageSources if the public dotnet3 feeds are present -grep -i "" $ConfigFile + grep -i "" + PackageSourceTemplate="${TB}" sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile fi - PackageSources+=('dotnet3-internal') + PackageSources+=('dotnet3.1-internal') - grep -i "" $ConfigFile if [ "$?" != "0" ]; then - echo "Adding dotnet3-internal-transport to the packageSources." + echo "Adding dotnet3.1-internal-transport to the packageSources." PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" + PackageSourceTemplate="${TB}" sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile fi - PackageSources+=('dotnet3-internal-transport') + PackageSources+=('dotnet3.1-internal-transport') fi -# Ensure dotnet3.1-internal and dotnet3.1-internal-transport are in the packageSources if the public dotnet3.1 feeds are present -grep -i "" + PackageSourceTemplate="${TB}" sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile fi - PackageSources+=('dotnet3.1-internal') + PackageSources+=('dotnet5-internal') - grep -i "" $ConfigFile + grep -i "" $ConfigFile if [ "$?" != "0" ]; then - echo "Adding dotnet3.1-internal-transport to the packageSources." + echo "Adding dotnet5-internal-transport to the packageSources." PackageSourcesNodeFooter="" - PackageSourceTemplate="${TB}" + PackageSourceTemplate="${TB}" sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile fi - PackageSources+=('dotnet3.1-internal-transport') + PackageSources+=('dotnet5-internal-transport') fi # I want things split line by line diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index 31a99e49015f..656c0bd9022c 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -54,6 +54,11 @@ if ($Internal) { $HelixSourcePrefix = "official" } +if($MonoInterpreter) +{ + $ExtraBenchmarkDotNetArguments = "--category-exclusion-filter NoInterpreter" +} + if($MonoDotnet -ne "") { $Configurations += " LLVM=$LLVM MonoInterpreter=$MonoInterpreter MonoAOT=$MonoAOT" diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 9409e4d85e92..c87cbf0fc232 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -191,6 +191,10 @@ if [[ "$mono_dotnet" != "" ]]; then configurations="$configurations LLVM=$llvm MonoInterpreter=$monointerpreter MonoAOT=$monoaot" fi +if [[ "$monointerpreter" == "true" ]]; then + extra_benchmark_dotnet_arguments="--category-exclusion-filter NoInterpreter" +fi + common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture" setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 index 495428ea2b51..a36fa6f26bcd 100644 --- a/eng/common/post-build/symbols-validation.ps1 +++ b/eng/common/post-build/symbols-validation.ps1 @@ -144,7 +144,7 @@ $CountMissingSymbols = { if ($MissingSymbols -ne 0) { - Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $MissingSymbols modules in the package $FileName" + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $MissingSymbols modules in the package $PackagePath" } Pop-Location diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index c08bb416d562..e78ed9a1c6ec 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -65,6 +65,9 @@ jobs: - ${{ if ne(parameters.enableTelemetry, 'false') }}: - name: DOTNET_CLI_TELEMETRY_PROFILE value: '$(Build.Repository.Uri)' + - ${{ if eq(parameters.enableRichCodeNavigation, 'true') }}: + - name: EnableRichCodeNavigation + value: 'true' - ${{ each variable in parameters.variables }}: # handle name-value variable syntax # example: @@ -124,6 +127,15 @@ jobs: - ${{ each step in parameters.steps }}: - ${{ step }} + - ${{ if eq(parameters.enableRichCodeNavigation, true) }}: + - task: RichCodeNavIndexer@0 + displayName: RichCodeNav Upload + inputs: + languages: 'csharp' + environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'prod') }} + richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin + continueOnError: true + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: MicroBuildCleanup@1 diff --git a/eng/common/templates/post-build/channels/generic-internal-channel.yml b/eng/common/templates/post-build/channels/generic-internal-channel.yml index 258ba4b7706d..12db36ebe74f 100644 --- a/eng/common/templates/post-build/channels/generic-internal-channel.yml +++ b/eng/common/templates/post-build/channels/generic-internal-channel.yml @@ -35,6 +35,10 @@ stages: pool: vmImage: 'windows-2019' steps: + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: DownloadBuildArtifacts@0 displayName: Download Build Assets continueOnError: true diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 07fc2e982df1..0e79a546b553 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -46,15 +46,16 @@ parameters: NETCoreExperimentalChannelId: 562 NetEngServicesIntChannelId: 678 NetEngServicesProdChannelId: 679 - Net5Preview5ChannelId: 857 - Net5Preview6ChannelId: 1013 Net5Preview7ChannelId: 1065 + Net5Preview8ChannelId: 1155 + Net5RC1ChannelId: 1157 NetCoreSDK313xxChannelId: 759 NetCoreSDK313xxInternalChannelId: 760 NetCoreSDK314xxChannelId: 921 NetCoreSDK314xxInternalChannelId: 922 VS166ChannelId: 1010 VS167ChannelId: 1011 + VS168ChannelId: 1154 VSMasterChannelId: 1012 stages: @@ -114,7 +115,7 @@ stages: inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 arguments: -PromoteToChannels "$(TargetChannels)" - -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview5ChannelId}},${{parameters.Net5Preview6ChannelId}},${{parameters.Net5Preview7ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VSMasterChannelId}} + -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview7ChannelId}},${{parameters.Net5Preview8ChannelId}},${{parameters.Net5RC1ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}} - job: displayName: NuGet Validation @@ -275,41 +276,41 @@ stages: dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_Preview5_Publish' - channelName: '.NET 5 Preview 5' - akaMSChannelName: 'net5/preview5' - channelId: ${{ parameters.Net5Preview5ChannelId }} + stageName: 'Net5_Preview7_Publish' + channelName: '.NET 5 Preview 7' + akaMSChannelName: 'net5/preview7' + channelId: ${{ parameters.Net5Preview7ChannelId }} transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + - template: \eng\common\templates\post-build\channels\generic-internal-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_Preview6_Publish' - channelName: '.NET 5 Preview 6' - akaMSChannelName: 'net5/preview6' - channelId: ${{ parameters.Net5Preview6ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' + stageName: 'Net5_Preview8_Publish' + channelName: '.NET 5 Preview 8' + akaMSChannelName: 'net5/preview8' + channelId: ${{ parameters.Net5Preview8ChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-symbols/nuget/v3/index.json' - - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + - template: \eng\common\templates\post-build\channels\generic-internal-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_Preview7_Publish' - channelName: '.NET 5 Preview 7' - akaMSChannelName: 'net5/preview7' - channelId: ${{ parameters.Net5Preview7ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' + stageName: 'Net5_RC1_Publish' + channelName: '.NET 5 RC 1' + akaMSChannelName: 'net5/rc1' + channelId: ${{ parameters.Net5RC1ChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-symbols/nuget/v3/index.json' - template: \eng\common\templates\post-build\channels\generic-public-channel.yml parameters: @@ -509,6 +510,19 @@ stages: shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'VS16_8_Publishing' + channelName: 'VS 16.8' + channelId: ${{ parameters.VS168ChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index d68684e2a166..6f8bc41116b7 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -385,7 +385,7 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { Create-Directory $packageDir Write-Host "Downloading $packageName $packageVersion" $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - Invoke-WebRequest "https://dotnet.myget.org/F/roslyn-tools/api/v2/package/$packageName/$packageVersion/" -OutFile $packagePath + Invoke-WebRequest "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/flat2/$packageName/$packageVersion/$packageName.$packageVersion.nupkg" -OutFile $packagePath Unzip $packagePath $packageDir } diff --git a/global.json b/global.json index c9bb4b4b2544..ea83bbe269c5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-preview.6.20310.4" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20330.3" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20364.3" } } From d3f30745d1314333c0f268e9684fbe94e88aaf09 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 17 Jul 2020 12:03:31 +0000 Subject: [PATCH 1089/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200717.1 Microsoft.NETCore.Compilers From Version 3.7.0-3.20312.3 -> To Version 3.7.0-5.20367.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2c0b67878f00..6a2b6878fc2c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ec4841263590f5456e32728d98097e97c1605e22 + f96dcbb6597fcc801970ee09688e733b64ce9040 diff --git a/eng/Versions.props b/eng/Versions.props index aea8653a87d3..7c1bd436118d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.7.0-3.20312.3 + 3.7.0-5.20367.1 3.1.1 - 3.7.0-5.20367.1 + 3.8.0-1.20367.11 3.1.1 - 3.8.0-1.20367.11 + 3.7.0-5.20367.1 3.1.1 - 3.7.0-5.20367.1 + 3.8.0-1.20367.11 3.1.1 + 2.1.0-rc1 LatestMajor true From c07f767060676af75d2ee79c2864f9586651b803 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2020 15:34:15 +0000 Subject: [PATCH 1096/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200721.14 (#740) Microsoft.NETCore.Compilers From Version 3.8.0-1.20367.11 -> To Version 3.8.0-1.20371.14 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 957ea244529b..ed506c082aa3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - fb7b2e716d163b7abebf57db505e01a4a521ddae + ad5096d80a47fb7aa5dbce164fa042804f6a7422 diff --git a/eng/Versions.props b/eng/Versions.props index 930d11a57402..02fff94695e0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.8.0-1.20367.11 + 3.8.0-1.20371.14 3.1.1 - 3.8.0-1.20371.14 + 3.8.0-2.20379.3 3.1.1 - 3.8.0-2.20379.3 + 3.8.0-2.20407.3 3.1.1 + + + + \ No newline at end of file From fb99404c312df98107b68800899bbdd10ed5ee81 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 7 Aug 2020 14:50:41 -0700 Subject: [PATCH 1103/2702] Fix drop path --- azure-pipelines-official.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index ca5c5886cd14..cd752de2f5cf 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -36,7 +36,6 @@ stages: - script: eng\common\CIBuild.cmd -configuration $(BuildConfiguration) /p:OfficialBuildId=$(Build.BuildNumber) - /p:VisualStudioDropName=$(VisualStudioDropName) /p:DotNetSignType=$(SignType) /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) @@ -48,7 +47,7 @@ stages: - task: NuGetPublisher@0 displayName: Publish NuGet Packages to MyGet inputs: - searchPattern: 'artifacts\packages\$(BuildConfiguration)\Shipping\*.nupkg' + searchPattern: '$(Build.SourcesDirectory)\artifacts\packages\$(BuildConfiguration)\Shipping\*.nupkg' connectedServiceName: 'dotnet-format - NuGet feed' nuGetVersion: 4.0.0.2283 condition: succeeded() @@ -65,7 +64,7 @@ stages: displayName: Publish Test Results inputs: testRunner: XUnit - testResultsFiles: 'artifacts/TestResults/$(BuildConfiguration)/*.xml' + testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(BuildConfiguration)\*.xml' mergeTestResults: true testRunTitle: 'Unit Tests' condition: always() @@ -75,7 +74,7 @@ stages: - task: PublishBuildArtifacts@1 displayName: Publish Artifact Packages inputs: - PathtoPublish: 'artifacts\packages\$(BuildConfiguration)' + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\packages\$(BuildConfiguration)' ArtifactName: 'PackageArtifacts' condition: succeeded() From 132b227fe0225b1d38e7eec1eb620b9d42c44e07 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 7 Aug 2020 16:19:35 -0700 Subject: [PATCH 1104/2702] Official build tweaks --- azure-pipelines-official.yml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index cd752de2f5cf..0a757f409c7c 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -36,6 +36,7 @@ stages: - script: eng\common\CIBuild.cmd -configuration $(BuildConfiguration) /p:OfficialBuildId=$(Build.BuildNumber) + /p:VisualStudioDropName=$(VisualStudioDropName) /p:DotNetSignType=$(SignType) /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) @@ -44,6 +45,15 @@ stages: /p:DotnetPublishUsingPipelines=true displayName: Build + - task: PublishTestResults@2 + displayName: Publish XUnit Test Results + inputs: + testRunner: XUnit + testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(BuildConfiguration)\*.xml' + mergeTestResults: true + testRunTitle: 'Unit Tests' + condition: always() + - task: NuGetPublisher@0 displayName: Publish NuGet Packages to MyGet inputs: @@ -57,22 +67,22 @@ stages: inputs: PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' ArtifactName: 'Logs' + publishLocation: Container continueOnError: true condition: not(succeeded()) - - task: PublishTestResults@1 - displayName: Publish Test Results + - task: PublishBuildArtifacts@1 + displayName: Publish Logs inputs: - testRunner: XUnit - testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(BuildConfiguration)\*.xml' - mergeTestResults: true - testRunTitle: 'Unit Tests' - condition: always() + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)' + ArtifactName: 'TestResults' + publishLocation: Container + condition: not(succeeded()) # Publish our NuPkgs as an artifact. The name of this artifact must be PackageArtifacts as the # arcade templates depend on the name.' - task: PublishBuildArtifacts@1 - displayName: Publish Artifact Packages + displayName: Publish Packages inputs: PathtoPublish: '$(Build.SourcesDirectory)\artifacts\packages\$(BuildConfiguration)' ArtifactName: 'PackageArtifacts' @@ -94,9 +104,8 @@ stages: displayName: Publish MicroBuild Artifacts inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)\MicroBuild\Output' - ArtifactName: '$(Build.BuildNumber)' - publishLocation: FilePath - TargetPath: '$(DropRoot)\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)' + ArtifactName: MicroBuildOutputs + publishLocation: Container condition: succeededOrFailed() # Publish to Build Asset Registry From c9f8f141a24439c789be52b97fff1ae784cc9284 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 11:15:24 -0700 Subject: [PATCH 1105/2702] Update Formatter tests to allow fixing CodeStyle and Analyzers --- tests/Analyzers/FilterDiagnosticsTests.cs | 3 - tests/Formatters/AbstractFormatterTests.cs | 48 +++++++++++----- tests/Formatters/CharsetFormatterTests.cs | 4 +- tests/Formatters/EndOfLineFormatterTests.cs | 10 ++-- .../Formatters/FinalNewlineFormatterTests.cs | 56 ++++++------------- 5 files changed, 55 insertions(+), 66 deletions(-) diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs index a874f6538c6d..2adce2a1fb1f 100644 --- a/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Tools.Analyzers; using Microsoft.CodeAnalysis.Tools.Formatters; diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 4c0b4e5e2a6f..d9a60ad772d0 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -87,24 +87,42 @@ private protected string ToEditorConfig(IReadOnlyDictionary edit { string.Join(Environment.NewLine, editorConfig.Select(kvp => $"{kvp.Key} = {kvp.Value}")) } "; - private protected Task TestAsync(string testCode, string expectedCode, IReadOnlyDictionary editorConfig) + private protected Task AssertCodeUnchangedAsync( + string code, + IReadOnlyDictionary editorConfig, + Encoding encoding = null, + bool fixCodeStyle = false, + DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, + bool fixAnalyzers = false, + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { - return TestAsync(testCode, expectedCode, editorConfig, Encoding.UTF8); + return AssertCodeChangedAsync(code, code, ToEditorConfig(editorConfig), encoding, fixCodeStyle, codeStyleSeverity, fixAnalyzers, analyzerSeverity); } - private protected Task TestAsync(string testCode, string expectedCode, string editorConfigText) + private protected Task AssertCodeChangedAsync( + string testCode, + string expectedCode, + IReadOnlyDictionary editorConfig, + Encoding encoding = null, + bool fixCodeStyle = false, + DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, + bool fixAnalyzers = false, + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { - return TestAsync(testCode, expectedCode, editorConfigText, Encoding.UTF8); + return AssertCodeChangedAsync(testCode, expectedCode, ToEditorConfig(editorConfig), encoding, fixCodeStyle, codeStyleSeverity, fixAnalyzers, analyzerSeverity); } - private protected Task TestAsync(string testCode, string expectedCode, IReadOnlyDictionary editorConfig, Encoding encoding) + private protected async Task AssertCodeChangedAsync( + string testCode, + string expectedCode, + string editorConfig, + Encoding encoding = null, + bool fixCodeStyle = false, + DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, + bool fixAnalyzers = false, + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { - return TestAsync(testCode, expectedCode, ToEditorConfig(editorConfig), encoding); - } - - private protected async Task TestAsync(string testCode, string expectedCode, string editorConfig, Encoding encoding) - { - var text = SourceText.From(testCode, encoding); + var text = SourceText.From(testCode, encoding ?? Encoding.UTF8); TestState.Sources.Add(text); var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), editorConfig); @@ -116,10 +134,10 @@ private protected async Task TestAsync(string testCode, string expec workspaceFilePath: project.FilePath, workspaceType: WorkspaceType.Folder, logLevel: LogLevel.Trace, - fixCodeStyle: false, - codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + fixCodeStyle, + codeStyleSeverity, + fixAnalyzers, + analyzerSeverity, saveFormattedFiles: false, changesAreErrors: false, fileMatcher, diff --git a/tests/Formatters/CharsetFormatterTests.cs b/tests/Formatters/CharsetFormatterTests.cs index dbbcd81ede8b..96bb2ff0c276 100644 --- a/tests/Formatters/CharsetFormatterTests.cs +++ b/tests/Formatters/CharsetFormatterTests.cs @@ -47,7 +47,7 @@ public async Task TestCharsetWrong_CharsetFixed(string codeValue, string expecte ["charset"] = expectedValue, }; - var formattedText = await TestAsync(testCode, testCode, editorConfig, codeEncoding); + var formattedText = await AssertCodeUnchangedAsync(testCode, editorConfig, codeEncoding); Assert.Equal(expectedEncoding, formattedText.Encoding); } @@ -64,7 +64,7 @@ public async Task TestCharsetNotSpecified_NoChange() { }; - var formattedText = await TestAsync(testCode, testCode, editorConfig, codeEncoding); + var formattedText = await AssertCodeUnchangedAsync(testCode, editorConfig, codeEncoding); Assert.Equal(codeEncoding, formattedText.Encoding); } diff --git a/tests/Formatters/EndOfLineFormatterTests.cs b/tests/Formatters/EndOfLineFormatterTests.cs index e5162afbf505..df06638c1fe3 100644 --- a/tests/Formatters/EndOfLineFormatterTests.cs +++ b/tests/Formatters/EndOfLineFormatterTests.cs @@ -32,7 +32,7 @@ public async Task TestEndOfLine_NoFinalNewline(string codeNewline, string expect ["end_of_line"] = endOfLine, }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Theory] @@ -56,7 +56,7 @@ public async Task TestEndOfLine_WithFinalNewline(string codeNewline, string expe ["end_of_line"] = endOfLine, }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Theory] @@ -67,11 +67,9 @@ public async Task TestEndOfLine_AndNoSetting_NoChanges(string codeNewline) { var testCode = $"class C{codeNewline}{{{codeNewline}}}{codeNewline}"; - var editorConfig = new Dictionary() - { - }; + var editorConfig = new Dictionary(); - await TestAsync(testCode, testCode, editorConfig); + await AssertCodeUnchangedAsync(testCode, editorConfig); } } } diff --git a/tests/Formatters/FinalNewlineFormatterTests.cs b/tests/Formatters/FinalNewlineFormatterTests.cs index 01b71c860db2..a305c545d038 100644 --- a/tests/Formatters/FinalNewlineFormatterTests.cs +++ b/tests/Formatters/FinalNewlineFormatterTests.cs @@ -14,12 +14,7 @@ public class FinalNewlineFormatterTests : CSharpFormatterTests [Fact] public async Task WhenFinalNewlineUnspecified_AndFinalNewlineMissing_NoChange() { - var testCode = @" -class C -{ -}"; - - var expectedCode = @" + var code = @" class C { }"; @@ -29,19 +24,13 @@ class C ["end_of_line"] = "crlf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeUnchangedAsync(code, editorConfig); } [Fact] public async Task WhenFinalNewlineUnspecified_AndFinalNewlineExits_NoChange() { - var testCode = @" -class C -{ -} -"; - - var expectedCode = @" + var code = @" class C { } @@ -52,7 +41,7 @@ class C ["end_of_line"] = "crlf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeUnchangedAsync(code, editorConfig); } [Fact] @@ -68,7 +57,7 @@ public async Task WhenFinalNewlineRequired_AndEndOfLineIsLineFeed_LineFeedAdded( ["end_of_line"] = "lf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] @@ -84,7 +73,7 @@ public async Task WhenFinalNewlineRequired_AndEndOfLineIsCarriageReturnLineFeed_ ["end_of_line"] = "crlf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] @@ -100,18 +89,12 @@ public async Task WhenFinalNewlineRequired_AndEndOfLineIsCarriageReturn_Carriage ["end_of_line"] = "cr", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] public async Task WhenFinalNewlineRequired_AndFinalNewlineExits_NoChange() { - var testCode = @" -class C -{ -} -"; - - var expectedCode = @" + var code = @" class C { } @@ -123,7 +106,7 @@ class C ["end_of_line"] = "crlf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeUnchangedAsync(code, editorConfig); } [Fact] @@ -139,7 +122,7 @@ public async Task WhenFinalNewlineUnwanted_AndFinalNewlineExists_CarriageReturnL ["end_of_line"] = "crlf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] @@ -155,7 +138,7 @@ public async Task WhenFinalNewlineUnwanted_AndFinalNewlineExists_LineFeedRemoved ["end_of_line"] = "crlf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] @@ -171,18 +154,13 @@ public async Task WhenFinalNewlineUnwanted_AndFinalNewlineExists_CarriageReturnR ["end_of_line"] = "crlf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] public async Task WhenFinalNewlineUnwanted_AndFinalNewlineMissing_NoChange() { - var testCode = @" -class C -{ -}"; - - var expectedCode = @" + var code = @" class C { }"; @@ -193,15 +171,13 @@ class C ["end_of_line"] = "crlf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeUnchangedAsync(code, editorConfig); } [Fact] public async Task WhenFinalNewlineUnwanted_AndFileIsEmpty_NoChange() { - var testCode = @""; - - var expectedCode = @""; + var code = @""; var editorConfig = new Dictionary() { @@ -209,7 +185,7 @@ public async Task WhenFinalNewlineUnwanted_AndFileIsEmpty_NoChange() ["end_of_line"] = "crlf", }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeUnchangedAsync(code, editorConfig); } } } From 6ef261d5dda044ea326fe32015cde8a12b483005 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 11:16:14 -0700 Subject: [PATCH 1106/2702] Add Remove Import fixer string --- src/Resources.resx | 3 +++ src/xlf/Resources.cs.xlf | 5 +++++ src/xlf/Resources.de.xlf | 5 +++++ src/xlf/Resources.es.xlf | 5 +++++ src/xlf/Resources.fr.xlf | 5 +++++ src/xlf/Resources.it.xlf | 5 +++++ src/xlf/Resources.ja.xlf | 5 +++++ src/xlf/Resources.ko.xlf | 5 +++++ src/xlf/Resources.pl.xlf | 5 +++++ src/xlf/Resources.pt-BR.xlf | 5 +++++ src/xlf/Resources.ru.xlf | 5 +++++ src/xlf/Resources.tr.xlf | 5 +++++ src/xlf/Resources.zh-Hans.xlf | 5 +++++ src/xlf/Resources.zh-Hant.xlf | 5 +++++ 14 files changed, 68 insertions(+) diff --git a/src/Resources.resx b/src/Resources.resx index 7a329aa21bbf..96140ddf60dc 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -270,4 +270,7 @@ Unable to fix {0}. No associated code fix found. + + Remove unnecessary import. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index e36838544388..34a824e37f38 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -152,6 +152,11 @@ {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí argumentu <workspace>. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. Spustit analyzátory třetích stran a použít opravy diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 811907f1bded..4e18e09947e5 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -152,6 +152,11 @@ In "{0}" wurden mehrere MSBuild-Projektmappendateien gefunden. Geben Sie die zu verwendende Datei mit dem <workspace>-Argument an. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. Führen Sie Drittanbieter-Analysetools aus, und wenden Sie Korrekturen an. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index ccca3a188dba..160a6386e30c 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -152,6 +152,11 @@ Se encontraron varios archivos de solución MSBuild en "{0}". Especifique cuál debe usarse con el argumento <workspace>. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. Ejecute analizadores de terceros y aplique las correcciones. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 213e9a062a27..36f46a479bdf 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -152,6 +152,11 @@ Plusieurs fichiers solution MSBuild trouvés dans '{0}'. Spécifiez celui qui doit être utilisé avec l'argument <espace de travail>. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. Exécutez des analyseurs tiers et appliquez des correctifs. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index e2a3c9a79cc8..b0243b17d59c 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -152,6 +152,11 @@ In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'argomento <workspace>. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. Esegue gli analizzatori di terze parti e applica le correzioni. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 1632d727ff04..760837564e46 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -152,6 +152,11 @@ 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するものを <workspace> 引数で指定してください。 + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. サード パーティのアナライザーを実行し、修正プログラムを適用します。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 42193129944e..0c67a8d9b892 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -152,6 +152,11 @@ '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. <workspace> 인수를 사용하여 사용할 파일을 지정하세요. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. 타사 분석기를 실행하고 수정 사항을 적용합니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 636862d854b7..401a2d4f4326 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -152,6 +152,11 @@ W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą argumentu <workspace>. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. Uruchom analizatory innych firm i zastosuj poprawki. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 33b2404dbf12..32f5704c658c 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -152,6 +152,11 @@ Foram encontrados vários arquivos de solução do MSBuild em '{0}'. Especifique qual será usado com o argumento <workspace>. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. Executar analisadores de terceiros e aplicar correções. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index bc2bfc0d7d09..6298dd6194fd 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -152,6 +152,11 @@ В "{0}" обнаружено несколько файлов решения MSBuild. Укажите используемый файл с помощью аргумента <workspace>. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. Запустите сторонние анализаторы и примените исправления. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 3468b3970900..36e71f00a0cc 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -152,6 +152,11 @@ '{0}' içinde birden fazla MSBuild çözüm dosyası bulundu. Hangisinin <çalışma alanı> bağımsız değişkeni ile kullanılacağını belirtin. + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. 3. taraf çözümleyicileri çalıştırıp düzeltmeleri uygulayın. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index edd07603b7b3..de99c2b9d037 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -152,6 +152,11 @@ 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 <workspace> 参数的文件。 + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. 运行第三方分析器并应用修补程序。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 351835105527..09ab9d5f242e 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -152,6 +152,11 @@ 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要用於 <workspace> 引數的檔案。 + + Remove unnecessary import. + Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. 執行協力廠商分析器並套用修正。 From 39070af55b03bd8edbd84fa0cc0e63bd13fa503c Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 11:17:57 -0700 Subject: [PATCH 1107/2702] Get configrued diagnostic severity by Id and Category --- src/Analyzers/AnalyzerOptionExtensions.cs | 94 +++++++++++++++++++++-- src/Analyzers/Extensions.cs | 26 +++---- 2 files changed, 99 insertions(+), 21 deletions(-) diff --git a/src/Analyzers/AnalyzerOptionExtensions.cs b/src/Analyzers/AnalyzerOptionExtensions.cs index a063ab6ec5df..12c3874e465f 100644 --- a/src/Analyzers/AnalyzerOptionExtensions.cs +++ b/src/Analyzers/AnalyzerOptionExtensions.cs @@ -2,28 +2,33 @@ using System; using System.Linq; +using Microsoft.CodeAnalysis.Tools.Analyzers; namespace Microsoft.CodeAnalysis.Diagnostics { internal static class AnalyzerOptionsExtensions { - private const string DotnetAnalyzerDiagnosticPrefix = "dotnet_analyzer_diagnostic"; - private const string CategoryPrefix = "category"; - private const string SeveritySuffix = "severity"; + internal const string DotnetDiagnosticPrefix = "dotnet_diagnostic"; + internal const string DotnetAnalyzerDiagnosticPrefix = "dotnet_analyzer_diagnostic"; + internal const string CategoryPrefix = "category"; + internal const string SeveritySuffix = "severity"; - private const string DotnetAnalyzerDiagnosticSeverityKey = DotnetAnalyzerDiagnosticPrefix + "." + SeveritySuffix; + internal const string DotnetAnalyzerDiagnosticSeverityKey = DotnetAnalyzerDiagnosticPrefix + "." + SeveritySuffix; - private static string GetCategoryBasedDotnetAnalyzerDiagnosticSeverityKey(string category) + internal static string GetDiagnosticIdBasedDotnetAnalyzerDiagnosticSeverityKey(string diagnosticId) + => $"{DotnetDiagnosticPrefix}.{diagnosticId}.{SeveritySuffix}"; + internal static string GetCategoryBasedDotnetAnalyzerDiagnosticSeverityKey(string category) => $"{DotnetAnalyzerDiagnosticPrefix}.{CategoryPrefix}-{category}.{SeveritySuffix}"; /// /// Tries to get configured severity for the given - /// for the given from bulk configuration analyzer config options, i.e. - /// 'dotnet_analyzer_diagnostic.category-%RuleCategory%.severity = %severity%' + /// for the given from analyzer config options, i.e. + /// 'dotnet_diagnostic.%descriptor.Id%.severity = %severity%', + /// 'dotnet_analyzer_diagnostic.category-%RuleCategory%.severity = %severity%', /// or /// 'dotnet_analyzer_diagnostic.severity = %severity%' /// - public static bool TryGetSeverityFromBulkConfiguration( + public static bool TryGetSeverityFromConfiguration( this AnalyzerOptions? analyzerOptions, SyntaxTree tree, Compilation compilation, @@ -78,6 +83,79 @@ public static bool TryGetSeverityFromBulkConfiguration( return false; } + /// + /// Determines whether a diagnostic is configured in the . + /// + public static bool IsDiagnosticSeverityConfigured(this AnalyzerConfigOptions analyzerConfigOptions, SyntaxTree tree, string diagnosticId, string? diagnosticCategory) + { + return tree.DiagnosticOptions.TryGetValue(diagnosticId, out _) + || (diagnosticCategory != null && analyzerConfigOptions.TryGetValue(GetCategoryBasedDotnetAnalyzerDiagnosticSeverityKey(diagnosticCategory), out _)) + || analyzerConfigOptions.TryGetValue(DotnetAnalyzerDiagnosticSeverityKey, out _); + } + + /// + /// Get the configured severity for a diagnostic analyzer from the . + /// + public static DiagnosticSeverity GetDiagnosticSeverity(this AnalyzerConfigOptions analyzerConfigOptions, SyntaxTree tree, string diagnosticId, string? diagnosticCategory) + { + return analyzerConfigOptions.TryGetSeverityFromConfiguration(tree, diagnosticId, diagnosticCategory, out var reportSeverity) + ? reportSeverity.ToSeverity() + : DiagnosticSeverity.Hidden; + } + + /// + /// Tries to get configured severity for the given + /// for the given from analyzer config options, i.e. + /// 'dotnet_diagnostic.%descriptor.Id%.severity = %severity%', + /// 'dotnet_analyzer_diagnostic.category-%RuleCategory%.severity = %severity%', + /// or + /// 'dotnet_analyzer_diagnostic.severity = %severity%' + /// + public static bool TryGetSeverityFromConfiguration( + this AnalyzerConfigOptions? analyzerConfigOptions, + SyntaxTree tree, + string diagnosticId, + string? diagnosticCategory, + out ReportDiagnostic severity) + { + if (analyzerConfigOptions is null) + { + severity = default; + return false; + } + + // If user has explicitly configured severity for this diagnostic ID, that should be respected. + // For example, 'dotnet_diagnostic.CA1000.severity = error' + if (tree.DiagnosticOptions.TryGetValue(diagnosticId, out severity)) + { + return true; + } + + string? value; + if (diagnosticCategory != null) + { + // If user has explicitly configured default severity for the diagnostic category, that should be respected. + // For example, 'dotnet_analyzer_diagnostic.category-security.severity = error' + var categoryBasedKey = GetCategoryBasedDotnetAnalyzerDiagnosticSeverityKey(diagnosticCategory); + if (analyzerConfigOptions.TryGetValue(categoryBasedKey, out value) && + TryParseSeverity(value, out severity)) + { + return true; + } + } + + // Otherwise, if user has explicitly configured default severity for all analyzer diagnostics, that should be respected. + // For example, 'dotnet_analyzer_diagnostic.severity = error' + if (analyzerConfigOptions.TryGetValue(DotnetAnalyzerDiagnosticSeverityKey, out value) && + TryParseSeverity(value, out severity)) + { + return true; + } + + severity = default; + return false; + } + internal static bool TryParseSeverity(string value, out ReportDiagnostic severity) { var comparer = StringComparer.OrdinalIgnoreCase; diff --git a/src/Analyzers/Extensions.cs b/src/Analyzers/Extensions.cs index 57bf2f384bac..28a06c727c7c 100644 --- a/src/Analyzers/Extensions.cs +++ b/src/Analyzers/Extensions.cs @@ -92,6 +92,17 @@ public static async Task GetSeverityAsync( return severity; } + public static DiagnosticSeverity ToSeverity(this ReportDiagnostic reportDiagnostic) + { + return reportDiagnostic switch + { + ReportDiagnostic.Error => DiagnosticSeverity.Error, + ReportDiagnostic.Warn => DiagnosticSeverity.Warning, + ReportDiagnostic.Info => DiagnosticSeverity.Info, + _ => DiagnosticSeverity.Hidden + }; + } + private static DiagnosticSeverity GetSeverity( this DiagnosticAnalyzer analyzer, Document document, @@ -113,9 +124,9 @@ private static DiagnosticSeverity GetSeverity( break; } - if (analyzerOptions.TryGetSeverityFromBulkConfiguration(tree, compilation, descriptor, out var reportDiagnostic)) + if (analyzerOptions.TryGetSeverityFromConfiguration(tree, compilation, descriptor, out var reportDiagnostic)) { - var configuredSeverity = ToSeverity(reportDiagnostic); + var configuredSeverity = reportDiagnostic.ToSeverity(); if (configuredSeverity > severity) { severity = configuredSeverity; @@ -140,17 +151,6 @@ private static DiagnosticSeverity GetSeverity( return severity; - static DiagnosticSeverity ToSeverity(ReportDiagnostic reportDiagnostic) - { - return reportDiagnostic switch - { - ReportDiagnostic.Error => DiagnosticSeverity.Error, - ReportDiagnostic.Warn => DiagnosticSeverity.Warning, - ReportDiagnostic.Info => DiagnosticSeverity.Info, - _ => DiagnosticSeverity.Hidden - }; - } - static bool TryGetSeverityFromCodeStyleOption( DiagnosticDescriptor descriptor, Compilation compilation, From 6f9f17d249866ef8f7c46d97f36b006a03586975 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 11:19:28 -0700 Subject: [PATCH 1108/2702] Add unnecesary imports formatter --- src/CodeFormatter.cs | 3 +- src/Formatters/DocumentFormatter.cs | 18 ++++++ ...rmatter.cs => OrganizeImportsFormatter.cs} | 23 +------ src/Formatters/UnnecessaryImportsFormatter.cs | 63 +++++++++++++++++++ .../RemoveUnnecessaryImportsHelper.cs | 26 ++++++++ 5 files changed, 111 insertions(+), 22 deletions(-) rename src/Formatters/{ImportsFormatter.cs => OrganizeImportsFormatter.cs} (79%) create mode 100644 src/Formatters/UnnecessaryImportsFormatter.cs create mode 100644 src/Reflection/RemoveUnnecessaryImportsHelper.cs diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 6cfa0672a1e0..8be0b583c384 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -28,7 +28,8 @@ internal static class CodeFormatter new FinalNewlineFormatter(), new EndOfLineFormatter(), new CharsetFormatter(), - new ImportsFormatter(), + new OrganizeImportsFormatter(), + new UnnecessaryImportsFormatter(), new AnalyzerFormatter(Resources.Code_Style, new CodeStyleInformationProvider(), new AnalyzerRunner(includeCompilerDiagnostics: true), new SolutionCodeFixApplier()), new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(includeCompilerDiagnostics: true), new SolutionCodeFixApplier()), }.ToImmutableArray(); diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index 412ca1a0f3e7..b6dead311e00 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -181,5 +181,23 @@ private static void LogFormattingChanges(string filePath, bool changesAreErrors, logger.LogWarning(formatMessage); } } + + protected static async Task IsSameDocumentAndVersionAsync(Document a, Document b, CancellationToken cancellationToken) + { + if (a == b) + { + return true; + } + + if (a.Id != b.Id) + { + return false; + } + + var aVersion = await a.GetTextVersionAsync(cancellationToken).ConfigureAwait(false); + var bVersion = await b.GetTextVersionAsync(cancellationToken).ConfigureAwait(false); + + return aVersion == bVersion; + } } } diff --git a/src/Formatters/ImportsFormatter.cs b/src/Formatters/OrganizeImportsFormatter.cs similarity index 79% rename from src/Formatters/ImportsFormatter.cs rename to src/Formatters/OrganizeImportsFormatter.cs index 272444c853e2..780c9e4701f7 100644 --- a/src/Formatters/ImportsFormatter.cs +++ b/src/Formatters/OrganizeImportsFormatter.cs @@ -13,9 +13,9 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { /// - /// ImportsFormatter that uses the to format document import directives. + /// OrganizeImportsFormatter that uses the to format document import directives. /// - internal sealed class ImportsFormatter : DocumentFormatter + internal sealed class OrganizeImportsFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_imports_ordering; private readonly DocumentFormatter _endOfLineFormatter = new EndOfLineFormatter(); @@ -59,24 +59,5 @@ internal override async Task FormatFileAsync( return sourceText; } } - - private static async Task IsSameDocumentAndVersionAsync(Document a, Document b, CancellationToken cancellationToken) - { - if (a == b) - { - return true; - } - - if (a.Id != b.Id) - { - return false; - } - - var aVersion = await a.GetTextVersionAsync(cancellationToken).ConfigureAwait(false); - var bVersion = await b.GetTextVersionAsync(cancellationToken).ConfigureAwait(false); - - return aVersion == bVersion; - } } } - diff --git a/src/Formatters/UnnecessaryImportsFormatter.cs b/src/Formatters/UnnecessaryImportsFormatter.cs new file mode 100644 index 000000000000..a98581fdd019 --- /dev/null +++ b/src/Formatters/UnnecessaryImportsFormatter.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Text; +using Microsoft.CodeAnalysis.Tools.Refelection; +using Microsoft.Extensions.Logging; + +namespace Microsoft.CodeAnalysis.Tools.Formatters +{ + /// + /// UnusedImportsFormatter that removes unsused imports when fixing code style errors. + /// + internal sealed class UnnecessaryImportsFormatter : DocumentFormatter + { + internal const string IDE0005 = nameof(IDE0005); + internal const string Style = nameof(Style); + + protected override string FormatWarningDescription => Resources.Remove_unnecessary_import; + + internal override async Task FormatFileAsync( + Document document, + SourceText sourceText, + OptionSet optionSet, + AnalyzerConfigOptions analyzerConfigOptions, + FormatOptions formatOptions, + ILogger logger, + CancellationToken cancellationToken) + { + // If we are fixing CodeStyle and the 'IDE0005' diagnostic is configured, then + // see if we can remove unused imports. + if (!formatOptions.FixCodeStyle) + { + return sourceText; + } + + var tree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + if (tree is null) + { + return sourceText; + } + + var severity = analyzerConfigOptions.GetDiagnosticSeverity(tree, IDE0005, Style); + if (severity < formatOptions.CodeStyleSeverity) + { + return sourceText; + } + + var formattedDocument = await RemoveUnnecessaryImportsHelper.RemoveUnnecessaryImportsAsync(document, cancellationToken).ConfigureAwait(false); + + var isSameVersion = await IsSameDocumentAndVersionAsync(document, formattedDocument, cancellationToken).ConfigureAwait(false); + if (isSameVersion) + { + return sourceText; + } + + var formattedText = await formattedDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + return formattedText; + } + } +} diff --git a/src/Reflection/RemoveUnnecessaryImportsHelper.cs b/src/Reflection/RemoveUnnecessaryImportsHelper.cs new file mode 100644 index 000000000000..3ee082c196c4 --- /dev/null +++ b/src/Reflection/RemoveUnnecessaryImportsHelper.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.Tools.Refelection +{ + internal static class RemoveUnnecessaryImportsHelper + { + private static readonly Assembly? s_microsoftCodeAnalysisFeaturesAssembly = Assembly.Load(new AssemblyName("Microsoft.CodeAnalysis.Features")); + private static readonly Type? s_abstractRemoveUnnecessaryImportsCodeFixProviderType = s_microsoftCodeAnalysisFeaturesAssembly?.GetType("Microsoft.CodeAnalysis.RemoveUnnecessaryImports.AbstractRemoveUnnecessaryImportsCodeFixProvider"); + private static readonly MethodInfo? s_removeUnnecessaryImportsAsyncMethod = s_abstractRemoveUnnecessaryImportsCodeFixProviderType?.GetMethod("RemoveUnnecessaryImportsAsync", BindingFlags.Static | BindingFlags.NonPublic); + + public static async Task RemoveUnnecessaryImportsAsync(Document document, CancellationToken cancellationToken) + { + if (s_removeUnnecessaryImportsAsyncMethod is null) + { + return document; + } + + return await (Task)s_removeUnnecessaryImportsAsyncMethod.Invoke(obj: null, new object[] { document, cancellationToken }); + } + } +} From 5e45cfe94e1f2ba5a18dd8a9ef6ced99f92c5112 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 11:19:50 -0700 Subject: [PATCH 1109/2702] Add unnecessary imports tests --- ...ts.cs => OrganizeImportsFormatterTests.cs} | 14 +-- .../UnnecessaryImportsFormatterTests.cs | 103 ++++++++++++++++++ 2 files changed, 110 insertions(+), 7 deletions(-) rename tests/Formatters/{ImportsFormatterTests.cs => OrganizeImportsFormatterTests.cs} (87%) create mode 100644 tests/Formatters/UnnecessaryImportsFormatterTests.cs diff --git a/tests/Formatters/ImportsFormatterTests.cs b/tests/Formatters/OrganizeImportsFormatterTests.cs similarity index 87% rename from tests/Formatters/ImportsFormatterTests.cs rename to tests/Formatters/OrganizeImportsFormatterTests.cs index 250d0785d1d8..b9a83dba4cae 100644 --- a/tests/Formatters/ImportsFormatterTests.cs +++ b/tests/Formatters/OrganizeImportsFormatterTests.cs @@ -8,9 +8,9 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { - public class ImportsFormatterTests : CSharpFormatterTests + public class OrganizeImportsFormatterTests : CSharpFormatterTests { - private protected override ICodeFormatter Formatter => new ImportsFormatter(); + private protected override ICodeFormatter Formatter => new OrganizeImportsFormatter(); [Fact] public async Task WhenOptionsDisabled_AndImportsNotSorted_ImportsSorted() @@ -40,7 +40,7 @@ class C ["dotnet_separate_import_directive_groups"] = "false" }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] @@ -71,7 +71,7 @@ class C ["dotnet_separate_import_directive_groups"] = "false" }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] @@ -103,7 +103,7 @@ class C ["dotnet_separate_import_directive_groups"] = "true" }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] @@ -135,7 +135,7 @@ class C ["dotnet_separate_import_directive_groups"] = "true" }; - await TestAsync(testCode, expectedCode, editorConfig); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig); } [Fact] @@ -155,7 +155,7 @@ class C ["end_of_line"] = EndOfLineFormatter.GetEndOfLineOption(Environment.NewLine) }; - await TestAsync(code, code, editorConfig); + await AssertCodeUnchangedAsync(code, editorConfig); } } } diff --git a/tests/Formatters/UnnecessaryImportsFormatterTests.cs b/tests/Formatters/UnnecessaryImportsFormatterTests.cs new file mode 100644 index 000000000000..9b1134ce6d28 --- /dev/null +++ b/tests/Formatters/UnnecessaryImportsFormatterTests.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Tools.Formatters; +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters +{ + public class UnnecessaryImportsFormatterTests : CSharpFormatterTests + { + private const string RemoveUnnecessaryImportDiagnosticKey = + AnalyzerOptionsExtensions.DotnetDiagnosticPrefix + "." + UnnecessaryImportsFormatter.IDE0005 + "." + AnalyzerOptionsExtensions.SeveritySuffix; + private const string RemoveUnnecessaryImportCategoryKey = + AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticPrefix + "." + AnalyzerOptionsExtensions.CategoryPrefix + "-" + UnnecessaryImportsFormatter.Style + "." + AnalyzerOptionsExtensions.SeveritySuffix; + + private protected override ICodeFormatter Formatter => new UnnecessaryImportsFormatter(); + + [Fact] + public async Task WhenNotFixingCodeSyle_AndHasUnusedImports_NoChange() + { + var code = +@"using System; + +class C +{ +}"; + + var editorConfig = new Dictionary(); + + await AssertCodeUnchangedAsync(code, editorConfig, fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Info); + } + + [Fact] + public async Task WhenIDE0005NotConfigured_AndHasUnusedImports_NoChange() + { + var code = +@"using System; + +class C +{ +}"; + + var editorConfig = new Dictionary(); + + await AssertCodeUnchangedAsync(code, editorConfig, fixCodeStyle: true, codeStyleSeverity: DiagnosticSeverity.Info); + } + + [Theory] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, "warning")] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, "info")] + [InlineData(RemoveUnnecessaryImportCategoryKey, "warning")] + [InlineData(RemoveUnnecessaryImportCategoryKey, "info")] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, "warning")] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, "info")] + public async Task WhenIDE0005SeverityLowerThanFixSeverity_AndHasUnusedImports_NoChange(string key, string severity) + { + var code = +@"using System; + +class C +{ +}"; + + var editorConfig = new Dictionary() + { + [key] = severity + }; + + await AssertCodeUnchangedAsync(code, editorConfig, fixCodeStyle: true, codeStyleSeverity: DiagnosticSeverity.Error); + } + + [Theory] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, "warning")] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, "error")] + [InlineData(RemoveUnnecessaryImportCategoryKey, "warning")] + [InlineData(RemoveUnnecessaryImportCategoryKey, "error")] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, "warning")] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, "error")] + public async Task WhenIDE0005SeverityEqualOrGreaterThanFixSeverity_AndHasUnusedImports_ImportRemoved(string key, string severity) + { + var testCode = +@"using System; + +class C +{ +}"; + + var expectedCode = +@"class C +{ +}"; + + var editorConfig = new Dictionary() + { + [key] = severity + }; + + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCodeStyle: true, codeStyleSeverity: DiagnosticSeverity.Warning); + } + } +} From 955f6ad828ec74bf582e348cd918eaa27b4433bb Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 11:20:07 -0700 Subject: [PATCH 1110/2702] Run format and remove unncessary imports --- src/Analyzers/AnalyzerRunner.cs | 1 - src/Workspaces/FolderWorkspace.cs | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index 84195df248eb..46239283eaad 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Immutable; -using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; diff --git a/src/Workspaces/FolderWorkspace.cs b/src/Workspaces/FolderWorkspace.cs index 81650b8fa161..ab62b56f5301 100644 --- a/src/Workspaces/FolderWorkspace.cs +++ b/src/Workspaces/FolderWorkspace.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Immutable; -using System.Diagnostics; using System.IO; using System.Text; using System.Threading; From 6afb76c8a8313a5f44841842c5c377979cda2d33 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 11:28:59 -0700 Subject: [PATCH 1111/2702] Add constants for tests --- src/Formatters/UnnecessaryImportsFormatter.cs | 2 +- .../UnnecessaryImportsFormatterTests.cs | 24 +++++++++---------- tests/Utilities/Severity.cs | 11 +++++++++ 3 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 tests/Utilities/Severity.cs diff --git a/src/Formatters/UnnecessaryImportsFormatter.cs b/src/Formatters/UnnecessaryImportsFormatter.cs index a98581fdd019..28e346735e1f 100644 --- a/src/Formatters/UnnecessaryImportsFormatter.cs +++ b/src/Formatters/UnnecessaryImportsFormatter.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { /// - /// UnusedImportsFormatter that removes unsused imports when fixing code style errors. + /// UnnecessaryImportsFormatter that removes unsused imports when fixing code style errors. /// internal sealed class UnnecessaryImportsFormatter : DocumentFormatter { diff --git a/tests/Formatters/UnnecessaryImportsFormatterTests.cs b/tests/Formatters/UnnecessaryImportsFormatterTests.cs index 9b1134ce6d28..b28bb2ce6458 100644 --- a/tests/Formatters/UnnecessaryImportsFormatterTests.cs +++ b/tests/Formatters/UnnecessaryImportsFormatterTests.cs @@ -48,12 +48,12 @@ class C } [Theory] - [InlineData(RemoveUnnecessaryImportDiagnosticKey, "warning")] - [InlineData(RemoveUnnecessaryImportDiagnosticKey, "info")] - [InlineData(RemoveUnnecessaryImportCategoryKey, "warning")] - [InlineData(RemoveUnnecessaryImportCategoryKey, "info")] - [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, "warning")] - [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, "info")] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, Severity.Warning)] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, Severity.Info)] + [InlineData(RemoveUnnecessaryImportCategoryKey, Severity.Warning)] + [InlineData(RemoveUnnecessaryImportCategoryKey, Severity.Info)] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, Severity.Warning)] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, Severity.Info)] public async Task WhenIDE0005SeverityLowerThanFixSeverity_AndHasUnusedImports_NoChange(string key, string severity) { var code = @@ -72,12 +72,12 @@ class C } [Theory] - [InlineData(RemoveUnnecessaryImportDiagnosticKey, "warning")] - [InlineData(RemoveUnnecessaryImportDiagnosticKey, "error")] - [InlineData(RemoveUnnecessaryImportCategoryKey, "warning")] - [InlineData(RemoveUnnecessaryImportCategoryKey, "error")] - [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, "warning")] - [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, "error")] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, Severity.Warning)] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, Severity.Error)] + [InlineData(RemoveUnnecessaryImportCategoryKey, Severity.Warning)] + [InlineData(RemoveUnnecessaryImportCategoryKey, Severity.Error)] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, Severity.Warning)] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, Severity.Error)] public async Task WhenIDE0005SeverityEqualOrGreaterThanFixSeverity_AndHasUnusedImports_ImportRemoved(string key, string severity) { var testCode = diff --git a/tests/Utilities/Severity.cs b/tests/Utilities/Severity.cs new file mode 100644 index 000000000000..93d73d5a9430 --- /dev/null +++ b/tests/Utilities/Severity.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Tools.Tests +{ + internal static class Severity + { + public const string Info = "info"; + public const string Warning = "warning"; + public const string Error = "error"; + } +} From 6f7e15efa441908139b98144f407144656f3bea1 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 11:37:31 -0700 Subject: [PATCH 1112/2702] Add unnecesary import config to docs --- docs/Supported-.editorconfig-options.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/Supported-.editorconfig-options.md b/docs/Supported-.editorconfig-options.md index aaa167dcc2e4..9151fb1a06f5 100644 --- a/docs/Supported-.editorconfig-options.md +++ b/docs/Supported-.editorconfig-options.md @@ -13,3 +13,21 @@ The dotnet-format global tool supports the core set of [EditorConfig options](ht [*] The options `trim_trailing_whitespace` and `max_line_length` are not supported. Currently insignificant whitespace is **always** removed by the formatter. [**] [Formatting conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-formatting-conventions?view=vs-2019) are enforced by default. Use the `--fix-style` option to enforce [Language conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019) and [Naming conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2019). + +## Removing unnecessary imports +In order to remove unnecessary imports the IDE0005 (unnecessary import) diagnostic id must be configured in your .editorconfig. When running dotnet-format pass the `--fix-style` option and specify a severity that includes the configured IDE0005 severity. + +*Example:* + +.editorconfig +```ini +root = true + +[*.{cs,vb}] +dotnet_diagnostic.IDE0005.severity = warning +``` + +command +```console +dotnet-format ./format.sln --fix-style warn +``` \ No newline at end of file From ca2df1c00c8af123b3dde43df558c831256fac2f Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 12:12:29 -0700 Subject: [PATCH 1113/2702] Fix file encoding --- tests/Utilities/Severity.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Utilities/Severity.cs b/tests/Utilities/Severity.cs index 93d73d5a9430..19c7042a0c9b 100644 --- a/tests/Utilities/Severity.cs +++ b/tests/Utilities/Severity.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. namespace Microsoft.CodeAnalysis.Tools.Tests { From 13a51a3fefafd62456d55430ecc65d700508d7b9 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 12:43:05 -0700 Subject: [PATCH 1114/2702] Only include compiler diagnostics if a fixer supports them --- src/Analyzers/AnalyzerFormatter.cs | 15 +++++++++++---- src/Analyzers/AnalyzerRunner.cs | 16 +++++----------- src/Analyzers/Interfaces/IAnalyzerRunner.cs | 2 ++ src/CodeFormatter.cs | 4 ++-- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 6f20a00762cb..80336483c2a2 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -49,6 +49,11 @@ public async Task FormatAsync( return solution; } + // Only include compiler diagnostics if we have a fixer that can fix them. + var includeCompilerDiagnostics = fixers.Any( + codefix => codefix.FixableDiagnosticIds.Any( + id => id.StartsWith("CS") || id.StartsWith("BC"))); + var analysisStopwatch = Stopwatch.StartNew(); logger.LogTrace(Resources.Running_0_analysis, _name); @@ -63,7 +68,7 @@ public async Task FormatAsync( var projectAnalyzers = await FilterBySeverityAsync(solution.Projects, analyzers, formattablePaths, severity, cancellationToken).ConfigureAwait(false); // Determine which diagnostics are being reported for each project. - var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, formatOptions, severity, logger, formattedFiles, cancellationToken).ConfigureAwait(false); + var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, formatOptions, severity, includeCompilerDiagnostics, logger, formattedFiles, cancellationToken).ConfigureAwait(false); var projectDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds; logger.LogTrace(Resources.Complete_in_0_ms, projectDiagnosticsMS); @@ -71,7 +76,7 @@ public async Task FormatAsync( logger.LogTrace(Resources.Fixing_diagnostics); // Run each analyzer individually and apply fixes if possible. - solution = await FixDiagnosticsAsync(solution, analyzers, fixers, projectDiagnostics, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); + solution = await FixDiagnosticsAsync(solution, analyzers, fixers, projectDiagnostics, formattablePaths, severity, includeCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); var fixDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds - projectDiagnosticsMS; logger.LogTrace(Resources.Complete_in_0_ms, fixDiagnosticsMS); @@ -87,6 +92,7 @@ private async Task>> Get ImmutableHashSet formattablePaths, FormatOptions options, DiagnosticSeverity severity, + bool includeCompilerDiagnostics, ILogger logger, List formattedFiles, CancellationToken cancellationToken) @@ -101,7 +107,7 @@ private async Task>> Get } // Run all the filtered analyzers to determine which are reporting diagnostic. - await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); + await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, includeCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); } LogDiagnosticLocations(solution, result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger, formattedFiles); @@ -143,6 +149,7 @@ private async Task FixDiagnosticsAsync( ImmutableDictionary> projectDiagnostics, ImmutableHashSet formattablePaths, DiagnosticSeverity severity, + bool includeCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken) { @@ -180,7 +187,7 @@ private async Task FixDiagnosticsAsync( } var analyzers = analyzersByLanguage[project.Language]; - await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, logger, cancellationToken).ConfigureAwait(false); + await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, includeCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); } var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Count > 0); diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index 84195df248eb..638dd1854e01 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Immutable; -using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; @@ -11,22 +10,16 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal partial class AnalyzerRunner : IAnalyzerRunner { - private readonly bool _includeComplilerDiagnostics; - - public AnalyzerRunner(bool includeCompilerDiagnostics) - { - _includeComplilerDiagnostics = includeCompilerDiagnostics; - } - public Task RunCodeAnalysisAsync( CodeAnalysisResult result, DiagnosticAnalyzer analyzers, Project project, ImmutableHashSet formattableDocumentPaths, DiagnosticSeverity severity, + bool includeCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken) - => RunCodeAnalysisAsync(result, ImmutableArray.Create(analyzers), project, formattableDocumentPaths, severity, logger, cancellationToken); + => RunCodeAnalysisAsync(result, ImmutableArray.Create(analyzers), project, formattableDocumentPaths, severity, includeCompilerDiagnostics, logger, cancellationToken); public async Task RunCodeAnalysisAsync( CodeAnalysisResult result, @@ -34,6 +27,7 @@ public async Task RunCodeAnalysisAsync( Project project, ImmutableHashSet formattableDocumentPaths, DiagnosticSeverity severity, + bool includeCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken) { @@ -45,7 +39,7 @@ public async Task RunCodeAnalysisAsync( // If are not running any analyzers and are not reporting compiler diagnostics, then there is // nothing to report. - if (analyzers.IsEmpty && !_includeComplilerDiagnostics) + if (analyzers.IsEmpty && !includeCompilerDiagnostics) { return; } @@ -64,7 +58,7 @@ public async Task RunCodeAnalysisAsync( logAnalyzerExecutionTime: false, reportSuppressedDiagnostics: false); var analyzerCompilation = compilation.WithAnalyzers(analyzers, analyzerOptions); - diagnostics = _includeComplilerDiagnostics + diagnostics = includeCompilerDiagnostics ? await analyzerCompilation.GetAllDiagnosticsAsync(cancellationToken).ConfigureAwait(false) : await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken).ConfigureAwait(false); } diff --git a/src/Analyzers/Interfaces/IAnalyzerRunner.cs b/src/Analyzers/Interfaces/IAnalyzerRunner.cs index 565b7fbd4af6..beb19d1ebb5d 100644 --- a/src/Analyzers/Interfaces/IAnalyzerRunner.cs +++ b/src/Analyzers/Interfaces/IAnalyzerRunner.cs @@ -16,6 +16,7 @@ Task RunCodeAnalysisAsync( Project project, ImmutableHashSet formattableDocumentPaths, DiagnosticSeverity severity, + bool includeCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken); @@ -25,6 +26,7 @@ Task RunCodeAnalysisAsync( Project project, ImmutableHashSet formattableDocumentPaths, DiagnosticSeverity severity, + bool includeCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken); } diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 6cfa0672a1e0..944c4a911f98 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -29,8 +29,8 @@ internal static class CodeFormatter new EndOfLineFormatter(), new CharsetFormatter(), new ImportsFormatter(), - new AnalyzerFormatter(Resources.Code_Style, new CodeStyleInformationProvider(), new AnalyzerRunner(includeCompilerDiagnostics: true), new SolutionCodeFixApplier()), - new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(includeCompilerDiagnostics: true), new SolutionCodeFixApplier()), + new AnalyzerFormatter(Resources.Code_Style, new CodeStyleInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier()), + new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier()), }.ToImmutableArray(); public static async Task FormatWorkspaceAsync( From a0ded24e7d18a1595f1647079f68df4ead143528 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 15:29:16 -0700 Subject: [PATCH 1115/2702] Fix typo in reflection Co-authored-by: Rikki Gibson --- src/Formatters/UnnecessaryImportsFormatter.cs | 2 +- src/Reflection/RemoveUnnecessaryImportsHelper.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Formatters/UnnecessaryImportsFormatter.cs b/src/Formatters/UnnecessaryImportsFormatter.cs index 28e346735e1f..3fdea6f24d52 100644 --- a/src/Formatters/UnnecessaryImportsFormatter.cs +++ b/src/Formatters/UnnecessaryImportsFormatter.cs @@ -5,7 +5,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; -using Microsoft.CodeAnalysis.Tools.Refelection; +using Microsoft.CodeAnalysis.Tools.Reflection; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Formatters diff --git a/src/Reflection/RemoveUnnecessaryImportsHelper.cs b/src/Reflection/RemoveUnnecessaryImportsHelper.cs index 3ee082c196c4..2ad93f94517e 100644 --- a/src/Reflection/RemoveUnnecessaryImportsHelper.cs +++ b/src/Reflection/RemoveUnnecessaryImportsHelper.cs @@ -5,7 +5,7 @@ using System.Threading; using System.Threading.Tasks; -namespace Microsoft.CodeAnalysis.Tools.Refelection +namespace Microsoft.CodeAnalysis.Tools.Reflection { internal static class RemoveUnnecessaryImportsHelper { From b8bfffa65c01ea590e555ffa0d30612098aff858 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 16:09:23 -0700 Subject: [PATCH 1116/2702] Enable restore so that references can be added for netstandard projects --- src/CodeFormatter.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 6cfa0672a1e0..c105d9b756a8 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -170,9 +170,6 @@ private static async Task OpenFolderWorkspaceAsync(string workspacePa // rather than a separate one. Any tasks isolated in AppDomains or tasks that create // AppDomains will likely not work due to https://github.com/Microsoft/MSBuildLocator/issues/16. { "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, - // This flag is used at restore time to avoid imports from packages changing the inputs to restore, - // without this it is possible to get different results between the first and second restore. - { "ExcludeRestorePackageImports", bool.TrueString }, }; var workspace = MSBuildWorkspace.Create(properties); From f1829f0c6460d4f729b4526e3c38fc699e06999e Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 17:39:11 -0700 Subject: [PATCH 1117/2702] Add codestyle solution for testing against --- .../codestyle_solution/.editorconfig | 212 ++++++++++++++++++ .../codestyle_solution/codestyle_solution.sln | 30 +++ .../console_project/Program.cs | 14 ++ .../console_project/console_project.csproj | 11 + .../codestyle_solution/library/Speaker.cs | 16 ++ .../codestyle_solution/library/library.csproj | 7 + 6 files changed, 290 insertions(+) create mode 100644 tests/projects/for_code_formatter/codestyle_solution/.editorconfig create mode 100644 tests/projects/for_code_formatter/codestyle_solution/codestyle_solution.sln create mode 100644 tests/projects/for_code_formatter/codestyle_solution/console_project/Program.cs create mode 100644 tests/projects/for_code_formatter/codestyle_solution/console_project/console_project.csproj create mode 100644 tests/projects/for_code_formatter/codestyle_solution/library/Speaker.cs create mode 100644 tests/projects/for_code_formatter/codestyle_solution/library/library.csproj diff --git a/tests/projects/for_code_formatter/codestyle_solution/.editorconfig b/tests/projects/for_code_formatter/codestyle_solution/.editorconfig new file mode 100644 index 000000000000..a2441517eef4 --- /dev/null +++ b/tests/projects/for_code_formatter/codestyle_solution/.editorconfig @@ -0,0 +1,212 @@ +# EditorConfig is awesome:http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Don't use tabs for indentation. +[*] +indent_style = space +# (Please don't specify an indent_size here; that has too many unintended consequences.) + +# Code files +[*.{cs,csx,vb,vbx}] +indent_size = 4 +insert_final_newline = true +charset = utf-8-bom + +# Xml project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +indent_size = 2 + +# Xml config files +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] +indent_size = 2 + +# JSON files +[*.json] +indent_size = 2 + +[*.{sh}] +end_of_line = lf +indent_size = 2 + +# Dotnet code style settings: +[*.{cs,vb}] +# Sort using and Import directives with System.* appearing first +dotnet_sort_system_directives_first = true +# Avoid "this." and "Me." if not necessary +dotnet_style_qualification_for_field = false:warning +dotnet_style_qualification_for_property = false:warning +dotnet_style_qualification_for_method = false:warning +dotnet_style_qualification_for_event = false:warning + +# Use language keywords instead of framework type names for type references +dotnet_style_predefined_type_for_locals_parameters_members = true:warning +dotnet_style_predefined_type_for_member_access = true:warning + +# Suggest more modern language features when available +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion + +# Non-private static fields are PascalCase +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static + +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case + +# Constants are PascalCase +dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants +dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style + +dotnet_naming_symbols.constants.applicable_kinds = field, local +dotnet_naming_symbols.constants.required_modifiers = const + +dotnet_naming_style.constant_style.capitalization = pascal_case + +# Static fields are camelCase and start with s_ +dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields +dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style + +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static + +dotnet_naming_style.static_field_style.capitalization = camel_case +dotnet_naming_style.static_field_style.required_prefix = s_ + +# Instance fields are camelCase and start with _ +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields +dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style + +dotnet_naming_symbols.instance_fields.applicable_kinds = field + +dotnet_naming_style.instance_field_style.capitalization = camel_case +dotnet_naming_style.instance_field_style.required_prefix = _ + +# Locals and parameters are camelCase +dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style + +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local + +dotnet_naming_style.camel_case_style.capitalization = camel_case + +# Local functions are PascalCase +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function + +dotnet_naming_style.local_function_style.capitalization = pascal_case + +# By default, name items with PascalCase +dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members +dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style + +dotnet_naming_symbols.all_members.applicable_kinds = * + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# CSharp code style settings: +[*.cs] +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_switch_labels = true +csharp_indent_labels = flush_left + +# Prefer "var" everywhere +dotnet_diagnostic.IDE0007.severity = warning +csharp_style_var_for_built_in_types = true:warning +csharp_style_var_when_type_is_apparent = true:warning +csharp_style_var_elsewhere = true:warning + +# Prefer method-like constructs to have a block body +csharp_style_expression_bodied_methods = false:none +csharp_style_expression_bodied_constructors = false:none +csharp_style_expression_bodied_operators = false:none + +# Prefer property-like constructs to have an expression-body +csharp_style_expression_bodied_properties = true:warning +csharp_style_expression_bodied_indexers = true:warning +csharp_style_expression_bodied_accessors = true:warning + +# Suggest more modern language features when available +csharp_style_pattern_matching_over_is_with_cast_check = true:warning +csharp_style_pattern_matching_over_as_with_null_check = true:warning +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_throw_expression = true:warning +csharp_style_conditional_delegate_call = true:suggestion + +# Newline settings +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Spacing +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_around_binary_operators = before_and_after +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false + +# Blocks are allowed +csharp_prefer_braces = true:silent +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +# IDE0035: Remove unreachable code +dotnet_diagnostic.IDE0035.severity = warning + +# IDE0036: Order modifiers +dotnet_diagnostic.IDE0036.severity = warning + +# IDE0040: Add accessibility modifiers +dotnet_diagnostic.IDE0040.severity = warning + +# IDE0043: Format string contains invalid placeholder +dotnet_diagnostic.IDE0043.severity = warning + +# IDE0044: Make field readonly +dotnet_diagnostic.IDE0044.severity = warning + +# CONSIDER: Are IDE0051 and IDE0052 too noisy to be warnings for IDE editing scenarios? Should they be made build-only warnings? +# IDE0051: Remove unused private member +dotnet_diagnostic.IDE0051.severity = warning + +# IDE0052: Remove unread private member +dotnet_diagnostic.IDE0052.severity = warning + +# IDE0059: Unnecessary assignment to a value +dotnet_diagnostic.IDE0059.severity = warning + +# IDE0060: Remove unused parameter +dotnet_diagnostic.IDE0060.severity = warning + +# IDE0005: Using directive is unnecessary +dotnet_diagnostic.IDE0005.severity = warning diff --git a/tests/projects/for_code_formatter/codestyle_solution/codestyle_solution.sln b/tests/projects/for_code_formatter/codestyle_solution/codestyle_solution.sln new file mode 100644 index 000000000000..dfb78836e5bc --- /dev/null +++ b/tests/projects/for_code_formatter/codestyle_solution/codestyle_solution.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28621.142 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "codestyle_project", ".\console_project\console_project.csproj", "{EE13F2F8-3254-46A8-8A49-02C428EDE60A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "library", ".\library\library.csproj", "{EE13F2F8-3254-46A8-8A49-02C428EDE60B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EE13F2F8-3254-46A8-8A49-02C428EDE60A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE13F2F8-3254-46A8-8A49-02C428EDE60A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE13F2F8-3254-46A8-8A49-02C428EDE60A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE13F2F8-3254-46A8-8A49-02C428EDE60A}.Release|Any CPU.Build.0 = Release|Any CPU + {EE13F2F8-3254-46A8-8A49-02C428EDE60B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE13F2F8-3254-46A8-8A49-02C428EDE60B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE13F2F8-3254-46A8-8A49-02C428EDE60B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE13F2F8-3254-46A8-8A49-02C428EDE60B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C0AFE45C-FD8E-4E3B-9300-8C067DE00C01} + EndGlobalSection +EndGlobal diff --git a/tests/projects/for_code_formatter/codestyle_solution/console_project/Program.cs b/tests/projects/for_code_formatter/codestyle_solution/console_project/Program.cs new file mode 100644 index 000000000000..7c16b6d83e11 --- /dev/null +++ b/tests/projects/for_code_formatter/codestyle_solution/console_project/Program.cs @@ -0,0 +1,14 @@ +using System; +using library; + +namespace codestyle_project +{ + class Program + { + static void Main(string[] args) + { + Speaker speaker = new Speaker(); + Console.WriteLine(speaker.SayHello("World")); + } + } +} diff --git a/tests/projects/for_code_formatter/codestyle_solution/console_project/console_project.csproj b/tests/projects/for_code_formatter/codestyle_solution/console_project/console_project.csproj new file mode 100644 index 000000000000..78bfae4dacfa --- /dev/null +++ b/tests/projects/for_code_formatter/codestyle_solution/console_project/console_project.csproj @@ -0,0 +1,11 @@ + + + + Exe + netcoreapp3.0 + + + + + + diff --git a/tests/projects/for_code_formatter/codestyle_solution/library/Speaker.cs b/tests/projects/for_code_formatter/codestyle_solution/library/Speaker.cs new file mode 100644 index 000000000000..16e4496bd344 --- /dev/null +++ b/tests/projects/for_code_formatter/codestyle_solution/library/Speaker.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; + +namespace library +{ + public class Speaker + { + string lastName; + + public string SayHello(string name) + { + lastName = name; + return $"Hello {this.lastName}."; + } + } +} diff --git a/tests/projects/for_code_formatter/codestyle_solution/library/library.csproj b/tests/projects/for_code_formatter/codestyle_solution/library/library.csproj new file mode 100644 index 000000000000..9f5c4f4abb61 --- /dev/null +++ b/tests/projects/for_code_formatter/codestyle_solution/library/library.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + From 61c26a4e30a4a194e8b7614df3ff8d46d99f363c Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 9 Aug 2020 17:39:32 -0700 Subject: [PATCH 1118/2702] Added CodeFormatter tests for `--fix-style` --- perf/FormattedFiles.cs | 6 +- perf/NoFilesFormatted.cs | 6 +- perf/RealWorldSolution.cs | 4 +- src/CodeFormatter.cs | 3 - src/FormatOptions.cs | 8 +- src/Program.cs | 2 +- tests/CodeFormatterTests.cs | 89 +++++++++++++++++----- tests/Formatters/AbstractFormatterTests.cs | 2 +- tests/Formatters/FormattedFilesTests.cs | 2 +- tests/dotnet-format.UnitTests.csproj | 3 + 10 files changed, 86 insertions(+), 39 deletions(-) diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index b5d57b377f6c..81ae531205fd 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -37,7 +37,7 @@ public void FilesFormattedFolder() fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -57,7 +57,7 @@ public void FilesFormattedProject() fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -77,7 +77,7 @@ public void FilesFormattedSolution() fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index 2d66554efd9c..8cb80296eedf 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -37,7 +37,7 @@ public void NoFilesFormattedFolder() fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -57,7 +57,7 @@ public void NoFilesFormattedProject() fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -77,7 +77,7 @@ public void NoFilesFormattedSolution() fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index 999ba730e52b..1c2335075e4e 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -39,7 +39,7 @@ public void FilesFormattedSolution() fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -59,7 +59,7 @@ public void FilesFormattedFolder() fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 6cfa0672a1e0..c105d9b756a8 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -170,9 +170,6 @@ private static async Task OpenFolderWorkspaceAsync(string workspacePa // rather than a separate one. Any tasks isolated in AppDomains or tasks that create // AppDomains will likely not work due to https://github.com/Microsoft/MSBuildLocator/issues/16. { "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, - // This flag is used at restore time to avoid imports from packages changing the inputs to restore, - // without this it is possible to get different results between the first and second restore. - { "ExcludeRestorePackageImports", bool.TrueString }, }; var workspace = MSBuildWorkspace.Create(properties); diff --git a/src/FormatOptions.cs b/src/FormatOptions.cs index 597fe4547b44..ba8e765ef85a 100644 --- a/src/FormatOptions.cs +++ b/src/FormatOptions.cs @@ -27,7 +27,7 @@ public FormatOptions( bool fixCodeStyle, DiagnosticSeverity codeStyleSeverity, bool fixAnalyzers, - DiagnosticSeverity analyerSeverity, + DiagnosticSeverity analyzerSeverity, bool saveFormattedFiles, bool changesAreErrors, Matcher fileMatcher, @@ -40,7 +40,7 @@ public FormatOptions( FixCodeStyle = fixCodeStyle; CodeStyleSeverity = codeStyleSeverity; FixAnalyzers = fixAnalyzers; - AnalyzerSeverity = analyerSeverity; + AnalyzerSeverity = analyzerSeverity; SaveFormattedFiles = saveFormattedFiles; ChangesAreErrors = changesAreErrors; FileMatcher = fileMatcher; @@ -55,7 +55,7 @@ public void Deconstruct( out bool fixCodeStyle, out DiagnosticSeverity codeStyleSeverity, out bool fixAnalyzers, - out DiagnosticSeverity analyerSeverity, + out DiagnosticSeverity analyzerSeverity, out bool saveFormattedFiles, out bool changesAreErrors, out Matcher fileMatcher, @@ -68,7 +68,7 @@ public void Deconstruct( fixCodeStyle = FixCodeStyle; codeStyleSeverity = CodeStyleSeverity; fixAnalyzers = FixAnalyzers; - analyerSeverity = AnalyzerSeverity; + analyzerSeverity = AnalyzerSeverity; saveFormattedFiles = SaveFormattedFiles; changesAreErrors = ChangesAreErrors; fileMatcher = FileMatcher; diff --git a/src/Program.cs b/src/Program.cs index 3bdf8d471c7f..e8fc98002cce 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -134,7 +134,7 @@ public static async Task Run( fixCodeStyle: s_parseResult.WasOptionUsed("--fix-style", "-fs"), codeStyleSeverity: GetSeverity(fixStyle ?? FixSeverity.Error), fixAnalyzers: s_parseResult.WasOptionUsed("--fix-analyzers", "-fa"), - analyerSeverity: GetSeverity(fixAnalyzers ?? FixSeverity.Error), + analyzerSeverity: GetSeverity(fixAnalyzers ?? FixSeverity.Error), saveFormattedFiles: !check, changesAreErrors: check, fileMatcher, diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index d1aa16673460..8f468e2c61d9 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -29,6 +29,9 @@ public class CodeFormatterTests : IClassFixture, IClassFixture EmptyFilesList => Array.Empty(); private Regex FindFormattingLogLine => new Regex(@"((.*)\(\d+,\d+\): (.*))\r|((.*)\(\d+,\d+\): (.*))"); @@ -41,6 +44,10 @@ public CodeFormatterTests(ITestOutputHelper output, MSBuildFixture msBuildFixtur testProjectsPathFixture.SetCurrentDirectory(); msBuildFixture.RegisterInstance(_output); + + // For NetStandard projects to resolve framework references, the project.assets.json files must + // be constructed by a NuGet restore. + ProcessRunner.CreateProcess("dotnet", $"restore \"{CodeStyleSolutionFilePath}\"").Result.GetAwaiter().GetResult(); } [Fact] @@ -320,7 +327,7 @@ public async Task IgnoreFileWhenListedInExcludeList() { var include = new[] { UnformattedProgramFilePath }; - var log = await TestFormatWorkspaceAsync( + await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, include: include, exclude: include, @@ -328,11 +335,6 @@ public async Task IgnoreFileWhenListedInExcludeList() expectedExitCode: 0, expectedFilesFormatted: 0, expectedFileCount: 5); - - var pattern = string.Format(Resources.Formatted_code_file_0, @"(.*)"); - var match = new Regex(pattern, RegexOptions.Multiline).Match(log); - - Assert.False(match.Success, log); } [Fact] @@ -341,7 +343,7 @@ public async Task IgnoreFileWhenContainingFolderListedInExcludeList() var include = new[] { UnformattedProgramFilePath }; var exclude = new[] { UnformattedProjectPath }; - var log = await TestFormatWorkspaceAsync( + await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, include: include, exclude: exclude, @@ -349,11 +351,6 @@ public async Task IgnoreFileWhenContainingFolderListedInExcludeList() expectedExitCode: 0, expectedFilesFormatted: 0, expectedFileCount: 5); - - var pattern = string.Format(Resources.Formatted_code_file_0, @"(.*)"); - var match = new Regex(pattern, RegexOptions.Multiline).Match(log); - - Assert.False(match.Success, log); } [Fact] @@ -362,7 +359,7 @@ public async Task IgnoreAllFileWhenExcludingAllFiles() var include = new[] { UnformattedProgramFilePath }; var exclude = new[] { "**/*.*" }; - var log = await TestFormatWorkspaceAsync( + await TestFormatWorkspaceAsync( UnformattedSolutionFilePath, include: include, exclude: exclude, @@ -370,14 +367,64 @@ public async Task IgnoreAllFileWhenExcludingAllFiles() expectedExitCode: 0, expectedFilesFormatted: 0, expectedFileCount: 5); + } - var pattern = string.Format(Resources.Formatted_code_file_0, @"(.*)"); - var match = new Regex(pattern, RegexOptions.Multiline).Match(log); + [Fact] + public async Task NoFilesFormattedInCodeStyleSolution_WhenNotFixingCodeStyle() + { + await TestFormatWorkspaceAsync( + CodeStyleSolutionFilePath, + include: EmptyFilesList, + exclude: EmptyFilesList, + includeGenerated: false, + expectedExitCode: 0, + expectedFilesFormatted: 0, + expectedFileCount: 6, + fixCodeStyle: false); + } - Assert.False(match.Success, log); + [Fact] + public async Task NoFilesFormattedInCodeStyleSolution_WhenFixingCodeStyleErrors() + { + await TestFormatWorkspaceAsync( + CodeStyleSolutionFilePath, + include: EmptyFilesList, + exclude: EmptyFilesList, + includeGenerated: false, + expectedExitCode: 0, + expectedFilesFormatted: 0, + expectedFileCount: 6, + fixCodeStyle: true, + codeStyleSeverity: DiagnosticSeverity.Error); + } + + [Fact] + public async Task FilesFormattedInCodeStyleSolution_WhenFixingCodeStyleWarnings() + { + await TestFormatWorkspaceAsync( + CodeStyleSolutionFilePath, + include: EmptyFilesList, + exclude: EmptyFilesList, + includeGenerated: false, + expectedExitCode: 0, + expectedFilesFormatted: 2, + expectedFileCount: 6, + fixCodeStyle: true, + codeStyleSeverity: DiagnosticSeverity.Warning); } - public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEnumerable include, IEnumerable exclude, bool includeGenerated, int expectedExitCode, int expectedFilesFormatted, int expectedFileCount) + public async Task TestFormatWorkspaceAsync( + string workspaceFilePath, + IEnumerable include, + IEnumerable exclude, + bool includeGenerated, + int expectedExitCode, + int expectedFilesFormatted, + int expectedFileCount, + bool fixCodeStyle = false, + DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, + bool fixAnalyzers = false, + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { var workspacePath = Path.GetFullPath(workspaceFilePath); @@ -399,10 +446,10 @@ public async Task TestFormatWorkspaceAsync(string workspaceFilePath, IEn workspacePath, workspaceType, LogLevel.Trace, - fixCodeStyle: false, - codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + fixCodeStyle, + codeStyleSeverity, + fixAnalyzers, + analyzerSeverity, saveFormattedFiles: false, changesAreErrors: false, fileMatcher, diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 4c0b4e5e2a6f..e13c114c9732 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -119,7 +119,7 @@ private protected async Task TestAsync(string testCode, string expec fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, fileMatcher, diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index 6c7a8d2880bf..86fbe17ecebe 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -61,7 +61,7 @@ private async Task> TestFormattedFiles(string testCode) fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Error, fixAnalyzers: false, - analyerSeverity: DiagnosticSeverity.Error, + analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, fileMatcher, diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 0c3a8f02fd15..ce5c874434cd 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -6,6 +6,9 @@ false Microsoft.CodeAnalysis.Tools.Tests + + true + LatestMajor From 621b9b4f2f9008042a97f2b3b333d34c5b466ba0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 10 Aug 2020 10:29:10 -0700 Subject: [PATCH 1119/2702] Increase integration test timeout --- azure-pipelines-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index d4851c1a5059..c85f9acfac9c 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -64,7 +64,7 @@ jobs: _targetSolution: "EntityFramework.sln" _branchName: "master" _sha: "efd56d44977632d1915a569046be6a23cb39da16" - timeoutInMinutes: 30 + timeoutInMinutes: 35 steps: - script: eng\integration-test.cmd -repo '$(_repo)' -branchName '$(_branchName)' -sha '$(_sha)' -targetSolution '$(_targetSolution)' -testPath '$(Build.SourcesDirectory)\temp' -stage 'prepare' displayName: Prepare $(_repoName) for formatting From f17df8893de570b69637855be28adb159675aa33 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2020 12:21:44 +0000 Subject: [PATCH 1120/2702] Update dependencies from https://github.com/dotnet/arcade build 20200807.3 (#752) [master] Update dependencies from dotnet/arcade - Updates: - Microsoft.DotNet.Arcade.Sdk: from 5.0.0-beta.20403.5 to 5.0.0-beta.20407.3 --- eng/Version.Details.xml | 4 ++-- eng/common/SetupNugetSources.ps1 | 17 +++++++++++++++++ eng/common/SetupNugetSources.sh | 23 +++++++++++++++++++++-- global.json | 2 +- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8c658ed8fc83..5e1432005067 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 7385e2722b9fa517314aa5db1fa598a8d417b3c7 + ea8f37e8982dc22022b33c5e151081ad04d923a6 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index dc22178125a6..bb3617133f09 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -11,6 +11,8 @@ # See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)` # from the AzureDevOps-Artifact-Feeds-Pats variable group. # +# Any disabledPackageSources entries which start with "darc-int" will be re-enabled as part of this script executing +# # - task: PowerShell@2 # displayName: Setup Private Feeds Credentials # condition: eq(variables['Agent.OS'], 'Windows_NT') @@ -94,6 +96,14 @@ function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Passw } } +function EnablePrivatePackageSources($DisabledPackageSources) { + $maestroPrivateSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]") + ForEach ($DisabledPackageSource in $maestroPrivateSources) { + Write-Host "`tEnsuring private source '$($DisabledPackageSource.key)' is enabled" + $DisabledPackageSource.SetAttribute("value", "false") + } +} + if (!(Test-Path $ConfigFile -PathType Leaf)) { Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. Couldn't find the NuGet config file: $ConfigFile" ExitWithExitCode 1 @@ -123,6 +133,13 @@ if ($creds -eq $null) { $doc.DocumentElement.AppendChild($creds) | Out-Null } +# Check for disabledPackageSources; we'll enable any darc-int ones we find there +$disabledSources = $doc.DocumentElement.SelectSingleNode("disabledPackageSources") +if ($disabledSources -ne $null) { + Write-Host "Checking for any darc-int disabled package sources in the disabledPackageSources node" + EnablePrivatePackageSources -DisabledPackageSources $disabledSources +} + $userName = "dn-bot" # Insert credential nodes for Maestro's private feeds diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index f33e37711e72..ef33382954cf 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -13,6 +13,8 @@ # See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)` # from the AzureDevOps-Artifact-Feeds-Pats variable group. # +# Any disabledPackageSources entries which start with "darc-int" will be re-enabled as part of this script executing. +# # - task: Bash@3 # displayName: Setup Private Feeds Credentials # inputs: @@ -63,7 +65,7 @@ if [ "$?" != "0" ]; then ConfigNodeHeader="" PackageSourcesTemplate="${TB}${NL}${TB}" - sed -i.bak "s|$ConfigNodeHeader|$ConfigNodeHeader${NL}$PackageSourcesTemplate|" NuGet.config + sed -i.bak "s|$ConfigNodeHeader|$ConfigNodeHeader${NL}$PackageSourcesTemplate|" $ConfigFile fi # Ensure there is a ... section. @@ -74,7 +76,7 @@ if [ "$?" != "0" ]; then PackageSourcesNodeFooter="" PackageSourceCredentialsTemplate="${TB}${NL}${TB}" - sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" NuGet.config + sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" $ConfigFile fi PackageSources=() @@ -146,3 +148,20 @@ for FeedName in ${PackageSources[@]} ; do sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" $ConfigFile fi done + +# Re-enable any entries in disabledPackageSources where the feed name contains darc-int +grep -i "" $ConfigFile +if [ "$?" == "0" ]; then + DisabledDarcIntSources=() + echo "Re-enabling any disabled \"darc-int\" package sources in $ConfigFile" + DisabledDarcIntSources+=$(grep -oh '"darc-int-[^"]*" value="true"' $ConfigFile | tr -d '"') + for DisabledSourceName in ${DisabledDarcIntSources[@]} ; do + if [[ $DisabledSourceName == darc-int* ]] + then + OldDisableValue="add key=\"$DisabledSourceName\" value=\"true\"" + NewDisableValue="add key=\"$DisabledSourceName\" value=\"false\"" + sed -i.bak "s|$OldDisableValue|$NewDisableValue|" $ConfigFile + echo "Neutralized disablePackageSources entry for '$DisabledSourceName'" + fi + done +fi diff --git a/global.json b/global.json index 7bc48e1c46d4..9077646eed05 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-preview.6.20310.4" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20403.5" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20407.3" } } From 83afb80b5d72fba0e278410434775e4a4ede028a Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 11 Aug 2020 09:37:43 -0700 Subject: [PATCH 1121/2702] Move strings to resource --- src/Analyzers/AnalyzerRunner.cs | 10 ++++++---- src/Program.cs | 2 +- src/Resources.resx | 9 +++++++++ src/xlf/Resources.cs.xlf | 15 +++++++++++++++ src/xlf/Resources.de.xlf | 15 +++++++++++++++ src/xlf/Resources.es.xlf | 15 +++++++++++++++ src/xlf/Resources.fr.xlf | 15 +++++++++++++++ src/xlf/Resources.it.xlf | 15 +++++++++++++++ src/xlf/Resources.ja.xlf | 15 +++++++++++++++ src/xlf/Resources.ko.xlf | 15 +++++++++++++++ src/xlf/Resources.pl.xlf | 15 +++++++++++++++ src/xlf/Resources.pt-BR.xlf | 15 +++++++++++++++ src/xlf/Resources.ru.xlf | 15 +++++++++++++++ src/xlf/Resources.tr.xlf | 15 +++++++++++++++ src/xlf/Resources.zh-Hans.xlf | 15 +++++++++++++++ src/xlf/Resources.zh-Hant.xlf | 15 +++++++++++++++ 16 files changed, 211 insertions(+), 5 deletions(-) diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index 7a260e63062b..ce656e748c6a 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Immutable; -using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -35,14 +34,16 @@ public async Task RunCodeAnalysisAsync( { // If are not running any analyzers and are not reporting compiler diagnostics, then there is // nothing to report. - if (analyzers.IsEmpty && !_includeComplilerDiagnostics) + if (analyzers.IsEmpty && includeCompilerDiagnostics) { return; } + // For projects targeting NetStandard, the Runtime references are resolved from the project.assets.json. + // This file is generated during a `dotnet restore`. if (!AllReferencedProjectsLoaded(project)) { - Debug.WriteLine($"Required references did not load for {project.Name} or referenced project."); + logger.LogWarning(Resources.Required_references_did_not_load_for_0_or_referenced_project_Run_dotnet_restore_prior_to_formatting, project.Name); return; } @@ -59,7 +60,7 @@ public async Task RunCodeAnalysisAsync( } else { - Debug.WriteLine($"Running {analyzers.Length} analyzers on {project.Name}."); + logger.LogDebug(Resources.Running_0_analyzers_on_1, analyzers.Length, project.Name); var analyzerOptions = new CompilationWithAnalyzersOptions( project.AnalyzerOptions, @@ -90,6 +91,7 @@ public async Task RunCodeAnalysisAsync( static bool AllReferencedProjectsLoaded(Project project) { + // Use mscorlib to represent Runtime references being loaded. if (!project.MetadataReferences.Any(reference => reference.Display?.EndsWith("mscorlib.dll") == true)) { return false; diff --git a/src/Program.cs b/src/Program.cs index a2f5bd454ace..0fe07cce63ca 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -109,7 +109,7 @@ public static async Task Run( var runtimeVersion = GetRuntimeVersion(); - Debug.WriteLine($"The dotnet runtime version is '{runtimeVersion}'."); + logger.LogDebug(Resources.The_dotnet_runtime_version_is_0, runtimeVersion); // Load MSBuild Environment.CurrentDirectory = workspaceDirectory; diff --git a/src/Resources.resx b/src/Resources.resx index 7a329aa21bbf..fe2ae7cbdcc9 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -270,4 +270,13 @@ Unable to fix {0}. No associated code fix found. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + + Running {0} analyzers on {1}. + + + The dotnet runtime version is '{0}'. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index e36838544388..70272b865a8f 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -152,6 +152,11 @@ {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí argumentu <workspace>. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. Spustit analyzátory třetích stran a použít opravy @@ -167,6 +172,11 @@ Probíhá analýza {0}. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. Spouští se formátování. @@ -192,6 +202,11 @@ Verze .NET CLI je {0}. + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. Soubor {0} zřejmě není platný soubor projektu nebo řešení. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 811907f1bded..02630a051b62 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -152,6 +152,11 @@ In "{0}" wurden mehrere MSBuild-Projektmappendateien gefunden. Geben Sie die zu verwendende Datei mit dem <workspace>-Argument an. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. Führen Sie Drittanbieter-Analysetools aus, und wenden Sie Korrekturen an. @@ -167,6 +172,11 @@ Die Analyse für "{0}" wird ausgeführt. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. Formatierer werden ausgeführt. @@ -192,6 +202,11 @@ Die dotnet-CLI-Version ist "{0}". + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. Die Datei "{0}" ist weder ein gültiges Projekt noch eine Projektmappendatei. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index ccca3a188dba..d2d895126f03 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -152,6 +152,11 @@ Se encontraron varios archivos de solución MSBuild en "{0}". Especifique cuál debe usarse con el argumento <workspace>. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. Ejecute analizadores de terceros y aplique las correcciones. @@ -167,6 +172,11 @@ Ejecutando el análisis de {0}. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. Ejecutando los formateadores. @@ -192,6 +202,11 @@ La versión de la CLI de dotnet es "{0}". + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. El archivo "{0}" no parece ser un proyecto o archivo de solución válido. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 213e9a062a27..7ebb2d7a05bc 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -152,6 +152,11 @@ Plusieurs fichiers solution MSBuild trouvés dans '{0}'. Spécifiez celui qui doit être utilisé avec l'argument <espace de travail>. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. Exécutez des analyseurs tiers et appliquez des correctifs. @@ -167,6 +172,11 @@ Exécution de l'analyse de {0}. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. Exécution des formateurs. @@ -192,6 +202,11 @@ La version de l'interface CLI dotnet est '{0}'. + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. Le fichier '{0}' ne semble pas être un fichier projet ou solution valide. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index e2a3c9a79cc8..7ec1b5c3043c 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -152,6 +152,11 @@ In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'argomento <workspace>. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. Esegue gli analizzatori di terze parti e applica le correzioni. @@ -167,6 +172,11 @@ Esecuzione dell'analisi {0}. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. Esecuzione dei formattatori. @@ -192,6 +202,11 @@ La versione dell'interfaccia della riga di comando di dotnet è '{0}'. + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. Il file '{0}' non sembra essere un file di progetto o di soluzione valido. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 1632d727ff04..f2bd4c888c77 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -152,6 +152,11 @@ 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するものを <workspace> 引数で指定してください。 + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. サード パーティのアナライザーを実行し、修正プログラムを適用します。 @@ -167,6 +172,11 @@ {0} 分析を実行しています。 + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. フォーマッタを実行しています。 @@ -192,6 +202,11 @@ dotnet CLI バージョンは '{0}' です。 + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. ファイル '{0}' が、有効なプロジェクト ファイルまたはソリューション ファイルではない可能性があります。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 42193129944e..4c82023d1180 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -152,6 +152,11 @@ '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. <workspace> 인수를 사용하여 사용할 파일을 지정하세요. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. 타사 분석기를 실행하고 수정 사항을 적용합니다. @@ -167,6 +172,11 @@ {0} 분석을 실행하고 있습니다. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. 포맷터를 실행하는 중입니다. @@ -192,6 +202,11 @@ dotnet CLI 버전은 '{0}'입니다. + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. '{0}' 파일은 유효한 프로젝트 또는 솔루션 파일이 아닌 것 같습니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 636862d854b7..704d220b5cad 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -152,6 +152,11 @@ W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą argumentu <workspace>. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. Uruchom analizatory innych firm i zastosuj poprawki. @@ -167,6 +172,11 @@ Uruchamianie analizy {0}. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. Uruchamianie elementów formatujących. @@ -192,6 +202,11 @@ Wersja interfejsu wiersza polecenia dotnet to „{0}”. + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. Plik „{0}” prawdopodobnie nie jest prawidłowym plikiem projektu lub rozwiązania. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 33b2404dbf12..10fade6e31d3 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -152,6 +152,11 @@ Foram encontrados vários arquivos de solução do MSBuild em '{0}'. Especifique qual será usado com o argumento <workspace>. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. Executar analisadores de terceiros e aplicar correções. @@ -167,6 +172,11 @@ Executando a análise de {0}. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. Executando formatadores. @@ -192,6 +202,11 @@ A versão do CLI do dotnet é '{0}'. + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. O arquivo '{0}' parece não ser um projeto válido ou o arquivo de solução. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index bc2bfc0d7d09..39cc7e15f0d6 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -152,6 +152,11 @@ В "{0}" обнаружено несколько файлов решения MSBuild. Укажите используемый файл с помощью аргумента <workspace>. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. Запустите сторонние анализаторы и примените исправления. @@ -167,6 +172,11 @@ Выполнение анализа {0}. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. Запуск средств форматирования. @@ -192,6 +202,11 @@ Версия CLI dotnet: "{0}". + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. Файл "{0}" не является допустимым файлом проекта или решения. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 3468b3970900..632018283197 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -152,6 +152,11 @@ '{0}' içinde birden fazla MSBuild çözüm dosyası bulundu. Hangisinin <çalışma alanı> bağımsız değişkeni ile kullanılacağını belirtin. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. 3. taraf çözümleyicileri çalıştırıp düzeltmeleri uygulayın. @@ -167,6 +172,11 @@ {0} analizi çalıştırılıyor. + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. Biçimlendiriciler çalıştırılıyor. @@ -192,6 +202,11 @@ dotnet CLI sürümü: '{0}'. + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. '{0}' dosyası geçerli proje veya çözüm dosyası gibi görünmüyor. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index edd07603b7b3..d75adc1f0530 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -152,6 +152,11 @@ 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 <workspace> 参数的文件。 + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. 运行第三方分析器并应用修补程序。 @@ -167,6 +172,11 @@ 正在运行 {0} 分析。 + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. 正在运行格式化程序。 @@ -192,6 +202,11 @@ dotnet CLI 版本为“{0}”。 + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. 文件“{0}”似乎不是有效的项目或解决方案文件。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 351835105527..20c90752d0df 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -152,6 +152,11 @@ 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要用於 <workspace> 引數的檔案。 + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. + + Run 3rd party analyzers and apply fixes. 執行協力廠商分析器並套用修正。 @@ -167,6 +172,11 @@ 正在執行 {0} 分析。 + + Running {0} analyzers on {1}. + Running {0} analyzers on {1}. + + Running formatters. 正在執行格式器。 @@ -192,6 +202,11 @@ dotnet CLI 版本為 '{0}'。 + + The dotnet runtime version is '{0}'. + The dotnet runtime version is '{0}'. + + The file '{0}' does not appear to be a valid project or solution file. 檔案 '{0}' 似乎不是有效的專案或解決方案檔。 From b469c6f7f8ef1d08c2046999cfabfbdaa420a4a9 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 11 Aug 2020 10:29:59 -0700 Subject: [PATCH 1122/2702] Bump integration timeout higher --- azure-pipelines-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index c85f9acfac9c..e430b9ba1597 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -64,7 +64,7 @@ jobs: _targetSolution: "EntityFramework.sln" _branchName: "master" _sha: "efd56d44977632d1915a569046be6a23cb39da16" - timeoutInMinutes: 35 + timeoutInMinutes: 40 steps: - script: eng\integration-test.cmd -repo '$(_repo)' -branchName '$(_branchName)' -sha '$(_sha)' -targetSolution '$(_targetSolution)' -testPath '$(Build.SourcesDirectory)\temp' -stage 'prepare' displayName: Prepare $(_repoName) for formatting From 7b1ce1cde01aad05123f27e9aa4028315eb4af2e Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 11 Aug 2020 13:16:39 -0700 Subject: [PATCH 1123/2702] Remove aliases for the fix style and fix analyzers options --- src/FormatCommand.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 51890f8f2b0e..74cd503dc95e 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -22,11 +22,11 @@ internal static RootCommand CreateCommandLineOptions() Description = Resources.A_path_to_a_solution_file_a_project_file_or_a_folder_containing_a_solution_or_project_file_If_a_path_is_not_specified_then_the_current_directory_is_used }.LegalFilePathsOnly(), new Option(new[] { "--folder", "-f" }, Resources.Whether_to_treat_the_workspace_argument_as_a_simple_folder_of_files), - new Option(new[] { "--fix-style", "-fs" }, Resources.Run_code_style_analyzers_and_apply_fixes) + new Option(new[] { "--fix-style" }, Resources.Run_code_style_analyzers_and_apply_fixes) { Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne }.FromAmong(SeverityLevels) }, - new Option(new[] { "--fix-analyzers", "-fa" }, Resources.Run_3rd_party_analyzers_and_apply_fixes) + new Option(new[] { "--fix-analyzers" }, Resources.Run_3rd_party_analyzers_and_apply_fixes) { Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne }.FromAmong(SeverityLevels) }, From 19a56feb20cb6ef36daa10285c996d405a227a28 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 11 Aug 2020 13:38:00 -0700 Subject: [PATCH 1124/2702] Remove -fs and -fa alias usage from Readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 38219b8ac465..6be257227851 100644 --- a/README.md +++ b/README.md @@ -72,8 +72,8 @@ Arguments: Options: --folder, -f Whether to treat the `` argument as a simple folder of files. - --fix-style, -fs Run code style analyzers and apply fixes. - --fix-analyzers, -fa Run 3rd party analyzers and apply fixes. + --fix-style Run code style analyzers and apply fixes. + --fix-analyzers Run 3rd party analyzers and apply fixes. --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. --exclude A list of relative file or folder paths to exclude from formatting. --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. From c2e399194ea16460c3d7268078c3bf3410a058db Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2020 16:31:54 +0000 Subject: [PATCH 1125/2702] [master] Update dependencies from dotnet/roslyn (#754) [master] Update dependencies from dotnet/roslyn - Updates: - Microsoft.NETCore.Compilers: from 3.8.0-2.20407.3 to 3.8.0-2.20412.1 - Access configured diagnostic severity from SyntaxTreeOptions --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- src/Analyzers/AnalyzerOptionExtensions.cs | 16 ++++++++++------ src/Formatters/UnnecessaryImportsFormatter.cs | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5e1432005067..54a7c6f70011 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - dba2fa57432b4bd9cc7880e2c6fe3acdd01bba3c + 2b1f11473391786d27aac50e58f79428d070f9b6 diff --git a/eng/Versions.props b/eng/Versions.props index 61e7916d8ecf..0061dcfc43a3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.8.0-2.20407.3 + 3.8.0-2.20412.1 3.1.1 - 3.8.0-2.20412.1 + 3.8.0-2.20413.3 3.1.1 3.8.0-2.20413.3 - 3.1.1 + 5.0.0-preview.7.20364.11 - 2.0.0-beta1.20303.1 - 0.3.0-alpha.20303.1 + 2.0.0-beta1.20371.2 + 0.3.0-alpha.20371.2 $(MicrosoftBuildVersion) 1.2.6 - 1.0.1-beta1.20114.4 + 1.0.1-beta1.20413.3 $(MicrosoftExtensionsVersion) $(MicrosoftExtensionsVersion) $(MicrosoftExtensionsVersion) - 3.0.0 + 3.3.0 $(MicrosoftNETCoreCompilersPackageVersion) - 4.7.0 + $(MicrosoftExtensionsVersion) - 3.8.0-2.20413.3 + 3.8.0-2.20414.2 3.1.1 - 3.8.0-2.20414.2 + 3.8.0-2.20414.4 3.1.1 - 3.8.0-2.20414.4 + 3.8.0-2.20419.4 5.0.0-preview.7.20364.11 py -3 - $(HelixPreCommands);call %HELIX_CORRELATION_PAYLOAD%\performance\tools\machine-setup.cmd;set PYTHONPATH=%HELIX_WORKITEM_PAYLOAD%\scripts%3B%HELIX_WORKITEM_PAYLOAD% - %HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts - $HELIX_CORRELATION_PAYLOAD - $(BaseDirectory)/performance + $(HelixPreCommands) + %HELIX_CORRELATION_PAYLOAD%\Core_Root + %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\ + $(ScenarioDirectory)crossgen\ + $(ScenarioDirectory)crossgen2\ - - - $(PerformanceDirectory)/scripts/benchmarks_ci.py --csproj $(PerformanceDirectory)/$(TargetCsproj) - --dotnet-versions $DOTNET_VERSION --cli-source-info args --cli-branch $PERFLAB_BRANCH --cli-commit-sha $PERFLAB_HASH --cli-repository https://github.com/$PERFLAB_REPO --cli-source-timestamp $PERFLAB_BUILDTIMESTAMP + python3 - $(BaseDirectory)/Core_Root/corerun - $(HelixPreCommands);chmod +x $(PerformanceDirectory)/tools/machine-setup.sh;. $(PerformanceDirectory)/tools/machine-setup.sh - $(BaseDirectory)/artifacts/BenchmarkDotNet.Artifacts - $(BaseDirectory)/artifacts/BenchmarkDotNet.Artifacts_Baseline - $(PerformanceDirectory)/src/tools/ResultsComparer/ResultsComparer.csproj - $(PerformanceDirectory)/tools/dotnet/$(Architecture)/dotnet - %25 - $HELIX_WORKITEM_ROOT/testResults.xml - + $(HelixPreCommands);chmod +x $HELIX_WORKITEM_PAYLOAD/startup/Startup;chmod +x $HELIX_WORKITEM_PAYLOAD/startup/perfcollect;sudo apt update + $HELIX_CORRELATION_PAYLOAD/Core_Root + $HELIX_CORRELATION_PAYLOAD/performance/src/scenarios/ + $(ScenarioDirectory)crossgen/ + $(ScenarioDirectory)crossgen2/ + - - %(Identity) - + + + + + + + + - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen\test.py crossgen --test-name System.Private.Xml.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen\test.py crossgen --test-name System.Linq.Expressions.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen\test.py crossgen --test-name Microsoft.CodeAnalysis.VisualBasic.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen\test.py crossgen --test-name Microsoft.CodeAnalysis.CSharp.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen\test.py crossgen --test-name System.Private.CoreLib.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - + + + $(WorkItemDirectory) + $(Python) $(CrossgenDirectory)test.py crossgen --core-root $(CoreRoot) --test-name %(Identity) + - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\test.py crossgen2 --single System.Private.Xml.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\test.py crossgen2 --single System.Linq.Expressions.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\test.py crossgen2 --single Microsoft.CodeAnalysis.VisualBasic.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root - - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\test.py crossgen2 --single Microsoft.CodeAnalysis.CSharp.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root + + + $(WorkItemDirectory) + $(Python) $(Crossgen2Directory)test.py crossgen2 --core-root $(CoreRoot) --single %(Identity) + + + + + + + 4:00 - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\test.py crossgen2 --single System.Private.CoreLib.dll --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root + + + 4:00 - - $(WorkItemDirectory)\ScenarioCorrelation - $(Python) %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\test.py crossgen2 --composite %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\crossgen2\framework-r2r.dll.rsp --core-root %HELIX_CORRELATION_PAYLOAD%\Core_Root + + $(WorkItemDirectory) + $(Python) $(Crossgen2Directory)test.py crossgen2 --core-root $(CoreRoot) --composite $(Crossgen2Directory)framework-r2r.dll.rsp 1:00 diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index b5dc8e1e7d35..806e56c6121f 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -26,6 +26,7 @@ use_baseline_core_run=true using_mono=false wasm_runtime_loc= using_wasm=false +use_latest_dotnet=false while (($# > 0)); do lowerI="$(echo $1 | awk '{print tolower($0)}')" @@ -115,7 +116,11 @@ while (($# > 0)); do configurations=$2 shift 2 ;; - --help) + --latestdotnet) + use_latest_dotnet=true + shift 1 + ;; + *) echo "Common settings:" echo " --corerootdirectory Directory where Core_Root exists, if running perf testing with --corerun" echo " --architecture Architecture of the testing being run" @@ -137,6 +142,7 @@ while (($# > 0)); do echo " --internal If the benchmarks are running as an official job." echo " --monodotnet Pass the path to the mono dotnet for mono performance testing." echo " --wasm Path to the unpacked wasm runtime pack." + echo " --latestdotnet --dotnet-versions will not be specified. --dotnet-versions defaults to LKG version in global.json " echo "" exit 0 ;; @@ -200,7 +206,7 @@ if [[ "$mono_dotnet" != "" ]] && [[ "$monointerpreter" == "false" ]]; then fi if [[ "$wasm_runtime_loc" != "" ]]; then - configurations="CompilationMode=wasm RunKind=micro" + configurations="CompilationMode=wasm RunKind=$kind" extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --category-exclusion-filter NoInterpreter NoWASM NoMono" fi @@ -212,11 +218,12 @@ common_setup_arguments="--channel master --queue $queue --build-number $build_nu setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" -# Get the tools section from the global.json. -# This grabs the LKG version number of dotnet and passes it to our scripts -dotnet_version=`cat global.json | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["tools"]["dotnet"])'` -setup_arguments="--dotnet-versions $dotnet_version $setup_arguments" - +if [[ "$use_latest_dotnet" = false ]]; then + # Get the tools section from the global.json. + # This grabs the LKG version number of dotnet and passes it to our scripts + dotnet_version=`cat global.json | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["tools"]["dotnet"])'` + setup_arguments="--dotnet-versions $dotnet_version $setup_arguments" +fi if [[ "$run_from_perf_repo" = true ]]; then payload_directory= @@ -267,7 +274,7 @@ Write-PipelineSetVariable -name "PerformanceDirectory" -value "$performance_dire Write-PipelineSetVariable -name "WorkItemDirectory" -value "$workitem_directory" -is_multi_job_variable false Write-PipelineSetVariable -name "Queue" -value "$queue" -is_multi_job_variable false Write-PipelineSetVariable -name "SetupArguments" -value "$setup_arguments" -is_multi_job_variable false -Write-PipelineSetVariable -name "Python" -value "$python3" -is_multi_job_variable false +Write-PipelineSetVariable -name "Python" -value "python3" -is_multi_job_variable false Write-PipelineSetVariable -name "PerfLabArguments" -value "$perflab_arguments" -is_multi_job_variable false Write-PipelineSetVariable -name "ExtraBenchmarkDotNetArguments" -value "$extra_benchmark_dotnet_arguments" -is_multi_job_variable false Write-PipelineSetVariable -name "BDNCategories" -value "$run_categories" -is_multi_job_variable false diff --git a/global.json b/global.json index 235de1440573..d50548bcc00e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-preview.6.20310.4" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20424.23" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20426.1" } } From 3b17982c75379d54bcf33b9a58b0fb4e858e8097 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 28 Aug 2020 12:42:07 +0000 Subject: [PATCH 1163/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200828.3 (#785) [master] Update dependencies from dotnet/roslyn - Updates: - Microsoft.NETCore.Compilers: from 3.8.0-2.20419.4 to 3.8.0-2.20428.3 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1fe19d5b0c45..0637336089e7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - afb288f6c778c18003e89d8dd8ca94106df18702 + 24d279c313c40d93dd249e40170faf796353bd6d diff --git a/eng/Versions.props b/eng/Versions.props index c8440afd19ee..7dacaa443a48 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.8.0-2.20419.4 + 3.8.0-2.20428.3 5.0.0-preview.7.20364.11 - 3.8.0-2.20428.3 + 3.8.0-3.20452.1 5.0.0-preview.7.20364.11 - 3.8.0-3.20452.1 + 3.8.0-3.20453.2 5.0.0-preview.7.20364.11 - 3.8.0-3.20453.2 + 3.8.0-3.20454.4 5.0.0-preview.7.20364.11 + diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 95b113b33bbf..650b13b089b2 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -8,7 +8,7 @@ param( [Parameter(Mandatory=$false)][string] $EnableSourceLinkValidation, [Parameter(Mandatory=$false)][string] $EnableSigningValidation, [Parameter(Mandatory=$false)][string] $EnableNugetValidation, - [Parameter(Mandatory=$true)][string] $PublishInstallersAndChecksums, + [Parameter(Mandatory=$false)][string] $PublishInstallersAndChecksums, [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, [Parameter(Mandatory=$false)][string] $SigningValidationAdditionalParameters ) @@ -16,7 +16,7 @@ param( try { . $PSScriptRoot\post-build-utils.ps1 # Hard coding darc version till the next arcade-services roll out, cos this version has required API changes for darc add-build-to-channel - . $PSScriptRoot\..\darc-init.ps1 -darcVersion "1.1.0-beta.20418.1" + $darc = Get-Darc "1.1.0-beta.20418.1" $optionalParams = [System.Collections.ArrayList]::new() @@ -29,7 +29,7 @@ try { $optionalParams.Add("--no-wait") | Out-Null } - if ("true" -eq $PublishInstallersAndChecksums) { + if ("false" -ne $PublishInstallersAndChecksums) { $optionalParams.Add("--publish-installers-and-checksums") | Out-Null } @@ -50,12 +50,11 @@ try { } } - & darc add-build-to-channel ` + & $darc add-build-to-channel ` --id $buildId ` --publishing-infra-version $PublishingInfraVersion ` --default-channels ` --source-branch master ` - --publish-installers-and-checksums ` --azdev-pat $AzdoToken ` --bar-uri $MaestroApiEndPoint ` --password $MaestroToken ` diff --git a/eng/common/templates/post-build/channels/generic-internal-channel.yml b/eng/common/templates/post-build/channels/generic-internal-channel.yml index 59eb93a407cb..7ae5255921aa 100644 --- a/eng/common/templates/post-build/channels/generic-internal-channel.yml +++ b/eng/common/templates/post-build/channels/generic-internal-channel.yml @@ -4,7 +4,7 @@ parameters: artifactsPublishingAdditionalParameters: '' dependsOn: - Validate - publishInstallersAndChecksums: false + publishInstallersAndChecksums: true symbolPublishingAdditionalParameters: '' stageName: '' channelName: '' @@ -158,7 +158,7 @@ stages: /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release - /p:PublishInstallersAndChecksums=true + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:ChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(InternalChecksumsBlobFeedKey) /p:InstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) diff --git a/eng/common/templates/post-build/channels/generic-public-channel.yml b/eng/common/templates/post-build/channels/generic-public-channel.yml index 7e80a621a303..6cf39dbb2907 100644 --- a/eng/common/templates/post-build/channels/generic-public-channel.yml +++ b/eng/common/templates/post-build/channels/generic-public-channel.yml @@ -4,7 +4,7 @@ parameters: artifactsPublishingAdditionalParameters: '' dependsOn: - Validate - publishInstallersAndChecksums: false + publishInstallersAndChecksums: true symbolPublishingAdditionalParameters: '' stageName: '' channelName: '' diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 630a99d4dda3..df06f5371e7b 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -19,7 +19,7 @@ parameters: enableSigningValidation: true enableSymbolValidation: false enableNugetValidation: true - publishInstallersAndChecksums: false + publishInstallersAndChecksums: true SDLValidationParameters: enable: false continueOnError: false diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index daca90c0b63b..37a3a3d68001 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -718,6 +718,16 @@ function IsWindowsPlatform() { return [environment]::OSVersion.Platform -eq [PlatformID]::Win32NT } +function Get-Darc($version) { + $darcPath = "$TempDir\darc\$(New-Guid)" + if ($version -ne $null) { + & $PSScriptRoot\darc-init.ps1 -toolpath $darcPath -darcVersion $version | Out-Host + } else { + & $PSScriptRoot\darc-init.ps1 -toolpath $darcPath | Out-Host + } + return "$darcPath\darc.exe" +} + . $PSScriptRoot\pipeline-logging-functions.ps1 $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..') diff --git a/global.json b/global.json index fd645b8be056..3e2276cb9c3b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-preview.6.20310.4" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20452.19" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20453.7" } } From 6e49a72a47068b64f459a5f029178b7ad1193fb6 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 8 Sep 2020 19:00:11 -0700 Subject: [PATCH 1180/2702] Add option for whitespace formatting (#774) * Add option for whitespace formatting * Fix formatting * Fix validation CI * Add fix prefix to options --- README.md | 29 +++++++++-------- docs/README.md | 18 ++++++++++- eng/format-verifier.ps1 | 2 +- perf/FormattedFiles.cs | 9 ++---- perf/NoFilesFormatted.cs | 9 ++---- perf/RealWorldSolution.cs | 6 ++-- src/Analyzers/AnalyzerFormatter.cs | 4 +++ .../AnalyzerReferenceInformationProvider.cs | 5 --- src/Analyzers/CodeStyleInformationProvider.cs | 7 +---- src/CodeFormatter.cs | 10 ++++-- src/FixCategory.cs | 15 +++++++++ src/FormatCommand.cs | 5 +-- src/FormatOptions.cs | 15 +++------ src/Formatters/CharsetFormatter.cs | 2 ++ src/Formatters/DocumentFormatter.cs | 5 +++ src/Formatters/EndOfLineFormatter.cs | 2 ++ src/Formatters/FinalNewlineFormatter.cs | 2 ++ src/Formatters/ICodeFormatter.cs | 5 +++ src/Formatters/OrganizeImportsFormatter.cs | 2 ++ src/Formatters/UnnecessaryImportsFormatter.cs | 6 ++-- src/Formatters/WhitespaceFormatter.cs | 2 ++ src/Program.cs | 28 +++++++++++++---- .../RemoveUnnecessaryImportsHelper.cs | 2 +- src/Resources.resx | 3 ++ src/Utilities/Index.cs | 4 +-- src/xlf/Resources.cs.xlf | 5 +++ src/xlf/Resources.de.xlf | 5 +++ src/xlf/Resources.es.xlf | 5 +++ src/xlf/Resources.fr.xlf | 5 +++ src/xlf/Resources.it.xlf | 5 +++ src/xlf/Resources.ja.xlf | 5 +++ src/xlf/Resources.ko.xlf | 5 +++ src/xlf/Resources.pl.xlf | 5 +++ src/xlf/Resources.pt-BR.xlf | 5 +++ src/xlf/Resources.ru.xlf | 5 +++ src/xlf/Resources.tr.xlf | 5 +++ src/xlf/Resources.zh-Hans.xlf | 5 +++ src/xlf/Resources.zh-Hant.xlf | 5 +++ tests/CodeFormatterTests.cs | 31 +++++++++++++------ tests/Formatters/AbstractFormatterTests.cs | 16 ++++------ tests/Formatters/FormattedFilesTests.cs | 3 +- .../UnnecessaryImportsFormatterTests.cs | 8 ++--- validate.rsp | 1 + 43 files changed, 227 insertions(+), 94 deletions(-) create mode 100644 src/FixCategory.cs diff --git a/README.md b/README.md index 6be257227851..a97469628946 100644 --- a/README.md +++ b/README.md @@ -72,8 +72,9 @@ Arguments: Options: --folder, -f Whether to treat the `` argument as a simple folder of files. - --fix-style Run code style analyzers and apply fixes. - --fix-analyzers Run 3rd party analyzers and apply fixes. + --fix-whitespace, -w Run whitespace formatting. Run by default when not applying fixes. + --fix-style, -s Run code style analyzers and apply fixes. + --fix-analyzers, -a Run 3rd party analyzers and apply fixes. --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. --exclude A list of relative file or folder paths to exclude from formatting. --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -84,17 +85,19 @@ Options: Add `format` after `dotnet` and before the command arguments that you want to run: -| Examples | Description | -| ---------------------------------------------------------- |---------------------------------------------------------------------------------------------- | -| dotnet **format** | Formats the project or solution in the current directory. | -| dotnet **format** <workspace> | Formats a specific project or solution. | -| dotnet **format** <workspace> -f | Formats a particular folder and subfolders. | -| dotnet **format** <workspace> --fix-style warn | Formats and fixes codestyle analyzer warnings. | -| dotnet **format** <workspace> --fix-analyzers | Formats and fixes 3rd party analyzer errors. | -| dotnet **format** -v diag | Formats with very verbose logging. | -| dotnet **format** --include Programs.cs Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | -| dotnet **format** --check | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | -| dotnet **format** --report <report-path> | Formats and saves a json report file to the given directory. | +| Examples | Description | +| ---------------------------------------------------------------- |---------------------------------------------------------------------------------------------- | +| dotnet **format** | Formats the project or solution in the current directory. | +| dotnet **format** <workspace> | Formats a specific project or solution. | +| dotnet **format** <workspace> -f | Formats a particular folder and subfolders. | +| dotnet **format** <workspace> --fix-style warn | Fixes only codestyle analyzer warnings. | +| dotnet **format** <workspace> --fix-whitespace --fix-style | Formats and fixes codestyle analyzer errors. | +| dotnet **format** <workspace> --fix-analyzers | Fixes only 3rd party analyzer errors. | +| dotnet **format** <workspace> -wsa | Formats, fixes codestyle errors, and fixes 3rd party analyzer errors. | +| dotnet **format** -v diag | Formats with very verbose logging. | +| dotnet **format** --include Programs.cs Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | +| dotnet **format** --check | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | +| dotnet **format** --report <report-path> | Formats and saves a json report file to the given directory. | ### How To Uninstall diff --git a/docs/README.md b/docs/README.md index f4232e115170..52a6d4026b55 100644 --- a/docs/README.md +++ b/docs/README.md @@ -32,6 +32,22 @@ Format the code files from the `./src` folder. dotnet-format ./src --folder ``` +### Whitespace formatting + +Whitespace formatting includes the core .editorconfig settings along with the placement of spaces and newlines. The whitespace formatter is run by default when not running analysis. When you want to run analysis and fix formatting issues you must specify both. + +Whitespace formatting run by default. + +```console +dotnet-format ./format.sln +``` + +Running the whitespace formatter along with code-style analysis. + +```console +dotnet-format ./format.sln --fix-whitespace --fix-style +``` + ### Running analysis #### CodeStyle analysis @@ -42,7 +58,7 @@ Running codestyle analysis requires the use of a MSBuild solution or project fil *Example:* -Run analysis against the format solution and fix errors. +Run code-style analysis against the format solution and fix errors. ```console dotnet-format ./format.sln --fix-style diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index 4cf1f8ed90cb..bfc9284a786f 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -62,7 +62,7 @@ try { if ($stage -eq "format-workspace") { Write-Output "$(Get-Date) - $solutionFile - Formatting Workspace" - $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- $solution --fix-style --fix-analyzers -v diag --check | Out-String + $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- $solution -wsa -v diag --check | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index b1df99e38a4e..16f74f506fdb 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -33,9 +33,8 @@ public void FilesFormattedFolder() workspacePath, workspaceType, LogLevel.Error, - fixCodeStyle: false, + fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, @@ -53,9 +52,8 @@ public void FilesFormattedProject() workspacePath, workspaceType, LogLevel.Error, - fixCodeStyle: false, + fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, @@ -73,9 +71,8 @@ public void FilesFormattedSolution() workspacePath, workspaceType, LogLevel.Error, - fixCodeStyle: false, + fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index 5beec6fe1881..7dfbfc2cd411 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -33,9 +33,8 @@ public void NoFilesFormattedFolder() workspacePath, workspaceType, LogLevel.Error, - fixCodeStyle: false, + fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, @@ -53,9 +52,8 @@ public void NoFilesFormattedProject() workspacePath, workspaceType, LogLevel.Error, - fixCodeStyle: false, + fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, @@ -73,9 +71,8 @@ public void NoFilesFormattedSolution() workspacePath, workspaceType, LogLevel.Error, - fixCodeStyle: false, + fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index d53af5703690..d3ef7f46e7d6 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -35,9 +35,8 @@ public void FilesFormattedSolution() workspacePath, workspaceType, LogLevel.Error, - fixCodeStyle: false, + fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, @@ -55,9 +54,8 @@ public void FilesFormattedFolder() workspacePath, workspaceType, LogLevel.Error, - fixCodeStyle: false, + fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 24e1be02162e..42bb5be034f5 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -21,13 +21,17 @@ internal class AnalyzerFormatter : ICodeFormatter private readonly IAnalyzerRunner _runner; private readonly ICodeFixApplier _applier; + public FixCategory Category { get; } + public AnalyzerFormatter( string name, + FixCategory category, IAnalyzerInformationProvider informationProvider, IAnalyzerRunner runner, ICodeFixApplier applier) { _name = name; + Category = category; _informationProvider = informationProvider; _runner = runner; _applier = applier; diff --git a/src/Analyzers/AnalyzerReferenceInformationProvider.cs b/src/Analyzers/AnalyzerReferenceInformationProvider.cs index 7d585ab2c03d..eaae51abedad 100644 --- a/src/Analyzers/AnalyzerReferenceInformationProvider.cs +++ b/src/Analyzers/AnalyzerReferenceInformationProvider.cs @@ -17,11 +17,6 @@ public ImmutableDictionary GetAnalyzersAndFixers( FormatOptions formatOptions, ILogger logger) { - if (!formatOptions.FixAnalyzers) - { - return ImmutableDictionary.Empty; - } - return solution.Projects .ToImmutableDictionary(project => project.Id, GetAnalyzersAndFixers); } diff --git a/src/Analyzers/CodeStyleInformationProvider.cs b/src/Analyzers/CodeStyleInformationProvider.cs index d843c93abde1..250639ed1f12 100644 --- a/src/Analyzers/CodeStyleInformationProvider.cs +++ b/src/Analyzers/CodeStyleInformationProvider.cs @@ -18,14 +18,9 @@ internal class CodeStyleInformationProvider : IAnalyzerInformationProvider public ImmutableDictionary GetAnalyzersAndFixers( Solution solution, - FormatOptions options, + FormatOptions formatOptions, ILogger logger) { - if (!options.FixCodeStyle) - { - return ImmutableDictionary.Empty; - } - var assemblies = new[] { _featuresPath, diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 5f86267d59e1..be79fd21e219 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -25,8 +25,8 @@ internal static class CodeFormatter new CharsetFormatter(), new OrganizeImportsFormatter(), new UnnecessaryImportsFormatter(), - new AnalyzerFormatter(Resources.Code_Style, new CodeStyleInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier()), - new AnalyzerFormatter(Resources.Analyzer_Reference, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier())); + new AnalyzerFormatter(Resources.Code_Style, FixCategory.CodeStyle, new CodeStyleInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier()), + new AnalyzerFormatter(Resources.Analyzer_Reference, FixCategory.Analyzers, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier())); public static async Task FormatWorkspaceAsync( FormatOptions formatOptions, @@ -132,6 +132,12 @@ private static async Task RunCodeFormattersAsync( for (var index = 0; index < s_codeFormatters.Length; index++) { + // Only run the formatter if it belongs to one of the categories being fixed. + if (!formatOptions.FixCategory.HasFlag(s_codeFormatters[index].Category)) + { + continue; + } + formattedSolution = await s_codeFormatters[index].FormatAsync(formattedSolution, formattableDocuments, formatOptions, logger, formattedFiles, cancellationToken).ConfigureAwait(false); } diff --git a/src/FixCategory.cs b/src/FixCategory.cs new file mode 100644 index 000000000000..8f383a3232de --- /dev/null +++ b/src/FixCategory.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.CodeAnalysis.Tools +{ + [Flags] + internal enum FixCategory + { + None = 0, + Whitespace = 1, + CodeStyle = 2, + Analyzers = 4 + } +} diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 74cd503dc95e..3ab52d67434e 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -22,11 +22,12 @@ internal static RootCommand CreateCommandLineOptions() Description = Resources.A_path_to_a_solution_file_a_project_file_or_a_folder_containing_a_solution_or_project_file_If_a_path_is_not_specified_then_the_current_directory_is_used }.LegalFilePathsOnly(), new Option(new[] { "--folder", "-f" }, Resources.Whether_to_treat_the_workspace_argument_as_a_simple_folder_of_files), - new Option(new[] { "--fix-style" }, Resources.Run_code_style_analyzers_and_apply_fixes) + new Option(new[] { "--fix-whitespace", "-w" }, Resources.Run_whitespace_formatting_Run_by_default_when_not_applying_fixes), + new Option(new[] { "--fix-style", "-s" }, Resources.Run_code_style_analyzers_and_apply_fixes) { Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne }.FromAmong(SeverityLevels) }, - new Option(new[] { "--fix-analyzers" }, Resources.Run_3rd_party_analyzers_and_apply_fixes) + new Option(new[] { "--fix-analyzers", "-a" }, Resources.Run_3rd_party_analyzers_and_apply_fixes) { Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne }.FromAmong(SeverityLevels) }, diff --git a/src/FormatOptions.cs b/src/FormatOptions.cs index 082e25afd2da..55edf9fa10b7 100644 --- a/src/FormatOptions.cs +++ b/src/FormatOptions.cs @@ -10,9 +10,8 @@ internal class FormatOptions public string WorkspaceFilePath { get; } public WorkspaceType WorkspaceType { get; } public LogLevel LogLevel { get; } - public bool FixCodeStyle { get; } + public FixCategory FixCategory { get; } public DiagnosticSeverity CodeStyleSeverity { get; } - public bool FixAnalyzers { get; } public DiagnosticSeverity AnalyzerSeverity { get; } public bool SaveFormattedFiles { get; } public bool ChangesAreErrors { get; } @@ -24,9 +23,8 @@ public FormatOptions( string workspaceFilePath, WorkspaceType workspaceType, LogLevel logLevel, - bool fixCodeStyle, + FixCategory fixCategory, DiagnosticSeverity codeStyleSeverity, - bool fixAnalyzers, DiagnosticSeverity analyzerSeverity, bool saveFormattedFiles, bool changesAreErrors, @@ -37,9 +35,8 @@ public FormatOptions( WorkspaceFilePath = workspaceFilePath; WorkspaceType = workspaceType; LogLevel = logLevel; - FixCodeStyle = fixCodeStyle; + FixCategory = fixCategory; CodeStyleSeverity = codeStyleSeverity; - FixAnalyzers = fixAnalyzers; AnalyzerSeverity = analyzerSeverity; SaveFormattedFiles = saveFormattedFiles; ChangesAreErrors = changesAreErrors; @@ -52,9 +49,8 @@ public void Deconstruct( out string workspaceFilePath, out WorkspaceType workspaceType, out LogLevel logLevel, - out bool fixCodeStyle, + out FixCategory fixCategory, out DiagnosticSeverity codeStyleSeverity, - out bool fixAnalyzers, out DiagnosticSeverity analyzerSeverity, out bool saveFormattedFiles, out bool changesAreErrors, @@ -65,9 +61,8 @@ public void Deconstruct( workspaceFilePath = WorkspaceFilePath; workspaceType = WorkspaceType; logLevel = LogLevel; - fixCodeStyle = FixCodeStyle; + fixCategory = FixCategory; codeStyleSeverity = CodeStyleSeverity; - fixAnalyzers = FixAnalyzers; analyzerSeverity = AnalyzerSeverity; saveFormattedFiles = SaveFormattedFiles; changesAreErrors = ChangesAreErrors; diff --git a/src/Formatters/CharsetFormatter.cs b/src/Formatters/CharsetFormatter.cs index 5f352a016c90..e5a2c1c2761a 100644 --- a/src/Formatters/CharsetFormatter.cs +++ b/src/Formatters/CharsetFormatter.cs @@ -20,6 +20,8 @@ internal sealed class CharsetFormatter : DocumentFormatter private static Encoding Utf8 => new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); private static Encoding Latin1 => Encoding.GetEncoding("iso-8859-1"); + public override FixCategory Category => FixCategory.Whitespace; + internal override Task FormatFileAsync( Document document, SourceText sourceText, diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index 510c6778cf47..64e4439c9b58 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -20,6 +20,11 @@ internal abstract class DocumentFormatter : ICodeFormatter { protected abstract string FormatWarningDescription { get; } + /// + /// Gets the fix category this formatter belongs to. + /// + public abstract FixCategory Category { get; } + /// /// Applies formatting and returns a formatted /// diff --git a/src/Formatters/EndOfLineFormatter.cs b/src/Formatters/EndOfLineFormatter.cs index 58094c691968..203d7fc81de4 100644 --- a/src/Formatters/EndOfLineFormatter.cs +++ b/src/Formatters/EndOfLineFormatter.cs @@ -15,6 +15,8 @@ internal sealed class EndOfLineFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_end_of_line_marker; + public override FixCategory Category => FixCategory.Whitespace; + internal override Task FormatFileAsync( Document document, SourceText sourceText, diff --git a/src/Formatters/FinalNewlineFormatter.cs b/src/Formatters/FinalNewlineFormatter.cs index 75f2803b30ac..4113bb84d061 100644 --- a/src/Formatters/FinalNewlineFormatter.cs +++ b/src/Formatters/FinalNewlineFormatter.cs @@ -14,6 +14,8 @@ internal sealed class FinalNewlineFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_final_newline; + public override FixCategory Category => FixCategory.Whitespace; + internal override async Task FormatFileAsync( Document document, SourceText sourceText, diff --git a/src/Formatters/ICodeFormatter.cs b/src/Formatters/ICodeFormatter.cs index fa0b67db69de..9a92ead4ede4 100644 --- a/src/Formatters/ICodeFormatter.cs +++ b/src/Formatters/ICodeFormatter.cs @@ -10,6 +10,11 @@ namespace Microsoft.CodeAnalysis.Tools.Formatters { internal interface ICodeFormatter { + /// + /// Gets the fix category this formatter belongs to. + /// + FixCategory Category { get; } + /// /// Applies formatting and returns a formatted . /// diff --git a/src/Formatters/OrganizeImportsFormatter.cs b/src/Formatters/OrganizeImportsFormatter.cs index 780c9e4701f7..78d459bd6e8f 100644 --- a/src/Formatters/OrganizeImportsFormatter.cs +++ b/src/Formatters/OrganizeImportsFormatter.cs @@ -20,6 +20,8 @@ internal sealed class OrganizeImportsFormatter : DocumentFormatter protected override string FormatWarningDescription => Resources.Fix_imports_ordering; private readonly DocumentFormatter _endOfLineFormatter = new EndOfLineFormatter(); + public override FixCategory Category => FixCategory.Whitespace; + internal override async Task FormatFileAsync( Document document, SourceText sourceText, diff --git a/src/Formatters/UnnecessaryImportsFormatter.cs b/src/Formatters/UnnecessaryImportsFormatter.cs index c386b7977713..533bbcdc8b1a 100644 --- a/src/Formatters/UnnecessaryImportsFormatter.cs +++ b/src/Formatters/UnnecessaryImportsFormatter.cs @@ -20,6 +20,8 @@ internal sealed class UnnecessaryImportsFormatter : DocumentFormatter protected override string FormatWarningDescription => Resources.Remove_unnecessary_import; + public override FixCategory Category => FixCategory.CodeStyle; + internal override async Task FormatFileAsync( Document document, SourceText sourceText, @@ -31,10 +33,6 @@ internal override async Task FormatFileAsync( { // If we are fixing CodeStyle and the 'IDE0005' diagnostic is configured, then // see if we can remove unused imports. - if (!formatOptions.FixCodeStyle) - { - return sourceText; - } // If we are not saving files, do not make changes in this formatter. They will be // reported by their diagnostic id when the analyzer formatter runs. diff --git a/src/Formatters/WhitespaceFormatter.cs b/src/Formatters/WhitespaceFormatter.cs index e90774aecde7..0e79fad96355 100644 --- a/src/Formatters/WhitespaceFormatter.cs +++ b/src/Formatters/WhitespaceFormatter.cs @@ -17,6 +17,8 @@ internal sealed class WhitespaceFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_whitespace_formatting; + public override FixCategory Category => FixCategory.Whitespace; + internal override async Task FormatFileAsync( Document document, SourceText sourceText, diff --git a/src/Program.cs b/src/Program.cs index ec0706babdf7..f7087bb1b851 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -40,8 +40,9 @@ private static async Task Main(string[] args) public static async Task Run( string? workspace, bool folder, - string? fixStyle, - string? fixAnalyzers, + bool whitespace, + string? style, + string? analyzers, string? verbosity, bool check, string[] include, @@ -131,16 +132,31 @@ public static async Task Run( logger.LogTrace(Resources.Using_msbuildexe_located_in_0, msBuildPath); } + var fixType = FixCategory.None; + if (s_parseResult.WasOptionUsed("--fix-style", "-s")) + { + fixType |= FixCategory.CodeStyle; + } + + if (s_parseResult.WasOptionUsed("--fix-analyzers", "-a")) + { + fixType |= FixCategory.Analyzers; + } + + if (fixType == FixCategory.None || whitespace) + { + fixType |= FixCategory.Whitespace; + } + var fileMatcher = SourceFileMatcher.CreateMatcher(include, exclude); var formatOptions = new FormatOptions( workspacePath, workspaceType, logLevel, - fixCodeStyle: s_parseResult.WasOptionUsed("--fix-style", "-fs"), - codeStyleSeverity: GetSeverity(fixStyle ?? FixSeverity.Error), - fixAnalyzers: s_parseResult.WasOptionUsed("--fix-analyzers", "-fa"), - analyzerSeverity: GetSeverity(fixAnalyzers ?? FixSeverity.Error), + fixType, + codeStyleSeverity: GetSeverity(style ?? FixSeverity.Error), + analyzerSeverity: GetSeverity(analyzers ?? FixSeverity.Error), saveFormattedFiles: !check, changesAreErrors: check, fileMatcher, diff --git a/src/Reflection/RemoveUnnecessaryImportsHelper.cs b/src/Reflection/RemoveUnnecessaryImportsHelper.cs index dd67adb0a05a..7543bf0412ca 100644 --- a/src/Reflection/RemoveUnnecessaryImportsHelper.cs +++ b/src/Reflection/RemoveUnnecessaryImportsHelper.cs @@ -20,7 +20,7 @@ internal static class RemoveUnnecessaryImportsHelper return document; } - return await (Task)s_removeUnnecessaryImportsAsyncMethod.Invoke(obj: null, new object[] { document, cancellationToken }); + return await (Task)s_removeUnnecessaryImportsAsyncMethod.Invoke(obj: null, new object[] { document, cancellationToken })!; } } } diff --git a/src/Resources.resx b/src/Resources.resx index 6cc5f1f47b21..d8c085cd58c7 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -288,4 +288,7 @@ Unable to fix {0}. Code fix {1} returned an unexpected operation. + + Run whitespace formatting. Run by default when not applying fixes. + \ No newline at end of file diff --git a/src/Utilities/Index.cs b/src/Utilities/Index.cs index d498d630b507..623ceeda8b21 100644 --- a/src/Utilities/Index.cs +++ b/src/Utilities/Index.cs @@ -114,7 +114,7 @@ public int GetOffset(int length) /// Indicates whether the current Index object is equal to another object of the same type. /// An object to compare with this object - public override bool Equals(object? value) => value is Index && _value == ((Index)value)._value; + public override bool Equals(object? value) => value is Index index && _value == index._value; /// Indicates whether the current Index object is equal to another Index object. /// An object to compare with this object @@ -130,7 +130,7 @@ public int GetOffset(int length) public override string ToString() { if (IsFromEnd) - return $"^{((uint)Value).ToString()}"; + return $"^{(uint)Value}"; return ((uint)Value).ToString(); } diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 073dcf49048d..a9d8b376c3d4 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -172,6 +172,11 @@ Spustit analyzátory stylu kódu a použít opravy + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. Probíhá analýza {0}. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 504ca73e1ad8..b48d869289d8 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -172,6 +172,11 @@ Führen Sie Codeformat-Analysetools aus, und wenden Sie Korrekturen an. + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. Die Analyse für "{0}" wird ausgeführt. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index c72430176dee..d86ca2927715 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -172,6 +172,11 @@ Ejecute analizadores de estilo de código y aplique las correcciones. + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. Ejecutando el análisis de {0}. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index aecbad8827e9..079428bdd09b 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -172,6 +172,11 @@ Exécutez des analyseurs de style de code et appliquez des correctifs. + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. Exécution de l'analyse de {0}. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index d96d095b6bb2..03d7d8f0f013 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -172,6 +172,11 @@ Esegue gli analizzatori degli stili di codice e applica le correzioni. + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. Esecuzione dell'analisi {0}. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index a978d5c903f4..bec13735a908 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -172,6 +172,11 @@ コード スタイル アナライザーを実行し、修正プログラムを適用します。 + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. {0} 分析を実行しています。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index e8b4583ebad4..51ed9a3e4245 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -172,6 +172,11 @@ 코드 스타일 분석기를 실행하고 수정 사항을 적용합니다. + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. {0} 분석을 실행하고 있습니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 18773cfae106..fc68ff6490fe 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -172,6 +172,11 @@ Uruchom analizatory stylu kodu i zastosuj poprawki. + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. Uruchamianie analizy {0}. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 947d2fe18bc7..756e037b6c36 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -172,6 +172,11 @@ Executar analisadores de estilo de código e aplicar correções. + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. Executando a análise de {0}. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index de371a32dc1d..7ef1e375500e 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -172,6 +172,11 @@ Запустите анализаторы стиля кода и примените исправления. + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. Выполнение анализа {0}. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 5f5a5ea58264..6e65eefe3992 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -172,6 +172,11 @@ Kod stili çözümleyicilerini çalıştırıp düzeltmeleri uygulayın. + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. {0} analizi çalıştırılıyor. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index fd927a1a9227..47c163a19af3 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -172,6 +172,11 @@ 运行代码样式分析器并应用修补程序。 + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. 正在运行 {0} 分析。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 2dae7044998a..3a147b91f534 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -172,6 +172,11 @@ 執行程式碼樣式分析器並套用修正。 + + Run whitespace formatting. Run by default when not applying fixes. + Run whitespace formatting. Run by default when not applying fixes. + + Running {0} analysis. 正在執行 {0} 分析。 diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 1b17224958ae..de1dbf281d5c 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -94,6 +94,21 @@ await TestFormatWorkspaceAsync( expectedFileCount: 5); } + [Fact] + public async Task NoFilesFormattedInUnformattedProjectWhenFixingCodeStyle() + { + await TestFormatWorkspaceAsync( + UnformattedProjectFilePath, + include: EmptyFilesList, + exclude: EmptyFilesList, + includeGenerated: false, + fixCategory: FixCategory.CodeStyle, + codeStyleSeverity: DiagnosticSeverity.Error, + expectedExitCode: 0, + expectedFilesFormatted: 0, + expectedFileCount: 5); + } + [Fact] public async Task GeneratedFilesFormattedInUnformattedProject() { @@ -411,7 +426,7 @@ await TestFormatWorkspaceAsync( expectedExitCode: 0, expectedFilesFormatted: 0, expectedFileCount: 6, - fixCodeStyle: false); + fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle); } [Fact] @@ -425,7 +440,7 @@ await TestFormatWorkspaceAsync( expectedExitCode: 0, expectedFilesFormatted: 0, expectedFileCount: 6, - fixCodeStyle: true, + fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Error); } @@ -440,7 +455,7 @@ await TestFormatWorkspaceAsync( expectedExitCode: 0, expectedFilesFormatted: 2, expectedFileCount: 6, - fixCodeStyle: true, + fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Warning); } @@ -458,7 +473,7 @@ await TestFormatWorkspaceAsync( expectedExitCode: 0, expectedFilesFormatted: 0, expectedFileCount: 7, - fixAnalyzers: false); + fixCategory: FixCategory.Whitespace); } [Fact] @@ -475,7 +490,7 @@ await TestFormatWorkspaceAsync( expectedExitCode: 0, expectedFilesFormatted: 1, expectedFileCount: 7, - fixAnalyzers: true, + fixCategory: FixCategory.Whitespace | FixCategory.Analyzers, analyzerSeverity: DiagnosticSeverity.Error); } @@ -495,9 +510,8 @@ internal async Task TestFormatWorkspaceAsync( int expectedExitCode, int expectedFilesFormatted, int expectedFileCount, - bool fixCodeStyle = false, + FixCategory fixCategory = FixCategory.Whitespace, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - bool fixAnalyzers = false, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { var workspacePath = Path.GetFullPath(workspaceFilePath); @@ -520,9 +534,8 @@ internal async Task TestFormatWorkspaceAsync( workspacePath, workspaceType, LogLevel.Trace, - fixCodeStyle, + fixCategory, codeStyleSeverity, - fixAnalyzers, analyzerSeverity, saveFormattedFiles: false, changesAreErrors: false, diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 9f7dcd26a43f..12949fd4e4ee 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -91,12 +91,11 @@ private protected Task AssertCodeUnchangedAsync( string code, IReadOnlyDictionary editorConfig, Encoding encoding = null, - bool fixCodeStyle = false, + FixCategory fixCategory = FixCategory.Whitespace, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - bool fixAnalyzers = false, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { - return AssertCodeChangedAsync(code, code, ToEditorConfig(editorConfig), encoding, fixCodeStyle, codeStyleSeverity, fixAnalyzers, analyzerSeverity); + return AssertCodeChangedAsync(code, code, ToEditorConfig(editorConfig), encoding, fixCategory, codeStyleSeverity, analyzerSeverity); } private protected Task AssertCodeChangedAsync( @@ -104,12 +103,11 @@ private protected Task AssertCodeChangedAsync( string expectedCode, IReadOnlyDictionary editorConfig, Encoding encoding = null, - bool fixCodeStyle = false, + FixCategory fixCategory = FixCategory.Whitespace, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - bool fixAnalyzers = false, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { - return AssertCodeChangedAsync(testCode, expectedCode, ToEditorConfig(editorConfig), encoding, fixCodeStyle, codeStyleSeverity, fixAnalyzers, analyzerSeverity); + return AssertCodeChangedAsync(testCode, expectedCode, ToEditorConfig(editorConfig), encoding, fixCategory, codeStyleSeverity, analyzerSeverity); } private protected async Task AssertCodeChangedAsync( @@ -117,9 +115,8 @@ private protected async Task AssertCodeChangedAsync( string expectedCode, string editorConfig, Encoding encoding = null, - bool fixCodeStyle = false, + FixCategory fixCategory = FixCategory.Whitespace, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - bool fixAnalyzers = false, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { var text = SourceText.From(testCode, encoding ?? Encoding.UTF8); @@ -134,9 +131,8 @@ private protected async Task AssertCodeChangedAsync( workspaceFilePath: project.FilePath, workspaceType: WorkspaceType.Folder, logLevel: LogLevel.Trace, - fixCodeStyle, + fixCategory, codeStyleSeverity, - fixAnalyzers, analyzerSeverity, saveFormattedFiles: true, changesAreErrors: false, diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index 86fbe17ecebe..2f0c1ac4a436 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -58,9 +58,8 @@ private async Task> TestFormattedFiles(string testCode) workspaceFilePath: project.FilePath, workspaceType: WorkspaceType.Folder, logLevel: LogLevel.Trace, - fixCodeStyle: false, + fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, - fixAnalyzers: false, analyzerSeverity: DiagnosticSeverity.Error, saveFormattedFiles: false, changesAreErrors: false, diff --git a/tests/Formatters/UnnecessaryImportsFormatterTests.cs b/tests/Formatters/UnnecessaryImportsFormatterTests.cs index b28bb2ce6458..2a69c43d460a 100644 --- a/tests/Formatters/UnnecessaryImportsFormatterTests.cs +++ b/tests/Formatters/UnnecessaryImportsFormatterTests.cs @@ -29,7 +29,7 @@ class C var editorConfig = new Dictionary(); - await AssertCodeUnchangedAsync(code, editorConfig, fixCodeStyle: false, codeStyleSeverity: DiagnosticSeverity.Info); + await AssertCodeUnchangedAsync(code, editorConfig, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Info); } [Fact] @@ -44,7 +44,7 @@ class C var editorConfig = new Dictionary(); - await AssertCodeUnchangedAsync(code, editorConfig, fixCodeStyle: true, codeStyleSeverity: DiagnosticSeverity.Info); + await AssertCodeUnchangedAsync(code, editorConfig, fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Info); } [Theory] @@ -68,7 +68,7 @@ class C [key] = severity }; - await AssertCodeUnchangedAsync(code, editorConfig, fixCodeStyle: true, codeStyleSeverity: DiagnosticSeverity.Error); + await AssertCodeUnchangedAsync(code, editorConfig, fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Error); } [Theory] @@ -97,7 +97,7 @@ class C [key] = severity }; - await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCodeStyle: true, codeStyleSeverity: DiagnosticSeverity.Warning); + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Warning); } } } diff --git a/validate.rsp b/validate.rsp index cd0bd8bffa53..acb9307547b0 100644 --- a/validate.rsp +++ b/validate.rsp @@ -1,4 +1,5 @@ ./format.sln +--fix-whitespace --fix-style --fix-analyzers --exclude From 8db08475699443c0fecbeaef6d3c6ea0c5e1f8c7 Mon Sep 17 00:00:00 2001 From: Adeel Date: Wed, 9 Sep 2020 10:46:16 +0300 Subject: [PATCH 1181/2702] Add ability to read --{in,ex}clude value from stdin Today, `dotnet-format` accepts space-separated list of files. This allows us to pass files via shell's native globbing expansion, heredoc style redirections as well as via pipelines (see #551 for examples). However, in case of pipeline it requires a second utility (`xarg`) to transform pipeline input as space-separated list to `dotnet-format`. This PR implements native pipeline reading support for `--include` and `--exclude` options, while keeping the space-separated list intact. #### Usage examples 1. Include all C# source files under `tests/Utilities` directory that are in git source tree: ```sh git ls-files :/tests/Utilities/*.cs | dotnet format --include - --folder ``` 3. Format all C# source files in last commit: ```sh git show --name-only --pretty="" | dotnet format --include - --folder ``` 2. Exclude certain `*.cs` and `*.vb` files using `ls(1)`: ```sh ls ../../../../../src/generated/{*.cs,*.vb} | dotnet format --exclude /dev/stdin --folder ``` #### Rules * Based on Guideline 13 of [IEEE 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02) (POSIX), it accepts `-` as an explicit marker for stdin with addition of: * `/dev/stdin` - which is a universal synonym of `-` on all Unices. * It *only* accepts explicit markers (`/dev/stdin` or `-`) and does not implicitly deduce the output if standard input was redirected, but marker was not present. This is because our usage is multi-purpose (both `--include` and `--exclude`). * It is an error if both `--include` and `--exclude` are using stdin marker (`/dev/stdin` or `-`). #### Limitations / future considerations * Currently, it reads the entire input from pipeline in `include`/`exclude` buffer, and then runs the operation on the whole batch. In order to make it true pipeline friendly, it would require some refactoring; so files are `yield return`'d and enumerator can dispatch format operation per file. * At present, we do not have out-of-process functional test mechanism for CLI to effectively validate these kind of use-cases (redirection and shell globbing vs. dotnet-format's built-in globbing support); so no tests are included in this PR. --- README.md | 32 ++++++++++++--------- src/Program.cs | 52 +++++++++++++++++++++++++++++++++++ src/Resources.resx | 3 ++ src/xlf/Resources.cs.xlf | 5 ++++ src/xlf/Resources.de.xlf | 5 ++++ src/xlf/Resources.es.xlf | 5 ++++ src/xlf/Resources.fr.xlf | 5 ++++ src/xlf/Resources.it.xlf | 5 ++++ src/xlf/Resources.ja.xlf | 5 ++++ src/xlf/Resources.ko.xlf | 5 ++++ src/xlf/Resources.pl.xlf | 5 ++++ src/xlf/Resources.pt-BR.xlf | 5 ++++ src/xlf/Resources.ru.xlf | 5 ++++ src/xlf/Resources.tr.xlf | 5 ++++ src/xlf/Resources.zh-Hans.xlf | 5 ++++ src/xlf/Resources.zh-Hant.xlf | 5 ++++ 16 files changed, 139 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a97469628946..dcddcbc6052a 100644 --- a/README.md +++ b/README.md @@ -85,19 +85,25 @@ Options: Add `format` after `dotnet` and before the command arguments that you want to run: -| Examples | Description | -| ---------------------------------------------------------------- |---------------------------------------------------------------------------------------------- | -| dotnet **format** | Formats the project or solution in the current directory. | -| dotnet **format** <workspace> | Formats a specific project or solution. | -| dotnet **format** <workspace> -f | Formats a particular folder and subfolders. | -| dotnet **format** <workspace> --fix-style warn | Fixes only codestyle analyzer warnings. | -| dotnet **format** <workspace> --fix-whitespace --fix-style | Formats and fixes codestyle analyzer errors. | -| dotnet **format** <workspace> --fix-analyzers | Fixes only 3rd party analyzer errors. | -| dotnet **format** <workspace> -wsa | Formats, fixes codestyle errors, and fixes 3rd party analyzer errors. | -| dotnet **format** -v diag | Formats with very verbose logging. | -| dotnet **format** --include Programs.cs Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | -| dotnet **format** --check | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | -| dotnet **format** --report <report-path> | Formats and saves a json report file to the given directory. | +| Examples | Description | +| ---------------------------------------------------------------- |--------------------------------------------------------------------------------------------------- | +| `dotnet format` | Formats the project or solution in the current directory. | +| `dotnet format ` | Formats a specific project or solution. | +| `dotnet format -f` | Formats a particular folder and subfolders. | +| `dotnet format --fix-style warn` | Fixes only codestyle analyzer warnings. | +| `dotnet format --fix-whitespace --fix-style` | Formats and fixes codestyle analyzer errors. | +| `dotnet format --fix-analyzers` | Fixes only 3rd party analyzer errors. | +| `dotnet format -wsa | Formats, fixes codestyle errors, and fixes 3rd party analyzer errors. | +| `dotnet format -v diag` | Formats with very verbose logging. | +| `dotnet format --include Programs.cs Utility\Logging.cs` | Formats the files Program.cs and Utility\Logging.cs | +| `dotnet format --check` | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | +| `dotnet format --report ` | Formats and saves a json report file to the given directory. | +| `dotnet format --include test/Utilities/*.cs --folder` | Formats the files expanded from native shell globbing (e.g. bash). Space-separated list of | +| | files are fed to formatter in this case. Also applies to `--exclude` option. | +| `dotnet format --include 'test/Utilities/*.cs' --folder` | With single quotes, formats the files expanded from built-in glob expansion. A single file | +| | pattern is fed to formatter, which gets expanded internally. Also applies to `--exclude` option. | +| `ls tests/Utilities/*.cs \| dotnet format --include - --folder` | Formats the list of files redirected from pipeline via standard input. Formatter will iterate over | +| | `Console.In` to read the list of files. Also applies to `--exclude` option. | ### How To Uninstall diff --git a/src/Program.cs b/src/Program.cs index f7087bb1b851..2458b70456b5 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -7,6 +7,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; +using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Logging; @@ -24,6 +25,8 @@ internal class Program internal const int UnableToLocateMSBuildExitCode = 3; internal const int UnableToLocateDotNetCliExitCode = 4; + private static readonly string[] s_standardInputKeywords = { "/dev/stdin", "-" }; + private static ParseResult? s_parseResult; private static async Task Main(string[] args) @@ -148,6 +151,8 @@ public static async Task Run( fixType |= FixCategory.Whitespace; } + HandleStandardInput(logger, ref include, ref exclude); + var fileMatcher = SourceFileMatcher.CreateMatcher(include, exclude); var formatOptions = new FormatOptions( @@ -189,6 +194,53 @@ public static async Task Run( } } + private static void HandleStandardInput(ILogger logger, ref string[] include, ref string[] exclude) + { + var isStandardMarkerUsed = false; + if (include.Length == 1 && s_standardInputKeywords.Contains(include[0])) + { + if (TryReadFromStandardInput(ref include)) + { + isStandardMarkerUsed = true; + } + } + + if (exclude.Length == 1 && s_standardInputKeywords.Contains(exclude[0])) + { + if (isStandardMarkerUsed) + { + logger.LogCritical(Resources.Standard_input_used_multiple_times); + Environment.Exit(CheckFailedExitCode); + } + + TryReadFromStandardInput(ref exclude); + } + + static bool TryReadFromStandardInput(ref string[] subject) + { + if (!Console.IsInputRedirected) + { + return false; // pass + } + + // reset the subject array + Array.Clear(subject, 0, subject.Length); + Array.Resize(ref subject, 0); + + Console.InputEncoding = Encoding.UTF8; + using var reader = new StreamReader(Console.OpenStandardInput(8192)); + Console.SetIn(reader); + + for (var i = 0; Console.In.Peek() != -1; ++i) + { + Array.Resize(ref subject, subject.Length + 1); + subject[i] = Console.In.ReadLine(); + } + + return true; + } + } + internal static int GetExitCode(WorkspaceFormatResult formatResult, bool check) { if (!check) diff --git a/src/Resources.resx b/src/Resources.resx index d8c085cd58c7..b429456b3a0c 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -222,6 +222,9 @@ Include generated code files in formatting operations. + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Unable to locate dotnet CLI. Ensure that it is on the PATH. diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index a9d8b376c3d4..fe0c50bae6f3 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -207,6 +207,11 @@ Řešení {0} nemá žádné projekty. + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. Verze .NET CLI je {0}. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index b48d869289d8..2052021e5560 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -207,6 +207,11 @@ Die Projektmappe "{0}" enthält keine Projekte. + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. Die dotnet-CLI-Version ist "{0}". diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index d86ca2927715..e5cf9df3f1d7 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -207,6 +207,11 @@ La solución {0} no tiene ningún proyecto. + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. La versión de la CLI de dotnet es "{0}". diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 079428bdd09b..d978434fb3a8 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -207,6 +207,11 @@ La solution {0} n'a aucun projet + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. La version de l'interface CLI dotnet est '{0}'. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 03d7d8f0f013..5d4f6e22caa9 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -207,6 +207,11 @@ La soluzione {0} non contiene progetti + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. La versione dell'interfaccia della riga di comando di dotnet è '{0}'. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index bec13735a908..632225f4fded 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -207,6 +207,11 @@ ソリューション {0} にプロジェクトがありません + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. dotnet CLI バージョンは '{0}' です。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 51ed9a3e4245..ba52245a686a 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -207,6 +207,11 @@ {0} 솔루션에 프로젝트가 없습니다. + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. dotnet CLI 버전은 '{0}'입니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index fc68ff6490fe..afde43794e3b 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -207,6 +207,11 @@ Rozwiązanie {0} nie zawiera projektów + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. Wersja interfejsu wiersza polecenia dotnet to „{0}”. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 756e037b6c36..9f06aaa787a3 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -207,6 +207,11 @@ A solução {0} não tem nenhum projeto + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. A versão do CLI do dotnet é '{0}'. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 7ef1e375500e..f475896a4458 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -207,6 +207,11 @@ Решение {0} не содержит проектов. + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. Версия CLI dotnet: "{0}". diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 6e65eefe3992..0d6757c6774a 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -207,6 +207,11 @@ {0} çözümünde proje yok + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. dotnet CLI sürümü: '{0}'. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 47c163a19af3..af5e9ed2d04f 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -207,6 +207,11 @@ 解决方案 {0} 不包含任何项目 + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. dotnet CLI 版本为“{0}”。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 3a147b91f534..8b823a6f4b09 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -207,6 +207,11 @@ 解決方案 {0} 沒有任何專案 + + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The dotnet CLI version is '{0}'. dotnet CLI 版本為 '{0}'。 From d947dcecc7c57c6b0c53326edbca756d33ad0573 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 9 Sep 2020 12:34:24 +0000 Subject: [PATCH 1182/2702] Update dependencies from https://github.com/dotnet/roslyn build 20200909.5 (#804) [master] Update dependencies from dotnet/roslyn - Updates: - Microsoft.NETCore.Compilers: from 3.8.0-3.20454.4 to 3.8.0-3.20459.5 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 139a6a8cd6fd..5e1b52a11370 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 100f4bee62f45e4ef8756956529d91a7f3407a20 + f0e0e43c1eacb2131acd97d38b871c5bf2ac16b6 diff --git a/eng/Versions.props b/eng/Versions.props index 726c3ff273ff..898c3306f91f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.8.0-3.20454.4 + 3.8.0-3.20459.5 5.0.0-preview.7.20364.11 - 3.8.0-3.20459.5 + 3.8.0-3.20460.2 5.0.0-preview.7.20364.11 + 2.1.0-rc1 LatestMajor From 00fad48945fc9060be29ce01b90c1edde87c1d60 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 22 Sep 2020 16:58:40 +0000 Subject: [PATCH 1194/2702] Update dependencies from https://github.com/dotnet/arcade build 20200921.1 Microsoft.DotNet.Arcade.Sdk From Version 5.0.0-beta.20464.13 -> To Version 5.0.0-beta.20471.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3e1c5e79a84a..e61d2dbd2b38 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - b63ea25b8dc50bb3dfcef128d415254bd5ca4dc8 + 0365488709f58e37de6c2180e7fb243203ca0a9c diff --git a/global.json b/global.json index 3db6a09ab48d..771333085754 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.1.20452.10" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20467.6" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20471.1" } } From 55502873a09fea3b493e90a9e29dd52f30b86c4e Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 22 Sep 2020 10:12:22 -0700 Subject: [PATCH 1195/2702] lock our version of the sdk --- global.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/global.json b/global.json index 771333085754..d8e6e3e1e961 100644 --- a/global.json +++ b/global.json @@ -1,4 +1,9 @@ { + "sdk": { + "version": "5.0.100-rc.1.20452.10", + "allowPrerelease": true, + "rollForward": "major" + }, "tools": { "dotnet": "5.0.100-rc.1.20452.10" }, From bae41eb0d9f82ab2b64682fc2d8d62da340e2e20 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 22 Sep 2020 10:12:33 -0700 Subject: [PATCH 1196/2702] use latest images --- azure-pipelines.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ce1ae430c638..eb13f527b613 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,7 +12,7 @@ jobs: - job: Windows pool: - vmImage: 'vs2017-win2016' + vmImage: 'windows-latest' variables: _os: Windows strategy: @@ -43,8 +43,7 @@ jobs: - job: Linux pool: - name: NetCorePublic-Pool - queue: BuildPool.Ubuntu.1604.Amd64.Open + vmImage: 'ubuntu-latest' variables: _os: Linux strategy: From 61d344f07e15df9b0db915725b429a047e8076e2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 24 Sep 2020 12:07:18 +0000 Subject: [PATCH 1197/2702] Update dependencies from https://github.com/dotnet/arcade build 20200922.36 Microsoft.DotNet.Arcade.Sdk From Version 5.0.0-beta.20464.13 -> To Version 5.0.0-beta.20472.36 --- eng/Version.Details.xml | 4 +- eng/common/templates/job/source-build.yml | 49 +++++++++++++++ eng/common/templates/jobs/jobs.yml | 16 +++++ eng/common/templates/jobs/source-build.yml | 48 +++++++++++++++ eng/common/templates/steps/source-build.yml | 66 +++++++++++++++++++++ global.json | 2 +- 6 files changed, 182 insertions(+), 3 deletions(-) create mode 100644 eng/common/templates/job/source-build.yml create mode 100644 eng/common/templates/jobs/source-build.yml create mode 100644 eng/common/templates/steps/source-build.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e61d2dbd2b38..79aecaadca9f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 0365488709f58e37de6c2180e7fb243203ca0a9c + 06ad7cf82dbf56b3facf8a7d3a00944f5116663d diff --git a/eng/common/templates/job/source-build.yml b/eng/common/templates/job/source-build.yml new file mode 100644 index 000000000000..9332f5ecc38a --- /dev/null +++ b/eng/common/templates/job/source-build.yml @@ -0,0 +1,49 @@ +parameters: + # This template adds arcade-powered source-build to CI. The template produces a server job with a + # default ID 'Source_Build_Complete' to put in a dependency list if necessary. + + # Specifies the prefix for source-build jobs added to pipeline. Use this if disambiguation needed. + jobNamePrefix: 'Source_Build' + + # Defines the platform on which to run the job. By default, a linux-x64 machine, suitable for + # managed-only repositories. This is an object with these properties: + # + # name: '' + # The name of the job. This is included in the job ID. + # targetRID: '' + # The name of the target RID to use, instead of the one auto-detected by Arcade. + # nonPortable: false + # Enables non-portable mode. This means a more specific RID (e.g. fedora.32-x64 rather than + # linux-x64), and compiling against distro-provided packages rather than portable ones. + # container: '' + # A container to use. Runs in docker. + # pool: {} + # A pool to use. Runs directly on an agent. + # buildScript: '' + # Specifies the build script to invoke to perform the build in the repo. The default + # './build.sh' should work for typical Arcade repositories, but this is customizable for + # difficult situations. + # jobProperties: {} + # A list of job properties to inject at the top level, for potential extensibility beyond + # container and pool. + platform: {} + +jobs: +- job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} + displayName: Source-Build (${{ parameters.platform.name }}) + + ${{ each property in parameters.platform.jobProperties }}: + ${{ property.key }}: ${{ property.value }} + + ${{ if ne(parameters.platform.container, '') }}: + container: ${{ parameters.platform.container }} + ${{ if ne(parameters.platform.pool, '') }}: + pool: ${{ parameters.platform.pool }} + + workspace: + clean: all + + steps: + - template: /eng/common/templates/steps/source-build.yml + parameters: + platform: ${{ parameters.platform }} diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index c08225a9a975..08845950f441 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -24,6 +24,13 @@ parameters: # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. runAsPublic: false + # Optional: Enable running the source-build jobs to build repo from source + runSourceBuild: false + + # Optional: Parameters for source-build template. + # See /eng/common/templates/jobs/source-build.yml for options + sourceBuildParameters: [] + # Internal resources (telemetry, microbuild) can only be accessed from non-public projects, # and some (Microbuild) should only be applied to non-PR cases for internal builds. @@ -43,6 +50,13 @@ jobs: name: ${{ job.job }} +- ${{ if eq(parameters.runSourceBuild, true) }}: + - template: /eng/common/templates/jobs/source-build.yml + parameters: + allCompletedJobId: Source_Build_Complete + ${{ each parameter in parameters.sourceBuildParameters }}: + ${{ parameter.key }}: ${{ parameter.value }} + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: - template: ../job/publish-build-assets.yml @@ -55,6 +69,8 @@ jobs: - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: - ${{ each job in parameters.jobs }}: - ${{ job.job }} + - ${{ if eq(parameters.runSourceBuild, true) }}: + - Source_Build_Complete pool: vmImage: vs2017-win2016 runAsPublic: ${{ parameters.runAsPublic }} diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml new file mode 100644 index 000000000000..f463011e7931 --- /dev/null +++ b/eng/common/templates/jobs/source-build.yml @@ -0,0 +1,48 @@ +parameters: + # This template adds arcade-powered source-build to CI. A job is created for each platform, as + # well as an optional server job that completes when all platform jobs complete. + + # The name of the "join" job for all source-build platforms. If set to empty string, the job is + # not included. Existing repo pipelines can use this job depend on all source-build jobs + # completing without maintaining a separate list of every single job ID: just depend on this one + # server job. By default, not included. Recommended name if used: 'Source_Build_Complete'. + allCompletedJobId: '' + + # See /eng/common/templates/job/source-build.yml + jobNamePrefix: 'Source_Build' + + # If changed to true, causes this template to include the default platform for a managed-only + # repo. The exact Docker image used for this build will be provided by Arcade. This has some risk, + # but since the repo is supposed to be managed-only, the risk should be very low. + includeDefaultManagedPlatform: false + defaultManagedPlatform: + name: 'Managed' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-3e800f1-20190501005343' + + # Defines the platforms on which to run build jobs. One job is created for each platform, and the + # object in this array is sent to the job template as 'platform'. + platforms: [] + +jobs: + +- ${{ if ne(parameters.allCompletedJobId, '') }}: + - job: ${{ parameters.allCompletedJobId }} + displayName: Source-Build Complete + pool: server + dependsOn: + - ${{ each platform in parameters.platforms }}: + - ${{ parameters.jobNamePrefix }}_${{ platform.name }} + - ${{ if eq(parameters.includeDefaultManagedPlatform, true) }}: + - ${{ parameters.jobNamePrefix }}_${{ parameters.defaultManagedPlatform.name }} + +- ${{ each platform in parameters.platforms }}: + - template: /eng/common/templates/job/source-build.yml + parameters: + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ platform }} + +- ${{ if eq(parameters.includeDefaultManagedPlatform, true) }}: + - template: /eng/common/templates/job/source-build.yml + parameters: + jobNamePrefix: ${{ parameters.jobNamePrefix }} + platform: ${{ parameters.defaultManagedPlatform }} diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml new file mode 100644 index 000000000000..8e336b7d16b3 --- /dev/null +++ b/eng/common/templates/steps/source-build.yml @@ -0,0 +1,66 @@ +parameters: + # This template adds arcade-powered source-build to CI. + + # This is a 'steps' template, and is intended for advanced scenarios where the existing build + # infra has a careful build methodology that must be followed. For example, a repo + # (dotnet/runtime) might choose to clone the GitHub repo only once and store it as a pipeline + # artifact for all subsequent jobs to use, to reduce dependence on a strong network connection to + # GitHub. Using this steps template leaves room for that infra to be included. + + # Defines the platform on which to run the steps. See 'eng/common/templates/job/source-build.yml' + # for details. The entire object is described in the 'job' template for simplicity, even though + # the usage of the properties on this object is split between the 'job' and 'steps' templates. + platform: {} + +steps: +# Build. Keep it self-contained for simple reusability. (No source-build-specific job variables.) +- script: | + set -x + df -h + + buildConfig=Release + # Check if AzDO substitutes in a build config from a variable, and use it if so. + if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then + buildConfig='$(_BuildConfig)' + fi + + officialBuildArgs= + if [ '${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}' = 'True' ]; then + officialBuildArgs='/p:DotNetPublishUsingPipelines=true /p:OfficialBuildId=$(BUILD.BUILDNUMBER)' + fi + + targetRidArgs= + if [ '${{ parameters.platform.targetRID }}' != '' ]; then + targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}' + fi + + ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ + --configuration $buildConfig \ + --restore --build --pack --publish \ + $officialBuildArgs \ + $targetRidArgs \ + /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ + /p:ArcadeBuildFromSource=true + displayName: Build + +# Upload build logs for diagnosis. +- task: CopyFiles@2 + displayName: Prepare BuildLogs staging directory + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/*.log + **/*.binlog + artifacts/source-build/self/prebuilt-report/** + TargetFolder: '$(Build.StagingDirectory)/BuildLogs' + CleanTargetFolder: true + continueOnError: true + condition: succeededOrFailed() + +- task: PublishPipelineArtifact@1 + displayName: Publish BuildLogs + inputs: + targetPath: '$(Build.StagingDirectory)/BuildLogs' + artifactName: BuildLogs_SourceBuild_${{ parameters.platform.name }}_Attempt$(System.JobAttempt) + continueOnError: true + condition: succeededOrFailed() diff --git a/global.json b/global.json index d8e6e3e1e961..46444216a442 100644 --- a/global.json +++ b/global.json @@ -8,6 +8,6 @@ "dotnet": "5.0.100-rc.1.20452.10" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20471.1" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20472.36" } } From 2b49d6afc1403edc485dcb6edc2dea8ac4d52378 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 24 Sep 2020 18:50:34 +0000 Subject: [PATCH 1198/2702] [master] Update dependencies from dotnet/roslyn (#820) [master] Update dependencies from dotnet/roslyn - Fix nullablility warnings --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- src/Analyzers/SolutionCodeFixApplier.cs | 2 +- src/Formatters/WhitespaceFormatter.cs | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 460c224a9afd..7d4097cf33e1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - d57cda76c2b76cff75487a085d289cfadd99150b + cec38d8c307bb51596c35b6517f45607d8ea9cc8 diff --git a/eng/Versions.props b/eng/Versions.props index 84dc35b41627..604fae43a011 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.8.0-3.20460.2 + 3.8.0-4.20474.4 5.0.0-preview.7.20364.11 + + + + + + From 09f34f9baad4bfaef17b8bf65ac13ba106aae6d7 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 24 Sep 2020 18:45:04 -0700 Subject: [PATCH 1200/2702] Add package references for NuGet assemblies to UnitTests project --- eng/Versions.props | 8 ++++++++ tests/dotnet-format.UnitTests.csproj | 18 +++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 604fae43a011..491364ea6427 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -11,6 +11,8 @@ 3.8.0-4.20474.4 5.0.0-preview.7.20364.11 + + 5.8.0-preview.3.6823 - - - - - - + The package "Microsoft.CodeAnalysis.Analyzer.Testing" brings in v5.3 of these NuGet dependencies. In order to + test against the same verion of NuGet as our configured SDK, we must set the version to be the same. + --> + + + + + + From 0c680b61b64776f72653f2b302995b3c600c0cce Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 25 Sep 2020 22:21:51 +0000 Subject: [PATCH 1201/2702] Update dependencies from https://github.com/dotnet/arcade build 20200924.4 Microsoft.DotNet.Arcade.Sdk From Version 5.0.0-beta.20464.13 -> To Version 5.0.0-beta.20474.4 --- eng/Version.Details.xml | 4 +-- eng/common/performance/performance-setup.sh | 2 +- .../templates/post-build/post-build.yml | 31 ++++++++++--------- eng/common/tools.ps1 | 4 ++- eng/common/tools.sh | 2 ++ global.json | 2 +- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ed23437bff46..7303b48d4b95 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 06ad7cf82dbf56b3facf8a7d3a00944f5116663d + 61cde6e8fb9d5c9790867b279deb41783a780cd8 diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 806e56c6121f..99d1b7bc1fc8 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -201,7 +201,6 @@ if [[ "$internal" == true ]]; then fi if [[ "$mono_dotnet" != "" ]] && [[ "$monointerpreter" == "false" ]]; then - configurations="$configurations LLVM=$llvm MonoInterpreter=$monointerpreter MonoAOT=$monoaot" extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --category-exclusion-filter NoMono" fi @@ -211,6 +210,7 @@ if [[ "$wasm_runtime_loc" != "" ]]; then fi if [[ "$mono_dotnet" != "" ]] && [[ "$monointerpreter" == "true" ]]; then + configurations="$configurations LLVM=$llvm MonoInterpreter=$monointerpreter MonoAOT=$monoaot" extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --category-exclusion-filter NoInterpreter NoMono" fi diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index df06f5371e7b..0854e489615a 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -78,21 +78,22 @@ stages: BARBuildId: ${{ parameters.BARBuildId }} PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - job: - displayName: Post-build Checks - dependsOn: setupMaestroVars - variables: - - name: TargetChannels - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Maestro Channels Consistency - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 - arguments: -PromoteToChannels "$(TargetChannels)" - -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview8ChannelId}},${{parameters.Net5RC1ChannelId}},${{parameters.Net5RC2ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}} + - ${{ if and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')) }}: + - job: + displayName: Post-build Checks + dependsOn: setupMaestroVars + variables: + - name: TargetChannels + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'] ] + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Maestro Channels Consistency + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 + arguments: -PromoteToChannels "$(TargetChannels)" + -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview8ChannelId}},${{parameters.Net5RC1ChannelId}},${{parameters.Net5RC2ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}} - job: displayName: NuGet Validation diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 60066083b34f..9014e062514b 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -540,13 +540,15 @@ function GetDefaultMSBuildEngine() { function GetNuGetPackageCachePath() { if ($env:NUGET_PACKAGES -eq $null) { - # Use local cache on CI to ensure deterministic build, + # Use local cache on CI to ensure deterministic build. + # Avoid using the http cache as workaround for https://github.com/NuGet/Home/issues/3116 # use global cache in dev builds to avoid cost of downloading packages. # For directory normalization, see also: https://github.com/NuGet/Home/issues/7968 if ($useGlobalNuGetCache) { $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\' } else { $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\' + $env:RESTORENOCACHE = $true } } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index c722a0585317..b5d63cb1b7cb 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -312,12 +312,14 @@ function InitializeBuildTool { _InitializeBuildToolFramework="netcoreapp2.1" } +# Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116 function GetNuGetPackageCachePath { if [[ -z ${NUGET_PACKAGES:-} ]]; then if [[ "$use_global_nuget_cache" == true ]]; then export NUGET_PACKAGES="$HOME/.nuget/packages" else export NUGET_PACKAGES="$repo_root/.packages" + export RESTORENOCACHE=true fi fi diff --git a/global.json b/global.json index 46444216a442..c848e009812b 100644 --- a/global.json +++ b/global.json @@ -8,6 +8,6 @@ "dotnet": "5.0.100-rc.1.20452.10" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20472.36" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20474.4" } } From 4919c82959a701775fcf829b2a9bc7a9b4e1a6ba Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 25 Sep 2020 16:11:19 -0700 Subject: [PATCH 1202/2702] Remove NuGet Assembly Loader --- azure-pipelines.yml | 6 ++-- tests/Analyzers/FilterDiagnosticsTests.cs | 5 ---- .../Analyzers/LoadAnalyzersAndFixersTests.cs | 5 ---- tests/Utilities/MSBuildRegistrar.cs | 3 +- tests/Utilities/NuGetLoader.cs | 30 ------------------- 5 files changed, 3 insertions(+), 46 deletions(-) delete mode 100644 tests/Utilities/NuGetLoader.cs diff --git a/azure-pipelines.yml b/azure-pipelines.yml index eb13f527b613..45dd0e688d51 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -107,12 +107,10 @@ jobs: - job: Formatting_Check pool: - vmImage: 'vs2017-win2016' + vmImage: 'windows-latest' timeoutInMinutes: 5 steps: - - script: ./build.cmd -c Release - displayName: Build dotnet-format - - script: dotnet ./artifacts/bin/dotnet-format/Release/netcoreapp2.1/dotnet-format.dll @validate.rsp + - script: dotnet run --project ./src/dotnet-format.csproj -c Release -- '@validate.rsp' displayName: Run dotnet-format - task: PublishBuildArtifacts@1 displayName: Publish Logs diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs index 4fb6b73c77ca..20fda65772d8 100644 --- a/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -17,11 +17,6 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers public class FilterDiagnosticsTests : CSharpFormatterTests { - public FilterDiagnosticsTests() - { - MSBuildRegistrar.RegisterInstance(); - } - [Fact] public async Task TestFilterWarning() { diff --git a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs index feee56892d0c..8ebed5c893d8 100644 --- a/tests/Analyzers/LoadAnalyzersAndFixersTests.cs +++ b/tests/Analyzers/LoadAnalyzersAndFixersTests.cs @@ -12,11 +12,6 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers public class LoadAnalyzersAndFixersTests { - public LoadAnalyzersAndFixersTests() - { - MSBuildRegistrar.RegisterInstance(); - } - [Fact] public static async Task TestSingleAnalyzerAndFixerAsync() { diff --git a/tests/Utilities/MSBuildRegistrar.cs b/tests/Utilities/MSBuildRegistrar.cs index 25811d30d2e6..029832eca798 100644 --- a/tests/Utilities/MSBuildRegistrar.cs +++ b/tests/Utilities/MSBuildRegistrar.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities { /// - /// Loads MSBuild and NuGet assemblies. + /// Loads MSBuild assemblies. /// public sealed class MSBuildRegistrar { @@ -29,7 +29,6 @@ public static string RegisterInstance(ILogger? logger = null) LooseVersionAssemblyLoader.Register(s_msBuildPath, logger); Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); - NuGetLoader.Load(); } return s_msBuildPath!; diff --git a/tests/Utilities/NuGetLoader.cs b/tests/Utilities/NuGetLoader.cs deleted file mode 100644 index 917c6468153c..000000000000 --- a/tests/Utilities/NuGetLoader.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Reflection; -using System.Runtime.Loader; - -#nullable enable - -namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities -{ - internal sealed class NuGetLoader - { - private static readonly string[] s_nugetAssemblyName = new[] - { - "NuGet.Common", - "NuGet.Configuration", - "NuGet.Frameworks", - "NuGet.Packaging", - "NuGet.Protocol", - "NuGet.Versioning", - }; - - public static void Load() - { - foreach (var assemblyName in s_nugetAssemblyName) - { - AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(assemblyName)); - } - } - } -} From c9c9f8c0d71617ba8cf6e5f928be890120fb15a7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 26 Sep 2020 12:42:25 +0000 Subject: [PATCH 1203/2702] [master] Update dependencies from dotnet/roslyn (#821) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7d4097cf33e1..ea20b027f092 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - cec38d8c307bb51596c35b6517f45607d8ea9cc8 + dd7319ea5e31ffe79f558c2c835067f4a9091902 diff --git a/eng/Versions.props b/eng/Versions.props index 604fae43a011..860d366fb7c8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.8.0-4.20474.4 + 3.8.0-4.20475.8 5.0.0-preview.7.20364.11 - 3.8.0-4.20475.8 + 3.8.0-4.20479.2 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 diff --git a/global.json b/global.json index 2f89923bc980..42a3e013d79c 100644 --- a/global.json +++ b/global.json @@ -5,4 +5,4 @@ "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20474.4" } -} \ No newline at end of file +} From 8a1ec0cd05e5eb686504eb1efeeebc4ee4f7aa97 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 29 Sep 2020 10:11:42 -0700 Subject: [PATCH 1207/2702] Remove MyGet publishing --- NuGet.config | 2 -- README.md | 6 ++---- azure-pipelines-official.yml | 8 -------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/NuGet.config b/NuGet.config index 26350252bb39..3b22e3ed49e1 100644 --- a/NuGet.config +++ b/NuGet.config @@ -5,8 +5,6 @@ - - diff --git a/README.md b/README.md index 1ca35eef5b9e..536d84dffe5f 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ [![Nuget](https://img.shields.io/nuget/v/dotnet-format.svg)](https://www.nuget.org/packages/dotnet-format) -[![MyGet](https://img.shields.io/dotnet.myget/format/vpre/dotnet-format.svg?label=myget)](https://dotnet.myget.org/feed/format/package/nuget/dotnet-format) - |Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) | Localization (Debug) | Localization (Release) | |---|:--:|:--:|:--:|:--:|:--:|:--:| [master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)| @@ -51,12 +49,12 @@ dotnet tool install -g dotnet-format #### Installing Development Builds -Development builds of `dotnet-format` are being hosted on myget. You can visit the [dotnet-format myget page](https://dotnet.myget.org/feed/format/package/nuget/dotnet-format) to get the latest version number. +Development builds of `dotnet-format` are being hosted on Azure Packages. You can visit the [dotnet-format Azure Packages page](https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&package=dotnet-format&version=5.0.142902&protocolType=NuGet&view=versions) to get the latest version number. You can install the tool using the following command. ```console -dotnet tool install -g dotnet-format --version 5.0.135301 --add-source https://dotnet.myget.org/F/format/api/v3/index.json +dotnet tool install -g dotnet-format --version 5.0.142902 --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json ``` ### How To Use diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 0a757f409c7c..14ea42809274 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -54,14 +54,6 @@ stages: testRunTitle: 'Unit Tests' condition: always() - - task: NuGetPublisher@0 - displayName: Publish NuGet Packages to MyGet - inputs: - searchPattern: '$(Build.SourcesDirectory)\artifacts\packages\$(BuildConfiguration)\Shipping\*.nupkg' - connectedServiceName: 'dotnet-format - NuGet feed' - nuGetVersion: 4.0.0.2283 - condition: succeeded() - - task: PublishBuildArtifacts@1 displayName: Publish Logs inputs: From 230d3cc8ee5fd76e0f4499b9edc4cfea1ff8bcbb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2020 16:34:54 +0000 Subject: [PATCH 1208/2702] [master] Update dependencies from dotnet/roslyn (#826) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ca28c0cea5f1..618f3d5cc855 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 1dd007226c75bda68c2e37d46c3ccfacb85d952b + 75d31ee941ce4dbbe5752f4ac2d5c0583f388a27 diff --git a/eng/Versions.props b/eng/Versions.props index ca8b1439de4c..71d4879ce414 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.8.0-4.20479.2 + 3.8.0-4.20503.2 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 5d34994bbd18251f32fb6643c0489c56e428a5af Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 8 Oct 2020 12:43:08 +0000 Subject: [PATCH 1209/2702] [master] Update dependencies from dotnet/arcade (#825) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/templates/job/job.yml | 12 +++++++++++- eng/common/templates/steps/perf-send-to-helix.yml | 2 +- eng/common/templates/steps/send-to-helix.yml | 2 +- global.json | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 618f3d5cc855..d1cd12dd7538 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 61cde6e8fb9d5c9790867b279deb41783a780cd8 + ee39cd1573dbb8011f343e1037af51d4fc00a747 diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index e78ed9a1c6ec..8b81a7e51436 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -204,7 +204,7 @@ jobs: - ${{ if eq(parameters.enablePublishTestResults, 'true') }}: - task: PublishTestResults@2 - displayName: Publish Test Results + displayName: Publish XUnit Test Results inputs: testResultsFormat: 'xUnit' testResultsFiles: '*.xml' @@ -213,6 +213,16 @@ jobs: mergeTestResults: ${{ parameters.mergeTestResults }} continueOnError: true condition: always() + - task: PublishTestResults@2 + displayName: Publish TRX Test Results + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '*.trx' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + testRunTitle: ${{ coalesce(parameters.testRunTitle, parameters.name, '$(System.JobName)') }}-trx + mergeTestResults: ${{ parameters.mergeTestResults }} + continueOnError: true + condition: always() - ${{ if and(eq(parameters.enablePublishBuildAssets, true), ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: CopyFiles@2 diff --git a/eng/common/templates/steps/perf-send-to-helix.yml b/eng/common/templates/steps/perf-send-to-helix.yml index 8427de59cd10..a468e92ce44d 100644 --- a/eng/common/templates/steps/perf-send-to-helix.yml +++ b/eng/common/templates/steps/perf-send-to-helix.yml @@ -11,7 +11,7 @@ parameters: WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion - DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 5eceb48725dc..bb5f1a929389 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -18,7 +18,7 @@ parameters: XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner XUnitRunnerVersion: '' # optional -- version of the xUnit nuget package you wish to use on Helix; required for XUnitProjects IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion - DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json + DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." diff --git a/global.json b/global.json index 42a3e013d79c..aecb93288718 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.1.20452.10" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20474.4" + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20506.7" } } From fc8fa478310898c54131611108e541d55fb8b3cf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 14 Oct 2020 12:48:29 +0000 Subject: [PATCH 1210/2702] Update dependencies from https://github.com/dotnet/arcade build 20201009.12 (#832) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 +- .../post-build/sourcelink-validation.ps1 | 15 +- .../templates/post-build/post-build.yml | 306 +++++++++--------- global.json | 4 +- 4 files changed, 167 insertions(+), 162 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d1cd12dd7538..8bf4024f60a7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - ee39cd1573dbb8011f343e1037af51d4fc00a747 + f2f45f7a856fe4949735e574f7a0350bda48264f diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index c7e7ae67d819..1728b742b3b7 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -161,9 +161,12 @@ $ValidatePackage = { function CheckJobResult( $result, $packagePath, - [ref]$ValidationFailures) { - if ($jobResult.result -ne '0') { - Write-PipelineTelemetryError -Category 'SourceLink' -Message "$packagePath has broken SourceLink links." + [ref]$ValidationFailures, + [switch]$logErrors) { + if ($result -ne '0') { + if ($logError) { + Write-PipelineTelemetryError -Category 'SourceLink' -Message "$packagePath has broken SourceLink links." + } $ValidationFailures.Value++ } } @@ -228,16 +231,14 @@ function ValidateSourceLinkLinks { foreach ($Job in @(Get-Job -State 'Completed')) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job - CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) -LogErrors Remove-Job -Id $Job.Id } } foreach ($Job in @(Get-Job)) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job - if ($jobResult -ne '0') { - $ValidationFailures++ - } + CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) Remove-Job -Id $Job.Id } if ($ValidationFailures -gt 0) { diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 0854e489615a..761fb1a29c35 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -67,176 +67,180 @@ parameters: VSMasterChannelId: 1012 stages: -- stage: Validate - dependsOn: ${{ parameters.validateDependsOn }} - displayName: Validate Build Assets - variables: - - template: common-variables.yml - jobs: - - template: setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} +- ${{ if or(and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')), eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + - stage: Validate + dependsOn: ${{ parameters.validateDependsOn }} + displayName: Validate Build Assets + variables: + - template: common-variables.yml + jobs: + - template: setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + + - ${{ if and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')) }}: + - job: + displayName: Post-build Checks + dependsOn: setupMaestroVars + variables: + - name: TargetChannels + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'] ] + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Maestro Channels Consistency + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 + arguments: -PromoteToChannels "$(TargetChannels)" + -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview8ChannelId}},${{parameters.Net5RC1ChannelId}},${{parameters.Net5RC2ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}} - - ${{ if and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')) }}: - job: - displayName: Post-build Checks + displayName: NuGet Validation dependsOn: setupMaestroVars - variables: - - name: TargetChannels - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'] ] + condition: eq( ${{ parameters.enableNugetValidation }}, 'true') pool: vmImage: 'windows-2019' + variables: + - name: AzDOProjectName + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] + - name: AzDOPipelineId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] + - name: AzDOBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + - task: PowerShell@2 - displayName: Maestro Channels Consistency + displayName: Validate inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 - arguments: -PromoteToChannels "$(TargetChannels)" - -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview8ChannelId}},${{parameters.Net5RC1ChannelId}},${{parameters.Net5RC2ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}} - - - job: - displayName: NuGet Validation - dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableNugetValidation }}, 'true') - pool: - vmImage: 'windows-2019' - variables: - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 - arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ - -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ - - - job: - displayName: Signing Validation - dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableSigningValidation }}, 'true') - variables: - - template: common-variables.yml - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - ${{ if eq(parameters.useBuildManifest, true) }}: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ + + - job: + displayName: Signing Validation + dependsOn: setupMaestroVars + condition: eq( ${{ parameters.enableSigningValidation }}, 'true') + variables: + - template: common-variables.yml + - name: AzDOProjectName + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] + - name: AzDOPipelineId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] + - name: AzDOBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] + pool: + vmImage: 'windows-2019' + steps: + - ${{ if eq(parameters.useBuildManifest, true) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download build manifest + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BuildManifests - task: DownloadBuildArtifacts@0 - displayName: Download build manifest + displayName: Download Package Artifacts inputs: buildType: specific buildVersionToDownload: specific project: $(AzDOProjectName) pipeline: $(AzDOPipelineId) buildId: $(AzDOBuildId) - artifactName: BuildManifests - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - - # This is necessary whenever we want to publish/restore to an AzDO private feed - # Since sdk-task.ps1 tries to restore packages we need to do this authentication here - # otherwise it'll complain about accessing a private feed. - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Enable cross-org publishing - inputs: - filePath: eng\common\enable-cross-org-publishing.ps1 - arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) - - # Signing validation will optionally work with the buildmanifest file which is downloaded from - # Azure DevOps above. - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task SigningValidation -restore -msbuildEngine vs - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' - /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' - ${{ parameters.signingValidationAdditionalParameters }} - - - template: ../steps/publish-logs.yml - parameters: - StageLabel: 'Validation' - JobLabel: 'Signing' - - - job: - displayName: SourceLink Validation - dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') - variables: - - template: common-variables.yml - - name: AzDOProjectName - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] - - name: AzDOPipelineId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] - - name: AzDOBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: BlobArtifacts - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -ExtractPath $(Agent.BuildDirectory)/Extract/ - -GHRepoName $(Build.Repository.Name) - -GHCommit $(Build.SourceVersion) - -SourcelinkCliVersion $(SourceLinkCLIVersion) - continueOnError: true - - - template: /eng/common/templates/job/execute-sdl.yml - parameters: - enable: ${{ parameters.SDLValidationParameters.enable }} + artifactName: PackageArtifacts + + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + + # Signing validation will optionally work with the buildmanifest file which is downloaded from + # Azure DevOps above. + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task SigningValidation -restore -msbuildEngine vs + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' + /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' + ${{ parameters.signingValidationAdditionalParameters }} + + - template: ../steps/publish-logs.yml + parameters: + StageLabel: 'Validation' + JobLabel: 'Signing' + + - job: + displayName: SourceLink Validation dependsOn: setupMaestroVars - additionalParameters: ${{ parameters.SDLValidationParameters.params }} - continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} - artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }} - downloadArtifacts: ${{ parameters.SDLValidationParameters.downloadArtifacts }} + condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') + variables: + - template: common-variables.yml + - name: AzDOProjectName + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ] + - name: AzDOPipelineId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ] + - name: AzDOBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ] + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: BlobArtifacts + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) + -GHCommit $(Build.SourceVersion) + -SourcelinkCliVersion $(SourceLinkCLIVersion) + continueOnError: true + + - template: /eng/common/templates/job/execute-sdl.yml + parameters: + enable: ${{ parameters.SDLValidationParameters.enable }} + dependsOn: setupMaestroVars + additionalParameters: ${{ parameters.SDLValidationParameters.params }} + continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} + artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }} + downloadArtifacts: ${{ parameters.SDLValidationParameters.downloadArtifacts }} - ${{ if or(ge(parameters.publishingInfraVersion, 3), eq(parameters.inline, 'false')) }}: - stage: publish_using_darc - dependsOn: Validate + ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + dependsOn: Validate + ${{ if and(ne(parameters.enableNugetValidation, 'true'), ne(parameters.enableSigningValidation, 'true'), ne(parameters.enableSourceLinkValidation, 'true'), ne(parameters.SDLValidationParameters.enable, 'true')) }}: + dependsOn: ${{ parameters.validateDependsOn }} displayName: Publish using Darc variables: - template: common-variables.yml diff --git a/global.json b/global.json index aecb93288718..0299c96fd221 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,8 @@ { "tools": { - "dotnet": "5.0.100-rc.1.20452.10" + "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20506.7" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20509.12" } } From 5cfce9f20650139bf9f13135da2acdec6a709944 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 14 Oct 2020 12:49:36 +0000 Subject: [PATCH 1211/2702] [master] Update dependencies from dotnet/roslyn (#830) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8bf4024f60a7..4d4d58026e72 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 75d31ee941ce4dbbe5752f4ac2d5c0583f388a27 + 5df35c46ea6e3ec8fb48f01f42d40e678769cd3f diff --git a/eng/Versions.props b/eng/Versions.props index 71d4879ce414..7cbffd6b7bda 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.8.0-4.20503.2 + 3.8.0-5.20512.3 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 5c1707005861655b6ddadaf802208f3d8560be4d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2020 18:12:46 +0000 Subject: [PATCH 1212/2702] Update dependencies from https://github.com/dotnet/arcade build 20201014.1 (#835) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/cross/toolchain.cmake | 4 ++++ eng/common/performance/performance-setup.sh | 1 + global.json | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4d4d58026e72..1dfa118bf970 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - f2f45f7a856fe4949735e574f7a0350bda48264f + d3cea00bba6539c68436ac9b3d9665318d76b47d diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index 137736c0a272..8b437d8ade0a 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -139,6 +139,10 @@ function(add_toolchain_linker_flag Flag) set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE) endfunction() +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib/${TOOLCHAIN}") + add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}") +endif() if(TARGET_ARCH_NAME STREQUAL "armel") if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 99d1b7bc1fc8..9c0f6c909145 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -201,6 +201,7 @@ if [[ "$internal" == true ]]; then fi if [[ "$mono_dotnet" != "" ]] && [[ "$monointerpreter" == "false" ]]; then + configurations="$configurations LLVM=$llvm MonoInterpreter=$monointerpreter MonoAOT=$monoaot" extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --category-exclusion-filter NoMono" fi diff --git a/global.json b/global.json index 0299c96fd221..552aeb7c5429 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20509.12" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20514.1" } } From f335db6c52a36687ef8554546bbe803df9160060 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2020 18:43:53 +0000 Subject: [PATCH 1213/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201016.2 (#836) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1dfa118bf970..c9dc38024533 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 5df35c46ea6e3ec8fb48f01f42d40e678769cd3f + 5fad08ef408ec0f001fa8bdd89f54b5767af1cb6 diff --git a/eng/Versions.props b/eng/Versions.props index 7cbffd6b7bda..5ae9164751b0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,7 @@ 15.3.409 - 3.8.0-5.20512.3 + 3.8.0-5.20516.2 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 1e0c588d65043ac52243219194bae4041dc7e7c2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2020 16:24:53 +0000 Subject: [PATCH 1214/2702] Update dependencies from https://github.com/dotnet/arcade build 20201015.7 (#839) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c9dc38024533..22a8191dd1a4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - d3cea00bba6539c68436ac9b3d9665318d76b47d + d4de3ce701c2ba697d71cc70e2db69d7568913dc diff --git a/global.json b/global.json index 552aeb7c5429..ef0f5708b519 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20514.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20515.7" } } From eadde172822e75922a68332d1037972f1fcec791 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 19 Oct 2020 10:45:00 -0700 Subject: [PATCH 1215/2702] Set AutoGenerateAssemblyVersion in Version.props --- azure-pipelines-official.yml | 2 +- eng/Versions.props | 6 ++++++ src/dotnet-format.csproj | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 14ea42809274..b4d7a41e0949 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -61,7 +61,7 @@ stages: ArtifactName: 'Logs' publishLocation: Container continueOnError: true - condition: not(succeeded()) + condition: always() - task: PublishBuildArtifacts@1 displayName: Publish Logs diff --git a/eng/Versions.props b/eng/Versions.props index 5ae9164751b0..6722501b7e0d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -5,6 +5,12 @@ 0 + + + true 15.3.409 diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 9a2f6c8e46f2..90baa1fbcdaa 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -7,7 +7,6 @@ true Microsoft.CodeAnalysis.Tools true - true Enable $(NoWarn);8002 From d96fc0aabd14647957d0ee0898d25b0387b01fce Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2020 17:47:53 +0000 Subject: [PATCH 1216/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201017.14 (#840) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 22a8191dd1a4..3178bbb54169 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 5fad08ef408ec0f001fa8bdd89f54b5767af1cb6 + 6512635c6e366ecf451dadafa55c98a96db590d3 diff --git a/eng/Versions.props b/eng/Versions.props index 6722501b7e0d..40a5646e0018 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.8.0-5.20516.2 + 3.8.0-5.20517.14 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 639e34eb28e8c05ac4061445eb00df0fb1c02eaa Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 19 Oct 2020 10:50:56 -0700 Subject: [PATCH 1217/2702] Set PreReleaseAssemblyVersion to an empty value --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 40a5646e0018..0d1ab4b01ec9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -4,7 +4,7 @@ 5 0 - + - - + + + + + + + + + + + + + @@ -51,6 +58,13 @@ + + + $(WorkItemDirectory) + $(Python) $(Crossgen2Directory)test.py crossgen2 --core-root $(CoreRoot) --single %(Identity) --singlethreaded True + + + @@ -60,6 +74,9 @@ 4:00 + + 4:00 + $(WorkItemDirectory) $(Python) $(Crossgen2Directory)test.py crossgen2 --core-root $(CoreRoot) --composite $(Crossgen2Directory)framework-r2r.dll.rsp diff --git a/global.json b/global.json index ef0f5708b519..32baa34284f6 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20515.7" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20516.5" } } From 04e1662a32eb1b798514e66ed5668c557350ca24 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 20 Oct 2020 16:03:05 +0000 Subject: [PATCH 1223/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201019.18 (#846) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fbeb70311fc9..0e2dc9ef80e6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 6512635c6e366ecf451dadafa55c98a96db590d3 + 4c195c3ac1974edcefa76774d7a59a2350ec55fa diff --git a/eng/Versions.props b/eng/Versions.props index 62e92c8f01d1..f15ea4867639 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.8.0-5.20517.14 + 3.8.0-5.20519.18 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 329efd472431a7524b76bebdd03925ba2562d68c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 23 Oct 2020 15:26:02 +0000 Subject: [PATCH 1224/2702] Update dependencies from https://github.com/dotnet/arcade build 20201020.8 (#847) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/cross/build-rootfs.sh | 1 + eng/common/templates/job/job.yml | 8 +++++--- global.json | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0e2dc9ef80e6..525a248fb9bc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - e7a79ce64f0703c231e6da88b5279dd0bf681b3d + 7fbf2a7703498067569d07a21776b91e599028e2 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index ffdff38542e1..a841c64f3f3b 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -329,6 +329,7 @@ elif [[ -n $__CodeName ]]; then chroot $__RootfsDir apt-get -f -y install chroot $__RootfsDir apt-get -y install $__UbuntuPackages chroot $__RootfsDir symlinks -cr /usr + chroot $__RootfsDir apt clean if [ $__SkipUnmount == 0 ]; then umount $__RootfsDir/* || true diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 8b81a7e51436..8e4ce2c28537 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -27,6 +27,7 @@ parameters: useBuildManifest: false mergeTestResults: false testRunTitle: '' + testResultsFormat: '' name: '' preSteps: [] runAsPublic: false @@ -131,8 +132,8 @@ jobs: - task: RichCodeNavIndexer@0 displayName: RichCodeNav Upload inputs: - languages: 'csharp' - environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'prod') }} + languages: ${{ coalesce(parameters.richCodeNavigationLanguage, 'csharp') }} + environment: ${{ coalesce(parameters.richCodeNavigationEnvironment, 'production') }} richNavLogOutputDirectory: $(Build.SourcesDirectory)/artifacts/bin continueOnError: true @@ -202,7 +203,7 @@ jobs: continueOnError: true condition: always() - - ${{ if eq(parameters.enablePublishTestResults, 'true') }}: + - ${{ if or(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, 'xunit')) }}: - task: PublishTestResults@2 displayName: Publish XUnit Test Results inputs: @@ -213,6 +214,7 @@ jobs: mergeTestResults: ${{ parameters.mergeTestResults }} continueOnError: true condition: always() + - ${{ if or(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, 'vstest')) }}: - task: PublishTestResults@2 displayName: Publish TRX Test Results inputs: diff --git a/global.json b/global.json index 32baa34284f6..0435f44df513 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20516.5" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20520.8" } } From 7d7b7f05e9ed67cc4c983b9164add3eb32fa6518 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2020 14:45:17 +0000 Subject: [PATCH 1225/2702] Update dependencies from https://github.com/dotnet/arcade build 20201022.2 (#849) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 525a248fb9bc..e56506f7872f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 7fbf2a7703498067569d07a21776b91e599028e2 + c262e0121edb7df890528bb61589d4b6e440a1f6 diff --git a/global.json b/global.json index 0435f44df513..22258585922a 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20520.8" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20522.2" } } From b9dcdd78c92ad4f0e968a0bdebc0c8a883ff41c7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2020 16:55:56 +0000 Subject: [PATCH 1226/2702] Update dependencies from https://github.com/dotnet/arcade build 20201025.1 (#850) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/templates/job/job.yml | 4 ++-- global.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e56506f7872f..856a6dedcdac 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - c262e0121edb7df890528bb61589d4b6e440a1f6 + a77062f9cdaf07cbaf8d19941d079837844f69ca diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 8e4ce2c28537..06048c27907b 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -203,7 +203,7 @@ jobs: continueOnError: true condition: always() - - ${{ if or(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, 'xunit')) }}: + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'xunit')) }}: - task: PublishTestResults@2 displayName: Publish XUnit Test Results inputs: @@ -214,7 +214,7 @@ jobs: mergeTestResults: ${{ parameters.mergeTestResults }} continueOnError: true condition: always() - - ${{ if or(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, 'vstest')) }}: + - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'vstest')) }}: - task: PublishTestResults@2 displayName: Publish TRX Test Results inputs: diff --git a/global.json b/global.json index 22258585922a..cb3ee96754f2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20522.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20525.1" } } From 32868a21a4eedb3cc1c88d2c74c6c422be16afd0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 28 Oct 2020 14:36:08 +0000 Subject: [PATCH 1227/2702] Update dependencies from https://github.com/dotnet/arcade build 20201026.10 (#851) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 +- eng/common/build.ps1 | 2 - eng/common/build.sh | 9 +- .../dotnet-install-scripts/dotnet-install.ps1 | 774 ----------- .../dotnet-install-scripts/dotnet-install.sh | 1133 ----------------- eng/common/tools.ps1 | 63 +- eng/common/tools.sh | 37 +- global.json | 2 +- 8 files changed, 42 insertions(+), 1982 deletions(-) delete mode 100644 eng/common/dotnet-install-scripts/dotnet-install.ps1 delete mode 100644 eng/common/dotnet-install-scripts/dotnet-install.sh diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 856a6dedcdac..48c5fcb2aab7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - a77062f9cdaf07cbaf8d19941d079837844f69ca + c0f916d7f45834c080bf6cce60cf2bcfa00bc0a7 diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 1fd7f686faea..94a91c0817e8 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -7,7 +7,6 @@ Param( [string] $msbuildEngine = $null, [bool] $warnAsError = $true, [bool] $nodeReuse = $true, - [bool] $useDefaultDotnetInstall = $false, [switch][Alias('r')]$restore, [switch] $deployDeps, [switch][Alias('b')]$build, @@ -66,7 +65,6 @@ function Print-Usage() { Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." - Write-Host " -useDefaultDotnetInstall Use dotnet-install.* scripts from public location as opposed to from eng common folder" Write-Host "" Write-Host "Command line arguments not listed above are passed thru to msbuild." diff --git a/eng/common/build.sh b/eng/common/build.sh index 19849adbee3f..252b63604e6e 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -36,8 +36,6 @@ usage() echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" - echo " --useDefaultDotnetInstall Use dotnet-install.* scripts from public location as opposed to from eng common folder" - echo "" echo "Command line arguments not listed above are passed thru to msbuild." echo "Arguments can also be passed in with a single hyphen." @@ -80,7 +78,6 @@ prepare_machine=false verbosity='minimal' runtime_source_feed='' runtime_source_feed_key='' -use_default_dotnet_install=false properties='' while [[ $# > 0 ]]; do @@ -159,14 +156,10 @@ while [[ $# > 0 ]]; do runtime_source_feed=$2 shift ;; - -runtimesourcefeedkey) + -runtimesourcefeedkey) runtime_source_feed_key=$2 shift ;; - -usedefaultdotnetinstall) - use_default_dotnet_install=$2 - shift - ;; *) properties="$properties $1" ;; diff --git a/eng/common/dotnet-install-scripts/dotnet-install.ps1 b/eng/common/dotnet-install-scripts/dotnet-install.ps1 deleted file mode 100644 index f63b533f25a9..000000000000 --- a/eng/common/dotnet-install-scripts/dotnet-install.ps1 +++ /dev/null @@ -1,774 +0,0 @@ -# -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -# Copied from https://dot.net/v1/dotnet-install.ps1 on 8/26/2020 - -<# -.SYNOPSIS - Installs dotnet cli -.DESCRIPTION - Installs dotnet cli. If dotnet installation already exists in the given directory - it will update it only if the requested version differs from the one already installed. -.PARAMETER Channel - Default: LTS - Download from the Channel specified. Possible values: - - Current - most current release - - LTS - most current supported release - - 2-part version in a format A.B - represents a specific release - examples: 2.0, 1.0 - - Branch name - examples: release/2.0.0, Master - Note: The version parameter overrides the channel parameter. -.PARAMETER Version - Default: latest - Represents a build version on specific channel. Possible values: - - latest - most latest build on specific channel - - coherent - most latest coherent build on specific channel - coherent applies only to SDK downloads - - 3-part version in a format A.B.C - represents specific version of build - examples: 2.0.0-preview2-006120, 1.1.0 -.PARAMETER InstallDir - Default: %LocalAppData%\Microsoft\dotnet - Path to where to install dotnet. Note that binaries will be placed directly in a given directory. -.PARAMETER Architecture - Default: - this value represents currently running OS architecture - Architecture of dotnet binaries to be installed. - Possible values are: , amd64, x64, x86, arm64, arm -.PARAMETER SharedRuntime - This parameter is obsolete and may be removed in a future version of this script. - The recommended alternative is '-Runtime dotnet'. - Installs just the shared runtime bits, not the entire SDK. -.PARAMETER Runtime - Installs just a shared runtime, not the entire SDK. - Possible values: - - dotnet - the Microsoft.NETCore.App shared runtime - - aspnetcore - the Microsoft.AspNetCore.App shared runtime - - windowsdesktop - the Microsoft.WindowsDesktop.App shared runtime -.PARAMETER DryRun - If set it will not perform installation but instead display what command line to use to consistently install - currently requested version of dotnet cli. In example if you specify version 'latest' it will display a link - with specific version so that this command can be used deterministicly in a build script. - It also displays binaries location if you prefer to install or download it yourself. -.PARAMETER NoPath - By default this script will set environment variable PATH for the current process to the binaries folder inside installation folder. - If set it will display binaries location but not set any environment variable. -.PARAMETER Verbose - Displays diagnostics information. -.PARAMETER AzureFeed - Default: https://dotnetcli.azureedge.net/dotnet - This parameter typically is not changed by the user. - It allows changing the URL for the Azure feed used by this installer. -.PARAMETER UncachedFeed - This parameter typically is not changed by the user. - It allows changing the URL for the Uncached feed used by this installer. -.PARAMETER FeedCredential - Used as a query string to append to the Azure feed. - It allows changing the URL to use non-public blob storage accounts. -.PARAMETER ProxyAddress - If set, the installer will use the proxy when making web requests -.PARAMETER ProxyUseDefaultCredentials - Default: false - Use default credentials, when using proxy address. -.PARAMETER ProxyBypassList - If set with ProxyAddress, will provide the list of comma separated urls that will bypass the proxy -.PARAMETER SkipNonVersionedFiles - Default: false - Skips installing non-versioned files if they already exist, such as dotnet.exe. -.PARAMETER NoCdn - Disable downloading from the Azure CDN, and use the uncached feed directly. -.PARAMETER JSonFile - Determines the SDK version from a user specified global.json file - Note: global.json must have a value for 'SDK:Version' -#> -[cmdletbinding()] -param( - [string]$Channel="LTS", - [string]$Version="Latest", - [string]$JSonFile, - [string]$InstallDir="", - [string]$Architecture="", - [ValidateSet("dotnet", "aspnetcore", "windowsdesktop", IgnoreCase = $false)] - [string]$Runtime, - [Obsolete("This parameter may be removed in a future version of this script. The recommended alternative is '-Runtime dotnet'.")] - [switch]$SharedRuntime, - [switch]$DryRun, - [switch]$NoPath, - [string]$AzureFeed="https://dotnetcli.azureedge.net/dotnet", - [string]$UncachedFeed="https://dotnetcli.blob.core.windows.net/dotnet", - [string]$FeedCredential, - [string]$ProxyAddress, - [switch]$ProxyUseDefaultCredentials, - [string[]]$ProxyBypassList=@(), - [switch]$SkipNonVersionedFiles, - [switch]$NoCdn -) - -Set-StrictMode -Version Latest -$ErrorActionPreference="Stop" -$ProgressPreference="SilentlyContinue" - -if ($NoCdn) { - $AzureFeed = $UncachedFeed -} - -$BinFolderRelativePath="" - -if ($SharedRuntime -and (-not $Runtime)) { - $Runtime = "dotnet" -} - -# example path with regex: shared/1.0.0-beta-12345/somepath -$VersionRegEx="/\d+\.\d+[^/]+/" -$OverrideNonVersionedFiles = !$SkipNonVersionedFiles - -function Say($str) { - try - { - Write-Host "dotnet-install: $str" - } - catch - { - # Some platforms cannot utilize Write-Host (Azure Functions, for instance). Fall back to Write-Output - Write-Output "dotnet-install: $str" - } -} - -function Say-Verbose($str) { - try - { - Write-Verbose "dotnet-install: $str" - } - catch - { - # Some platforms cannot utilize Write-Verbose (Azure Functions, for instance). Fall back to Write-Output - Write-Output "dotnet-install: $str" - } -} - -function Say-Invocation($Invocation) { - $command = $Invocation.MyCommand; - $args = (($Invocation.BoundParameters.Keys | foreach { "-$_ `"$($Invocation.BoundParameters[$_])`"" }) -join " ") - Say-Verbose "$command $args" -} - -function Invoke-With-Retry([ScriptBlock]$ScriptBlock, [int]$MaxAttempts = 3, [int]$SecondsBetweenAttempts = 1) { - $Attempts = 0 - - while ($true) { - try { - return $ScriptBlock.Invoke() - } - catch { - $Attempts++ - if ($Attempts -lt $MaxAttempts) { - Start-Sleep $SecondsBetweenAttempts - } - else { - throw - } - } - } -} - -function Get-Machine-Architecture() { - Say-Invocation $MyInvocation - - # On PS x86, PROCESSOR_ARCHITECTURE reports x86 even on x64 systems. - # To get the correct architecture, we need to use PROCESSOR_ARCHITEW6432. - # PS x64 doesn't define this, so we fall back to PROCESSOR_ARCHITECTURE. - # Possible values: amd64, x64, x86, arm64, arm - - if( $ENV:PROCESSOR_ARCHITEW6432 -ne $null ) - { - return $ENV:PROCESSOR_ARCHITEW6432 - } - - return $ENV:PROCESSOR_ARCHITECTURE -} - -function Get-CLIArchitecture-From-Architecture([string]$Architecture) { - Say-Invocation $MyInvocation - - switch ($Architecture.ToLower()) { - { $_ -eq "" } { return Get-CLIArchitecture-From-Architecture $(Get-Machine-Architecture) } - { ($_ -eq "amd64") -or ($_ -eq "x64") } { return "x64" } - { $_ -eq "x86" } { return "x86" } - { $_ -eq "arm" } { return "arm" } - { $_ -eq "arm64" } { return "arm64" } - default { throw "Architecture not supported. If you think this is a bug, report it at https://github.com/dotnet/sdk/issues" } - } -} - -# The version text returned from the feeds is a 1-line or 2-line string: -# For the SDK and the dotnet runtime (2 lines): -# Line 1: # commit_hash -# Line 2: # 4-part version -# For the aspnetcore runtime (1 line): -# Line 1: # 4-part version -function Get-Version-Info-From-Version-Text([string]$VersionText) { - Say-Invocation $MyInvocation - - $Data = -split $VersionText - - $VersionInfo = @{ - CommitHash = $(if ($Data.Count -gt 1) { $Data[0] }) - Version = $Data[-1] # last line is always the version number. - } - return $VersionInfo -} - -function Load-Assembly([string] $Assembly) { - try { - Add-Type -Assembly $Assembly | Out-Null - } - catch { - # On Nano Server, Powershell Core Edition is used. Add-Type is unable to resolve base class assemblies because they are not GAC'd. - # Loading the base class assemblies is not unnecessary as the types will automatically get resolved. - } -} - -function GetHTTPResponse([Uri] $Uri) -{ - Invoke-With-Retry( - { - - $HttpClient = $null - - try { - # HttpClient is used vs Invoke-WebRequest in order to support Nano Server which doesn't support the Invoke-WebRequest cmdlet. - Load-Assembly -Assembly System.Net.Http - - if(-not $ProxyAddress) { - try { - # Despite no proxy being explicitly specified, we may still be behind a default proxy - $DefaultProxy = [System.Net.WebRequest]::DefaultWebProxy; - if($DefaultProxy -and (-not $DefaultProxy.IsBypassed($Uri))) { - $ProxyAddress = $DefaultProxy.GetProxy($Uri).OriginalString - $ProxyUseDefaultCredentials = $true - } - } catch { - # Eat the exception and move forward as the above code is an attempt - # at resolving the DefaultProxy that may not have been a problem. - $ProxyAddress = $null - Say-Verbose("Exception ignored: $_.Exception.Message - moving forward...") - } - } - - if($ProxyAddress) { - $HttpClientHandler = New-Object System.Net.Http.HttpClientHandler - $HttpClientHandler.Proxy = New-Object System.Net.WebProxy -Property @{ - Address=$ProxyAddress; - UseDefaultCredentials=$ProxyUseDefaultCredentials; - BypassList = $ProxyBypassList; - } - $HttpClient = New-Object System.Net.Http.HttpClient -ArgumentList $HttpClientHandler - } - else { - - $HttpClient = New-Object System.Net.Http.HttpClient - } - # Default timeout for HttpClient is 100s. For a 50 MB download this assumes 500 KB/s average, any less will time out - # 20 minutes allows it to work over much slower connections. - $HttpClient.Timeout = New-TimeSpan -Minutes 20 - $Response = $HttpClient.GetAsync("${Uri}${FeedCredential}").Result - if (($Response -eq $null) -or (-not ($Response.IsSuccessStatusCode))) { - # The feed credential is potentially sensitive info. Do not log FeedCredential to console output. - $ErrorMsg = "Failed to download $Uri." - if ($Response -ne $null) { - $ErrorMsg += " $Response" - } - - throw $ErrorMsg - } - - return $Response - } - finally { - if ($HttpClient -ne $null) { - $HttpClient.Dispose() - } - } - }) -} - -function Get-Latest-Version-Info([string]$AzureFeed, [string]$Channel, [bool]$Coherent) { - Say-Invocation $MyInvocation - - $VersionFileUrl = $null - if ($Runtime -eq "dotnet") { - $VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.version" - } - elseif ($Runtime -eq "aspnetcore") { - $VersionFileUrl = "$UncachedFeed/aspnetcore/Runtime/$Channel/latest.version" - } - # Currently, the WindowsDesktop runtime is manufactured with the .Net core runtime - elseif ($Runtime -eq "windowsdesktop") { - $VersionFileUrl = "$UncachedFeed/Runtime/$Channel/latest.version" - } - elseif (-not $Runtime) { - if ($Coherent) { - $VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.coherent.version" - } - else { - $VersionFileUrl = "$UncachedFeed/Sdk/$Channel/latest.version" - } - } - else { - throw "Invalid value for `$Runtime" - } - try { - $Response = GetHTTPResponse -Uri $VersionFileUrl - } - catch { - throw "Could not resolve version information." - } - $StringContent = $Response.Content.ReadAsStringAsync().Result - - switch ($Response.Content.Headers.ContentType) { - { ($_ -eq "application/octet-stream") } { $VersionText = $StringContent } - { ($_ -eq "text/plain") } { $VersionText = $StringContent } - { ($_ -eq "text/plain; charset=UTF-8") } { $VersionText = $StringContent } - default { throw "``$Response.Content.Headers.ContentType`` is an unknown .version file content type." } - } - - $VersionInfo = Get-Version-Info-From-Version-Text $VersionText - - return $VersionInfo -} - -function Parse-Jsonfile-For-Version([string]$JSonFile) { - Say-Invocation $MyInvocation - - If (-Not (Test-Path $JSonFile)) { - throw "Unable to find '$JSonFile'" - } - try { - $JSonContent = Get-Content($JSonFile) -Raw | ConvertFrom-Json | Select-Object -expand "sdk" -ErrorAction SilentlyContinue - } - catch { - throw "Json file unreadable: '$JSonFile'" - } - if ($JSonContent) { - try { - $JSonContent.PSObject.Properties | ForEach-Object { - $PropertyName = $_.Name - if ($PropertyName -eq "version") { - $Version = $_.Value - Say-Verbose "Version = $Version" - } - } - } - catch { - throw "Unable to parse the SDK node in '$JSonFile'" - } - } - else { - throw "Unable to find the SDK node in '$JSonFile'" - } - If ($Version -eq $null) { - throw "Unable to find the SDK:version node in '$JSonFile'" - } - return $Version -} - -function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$Channel, [string]$Version, [string]$JSonFile) { - Say-Invocation $MyInvocation - - if (-not $JSonFile) { - switch ($Version.ToLower()) { - { $_ -eq "latest" } { - $LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -Coherent $False - return $LatestVersionInfo.Version - } - { $_ -eq "coherent" } { - $LatestVersionInfo = Get-Latest-Version-Info -AzureFeed $AzureFeed -Channel $Channel -Coherent $True - return $LatestVersionInfo.Version - } - default { return $Version } - } - } - else { - return Parse-Jsonfile-For-Version $JSonFile - } -} - -function Get-Download-Link([string]$AzureFeed, [string]$SpecificVersion, [string]$CLIArchitecture) { - Say-Invocation $MyInvocation - - # If anything fails in this lookup it will default to $SpecificVersion - $SpecificProductVersion = Get-Product-Version -AzureFeed $AzureFeed -SpecificVersion $SpecificVersion - - if ($Runtime -eq "dotnet") { - $PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/dotnet-runtime-$SpecificProductVersion-win-$CLIArchitecture.zip" - } - elseif ($Runtime -eq "aspnetcore") { - $PayloadURL = "$AzureFeed/aspnetcore/Runtime/$SpecificVersion/aspnetcore-runtime-$SpecificProductVersion-win-$CLIArchitecture.zip" - } - elseif ($Runtime -eq "windowsdesktop") { - $PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/windowsdesktop-runtime-$SpecificProductVersion-win-$CLIArchitecture.zip" - } - elseif (-not $Runtime) { - $PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-sdk-$SpecificProductVersion-win-$CLIArchitecture.zip" - } - else { - throw "Invalid value for `$Runtime" - } - - Say-Verbose "Constructed primary named payload URL: $PayloadURL" - - return $PayloadURL, $SpecificProductVersion -} - -function Get-LegacyDownload-Link([string]$AzureFeed, [string]$SpecificVersion, [string]$CLIArchitecture) { - Say-Invocation $MyInvocation - - if (-not $Runtime) { - $PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-win-$CLIArchitecture.$SpecificVersion.zip" - } - elseif ($Runtime -eq "dotnet") { - $PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/dotnet-win-$CLIArchitecture.$SpecificVersion.zip" - } - else { - return $null - } - - Say-Verbose "Constructed legacy named payload URL: $PayloadURL" - - return $PayloadURL -} - -function Get-Product-Version([string]$AzureFeed, [string]$SpecificVersion) { - Say-Invocation $MyInvocation - - if ($Runtime -eq "dotnet") { - $ProductVersionTxtURL = "$AzureFeed/Runtime/$SpecificVersion/productVersion.txt" - } - elseif ($Runtime -eq "aspnetcore") { - $ProductVersionTxtURL = "$AzureFeed/aspnetcore/Runtime/$SpecificVersion/productVersion.txt" - } - elseif ($Runtime -eq "windowsdesktop") { - $ProductVersionTxtURL = "$AzureFeed/Runtime/$SpecificVersion/productVersion.txt" - } - elseif (-not $Runtime) { - $ProductVersionTxtURL = "$AzureFeed/Sdk/$SpecificVersion/productVersion.txt" - } - else { - throw "Invalid value specified for `$Runtime" - } - - Say-Verbose "Checking for existence of $ProductVersionTxtURL" - - try { - $productVersionResponse = GetHTTPResponse($productVersionTxtUrl) - - if ($productVersionResponse.StatusCode -eq 200) { - $productVersion = $productVersionResponse.Content.ReadAsStringAsync().Result.Trim() - if ($productVersion -ne $SpecificVersion) - { - Say "Using alternate version $productVersion found in $ProductVersionTxtURL" - } - - return $productVersion - } - else { - Say-Verbose "Got StatusCode $($productVersionResponse.StatusCode) trying to get productVersion.txt at $productVersionTxtUrl, so using default value of $SpecificVersion" - $productVersion = $SpecificVersion - } - } catch { - Say-Verbose "Could not read productVersion.txt at $productVersionTxtUrl, so using default value of $SpecificVersion" - $productVersion = $SpecificVersion - } - - return $productVersion -} - -function Get-User-Share-Path() { - Say-Invocation $MyInvocation - - $InstallRoot = $env:DOTNET_INSTALL_DIR - if (!$InstallRoot) { - $InstallRoot = "$env:LocalAppData\Microsoft\dotnet" - } - return $InstallRoot -} - -function Resolve-Installation-Path([string]$InstallDir) { - Say-Invocation $MyInvocation - - if ($InstallDir -eq "") { - return Get-User-Share-Path - } - return $InstallDir -} - -function Is-Dotnet-Package-Installed([string]$InstallRoot, [string]$RelativePathToPackage, [string]$SpecificVersion) { - Say-Invocation $MyInvocation - - $DotnetPackagePath = Join-Path -Path $InstallRoot -ChildPath $RelativePathToPackage | Join-Path -ChildPath $SpecificVersion - Say-Verbose "Is-Dotnet-Package-Installed: DotnetPackagePath=$DotnetPackagePath" - return Test-Path $DotnetPackagePath -PathType Container -} - -function Get-Absolute-Path([string]$RelativeOrAbsolutePath) { - # Too much spam - # Say-Invocation $MyInvocation - - return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($RelativeOrAbsolutePath) -} - -function Get-Path-Prefix-With-Version($path) { - $match = [regex]::match($path, $VersionRegEx) - if ($match.Success) { - return $entry.FullName.Substring(0, $match.Index + $match.Length) - } - - return $null -} - -function Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package([System.IO.Compression.ZipArchive]$Zip, [string]$OutPath) { - Say-Invocation $MyInvocation - - $ret = @() - foreach ($entry in $Zip.Entries) { - $dir = Get-Path-Prefix-With-Version $entry.FullName - if ($dir -ne $null) { - $path = Get-Absolute-Path $(Join-Path -Path $OutPath -ChildPath $dir) - if (-Not (Test-Path $path -PathType Container)) { - $ret += $dir - } - } - } - - $ret = $ret | Sort-Object | Get-Unique - - $values = ($ret | foreach { "$_" }) -join ";" - Say-Verbose "Directories to unpack: $values" - - return $ret -} - -# Example zip content and extraction algorithm: -# Rule: files if extracted are always being extracted to the same relative path locally -# .\ -# a.exe # file does not exist locally, extract -# b.dll # file exists locally, override only if $OverrideFiles set -# aaa\ # same rules as for files -# ... -# abc\1.0.0\ # directory contains version and exists locally -# ... # do not extract content under versioned part -# abc\asd\ # same rules as for files -# ... -# def\ghi\1.0.1\ # directory contains version and does not exist locally -# ... # extract content -function Extract-Dotnet-Package([string]$ZipPath, [string]$OutPath) { - Say-Invocation $MyInvocation - - Load-Assembly -Assembly System.IO.Compression.FileSystem - Set-Variable -Name Zip - try { - $Zip = [System.IO.Compression.ZipFile]::OpenRead($ZipPath) - - $DirectoriesToUnpack = Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package -Zip $Zip -OutPath $OutPath - - foreach ($entry in $Zip.Entries) { - $PathWithVersion = Get-Path-Prefix-With-Version $entry.FullName - if (($PathWithVersion -eq $null) -Or ($DirectoriesToUnpack -contains $PathWithVersion)) { - $DestinationPath = Get-Absolute-Path $(Join-Path -Path $OutPath -ChildPath $entry.FullName) - $DestinationDir = Split-Path -Parent $DestinationPath - $OverrideFiles=$OverrideNonVersionedFiles -Or (-Not (Test-Path $DestinationPath)) - if ((-Not $DestinationPath.EndsWith("\")) -And $OverrideFiles) { - New-Item -ItemType Directory -Force -Path $DestinationDir | Out-Null - [System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $DestinationPath, $OverrideNonVersionedFiles) - } - } - } - } - finally { - if ($Zip -ne $null) { - $Zip.Dispose() - } - } -} - -function DownloadFile($Source, [string]$OutPath) { - if ($Source -notlike "http*") { - # Using System.IO.Path.GetFullPath to get the current directory - # does not work in this context - $pwd gives the current directory - if (![System.IO.Path]::IsPathRooted($Source)) { - $Source = $(Join-Path -Path $pwd -ChildPath $Source) - } - $Source = Get-Absolute-Path $Source - Say "Copying file from $Source to $OutPath" - Copy-Item $Source $OutPath - return - } - - $Stream = $null - - try { - $Response = GetHTTPResponse -Uri $Source - $Stream = $Response.Content.ReadAsStreamAsync().Result - $File = [System.IO.File]::Create($OutPath) - $Stream.CopyTo($File) - $File.Close() - } - finally { - if ($Stream -ne $null) { - $Stream.Dispose() - } - } -} - -function Prepend-Sdk-InstallRoot-To-Path([string]$InstallRoot, [string]$BinFolderRelativePath) { - $BinPath = Get-Absolute-Path $(Join-Path -Path $InstallRoot -ChildPath $BinFolderRelativePath) - if (-Not $NoPath) { - $SuffixedBinPath = "$BinPath;" - if (-Not $env:path.Contains($SuffixedBinPath)) { - Say "Adding to current process PATH: `"$BinPath`". Note: This change will not be visible if PowerShell was run as a child process." - $env:path = $SuffixedBinPath + $env:path - } else { - Say-Verbose "Current process PATH already contains `"$BinPath`"" - } - } - else { - Say "Binaries of dotnet can be found in $BinPath" - } -} - -$CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture -$SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $AzureFeed -Channel $Channel -Version $Version -JSonFile $JSonFile -$DownloadLink, $EffectiveVersion = Get-Download-Link -AzureFeed $AzureFeed -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture -$LegacyDownloadLink = Get-LegacyDownload-Link -AzureFeed $AzureFeed -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture - -$InstallRoot = Resolve-Installation-Path $InstallDir -Say-Verbose "InstallRoot: $InstallRoot" -$ScriptName = $MyInvocation.MyCommand.Name - -if ($DryRun) { - Say "Payload URLs:" - Say "Primary named payload URL: $DownloadLink" - if ($LegacyDownloadLink) { - Say "Legacy named payload URL: $LegacyDownloadLink" - } - $RepeatableCommand = ".\$ScriptName -Version `"$SpecificVersion`" -InstallDir `"$InstallRoot`" -Architecture `"$CLIArchitecture`"" - if ($Runtime -eq "dotnet") { - $RepeatableCommand+=" -Runtime `"dotnet`"" - } - elseif ($Runtime -eq "aspnetcore") { - $RepeatableCommand+=" -Runtime `"aspnetcore`"" - } - foreach ($key in $MyInvocation.BoundParameters.Keys) { - if (-not (@("Architecture","Channel","DryRun","InstallDir","Runtime","SharedRuntime","Version") -contains $key)) { - $RepeatableCommand+=" -$key `"$($MyInvocation.BoundParameters[$key])`"" - } - } - Say "Repeatable invocation: $RepeatableCommand" - exit 0 -} - -if ($Runtime -eq "dotnet") { - $assetName = ".NET Core Runtime" - $dotnetPackageRelativePath = "shared\Microsoft.NETCore.App" -} -elseif ($Runtime -eq "aspnetcore") { - $assetName = "ASP.NET Core Runtime" - $dotnetPackageRelativePath = "shared\Microsoft.AspNetCore.App" -} -elseif ($Runtime -eq "windowsdesktop") { - $assetName = ".NET Core Windows Desktop Runtime" - $dotnetPackageRelativePath = "shared\Microsoft.WindowsDesktop.App" -} -elseif (-not $Runtime) { - $assetName = ".NET Core SDK" - $dotnetPackageRelativePath = "sdk" -} -else { - throw "Invalid value for `$Runtime" -} - -if ($SpecificVersion -ne $EffectiveVersion) -{ - Say "Performing installation checks for effective version: $EffectiveVersion" - $SpecificVersion = $EffectiveVersion -} - -# Check if the SDK version is already installed. -$isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion -if ($isAssetInstalled) { - Say "$assetName version $SpecificVersion is already installed." - Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot -BinFolderRelativePath $BinFolderRelativePath - exit 0 -} - -New-Item -ItemType Directory -Force -Path $InstallRoot | Out-Null - -$installDrive = $((Get-Item $InstallRoot).PSDrive.Name); -$diskInfo = Get-PSDrive -Name $installDrive -if ($diskInfo.Free / 1MB -le 100) { - Say "There is not enough disk space on drive ${installDrive}:" - exit 0 -} - -$ZipPath = [System.IO.Path]::combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) -Say-Verbose "Zip path: $ZipPath" - -$DownloadFailed = $false -Say "Downloading link: $DownloadLink" -try { - DownloadFile -Source $DownloadLink -OutPath $ZipPath -} -catch { - Say "Cannot download: $DownloadLink" - if ($LegacyDownloadLink) { - $DownloadLink = $LegacyDownloadLink - $ZipPath = [System.IO.Path]::combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) - Say-Verbose "Legacy zip path: $ZipPath" - Say "Downloading legacy link: $DownloadLink" - try { - DownloadFile -Source $DownloadLink -OutPath $ZipPath - } - catch { - Say "Cannot download: $DownloadLink" - $DownloadFailed = $true - } - } - else { - $DownloadFailed = $true - } -} - -if ($DownloadFailed) { - throw "Could not find/download: `"$assetName`" with version = $SpecificVersion`nRefer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support" -} - -Say "Extracting zip from $DownloadLink" -Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot - -# Check if the SDK version is installed; if not, fail the installation. -$isAssetInstalled = $false - -# if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed. -if ($SpecificVersion -Match "rtm" -or $SpecificVersion -Match "servicing") { - $ReleaseVersion = $SpecificVersion.Split("-")[0] - Say-Verbose "Checking installation: version = $ReleaseVersion" - $isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $ReleaseVersion -} - -# Check if the SDK version is installed. -if (!$isAssetInstalled) { - Say-Verbose "Checking installation: version = $SpecificVersion" - $isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $SpecificVersion -} - -if (!$isAssetInstalled) { - throw "`"$assetName`" with version = $SpecificVersion failed to install with an unknown error." -} - -Remove-Item $ZipPath - -Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot -BinFolderRelativePath $BinFolderRelativePath - -Say "Installation finished" -exit 0 \ No newline at end of file diff --git a/eng/common/dotnet-install-scripts/dotnet-install.sh b/eng/common/dotnet-install-scripts/dotnet-install.sh deleted file mode 100644 index 92161141f6c3..000000000000 --- a/eng/common/dotnet-install-scripts/dotnet-install.sh +++ /dev/null @@ -1,1133 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. -# - -# Stop script on NZEC -set -e -# Stop script if unbound variable found (use ${var:-} if intentional) -set -u -# By default cmd1 | cmd2 returns exit code of cmd2 regardless of cmd1 success -# This is causing it to fail -set -o pipefail - -# Use in the the functions: eval $invocation -invocation='say_verbose "Calling: ${yellow:-}${FUNCNAME[0]} ${green:-}$*${normal:-}"' - -# standard output may be used as a return value in the functions -# we need a way to write text on the screen in the functions so that -# it won't interfere with the return value. -# Exposing stream 3 as a pipe to standard output of the script itself -exec 3>&1 - -# Setup some colors to use. These need to work in fairly limited shells, like the Ubuntu Docker container where there are only 8 colors. -# See if stdout is a terminal -if [ -t 1 ] && command -v tput > /dev/null; then - # see if it supports colors - ncolors=$(tput colors) - if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then - bold="$(tput bold || echo)" - normal="$(tput sgr0 || echo)" - black="$(tput setaf 0 || echo)" - red="$(tput setaf 1 || echo)" - green="$(tput setaf 2 || echo)" - yellow="$(tput setaf 3 || echo)" - blue="$(tput setaf 4 || echo)" - magenta="$(tput setaf 5 || echo)" - cyan="$(tput setaf 6 || echo)" - white="$(tput setaf 7 || echo)" - fi -fi - -say_warning() { - printf "%b\n" "${yellow:-}dotnet_install: Warning: $1${normal:-}" -} - -say_err() { - printf "%b\n" "${red:-}dotnet_install: Error: $1${normal:-}" >&2 -} - -say() { - # using stream 3 (defined in the beginning) to not interfere with stdout of functions - # which may be used as return value - printf "%b\n" "${cyan:-}dotnet-install:${normal:-} $1" >&3 -} - -say_verbose() { - if [ "$verbose" = true ]; then - say "$1" - fi -} - -# This platform list is finite - if the SDK/Runtime has supported Linux distribution-specific assets, -# then and only then should the Linux distribution appear in this list. -# Adding a Linux distribution to this list does not imply distribution-specific support. -get_legacy_os_name_from_platform() { - eval $invocation - - platform="$1" - case "$platform" in - "centos.7") - echo "centos" - return 0 - ;; - "debian.8") - echo "debian" - return 0 - ;; - "debian.9") - echo "debian.9" - return 0 - ;; - "fedora.23") - echo "fedora.23" - return 0 - ;; - "fedora.24") - echo "fedora.24" - return 0 - ;; - "fedora.27") - echo "fedora.27" - return 0 - ;; - "fedora.28") - echo "fedora.28" - return 0 - ;; - "opensuse.13.2") - echo "opensuse.13.2" - return 0 - ;; - "opensuse.42.1") - echo "opensuse.42.1" - return 0 - ;; - "opensuse.42.3") - echo "opensuse.42.3" - return 0 - ;; - "rhel.7"*) - echo "rhel" - return 0 - ;; - "ubuntu.14.04") - echo "ubuntu" - return 0 - ;; - "ubuntu.16.04") - echo "ubuntu.16.04" - return 0 - ;; - "ubuntu.16.10") - echo "ubuntu.16.10" - return 0 - ;; - "ubuntu.18.04") - echo "ubuntu.18.04" - return 0 - ;; - "alpine.3.4.3") - echo "alpine" - return 0 - ;; - esac - return 1 -} - -get_linux_platform_name() { - eval $invocation - - if [ -n "$runtime_id" ]; then - echo "${runtime_id%-*}" - return 0 - else - if [ -e /etc/os-release ]; then - . /etc/os-release - echo "$ID${VERSION_ID:+.${VERSION_ID}}" - return 0 - elif [ -e /etc/redhat-release ]; then - local redhatRelease=$(&1 || true) | grep -q musl -} - -get_current_os_name() { - eval $invocation - - local uname=$(uname) - if [ "$uname" = "Darwin" ]; then - echo "osx" - return 0 - elif [ "$uname" = "FreeBSD" ]; then - echo "freebsd" - return 0 - elif [ "$uname" = "Linux" ]; then - local linux_platform_name - linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; } - - if [ "$linux_platform_name" = "rhel.6" ]; then - echo $linux_platform_name - return 0 - elif is_musl_based_distro; then - echo "linux-musl" - return 0 - else - echo "linux" - return 0 - fi - fi - - say_err "OS name could not be detected: UName = $uname" - return 1 -} - -get_legacy_os_name() { - eval $invocation - - local uname=$(uname) - if [ "$uname" = "Darwin" ]; then - echo "osx" - return 0 - elif [ -n "$runtime_id" ]; then - echo $(get_legacy_os_name_from_platform "${runtime_id%-*}" || echo "${runtime_id%-*}") - return 0 - else - if [ -e /etc/os-release ]; then - . /etc/os-release - os=$(get_legacy_os_name_from_platform "$ID${VERSION_ID:+.${VERSION_ID}}" || echo "") - if [ -n "$os" ]; then - echo "$os" - return 0 - fi - fi - fi - - say_verbose "Distribution specific OS name and version could not be detected: UName = $uname" - return 1 -} - -machine_has() { - eval $invocation - - hash "$1" > /dev/null 2>&1 - return $? -} - - -check_min_reqs() { - local hasMinimum=false - if machine_has "curl"; then - hasMinimum=true - elif machine_has "wget"; then - hasMinimum=true - fi - - if [ "$hasMinimum" = "false" ]; then - say_err "curl (recommended) or wget are required to download dotnet. Install missing prerequisite to proceed." - return 1 - fi - return 0 -} - -check_pre_reqs() { - eval $invocation - - if [ "${DOTNET_INSTALL_SKIP_PREREQS:-}" = "1" ]; then - return 0 - fi - - if [ "$(uname)" = "Linux" ]; then - if is_musl_based_distro; then - if ! command -v scanelf > /dev/null; then - say_warning "scanelf not found, please install pax-utils package." - return 0 - fi - LDCONFIG_COMMAND="scanelf --ldpath -BF '%f'" - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libintl)" ] && say_warning "Unable to locate libintl. Probable prerequisite missing; install libintl (or gettext)." - else - if [ ! -x "$(command -v ldconfig)" ]; then - say_verbose "ldconfig is not in PATH, trying /sbin/ldconfig." - LDCONFIG_COMMAND="/sbin/ldconfig" - else - LDCONFIG_COMMAND="ldconfig" - fi - local librarypath=${LD_LIBRARY_PATH:-} - LDCONFIG_COMMAND="$LDCONFIG_COMMAND -NXv ${librarypath//:/ }" - fi - - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep zlib)" ] && say_warning "Unable to locate zlib. Probable prerequisite missing; install zlib." - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep ssl)" ] && say_warning "Unable to locate libssl. Probable prerequisite missing; install libssl." - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libicu)" ] && say_warning "Unable to locate libicu. Probable prerequisite missing; install libicu." - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep lttng)" ] && say_warning "Unable to locate liblttng. Probable prerequisite missing; install libcurl." - [ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libcurl)" ] && say_warning "Unable to locate libcurl. Probable prerequisite missing; install libcurl." - fi - - return 0 -} - -# args: -# input - $1 -to_lowercase() { - #eval $invocation - - echo "$1" | tr '[:upper:]' '[:lower:]' - return 0 -} - -# args: -# input - $1 -remove_trailing_slash() { - #eval $invocation - - local input="${1:-}" - echo "${input%/}" - return 0 -} - -# args: -# input - $1 -remove_beginning_slash() { - #eval $invocation - - local input="${1:-}" - echo "${input#/}" - return 0 -} - -# args: -# root_path - $1 -# child_path - $2 - this parameter can be empty -combine_paths() { - eval $invocation - - # TODO: Consider making it work with any number of paths. For now: - if [ ! -z "${3:-}" ]; then - say_err "combine_paths: Function takes two parameters." - return 1 - fi - - local root_path="$(remove_trailing_slash "$1")" - local child_path="$(remove_beginning_slash "${2:-}")" - say_verbose "combine_paths: root_path=$root_path" - say_verbose "combine_paths: child_path=$child_path" - echo "$root_path/$child_path" - return 0 -} - -get_machine_architecture() { - eval $invocation - - if command -v uname > /dev/null; then - CPUName=$(uname -m) - case $CPUName in - armv7l) - echo "arm" - return 0 - ;; - aarch64) - echo "arm64" - return 0 - ;; - esac - fi - - # Always default to 'x64' - echo "x64" - return 0 -} - -# args: -# architecture - $1 -get_normalized_architecture_from_architecture() { - eval $invocation - - local architecture="$(to_lowercase "$1")" - case "$architecture" in - \) - echo "$(get_normalized_architecture_from_architecture "$(get_machine_architecture)")" - return 0 - ;; - amd64|x64) - echo "x64" - return 0 - ;; - arm) - echo "arm" - return 0 - ;; - arm64) - echo "arm64" - return 0 - ;; - esac - - say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/sdk/issues" - return 1 -} - -# The version text returned from the feeds is a 1-line or 2-line string: -# For the SDK and the dotnet runtime (2 lines): -# Line 1: # commit_hash -# Line 2: # 4-part version -# For the aspnetcore runtime (1 line): -# Line 1: # 4-part version - -# args: -# version_text - stdin -get_version_from_version_info() { - eval $invocation - - cat | tail -n 1 | sed 's/\r$//' - return 0 -} - -# args: -# install_root - $1 -# relative_path_to_package - $2 -# specific_version - $3 -is_dotnet_package_installed() { - eval $invocation - - local install_root="$1" - local relative_path_to_package="$2" - local specific_version="${3//[$'\t\r\n']}" - - local dotnet_package_path="$(combine_paths "$(combine_paths "$install_root" "$relative_path_to_package")" "$specific_version")" - say_verbose "is_dotnet_package_installed: dotnet_package_path=$dotnet_package_path" - - if [ -d "$dotnet_package_path" ]; then - return 0 - else - return 1 - fi -} - -# args: -# azure_feed - $1 -# channel - $2 -# normalized_architecture - $3 -# coherent - $4 -get_latest_version_info() { - eval $invocation - - local azure_feed="$1" - local channel="$2" - local normalized_architecture="$3" - local coherent="$4" - - local version_file_url=null - if [[ "$runtime" == "dotnet" ]]; then - version_file_url="$uncached_feed/Runtime/$channel/latest.version" - elif [[ "$runtime" == "aspnetcore" ]]; then - version_file_url="$uncached_feed/aspnetcore/Runtime/$channel/latest.version" - elif [ -z "$runtime" ]; then - if [ "$coherent" = true ]; then - version_file_url="$uncached_feed/Sdk/$channel/latest.coherent.version" - else - version_file_url="$uncached_feed/Sdk/$channel/latest.version" - fi - else - say_err "Invalid value for \$runtime" - return 1 - fi - say_verbose "get_latest_version_info: latest url: $version_file_url" - - download "$version_file_url" - return $? -} - -# args: -# json_file - $1 -parse_jsonfile_for_version() { - eval $invocation - - local json_file="$1" - if [ ! -f "$json_file" ]; then - say_err "Unable to find \`$json_file\`" - return 1 - fi - - sdk_section=$(cat $json_file | awk '/"sdk"/,/}/') - if [ -z "$sdk_section" ]; then - say_err "Unable to parse the SDK node in \`$json_file\`" - return 1 - fi - - sdk_list=$(echo $sdk_section | awk -F"[{}]" '{print $2}') - sdk_list=${sdk_list//[\" ]/} - sdk_list=${sdk_list//,/$'\n'} - sdk_list="$(echo -e "${sdk_list}" | tr -d '[[:space:]]')" - - local version_info="" - while read -r line; do - IFS=: - while read -r key value; do - if [[ "$key" == "version" ]]; then - version_info=$value - fi - done <<< "$line" - done <<< "$sdk_list" - if [ -z "$version_info" ]; then - say_err "Unable to find the SDK:version node in \`$json_file\`" - return 1 - fi - - unset IFS; - echo "$version_info" - return 0 -} - -# args: -# azure_feed - $1 -# channel - $2 -# normalized_architecture - $3 -# version - $4 -# json_file - $5 -get_specific_version_from_version() { - eval $invocation - - local azure_feed="$1" - local channel="$2" - local normalized_architecture="$3" - local version="$(to_lowercase "$4")" - local json_file="$5" - - if [ -z "$json_file" ]; then - case "$version" in - latest) - local version_info - version_info="$(get_latest_version_info "$azure_feed" "$channel" "$normalized_architecture" false)" || return 1 - say_verbose "get_specific_version_from_version: version_info=$version_info" - echo "$version_info" | get_version_from_version_info - return 0 - ;; - coherent) - local version_info - version_info="$(get_latest_version_info "$azure_feed" "$channel" "$normalized_architecture" true)" || return 1 - say_verbose "get_specific_version_from_version: version_info=$version_info" - echo "$version_info" | get_version_from_version_info - return 0 - ;; - *) - echo "$version" - return 0 - ;; - esac - else - local version_info - version_info="$(parse_jsonfile_for_version "$json_file")" || return 1 - echo "$version_info" - return 0 - fi -} - -# args: -# azure_feed - $1 -# channel - $2 -# normalized_architecture - $3 -# specific_version - $4 -construct_download_link() { - eval $invocation - - local azure_feed="$1" - local channel="$2" - local normalized_architecture="$3" - local specific_version="${4//[$'\t\r\n']}" - local specific_product_version="$(get_specific_product_version "$1" "$4")" - - local osname - osname="$(get_current_os_name)" || return 1 - - local download_link=null - if [[ "$runtime" == "dotnet" ]]; then - download_link="$azure_feed/Runtime/$specific_version/dotnet-runtime-$specific_product_version-$osname-$normalized_architecture.tar.gz" - elif [[ "$runtime" == "aspnetcore" ]]; then - download_link="$azure_feed/aspnetcore/Runtime/$specific_version/aspnetcore-runtime-$specific_product_version-$osname-$normalized_architecture.tar.gz" - elif [ -z "$runtime" ]; then - download_link="$azure_feed/Sdk/$specific_version/dotnet-sdk-$specific_product_version-$osname-$normalized_architecture.tar.gz" - else - return 1 - fi - - echo "$download_link" - return 0 -} - -# args: -# azure_feed - $1 -# specific_version - $2 -get_specific_product_version() { - # If we find a 'productVersion.txt' at the root of any folder, we'll use its contents - # to resolve the version of what's in the folder, superseding the specified version. - eval $invocation - - local azure_feed="$1" - local specific_version="${2//[$'\t\r\n']}" - local specific_product_version=$specific_version - - local download_link=null - if [[ "$runtime" == "dotnet" ]]; then - download_link="$azure_feed/Runtime/$specific_version/productVersion.txt${feed_credential}" - elif [[ "$runtime" == "aspnetcore" ]]; then - download_link="$azure_feed/aspnetcore/Runtime/$specific_version/productVersion.txt${feed_credential}" - elif [ -z "$runtime" ]; then - download_link="$azure_feed/Sdk/$specific_version/productVersion.txt${feed_credential}" - else - return 1 - fi - - specific_product_version=$(curl -s --fail "$download_link") - if [ $? -ne 0 ] - then - specific_product_version=$(wget -qO- "$download_link") - if [ $? -ne 0 ] - then - specific_product_version=$specific_version - fi - fi - specific_product_version="${specific_product_version//[$'\t\r\n']}" - - echo "$specific_product_version" - return 0 -} - -# args: -# azure_feed - $1 -# channel - $2 -# normalized_architecture - $3 -# specific_version - $4 -construct_legacy_download_link() { - eval $invocation - - local azure_feed="$1" - local channel="$2" - local normalized_architecture="$3" - local specific_version="${4//[$'\t\r\n']}" - - local distro_specific_osname - distro_specific_osname="$(get_legacy_os_name)" || return 1 - - local legacy_download_link=null - if [[ "$runtime" == "dotnet" ]]; then - legacy_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz" - elif [ -z "$runtime" ]; then - legacy_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz" - else - return 1 - fi - - echo "$legacy_download_link" - return 0 -} - -get_user_install_path() { - eval $invocation - - if [ ! -z "${DOTNET_INSTALL_DIR:-}" ]; then - echo "$DOTNET_INSTALL_DIR" - else - echo "$HOME/.dotnet" - fi - return 0 -} - -# args: -# install_dir - $1 -resolve_installation_path() { - eval $invocation - - local install_dir=$1 - if [ "$install_dir" = "" ]; then - local user_install_path="$(get_user_install_path)" - say_verbose "resolve_installation_path: user_install_path=$user_install_path" - echo "$user_install_path" - return 0 - fi - - echo "$install_dir" - return 0 -} - -# args: -# relative_or_absolute_path - $1 -get_absolute_path() { - eval $invocation - - local relative_or_absolute_path=$1 - echo "$(cd "$(dirname "$1")" && pwd -P)/$(basename "$1")" - return 0 -} - -# args: -# input_files - stdin -# root_path - $1 -# out_path - $2 -# override - $3 -copy_files_or_dirs_from_list() { - eval $invocation - - local root_path="$(remove_trailing_slash "$1")" - local out_path="$(remove_trailing_slash "$2")" - local override="$3" - local osname="$(get_current_os_name)" - local override_switch=$( - if [ "$override" = false ]; then - if [ "$osname" = "linux-musl" ]; then - printf -- "-u"; - else - printf -- "-n"; - fi - fi) - - cat | uniq | while read -r file_path; do - local path="$(remove_beginning_slash "${file_path#$root_path}")" - local target="$out_path/$path" - if [ "$override" = true ] || (! ([ -d "$target" ] || [ -e "$target" ])); then - mkdir -p "$out_path/$(dirname "$path")" - if [ -d "$target" ]; then - rm -rf "$target" - fi - cp -R $override_switch "$root_path/$path" "$target" - fi - done -} - -# args: -# zip_path - $1 -# out_path - $2 -extract_dotnet_package() { - eval $invocation - - local zip_path="$1" - local out_path="$2" - - local temp_out_path="$(mktemp -d "$temporary_file_template")" - - local failed=false - tar -xzf "$zip_path" -C "$temp_out_path" > /dev/null || failed=true - - local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' - find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false - find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files" - - rm -rf "$temp_out_path" - - if [ "$failed" = true ]; then - say_err "Extraction failed" - return 1 - fi -} - -# args: -# remote_path - $1 -# [out_path] - $2 - stdout if not provided -download() { - eval $invocation - - local remote_path="$1" - local out_path="${2:-}" - - if [[ "$remote_path" != "http"* ]]; then - cp "$remote_path" "$out_path" - return $? - fi - - local failed=false - if machine_has "curl"; then - downloadcurl "$remote_path" "$out_path" || failed=true - elif machine_has "wget"; then - downloadwget "$remote_path" "$out_path" || failed=true - else - failed=true - fi - if [ "$failed" = true ]; then - say_verbose "Download failed: $remote_path" - return 1 - fi - return 0 -} - -downloadcurl() { - eval $invocation - local remote_path="$1" - local out_path="${2:-}" - - # Append feed_credential as late as possible before calling curl to avoid logging feed_credential - remote_path="${remote_path}${feed_credential}" - - local curl_options="--retry 20 --retry-delay 2 --connect-timeout 15 -sSL -f --create-dirs " - local failed=false - if [ -z "$out_path" ]; then - curl $curl_options "$remote_path" || failed=true - else - curl $curl_options -o "$out_path" "$remote_path" || failed=true - fi - if [ "$failed" = true ]; then - say_verbose "Curl download failed" - return 1 - fi - return 0 -} - -downloadwget() { - eval $invocation - local remote_path="$1" - local out_path="${2:-}" - - # Append feed_credential as late as possible before calling wget to avoid logging feed_credential - remote_path="${remote_path}${feed_credential}" - local wget_options="--tries 20 --waitretry 2 --connect-timeout 15 " - local failed=false - if [ -z "$out_path" ]; then - wget -q $wget_options -O - "$remote_path" || failed=true - else - wget $wget_options -O "$out_path" "$remote_path" || failed=true - fi - if [ "$failed" = true ]; then - say_verbose "Wget download failed" - return 1 - fi - return 0 -} - -calculate_vars() { - eval $invocation - valid_legacy_download_link=true - - normalized_architecture="$(get_normalized_architecture_from_architecture "$architecture")" - say_verbose "normalized_architecture=$normalized_architecture" - - specific_version="$(get_specific_version_from_version "$azure_feed" "$channel" "$normalized_architecture" "$version" "$json_file")" - specific_product_version="$(get_specific_product_version "$azure_feed" "$specific_version")" - say_verbose "specific_version=$specific_version" - if [ -z "$specific_version" ]; then - say_err "Could not resolve version information." - return 1 - fi - - download_link="$(construct_download_link "$azure_feed" "$channel" "$normalized_architecture" "$specific_version")" - say_verbose "Constructed primary named payload URL: $download_link" - - legacy_download_link="$(construct_legacy_download_link "$azure_feed" "$channel" "$normalized_architecture" "$specific_version")" || valid_legacy_download_link=false - - if [ "$valid_legacy_download_link" = true ]; then - say_verbose "Constructed legacy named payload URL: $legacy_download_link" - else - say_verbose "Cound not construct a legacy_download_link; omitting..." - fi - - install_root="$(resolve_installation_path "$install_dir")" - say_verbose "InstallRoot: $install_root" -} - -install_dotnet() { - eval $invocation - local download_failed=false - local asset_name='' - local asset_relative_path='' - - if [[ "$runtime" == "dotnet" ]]; then - asset_relative_path="shared/Microsoft.NETCore.App" - asset_name=".NET Core Runtime" - elif [[ "$runtime" == "aspnetcore" ]]; then - asset_relative_path="shared/Microsoft.AspNetCore.App" - asset_name="ASP.NET Core Runtime" - elif [ -z "$runtime" ]; then - asset_relative_path="sdk" - asset_name=".NET Core SDK" - else - say_err "Invalid value for \$runtime" - return 1 - fi - - # Check if the SDK version is already installed. - if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_version"; then - say "$asset_name version $specific_version is already installed." - return 0 - fi - - mkdir -p "$install_root" - zip_path="$(mktemp "$temporary_file_template")" - say_verbose "Zip path: $zip_path" - - say "Downloading link: $download_link" - - # Failures are normal in the non-legacy case for ultimately legacy downloads. - # Do not output to stderr, since output to stderr is considered an error. - download "$download_link" "$zip_path" 2>&1 || download_failed=true - - # if the download fails, download the legacy_download_link - if [ "$download_failed" = true ]; then - say "Cannot download: $download_link" - - if [ "$valid_legacy_download_link" = true ]; then - download_failed=false - download_link="$legacy_download_link" - zip_path="$(mktemp "$temporary_file_template")" - say_verbose "Legacy zip path: $zip_path" - say "Downloading legacy link: $download_link" - download "$download_link" "$zip_path" 2>&1 || download_failed=true - - if [ "$download_failed" = true ]; then - say "Cannot download: $download_link" - fi - fi - fi - - if [ "$download_failed" = true ]; then - say_err "Could not find/download: \`$asset_name\` with version = $specific_version" - say_err "Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support" - return 1 - fi - - say "Extracting zip from $download_link" - extract_dotnet_package "$zip_path" "$install_root" - - # Check if the SDK version is installed; if not, fail the installation. - # if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed. - if [[ $specific_version == *"rtm"* || $specific_version == *"servicing"* ]]; then - IFS='-' - read -ra verArr <<< "$specific_version" - release_version="${verArr[0]}" - unset IFS; - say_verbose "Checking installation: version = $release_version" - if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$release_version"; then - return 0 - fi - fi - - # Check if the standard SDK version is installed. - say_verbose "Checking installation: version = $specific_product_version" - if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$specific_product_version"; then - return 0 - fi - - say_err "\`$asset_name\` with version = $specific_product_version failed to install with an unknown error." - return 1 -} - -args=("$@") - -local_version_file_relative_path="/.version" -bin_folder_relative_path="" -temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX" - -channel="LTS" -version="Latest" -json_file="" -install_dir="" -architecture="" -dry_run=false -no_path=false -no_cdn=false -azure_feed="https://dotnetcli.azureedge.net/dotnet" -uncached_feed="https://dotnetcli.blob.core.windows.net/dotnet" -feed_credential="" -verbose=false -runtime="" -runtime_id="" -override_non_versioned_files=true -non_dynamic_parameters="" - -while [ $# -ne 0 ] -do - name="$1" - case "$name" in - -c|--channel|-[Cc]hannel) - shift - channel="$1" - ;; - -v|--version|-[Vv]ersion) - shift - version="$1" - ;; - -i|--install-dir|-[Ii]nstall[Dd]ir) - shift - install_dir="$1" - ;; - --arch|--architecture|-[Aa]rch|-[Aa]rchitecture) - shift - architecture="$1" - ;; - --shared-runtime|-[Ss]hared[Rr]untime) - say_warning "The --shared-runtime flag is obsolete and may be removed in a future version of this script. The recommended usage is to specify '--runtime dotnet'." - if [ -z "$runtime" ]; then - runtime="dotnet" - fi - ;; - --runtime|-[Rr]untime) - shift - runtime="$1" - if [[ "$runtime" != "dotnet" ]] && [[ "$runtime" != "aspnetcore" ]]; then - say_err "Unsupported value for --runtime: '$1'. Valid values are 'dotnet' and 'aspnetcore'." - if [[ "$runtime" == "windowsdesktop" ]]; then - say_err "WindowsDesktop archives are manufactured for Windows platforms only." - fi - exit 1 - fi - ;; - --dry-run|-[Dd]ry[Rr]un) - dry_run=true - ;; - --no-path|-[Nn]o[Pp]ath) - no_path=true - non_dynamic_parameters+=" $name" - ;; - --verbose|-[Vv]erbose) - verbose=true - non_dynamic_parameters+=" $name" - ;; - --no-cdn|-[Nn]o[Cc]dn) - no_cdn=true - non_dynamic_parameters+=" $name" - ;; - --azure-feed|-[Aa]zure[Ff]eed) - shift - azure_feed="$1" - non_dynamic_parameters+=" $name "\""$1"\""" - ;; - --uncached-feed|-[Uu]ncached[Ff]eed) - shift - uncached_feed="$1" - non_dynamic_parameters+=" $name "\""$1"\""" - ;; - --feed-credential|-[Ff]eed[Cc]redential) - shift - feed_credential="$1" - non_dynamic_parameters+=" $name "\""$1"\""" - ;; - --runtime-id|-[Rr]untime[Ii]d) - shift - runtime_id="$1" - non_dynamic_parameters+=" $name "\""$1"\""" - ;; - --jsonfile|-[Jj][Ss]on[Ff]ile) - shift - json_file="$1" - ;; - --skip-non-versioned-files|-[Ss]kip[Nn]on[Vv]ersioned[Ff]iles) - override_non_versioned_files=false - non_dynamic_parameters+=" $name" - ;; - -?|--?|-h|--help|-[Hh]elp) - script_name="$(basename "$0")" - echo ".NET Tools Installer" - echo "Usage: $script_name [-c|--channel ] [-v|--version ] [-p|--prefix ]" - echo " $script_name -h|-?|--help" - echo "" - echo "$script_name is a simple command line interface for obtaining dotnet cli." - echo "" - echo "Options:" - echo " -c,--channel Download from the channel specified, Defaults to \`$channel\`." - echo " -Channel" - echo " Possible values:" - echo " - Current - most current release" - echo " - LTS - most current supported release" - echo " - 2-part version in a format A.B - represents a specific release" - echo " examples: 2.0; 1.0" - echo " - Branch name" - echo " examples: release/2.0.0; Master" - echo " Note: The version parameter overrides the channel parameter." - echo " -v,--version Use specific VERSION, Defaults to \`$version\`." - echo " -Version" - echo " Possible values:" - echo " - latest - most latest build on specific channel" - echo " - coherent - most latest coherent build on specific channel" - echo " coherent applies only to SDK downloads" - echo " - 3-part version in a format A.B.C - represents specific version of build" - echo " examples: 2.0.0-preview2-006120; 1.1.0" - echo " -i,--install-dir Install under specified location (see Install Location below)" - echo " -InstallDir" - echo " --architecture Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`." - echo " --arch,-Architecture,-Arch" - echo " Possible values: x64, arm, and arm64" - echo " --runtime Installs a shared runtime only, without the SDK." - echo " -Runtime" - echo " Possible values:" - echo " - dotnet - the Microsoft.NETCore.App shared runtime" - echo " - aspnetcore - the Microsoft.AspNetCore.App shared runtime" - echo " --dry-run,-DryRun Do not perform installation. Display download link." - echo " --no-path, -NoPath Do not set PATH for the current process." - echo " --verbose,-Verbose Display diagnostics information." - echo " --azure-feed,-AzureFeed Azure feed location. Defaults to $azure_feed, This parameter typically is not changed by the user." - echo " --uncached-feed,-UncachedFeed Uncached feed location. This parameter typically is not changed by the user." - echo " --feed-credential,-FeedCredential Azure feed shared access token. This parameter typically is not specified." - echo " --skip-non-versioned-files Skips non-versioned files if they already exist, such as the dotnet executable." - echo " -SkipNonVersionedFiles" - echo " --no-cdn,-NoCdn Disable downloading from the Azure CDN, and use the uncached feed directly." - echo " --jsonfile Determines the SDK version from a user specified global.json file." - echo " Note: global.json must have a value for 'SDK:Version'" - echo " --runtime-id Installs the .NET Tools for the given platform (use linux-x64 for portable linux)." - echo " -RuntimeId" - echo " -?,--?,-h,--help,-Help Shows this help message" - echo "" - echo "Obsolete parameters:" - echo " --shared-runtime The recommended alternative is '--runtime dotnet'." - echo " This parameter is obsolete and may be removed in a future version of this script." - echo " Installs just the shared runtime bits, not the entire SDK." - echo "" - echo "Install Location:" - echo " Location is chosen in following order:" - echo " - --install-dir option" - echo " - Environmental variable DOTNET_INSTALL_DIR" - echo " - $HOME/.dotnet" - exit 0 - ;; - *) - say_err "Unknown argument \`$name\`" - exit 1 - ;; - esac - - shift -done - -if [ "$no_cdn" = true ]; then - azure_feed="$uncached_feed" -fi - -check_min_reqs -calculate_vars -script_name=$(basename "$0") - -if [ "$dry_run" = true ]; then - say "Payload URLs:" - say "Primary named payload URL: $download_link" - if [ "$valid_legacy_download_link" = true ]; then - say "Legacy named payload URL: $legacy_download_link" - fi - repeatable_command="./$script_name --version "\""$specific_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\""" - if [[ "$runtime" == "dotnet" ]]; then - repeatable_command+=" --runtime "\""dotnet"\""" - elif [[ "$runtime" == "aspnetcore" ]]; then - repeatable_command+=" --runtime "\""aspnetcore"\""" - fi - repeatable_command+="$non_dynamic_parameters" - say "Repeatable invocation: $repeatable_command" - exit 0 -fi - -check_pre_reqs -install_dotnet - -bin_path="$(get_absolute_path "$(combine_paths "$install_root" "$bin_folder_relative_path")")" -if [ "$no_path" = false ]; then - say "Adding to current process PATH: \`$bin_path\`. Note: This change will be visible only when sourcing script." - export PATH="$bin_path":"$PATH" -else - say "Binaries of dotnet can be found in $bin_path" -fi - -say "Installation finished successfully." diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 9014e062514b..fc09059ffe43 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -57,15 +57,11 @@ set-strictmode -version 2.0 $ErrorActionPreference = 'Stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -# If specified, provides an alternate path for getting .NET Core SDKs and Runtimes. This script will still try public sources first. +# If specifies, provides an alternate path for getting .NET Core SDKs and Runtimes. This script will still try public sources first. [string]$runtimeSourceFeed = if (Test-Path variable:runtimeSourceFeed) { $runtimeSourceFeed } else { $null } # Base-64 encoded SAS token that has permission to storage container described by $runtimeSourceFeed [string]$runtimeSourceFeedKey = if (Test-Path variable:runtimeSourceFeedKey) { $runtimeSourceFeedKey } else { $null } -# If false, use copy of dotnet-install from /eng/common/dotnet-install-scripts (for custom behaviors). -# otherwise will fetch from public location. -[bool]$useDefaultDotnetInstall = if (Test-Path variable:useDefaultDotnetInstall) { $useDefaultDotnetInstall } else { $false } - function Create-Directory ([string[]] $path) { New-Item -Path $path -Force -ItemType 'Directory' | Out-Null } @@ -197,46 +193,37 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { function GetDotNetInstallScript([string] $dotnetRoot) { $installScript = Join-Path $dotnetRoot 'dotnet-install.ps1' if (!(Test-Path $installScript)) { - create-directory $dotnetroot - - if ($useDefaultDotnetInstall) - { - $progresspreference = 'silentlycontinue' # don't display the console progress ui - it's a huge perf hit + Create-Directory $dotnetRoot + $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - $maxretries = 5 - $retries = 1 + $maxRetries = 5 + $retries = 1 - $uri = "https://dot.net/$dotnetinstallscriptversion/dotnet-install.ps1" + $uri = "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1" - while($true) { - try { - write-host "get $uri" - invoke-webrequest $uri -outfile $installscript - break - } - catch { - write-host "failed to download '$uri'" - write-error $_.exception.message -erroraction continue - } + while($true) { + try { + Write-Host "GET $uri" + Invoke-WebRequest $uri -OutFile $installScript + break + } + catch { + Write-Host "Failed to download '$uri'" + Write-Error $_.Exception.Message -ErrorAction Continue + } - if (++$retries -le $maxretries) { - $delayinseconds = [math]::pow(2, $retries) - 1 # exponential backoff - write-host "retrying. waiting for $delayinseconds seconds before next attempt ($retries of $maxretries)." - start-sleep -seconds $delayinseconds - } - else { - throw "unable to download file in $maxretries attempts." - } + if (++$retries -le $maxRetries) { + $delayInSeconds = [math]::Pow(2, $retries) - 1 # Exponential backoff + Write-Host "Retrying. Waiting for $delayInSeconds seconds before next attempt ($retries of $maxRetries)." + Start-Sleep -Seconds $delayInSeconds } - } - else - { - # Use a special version of the script from eng/common that understands the existence of a "productVersion.txt" in a dotnet path. - # See https://github.com/dotnet/arcade/issues/6047 for details - $engCommonCopy = Resolve-Path (Join-Path $PSScriptRoot 'dotnet-install-scripts\dotnet-install.ps1') - Copy-Item $engCommonCopy -Destination $installScript -Force + else { + throw "Unable to download file in $maxRetries attempts." + } + } } + return $installScript } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index b5d63cb1b7cb..98186e784965 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -68,10 +68,6 @@ fi runtime_source_feed=${runtime_source_feed:-''} runtime_source_feed_key=${runtime_source_feed_key:-''} -# Determines if dotnet-install.sh comes from the eng/common folder or the internet -# (default = public version) -use_default_dotnet_install=${use_default_dotnet_install:-false} - # Resolve any symlinks in the given path. function ResolvePath { local path=$1 @@ -271,30 +267,23 @@ function GetDotNetInstallScript { if [[ ! -a "$install_script" ]]; then mkdir -p "$root" - if [[ "$use_default_dotnet_install" == true ]]; then - echo "Downloading '$install_script_url'" + echo "Downloading '$install_script_url'" - # Use curl if available, otherwise use wget - if command -v curl > /dev/null; then - with_retries curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." - ExitWithExitCode $exit_code - } - else - with_retries wget -v -O "$install_script" "$install_script_url" || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." - ExitWithExitCode $exit_code - } - fi + # Use curl if available, otherwise use wget + if command -v curl > /dev/null; then + with_retries curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { + local exit_code=$? + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." + ExitWithExitCode $exit_code + } else - # Use a special version of the script from eng/common that understands the existence of a "productVersion.txt" in a dotnet path. - # See https://github.com/dotnet/arcade/issues/6047 for details - cp $repo_root/eng/common/dotnet-install-scripts/dotnet-install.sh $install_script + with_retries wget -v -O "$install_script" "$install_script_url" || { + local exit_code=$? + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." + ExitWithExitCode $exit_code + } fi fi - # return value _GetDotNetInstallScript="$install_script" } diff --git a/global.json b/global.json index cb3ee96754f2..c04966121fa9 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20525.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20526.10" } } From d3fd5ad5b6c8c26b2244108940617e6241cbf96e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2020 12:41:00 +0000 Subject: [PATCH 1228/2702] Update dependencies from https://github.com/dotnet/arcade build 20201027.10 (#852) [master] Update dependencies from dotnet/arcade --- .config/dotnet-tools.json | 2 +- eng/Version.Details.xml | 4 ++-- eng/common/cross/build-rootfs.sh | 7 +++++++ eng/common/cross/s390x/sources.list.bionic | 11 ++++++++++ eng/common/cross/toolchain.cmake | 7 +++++-- eng/common/performance/crossgen_perf.proj | 24 ++++++++++++++++++++++ global.json | 2 +- 7 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 eng/common/cross/s390x/sources.list.bionic diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 915df3e8f229..adb43a203ba6 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -9,4 +9,4 @@ ] } } -} \ No newline at end of file +} diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 48c5fcb2aab7..fc4e26ba4435 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - c0f916d7f45834c080bf6cce60cf2bcfa00bc0a7 + 51f14c7da74e5c3d2ce0bab077461da399333896 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index a841c64f3f3b..575eee9fa190 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -106,6 +106,13 @@ while :; do __UbuntuRepo="http://ftp.debian.org/debian/" __CodeName=jessie ;; + s390x) + __BuildArch=s390x + __UbuntuArch=s390x + __UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/" + __UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libunwind8-dev//') + unset __LLDB_Package + ;; x86) __BuildArch=x86 __UbuntuArch=i386 diff --git a/eng/common/cross/s390x/sources.list.bionic b/eng/common/cross/s390x/sources.list.bionic new file mode 100644 index 000000000000..210955740957 --- /dev/null +++ b/eng/common/cross/s390x/sources.list.bionic @@ -0,0 +1,11 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted + +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index 8b437d8ade0a..fc11001aa76c 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -36,6 +36,9 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm64") if("$ENV{__DistroRid}" MATCHES "tizen.*") set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu/9.2.0") endif() +elseif(TARGET_ARCH_NAME STREQUAL "s390x") + set(CMAKE_SYSTEM_PROCESSOR s390x) + set(TOOLCHAIN "s390x-linux-gnu") elseif(TARGET_ARCH_NAME STREQUAL "x86") set(CMAKE_SYSTEM_PROCESSOR i686) set(TOOLCHAIN "i686-linux-gnu") @@ -46,7 +49,7 @@ elseif (ILLUMOS) set(CMAKE_SYSTEM_PROCESSOR "x86_64") set(TOOLCHAIN "x86_64-illumos") else() - message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64 and x86 are supported!") + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, s390x and x86 are supported!") endif() if(DEFINED ENV{TOOLCHAIN}) @@ -171,7 +174,7 @@ endif() # Specify compile options -if((TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$" AND NOT "$ENV{__DistroRid}" MATCHES "android.*") OR ILLUMOS) +if((TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64|s390x)$" AND NOT "$ENV{__DistroRid}" MATCHES "android.*") OR ILLUMOS) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN}) set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN}) diff --git a/eng/common/performance/crossgen_perf.proj b/eng/common/performance/crossgen_perf.proj index 3b8dfc2b1fb3..79a5486546ea 100644 --- a/eng/common/performance/crossgen_perf.proj +++ b/eng/common/performance/crossgen_perf.proj @@ -65,6 +65,24 @@ + + + $(WorkItemDirectory) + $(Python) pre.py crossgen --core-root $(CoreRoot) --single %(Identity) + $(Python) test.py sod --scenario-name "Crossgen %(Identity) Size" --dirs ./crossgen/ + $(Python) post.py + + + + + + $(WorkItemDirectory) + $(Python) $(Crossgen2Directory)pre.py crossgen2 --core-root $(CoreRoot) --single %(Identity) + $(Python) test.py sod --scenario-name "Crossgen2 %(Identity) Size" --dirs ./crossgen/ + $(Python) post.py + + + @@ -82,5 +100,11 @@ $(Python) $(Crossgen2Directory)test.py crossgen2 --core-root $(CoreRoot) --composite $(Crossgen2Directory)framework-r2r.dll.rsp 1:00 + + 4:00 + + + 4:00 + \ No newline at end of file diff --git a/global.json b/global.json index c04966121fa9..778870c9377f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20526.10" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20527.10" } } From 9c3688c50165d00893f8aeed60c47bc658af7da4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2020 12:35:40 +0000 Subject: [PATCH 1229/2702] Update dependencies from https://github.com/dotnet/arcade build 20201029.1 (#853) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 +- eng/common/post-build/symbols-validation.ps1 | 76 +++++++++++++------- global.json | 2 +- 3 files changed, 55 insertions(+), 27 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fc4e26ba4435..de10a24f10ea 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 51f14c7da74e5c3d2ce0bab077461da399333896 + 19e7e769f7ca2ece42221f7ff951e7ec705498ec diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 index fcc6019b4952..99bf28cd5c1b 100644 --- a/eng/common/post-build/symbols-validation.ps1 +++ b/eng/common/post-build/symbols-validation.ps1 @@ -9,9 +9,16 @@ param( # Maximum number of jobs to run in parallel $MaxParallelJobs = 6 +# Max number of retries +$MaxRetry = 5 + # Wait time between check for system load $SecondsBetweenLoadChecks = 10 +# Set error codes +Set-Variable -Name "ERROR_BADEXTRACT" -Option Constant -Value -1 +Set-Variable -Name "ERROR_FILEDOESNOTEXIST" -Option Constant -Value -2 + $CountMissingSymbols = { param( [string] $PackagePath # Path to a NuGet package @@ -21,10 +28,15 @@ $CountMissingSymbols = { Add-Type -AssemblyName System.IO.Compression.FileSystem + Write-Host "Validating $PackagePath " + # Ensure input file exist if (!(Test-Path $PackagePath)) { Write-PipelineTaskError "Input file does not exist: $PackagePath" - return -2 + return [pscustomobject]@{ + result = $using:ERROR_FILEDOESNOTEXIST + packagePath = $PackagePath + } } # Extensions for which we'll look for symbols @@ -45,7 +57,7 @@ $CountMissingSymbols = { Write-Host "Something went wrong extracting $PackagePath" Write-Host $_ return [pscustomobject]@{ - result = -1 + result = $using:ERROR_BADEXTRACT packagePath = $PackagePath } } @@ -91,26 +103,37 @@ $CountMissingSymbols = { $dotnetSymbolExe = "$env:USERPROFILE\.dotnet\tools" $dotnetSymbolExe = Resolve-Path "$dotnetSymbolExe\dotnet-symbol.exe" - & $dotnetSymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null + $totalRetries = 0 - if (Test-Path $PdbPath) { - return 'PDB' - } - elseif (Test-Path $NGenPdb) { - return 'NGen PDB' - } - elseif (Test-Path $SODbg) { - return 'DBG for SO' - } - elseif (Test-Path $DylibDwarf) { - return 'Dwarf for Dylib' - } - elseif (Test-Path $SymbolPath) { - return 'Module' - } - else { - return $null + while ($totalRetries -lt $using:MaxRetry) { + # Save the output and get diagnostic output + $output = & $dotnetSymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath --diagnostics | Out-String + + if (Test-Path $PdbPath) { + return 'PDB' + } + elseif (Test-Path $NGenPdb) { + return 'NGen PDB' + } + elseif (Test-Path $SODbg) { + return 'DBG for SO' + } + elseif (Test-Path $DylibDwarf) { + return 'Dwarf for Dylib' + } + elseif (Test-Path $SymbolPath) { + return 'Module' + } + elseif ($output.Contains("503 Service Unavailable")) { + # If we got a 503 error, we should retry. + $totalRetries++ + } + else { + return $null + } } + + return $null } $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault $FileName '--microsoft-symbol-server' $SymbolsPath @@ -155,14 +178,21 @@ function CheckJobResult( $packagePath, [ref]$DupedSymbols, [ref]$TotalFailures) { - if ($result -eq '-1') { + if ($result -eq $ERROR_BADEXTRACT) { Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$packagePath has duplicated symbol files" $DupedSymbols.Value++ } - elseif ($jobResult.result -ne '0') { + elseif ($result -eq $ERROR_FILEDOESNOTEXIST) { + Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$packagePath does not exist" + $TotalFailures.Value++ + } + elseif ($result -gt '0') { Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "Missing symbols for $result modules in the package $packagePath" $TotalFailures.Value++ } + else { + Write-Host "All symbols verified for package $packagePath" + } } function CheckSymbolsAvailable { @@ -192,8 +222,6 @@ function CheckSymbolsAvailable { return } - Write-Host "Validating $FileName " - Start-Job -ScriptBlock $CountMissingSymbols -ArgumentList $FullName | Out-Null $NumJobs = @(Get-Job -State 'Running').Count diff --git a/global.json b/global.json index 778870c9377f..82157391ba9b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20527.10" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20529.1" } } From 4715b0a95f9683abf0c05c74c57083c3da1f36fc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2020 13:55:07 +0000 Subject: [PATCH 1230/2702] [master] Update dependencies from dotnet/arcade (#855) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index de10a24f10ea..d9a86497456c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 19e7e769f7ca2ece42221f7ff951e7ec705498ec + 72b28b7e023d4c3fffa0a0b9748a7d4e8cc799be diff --git a/global.json b/global.json index 82157391ba9b..cf1538a042c8 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100-rc.2.20479.15" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20529.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20552.5" } } From 72e5742637a69c64b928ab0a6d24faecf25583ce Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 5 Nov 2020 13:35:01 -0800 Subject: [PATCH 1231/2702] Add test to ensure code containing comment is treated as generated. --- tests/CodeFormatterTests.cs | 30 +++++++++---------- .../unformatted_project/.editorconfig | 2 +- .../unformatted_project/GeneratedTest.cs | 17 +++++++++++ 3 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 tests/projects/for_code_formatter/unformatted_project/GeneratedTest.cs diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index aae0a9597ab2..371ff5a88bd6 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -86,7 +86,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 2, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] @@ -101,7 +101,7 @@ await TestFormatWorkspaceAsync( codeStyleSeverity: DiagnosticSeverity.Error, expectedExitCode: 0, expectedFilesFormatted: 0, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] @@ -113,8 +113,8 @@ public async Task GeneratedFilesFormattedInUnformattedProject() exclude: EmptyFilesList, includeGenerated: true, expectedExitCode: 0, - expectedFilesFormatted: 4, - expectedFileCount: 5); + expectedFilesFormatted: 5, + expectedFileCount: 6); var logLines = log.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries); Assert.Contains(logLines, line => line.Contains("unformatted_project.AssemblyInfo.cs")); @@ -131,7 +131,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 2, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] @@ -145,7 +145,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 2, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] @@ -193,7 +193,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 2, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] @@ -208,7 +208,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 1, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] @@ -223,7 +223,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 0, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] @@ -238,7 +238,7 @@ public async Task OnlyLogFormattedFiles() includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 1, - expectedFileCount: 5); + expectedFileCount: 6); var pattern = string.Format(Resources.Formatted_code_file_0, @"(.*)"); var match = new Regex(pattern, RegexOptions.Multiline).Match(log); @@ -257,7 +257,7 @@ public async Task FormatLocationsLoggedInUnformattedProject() includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 2, - expectedFileCount: 5); + expectedFileCount: 6); var formatLocations = log.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries) .Where(line => FindFormattingLogLine.Match(line).Success) @@ -328,7 +328,7 @@ public async Task LogFilesThatDontMatchExclude() includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 1, - expectedFileCount: 5); + expectedFileCount: 6); var pattern = string.Format(Resources.Formatted_code_file_0, @"(.*)"); var match = new Regex(pattern, RegexOptions.Multiline).Match(log); @@ -349,7 +349,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 0, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] @@ -365,7 +365,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 0, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] @@ -381,7 +381,7 @@ await TestFormatWorkspaceAsync( includeGenerated: false, expectedExitCode: 0, expectedFilesFormatted: 0, - expectedFileCount: 5); + expectedFileCount: 6); } [Fact] diff --git a/tests/projects/for_code_formatter/unformatted_project/.editorconfig b/tests/projects/for_code_formatter/unformatted_project/.editorconfig index 68704aa414a4..a5534703b411 100644 --- a/tests/projects/for_code_formatter/unformatted_project/.editorconfig +++ b/tests/projects/for_code_formatter/unformatted_project/.editorconfig @@ -2,7 +2,7 @@ root = true # C# files -[{Program.cs,other_items/*.cs,obj/**/*.cs}] +[{Program.cs,GeneratedTest.cs,other_items/*.cs,obj/**/*.cs}] #### Core EditorConfig Options #### diff --git a/tests/projects/for_code_formatter/unformatted_project/GeneratedTest.cs b/tests/projects/for_code_formatter/unformatted_project/GeneratedTest.cs new file mode 100644 index 000000000000..ba09d1a5e22e --- /dev/null +++ b/tests/projects/for_code_formatter/unformatted_project/GeneratedTest.cs @@ -0,0 +1,17 @@ + +// This is a file that should be ignored. +// +// + +using System; + +namespace for_code_formatter +{ + class GeneratedTest + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} From 7ac12c1a8737d92108b7a7c7efb39139e038d69c Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Mon, 9 Nov 2020 20:29:49 +0200 Subject: [PATCH 1232/2702] Fix markdown formatting in example table --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9c7694853646..9752d2dd9355 100644 --- a/README.md +++ b/README.md @@ -128,12 +128,9 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | `dotnet format --include Programs.cs Utility\Logging.cs` | Formats the files Program.cs and Utility\Logging.cs | | `dotnet format --check` | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | | `dotnet format --report ` | Formats and saves a json report file to the given directory. | -| `dotnet format --include test/Utilities/*.cs --folder` | Formats the files expanded from native shell globbing (e.g. bash). Space-separated list of | -| | files are fed to formatter in this case. Also applies to `--exclude` option. | -| `dotnet format --include 'test/Utilities/*.cs' --folder` | With single quotes, formats the files expanded from built-in glob expansion. A single file | -| | pattern is fed to formatter, which gets expanded internally. Also applies to `--exclude` option. | -| `ls tests/Utilities/*.cs \| dotnet format --include - --folder` | Formats the list of files redirected from pipeline via standard input. Formatter will iterate over | -| | `Console.In` to read the list of files. Also applies to `--exclude` option. | +| `dotnet format --include test/Utilities/*.cs --folder` | Formats the files expanded from native shell globbing (e.g. bash). Space-separated list of files are fed to formatter in this case. Also applies to `--exclude` option. | +| `dotnet format --include 'test/Utilities/*.cs' --folder` | With single quotes, formats the files expanded from built-in glob expansion. A single file pattern is fed to formatter, which gets expanded internally. Also applies to `--exclude` option. | +| `ls tests/Utilities/*.cs \| dotnet format --include - --folder` | Formats the list of files redirected from pipeline via standard input. Formatter will iterate over `Console.In` to read the list of files. Also applies to `--exclude` option. | ### How To Uninstall From 248b292b6ea5e6557433bc88a47c0f105b1fe944 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 13 Nov 2020 13:34:32 +0000 Subject: [PATCH 1233/2702] Update dependencies from https://github.com/dotnet/arcade build 20201111.5 (#863) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 +- eng/common/performance/crossgen_perf.proj | 10 +-- eng/common/performance/performance-setup.ps1 | 4 +- eng/common/performance/performance-setup.sh | 4 +- eng/common/post-build/publish-using-darc.ps1 | 6 ++ eng/common/templates/job/job.yml | 10 --- .../templates/post-build/post-build.yml | 67 ++----------------- global.json | 4 +- 8 files changed, 25 insertions(+), 84 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d9a86497456c..aa5a4bc53ff6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 72b28b7e023d4c3fffa0a0b9748a7d4e8cc799be + e65d307045c183af6e48b087571f6b7a05e39f01 diff --git a/eng/common/performance/crossgen_perf.proj b/eng/common/performance/crossgen_perf.proj index 79a5486546ea..cf09e40578a5 100644 --- a/eng/common/performance/crossgen_perf.proj +++ b/eng/common/performance/crossgen_perf.proj @@ -68,9 +68,9 @@ $(WorkItemDirectory) - $(Python) pre.py crossgen --core-root $(CoreRoot) --single %(Identity) - $(Python) test.py sod --scenario-name "Crossgen %(Identity) Size" --dirs ./crossgen/ - $(Python) post.py + $(Python) $(CrossgenDirectory)pre.py crossgen --core-root $(CoreRoot) --single %(Identity) + $(Python) $(CrossgenDirectory)test.py sod --scenario-name "Crossgen %(Identity) Size" --dirs ./crossgen/ + $(Python) $(CrossgenDirectory)post.py @@ -78,8 +78,8 @@ $(WorkItemDirectory) $(Python) $(Crossgen2Directory)pre.py crossgen2 --core-root $(CoreRoot) --single %(Identity) - $(Python) test.py sod --scenario-name "Crossgen2 %(Identity) Size" --dirs ./crossgen/ - $(Python) post.py + $(Python) $(Crossgen2Directory)test.py sod --scenario-name "Crossgen2 %(Identity) Size" --dirs ./crossgen/ + $(Python) $(Crossgen2Directory)post.py diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index 656c0bd9022c..0edb2ae276ed 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -82,7 +82,9 @@ $SetupArguments = "--repository https://github.com/$Repository --branch $Branch #This grabs the LKG version number of dotnet and passes it to our scripts $VersionJSON = Get-Content global.json | ConvertFrom-Json $DotNetVersion = $VersionJSON.tools.dotnet -$SetupArguments = "--dotnet-versions $DotNetVersion $SetupArguments" +# TODO: Change this back to parsing when we have a good story for dealing with TFM changes or when the LKG in runtime gets updated to include net6.0 +# $SetupArguments = "--dotnet-versions $DotNetVersion $SetupArguments" +$SetupArguments = "--dotnet-versions 6.0.100-alpha.1.20553.6 $SetupArguments" if ($RunFromPerformanceRepo) { diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 9c0f6c909145..315815a96777 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -223,7 +223,9 @@ if [[ "$use_latest_dotnet" = false ]]; then # Get the tools section from the global.json. # This grabs the LKG version number of dotnet and passes it to our scripts dotnet_version=`cat global.json | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["tools"]["dotnet"])'` - setup_arguments="--dotnet-versions $dotnet_version $setup_arguments" + # TODO: Change this back to parsing when we have a good story for dealing with TFM changes or when the LKG in runtime gets updated to include net6.0 + # setup_arguments="--dotnet-versions $dotnet_version $setup_arguments" + setup_arguments="--dotnet-versions 6.0.100-alpha.1.20553.6 $setup_arguments" fi if [[ "$run_from_perf_repo" = true ]]; then diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 650b13b089b2..31cf27674171 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -10,6 +10,7 @@ param( [Parameter(Mandatory=$false)][string] $EnableNugetValidation, [Parameter(Mandatory=$false)][string] $PublishInstallersAndChecksums, [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, + [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters, [Parameter(Mandatory=$false)][string] $SigningValidationAdditionalParameters ) @@ -25,6 +26,11 @@ try { $optionalParams.Add($ArtifactsPublishingAdditionalParameters) | Out-Null } + if ("" -ne $SymbolPublishingAdditionalParameters) { + $optionalParams.Add("symbol-publishing-parameters") | Out-Null + $optionalParams.Add($SymbolPublishingAdditionalParameters) | Out-Null + } + if ("false" -eq $WaitPublishingFinish) { $optionalParams.Add("--no-wait") | Out-Null } diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 06048c27907b..866967934802 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -24,7 +24,6 @@ parameters: enablePublishBuildAssets: false enablePublishTestResults: false enablePublishUsingPipelines: false - useBuildManifest: false mergeTestResults: false testRunTitle: '' testResultsFormat: '' @@ -243,12 +242,3 @@ jobs: ArtifactName: AssetManifests continueOnError: ${{ parameters.continueOnError }} condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) - - - ${{ if eq(parameters.useBuildManifest, true) }}: - - task: PublishBuildArtifacts@1 - displayName: Publish Build Manifest - inputs: - PathToPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/manifest.props' - PublishLocation: Container - ArtifactName: BuildManifests - continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 761fb1a29c35..41f2d96a608c 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -32,7 +32,6 @@ parameters: symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' signingValidationAdditionalParameters: '' - useBuildManifest: false # Which stages should finish execution before post-build stages start validateDependsOn: @@ -54,9 +53,6 @@ parameters: NETCoreExperimentalChannelId: 562 NetEngServicesIntChannelId: 678 NetEngServicesProdChannelId: 679 - Net5Preview8ChannelId: 1155 - Net5RC1ChannelId: 1157 - Net5RC2ChannelId: 1329 NetCoreSDK313xxChannelId: 759 NetCoreSDK313xxInternalChannelId: 760 NetCoreSDK314xxChannelId: 921 @@ -94,7 +90,7 @@ stages: inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 arguments: -PromoteToChannels "$(TargetChannels)" - -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.Net5Preview8ChannelId}},${{parameters.Net5RC1ChannelId}},${{parameters.Net5RC2ChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}} + -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}} - job: displayName: NuGet Validation @@ -142,16 +138,6 @@ stages: pool: vmImage: 'windows-2019' steps: - - ${{ if eq(parameters.useBuildManifest, true) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download build manifest - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: BuildManifests - task: DownloadBuildArtifacts@0 displayName: Download Package Artifacts inputs: @@ -253,6 +239,7 @@ stages: - job: displayName: Publish Using Darc dependsOn: setupMaestroVars + timeoutInMinutes: 120 variables: - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] @@ -269,6 +256,8 @@ stages: -MaestroToken '$(MaestroApiAccessToken)' -WaitPublishingFinish ${{ parameters.waitPublishingFinish }} -PublishInstallersAndChecksums ${{ parameters.publishInstallersAndChecksums }} + -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' + -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' - ${{ if and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')) }}: - template: \eng\common\templates\post-build\channels\generic-public-channel.yml @@ -303,54 +292,6 @@ stages: shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json' symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6-symbols/nuget/v3/index.json' - - template: \eng\common\templates\post-build\channels\generic-internal-channel.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_Preview8_Publish' - channelName: '.NET 5 Preview 8' - akaMSChannelName: 'net5/preview8' - channelId: ${{ parameters.Net5Preview8ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-symbols/nuget/v3/index.json' - - - template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_RC1_Publish' - channelName: '.NET 5 RC 1' - akaMSChannelName: 'net5/rc1' - channelId: ${{ parameters.Net5RC1ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - - - template: \eng\common\templates\post-build\channels\generic-public-channel.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - dependsOn: ${{ parameters.publishDependsOn }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - stageName: 'Net5_RC2_Publish' - channelName: '.NET 5 RC 2' - akaMSChannelName: 'net5/rc2' - channelId: ${{ parameters.Net5RC2ChannelId }} - transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' - symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' - - template: \eng\common\templates\post-build\channels\generic-public-channel.yml parameters: BARBuildId: ${{ parameters.BARBuildId }} diff --git a/global.json b/global.json index cf1538a042c8..ed756d2bebc6 100644 --- a/global.json +++ b/global.json @@ -1,8 +1,8 @@ { "tools": { - "dotnet": "5.0.100-rc.2.20479.15" + "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20552.5" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20561.5" } } From 7e10bb8eb340e6e4e2430e00190680780e567943 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 16 Nov 2020 13:48:26 -0800 Subject: [PATCH 1234/2702] When matching all files don't rely on FileMatcher --- src/CodeFormatter.cs | 2 +- src/Utilities/SourceFileMatcher.cs | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index be79fd21e219..86bace4ce854 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -194,7 +194,7 @@ private static async Task RunCodeFormattersAsync( addedFilePaths.Add(document.FilePath); var isFileIncluded = formatOptions.WorkspaceType == WorkspaceType.Folder || - (formatOptions.FileMatcher.Match(document.FilePath).HasMatches && File.Exists(document.FilePath)); + (formatOptions.FileMatcher.HasMatches(document.FilePath) && File.Exists(document.FilePath)); if (!isFileIncluded || !document.SupportsSyntaxTree) { continue; diff --git a/src/Utilities/SourceFileMatcher.cs b/src/Utilities/SourceFileMatcher.cs index b9fbd81208bc..d0779ff018f5 100644 --- a/src/Utilities/SourceFileMatcher.cs +++ b/src/Utilities/SourceFileMatcher.cs @@ -12,16 +12,21 @@ internal sealed class SourceFileMatcher private static string[] AllFilesList => new[] { @"**/*.*" }; public static SourceFileMatcher CreateMatcher(string[] include, string[] exclude) - => new SourceFileMatcher(include.Length > 0 ? include : AllFilesList, exclude); + => new SourceFileMatcher(include, exclude); private readonly Matcher _matcher = new Matcher(StringComparison.OrdinalIgnoreCase); + private readonly bool _shouldMatchAll; public ImmutableArray Include { get; } public ImmutableArray Exclude { get; } private SourceFileMatcher(string[] include, string[] exclude) { - Include = include.ToImmutableArray(); + _shouldMatchAll = include.Length == 0 && exclude.Length == 0; + + Include = include.Length > 0 + ? include.ToImmutableArray() + : AllFilesList.ToImmutableArray(); Exclude = exclude.ToImmutableArray(); _matcher = new Matcher(StringComparison.OrdinalIgnoreCase); @@ -29,8 +34,8 @@ private SourceFileMatcher(string[] include, string[] exclude) _matcher.AddExcludePatterns(Exclude); } - public PatternMatchingResult Match(string filePath) - => _matcher.Match(filePath); + public bool HasMatches(string filePath) + => _shouldMatchAll || _matcher.Match(filePath).HasMatches; public IEnumerable GetResultsInFullPath(string directoryPath) => _matcher.GetResultsInFullPath(directoryPath); From e68fa5fc4b4d84ff3bc108b5556080a31b25d066 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 16 Nov 2020 21:43:03 -0800 Subject: [PATCH 1235/2702] Only run analyzers against specified project when workspace is a project --- src/Analyzers/AnalyzerFormatter.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 42bb5be034f5..2676e3a54928 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -106,7 +106,10 @@ private async Task>> Get CancellationToken cancellationToken) { var result = new CodeAnalysisResult(); - foreach (var project in solution.Projects) + var projects = options.WorkspaceType == WorkspaceType.Solution + ? solution.Projects + : solution.Projects.Where(project => project.FilePath == options.WorkspaceFilePath); + foreach (var project in projects) { var analyzers = projectAnalyzers[project.Id]; if (analyzers.IsEmpty) From 9e00b71122fe9195623552fb081be040c4d661e0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2020 19:09:10 +0000 Subject: [PATCH 1236/2702] Update dependencies from https://github.com/dotnet/arcade build 20201113.2 (#867) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 +-- eng/common/cross/armel/armel.jessie.patch | 43 +++++++++++++++++++++++ eng/common/cross/build-rootfs.sh | 8 ++++- global.json | 2 +- 4 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 eng/common/cross/armel/armel.jessie.patch diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index aa5a4bc53ff6..46d01ddb8ae4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - e65d307045c183af6e48b087571f6b7a05e39f01 + 3fea3a1b584e3ddd9145d80a0cfb51e3e658c464 diff --git a/eng/common/cross/armel/armel.jessie.patch b/eng/common/cross/armel/armel.jessie.patch new file mode 100644 index 000000000000..2d2615619351 --- /dev/null +++ b/eng/common/cross/armel/armel.jessie.patch @@ -0,0 +1,43 @@ +diff -u -r a/usr/include/urcu/uatomic/generic.h b/usr/include/urcu/uatomic/generic.h +--- a/usr/include/urcu/uatomic/generic.h 2014-10-22 15:00:58.000000000 -0700 ++++ b/usr/include/urcu/uatomic/generic.h 2020-10-30 21:38:28.550000000 -0700 +@@ -69,10 +69,10 @@ + #endif + #ifdef UATOMIC_HAS_ATOMIC_SHORT + case 2: +- return __sync_val_compare_and_swap_2(addr, old, _new); ++ return __sync_val_compare_and_swap_2((uint16_t*) addr, old, _new); + #endif + case 4: +- return __sync_val_compare_and_swap_4(addr, old, _new); ++ return __sync_val_compare_and_swap_4((uint32_t*) addr, old, _new); + #if (CAA_BITS_PER_LONG == 64) + case 8: + return __sync_val_compare_and_swap_8(addr, old, _new); +@@ -109,7 +109,7 @@ + return; + #endif + case 4: +- __sync_and_and_fetch_4(addr, val); ++ __sync_and_and_fetch_4((uint32_t*) addr, val); + return; + #if (CAA_BITS_PER_LONG == 64) + case 8: +@@ -148,7 +148,7 @@ + return; + #endif + case 4: +- __sync_or_and_fetch_4(addr, val); ++ __sync_or_and_fetch_4((uint32_t*) addr, val); + return; + #if (CAA_BITS_PER_LONG == 64) + case 8: +@@ -187,7 +187,7 @@ + return __sync_add_and_fetch_2(addr, val); + #endif + case 4: +- return __sync_add_and_fetch_4(addr, val); ++ return __sync_add_and_fetch_4((uint32_t*) addr, val); + #if (CAA_BITS_PER_LONG == 64) + case 8: + return __sync_add_and_fetch_8(addr, val); diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 575eee9fa190..6d59e181c8fd 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -336,7 +336,7 @@ elif [[ -n $__CodeName ]]; then chroot $__RootfsDir apt-get -f -y install chroot $__RootfsDir apt-get -y install $__UbuntuPackages chroot $__RootfsDir symlinks -cr /usr - chroot $__RootfsDir apt clean + chroot $__RootfsDir apt-get clean if [ $__SkipUnmount == 0 ]; then umount $__RootfsDir/* || true @@ -348,6 +348,12 @@ elif [[ -n $__CodeName ]]; then patch -p1 < $__CrossDir/$__BuildArch/trusty-lttng-2.4.patch popd fi + + if [[ "$__BuildArch" == "armel" && "$__CodeName" == "jessie" ]]; then + pushd $__RootfsDir + patch -p1 < $__CrossDir/$__BuildArch/armel.jessie.patch + popd + fi elif [[ "$__Tizen" == "tizen" ]]; then ROOTFS_DIR=$__RootfsDir $__CrossDir/$__BuildArch/tizen-build-rootfs.sh else diff --git a/global.json b/global.json index ed756d2bebc6..d5297fc432d2 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20561.5" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20563.2" } } From e5991c0789b96e4047afee85ca5b4edbed6f04b9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2020 19:30:11 +0000 Subject: [PATCH 1237/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201117.4 (#868) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 46d01ddb8ae4..0f5f593f109e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 4c195c3ac1974edcefa76774d7a59a2350ec55fa + ea939a52e7879876c7b4048c686a79ed160032ab diff --git a/eng/Versions.props b/eng/Versions.props index f15ea4867639..b3c1d7895252 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.8.0-5.20519.18 + 3.9.0-2.20567.4 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 6bb88202f886329f828b50817cd4437e90584e3c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 19 Nov 2020 20:32:26 +0000 Subject: [PATCH 1238/2702] [master] Update dependencies from dotnet/arcade (#869) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/SetupNugetSources.ps1 | 5 +++-- eng/common/SetupNugetSources.sh | 4 ++-- global.json | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0f5f593f109e..e4ba1c6da12a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 3fea3a1b584e3ddd9145d80a0cfb51e3e658c464 + a9a80fb35d2e7da21509441d665a40022ce8f1b4 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index bb3617133f09..a0b5fc37f438 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -99,8 +99,9 @@ function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Passw function EnablePrivatePackageSources($DisabledPackageSources) { $maestroPrivateSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]") ForEach ($DisabledPackageSource in $maestroPrivateSources) { - Write-Host "`tEnsuring private source '$($DisabledPackageSource.key)' is enabled" - $DisabledPackageSource.SetAttribute("value", "false") + Write-Host "`tEnsuring private source '$($DisabledPackageSource.key)' is enabled by deleting it from disabledPackageSource" + # Due to https://github.com/NuGet/Home/issues/10291, we must actually remove the disabled entries + $DisabledPackageSources.RemoveChild($DisabledPackageSource) } } diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index ef33382954cf..2734601c13c4 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -158,8 +158,8 @@ if [ "$?" == "0" ]; then for DisabledSourceName in ${DisabledDarcIntSources[@]} ; do if [[ $DisabledSourceName == darc-int* ]] then - OldDisableValue="add key=\"$DisabledSourceName\" value=\"true\"" - NewDisableValue="add key=\"$DisabledSourceName\" value=\"false\"" + OldDisableValue="" + NewDisableValue="" sed -i.bak "s|$OldDisableValue|$NewDisableValue|" $ConfigFile echo "Neutralized disablePackageSources entry for '$DisabledSourceName'" fi diff --git a/global.json b/global.json index d5297fc432d2..fe5499c1fd4c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20563.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20567.7" } } From 2f029418397a9aabaa42176e0635e11497598aad Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2020 00:00:00 +0000 Subject: [PATCH 1239/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201118.12 (#870) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e4ba1c6da12a..c8165f78f51e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ea939a52e7879876c7b4048c686a79ed160032ab + 02d01afeb28e693f76955f88c03e5d7548b600c8 diff --git a/eng/Versions.props b/eng/Versions.props index b3c1d7895252..5d4a9976a431 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-2.20567.4 + 3.9.0-2.20568.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 53d97b7f1071b3e9226947631e151b151040aafd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2020 13:41:00 +0000 Subject: [PATCH 1240/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201121.4 (#871) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c8165f78f51e..6776eafce9df 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 02d01afeb28e693f76955f88c03e5d7548b600c8 + ffb5be0ffe11071d4fd6d16f57a9330fc2af02d5 diff --git a/eng/Versions.props b/eng/Versions.props index 5d4a9976a431..e408c8a34149 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-2.20568.12 + 3.9.0-2.20571.4 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From f6ccd2f8027343a11186e5dd16668b8bcce5e951 Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod Date: Mon, 2 Nov 2020 13:20:09 +0000 Subject: [PATCH 1241/2702] add .pre-commit-hooks.yaml --- .pre-commit-hooks.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .pre-commit-hooks.yaml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 000000000000..2f3559f4e9f5 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,7 @@ +--- + +- id: dotnet-format + name: dotnet format + language: dotnet + types: ['c#'] + entry: dotnet-format From 954396af0d5bc629e42491b5c4413d1c0a3c609c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 23 Nov 2020 14:06:59 +0000 Subject: [PATCH 1242/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201123.10 (#873) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6776eafce9df..7bd9b35ac972 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ffb5be0ffe11071d4fd6d16f57a9330fc2af02d5 + edf43e80d55de958f8db2c0fd0f184309da25bb6 diff --git a/eng/Versions.props b/eng/Versions.props index e408c8a34149..70af34208024 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-2.20571.4 + 3.9.0-2.20573.10 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 2bf11e3f75e604bfbe88adc6f0079643b8282af5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2020 14:08:49 +0000 Subject: [PATCH 1243/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201124.10 (#875) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7bd9b35ac972..6e6487df2006 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - edf43e80d55de958f8db2c0fd0f184309da25bb6 + 07ec1b11ea750fb05ee057af23a86ae53bccb1f5 diff --git a/eng/Versions.props b/eng/Versions.props index 70af34208024..fdd4f332afd1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-2.20573.10 + 3.9.0-3.20574.10 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 5f1e6e250b72b8567ac3d1a3cb13d51dc4fb575b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2020 13:42:43 +0000 Subject: [PATCH 1244/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201125.4 (#877) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6e6487df2006..b0552cb76c43 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 07ec1b11ea750fb05ee057af23a86ae53bccb1f5 + d75535527ed29392f85a6226e098b09d4fdb1bde diff --git a/eng/Versions.props b/eng/Versions.props index fdd4f332afd1..a8b6d9dd11c0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20574.10 + 3.9.0-3.20575.4 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 1f2c689d30b1425e22b4dc21450194bda6891a4f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2020 13:53:13 +0000 Subject: [PATCH 1245/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201126.4 (#880) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b0552cb76c43..28ffa2d832ed 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - d75535527ed29392f85a6226e098b09d4fdb1bde + ac68377d66fe5c35c161dd8b4b3b6f21e160d5c6 diff --git a/eng/Versions.props b/eng/Versions.props index a8b6d9dd11c0..32ee660f3547 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20575.4 + 3.9.0-3.20576.4 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 50d9886f98a862af9d2f843f39020a2413c27637 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 19:53:45 +0000 Subject: [PATCH 1246/2702] Update dependencies from https://github.com/dotnet/arcade build 20201123.2 (#874) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/performance/crossgen_perf.proj | 6 +++--- eng/common/performance/performance-setup.sh | 6 ++++++ eng/common/post-build/sourcelink-validation.ps1 | 2 +- global.json | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 28ffa2d832ed..f20c6c1461b1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - a9a80fb35d2e7da21509441d665a40022ce8f1b4 + 35bddd4fbfab8da3518fb920250d7c9e0c3138ff diff --git a/eng/common/performance/crossgen_perf.proj b/eng/common/performance/crossgen_perf.proj index cf09e40578a5..eb8bdd9c440c 100644 --- a/eng/common/performance/crossgen_perf.proj +++ b/eng/common/performance/crossgen_perf.proj @@ -19,7 +19,7 @@ python3 - $(HelixPreCommands);chmod +x $HELIX_WORKITEM_PAYLOAD/startup/Startup;chmod +x $HELIX_WORKITEM_PAYLOAD/startup/perfcollect;sudo apt update + $(HelixPreCommands);chmod +x $HELIX_WORKITEM_PAYLOAD/startup/Startup;chmod +x $HELIX_WORKITEM_PAYLOAD/startup/perfcollect;sudo apt update;chmod +x $HELIX_WORKITEM_PAYLOAD/SOD/SizeOnDisk $HELIX_CORRELATION_PAYLOAD/Core_Root $HELIX_CORRELATION_PAYLOAD/performance/src/scenarios/ $(ScenarioDirectory)crossgen/ @@ -69,7 +69,7 @@ $(WorkItemDirectory) $(Python) $(CrossgenDirectory)pre.py crossgen --core-root $(CoreRoot) --single %(Identity) - $(Python) $(CrossgenDirectory)test.py sod --scenario-name "Crossgen %(Identity) Size" --dirs ./crossgen/ + $(Python) $(CrossgenDirectory)test.py sod --scenario-name "Crossgen %(Identity) Size" --dirs ./crossgen.out/ $(Python) $(CrossgenDirectory)post.py @@ -78,7 +78,7 @@ $(WorkItemDirectory) $(Python) $(Crossgen2Directory)pre.py crossgen2 --core-root $(CoreRoot) --single %(Identity) - $(Python) $(Crossgen2Directory)test.py sod --scenario-name "Crossgen2 %(Identity) Size" --dirs ./crossgen/ + $(Python) $(Crossgen2Directory)test.py sod --scenario-name "Crossgen2 %(Identity) Size" --dirs ./crossgen.out/ $(Python) $(Crossgen2Directory)post.py diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 315815a96777..c8e211bcb1bb 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -198,6 +198,12 @@ if [[ "$internal" == true ]]; then else queue=Ubuntu.1804.Amd64.Tiger.Perf fi +else + if [[ "$architecture" = "arm64" ]]; then + queue=ubuntu.1804.armarch.open + else + queue=Ubuntu.1804.Amd64.Open + fi fi if [[ "$mono_dotnet" != "" ]] && [[ "$monointerpreter" == "false" ]]; then diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 1728b742b3b7..1c46f7b63414 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -164,7 +164,7 @@ function CheckJobResult( [ref]$ValidationFailures, [switch]$logErrors) { if ($result -ne '0') { - if ($logError) { + if ($logErrors) { Write-PipelineTelemetryError -Category 'SourceLink' -Message "$packagePath has broken SourceLink links." } $ValidationFailures.Value++ diff --git a/global.json b/global.json index fe5499c1fd4c..47f0257b0d48 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20567.7" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20573.2" } } From a08108065c1680b2c2c28eeec0bb749bc36674de Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 1 Dec 2020 13:52:06 +0000 Subject: [PATCH 1247/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201130.12 (#881) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f20c6c1461b1..e347e706fb81 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ac68377d66fe5c35c161dd8b4b3b6f21e160d5c6 + 41b216872e1ca1625c3c0571804a861117ecd627 diff --git a/eng/Versions.props b/eng/Versions.props index 32ee660f3547..8fcafa566644 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20576.4 + 3.9.0-3.20580.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 0b4ae80452fa8b4ae5fe7714a3bae4b735837e47 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 2 Dec 2020 13:46:41 +0000 Subject: [PATCH 1248/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201202.14 (#883) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e347e706fb81..8ebeaa3a8ed8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 41b216872e1ca1625c3c0571804a861117ecd627 + c42f33120622ee51704db04a3e0539c21d4924c5 diff --git a/eng/Versions.props b/eng/Versions.props index 8fcafa566644..b9696eb9f791 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20580.12 + 3.9.0-3.20602.14 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 4415afc6e1e9bfd6180c72c986f15a10f820ddad Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 2 Dec 2020 11:12:06 -0800 Subject: [PATCH 1249/2702] Improve FixAll support by using equivalence key when available --- src/Analyzers/SolutionCodeFixApplier.cs | 34 ++++++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index 162da991d404..0f565c032409 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -29,37 +29,57 @@ public async Task ApplyCodeFixesAsync( return solution; } - var document = result.Diagnostics + var diagnostic = result.Diagnostics .SelectMany(kvp => kvp.Value) - .Select(diagnostic => solution.GetDocument(diagnostic.Location.SourceTree)) + .Where(diagnostic => diagnostic.Location.SourceTree != null) .FirstOrDefault(); + if (diagnostic is null) + { + return solution; + } + + var document = solution.GetDocument(diagnostic.Location.SourceTree); + if (document is null) { return solution; } + CodeAction? action = null; + var context = new CodeFixContext(document, diagnostic, + (a, _) => + { + if (action == null) + { + action = a; + } + }, + cancellationToken); + + await codeFix.RegisterCodeFixesAsync(context).ConfigureAwait(false); + var fixAllContext = new FixAllContext( document: document, codeFixProvider: codeFix, scope: FixAllScope.Solution, - codeActionEquivalenceKey: null!, // FixAllState supports null equivalence key. This should still be supported. + codeActionEquivalenceKey: action?.EquivalenceKey!, // FixAllState supports null equivalence key. This should still be supported. diagnosticIds: new[] { diagnosticId }, fixAllDiagnosticProvider: new DiagnosticProvider(result), cancellationToken: cancellationToken); try { - var action = await fixAllProvider.GetFixAsync(fixAllContext).ConfigureAwait(false); - if (action is null) + var fixAllAction = await fixAllProvider.GetFixAsync(fixAllContext).ConfigureAwait(false); + if (fixAllAction is null) { logger.LogWarning(Resources.Unable_to_fix_0_Code_fix_1_didnt_return_a_Fix_All_action, diagnosticId, codeFix.GetType().Name); return solution; } - var operations = await action.GetOperationsAsync(cancellationToken).ConfigureAwait(false); + var operations = await fixAllAction.GetOperationsAsync(cancellationToken).ConfigureAwait(false); var applyChangesOperation = operations.OfType().SingleOrDefault(); - if (action is null) + if (applyChangesOperation is null) { logger.LogWarning(Resources.Unable_to_fix_0_Code_fix_1_returned_an_unexpected_operation, diagnosticId, codeFix.GetType().Name); return solution; From 225e935e24fbdfc18f74e2648591710da1366ae2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2020 13:56:08 +0000 Subject: [PATCH 1250/2702] Update dependencies from https://github.com/dotnet/arcade build 20201201.2 (#885) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/tools.sh | 14 +++++++++----- global.json | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8ebeaa3a8ed8..f35d15d390ce 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 35bddd4fbfab8da3518fb920250d7c9e0c3138ff + 6d8efa00a7dd2d15e07df673a83cecb8a0a3031f diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 98186e784965..87152724123b 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -249,7 +249,7 @@ function with_retries { return 0 fi - timeout=$((2**$retries-1)) + timeout=$((3**$retries-1)) echo "Failed to execute '$@'. Waiting $timeout seconds before next attempt ($retries out of $maxRetries)." 1>&2 sleep $timeout done @@ -271,10 +271,14 @@ function GetDotNetInstallScript { # Use curl if available, otherwise use wget if command -v curl > /dev/null; then - with_retries curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { - local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." - ExitWithExitCode $exit_code + # first, try directly, if this fails we will retry with verbose logging + curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { + echo "curl failed; will now retry with verbose logging." + with_retries curl "$install_script_url" -sSL --verbose --retry 10 --create-dirs -o "$install_script" || { + local exit_code=$? + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." + ExitWithExitCode $exit_code + } } else with_retries wget -v -O "$install_script" "$install_script_url" || { diff --git a/global.json b/global.json index 47f0257b0d48..e88afa82f8cc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20573.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20601.2" } } From 676fd61333b767d3af75e836f328764372c4c819 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2020 17:04:29 +0000 Subject: [PATCH 1251/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201203.6 (#886) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f35d15d390ce..5531c2d56dc4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c42f33120622ee51704db04a3e0539c21d4924c5 + 889dc4acc47ee10c89906934564ce14cc06f5bef diff --git a/eng/Versions.props b/eng/Versions.props index b9696eb9f791..aef958be75f5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20602.14 + 3.9.0-3.20603.6 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 7f3e2a14b2d3d94bf52d3199e3c8204a66825850 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2020 22:15:44 +0000 Subject: [PATCH 1252/2702] [master] Update dependencies from dotnet/roslyn (#887) [master] Update dependencies from dotnet/roslyn - No longer set CurrentDirectory in TestProjectsPathFixture --- eng/Version.Details.xml | 4 +- eng/Versions.props | 2 +- src/Program.cs | 11 +- src/Resources.resx | 3 + src/xlf/Resources.cs.xlf | 5 + src/xlf/Resources.de.xlf | 5 + src/xlf/Resources.es.xlf | 5 + src/xlf/Resources.fr.xlf | 5 + src/xlf/Resources.it.xlf | 5 + src/xlf/Resources.ja.xlf | 5 + src/xlf/Resources.ko.xlf | 5 + src/xlf/Resources.pl.xlf | 5 + src/xlf/Resources.pt-BR.xlf | 5 + src/xlf/Resources.ru.xlf | 5 + src/xlf/Resources.tr.xlf | 5 + src/xlf/Resources.zh-Hans.xlf | 5 + src/xlf/Resources.zh-Hant.xlf | 5 + tests/CodeFormatterTests.cs | 130 ++++++++++--------- tests/MSBuild/MSBuildWorkspaceFinderTests.cs | 34 ++--- tests/Utilities/TestProjectsPathFixture.cs | 41 ------ tests/Utilities/TestProjectsPathHelper.cs | 26 ++++ 21 files changed, 189 insertions(+), 127 deletions(-) delete mode 100644 tests/Utilities/TestProjectsPathFixture.cs create mode 100644 tests/Utilities/TestProjectsPathHelper.cs diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5531c2d56dc4..0f8154f2eeb0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 889dc4acc47ee10c89906934564ce14cc06f5bef + 4ebca9257496c3ffa075413670b5c53628e25253 diff --git a/eng/Versions.props b/eng/Versions.props index aef958be75f5..7be0a165dbe5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20603.6 + 3.9.0-3.20604.2 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 diff --git a/src/Program.cs b/src/Program.cs index 9086aa343507..b02dc3f20fec 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -7,6 +7,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -77,6 +78,8 @@ public static async Task Run( { currentDirectory = Environment.CurrentDirectory; + var formatVersion = GetVersion(); + logger.LogDebug(Resources.The_dotnet_format_version_is_0, formatVersion); string? workspaceDirectory; string workspacePath; @@ -112,7 +115,6 @@ public static async Task Run( if (workspaceType != WorkspaceType.Folder) { var runtimeVersion = GetRuntimeVersion(); - logger.LogDebug(Resources.The_dotnet_runtime_version_is_0, runtimeVersion); // Load MSBuild @@ -298,6 +300,13 @@ private static ILogger SetupLogging(IConsole console, LogLevel logLevel return logger!; } + private static string GetVersion() + { + return Assembly.GetExecutingAssembly() + .GetCustomAttribute() + .InformationalVersion; + } + private static bool TryGetDotNetCliVersion([NotNullWhen(returnValue: true)] out string? dotnetVersion) { try diff --git a/src/Resources.resx b/src/Resources.resx index b429456b3a0c..7982a8dfc5f7 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -294,4 +294,7 @@ Run whitespace formatting. Run by default when not applying fixes. + + The dotnet format version is '{0}'. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index fe0c50bae6f3..a558bcbedf55 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -217,6 +217,11 @@ Verze .NET CLI je {0}. + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 2052021e5560..be1f8c18ac1a 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -217,6 +217,11 @@ Die dotnet-CLI-Version ist "{0}". + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index e5cf9df3f1d7..24738b533677 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -217,6 +217,11 @@ La versión de la CLI de dotnet es "{0}". + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index d978434fb3a8..9c41a66598fc 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -217,6 +217,11 @@ La version de l'interface CLI dotnet est '{0}'. + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 5d4f6e22caa9..4f8e29bcc282 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -217,6 +217,11 @@ La versione dell'interfaccia della riga di comando di dotnet è '{0}'. + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 632225f4fded..515540a891a4 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -217,6 +217,11 @@ dotnet CLI バージョンは '{0}' です。 + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index ba52245a686a..6e6e344fbd4e 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -217,6 +217,11 @@ dotnet CLI 버전은 '{0}'입니다. + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index afde43794e3b..9be4b307d025 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -217,6 +217,11 @@ Wersja interfejsu wiersza polecenia dotnet to „{0}”. + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 9f06aaa787a3..c44fb3ec4fdf 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -217,6 +217,11 @@ A versão do CLI do dotnet é '{0}'. + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index f475896a4458..b783798e7084 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -217,6 +217,11 @@ Версия CLI dotnet: "{0}". + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 0d6757c6774a..c7d3d5dcdfaf 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -217,6 +217,11 @@ dotnet CLI sürümü: '{0}'. + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index af5e9ed2d04f..edb5ec33b463 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -217,6 +217,11 @@ dotnet CLI 版本为“{0}”。 + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 8b823a6f4b09..fae3baef6815 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -217,6 +217,11 @@ dotnet CLI 版本為 '{0}'。 + + The dotnet format version is '{0}'. + The dotnet format version is '{0}'. + + The dotnet runtime version is '{0}'. The dotnet runtime version is '{0}'. diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 371ff5a88bd6..d28fd083f668 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -14,28 +14,28 @@ namespace Microsoft.CodeAnalysis.Tools.Tests { - public class CodeFormatterTests : IClassFixture + public class CodeFormatterTests { - private const string FormattedProjectPath = "for_code_formatter/formatted_project/"; - private const string FormattedProjectFilePath = FormattedProjectPath + "formatted_project.csproj"; - private const string FormattedSolutionFilePath = "for_code_formatter/formatted_solution/formatted_solution.sln"; + private static readonly string s_formattedProjectPath = Path.Combine("for_code_formatter", "formatted_project"); + private static readonly string s_formattedProjectFilePath = Path.Combine(s_formattedProjectPath, "formatted_project.csproj"); + private static readonly string s_formattedSolutionFilePath = Path.Combine("for_code_formatter", "formatted_solution", "formatted_solution.sln"); - private const string UnformattedProjectPath = "for_code_formatter/unformatted_project/"; - private const string UnformattedProjectFilePath = UnformattedProjectPath + "unformatted_project.csproj"; - private const string UnformattedProgramFilePath = UnformattedProjectPath + "program.cs"; - private const string UnformattedSolutionFilePath = "for_code_formatter/unformatted_solution/unformatted_solution.sln"; + private static readonly string s_unformattedProjectPath = Path.Combine("for_code_formatter", "unformatted_project"); + private static readonly string s_unformattedProjectFilePath = Path.Combine(s_unformattedProjectPath, "unformatted_project.csproj"); + private static readonly string s_unformattedProgramFilePath = Path.Combine(s_unformattedProjectPath, "program.cs"); + private static readonly string s_unformattedSolutionFilePath = Path.Combine("for_code_formatter", "unformatted_solution", "unformatted_solution.sln"); - private const string FSharpProjectPath = "for_code_formatter/fsharp_project/"; - private const string FSharpProjectFilePath = FSharpProjectPath + "fsharp_project.fsproj"; + private static readonly string s_fSharpProjectPath = Path.Combine("for_code_formatter", "fsharp_project"); + private static readonly string s_fSharpProjectFilePath = Path.Combine(s_fSharpProjectPath, "fsharp_project.fsproj"); - private const string GeneratedProjectPath = "for_code_formatter/generated_project/"; - private const string GeneratedProjectFilePath = GeneratedProjectPath + "generated_project.csproj"; + private static readonly string s_generatedProjectPath = Path.Combine("for_code_formatter", "generated_project"); + private static readonly string s_generatedProjectFilePath = Path.Combine(s_generatedProjectPath, "generated_project.csproj"); - private const string CodeStyleSolutionPath = "for_code_formatter/codestyle_solution/"; - private const string CodeStyleSolutionFilePath = CodeStyleSolutionPath + "codestyle_solution.sln"; + private static readonly string s_codeStyleSolutionPath = Path.Combine("for_code_formatter", "codestyle_solution"); + private static readonly string s_codeStyleSolutionFilePath = Path.Combine(s_codeStyleSolutionPath, "codestyle_solution.sln"); - private const string AnalyzersSolutionPath = "for_code_formatter/analyzers_solution/"; - private const string AnalyzersSolutionFilePath = AnalyzersSolutionPath + "analyzers_solution.sln"; + private static readonly string s_analyzersSolutionPath = Path.Combine("for_code_formatter", "analyzers_solution"); + private static readonly string s_analyzersSolutionFilePath = Path.Combine(s_analyzersSolutionPath, "analyzers_solution.sln"); private static string[] EmptyFilesList => Array.Empty(); @@ -43,18 +43,16 @@ public class CodeFormatterTests : IClassFixture private readonly ITestOutputHelper _output; - public CodeFormatterTests(ITestOutputHelper output, TestProjectsPathFixture testProjectsPathFixture) + public CodeFormatterTests(ITestOutputHelper output) { _output = output; - - testProjectsPathFixture.SetCurrentDirectory(); } [Fact] public async Task NoFilesFormattedInFormattedProject() { await TestFormatWorkspaceAsync( - FormattedProjectFilePath, + s_formattedProjectFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -67,7 +65,7 @@ await TestFormatWorkspaceAsync( public async Task NoFilesFormattedInFormattedSolution() { await TestFormatWorkspaceAsync( - FormattedSolutionFilePath, + s_formattedSolutionFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -80,7 +78,7 @@ await TestFormatWorkspaceAsync( public async Task FilesFormattedInUnformattedProject() { await TestFormatWorkspaceAsync( - UnformattedProjectFilePath, + s_unformattedProjectFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -93,7 +91,7 @@ await TestFormatWorkspaceAsync( public async Task NoFilesFormattedInUnformattedProjectWhenFixingCodeStyle() { await TestFormatWorkspaceAsync( - UnformattedProjectFilePath, + s_unformattedProjectFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -108,7 +106,7 @@ await TestFormatWorkspaceAsync( public async Task GeneratedFilesFormattedInUnformattedProject() { var log = await TestFormatWorkspaceAsync( - UnformattedProjectFilePath, + s_unformattedProjectFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: true, @@ -125,7 +123,7 @@ public async Task GeneratedFilesFormattedInUnformattedProject() public async Task FilesFormattedInUnformattedSolution() { await TestFormatWorkspaceAsync( - UnformattedSolutionFilePath, + s_unformattedSolutionFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -139,7 +137,7 @@ public async Task FilesFormattedInUnformattedProjectFolder() { // Since the code files are beneath the project folder, files are found and formatted. await TestFormatWorkspaceAsync( - Path.GetDirectoryName(UnformattedProjectFilePath), + Path.GetDirectoryName(s_unformattedProjectFilePath), include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -153,7 +151,7 @@ public async Task NoFilesFormattedInUnformattedSolutionFolder() { // Since the code files are outside the solution folder, no files are found or formatted. await TestFormatWorkspaceAsync( - Path.GetDirectoryName(UnformattedSolutionFilePath), + Path.GetDirectoryName(s_unformattedSolutionFilePath), include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -166,7 +164,7 @@ await TestFormatWorkspaceAsync( public async Task FSharpProjectsDoNotCreateException() { var log = await TestFormatWorkspaceAsync( - FSharpProjectFilePath, + s_fSharpProjectFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -178,16 +176,17 @@ public async Task FSharpProjectsDoNotCreateException() var match = new Regex(pattern, RegexOptions.Multiline).Match(log); Assert.True(match.Success, log); - Assert.Equal(match.Groups[1].Value, Path.GetFullPath(FSharpProjectFilePath)); + Assert.EndsWith(s_fSharpProjectFilePath, match.Groups[1].Value); } [Fact] public async Task OnlyFormatPathsFromList() { - var include = new[] { UnformattedProjectPath }; + // To match a folder pattern it needs to end with a directory separator. + var include = new[] { s_unformattedProjectPath + Path.DirectorySeparatorChar }; await TestFormatWorkspaceAsync( - UnformattedProjectFilePath, + s_unformattedProjectFilePath, include, exclude: EmptyFilesList, includeGenerated: false, @@ -199,10 +198,10 @@ await TestFormatWorkspaceAsync( [Fact] public async Task OnlyFormatFilesFromList() { - var include = new[] { UnformattedProgramFilePath }; + var include = new[] { s_unformattedProgramFilePath }; await TestFormatWorkspaceAsync( - UnformattedProjectFilePath, + s_unformattedProjectFilePath, include, exclude: EmptyFilesList, includeGenerated: false, @@ -214,10 +213,10 @@ await TestFormatWorkspaceAsync( [Fact] public async Task NoFilesFormattedWhenNotInList() { - var include = new[] { Path.Combine(UnformattedProjectPath, "does_not_exist.cs") }; + var include = new[] { Path.Combine(s_unformattedProjectPath, "does_not_exist.cs") }; await TestFormatWorkspaceAsync( - UnformattedProjectFilePath, + s_unformattedProjectFilePath, include, exclude: EmptyFilesList, includeGenerated: false, @@ -229,10 +228,10 @@ await TestFormatWorkspaceAsync( [Fact] public async Task OnlyLogFormattedFiles() { - var include = new[] { UnformattedProgramFilePath }; + var include = new[] { s_unformattedProgramFilePath }; var log = await TestFormatWorkspaceAsync( - UnformattedSolutionFilePath, + s_unformattedSolutionFilePath, include, exclude: EmptyFilesList, includeGenerated: false, @@ -251,7 +250,7 @@ public async Task OnlyLogFormattedFiles() public async Task FormatLocationsLoggedInUnformattedProject() { var log = await TestFormatWorkspaceAsync( - UnformattedProjectFilePath, + s_unformattedProjectFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -302,7 +301,7 @@ public async Task FormatLocationsLoggedInUnformattedProject() public async Task FormatLocationsNotLoggedInFormattedProject() { var log = await TestFormatWorkspaceAsync( - FormattedProjectFilePath, + s_formattedProjectFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -319,10 +318,10 @@ public async Task FormatLocationsNotLoggedInFormattedProject() [Fact] public async Task LogFilesThatDontMatchExclude() { - var include = new[] { UnformattedProgramFilePath }; + var include = new[] { s_unformattedProgramFilePath }; var log = await TestFormatWorkspaceAsync( - UnformattedSolutionFilePath, + s_unformattedSolutionFilePath, include, exclude: EmptyFilesList, includeGenerated: false, @@ -340,10 +339,10 @@ public async Task LogFilesThatDontMatchExclude() [Fact] public async Task IgnoreFileWhenListedInExcludeList() { - var include = new[] { UnformattedProgramFilePath }; + var include = new[] { s_unformattedProgramFilePath }; await TestFormatWorkspaceAsync( - UnformattedSolutionFilePath, + s_unformattedSolutionFilePath, include: include, exclude: include, includeGenerated: false, @@ -355,11 +354,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task IgnoreFileWhenContainingFolderListedInExcludeList() { - var include = new[] { UnformattedProgramFilePath }; - var exclude = new[] { UnformattedProjectPath }; + var include = new[] { s_unformattedProgramFilePath }; + var exclude = new[] { s_unformattedProjectPath }; await TestFormatWorkspaceAsync( - UnformattedSolutionFilePath, + s_unformattedSolutionFilePath, include: include, exclude: exclude, includeGenerated: false, @@ -371,11 +370,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task IgnoreAllFileWhenExcludingAllFiles() { - var include = new[] { UnformattedProgramFilePath }; + var include = new[] { s_unformattedProgramFilePath }; var exclude = new[] { "**/*.*" }; await TestFormatWorkspaceAsync( - UnformattedSolutionFilePath, + s_unformattedSolutionFilePath, include: include, exclude: exclude, includeGenerated: false, @@ -388,7 +387,7 @@ await TestFormatWorkspaceAsync( public async Task NoFilesFormattedInGeneratedProject_WhenNotIncludingGeneratedCode() { await TestFormatWorkspaceAsync( - GeneratedProjectFilePath, + s_generatedProjectFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -401,7 +400,7 @@ await TestFormatWorkspaceAsync( public async Task FilesFormattedInGeneratedProject_WhenIncludingGeneratedCode() { await TestFormatWorkspaceAsync( - GeneratedProjectFilePath, + s_generatedProjectFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: true, @@ -413,11 +412,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task NoFilesFormattedInCodeStyleSolution_WhenNotFixingCodeStyle() { - var restoreExitCode = await PerformNuGetRestore(CodeStyleSolutionFilePath); + var restoreExitCode = await PerformNuGetRestore(s_codeStyleSolutionFilePath); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( - CodeStyleSolutionFilePath, + s_codeStyleSolutionFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -430,11 +429,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task NoFilesFormattedInCodeStyleSolution_WhenFixingCodeStyleErrors() { - var restoreExitCode = await PerformNuGetRestore(CodeStyleSolutionFilePath); + var restoreExitCode = await PerformNuGetRestore(s_codeStyleSolutionFilePath); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( - CodeStyleSolutionFilePath, + s_codeStyleSolutionFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -448,11 +447,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task FilesFormattedInCodeStyleSolution_WhenFixingCodeStyleWarnings() { - var restoreExitCode = await PerformNuGetRestore(CodeStyleSolutionFilePath); + var restoreExitCode = await PerformNuGetRestore(s_codeStyleSolutionFilePath); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( - CodeStyleSolutionFilePath, + s_codeStyleSolutionFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -466,11 +465,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task NoFilesFormattedInAnalyzersSolution_WhenNotFixingAnalyzers() { - var restoreExitCode = await PerformNuGetRestore(AnalyzersSolutionFilePath); + var restoreExitCode = await PerformNuGetRestore(s_analyzersSolutionFilePath); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( - AnalyzersSolutionFilePath, + s_analyzersSolutionFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -483,11 +482,11 @@ await TestFormatWorkspaceAsync( [Fact] public async Task FilesFormattedInAnalyzersSolution_WhenFixingAnalyzerErrors() { - var restoreExitCode = await PerformNuGetRestore(AnalyzersSolutionFilePath); + var restoreExitCode = await PerformNuGetRestore(s_analyzersSolutionFilePath); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( - AnalyzersSolutionFilePath, + s_analyzersSolutionFilePath, include: EmptyFilesList, exclude: EmptyFilesList, includeGenerated: false, @@ -500,9 +499,13 @@ await TestFormatWorkspaceAsync( internal async Task PerformNuGetRestore(string workspaceFilePath) { - var processInfo = ProcessRunner.CreateProcess("dotnet", $"restore \"{workspaceFilePath}\"", captureOutput: true, displayWindow: false); + var workspacePath = Path.Combine(TestProjectsPathHelper.GetProjectsDirectory(), workspaceFilePath); + + var processInfo = ProcessRunner.CreateProcess("dotnet", $"restore \"{workspacePath}\"", captureOutput: true, displayWindow: false); var restoreResult = await processInfo.Result; + _output.WriteLine(string.Join(Environment.NewLine, restoreResult.OutputLines)); + return restoreResult.ExitCode; } @@ -518,6 +521,9 @@ internal async Task TestFormatWorkspaceAsync( DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { + var currentDirectory = Environment.CurrentDirectory; + Environment.CurrentDirectory = TestProjectsPathHelper.GetProjectsDirectory(); + var workspacePath = Path.GetFullPath(workspaceFilePath); WorkspaceType workspaceType; @@ -552,9 +558,9 @@ internal async Task TestFormatWorkspaceAsync( reportPath: string.Empty, includeGenerated); var formatResult = await CodeFormatter.FormatWorkspaceAsync(formatOptions, logger, CancellationToken.None); + Environment.CurrentDirectory = currentDirectory; var log = logger.GetLog(); - _output.WriteLine(log); Assert.Equal(expectedExitCode, formatResult.ExitCode); diff --git a/tests/MSBuild/MSBuildWorkspaceFinderTests.cs b/tests/MSBuild/MSBuildWorkspaceFinderTests.cs index c4ccb2dbe625..2ff51f1855aa 100644 --- a/tests/MSBuild/MSBuildWorkspaceFinderTests.cs +++ b/tests/MSBuild/MSBuildWorkspaceFinderTests.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.IO; using Microsoft.CodeAnalysis.Tools.MSBuild; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; @@ -8,14 +7,9 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.MSBuild { - public class MSBuildWorkspaceFinderTests : IClassFixture + public class MSBuildWorkspaceFinderTests { - private string SolutionPath => Environment.CurrentDirectory; - - public MSBuildWorkspaceFinderTests(TestProjectsPathFixture testProjectsPathFixture) - { - testProjectsPathFixture.SetCurrentDirectory(); - } + private string ProjectsPath => TestProjectsPathHelper.GetProjectsDirectory(); [Fact] public void ThrowsException_CannotFindMSBuildProjectFile() @@ -23,8 +17,8 @@ public void ThrowsException_CannotFindMSBuildProjectFile() var workspacePath = "for_workspace_finder/no_project_or_solution/"; var exceptionMessageStart = string.Format( Resources.Could_not_find_a_MSBuild_project_or_solution_file_in_0_Specify_which_to_use_with_the_workspace_argument, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Path.Combine(ProjectsPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(ProjectsPath, workspacePath)); Assert.StartsWith(exceptionMessageStart, exception.Message); } @@ -34,8 +28,8 @@ public void ThrowsException_MultipleMSBuildProjectFiles() var workspacePath = "for_workspace_finder/multiple_projects/"; var exceptionMessageStart = string.Format( Resources.Multiple_MSBuild_project_files_found_in_0_Specify_which_to_use_with_the_workspace_argument, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Path.Combine(ProjectsPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(ProjectsPath, workspacePath)); Assert.Equal(exceptionMessageStart, exception.Message); } @@ -45,8 +39,8 @@ public void ThrowsException_MultipleMSBuildSolutionFiles() var workspacePath = "for_workspace_finder/multiple_solutions/"; var exceptionMessageStart = string.Format( Resources.Multiple_MSBuild_solution_files_found_in_0_Specify_which_to_use_with_the_workspace_argument, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Path.Combine(ProjectsPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(ProjectsPath, workspacePath)); Assert.Equal(exceptionMessageStart, exception.Message); } @@ -56,8 +50,8 @@ public void ThrowsException_SolutionAndProjectAmbiguity() var workspacePath = "for_workspace_finder/project_and_solution/"; var exceptionMessageStart = string.Format( Resources.Both_a_MSBuild_project_file_and_solution_file_found_in_0_Specify_which_to_use_with_the_workspace_argument, - Path.Combine(SolutionPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); - var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, workspacePath)); + Path.Combine(ProjectsPath, workspacePath)).Replace('/', Path.DirectorySeparatorChar); + var exception = Assert.Throws(() => MSBuildWorkspaceFinder.FindWorkspace(ProjectsPath, workspacePath)); Assert.Equal(exceptionMessageStart, exception.Message); } @@ -66,7 +60,7 @@ public void FindsSolutionByFolder() { const string Path = "for_workspace_finder/single_solution/"; - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(ProjectsPath, Path); var solutionFileName = System.IO.Path.GetFileName(workspacePath); Assert.Equal("single_solution.sln", solutionFileName); @@ -78,7 +72,7 @@ public void FindsSolutionByFilePath() { const string Path = "for_workspace_finder/multiple_solutions/solution_b.sln"; - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(ProjectsPath, Path); var solutionFileName = System.IO.Path.GetFileName(workspacePath); Assert.Equal("solution_b.sln", solutionFileName); @@ -90,7 +84,7 @@ public void FindsProjectByFolder() { const string Path = "for_workspace_finder/single_project/"; - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(ProjectsPath, Path); var solutionFileName = System.IO.Path.GetFileName(workspacePath); Assert.Equal("single_project.csproj", solutionFileName); @@ -102,7 +96,7 @@ public void FindsProjectByFilePath() { const string Path = "for_workspace_finder/multiple_projects/project_b.csproj"; - var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(SolutionPath, Path); + var (isSolution, workspacePath) = MSBuildWorkspaceFinder.FindWorkspace(ProjectsPath, Path); var solutionFileName = System.IO.Path.GetFileName(workspacePath); Assert.Equal("project_b.csproj", solutionFileName); diff --git a/tests/Utilities/TestProjectsPathFixture.cs b/tests/Utilities/TestProjectsPathFixture.cs deleted file mode 100644 index 41cbe5153bdc..000000000000 --- a/tests/Utilities/TestProjectsPathFixture.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Reflection; -using System.Threading; - -namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities -{ - /// - /// This test fixture sets the to the dotnet-format test projects folder path. - /// - public sealed class TestProjectsPathFixture : IDisposable - { - private static int s_registered; - private static string s_currentDirectory; - - public void SetCurrentDirectory() - { - if (Interlocked.Increment(ref s_registered) == 1) - { - s_currentDirectory = Environment.CurrentDirectory; - - // walk from /format/artifacts/bin/dotnet-format.UnitTests/Debug/netcoreapp2.1/dotnet-format.UnitTests.dll - // up to the repo root then down to the test projects folder. - var unitTestAssemblyPath = Assembly.GetExecutingAssembly().Location; - var repoRootPath = Directory.GetParent(unitTestAssemblyPath).Parent.Parent.Parent.Parent.Parent.FullName; - Environment.CurrentDirectory = Path.Combine(repoRootPath, "tests", "projects"); - } - } - - public void Dispose() - { - if (Interlocked.Decrement(ref s_registered) == 0) - { - Environment.CurrentDirectory = s_currentDirectory; - s_currentDirectory = null; - } - } - } -} diff --git a/tests/Utilities/TestProjectsPathHelper.cs b/tests/Utilities/TestProjectsPathHelper.cs new file mode 100644 index 000000000000..fd21b8aaaded --- /dev/null +++ b/tests/Utilities/TestProjectsPathHelper.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.IO; +using System.Reflection; + +namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities +{ + public static class TestProjectsPathHelper + { + private static string s_projectsDirectory; + + public static string GetProjectsDirectory() + { + if (s_projectsDirectory == null) + { + // walk from /format/artifacts/bin/dotnet-format.UnitTests/Debug/netcoreapp2.1/dotnet-format.UnitTests.dll + // up to the repo root then down to the test projects folder. + var unitTestAssemblyPath = Assembly.GetExecutingAssembly().Location; + var repoRootPath = Directory.GetParent(unitTestAssemblyPath).Parent.Parent.Parent.Parent.Parent.FullName; + s_projectsDirectory = Path.Combine(repoRootPath, "tests", "projects"); + } + + return s_projectsDirectory; + } + } +} From 36eeb6195da160570808946cd0b95a535ff653c1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 5 Dec 2020 13:42:19 +0000 Subject: [PATCH 1253/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201205.14 (#888) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0f8154f2eeb0..295913d948b0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 4ebca9257496c3ffa075413670b5c53628e25253 + 691f18254a1bfbf423f89d4640003ee33b5fc4fa diff --git a/eng/Versions.props b/eng/Versions.props index 7be0a165dbe5..4667b15243f3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20604.2 + 3.9.0-3.20605.14 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 30aec044de786faac5ab2ad56b85ca641be727e7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 6 Dec 2020 13:41:59 +0000 Subject: [PATCH 1254/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201206.2 (#889) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 295913d948b0..fdf2d5d3229c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 691f18254a1bfbf423f89d4640003ee33b5fc4fa + 9799239e5a7447f3d653abea0585cd2fbf7ea155 diff --git a/eng/Versions.props b/eng/Versions.props index 4667b15243f3..affdb52e2b9a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20605.14 + 3.9.0-3.20606.2 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 14948470e94a536f5e7aaa79eaea38b387a9cb47 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 7 Dec 2020 14:07:22 +0000 Subject: [PATCH 1255/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201207.4 (#890) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fdf2d5d3229c..aece57a4d3cb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 9799239e5a7447f3d653abea0585cd2fbf7ea155 + ffd1dec60e045e3262061b3cc5974aa789eecb25 diff --git a/eng/Versions.props b/eng/Versions.props index affdb52e2b9a..fcf8b5232f0c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20606.2 + 3.9.0-3.20607.4 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From b44d16ea918216e107963990b7ff028deffd3a01 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 8 Dec 2020 13:35:23 +0000 Subject: [PATCH 1256/2702] Update dependencies from https://github.com/dotnet/arcade build 20201204.2 (#891) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 +- eng/common/pipeline-logging-functions.ps1 | 104 +++++++++++++--------- eng/common/pipeline-logging-functions.sh | 26 +++++- eng/common/tools.ps1 | 15 +++- eng/common/tools.sh | 13 ++- global.json | 2 +- 6 files changed, 112 insertions(+), 52 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index aece57a4d3cb..01c66919985d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 6d8efa00a7dd2d15e07df673a83cecb8a0a3031f + ea609b8e036359934332480de9336d98fcbb3f91 diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 index 8484451f3a56..8e422c561e4b 100644 --- a/eng/common/pipeline-logging-functions.ps1 +++ b/eng/common/pipeline-logging-functions.ps1 @@ -29,14 +29,14 @@ function Write-PipelineTelemetryError { [switch]$AsOutput, [switch]$Force) - $PSBoundParameters.Remove('Category') | Out-Null + $PSBoundParameters.Remove('Category') | Out-Null - if($Force -Or ((Test-Path variable:ci) -And $ci)) { - $Message = "(NETCORE_ENGINEERING_TELEMETRY=$Category) $Message" - } - $PSBoundParameters.Remove('Message') | Out-Null - $PSBoundParameters.Add('Message', $Message) - Write-PipelineTaskError @PSBoundParameters + if ($Force -Or ((Test-Path variable:ci) -And $ci)) { + $Message = "(NETCORE_ENGINEERING_TELEMETRY=$Category) $Message" + } + $PSBoundParameters.Remove('Message') | Out-Null + $PSBoundParameters.Add('Message', $Message) + Write-PipelineTaskError @PSBoundParameters } # Specify "-Force" to force pipeline formatted output even if "$ci" is false or not set @@ -55,8 +55,8 @@ function Write-PipelineTaskError { [switch]$Force ) - if(!$Force -And (-Not (Test-Path variable:ci) -Or !$ci)) { - if($Type -eq 'error') { + if (!$Force -And (-Not (Test-Path variable:ci) -Or !$ci)) { + if ($Type -eq 'error') { Write-Host $Message -ForegroundColor Red return } @@ -66,47 +66,61 @@ function Write-PipelineTaskError { } } - if(($Type -ne 'error') -and ($Type -ne 'warning')) { + if (($Type -ne 'error') -and ($Type -ne 'warning')) { Write-Host $Message return } $PSBoundParameters.Remove('Force') | Out-Null - if(-not $PSBoundParameters.ContainsKey('Type')) { + if (-not $PSBoundParameters.ContainsKey('Type')) { $PSBoundParameters.Add('Type', 'error') } Write-LogIssue @PSBoundParameters - } +} - function Write-PipelineSetVariable { +function Write-PipelineSetVariable { [CmdletBinding()] param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput, - [bool]$IsMultiJobVariable=$true) - - if((Test-Path variable:ci) -And $ci) { + [Parameter(Mandatory = $true)] + [string]$Name, + [string]$Value, + [switch]$Secret, + [switch]$AsOutput, + [bool]$IsMultiJobVariable = $true) + + if ((Test-Path variable:ci) -And $ci) { Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'isSecret' = $Secret - 'isOutput' = $IsMultiJobVariable + 'variable' = $Name + 'isSecret' = $Secret + 'isOutput' = $IsMultiJobVariable } -AsOutput:$AsOutput - } - } + } +} - function Write-PipelinePrependPath { +function Write-PipelinePrependPath { [CmdletBinding()] param( - [Parameter(Mandatory=$true)] - [string]$Path, - [switch]$AsOutput) + [Parameter(Mandatory = $true)] + [string]$Path, + [switch]$AsOutput) - if((Test-Path variable:ci) -And $ci) { + if ((Test-Path variable:ci) -And $ci) { Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput - } - } + } +} + +function Write-PipelineSetResult { + [CmdletBinding()] + param( + [ValidateSet("Succeeded", "SucceededWithIssues", "Failed", "Cancelled", "Skipped")] + [Parameter(Mandatory = $true)] + [string]$Result, + [string]$Message) + if ((Test-Path variable:ci) -And $ci) { + Write-LoggingCommand -Area 'task' -Event 'complete' -Data $Message -Properties @{ + 'result' = $Result + } + } +} <######################################## # Private functions. @@ -123,7 +137,8 @@ function Format-LoggingCommandData { foreach ($mapping in $script:loggingCommandEscapeMappings) { $Value = $Value.Replace($mapping.Token, $mapping.Replacement) } - } else { + } + else { for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { $mapping = $script:loggingCommandEscapeMappings[$i] $Value = $Value.Replace($mapping.Replacement, $mapping.Token) @@ -156,7 +171,8 @@ function Format-LoggingCommand { if ($first) { $null = $sb.Append(' ') $first = $false - } else { + } + else { $null = $sb.Append(';') } @@ -193,7 +209,8 @@ function Write-LoggingCommand { $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties if ($AsOutput) { $command - } else { + } + else { Write-Host $command } } @@ -212,12 +229,12 @@ function Write-LogIssue { [switch]$AsOutput) $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } + 'type' = $Type + 'code' = $ErrCode + 'sourcepath' = $SourcePath + 'linenumber' = $LineNumber + 'columnnumber' = $ColumnNumber + } if ($AsOutput) { return $command } @@ -229,7 +246,8 @@ function Write-LogIssue { $foregroundColor = [System.ConsoleColor]::Red $backgroundColor = [System.ConsoleColor]::Black } - } else { + } + else { $foregroundColor = $host.PrivateData.WarningForegroundColor $backgroundColor = $host.PrivateData.WarningBackgroundColor if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh index 6cd0a3400e61..da5a7e6129eb 100755 --- a/eng/common/pipeline-logging-functions.sh +++ b/eng/common/pipeline-logging-functions.sh @@ -179,4 +179,28 @@ function Write-PipelinePrependPath { if [[ "$ci" == true ]]; then echo "##vso[task.prependpath]$prepend_path" fi -} \ No newline at end of file +} + +function Write-PipelineSetResult { + local result='' + local message='' + + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + case "$opt" in + -result|-r) + result=$2 + shift + ;; + -message|-m) + message=$2 + shift + ;; + esac + shift + done + + if [[ "$ci" == true ]]; then + echo "##vso[task.complete result=$result;]$message" + fi +} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index fc09059ffe43..bc8b66e29431 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -677,14 +677,23 @@ function MSBuild-Core() { $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { - Write-PipelineTelemetryError -Category 'Build' -Message 'Build failed.' + # We should not Write-PipelineTaskError here because that message shows up in the build summary + # The build already logged an error, that's the reason it failed. Producing an error here only adds noise. + Write-Host "Build failed with exit code $exitCode. Check errors above." -ForegroundColor Red $buildLog = GetMSBuildBinaryLogCommandLineArgument $args - if ($buildLog -ne $null) { + if ($null -ne $buildLog) { Write-Host "See log: $buildLog" -ForegroundColor DarkGray } - ExitWithExitCode $exitCode + if ($ci) { + Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed." + # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error + # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error + ExitWithExitCode 0 + } else { + ExitWithExitCode $exitCode + } } } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 87152724123b..0295dd9ff633 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -441,8 +441,17 @@ function MSBuild-Core { "$_InitializeBuildTool" "$@" || { local exit_code=$? - Write-PipelineTaskError "Build failed (exit code '$exit_code')." - ExitWithExitCode $exit_code + # We should not Write-PipelineTaskError here because that message shows up in the build summary + # The build already logged an error, that's the reason it failed. Producing an error here only adds noise. + echo "Build failed with exit code $exit_code. Check errors above." + if [[ "$ci" == "true" ]]; then + Write-PipelineSetResult -result "Failed" -message "msbuild execution failed." + # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error + # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error + ExitWithExitCode 0 + else + ExitWithExitCode $exit_code + fi } } diff --git a/global.json b/global.json index e88afa82f8cc..f3b7802dfa16 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20601.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20604.2" } } From 766c17750785f904ede281b9b5a21310e662d8e3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 8 Dec 2020 13:41:53 +0000 Subject: [PATCH 1257/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201208.12 (#892) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 01c66919985d..76bb7a8b890a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ffd1dec60e045e3262061b3cc5974aa789eecb25 + dff60c8eb20bbddcab6974c4ab8627b456954a31 diff --git a/eng/Versions.props b/eng/Versions.props index fcf8b5232f0c..8679b0cead6d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20607.4 + 3.9.0-3.20608.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From d6abf722667a4b027690b15ac9f2f2ece9c8e67b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 9 Dec 2020 13:45:55 +0000 Subject: [PATCH 1258/2702] Update dependencies from https://github.com/dotnet/arcade build 20201207.11 (#894) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/performance/microbenchmarks.proj | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 76bb7a8b890a..99ec8da0071f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - ea609b8e036359934332480de9336d98fcbb3f91 + ae4226e0521b46075925444f3d733e05ae74dc0d diff --git a/eng/common/performance/microbenchmarks.proj b/eng/common/performance/microbenchmarks.proj index 94b6efbc9297..318ca5f1b8d4 100644 --- a/eng/common/performance/microbenchmarks.proj +++ b/eng/common/performance/microbenchmarks.proj @@ -141,4 +141,4 @@ 4:00 - \ No newline at end of file + diff --git a/global.json b/global.json index f3b7802dfa16..49064eda5a0d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20604.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20607.11" } } From b65cd06d46d5d143b284842a36d941a4828ed61d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 8 Dec 2020 15:28:40 -0800 Subject: [PATCH 1259/2702] Add unit test for code style fixer formatting --- src/Analyzers/AnalyzerFormatter.cs | 14 ++++ src/CodeFormatter.cs | 4 +- .../CodeStyleAnalyzerFormatterTests.cs | 57 +++++++++++++++++ tests/Formatters/AbstractFormatterTests.cs | 64 ++++++++----------- tests/Formatters/CSharpFormatterTests.cs | 3 + 5 files changed, 104 insertions(+), 38 deletions(-) create mode 100644 tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 2676e3a54928..07bed02a8cc9 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -16,6 +16,20 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers { internal class AnalyzerFormatter : ICodeFormatter { + public static AnalyzerFormatter CodeStyleFormatter => new AnalyzerFormatter( + Resources.Code_Style, + FixCategory.CodeStyle, + new CodeStyleInformationProvider(), + new AnalyzerRunner(), + new SolutionCodeFixApplier()); + + public static AnalyzerFormatter ThirdPartyFormatter => new AnalyzerFormatter( + Resources.Analyzer_Reference, + FixCategory.Analyzers, + new AnalyzerReferenceInformationProvider(), + new AnalyzerRunner(), + new SolutionCodeFixApplier()); + private readonly string _name; private readonly IAnalyzerInformationProvider _informationProvider; private readonly IAnalyzerRunner _runner; diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 86bace4ce854..e69e55dc043e 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -25,8 +25,8 @@ internal static class CodeFormatter new CharsetFormatter(), new OrganizeImportsFormatter(), new UnnecessaryImportsFormatter(), - new AnalyzerFormatter(Resources.Code_Style, FixCategory.CodeStyle, new CodeStyleInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier()), - new AnalyzerFormatter(Resources.Analyzer_Reference, FixCategory.Analyzers, new AnalyzerReferenceInformationProvider(), new AnalyzerRunner(), new SolutionCodeFixApplier())); + AnalyzerFormatter.CodeStyleFormatter, + AnalyzerFormatter.ThirdPartyFormatter); public static async Task FormatWorkspaceAsync( FormatOptions formatOptions, diff --git a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs new file mode 100644 index 000000000000..9cd2bdc2a013 --- /dev/null +++ b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Analyzers; +using Microsoft.CodeAnalysis.Tools.Formatters; +using Microsoft.CodeAnalysis.Tools.Tests.Formatters; +using Xunit; + +namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers +{ + public class CodeStyleAnalyzerFormatterTests : CSharpFormatterTests + { + private protected override ICodeFormatter Formatter => AnalyzerFormatter.CodeStyleFormatter; + + [Fact] + public async Task TestUseVarCodeStyle_AppliesWhenNotUsingVar() + { + var testCode = @" +using System.Collections.Generic; + +class C +{ + void M() + { + object obj = new object(); + List list = new List(); + int count = 5; + } +}"; + + var expectedCode = @" +using System.Collections.Generic; + +class C +{ + void M() + { + var obj = new object(); + var list = new List(); + var count = 5; + } +}"; + + var editorConfig = new Dictionary() + { + /// Prefer "var" everywhere + ["dotnet_diagnostic.IDE0007.severity"] = "error", + ["csharp_style_var_for_built_in_types"] = "true:error", + ["csharp_style_var_when_type_is_apparent"] = "true:error", + ["csharp_style_var_elsewhere"] = "true:error", + }; + + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.CodeStyle); + } + } +} diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 12949fd4e4ee..8d4e895dd371 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -9,7 +9,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Tools.Formatters; @@ -23,12 +22,6 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { public abstract class AbstractFormatterTest { - private static MetadataReference CorlibReference => MetadataReference.CreateFromFile(typeof(object).Assembly.Location).WithAliases(ImmutableArray.Create("global", "corlib")); - private static MetadataReference SystemReference => MetadataReference.CreateFromFile(typeof(System.Diagnostics.Debug).Assembly.Location).WithAliases(ImmutableArray.Create("global", "system")); - private static MetadataReference SystemCoreReference => MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location); - private static MetadataReference CodeAnalysisReference => MetadataReference.CreateFromFile(typeof(Compilation).Assembly.Location); - - private static MetadataReference SystemCollectionsImmutableReference => MetadataReference.CreateFromFile(typeof(ImmutableArray).Assembly.Location); private static MetadataReference MicrosoftVisualBasicReference => MetadataReference.CreateFromFile(typeof(Microsoft.VisualBasic.Strings).Assembly.Location); private static Lazy ExportProviderFactory { get; } @@ -49,6 +42,8 @@ static AbstractFormatterTest() LazyThreadSafetyMode.ExecutionAndPublication); } + protected virtual ReferenceAssemblies ReferenceAssemblies => ReferenceAssemblies.Default; + protected virtual string DefaultFilePathPrefix => "Test"; protected virtual string DefaultTestProjectName => "TestProject"; @@ -59,7 +54,7 @@ static AbstractFormatterTest() protected virtual string DefaultTestProjectPath => Path.Combine(DefaultFolderPath, $"{DefaultTestProjectName}.{DefaultFileExt}proj"); - protected virtual string DefaultEditorConfigPath => Path.Combine(DefaultFolderPath + ".editorconfig"); + protected virtual string DefaultEditorConfigPath => Path.Combine(DefaultFolderPath, ".editorconfig"); protected virtual string DefaultFilePath => Path.Combine(DefaultFolderPath, $"{DefaultFilePathPrefix}0.{DefaultFileExt}"); @@ -77,7 +72,7 @@ protected AbstractFormatterTest() /// public abstract string Language { get; } - private static ILogger Logger => new TestLogger(); + private static TestLogger Logger => new TestLogger(); public SolutionState TestState { get; } @@ -129,7 +124,7 @@ private protected async Task AssertCodeChangedAsync( var fileMatcher = SourceFileMatcher.CreateMatcher(new[] { document.FilePath }, exclude: Array.Empty()); var formatOptions = new FormatOptions( workspaceFilePath: project.FilePath, - workspaceType: WorkspaceType.Folder, + workspaceType: WorkspaceType.Solution, logLevel: LogLevel.Trace, fixCategory, codeStyleSeverity, @@ -174,12 +169,6 @@ private protected async Task AssertCodeChangedAsync( /// public Dictionary XmlReferences { get; } = new Dictionary(); - /// - /// Gets a collection of transformation functions to apply to during diagnostic - /// or code fix test setup. - /// - public List> OptionsTransforms { get; } = new List>(); - /// /// Given an array of strings as sources and a language, turn them into a and return the /// solution. @@ -252,7 +241,7 @@ protected virtual Project CreateProjectImpl((string filename, SourceText content { (var newFileName, var source) = sources[i]; var documentId = DocumentId.CreateNewId(projectId, debugName: newFileName); - solution = solution.AddDocument(documentId, newFileName, source, filePath: Path.Combine(DefaultTestProjectPath, newFileName)); + solution = solution.AddDocument(documentId, newFileName, source, filePath: Path.Combine(DefaultFolderPath, newFileName)); } for (var i = 0; i < additionalFiles.Length; i++) @@ -274,15 +263,18 @@ protected virtual Project CreateProjectImpl((string filename, SourceText content /// The created solution. protected virtual Solution CreateSolution(ProjectId projectId, string language, SourceText editorConfigText) { - var compilationOptions = CreateCompilationOptions(); - var xmlReferenceResolver = new TestXmlReferenceResolver(); foreach (var xmlReference in XmlReferences) { xmlReferenceResolver.XmlReferences.Add(xmlReference.Key, xmlReference.Value); } - compilationOptions = compilationOptions.WithXmlReferenceResolver(xmlReferenceResolver); + var compilationOptions = CreateCompilationOptions() + .WithXmlReferenceResolver(xmlReferenceResolver) + .WithAssemblyIdentityComparer(ReferenceAssemblies.AssemblyIdentityComparer); + + var parseOptions = CreateParseOptions(); + var referenceAssemblies = ReferenceAssemblies.ResolveAsync(language, CancellationToken.None).GetAwaiter().GetResult(); var editorConfigDocument = DocumentInfo.Create( DocumentId.CreateNewId(projectId, DefaultEditorConfigPath), @@ -290,32 +282,30 @@ protected virtual Solution CreateSolution(ProjectId projectId, string language, loader: TextLoader.From(TextAndVersion.Create(editorConfigText, VersionStamp.Create())), filePath: DefaultEditorConfigPath); - var projectInfo = ProjectInfo.Create(projectId, VersionStamp.Create(), DefaultTestProjectName, DefaultTestProjectName, language, filePath: DefaultTestProjectPath) + var projectInfo = ProjectInfo.Create( + projectId, + VersionStamp.Create(), + name: DefaultTestProjectName, + assemblyName: DefaultTestProjectName, + language, + filePath: DefaultTestProjectPath, + outputFilePath: Path.ChangeExtension(DefaultTestProjectPath, "dll"), + compilationOptions: compilationOptions, + parseOptions: parseOptions, + metadataReferences: referenceAssemblies, + isSubmission: false) + .WithDefaultNamespace(DefaultTestProjectName) .WithAnalyzerConfigDocuments(ImmutableArray.Create(editorConfigDocument)); var solution = CreateWorkspace() .CurrentSolution - .AddProject(projectInfo) - .WithProjectCompilationOptions(projectId, compilationOptions) - .AddMetadataReference(projectId, CorlibReference) - .AddMetadataReference(projectId, SystemReference) - .AddMetadataReference(projectId, SystemCoreReference) - .AddMetadataReference(projectId, CodeAnalysisReference) - .AddMetadataReference(projectId, SystemCollectionsImmutableReference); + .AddProject(projectInfo); if (language == LanguageNames.VisualBasic) { solution = solution.AddMetadataReference(projectId, MicrosoftVisualBasicReference); } - foreach (var transform in OptionsTransforms) - { - solution.Workspace.TryApplyChanges(solution.WithOptions(transform(solution.Workspace.Options))); - } - - var parseOptions = solution.GetProject(projectId).ParseOptions; - solution = solution.WithProjectParseOptions(projectId, parseOptions.WithDocumentationMode(DocumentationMode.Diagnose)); - return solution; } @@ -327,5 +317,7 @@ public virtual AdhocWorkspace CreateWorkspace() } protected abstract CompilationOptions CreateCompilationOptions(); + + protected abstract ParseOptions CreateParseOptions(); } } diff --git a/tests/Formatters/CSharpFormatterTests.cs b/tests/Formatters/CSharpFormatterTests.cs index 255a0422b245..1c77af21c078 100644 --- a/tests/Formatters/CSharpFormatterTests.cs +++ b/tests/Formatters/CSharpFormatterTests.cs @@ -12,5 +12,8 @@ public abstract class CSharpFormatterTests : AbstractFormatterTest protected override CompilationOptions CreateCompilationOptions() => new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary, allowUnsafe: true); + + protected override ParseOptions CreateParseOptions() + => new CSharpParseOptions(LanguageVersion.Default, DocumentationMode.Diagnose); } } From 589aa8abec174467aa0b6efc79e2eb2316cf80ef Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 9 Dec 2020 13:01:46 -0800 Subject: [PATCH 1260/2702] Always specify .NETStandard 2.0 references --- tests/Analyzers/FilterDiagnosticsTests.cs | 8 ++++---- tests/Formatters/AbstractFormatterTests.cs | 24 +++++++++++----------- tests/Formatters/FormattedFilesTests.cs | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs index f504014376d8..00c5c8852416 100644 --- a/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -19,7 +19,7 @@ public class FilterDiagnosticsTests : CSharpFormatterTests [Fact] public async Task TestFilterWarning() { - var solution = GetSolution(); + var solution = await GetSolutionAsync(); var projectAnalyzersAndFixers = await GetProjectAnalyzersAndFixersAsync(solution); var project = solution.Projects.First(); var formattablePaths = ImmutableHashSet.Create(project.Documents.First().FilePath); @@ -37,7 +37,7 @@ public async Task TestFilterWarning() [Fact] public async Task TestFilterError() { - var solution = GetSolution(); + var solution = await GetSolutionAsync(); var projectAnalyzersAndFixers = await GetProjectAnalyzersAndFixersAsync(solution); var project = solution.Projects.First(); var formattablePaths = ImmutableHashSet.Create(project.Documents.First().FilePath); @@ -64,12 +64,12 @@ await GenerateAssemblyAsync( return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); } - private Solution GetSolution() + private Task GetSolutionAsync() { var text = SourceText.From(""); TestState.Sources.Add(text); - return GetSolution( + return GetSolutionAsync( TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 8d4e895dd371..bc5551fa7928 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -42,7 +42,7 @@ static AbstractFormatterTest() LazyThreadSafetyMode.ExecutionAndPublication); } - protected virtual ReferenceAssemblies ReferenceAssemblies => ReferenceAssemblies.Default; + protected virtual ReferenceAssemblies ReferenceAssemblies => ReferenceAssemblies.NetStandard.NetStandard20; protected virtual string DefaultFilePathPrefix => "Test"; @@ -117,7 +117,7 @@ private protected async Task AssertCodeChangedAsync( var text = SourceText.From(testCode, encoding ?? Encoding.UTF8); TestState.Sources.Add(text); - var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), editorConfig); + var solution = await GetSolutionAsync(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), editorConfig); var project = solution.Projects.Single(); var document = project.Documents.Single(); @@ -178,9 +178,9 @@ private protected async Task AssertCodeChangedAsync( /// Additional metadata references to include in the project. /// The .editorconfig to apply to this solution. /// A solution containing a project with the specified sources and additional files. - private protected Solution GetSolution((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, IReadOnlyDictionary editorConfig) + private protected async Task GetSolutionAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, IReadOnlyDictionary editorConfig) { - return GetSolution(sources, additionalFiles, additionalMetadataReferences, ToEditorConfig(editorConfig)); + return await GetSolutionAsync(sources, additionalFiles, additionalMetadataReferences, ToEditorConfig(editorConfig)); } /// @@ -192,9 +192,9 @@ private protected Solution GetSolution((string filename, SourceText content)[] s /// Additional metadata references to include in the project. /// The .editorconfig to apply to this solution. /// A solution containing a project with the specified sources and additional files. - private protected Solution GetSolution((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string editorConfig) + private protected async Task GetSolutionAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string editorConfig) { - var project = CreateProject(sources, additionalFiles, additionalMetadataReferences, Language, SourceText.From(editorConfig, Encoding.UTF8)); + var project = await CreateProjectAsync(sources, additionalFiles, additionalMetadataReferences, Language, SourceText.From(editorConfig, Encoding.UTF8)); return project.Solution; } @@ -213,10 +213,10 @@ private protected Solution GetSolution((string filename, SourceText content)[] s /// The .editorconfig to apply to this project. /// A created out of the s created from the source /// strings. - protected Project CreateProject((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language, SourceText editorConfigText) + protected async Task CreateProjectAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language, SourceText editorConfigText) { language ??= Language; - return CreateProjectImpl(sources, additionalFiles, additionalMetadataReferences, language, editorConfigText); + return await CreateProjectImplAsync(sources, additionalFiles, additionalMetadataReferences, language, editorConfigText); } /// @@ -230,10 +230,10 @@ protected Project CreateProject((string filename, SourceText content)[] sources, /// The .editorconfig to apply to this project. /// A created out of the s created from the source /// strings. - protected virtual Project CreateProjectImpl((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language, SourceText editorConfigText) + protected virtual async Task CreateProjectImplAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language, SourceText editorConfigText) { var projectId = ProjectId.CreateNewId(debugName: DefaultTestProjectName); - var solution = CreateSolution(projectId, language, editorConfigText); + var solution = await CreateSolutionAsync(projectId, language, editorConfigText); solution = solution.AddMetadataReferences(projectId, additionalMetadataReferences); @@ -261,7 +261,7 @@ protected virtual Project CreateProjectImpl((string filename, SourceText content /// The language for which the solution is being created. /// The .editorconfig to apply to this solution. /// The created solution. - protected virtual Solution CreateSolution(ProjectId projectId, string language, SourceText editorConfigText) + protected virtual async Task CreateSolutionAsync(ProjectId projectId, string language, SourceText editorConfigText) { var xmlReferenceResolver = new TestXmlReferenceResolver(); foreach (var xmlReference in XmlReferences) @@ -274,7 +274,7 @@ protected virtual Solution CreateSolution(ProjectId projectId, string language, .WithAssemblyIdentityComparer(ReferenceAssemblies.AssemblyIdentityComparer); var parseOptions = CreateParseOptions(); - var referenceAssemblies = ReferenceAssemblies.ResolveAsync(language, CancellationToken.None).GetAwaiter().GetResult(); + var referenceAssemblies = await ReferenceAssemblies.ResolveAsync(language, CancellationToken.None); var editorConfigDocument = DocumentInfo.Create( DocumentId.CreateNewId(projectId, DefaultEditorConfigPath), diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index 2f0c1ac4a436..eec4c2482ab0 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -49,7 +49,7 @@ private async Task> TestFormattedFiles(string testCode) var text = SourceText.From(testCode, Encoding.UTF8); TestState.Sources.Add(text); - var solution = GetSolution(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), EditorConfig); + var solution = await GetSolutionAsync(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), EditorConfig); var project = solution.Projects.Single(); var document = project.Documents.Single(); From dbc1651d14de99d10bb662a4927eb661f5475ad7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 10 Dec 2020 13:56:17 +0000 Subject: [PATCH 1261/2702] Update dependencies from https://github.com/dotnet/arcade build 20201208.21 (#895) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/performance/microbenchmarks.proj | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 99ec8da0071f..c23c25f64b25 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - ae4226e0521b46075925444f3d733e05ae74dc0d + b984ce874f048ec28e1067e9f47bdb183682df46 diff --git a/eng/common/performance/microbenchmarks.proj b/eng/common/performance/microbenchmarks.proj index 318ca5f1b8d4..94b6efbc9297 100644 --- a/eng/common/performance/microbenchmarks.proj +++ b/eng/common/performance/microbenchmarks.proj @@ -141,4 +141,4 @@ 4:00 - + \ No newline at end of file diff --git a/global.json b/global.json index 49064eda5a0d..06304e5f3bdc 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20607.11" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20608.21" } } From eec63a8d2feaa5e119ffe09b5dfb4d2b670e1707 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 10 Dec 2020 17:10:01 -0800 Subject: [PATCH 1262/2702] Add a lock around loading a MSBuild workspace --- src/Workspaces/MSBuildWorkspaceLoader.cs | 52 +++++++++++++++--------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/src/Workspaces/MSBuildWorkspaceLoader.cs b/src/Workspaces/MSBuildWorkspaceLoader.cs index 82dcce883f3f..fa91d1124b1f 100644 --- a/src/Workspaces/MSBuildWorkspaceLoader.cs +++ b/src/Workspaces/MSBuildWorkspaceLoader.cs @@ -13,6 +13,8 @@ namespace Microsoft.CodeAnalysis.Tools.Workspaces { internal static class MSBuildWorkspaceLoader { + private static readonly SemaphoreSlim s_guard = new SemaphoreSlim(1, 1); + public static async Task LoadAsync( string solutionOrProjectPath, WorkspaceType workspaceType, @@ -29,35 +31,45 @@ internal static class MSBuildWorkspaceLoader { "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, }; - var workspace = MSBuildWorkspace.Create(properties); + MSBuildWorkspace workspace; - Build.Framework.ILogger? binlog = null; - if (createBinaryLog) + await s_guard.WaitAsync(); + try { - binlog = new Build.Logging.BinaryLogger() + workspace = MSBuildWorkspace.Create(properties); + + Build.Framework.ILogger? binlog = null; + if (createBinaryLog) { - Parameters = Path.Combine(Environment.CurrentDirectory, "formatDiagnosticLog.binlog"), - Verbosity = Build.Framework.LoggerVerbosity.Diagnostic, - }; - } + binlog = new Build.Logging.BinaryLogger() + { + Parameters = Path.Combine(Environment.CurrentDirectory, "formatDiagnosticLog.binlog"), + Verbosity = Build.Framework.LoggerVerbosity.Diagnostic, + }; + } - if (workspaceType == WorkspaceType.Solution) - { - await workspace.OpenSolutionAsync(solutionOrProjectPath, msbuildLogger: binlog, cancellationToken: cancellationToken).ConfigureAwait(false); - } - else - { - try + if (workspaceType == WorkspaceType.Solution) { - await workspace.OpenProjectAsync(solutionOrProjectPath, msbuildLogger: binlog, cancellationToken: cancellationToken).ConfigureAwait(false); + await workspace.OpenSolutionAsync(solutionOrProjectPath, msbuildLogger: binlog, cancellationToken: cancellationToken).ConfigureAwait(false); } - catch (InvalidOperationException) + else { - logger.LogError(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, solutionOrProjectPath); - workspace.Dispose(); - return null; + try + { + await workspace.OpenProjectAsync(solutionOrProjectPath, msbuildLogger: binlog, cancellationToken: cancellationToken).ConfigureAwait(false); + } + catch (InvalidOperationException) + { + logger.LogError(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, solutionOrProjectPath); + workspace.Dispose(); + return null; + } } } + finally + { + s_guard.Release(); + } LogWorkspaceDiagnostics(logger, logWorkspaceWarnings, workspace.Diagnostics); From cf045dcdfd587cee742a54776133fe1aa386d748 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 10 Dec 2020 17:11:19 -0800 Subject: [PATCH 1263/2702] Extract out a nuget restore helper --- tests/CodeFormatterTests.cs | 24 ++++++------------------ tests/Utilities/NuGetHelper.cs | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 tests/Utilities/NuGetHelper.cs diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index d28fd083f668..b93c7e0de18c 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.IO; @@ -412,7 +412,7 @@ await TestFormatWorkspaceAsync( [Fact] public async Task NoFilesFormattedInCodeStyleSolution_WhenNotFixingCodeStyle() { - var restoreExitCode = await PerformNuGetRestore(s_codeStyleSolutionFilePath); + var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilePath, _output); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( @@ -429,7 +429,7 @@ await TestFormatWorkspaceAsync( [Fact] public async Task NoFilesFormattedInCodeStyleSolution_WhenFixingCodeStyleErrors() { - var restoreExitCode = await PerformNuGetRestore(s_codeStyleSolutionFilePath); + var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilePath, _output); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( @@ -447,7 +447,7 @@ await TestFormatWorkspaceAsync( [Fact] public async Task FilesFormattedInCodeStyleSolution_WhenFixingCodeStyleWarnings() { - var restoreExitCode = await PerformNuGetRestore(s_codeStyleSolutionFilePath); + var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilePath, _output); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( @@ -465,7 +465,7 @@ await TestFormatWorkspaceAsync( [Fact] public async Task NoFilesFormattedInAnalyzersSolution_WhenNotFixingAnalyzers() { - var restoreExitCode = await PerformNuGetRestore(s_analyzersSolutionFilePath); + var restoreExitCode = await NuGetHelper.PerformRestore(s_analyzersSolutionFilePath, _output); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( @@ -482,7 +482,7 @@ await TestFormatWorkspaceAsync( [Fact] public async Task FilesFormattedInAnalyzersSolution_WhenFixingAnalyzerErrors() { - var restoreExitCode = await PerformNuGetRestore(s_analyzersSolutionFilePath); + var restoreExitCode = await NuGetHelper.PerformRestore(s_analyzersSolutionFilePath, _output); Assert.Equal(0, restoreExitCode); await TestFormatWorkspaceAsync( @@ -497,18 +497,6 @@ await TestFormatWorkspaceAsync( analyzerSeverity: DiagnosticSeverity.Error); } - internal async Task PerformNuGetRestore(string workspaceFilePath) - { - var workspacePath = Path.Combine(TestProjectsPathHelper.GetProjectsDirectory(), workspaceFilePath); - - var processInfo = ProcessRunner.CreateProcess("dotnet", $"restore \"{workspacePath}\"", captureOutput: true, displayWindow: false); - var restoreResult = await processInfo.Result; - - _output.WriteLine(string.Join(Environment.NewLine, restoreResult.OutputLines)); - - return restoreResult.ExitCode; - } - internal async Task TestFormatWorkspaceAsync( string workspaceFilePath, string[] include, diff --git a/tests/Utilities/NuGetHelper.cs b/tests/Utilities/NuGetHelper.cs new file mode 100644 index 000000000000..49c3e247e058 --- /dev/null +++ b/tests/Utilities/NuGetHelper.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.IO; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Utilities; +using Xunit.Abstractions; + +#nullable enable + +namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities +{ + internal static class NuGetHelper + { + public static async Task PerformRestore(string workspaceFilePath, ITestOutputHelper output) + { + var workspacePath = Path.Combine(TestProjectsPathHelper.GetProjectsDirectory(), workspaceFilePath); + + var processInfo = ProcessRunner.CreateProcess("dotnet", $"restore \"{workspacePath}\"", captureOutput: true, displayWindow: false); + var restoreResult = await processInfo.Result; + + output.WriteLine(string.Join(Environment.NewLine, restoreResult.OutputLines)); + + return restoreResult.ExitCode; + } + } +} From bc9060a9d41a37cbc6327357ecedce7029e65cf1 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 10 Dec 2020 17:12:12 -0800 Subject: [PATCH 1264/2702] Add a project to store analyzer package references --- .../analyzer_project/analyzer_project.csproj | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj diff --git a/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj b/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj new file mode 100644 index 000000000000..5f0d40f60ce9 --- /dev/null +++ b/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj @@ -0,0 +1,14 @@ + + + + netstandard2.0 + + + + + all + runtime; build; native; contentfiles; analyzers + + + + From b78dcd9786c4a25cafa4482697c256eb4db725b9 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 10 Dec 2020 17:13:26 -0800 Subject: [PATCH 1265/2702] Add ability to add AnalyzerReferences during test formatting --- tests/Formatters/AbstractFormatterTests.cs | 64 ++++++++++++++-------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index bc5551fa7928..49a0f49f822b 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; @@ -17,6 +18,9 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.Composition; using Xunit; +using Xunit.Abstractions; + +#nullable enable namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { @@ -62,6 +66,8 @@ static AbstractFormatterTest() private protected abstract ICodeFormatter Formatter { get; } + protected ITestOutputHelper? TestOutputHelper { get; set; } + protected AbstractFormatterTest() { TestState = new SolutionState(DefaultFilePathPrefix, DefaultFileExt); @@ -72,8 +78,6 @@ protected AbstractFormatterTest() /// public abstract string Language { get; } - private static TestLogger Logger => new TestLogger(); - public SolutionState TestState { get; } private protected string ToEditorConfig(IReadOnlyDictionary editorConfig) => $@"root = true @@ -85,45 +89,48 @@ private protected string ToEditorConfig(IReadOnlyDictionary edit private protected Task AssertCodeUnchangedAsync( string code, IReadOnlyDictionary editorConfig, - Encoding encoding = null, + Encoding? encoding = null, FixCategory fixCategory = FixCategory.Whitespace, + IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { - return AssertCodeChangedAsync(code, code, ToEditorConfig(editorConfig), encoding, fixCategory, codeStyleSeverity, analyzerSeverity); + return AssertCodeChangedAsync(code, code, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); } private protected Task AssertCodeChangedAsync( string testCode, string expectedCode, IReadOnlyDictionary editorConfig, - Encoding encoding = null, + Encoding? encoding = null, FixCategory fixCategory = FixCategory.Whitespace, + IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { - return AssertCodeChangedAsync(testCode, expectedCode, ToEditorConfig(editorConfig), encoding, fixCategory, codeStyleSeverity, analyzerSeverity); + return AssertCodeChangedAsync(testCode, expectedCode, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); } private protected async Task AssertCodeChangedAsync( string testCode, string expectedCode, string editorConfig, - Encoding encoding = null, + Encoding? encoding = null, FixCategory fixCategory = FixCategory.Whitespace, + IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { var text = SourceText.From(testCode, encoding ?? Encoding.UTF8); TestState.Sources.Add(text); - var solution = await GetSolutionAsync(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), editorConfig); + var solution = await GetSolutionAsync(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), editorConfig, analyzerReferences); var project = solution.Projects.Single(); var document = project.Documents.Single(); - var fileMatcher = SourceFileMatcher.CreateMatcher(new[] { document.FilePath }, exclude: Array.Empty()); + var fileMatcher = SourceFileMatcher.CreateMatcher(new[] { document.FilePath! }, exclude: Array.Empty()); var formatOptions = new FormatOptions( - workspaceFilePath: project.FilePath, + workspaceFilePath: project.FilePath!, workspaceType: WorkspaceType.Solution, logLevel: LogLevel.Trace, fixCategory, @@ -137,11 +144,21 @@ private protected async Task AssertCodeChangedAsync( var pathsToFormat = GetOnlyFileToFormat(solution); - var formattedSolution = await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, Logger, new List(), default); + var logger = new TestLogger(); + + var formattedSolution = await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, logger, new List(), default); var formattedDocument = GetOnlyDocument(formattedSolution); var formattedText = await formattedDocument.GetTextAsync(); - Assert.Equal(expectedCode, formattedText.ToString()); + try + { + Assert.Equal(expectedCode, formattedText.ToString()); + } + catch + { + TestOutputHelper?.WriteLine(logger.GetLog()); + throw; + } return formattedText; } @@ -178,9 +195,9 @@ private protected async Task AssertCodeChangedAsync( /// Additional metadata references to include in the project. /// The .editorconfig to apply to this solution. /// A solution containing a project with the specified sources and additional files. - private protected async Task GetSolutionAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, IReadOnlyDictionary editorConfig) + private protected async Task GetSolutionAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, IReadOnlyDictionary editorConfig, IEnumerable? analyzerReferences = null) { - return await GetSolutionAsync(sources, additionalFiles, additionalMetadataReferences, ToEditorConfig(editorConfig)); + return await GetSolutionAsync(sources, additionalFiles, additionalMetadataReferences, ToEditorConfig(editorConfig), analyzerReferences); } /// @@ -192,9 +209,10 @@ private protected async Task GetSolutionAsync((string filename, Source /// Additional metadata references to include in the project. /// The .editorconfig to apply to this solution. /// A solution containing a project with the specified sources and additional files. - private protected async Task GetSolutionAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string editorConfig) + private protected async Task GetSolutionAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string editorConfig, IEnumerable? analyzerReferences = null) { - var project = await CreateProjectAsync(sources, additionalFiles, additionalMetadataReferences, Language, SourceText.From(editorConfig, Encoding.UTF8)); + analyzerReferences ??= Enumerable.Empty(); + var project = await CreateProjectAsync(sources, additionalFiles, additionalMetadataReferences, analyzerReferences, Language, SourceText.From(editorConfig, Encoding.UTF8)); return project.Solution; } @@ -213,10 +231,10 @@ private protected async Task GetSolutionAsync((string filename, Source /// The .editorconfig to apply to this project. /// A created out of the s created from the source /// strings. - protected async Task CreateProjectAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language, SourceText editorConfigText) + protected async Task CreateProjectAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, IEnumerable analyzerReferences, string language, SourceText editorConfigText) { language ??= Language; - return await CreateProjectImplAsync(sources, additionalFiles, additionalMetadataReferences, language, editorConfigText); + return await CreateProjectImplAsync(sources, additionalFiles, additionalMetadataReferences, analyzerReferences, language, editorConfigText); } /// @@ -230,12 +248,12 @@ protected async Task CreateProjectAsync((string filename, SourceText co /// The .editorconfig to apply to this project. /// A created out of the s created from the source /// strings. - protected virtual async Task CreateProjectImplAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, string language, SourceText editorConfigText) + protected virtual async Task CreateProjectImplAsync((string filename, SourceText content)[] sources, (string filename, SourceText content)[] additionalFiles, MetadataReference[] additionalMetadataReferences, IEnumerable analyzerReferences, string language, SourceText editorConfigText) { var projectId = ProjectId.CreateNewId(debugName: DefaultTestProjectName); - var solution = await CreateSolutionAsync(projectId, language, editorConfigText); - - solution = solution.AddMetadataReferences(projectId, additionalMetadataReferences); + var solution = (await CreateSolutionAsync(projectId, language, editorConfigText)) + .AddAnalyzerReferences(projectId, analyzerReferences) + .AddMetadataReferences(projectId, additionalMetadataReferences); for (var i = 0; i < sources.Length; i++) { @@ -251,7 +269,7 @@ protected virtual async Task CreateProjectImplAsync((string filename, S solution = solution.AddAdditionalDocument(documentId, newFileName, source); } - return solution.GetProject(projectId); + return solution.GetProject(projectId)!; } /// From 1fb7f29538453fa5566dfb748fb736f55b489986 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 10 Dec 2020 17:13:41 -0800 Subject: [PATCH 1266/2702] Add a 3rd party analyzer test class --- .../ThirdPartyAnalyzerFormatterTests.cs | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs diff --git a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs new file mode 100644 index 000000000000..7893f46d033e --- /dev/null +++ b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Tools.Analyzers; +using Microsoft.CodeAnalysis.Tools.Formatters; +using Microsoft.CodeAnalysis.Tools.Tests.Formatters; +using Microsoft.CodeAnalysis.Tools.Tests.Utilities; +using Microsoft.CodeAnalysis.Tools.Workspaces; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers +{ + public class ThirdPartyAnalyzerFormatterTests : CSharpFormatterTests, IAsyncLifetime + { + private static readonly string s_analyzerProjectFilePath = Path.Combine("for_analyzer_formatter", "analyzer_project", "analyzer_project.csproj"); + + private protected override ICodeFormatter Formatter => AnalyzerFormatter.ThirdPartyFormatter; + + private Project _analyzerReferencesProject; + + public ThirdPartyAnalyzerFormatterTests(ITestOutputHelper output) + { + TestOutputHelper = output; + } + + public async Task InitializeAsync() + { + var logger = new TestLogger(); + + try + { + // Restore the Analyzer packages that have been added to `for_analyzer_formatter/analyzer_project/analyzer_project.csproj` + var exitCode = await NuGetHelper.PerformRestore(s_analyzerProjectFilePath, TestOutputHelper); + Assert.Equal(0, exitCode); + + // Load the analyzer_project into a MSBuildWorkspace. + var workspacePath = Path.Combine(TestProjectsPathHelper.GetProjectsDirectory(), s_analyzerProjectFilePath); + + MSBuildRegistrar.RegisterInstance(logger); + var analyzerWorkspace = await MSBuildWorkspaceLoader.LoadAsync(workspacePath, WorkspaceType.Project, createBinaryLog: false, logWorkspaceWarnings: true, logger, CancellationToken.None); + + // From this project we can get valid AnalyzerReferences to add to our test project. + _analyzerReferencesProject = analyzerWorkspace.CurrentSolution.Projects.Single(); + } + catch + { + TestOutputHelper.WriteLine(logger.GetLog()); + throw; + } + } + + public Task DisposeAsync() + { + _analyzerReferencesProject = null; + + return Task.CompletedTask; + } + + private IEnumerable GetAnalyzerReferences(string prefix) + => _analyzerReferencesProject.AnalyzerReferences.Where(reference => reference.Display.StartsWith(prefix)); + + [Fact] + public async Task TestStyleCopBlankLineFixer_RemovesUnnecessaryBlankLines() + { + var analyzerReferences = GetAnalyzerReferences("StyleCop"); + + var testCode = @" +class C +{ + + void M() + + { + + object obj = new object(); + + + int count = 5; + + } + +} +"; + + var expectedCode = @" +class C +{ + void M() + { + object obj = new object(); + + int count = 5; + } +} +"; + + var editorConfig = new Dictionary() + { + // Turn off all diagnostics analyzers + ["dotnet_analyzer_diagnostic.severity"] = "none", + + // Two or more consecutive blank lines: Remove down to one blank line. SA1507 + ["dotnet_diagnostic.SA1507.severity"] = "error", + + // Blank line immediately before or after a { line: remove it. SA1505, SA1509 + ["dotnet_diagnostic.SA1505.severity"] = "error", + ["dotnet_diagnostic.SA1509.severity"] = "error", + + // Blank line immediately before a } line: remove it. SA1508 + ["dotnet_diagnostic.SA1508.severity"] = "error", + }; + + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Analyzers, analyzerReferences: analyzerReferences); + } + } +} From e3d2ce157afdfdfbebd422dee069ad2dd72bef70 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 10 Dec 2020 17:14:02 -0800 Subject: [PATCH 1267/2702] Enhance other tests to log the formatter output on failure --- .../CodeStyleAnalyzerFormatterTests.cs | 6 ++++++ tests/CodeFormatterTests.cs | 17 ++++++++++++----- tests/Formatters/CharsetFormatterTests.cs | 6 ++++++ tests/Formatters/EndOfLineFormatterTests.cs | 6 ++++++ tests/Formatters/FinalNewlineFormatterTests.cs | 6 ++++++ tests/Formatters/FormattedFilesTests.cs | 6 ++++++ .../Formatters/OrganizeImportsFormatterTests.cs | 6 ++++++ .../UnnecessaryImportsFormatterTests.cs | 6 ++++++ 8 files changed, 54 insertions(+), 5 deletions(-) diff --git a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs index 9cd2bdc2a013..1dbf7d60201d 100644 --- a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs +++ b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs @@ -6,6 +6,7 @@ using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Tests.Formatters; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers { @@ -13,6 +14,11 @@ public class CodeStyleAnalyzerFormatterTests : CSharpFormatterTests { private protected override ICodeFormatter Formatter => AnalyzerFormatter.CodeStyleFormatter; + public CodeStyleAnalyzerFormatterTests(ITestOutputHelper output) + { + TestOutputHelper = output; + } + [Fact] public async Task TestUseVarCodeStyle_AppliesWhenNotUsingVar() { diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index b93c7e0de18c..5964ced988c9 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.IO; @@ -549,11 +549,18 @@ internal async Task TestFormatWorkspaceAsync( Environment.CurrentDirectory = currentDirectory; var log = logger.GetLog(); - _output.WriteLine(log); - Assert.Equal(expectedExitCode, formatResult.ExitCode); - Assert.Equal(expectedFilesFormatted, formatResult.FilesFormatted); - Assert.Equal(expectedFileCount, formatResult.FileCount); + try + { + Assert.Equal(expectedExitCode, formatResult.ExitCode); + Assert.Equal(expectedFilesFormatted, formatResult.FilesFormatted); + Assert.Equal(expectedFileCount, formatResult.FileCount); + } + catch + { + _output.WriteLine(log); + throw; + } return log; } diff --git a/tests/Formatters/CharsetFormatterTests.cs b/tests/Formatters/CharsetFormatterTests.cs index 96bb2ff0c276..4585df758c26 100644 --- a/tests/Formatters/CharsetFormatterTests.cs +++ b/tests/Formatters/CharsetFormatterTests.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Formatters; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { @@ -12,6 +13,11 @@ public class CharsetFormatterTests : CSharpFormatterTests { private protected override ICodeFormatter Formatter => new CharsetFormatter(); + public CharsetFormatterTests(ITestOutputHelper output) + { + TestOutputHelper = output; + } + [Theory] [InlineData("latin1", "utf-8")] [InlineData("latin1", "utf-8-bom")] diff --git a/tests/Formatters/EndOfLineFormatterTests.cs b/tests/Formatters/EndOfLineFormatterTests.cs index df06638c1fe3..9420350049d1 100644 --- a/tests/Formatters/EndOfLineFormatterTests.cs +++ b/tests/Formatters/EndOfLineFormatterTests.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Formatters; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { @@ -11,6 +12,11 @@ public class EndOfLineFormatterTests : CSharpFormatterTests { private protected override ICodeFormatter Formatter => new EndOfLineFormatter(); + public EndOfLineFormatterTests(ITestOutputHelper output) + { + TestOutputHelper = output; + } + [Theory] [InlineData("\n", "\n", "lf")] [InlineData("\r\n", "\n", "lf")] diff --git a/tests/Formatters/FinalNewlineFormatterTests.cs b/tests/Formatters/FinalNewlineFormatterTests.cs index a305c545d038..c085db615751 100644 --- a/tests/Formatters/FinalNewlineFormatterTests.cs +++ b/tests/Formatters/FinalNewlineFormatterTests.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Formatters; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { @@ -11,6 +12,11 @@ public class FinalNewlineFormatterTests : CSharpFormatterTests { private protected override ICodeFormatter Formatter => new FinalNewlineFormatter(); + public FinalNewlineFormatterTests(ITestOutputHelper output) + { + TestOutputHelper = output; + } + [Fact] public async Task WhenFinalNewlineUnspecified_AndFinalNewlineMissing_NoChange() { diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index eec4c2482ab0..ddf267a836a5 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { @@ -24,6 +25,11 @@ public class FormattedFilesTests : CSharpFormatterTests ["end_of_line"] = "lf", }; + public FormattedFilesTests(ITestOutputHelper output) + { + TestOutputHelper = output; + } + [Fact] public async Task ReturnsItem_WhenFileFormatted() { diff --git a/tests/Formatters/OrganizeImportsFormatterTests.cs b/tests/Formatters/OrganizeImportsFormatterTests.cs index b9a83dba4cae..407ee14484f6 100644 --- a/tests/Formatters/OrganizeImportsFormatterTests.cs +++ b/tests/Formatters/OrganizeImportsFormatterTests.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Formatters; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { @@ -12,6 +13,11 @@ public class OrganizeImportsFormatterTests : CSharpFormatterTests { private protected override ICodeFormatter Formatter => new OrganizeImportsFormatter(); + public OrganizeImportsFormatterTests(ITestOutputHelper output) + { + TestOutputHelper = output; + } + [Fact] public async Task WhenOptionsDisabled_AndImportsNotSorted_ImportsSorted() { diff --git a/tests/Formatters/UnnecessaryImportsFormatterTests.cs b/tests/Formatters/UnnecessaryImportsFormatterTests.cs index 2a69c43d460a..66b33e088ce7 100644 --- a/tests/Formatters/UnnecessaryImportsFormatterTests.cs +++ b/tests/Formatters/UnnecessaryImportsFormatterTests.cs @@ -5,6 +5,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Tools.Formatters; using Xunit; +using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Tools.Tests.Formatters { @@ -17,6 +18,11 @@ public class UnnecessaryImportsFormatterTests : CSharpFormatterTests private protected override ICodeFormatter Formatter => new UnnecessaryImportsFormatter(); + public UnnecessaryImportsFormatterTests(ITestOutputHelper output) + { + TestOutputHelper = output; + } + [Fact] public async Task WhenNotFixingCodeSyle_AndHasUnusedImports_NoChange() { From a5387a9d06fb430a76550c00d05fb7dada76eb32 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 10 Dec 2020 17:20:55 -0800 Subject: [PATCH 1268/2702] Fix file encoding --- tests/Utilities/NuGetHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Utilities/NuGetHelper.cs b/tests/Utilities/NuGetHelper.cs index 49c3e247e058..8e6817ccbabe 100644 --- a/tests/Utilities/NuGetHelper.cs +++ b/tests/Utilities/NuGetHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.IO; From fc78a3709e3a75fc4d8f4a8179f4f83b6d94d60b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 11 Dec 2020 13:40:39 +0000 Subject: [PATCH 1269/2702] Update dependencies from https://github.com/dotnet/arcade build 20201209.9 (#897) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/post-build/post-build-utils.ps1 | 6 +++--- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c23c25f64b25..bac309349478 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - b984ce874f048ec28e1067e9f47bdb183682df46 + 66c6b1b53965afd8ee5695a36b1909d006ae98af diff --git a/eng/common/post-build/post-build-utils.ps1 b/eng/common/post-build/post-build-utils.ps1 index 7d49744795f6..534f6988d5b7 100644 --- a/eng/common/post-build/post-build-utils.ps1 +++ b/eng/common/post-build/post-build-utils.ps1 @@ -69,9 +69,9 @@ function Trigger-Subscription([string]$SubscriptionId) { function Validate-MaestroVars { try { - Get-Variable MaestroApiEndPoint -Scope Global | Out-Null - Get-Variable MaestroApiVersion -Scope Global | Out-Null - Get-Variable MaestroApiAccessToken -Scope Global | Out-Null + Get-Variable MaestroApiEndPoint | Out-Null + Get-Variable MaestroApiVersion | Out-Null + Get-Variable MaestroApiAccessToken | Out-Null if (!($MaestroApiEndPoint -Match '^http[s]?://maestro-(int|prod).westus2.cloudapp.azure.com$')) { Write-PipelineTelemetryError -Category 'MaestroVars' -Message "MaestroApiEndPoint is not a valid Maestro URL. '$MaestroApiEndPoint'" diff --git a/global.json b/global.json index 06304e5f3bdc..4c7e8919f6f5 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20608.21" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20609.9" } } From e64743f28b77542767d589aa47f669eead1cc919 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 11 Dec 2020 13:42:10 +0000 Subject: [PATCH 1270/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201210.26 (#898) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bac309349478..09f2490741ab 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - dff60c8eb20bbddcab6974c4ab8627b456954a31 + 0bfe7ca4970a3ff3c8f126e53d9ca152a28f0188 diff --git a/eng/Versions.props b/eng/Versions.props index 8679b0cead6d..a3d7bc79e6e9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20608.12 + 3.9.0-3.20610.26 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 3334052a98717641d2c3a73f7103cfc1ac43320d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 11 Dec 2020 10:36:23 -0800 Subject: [PATCH 1271/2702] Add MSBuildFact for tests to lock around MSBuild invocations --- src/Workspaces/MSBuildWorkspaceLoader.cs | 75 +++++++++++-------- .../ThirdPartyAnalyzerFormatterTests.cs | 2 +- tests/CodeFormatterTests.cs | 53 ++++++------- tests/XUnit/MSBuildFactAttribute.cs | 16 ++++ tests/XUnit/MSBuildFactDiscoverer.cs | 32 ++++++++ tests/XUnit/MSBuildTestCase.cs | 75 +++++++++++++++++++ tests/XUnit/MSBuildTheoryAttribute.cs | 16 ++++ tests/XUnit/MSBuildTheoryDiscoverer.cs | 32 ++++++++ 8 files changed, 243 insertions(+), 58 deletions(-) create mode 100644 tests/XUnit/MSBuildFactAttribute.cs create mode 100644 tests/XUnit/MSBuildFactDiscoverer.cs create mode 100644 tests/XUnit/MSBuildTestCase.cs create mode 100644 tests/XUnit/MSBuildTheoryAttribute.cs create mode 100644 tests/XUnit/MSBuildTheoryDiscoverer.cs diff --git a/src/Workspaces/MSBuildWorkspaceLoader.cs b/src/Workspaces/MSBuildWorkspaceLoader.cs index fa91d1124b1f..97f0f7f1184a 100644 --- a/src/Workspaces/MSBuildWorkspaceLoader.cs +++ b/src/Workspaces/MSBuildWorkspaceLoader.cs @@ -13,7 +13,8 @@ namespace Microsoft.CodeAnalysis.Tools.Workspaces { internal static class MSBuildWorkspaceLoader { - private static readonly SemaphoreSlim s_guard = new SemaphoreSlim(1, 1); + // Used in tests for locking around MSBuild invocations + internal static readonly SemaphoreSlim Guard = new SemaphoreSlim(1, 1); public static async Task LoadAsync( string solutionOrProjectPath, @@ -31,45 +32,35 @@ internal static class MSBuildWorkspaceLoader { "AlwaysCompileMarkupFilesInSeparateDomain", bool.FalseString }, }; - MSBuildWorkspace workspace; + var workspace = MSBuildWorkspace.Create(properties); - await s_guard.WaitAsync(); - try + Build.Framework.ILogger? binlog = null; + if (createBinaryLog) { - workspace = MSBuildWorkspace.Create(properties); - - Build.Framework.ILogger? binlog = null; - if (createBinaryLog) + binlog = new Build.Logging.BinaryLogger() { - binlog = new Build.Logging.BinaryLogger() - { - Parameters = Path.Combine(Environment.CurrentDirectory, "formatDiagnosticLog.binlog"), - Verbosity = Build.Framework.LoggerVerbosity.Diagnostic, - }; - } + Parameters = Path.Combine(Environment.CurrentDirectory, "formatDiagnosticLog.binlog"), + Verbosity = Build.Framework.LoggerVerbosity.Diagnostic, + }; + } - if (workspaceType == WorkspaceType.Solution) + if (workspaceType == WorkspaceType.Solution) + { + await workspace.OpenSolutionAsync(solutionOrProjectPath, msbuildLogger: binlog, cancellationToken: cancellationToken).ConfigureAwait(false); + } + else + { + try { - await workspace.OpenSolutionAsync(solutionOrProjectPath, msbuildLogger: binlog, cancellationToken: cancellationToken).ConfigureAwait(false); + await workspace.OpenProjectAsync(solutionOrProjectPath, msbuildLogger: binlog, cancellationToken: cancellationToken).ConfigureAwait(false); } - else + catch (InvalidOperationException) { - try - { - await workspace.OpenProjectAsync(solutionOrProjectPath, msbuildLogger: binlog, cancellationToken: cancellationToken).ConfigureAwait(false); - } - catch (InvalidOperationException) - { - logger.LogError(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, solutionOrProjectPath); - workspace.Dispose(); - return null; - } + logger.LogError(Resources.Could_not_format_0_Format_currently_supports_only_CSharp_and_Visual_Basic_projects, solutionOrProjectPath); + workspace.Dispose(); + return null; } } - finally - { - s_guard.Release(); - } LogWorkspaceDiagnostics(logger, logWorkspaceWarnings, workspace.Diagnostics); @@ -100,5 +91,27 @@ static void LogWorkspaceDiagnostics(ILogger logger, bool logWorkspaceWarnings, I } } } + + /// + /// This is for use in tests so that MSBuild is only invoked serially + /// + internal static async Task LockedLoadAsync( + string solutionOrProjectPath, + WorkspaceType workspaceType, + bool createBinaryLog, + bool logWorkspaceWarnings, + ILogger logger, + CancellationToken cancellationToken) + { + await Guard.WaitAsync(); + try + { + return await LoadAsync(solutionOrProjectPath, workspaceType, createBinaryLog, logWorkspaceWarnings, logger, cancellationToken); + } + finally + { + Guard.Release(); + } + } } } diff --git a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs index 7893f46d033e..8fd7e5a1549d 100644 --- a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs +++ b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs @@ -43,7 +43,7 @@ public async Task InitializeAsync() var workspacePath = Path.Combine(TestProjectsPathHelper.GetProjectsDirectory(), s_analyzerProjectFilePath); MSBuildRegistrar.RegisterInstance(logger); - var analyzerWorkspace = await MSBuildWorkspaceLoader.LoadAsync(workspacePath, WorkspaceType.Project, createBinaryLog: false, logWorkspaceWarnings: true, logger, CancellationToken.None); + var analyzerWorkspace = await MSBuildWorkspaceLoader.LockedLoadAsync(workspacePath, WorkspaceType.Project, createBinaryLog: false, logWorkspaceWarnings: true, logger, CancellationToken.None); // From this project we can get valid AnalyzerReferences to add to our test project. _analyzerReferencesProject = analyzerWorkspace.CurrentSolution.Projects.Single(); diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 5964ced988c9..814f6cb274cb 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; +using Microsoft.CodeAnalysis.Tools.Tests.XUnit; using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; using Xunit; @@ -48,7 +49,7 @@ public CodeFormatterTests(ITestOutputHelper output) _output = output; } - [Fact] + [MSBuildFact] public async Task NoFilesFormattedInFormattedProject() { await TestFormatWorkspaceAsync( @@ -61,7 +62,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 3); } - [Fact] + [MSBuildFact] public async Task NoFilesFormattedInFormattedSolution() { await TestFormatWorkspaceAsync( @@ -74,7 +75,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 3); } - [Fact] + [MSBuildFact] public async Task FilesFormattedInUnformattedProject() { await TestFormatWorkspaceAsync( @@ -87,7 +88,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task NoFilesFormattedInUnformattedProjectWhenFixingCodeStyle() { await TestFormatWorkspaceAsync( @@ -102,7 +103,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task GeneratedFilesFormattedInUnformattedProject() { var log = await TestFormatWorkspaceAsync( @@ -119,7 +120,7 @@ public async Task GeneratedFilesFormattedInUnformattedProject() Assert.Contains(logLines, line => line.Contains("NETCoreApp,Version=v3.0.AssemblyAttributes.cs")); } - [Fact] + [MSBuildFact] public async Task FilesFormattedInUnformattedSolution() { await TestFormatWorkspaceAsync( @@ -132,7 +133,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task FilesFormattedInUnformattedProjectFolder() { // Since the code files are beneath the project folder, files are found and formatted. @@ -146,7 +147,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task NoFilesFormattedInUnformattedSolutionFolder() { // Since the code files are outside the solution folder, no files are found or formatted. @@ -160,7 +161,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 0); } - [Fact] + [MSBuildFact] public async Task FSharpProjectsDoNotCreateException() { var log = await TestFormatWorkspaceAsync( @@ -179,7 +180,7 @@ public async Task FSharpProjectsDoNotCreateException() Assert.EndsWith(s_fSharpProjectFilePath, match.Groups[1].Value); } - [Fact] + [MSBuildFact] public async Task OnlyFormatPathsFromList() { // To match a folder pattern it needs to end with a directory separator. @@ -195,7 +196,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task OnlyFormatFilesFromList() { var include = new[] { s_unformattedProgramFilePath }; @@ -210,7 +211,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task NoFilesFormattedWhenNotInList() { var include = new[] { Path.Combine(s_unformattedProjectPath, "does_not_exist.cs") }; @@ -225,7 +226,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task OnlyLogFormattedFiles() { var include = new[] { s_unformattedProgramFilePath }; @@ -246,7 +247,7 @@ public async Task OnlyLogFormattedFiles() Assert.EndsWith("Program.cs", match.Groups[1].Value); } - [Fact] + [MSBuildFact] public async Task FormatLocationsLoggedInUnformattedProject() { var log = await TestFormatWorkspaceAsync( @@ -297,7 +298,7 @@ public async Task FormatLocationsLoggedInUnformattedProject() } } - [Fact] + [MSBuildFact] public async Task FormatLocationsNotLoggedInFormattedProject() { var log = await TestFormatWorkspaceAsync( @@ -315,7 +316,7 @@ public async Task FormatLocationsNotLoggedInFormattedProject() Assert.Empty(formatLocations); } - [Fact] + [MSBuildFact] public async Task LogFilesThatDontMatchExclude() { var include = new[] { s_unformattedProgramFilePath }; @@ -336,7 +337,7 @@ public async Task LogFilesThatDontMatchExclude() Assert.EndsWith("Program.cs", match.Groups[1].Value); } - [Fact] + [MSBuildFact] public async Task IgnoreFileWhenListedInExcludeList() { var include = new[] { s_unformattedProgramFilePath }; @@ -351,7 +352,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task IgnoreFileWhenContainingFolderListedInExcludeList() { var include = new[] { s_unformattedProgramFilePath }; @@ -367,7 +368,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task IgnoreAllFileWhenExcludingAllFiles() { var include = new[] { s_unformattedProgramFilePath }; @@ -383,7 +384,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 6); } - [Fact] + [MSBuildFact] public async Task NoFilesFormattedInGeneratedProject_WhenNotIncludingGeneratedCode() { await TestFormatWorkspaceAsync( @@ -396,7 +397,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 3); } - [Fact] + [MSBuildFact] public async Task FilesFormattedInGeneratedProject_WhenIncludingGeneratedCode() { await TestFormatWorkspaceAsync( @@ -409,7 +410,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 3); } - [Fact] + [MSBuildFact] public async Task NoFilesFormattedInCodeStyleSolution_WhenNotFixingCodeStyle() { var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilePath, _output); @@ -426,7 +427,7 @@ await TestFormatWorkspaceAsync( fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle); } - [Fact] + [MSBuildFact] public async Task NoFilesFormattedInCodeStyleSolution_WhenFixingCodeStyleErrors() { var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilePath, _output); @@ -444,7 +445,7 @@ await TestFormatWorkspaceAsync( codeStyleSeverity: DiagnosticSeverity.Error); } - [Fact] + [MSBuildFact] public async Task FilesFormattedInCodeStyleSolution_WhenFixingCodeStyleWarnings() { var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilePath, _output); @@ -462,7 +463,7 @@ await TestFormatWorkspaceAsync( codeStyleSeverity: DiagnosticSeverity.Warning); } - [Fact] + [MSBuildFact] public async Task NoFilesFormattedInAnalyzersSolution_WhenNotFixingAnalyzers() { var restoreExitCode = await NuGetHelper.PerformRestore(s_analyzersSolutionFilePath, _output); @@ -479,7 +480,7 @@ await TestFormatWorkspaceAsync( fixCategory: FixCategory.Whitespace); } - [Fact] + [MSBuildFact] public async Task FilesFormattedInAnalyzersSolution_WhenFixingAnalyzerErrors() { var restoreExitCode = await NuGetHelper.PerformRestore(s_analyzersSolutionFilePath, _output); diff --git a/tests/XUnit/MSBuildFactAttribute.cs b/tests/XUnit/MSBuildFactAttribute.cs new file mode 100644 index 000000000000..cbdc58737e8e --- /dev/null +++ b/tests/XUnit/MSBuildFactAttribute.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using Xunit; +using Xunit.Sdk; + +#nullable enable + +namespace Microsoft.CodeAnalysis.Tools.Tests.XUnit +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] + [XunitTestCaseDiscoverer("Microsoft.CodeAnalysis.Tools.Tests.XUnit.MSBuildFactDiscoverer", "dotnet-format.UnitTests")] + public sealed class MSBuildFactAttribute : FactAttribute + { + } +} diff --git a/tests/XUnit/MSBuildFactDiscoverer.cs b/tests/XUnit/MSBuildFactDiscoverer.cs new file mode 100644 index 000000000000..77103021ac6d --- /dev/null +++ b/tests/XUnit/MSBuildFactDiscoverer.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using Xunit.Abstractions; +using Xunit.Sdk; + +#nullable enable + +namespace Microsoft.CodeAnalysis.Tools.Tests.XUnit +{ + + public sealed class MSBuildFactDiscoverer : IXunitTestCaseDiscoverer + { + private readonly FactDiscoverer _factDiscoverer; + + public MSBuildFactDiscoverer(IMessageSink diagnosticMessageSink) + { + _factDiscoverer = new FactDiscoverer(diagnosticMessageSink); + } + + public IEnumerable Discover( + ITestFrameworkDiscoveryOptions discoveryOptions, + ITestMethod testMethod, + IAttributeInfo factAttribute) + { + return _factDiscoverer + .Discover(discoveryOptions, testMethod, factAttribute) + .Select(testCase => new MSBuildTestCase(testCase)); + } + } +} diff --git a/tests/XUnit/MSBuildTestCase.cs b/tests/XUnit/MSBuildTestCase.cs new file mode 100644 index 000000000000..5e9e20b41f9c --- /dev/null +++ b/tests/XUnit/MSBuildTestCase.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Workspaces; +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace Microsoft.CodeAnalysis.Tools.Tests.XUnit +{ + [DebuggerDisplay(@"\{ class = {TestMethod.TestClass.Class.Name}, method = {TestMethod.Method.Name}, display = {DisplayName}, skip = {SkipReason} \}")] + public sealed class MSBuildTestCase : LongLivedMarshalByRefObject, IXunitTestCase + { + private IXunitTestCase _testCase; + + public string DisplayName => _testCase.DisplayName; + public IMethodInfo Method => _testCase.Method; + public string SkipReason => _testCase.SkipReason; + public ITestMethod TestMethod => _testCase.TestMethod; + public object[] TestMethodArguments => _testCase.TestMethodArguments; + public Dictionary> Traits => _testCase.Traits; + public string UniqueID => _testCase.UniqueID; + + public ISourceInformation SourceInformation + { + get => _testCase.SourceInformation; + set => _testCase.SourceInformation = value; + } + + public Exception InitializationException => _testCase.InitializationException; + + public int Timeout => _testCase.Timeout; + + public MSBuildTestCase(IXunitTestCase testCase) + { + _testCase = testCase ?? throw new ArgumentNullException(nameof(testCase)); + } + + [Obsolete("Called by the deserializer", error: true)] + public MSBuildTestCase() { } + + public async Task RunAsync( + IMessageSink diagnosticMessageSink, + IMessageBus messageBus, + object[] constructorArguments, + ExceptionAggregator aggregator, + CancellationTokenSource cancellationTokenSource) + { + await MSBuildWorkspaceLoader.Guard.WaitAsync(); + try + { + var runner = new XunitTestCaseRunner(this, DisplayName, SkipReason, constructorArguments, TestMethodArguments, messageBus, aggregator, cancellationTokenSource); + return await runner.RunAsync(); + } + finally + { + MSBuildWorkspaceLoader.Guard.Release(); + } + } + + public void Deserialize(IXunitSerializationInfo info) + { + _testCase = info.GetValue("InnerTestCase"); + } + + public void Serialize(IXunitSerializationInfo info) + { + info.AddValue("InnerTestCase", _testCase); + } + } +} diff --git a/tests/XUnit/MSBuildTheoryAttribute.cs b/tests/XUnit/MSBuildTheoryAttribute.cs new file mode 100644 index 000000000000..f239b84778a0 --- /dev/null +++ b/tests/XUnit/MSBuildTheoryAttribute.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using Xunit; +using Xunit.Sdk; + +#nullable enable + +namespace Microsoft.CodeAnalysis.Tools.Tests.XUnit +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] + [XunitTestCaseDiscoverer("Microsoft.CodeAnalysis.Tools.Tests.XUnit.MSBuildTheoryDiscoverer", "dotnet-format.UnitTests")] + public sealed class MSBuildTheoryAttribute : TheoryAttribute + { + } +} diff --git a/tests/XUnit/MSBuildTheoryDiscoverer.cs b/tests/XUnit/MSBuildTheoryDiscoverer.cs new file mode 100644 index 000000000000..6c793bfa0937 --- /dev/null +++ b/tests/XUnit/MSBuildTheoryDiscoverer.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using Xunit.Abstractions; +using Xunit.Sdk; + +#nullable enable + +namespace Microsoft.CodeAnalysis.Tools.Tests.XUnit +{ + + public sealed class MSBuildTheoryDiscoverer : IXunitTestCaseDiscoverer + { + private readonly TheoryDiscoverer _theoryDiscoverer; + + public MSBuildTheoryDiscoverer(IMessageSink diagnosticMessageSink) + { + _theoryDiscoverer = new TheoryDiscoverer(diagnosticMessageSink); + } + + public IEnumerable Discover( + ITestFrameworkDiscoveryOptions discoveryOptions, + ITestMethod testMethod, + IAttributeInfo factAttribute) + { + return _theoryDiscoverer + .Discover(discoveryOptions, testMethod, factAttribute) + .Select(testCase => new MSBuildTestCase(testCase)); + } + } +} From 7430c00087533f2b3c18a9c0e2cf076acf26c949 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 12 Dec 2020 13:35:54 +0000 Subject: [PATCH 1272/2702] Update dependencies from https://github.com/dotnet/arcade build 20201210.4 (#901) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 09f2490741ab..842d8b7c0953 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 66c6b1b53965afd8ee5695a36b1909d006ae98af + 3346d7b4ff047c854913fb2ded6e3aa726da6d11 diff --git a/global.json b/global.json index 4c7e8919f6f5..2c1d5b22bbfa 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20609.9" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20610.4" } } From deed2fa29a406414ac85bdc9e62de7d3181cde02 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 12 Dec 2020 13:57:40 +0000 Subject: [PATCH 1273/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201211.16 (#902) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 842d8b7c0953..7315e2670b26 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 0bfe7ca4970a3ff3c8f126e53d9ca152a28f0188 + f27619580ad5b2bdc4043ad867bc145a48d21af6 diff --git a/eng/Versions.props b/eng/Versions.props index a3d7bc79e6e9..9c4769a62117 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20610.26 + 3.9.0-3.20611.16 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 9ba59dd83b390ff23e5724b15688a39cdb8d7fc3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 15 Dec 2020 13:31:23 +0000 Subject: [PATCH 1274/2702] Update dependencies from https://github.com/dotnet/arcade build 20201211.1 (#903) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7315e2670b26..c06ce13fa5a2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 3346d7b4ff047c854913fb2ded6e3aa726da6d11 + 4e8e7e7300b9a35796e2a81a9c93b34d975573db diff --git a/global.json b/global.json index 2c1d5b22bbfa..2207cdd86fdd 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20610.4" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20611.1" } } From 6f28a1b28ceb1693bb579f391f61ccc5a0450140 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 15 Dec 2020 14:03:26 +0000 Subject: [PATCH 1275/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201215.2 (#904) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c06ce13fa5a2..b5352f19cf77 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - f27619580ad5b2bdc4043ad867bc145a48d21af6 + 8bd41ebfcbde4a3c9fa0a43a9fe64ff56addafe6 diff --git a/eng/Versions.props b/eng/Versions.props index 9c4769a62117..1eff433264ea 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20611.16 + 3.9.0-3.20615.2 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From b13335a12ed8c5e6c08f6b8612b15a077d8aa209 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 16 Dec 2020 13:36:25 +0000 Subject: [PATCH 1276/2702] Update dependencies from https://github.com/dotnet/arcade build 20201214.8 (#905) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/native/CommonLibrary.psm1 | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b5352f19cf77..145847190d66 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 4e8e7e7300b9a35796e2a81a9c93b34d975573db + b2d5bf0342fa65d70ed2c3ddbdb3841d7ca0b382 diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index d7d1a6510949..adf707c8fe70 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -48,7 +48,7 @@ function DownloadAndExtract { -Verbose:$Verbose if ($DownloadStatus -Eq $False) { - Write-Error "Download failed" + Write-Error "Download failed from $Uri" return $False } diff --git a/global.json b/global.json index 2207cdd86fdd..1db3e941654f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20611.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20614.8" } } From 8d69e26994b881acdd797e7d6857c7d2d60fefe2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 16 Dec 2020 18:42:14 +0000 Subject: [PATCH 1277/2702] [master] Update dependencies from dotnet/roslyn (#906) [master] Update dependencies from dotnet/roslyn - Improve integration test time --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- eng/format-verifier.ps1 | 18 +++++++++++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 145847190d66..0f3bcbb393cd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 8bd41ebfcbde4a3c9fa0a43a9fe64ff56addafe6 + 6a9b81faeb6cb168ffc8a52a45fc4e1770873a72 diff --git a/eng/Versions.props b/eng/Versions.props index 1eff433264ea..3fab5205c747 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20615.2 + 3.9.0-3.20616.10 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index bfc9284a786f..21b86bfcaa79 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -8,6 +8,11 @@ Param( [string]$stage # Valid values are "prepare", "format-workspace", "format-folder" ) +if ($stage -eq "prepare") { + Write-Output "$(Get-Date) - Building dotnet-format." + dotnet.exe build ./src -c Release +} + $currentLocation = Get-Location if (!(Test-Path $testPath)) { @@ -19,14 +24,17 @@ try { $folderName = $repoName.Split("/")[1] $repoPath = Join-Path $testPath $folderName - if ($stage -eq "prepare") { - Write-Output "$(Get-Date) - Cloning $repoName." - git.exe clone $repo $repoPath -b $branchName --single-branch --no-tags + if (!(Test-Path $repoPath)) { + New-Item -ItemType Directory -Force -Path $repoPath | Out-Null } Set-Location $repoPath if ($stage -eq "prepare") { + Write-Output "$(Get-Date) - Cloning $repoName." + git.exe init + git.exe remote add origin $repo + git.exe fetch --progress --no-tags --depth=1 origin $sha git.exe checkout $sha } @@ -62,7 +70,7 @@ try { if ($stage -eq "format-workspace") { Write-Output "$(Get-Date) - $solutionFile - Formatting Workspace" - $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- $solution -wsa -v diag --check | Out-String + $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/netcoreapp2.1/dotnet-format.dll" $solution -wsa -v diag --check | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. @@ -84,7 +92,7 @@ try { if ($stage -eq "format-folder") { Write-Output "$(Get-Date) - $folderName - Formatting Folder" - $output = dotnet.exe run -p "$currentLocation\src\dotnet-format.csproj" -c Release -- -f $repoPath -v diag --check | Out-String + $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/netcoreapp2.1/dotnet-format.dll" -f $repoPath -v diag --check | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. From b12b690120075777a08625befe7e13927618efb3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 17 Dec 2020 13:36:24 +0000 Subject: [PATCH 1278/2702] Update dependencies from https://github.com/dotnet/arcade build 20201215.4 (#908) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/performance/microbenchmarks.proj | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0f3bcbb393cd..54b595254282 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - b2d5bf0342fa65d70ed2c3ddbdb3841d7ca0b382 + 7d638bb082f374f7c8ddbada79f757662df4a246 diff --git a/eng/common/performance/microbenchmarks.proj b/eng/common/performance/microbenchmarks.proj index 94b6efbc9297..318ca5f1b8d4 100644 --- a/eng/common/performance/microbenchmarks.proj +++ b/eng/common/performance/microbenchmarks.proj @@ -141,4 +141,4 @@ 4:00 - \ No newline at end of file + diff --git a/global.json b/global.json index 1db3e941654f..7baeeabcb252 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20614.8" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20615.4" } } From 416a87bede7b75b6fe85aa712e544eaa8a681ff7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 17 Dec 2020 13:49:33 +0000 Subject: [PATCH 1279/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201217.8 (#909) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 54b595254282..fa3eda7eec60 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 6a9b81faeb6cb168ffc8a52a45fc4e1770873a72 + c666a9c57fe0c1de5df0e5b9656a50ea8f5a265e diff --git a/eng/Versions.props b/eng/Versions.props index 3fab5205c747..f69a41c56d22 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20616.10 + 3.9.0-3.20617.8 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 34a1372ce7b5e745a91450f66c885c30760d14cf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 18 Dec 2020 13:31:33 +0000 Subject: [PATCH 1280/2702] Update dependencies from https://github.com/dotnet/arcade build 20201216.18 (#910) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fa3eda7eec60..b4f8e998e29f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 7d638bb082f374f7c8ddbada79f757662df4a246 + 26b005488dd7ddf6356873cb01a7b763a82a9622 diff --git a/global.json b/global.json index 7baeeabcb252..c08261ce3952 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20615.4" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20616.18" } } From eea97426e8183b8c9eff5bfb0fae826d1f227062 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 18 Dec 2020 14:09:48 +0000 Subject: [PATCH 1281/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201218.12 (#911) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b4f8e998e29f..25f9e04c4280 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c666a9c57fe0c1de5df0e5b9656a50ea8f5a265e + 36ec6c0af3c758e83799481750eef0d90f56040b diff --git a/eng/Versions.props b/eng/Versions.props index f69a41c56d22..a2ee644c473e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20617.8 + 3.9.0-3.20618.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From afdf81ca720625e4fdaa740053de12d2e245a38d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 19 Dec 2020 13:37:23 +0000 Subject: [PATCH 1282/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201219.10 (#912) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 25f9e04c4280..d15fbf9bd0bb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 36ec6c0af3c758e83799481750eef0d90f56040b + 5c0057e9c2febb1943ec36be58f45be737fbbb6b diff --git a/eng/Versions.props b/eng/Versions.props index a2ee644c473e..aa97aac1fac9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-3.20618.12 + 3.9.0-4.20619.10 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From f5a5d480efed5e980f548834010d003d0299cdc2 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Mon, 21 Dec 2020 19:23:04 +0000 Subject: [PATCH 1283/2702] Fix missing ` in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9752d2dd9355..427e96ebd8c6 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | `dotnet format --fix-style warn` | Fixes only codestyle analyzer warnings. | | `dotnet format --fix-whitespace --fix-style` | Formats and fixes codestyle analyzer errors. | | `dotnet format --fix-analyzers` | Fixes only 3rd party analyzer errors. | -| `dotnet format -wsa | Formats, fixes codestyle errors, and fixes 3rd party analyzer errors. | +| `dotnet format -wsa` | Formats, fixes codestyle errors, and fixes 3rd party analyzer errors. | | `dotnet format -v diag` | Formats with very verbose logging. | | `dotnet format --include Programs.cs Utility\Logging.cs` | Formats the files Program.cs and Utility\Logging.cs | | `dotnet format --check` | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | From 679750a7f66334f863b37d95767d3e3e73d0e115 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 22 Dec 2020 13:31:07 +0000 Subject: [PATCH 1284/2702] Update dependencies from https://github.com/dotnet/arcade build 20201218.3 (#915) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 25 ++++++++++++++++++++----- global.json | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d15fbf9bd0bb..5475051fd5c6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 26b005488dd7ddf6356873cb01a7b763a82a9622 + e9b75e1cd4e63570624006a6d5bdb48b5b40b513 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index bc8b66e29431..ce280eb95b18 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -439,11 +439,26 @@ function LocateVisualStudio([object]$vsRequirements = $null){ if (!(Test-Path $vsWhereExe)) { Create-Directory $vsWhereDir Write-Host 'Downloading vswhere' - try { - Invoke-WebRequest "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/vswhere/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe - } - catch { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + $maxRetries = 5 + $retries = 1 + + while($true) { + try { + Invoke-WebRequest "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/vswhere/$vswhereVersion/vswhere.exe" -OutFile $vswhereExe + break + } + catch{ + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ + } + + if (++$retries -le $maxRetries) { + $delayInSeconds = [math]::Pow(2, $retries) - 1 # Exponential backoff + Write-Host "Retrying. Waiting for $delayInSeconds seconds before next attempt ($retries of $maxRetries)." + Start-Sleep -Seconds $delayInSeconds + } + else { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Unable to download file in $maxRetries attempts." + } } } diff --git a/global.json b/global.json index c08261ce3952..8aa16223f13e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20616.18" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20618.3" } } From 083cc3e4b67d50158c8f0164ef16bffcaeb1eaec Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 22 Dec 2020 13:39:33 +0000 Subject: [PATCH 1285/2702] [master] Update dependencies from dotnet/roslyn (#913) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5475051fd5c6..90ca8131991e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 5c0057e9c2febb1943ec36be58f45be737fbbb6b + 5fc3dbb464d7046ff2bb0f32a32c98c1b314b3f2 diff --git a/eng/Versions.props b/eng/Versions.props index aa97aac1fac9..180a968dcca0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.20619.10 + 3.9.0-4.20621.6 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 568e876bc8a4647ccf6d9c8d9b19fd1ee1d5d2a0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 23 Dec 2020 13:31:02 +0000 Subject: [PATCH 1286/2702] Update dependencies from https://github.com/dotnet/arcade build 20201221.12 (#916) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/post-build/publish-using-darc.ps1 | 4 ++-- global.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 90ca8131991e..72b7b7bf2419 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - e9b75e1cd4e63570624006a6d5bdb48b5b40b513 + 3ba79fbd73d6765b67d0f75ac9dac148d6bea346 diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 31cf27674171..6b68ee847288 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -22,12 +22,12 @@ try { $optionalParams = [System.Collections.ArrayList]::new() if ("" -ne $ArtifactsPublishingAdditionalParameters) { - $optionalParams.Add("artifact-publishing-parameters") | Out-Null + $optionalParams.Add("--artifact-publishing-parameters") | Out-Null $optionalParams.Add($ArtifactsPublishingAdditionalParameters) | Out-Null } if ("" -ne $SymbolPublishingAdditionalParameters) { - $optionalParams.Add("symbol-publishing-parameters") | Out-Null + $optionalParams.Add("--symbol-publishing-parameters") | Out-Null $optionalParams.Add($SymbolPublishingAdditionalParameters) | Out-Null } diff --git a/global.json b/global.json index 8aa16223f13e..20e922955f5f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20618.3" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20621.12" } } From 7a9831ace3e2eefabebc5ebb20cdcad4d31b77f5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 23 Dec 2020 13:51:54 +0000 Subject: [PATCH 1287/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201222.12 (#917) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 72b7b7bf2419..8e39482f8e7e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 5fc3dbb464d7046ff2bb0f32a32c98c1b314b3f2 + 3446772a034e8f72d514fe00cc1d53ef18bd7536 diff --git a/eng/Versions.props b/eng/Versions.props index 180a968dcca0..e62ff76787cc 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.20621.6 + 3.9.0-4.20622.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From d8c7d857b561afb80038acff223655b64fe956c2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 24 Dec 2020 13:37:51 +0000 Subject: [PATCH 1288/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201223.4 (#918) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8e39482f8e7e..ec67c7b901d2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 3446772a034e8f72d514fe00cc1d53ef18bd7536 + 3771331700abe929950fa2331fb9a6a3040dec10 diff --git a/eng/Versions.props b/eng/Versions.props index e62ff76787cc..adf7c4df9110 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.20622.12 + 3.9.0-4.20623.4 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 669f3b8863b4999f19feed6e655e796aeedcb735 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 28 Dec 2020 13:32:49 +0000 Subject: [PATCH 1289/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201227.4 (#919) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ec67c7b901d2..4b6fc06d065e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 3771331700abe929950fa2331fb9a6a3040dec10 + ca950c2039668f0af2777530d8d2245456a0ca59 diff --git a/eng/Versions.props b/eng/Versions.props index adf7c4df9110..bc4c5a367e8b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.20623.4 + 3.9.0-4.20627.4 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 52cf675ee1018144e0fc994c116d33c1426758a1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 31 Dec 2020 13:45:06 +0000 Subject: [PATCH 1290/2702] [master] Update dependencies from dotnet/arcade (#920) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/tools.sh | 4 +++- global.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4b6fc06d065e..8f4171b420d9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 3ba79fbd73d6765b67d0f75ac9dac148d6bea346 + 4c8515c18ebe0071c32fed467ee3890fbd488898 diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 0295dd9ff633..b160c370f84e 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -273,7 +273,9 @@ function GetDotNetInstallScript { if command -v curl > /dev/null; then # first, try directly, if this fails we will retry with verbose logging curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { - echo "curl failed; will now retry with verbose logging." + echo "Curl failed; dumping some information about dotnet.microsoft.com for later investigation" + echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443 + echo "Will now retry the same URL with verbose logging." with_retries curl "$install_script_url" -sSL --verbose --retry 10 --create-dirs -o "$install_script" || { local exit_code=$? Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." diff --git a/global.json b/global.json index 20e922955f5f..b13e4fb692df 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20621.12" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20630.2" } } From 5b2ed2eeaaf3218c6361acd823021f1063a2190b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 31 Dec 2020 13:46:56 +0000 Subject: [PATCH 1291/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201230.10 (#922) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8f4171b420d9..a1be30872a8d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ca950c2039668f0af2777530d8d2245456a0ca59 + da5c0bd23220da1eecd6d804a1c52db9f29c6716 diff --git a/eng/Versions.props b/eng/Versions.props index bc4c5a367e8b..be086bbaa0ee 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.20627.4 + 3.9.0-4.20630.10 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 7be15a1bcaeee09bbec2b0755108e2a66b00314d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 1 Jan 2021 13:37:44 +0000 Subject: [PATCH 1292/2702] Update dependencies from https://github.com/dotnet/roslyn build 20201231.6 (#923) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a1be30872a8d..98ff1ce5c106 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - da5c0bd23220da1eecd6d804a1c52db9f29c6716 + c34bb049f1f74256f109794509cd9f0f1c23faea diff --git a/eng/Versions.props b/eng/Versions.props index be086bbaa0ee..8adc53bc2f8f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.20630.10 + 3.9.0-4.20631.6 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 373597021052fc0dcfddd7a1a8e09bec1bf7c61d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 6 Jan 2021 13:33:17 +0000 Subject: [PATCH 1293/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210106.10 (#924) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 98ff1ce5c106..1f7ad147c089 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c34bb049f1f74256f109794509cd9f0f1c23faea + 6027035fdb6b1d7d592459f3e5729391546829e5 diff --git a/eng/Versions.props b/eng/Versions.props index 8adc53bc2f8f..324ec5188a1e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.20631.6 + 3.9.0-4.21056.10 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From c6314df799fbe6530d9402db14d374519843671d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 6 Jan 2021 14:44:20 -0800 Subject: [PATCH 1294/2702] Update development build installation instructions in readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 427e96ebd8c6..ce8e8815189c 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,12 @@ dotnet tool install -g dotnet-format #### Installing Development Builds -Development builds of `dotnet-format` are being hosted on Azure Packages. You can visit the [dotnet-format Azure Packages page](https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&package=dotnet-format&version=5.0.142902&protocolType=NuGet&view=versions) to get the latest version number. +Development builds of `dotnet-format` are being hosted on Azure Packages. You can visit the [dotnet-format Azure Packages page](https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&view=versions&package=dotnet-format&protocolType=NuGet). -You can install the tool using the following command. +You can install the latest build of the tool using the following command. ```console -dotnet tool install -g dotnet-format --version 5.0.142902 --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json +dotnet tool install -g dotnet-format --version 5.0.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json ``` ### How To Use From fc9d31c33dd58913814b667bfec16c2bad440f87 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 7 Jan 2021 13:32:40 +0000 Subject: [PATCH 1295/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210106.26 (#925) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1f7ad147c089..a7368889c730 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 6027035fdb6b1d7d592459f3e5729391546829e5 + 75570f863aad6750a935926ab9ef3ec4452f9f25 diff --git a/eng/Versions.props b/eng/Versions.props index 324ec5188a1e..2ba5278d3ee3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21056.10 + 3.9.0-4.21056.26 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 71658bff777bbc623f3b9441f2890c58377c2137 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 9 Jan 2021 13:31:12 +0000 Subject: [PATCH 1296/2702] Update dependencies from https://github.com/dotnet/arcade build 20210108.3 (#926) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 +- eng/common/build.sh | 2 +- eng/common/cross/build-android-rootfs.sh | 2 +- eng/common/cross/build-rootfs.sh | 2 +- eng/common/darc-init.sh | 2 +- eng/common/dotnet-install.sh | 2 +- eng/common/init-tools-native.sh | 113 ++++++++++++++---- eng/common/internal-feed-operations.sh | 2 +- eng/common/msbuild.sh | 2 +- eng/common/native/install-cmake-test.sh | 6 +- eng/common/native/install-cmake.sh | 6 +- eng/common/performance/performance-setup.sh | 2 +- eng/common/pipeline-logging-functions.sh | 10 +- .../templates/job/publish-build-assets.yml | 7 ++ .../templates/job/source-index-stage1.yml | 46 +++++++ eng/common/templates/jobs/jobs.yml | 11 ++ eng/common/tools.ps1 | 6 +- eng/common/tools.sh | 31 +++-- global.json | 2 +- 19 files changed, 200 insertions(+), 58 deletions(-) create mode 100644 eng/common/templates/job/source-index-stage1.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a7368889c730..ecc3b94c0139 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 4c8515c18ebe0071c32fed467ee3890fbd488898 + 1571d6b095014ad63fdb48b10f5dea912f96872e diff --git a/eng/common/build.sh b/eng/common/build.sh index 252b63604e6e..55b298f16ccd 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -81,7 +81,7 @@ runtime_source_feed_key='' properties='' while [[ $# > 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" case "$opt" in -help|-h) usage diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh index e7f12edb565a..42516bbeebc3 100755 --- a/eng/common/cross/build-android-rootfs.sh +++ b/eng/common/cross/build-android-rootfs.sh @@ -27,7 +27,7 @@ __AndroidToolchain=aarch64-linux-android for i in "$@" do - lowerI="$(echo $i | awk '{print tolower($0)}')" + lowerI="$(echo $i | tr "[:upper:]" "[:lower:]")" case $lowerI in -?|-h|--help) usage diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 6d59e181c8fd..ae0cd1aac7b4 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -82,7 +82,7 @@ while :; do break fi - lowerI="$(echo $1 | awk '{print tolower($0)}')" + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" case $lowerI in -?|-h|--help) usage diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index d981d7bbf38d..39abdbecdcf1 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -6,7 +6,7 @@ versionEndpoint='https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc verbosity='minimal' while [[ $# > 0 ]]; do - opt="$(echo "$1" | awk '{print tolower($0)}')" + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" case "$opt" in --darcversion) darcVersion=$2 diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh index ead6a1d9a24b..25b69f8787f2 100755 --- a/eng/common/dotnet-install.sh +++ b/eng/common/dotnet-install.sh @@ -19,7 +19,7 @@ runtime='dotnet' runtimeSourceFeed='' runtimeSourceFeedKey='' while [[ $# > 0 ]]; do - opt="$(echo "$1" | awk '{print tolower($0)}')" + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" case "$opt" in -version|-v) shift diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh index 29fc5db8ae07..5bd205b5da3b 100755 --- a/eng/common/init-tools-native.sh +++ b/eng/common/init-tools-native.sh @@ -16,7 +16,7 @@ declare -A native_assets . $scriptroot/native/common-library.sh while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" case $lowerI in --baseuri) base_uri=$2 @@ -76,24 +76,89 @@ while (($# > 0)); do done function ReadGlobalJsonNativeTools { - # Get the native-tools section from the global.json. - local native_tools_section=$(cat $global_json_file | awk '/"native-tools"/,/}/') - # Only extract the contents of the object. - local native_tools_list=$(echo $native_tools_section | awk -F"[{}]" '{print $2}') - native_tools_list=${native_tools_list//[\" ]/} - native_tools_list=$( echo "$native_tools_list" | sed 's/\s//g' | sed 's/,/\n/g' ) - - local old_IFS=$IFS - while read -r line; do - # Lines are of the form: 'tool:version' - IFS=: - while read -r key value; do - native_assets[$key]=$value - done <<< "$line" - done <<< "$native_tools_list" - IFS=$old_IFS - - return 0; + # happy path: we have a proper JSON parsing tool `jq(1)` in PATH! + if command -v jq &> /dev/null; then + + # jq: read each key/value pair under "native-tools" entry and emit: + # KEY="" VALUE="" + # followed by a null byte. + # + # bash: read line with null byte delimeter and push to array (for later `eval`uation). + + while IFS= read -rd '' line; do + native_assets+=("$line") + done < <(jq -r '. | + select(has("native-tools")) | + ."native-tools" | + keys[] as $k | + @sh "KEY=\($k) VALUE=\(.[$k])\u0000"' "$global_json_file") + + return + fi + + # Warning: falling back to manually parsing JSON, which is not recommended. + + # Following routine matches the output and escaping logic of jq(1)'s @sh formatter used above. + # It has been tested with several weird strings with escaped characters in entries (key and value) + # and results were compared with the output of jq(1) in binary representation using xxd(1); + # just before the assignment to 'native_assets' array (above and below). + + # try to capture the section under "native-tools". + if [[ ! "$(cat "$global_json_file")" =~ \"native-tools\"[[:space:]\:\{]*([^\}]+) ]]; then + return + fi + + section="${BASH_REMATCH[1]}" + + parseStarted=0 + possibleEnd=0 + escaping=0 + escaped=0 + isKey=1 + + for (( i=0; i<${#section}; i++ )); do + char="${section:$i:1}" + if ! ((parseStarted)) && [[ "$char" =~ [[:space:],:] ]]; then continue; fi + + if ! ((escaping)) && [[ "$char" == "\\" ]]; then + escaping=1 + elif ((escaping)) && ! ((escaped)); then + escaped=1 + fi + + if ! ((parseStarted)) && [[ "$char" == "\"" ]]; then + parseStarted=1 + possibleEnd=0 + elif [[ "$char" == "'" ]]; then + token="$token'\\\''" + possibleEnd=0 + elif ((escaping)) || [[ "$char" != "\"" ]]; then + token="$token$char" + possibleEnd=1 + fi + + if ((possibleEnd)) && ! ((escaping)) && [[ "$char" == "\"" ]]; then + # Use printf to unescape token to match jq(1)'s @sh formatting rules. + # do not use 'token="$(printf "$token")"' syntax, as $() eats the trailing linefeed. + printf -v token "'$token'" + + if ((isKey)); then + KEY="$token" + isKey=0 + else + line="KEY=$KEY VALUE=$token" + native_assets+=("$line") + isKey=1 + fi + + # reset for next token + parseStarted=0 + token= + elif ((escaping)) && ((escaped)); then + escaping=0 + escaped=0 + fi + done } native_base_dir=$install_directory @@ -111,14 +176,14 @@ if [[ ${#native_assets[@]} -eq 0 ]]; then exit 0; else native_installer_dir="$scriptroot/native" - for tool in "${!native_assets[@]}" - do - tool_version=${native_assets[$tool]} - installer_path="$native_installer_dir/install-$tool.sh" + for index in "${!native_assets[@]}"; do + eval "${native_assets["$index"]}" + + installer_path="$native_installer_dir/install-$KEY.sh" installer_command="$installer_path" installer_command+=" --baseuri $base_uri" installer_command+=" --installpath $install_bin" - installer_command+=" --version $tool_version" + installer_command+=" --version $VALUE" echo $installer_command if [[ $force = true ]]; then diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh index 9ed225e7e559..a27410f6321b 100755 --- a/eng/common/internal-feed-operations.sh +++ b/eng/common/internal-feed-operations.sh @@ -103,7 +103,7 @@ authToken='' repoName='' while [[ $# > 0 ]]; do - opt="$(echo "$1" | awk '{print tolower($0)}')" + opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" case "$opt" in --operation) operation=$2 diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh index 8160cd5a59d1..20d3dad54352 100755 --- a/eng/common/msbuild.sh +++ b/eng/common/msbuild.sh @@ -19,7 +19,7 @@ prepare_machine=false extra_args='' while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" case $lowerI in --verbosity) verbosity=$2 diff --git a/eng/common/native/install-cmake-test.sh b/eng/common/native/install-cmake-test.sh index 12339a40761d..8a5e7cf0db5a 100755 --- a/eng/common/native/install-cmake-test.sh +++ b/eng/common/native/install-cmake-test.sh @@ -14,7 +14,7 @@ download_retries=5 retry_wait_time_seconds=30 while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" case $lowerI in --baseuri) base_uri=$2 @@ -63,7 +63,7 @@ done tool_name="cmake-test" tool_os=$(GetCurrentOS) -tool_folder=$(echo $tool_os | awk '{print tolower($0)}') +tool_folder="$(echo $tool_os | tr "[:upper:]" "[:lower:]")" tool_arch="x86_64" tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" tool_install_directory="$install_path/$tool_name/$version" @@ -114,4 +114,4 @@ if [[ $? != 0 ]]; then exit 1 fi -exit 0 \ No newline at end of file +exit 0 diff --git a/eng/common/native/install-cmake.sh b/eng/common/native/install-cmake.sh index 18041be87633..de496beebc5a 100755 --- a/eng/common/native/install-cmake.sh +++ b/eng/common/native/install-cmake.sh @@ -14,7 +14,7 @@ download_retries=5 retry_wait_time_seconds=30 while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" case $lowerI in --baseuri) base_uri=$2 @@ -63,7 +63,7 @@ done tool_name="cmake" tool_os=$(GetCurrentOS) -tool_folder=$(echo $tool_os | awk '{print tolower($0)}') +tool_folder="$(echo $tool_os | tr "[:upper:]" "[:lower:]")" tool_arch="x86_64" tool_name_moniker="$tool_name-$version-$tool_os-$tool_arch" tool_install_directory="$install_path/$tool_name/$version" @@ -114,4 +114,4 @@ if [[ $? != 0 ]]; then exit 1 fi -exit 0 \ No newline at end of file +exit 0 diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index c8e211bcb1bb..7321feb5c7e6 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -29,7 +29,7 @@ using_wasm=false use_latest_dotnet=false while (($# > 0)); do - lowerI="$(echo $1 | awk '{print tolower($0)}')" + lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" case $lowerI in --sourcedirectory) source_directory=$2 diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh index da5a7e6129eb..6a0b2255e911 100755 --- a/eng/common/pipeline-logging-functions.sh +++ b/eng/common/pipeline-logging-functions.sh @@ -6,7 +6,7 @@ function Write-PipelineTelemetryError { local function_args=() local message='' while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" case "$opt" in -category|-c) telemetry_category=$2 @@ -48,7 +48,7 @@ function Write-PipelineTaskError { local force=false while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" case "$opt" in -type|-t) message_type=$2 @@ -122,7 +122,7 @@ function Write-PipelineSetVariable { local is_multi_job_variable=true while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" case "$opt" in -name|-n) name=$2 @@ -164,7 +164,7 @@ function Write-PipelinePrependPath { local prepend_path='' while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" case "$opt" in -path|-p) prepend_path=$2 @@ -186,7 +186,7 @@ function Write-PipelineSetResult { local message='' while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" case "$opt" in -result|-r) result=$2 diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index d0c3cc2b3ba5..66ef736417f6 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -37,6 +37,7 @@ jobs: - name: _BuildConfig value: ${{ parameters.configuration }} - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats # Skip component governance and codesign validation for SDL. These jobs # create no content. - name: skipComponentGovernanceDetection @@ -57,6 +58,12 @@ jobs: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: NuGetAuthenticate@0 + - task: PowerShell@2 + displayName: Enable cross-org NuGet feed authentication + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-all-orgs-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish Build Assets inputs: diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml new file mode 100644 index 000000000000..b33f06b9517d --- /dev/null +++ b/eng/common/templates/job/source-index-stage1.yml @@ -0,0 +1,46 @@ +parameters: + runAsPublic: false + sourceIndexPackageVersion: 1.0.0-beta5 + sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json + sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" + binlogPath: artifacts/log/Debug/Build.binlog + pool: + vmImage: vs2017-win2016 + +jobs: +- job: SourceIndexStage1 + variables: + - name: SourceIndexPackageVersion + value: ${{ parameters.sourceIndexPackageVersion }} + - name: SourceIndexPackageSource + value: ${{ parameters.sourceIndexPackageSource }} + - name: BinlogPath + value: ${{ parameters.binlogPath }} + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - group: source-dot-net stage1 variables + + pool: ${{ parameters.pool }} + steps: + - task: UseDotNet@2 + displayName: Use .NET Core sdk 3.1 + inputs: + packageType: sdk + version: 3.1.x + + - script: | + dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path .source-index/tools + dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path .source-index/tools + echo ##vso[task.prependpath]$(Build.SourcesDirectory)/.source-index/tools + displayName: Download Tools + + - script: ${{ parameters.sourceIndexBuildCommand }} + displayName: Build Repository + + - script: BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output + displayName: Process Binlog into indexable sln + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - script: UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) + displayName: Upload stage1 artifacts to source index + env: + BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 08845950f441..79ffd6e66b3c 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -31,6 +31,9 @@ parameters: # See /eng/common/templates/jobs/source-build.yml for options sourceBuildParameters: [] + enableSourceIndex: false + sourceIndexParams: {} + # Internal resources (telemetry, microbuild) can only be accessed from non-public projects, # and some (Microbuild) should only be applied to non-PR cases for internal builds. @@ -57,7 +60,15 @@ jobs: ${{ each parameter in parameters.sourceBuildParameters }}: ${{ parameter.key }}: ${{ parameter.value }} +- ${{ if eq(parameters.enableSourceIndex, 'true') }}: + - template: ../job/source-index-stage1.yml + parameters: + runAsPublic: ${{ parameters.runAsPublic }} + ${{ each parameter in parameters.sourceIndexParams }}: + ${{ parameter.key }}: ${{ parameter.value }} + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: - template: ../job/publish-build-assets.yml parameters: diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index ce280eb95b18..10e98593e0c8 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -645,7 +645,11 @@ function MSBuild() { $toolsetBuildProject = InitializeToolset $path = Split-Path -parent $toolsetBuildProject - $path = Join-Path $path (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll') + $path = Join-Path $path (Join-Path $buildTool.Framework 'Microsoft.DotNet.ArcadeLogging.dll') + if (-not (Test-Path $path)) { + $path = Split-Path -parent $toolsetBuildProject + $path = Join-Path $path (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll') + } $args += "/logger:$path" } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index b160c370f84e..0920f5965b69 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -89,16 +89,16 @@ function ResolvePath { function ReadGlobalVersion { local key=$1 - local line=$(awk "/$key/ {print; exit}" "$global_json_file") - local pattern="\"$key\" *: *\"(.*)\"" + if command -v jq &> /dev/null; then + _ReadGlobalVersion="$(jq -r ".[] | select(has(\"$key\")) | .\"$key\"" "$global_json_file")" + elif [[ "$(cat "$global_json_file")" =~ \"$key\"[[:space:]\:]*\"([^\"]+) ]]; then + _ReadGlobalVersion=${BASH_REMATCH[1]} + fi - if [[ ! $line =~ $pattern ]]; then + if [[ -z "$_ReadGlobalVersion" ]]; then Write-PipelineTelemetryError -category 'Build' "Error: Cannot find \"$key\" in $global_json_file" ExitWithExitCode 1 fi - - # return value - _ReadGlobalVersion=${BASH_REMATCH[1]} } function InitializeDotNetCli { @@ -273,8 +273,11 @@ function GetDotNetInstallScript { if command -v curl > /dev/null; then # first, try directly, if this fails we will retry with verbose logging curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { - echo "Curl failed; dumping some information about dotnet.microsoft.com for later investigation" - echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443 + if command -v openssl &> /dev/null + then + echo "Curl failed; dumping some information about dotnet.microsoft.com for later investigation" + echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443 + fi echo "Will now retry the same URL with verbose logging." with_retries curl "$install_script_url" -sSL --verbose --retry 10 --create-dirs -o "$install_script" || { local exit_code=$? @@ -411,7 +414,10 @@ function MSBuild { fi local toolset_dir="${_InitializeToolset%/*}" - local logger_path="$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" + local logger_path="$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.ArcadeLogging.dll" + if [[ ! -f $logger_path ]]; then + logger_path="$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" + fi args=( "${args[@]}" "-logger:$logger_path" ) fi @@ -476,8 +482,11 @@ temp_dir="$artifacts_dir/tmp/$configuration" global_json_file="$repo_root/global.json" # determine if global.json contains a "runtimes" entry global_json_has_runtimes=false -dotnetlocal_key=$(awk "/runtimes/ {print; exit}" "$global_json_file") || true -if [[ -n "$dotnetlocal_key" ]]; then +if command -v jq &> /dev/null; then + if jq -er '. | select(has("runtimes"))' "$global_json_file" &> /dev/null; then + global_json_has_runtimes=true + fi +elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then global_json_has_runtimes=true fi diff --git a/global.json b/global.json index b13e4fb692df..feb516af6522 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.20630.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21058.3" } } From 465be1b4e883dd8f1c212ae1d51add3e512567b2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 9 Jan 2021 13:37:30 +0000 Subject: [PATCH 1297/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210108.10 (#927) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 2 +- eng/Versions.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ecc3b94c0139..0c6bf970ea0c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,7 +1,7 @@ - + https://github.com/dotnet/roslyn 75570f863aad6750a935926ab9ef3ec4452f9f25 diff --git a/eng/Versions.props b/eng/Versions.props index 2ba5278d3ee3..7c1427f4cd03 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21056.26 + 3.9.0-4.21058.10 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From beabfe0694eb3d4590e3e87b694924a68c164840 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 11 Jan 2021 13:27:20 +0000 Subject: [PATCH 1298/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210111.14 (#928) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0c6bf970ea0c..70388e821baa 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 75570f863aad6750a935926ab9ef3ec4452f9f25 + 38e7fbd17e2cddfdcb071931e85c5561b0bae268 diff --git a/eng/Versions.props b/eng/Versions.props index 7c1427f4cd03..2876f8ee9c0a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21058.10 + 3.9.0-4.21061.14 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 66efe340d3c63b3eee02639e80affeeec7728430 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 12 Jan 2021 13:31:51 +0000 Subject: [PATCH 1299/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210112.6 (#929) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 70388e821baa..e6d5cd5eccb0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 38e7fbd17e2cddfdcb071931e85c5561b0bae268 + 754346a30b4056f2810f45feff059a25324b05cc diff --git a/eng/Versions.props b/eng/Versions.props index 2876f8ee9c0a..182f852ea245 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21061.14 + 3.9.0-4.21062.6 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 20288f00350d9d3db512b1c2f3aaa081b6cebcd1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 13 Jan 2021 13:26:18 +0000 Subject: [PATCH 1300/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210113.12 (#930) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e6d5cd5eccb0..a3f1d46a6b09 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 754346a30b4056f2810f45feff059a25324b05cc + a85e2b46e9b965147e5c0b9421c23e4e4f513911 diff --git a/eng/Versions.props b/eng/Versions.props index 182f852ea245..e14092c5c1c0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21062.6 + 3.9.0-4.21063.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 7ded09fdf906e8e68f948462e74f0d364e6ea518 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 14 Jan 2021 13:31:53 +0000 Subject: [PATCH 1301/2702] Update dependencies from https://github.com/dotnet/arcade build 20210112.10 (#931) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/templates/job/source-index-stage1.yml | 12 ++++++++++++ eng/common/templates/post-build/post-build.yml | 2 +- global.json | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a3f1d46a6b09..f5b8dbf34d34 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 1571d6b095014ad63fdb48b10f5dea912f96872e + ff8fec9066eca51a26abf723dd7d92e20926a90e diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index b33f06b9517d..612633074552 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -3,6 +3,7 @@ parameters: sourceIndexPackageVersion: 1.0.0-beta5 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" + preSteps: [] binlogPath: artifacts/log/Debug/Build.binlog pool: vmImage: vs2017-win2016 @@ -21,12 +22,20 @@ jobs: pool: ${{ parameters.pool }} steps: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} + - task: UseDotNet@2 displayName: Use .NET Core sdk 3.1 inputs: packageType: sdk version: 3.1.x + - task: UseDotNet@2 + displayName: Use .NET Core sdk + inputs: + useGlobalJson: true + - script: | dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path .source-index/tools dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path .source-index/tools @@ -38,9 +47,12 @@ jobs: - script: BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output displayName: Process Binlog into indexable sln + env: + DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2 - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - script: UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) displayName: Upload stage1 artifacts to source index env: BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) + DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 41f2d96a608c..bd776c7675b9 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -224,7 +224,7 @@ stages: - ${{ if or(ge(parameters.publishingInfraVersion, 3), eq(parameters.inline, 'false')) }}: - stage: publish_using_darc ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: - dependsOn: Validate + dependsOn: ${{ parameters.publishDependsOn }} ${{ if and(ne(parameters.enableNugetValidation, 'true'), ne(parameters.enableSigningValidation, 'true'), ne(parameters.enableSourceLinkValidation, 'true'), ne(parameters.SDLValidationParameters.enable, 'true')) }}: dependsOn: ${{ parameters.validateDependsOn }} displayName: Publish using Darc diff --git a/global.json b/global.json index feb516af6522..9eb4c0bf3ccd 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21058.3" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21062.10" } } From 881fe860754cff353a9d95ea1ac7fd03009b2446 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 14 Jan 2021 13:34:16 +0000 Subject: [PATCH 1302/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210114.16 (#932) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f5b8dbf34d34..ef90ce58ceae 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - a85e2b46e9b965147e5c0b9421c23e4e4f513911 + f0e2f19f59990a15ae665d38b94265ef634b8d0c diff --git a/eng/Versions.props b/eng/Versions.props index e14092c5c1c0..7dcdaaa4c2b8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21063.12 + 3.9.0-4.21064.16 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 5df4e63edc2424ed9cb4223b3dd22aa305545f21 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 15 Jan 2021 13:25:36 +0000 Subject: [PATCH 1303/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210115.22 (#933) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ef90ce58ceae..9415064a726e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - f0e2f19f59990a15ae665d38b94265ef634b8d0c + 85435fa3025da409c88bd7aa04cb796bf2e72a99 diff --git a/eng/Versions.props b/eng/Versions.props index 7dcdaaa4c2b8..e2c27af767ca 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21064.16 + 3.9.0-4.21065.22 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From fb84521ec84929d96620be92b40b22564e98752b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 16 Jan 2021 13:20:58 +0000 Subject: [PATCH 1304/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210116.10 (#934) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9415064a726e..67f4a4223aa9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 85435fa3025da409c88bd7aa04cb796bf2e72a99 + 55575fa80aa9b8bf7ec3a379ecb12a9d997332da diff --git a/eng/Versions.props b/eng/Versions.props index e2c27af767ca..d59ce74ff550 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21065.22 + 3.9.0-4.21066.10 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 89489987e896979ef1d8cb1450b275e050689d30 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 17 Jan 2021 13:26:30 +0000 Subject: [PATCH 1305/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210117.2 (#935) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 67f4a4223aa9..1af38c532c82 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 55575fa80aa9b8bf7ec3a379ecb12a9d997332da + b72ed3eb15901f1e0f8adac1fb2a68897b6b69b4 diff --git a/eng/Versions.props b/eng/Versions.props index d59ce74ff550..05c8c43a11e0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21066.10 + 3.9.0-4.21067.2 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From d19162212480782b2976e3f5e9742635c2569c88 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 19 Jan 2021 13:07:30 +0000 Subject: [PATCH 1306/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210119.12 Microsoft.NETCore.Compilers From Version 3.9.0-4.21067.2 -> To Version 3.9.0-4.21069.12 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1af38c532c82..d9725789ce3b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - b72ed3eb15901f1e0f8adac1fb2a68897b6b69b4 + 0fd03294b19175243debda5e05d44df016943106 diff --git a/eng/Versions.props b/eng/Versions.props index 05c8c43a11e0..439bf9c3feb4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,7 +15,7 @@ 15.3.409 - 3.9.0-4.21067.2 + 3.9.0-4.21069.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From f8bea7e81918aaa1d24a5df692aec26cce554f9d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 20 Jan 2021 13:26:31 +0000 Subject: [PATCH 1307/2702] Update dependencies from https://github.com/dotnet/arcade build 20210118.2 (#938) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/post-build/publish-using-darc.ps1 | 4 ++-- eng/common/templates/job/source-build.yml | 8 ++++++++ eng/common/templates/jobs/jobs.yml | 20 ++++++++++---------- eng/common/templates/jobs/source-build.yml | 12 +++++------- global.json | 2 +- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1af38c532c82..73a1a8448324 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - ff8fec9066eca51a26abf723dd7d92e20926a90e + 298c72b33f6f7b742b11f7b1c0ae77a043789fcf diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 6b68ee847288..599a1172419b 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -16,8 +16,8 @@ param( try { . $PSScriptRoot\post-build-utils.ps1 - # Hard coding darc version till the next arcade-services roll out, cos this version has required API changes for darc add-build-to-channel - $darc = Get-Darc "1.1.0-beta.20418.1" + + $darc = Get-Darc $optionalParams = [System.Collections.ArrayList]::new() diff --git a/eng/common/templates/job/source-build.yml b/eng/common/templates/job/source-build.yml index 9332f5ecc38a..aad41464926c 100644 --- a/eng/common/templates/job/source-build.yml +++ b/eng/common/templates/job/source-build.yml @@ -28,6 +28,11 @@ parameters: # container and pool. platform: {} + # The default VM host AzDO pool. This should be capable of running Docker containers: almost all + # source-build builds run in Docker, including the default managed platform. + defaultContainerHostPool: + vmImage: ubuntu-20.04 + jobs: - job: ${{ parameters.jobNamePrefix }}_${{ parameters.platform.name }} displayName: Source-Build (${{ parameters.platform.name }}) @@ -37,6 +42,9 @@ jobs: ${{ if ne(parameters.platform.container, '') }}: container: ${{ parameters.platform.container }} + + ${{ if eq(parameters.platform.pool, '') }}: + pool: ${{ parameters.defaultContainerHostPool }} ${{ if ne(parameters.platform.pool, '') }}: pool: ${{ parameters.platform.pool }} diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 79ffd6e66b3c..a1f8fce96ca8 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -7,7 +7,14 @@ parameters: # Optional: Enable publishing using release pipelines enablePublishUsingPipelines: false - + + # Optional: Enable running the source-build jobs to build repo from source + enableSourceBuild: false + + # Optional: Parameters for source-build template. + # See /eng/common/templates/jobs/source-build.yml for options + sourceBuildParameters: [] + graphFileGeneration: # Optional: Enable generating the graph files at the end of the build enabled: false @@ -24,13 +31,6 @@ parameters: # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. runAsPublic: false - # Optional: Enable running the source-build jobs to build repo from source - runSourceBuild: false - - # Optional: Parameters for source-build template. - # See /eng/common/templates/jobs/source-build.yml for options - sourceBuildParameters: [] - enableSourceIndex: false sourceIndexParams: {} @@ -53,7 +53,7 @@ jobs: name: ${{ job.job }} -- ${{ if eq(parameters.runSourceBuild, true) }}: +- ${{ if eq(parameters.enableSourceBuild, true) }}: - template: /eng/common/templates/jobs/source-build.yml parameters: allCompletedJobId: Source_Build_Complete @@ -80,7 +80,7 @@ jobs: - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: - ${{ each job in parameters.jobs }}: - ${{ job.job }} - - ${{ if eq(parameters.runSourceBuild, true) }}: + - ${{ if eq(parameters.enableSourceBuild, true) }}: - Source_Build_Complete pool: vmImage: vs2017-win2016 diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml index f463011e7931..00aa98eb3bfd 100644 --- a/eng/common/templates/jobs/source-build.yml +++ b/eng/common/templates/jobs/source-build.yml @@ -11,16 +11,14 @@ parameters: # See /eng/common/templates/job/source-build.yml jobNamePrefix: 'Source_Build' - # If changed to true, causes this template to include the default platform for a managed-only - # repo. The exact Docker image used for this build will be provided by Arcade. This has some risk, - # but since the repo is supposed to be managed-only, the risk should be very low. - includeDefaultManagedPlatform: false + # This is the default platform provided by Arcade, intended for use by a managed-only repo. defaultManagedPlatform: name: 'Managed' container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-3e800f1-20190501005343' # Defines the platforms on which to run build jobs. One job is created for each platform, and the - # object in this array is sent to the job template as 'platform'. + # object in this array is sent to the job template as 'platform'. If no platforms are specified, + # one job runs on 'defaultManagedPlatform'. platforms: [] jobs: @@ -32,7 +30,7 @@ jobs: dependsOn: - ${{ each platform in parameters.platforms }}: - ${{ parameters.jobNamePrefix }}_${{ platform.name }} - - ${{ if eq(parameters.includeDefaultManagedPlatform, true) }}: + - ${{ if eq(length(parameters.platforms), 0) }}: - ${{ parameters.jobNamePrefix }}_${{ parameters.defaultManagedPlatform.name }} - ${{ each platform in parameters.platforms }}: @@ -41,7 +39,7 @@ jobs: jobNamePrefix: ${{ parameters.jobNamePrefix }} platform: ${{ platform }} -- ${{ if eq(parameters.includeDefaultManagedPlatform, true) }}: +- ${{ if eq(length(parameters.platforms), 0) }}: - template: /eng/common/templates/job/source-build.yml parameters: jobNamePrefix: ${{ parameters.jobNamePrefix }} diff --git a/global.json b/global.json index 9eb4c0bf3ccd..374f01bdab37 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21062.10" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21068.2" } } From f0ab03bf5556a11f6755f218f0fbbcc29afacb69 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 21 Jan 2021 13:32:16 +0000 Subject: [PATCH 1308/2702] Update dependencies from https://github.com/dotnet/arcade build 20210119.2 (#939) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/templates/post-build/post-build.yml | 3 +++ global.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 73a1a8448324..02e23b5f20f3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 298c72b33f6f7b742b11f7b1c0ae77a043789fcf + ee0a6a7d9acc6f5886ae214b935f3e3d989235e4 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index bd776c7675b9..375e91acdf3a 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -147,6 +147,9 @@ stages: pipeline: $(AzDOPipelineId) buildId: $(AzDOBuildId) artifactName: PackageArtifacts + itemPattern: | + ** + !**/Microsoft.SourceBuild.Intermediate.*.nupkg # This is necessary whenever we want to publish/restore to an AzDO private feed # Since sdk-task.ps1 tries to restore packages we need to do this authentication here diff --git a/global.json b/global.json index 374f01bdab37..4a467f57970d 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21068.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21069.2" } } From edd7acdf8581e3ca904777ae2a23a5db4ba3c1b5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 23 Jan 2021 13:26:35 +0000 Subject: [PATCH 1309/2702] Update dependencies from https://github.com/dotnet/arcade build 20210121.2 (#940) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 02e23b5f20f3..e81c516ec533 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - ee0a6a7d9acc6f5886ae214b935f3e3d989235e4 + 9a437ab126433012dd2e479c5edfb552b83e872b diff --git a/global.json b/global.json index 4a467f57970d..d479fe48a79e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21069.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21071.2" } } From 86f1f484f2ca9e7fc90d2121c20f3209d4f567c8 Mon Sep 17 00:00:00 2001 From: Daniel Monroy Date: Mon, 25 Jan 2021 11:04:20 -0800 Subject: [PATCH 1310/2702] Update master to main in project-system --- azure-pipelines-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index 8848ba71927d..ef5da3257217 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -38,7 +38,7 @@ jobs: _repo: "https://github.com/dotnet/project-system" _repoName: "dotnet/project-system" _targetSolution: "ProjectSystem.sln" - _branchName: "master" + _branchName: "main" _sha: "385943552a5dc219635551c1c0e6318ff35ffa38" msbuild: _repo: "https://github.com/Microsoft/msbuild" From 09c1a62b85d28806cb20dfe8e36c0b265ca40fc0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 26 Jan 2021 13:26:04 +0000 Subject: [PATCH 1311/2702] Update dependencies from https://github.com/dotnet/arcade build 20210122.6 (#942) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/sdl/packages.config | 2 +- eng/common/templates/job/execute-sdl.yml | 2 +- global.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e81c516ec533..8831c0750abf 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 9a437ab126433012dd2e479c5edfb552b83e872b + c313ff83e84445094fa5463498d5c94c29f27e1d diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config index 968b39bef5f1..3bd8b29ebd72 100644 --- a/eng/common/sdl/packages.config +++ b/eng/common/sdl/packages.config @@ -1,4 +1,4 @@ - + diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index c64c4f5686cb..53c100222b21 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -83,7 +83,7 @@ jobs: continueOnError: ${{ parameters.sdlContinueOnError }} - ${{ if eq(parameters.overrideParameters, '') }}: - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 - -GuardianPackageName Microsoft.Guardian.Cli.win10-x64.0.20.1 + -GuardianPackageName Microsoft.Guardian.Cli.0.53.3 -NugetPackageDirectory $(Build.SourcesDirectory)\.packages -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) ${{ parameters.additionalParameters }} diff --git a/global.json b/global.json index d479fe48a79e..4dc745ad127e 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21071.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21072.6" } } From 8bd8a756891e785d8b6f1052fa9adcf9addf9fa8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 28 Jan 2021 13:26:09 +0000 Subject: [PATCH 1312/2702] Update dependencies from https://github.com/dotnet/arcade build 20210126.1 (#944) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/templates/post-build/post-build.yml | 18 +++++++++++++++++- global.json | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8831c0750abf..2f8ba1fbddac 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - c313ff83e84445094fa5463498d5c94c29f27e1d + d7da80d96daf724706aafa450e00222fe659af13 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 375e91acdf3a..b9aa5b6052c7 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -61,6 +61,7 @@ parameters: VS167ChannelId: 1011 VS168ChannelId: 1154 VSMasterChannelId: 1012 + VS169ChannelId: 1473 stages: - ${{ if or(and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')), eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: @@ -90,7 +91,7 @@ stages: inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 arguments: -PromoteToChannels "$(TargetChannels)" - -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}} + -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}},${{parameters.VS169ChannelId}} - job: displayName: NuGet Validation @@ -552,3 +553,18 @@ stages: transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'VS_16_9_Publishing' + channelName: 'VS 16.9' + channelId: ${{ parameters.VS169ChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' diff --git a/global.json b/global.json index 4dc745ad127e..8f763d179e4b 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21072.6" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21076.1" } } From b6f944221d8727487c62028d00e23cecd97a5eec Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 30 Jan 2021 13:20:33 +0000 Subject: [PATCH 1313/2702] Update dependencies from https://github.com/dotnet/arcade build 20210128.12 (#946) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/sdl/init-sdl.ps1 | 13 +------------ global.json | 2 +- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2f8ba1fbddac..11d9838454e3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - d7da80d96daf724706aafa450e00222fe659af13 + 3233c41c837f72827efd8f827b538e047334847d diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 index a68bf0b88ea6..bb6a42971108 100644 --- a/eng/common/sdl/init-sdl.ps1 +++ b/eng/common/sdl/init-sdl.ps1 @@ -29,18 +29,7 @@ $zipFile = "$WorkingDirectory/gdn.zip" Add-Type -AssemblyName System.IO.Compression.FileSystem $gdnFolder = (Join-Path $WorkingDirectory '.gdn') -try { - # We try to download the zip; if the request fails (e.g. the file doesn't exist), we catch it and init guardian instead - Write-Host 'Downloading gdn folder from internal config repostiory...' - Invoke-WebRequest -Headers @{ "Accept"="application/zip"; "Authorization"="Basic $encodedPat" } -Uri $uri -OutFile $zipFile - if (Test-Path $gdnFolder) { - # Remove the gdn folder if it exists (it shouldn't unless there's too much caching; this is just in case) - Remove-Item -Force -Recurse $gdnFolder - } - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $WorkingDirectory) - Write-Host $gdnFolder - ExitWithExitCode 0 -} catch [System.Net.WebException] { } # Catch and ignore webexception + try { # if the folder does not exist, we'll do a guardian init and push it to the remote repository Write-Host 'Initializing Guardian...' diff --git a/global.json b/global.json index 8f763d179e4b..17fcd3a65376 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21076.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21078.12" } } From bac52fecf518f2b44a317bb94dd43f1721f9e926 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 2 Feb 2021 13:25:18 +0000 Subject: [PATCH 1314/2702] Update dependencies from https://github.com/dotnet/arcade build 20210131.1 (#947) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/internal-feed-operations.ps1 | 2 -- eng/common/internal-feed-operations.sh | 2 -- global.json | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 11d9838454e3..77ef5974bd75 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 3233c41c837f72827efd8f827b538e047334847d + f6ed3308865528c56ed26b85004121fce56bf4f4 diff --git a/eng/common/internal-feed-operations.ps1 b/eng/common/internal-feed-operations.ps1 index b8f6529fdc87..418c09930cf1 100644 --- a/eng/common/internal-feed-operations.ps1 +++ b/eng/common/internal-feed-operations.ps1 @@ -63,8 +63,6 @@ function SetupCredProvider { } if (($endpoints | Measure-Object).Count -gt 0) { - # [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Endpoint code example with no real credentials.")] - # Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}' $endpointCredentials = @{endpointCredentials=$endpoints} | ConvertTo-Json -Compress # Create the environment variables the AzDo way diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh index a27410f6321b..e2233e781220 100755 --- a/eng/common/internal-feed-operations.sh +++ b/eng/common/internal-feed-operations.sh @@ -62,8 +62,6 @@ function SetupCredProvider { endpoints+=']' if [ ${#endpoints} -gt 2 ]; then - # [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Endpoint code example with no real credentials.")] - # Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}' local endpointCredentials="{\"endpointCredentials\": "$endpoints"}" echo "##vso[task.setvariable variable=VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]$endpointCredentials" diff --git a/global.json b/global.json index 17fcd3a65376..6e963f74d43f 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21078.12" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21081.1" } } From 462fc3d92b2ab8ec319cbfc8d3948da78852ee76 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 2 Feb 2021 12:16:01 -0800 Subject: [PATCH 1315/2702] Fixup feeds --- NuGet.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NuGet.config b/NuGet.config index 3b22e3ed49e1..c2f0ca50d87e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -5,7 +5,7 @@ - + From e6cd4caa8a2fabac586e01a066f0e54d4ca1c7fb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 3 Feb 2021 13:25:27 +0000 Subject: [PATCH 1316/2702] Update dependencies from https://github.com/dotnet/arcade build 20210201.7 (#949) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- .../templates/post-build/post-build.yml | 20 +++++++++++++++++-- global.json | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 77ef5974bd75..920e6a14e633 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - f6ed3308865528c56ed26b85004121fce56bf4f4 + 2b430e5bbfaec37a6cead2f0cf79157f01f1a623 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index b9aa5b6052c7..822ff5975b01 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -62,7 +62,8 @@ parameters: VS168ChannelId: 1154 VSMasterChannelId: 1012 VS169ChannelId: 1473 - + VS1610ChannelId: 1692 + stages: - ${{ if or(and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')), eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: - stage: Validate @@ -91,7 +92,7 @@ stages: inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1 arguments: -PromoteToChannels "$(TargetChannels)" - -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}},${{parameters.VS169ChannelId}} + -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}},${{parameters.VS169ChannelId}},${{parameters.VS1610ChannelId}} - job: displayName: NuGet Validation @@ -568,3 +569,18 @@ stages: transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json' shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + + - template: \eng\common\templates\post-build\channels\generic-public-channel.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + stageName: 'VS_16_10_Publishing' + channelName: 'VS 16.10' + channelId: ${{ parameters.VS1610ChannelId }} + transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json' + shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' diff --git a/global.json b/global.json index 6e963f74d43f..bd88fef5f8a7 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21081.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21101.7" } } From ee113e1d7265438a943d50a8f123fd3817c70c86 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 3 Feb 2021 17:18:52 -0800 Subject: [PATCH 1317/2702] Fixup feeds --- .config/dotnet-tools.json | 12 ------------ NuGet.config | 2 +- perf/RealWorldSolution.cs | 10 +++++----- perf/dotnet-format.Performance.csproj | 5 ++--- 4 files changed, 8 insertions(+), 21 deletions(-) delete mode 100644 .config/dotnet-tools.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json deleted file mode 100644 index adb43a203ba6..000000000000 --- a/.config/dotnet-tools.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "benchmarkdotnet.tool": { - "version": "0.12.0", - "commands": [ - "dotnet-benchmark" - ] - } - } -} diff --git a/NuGet.config b/NuGet.config index 3b22e3ed49e1..c2f0ca50d87e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -5,7 +5,7 @@ - + diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index d3ef7f46e7d6..1427082ebf1b 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -73,14 +73,14 @@ private class RealWorldConfig : ManualConfig public RealWorldConfig() { var job = Job.Dry - .With(BenchmarkDotNet.Environments.Platform.X64) - .With(CoreRuntime.Core21) + .WithPlatform(BenchmarkDotNet.Environments.Platform.X64) + .WithRuntime(CoreRuntime.Core21) .WithWarmupCount(1) .WithIterationCount(12) - .WithOutlierMode(BenchmarkDotNet.Mathematics.OutlierMode.RemoveAll); + .WithOutlierMode(Perfolizer.Mathematics.OutlierDetection.OutlierMode.RemoveAll); Add(DefaultConfig.Instance - .With(job.AsDefault()) - .With(MemoryDiagnoser.Default)); + .AddJob(job.AsDefault()) + .AddDiagnoser(MemoryDiagnoser.Default)); } } } diff --git a/perf/dotnet-format.Performance.csproj b/perf/dotnet-format.Performance.csproj index 58d3d8fc8125..c58339aa38c2 100644 --- a/perf/dotnet-format.Performance.csproj +++ b/perf/dotnet-format.Performance.csproj @@ -9,9 +9,8 @@ Release - - - + + From 03bf2479e922ca753e452b17c913fec2c8b77fb3 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 3 Feb 2021 17:23:06 -0800 Subject: [PATCH 1318/2702] Add BenchmarkDotNet to Version.props --- eng/Versions.props | 2 ++ perf/dotnet-format.Performance.csproj | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 05c8c43a11e0..060846e2d34d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,6 +13,7 @@ true + 0.12.1 15.3.409 3.9.0-4.21067.2 @@ -24,6 +25,7 @@ Other Dependency versions --> + $(BenchmarkDotNetVersion) 2.0.0-beta1.20371.2 0.3.0-alpha.20371.2 $(MicrosoftBuildVersion) diff --git a/perf/dotnet-format.Performance.csproj b/perf/dotnet-format.Performance.csproj index c58339aa38c2..696025494bd7 100644 --- a/perf/dotnet-format.Performance.csproj +++ b/perf/dotnet-format.Performance.csproj @@ -9,8 +9,8 @@ Release - - + + From 68f3fc456adb69d0352552997a3484656aa4cad6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 6 Feb 2021 13:25:15 +0000 Subject: [PATCH 1319/2702] Update dependencies from https://github.com/dotnet/arcade build 20210205.5 (#956) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/dotnet-install.sh | 9 ++------- global.json | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 920e6a14e633..b807222dd4e8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 2b430e5bbfaec37a6cead2f0cf79157f01f1a623 + fc83e59329203724d4a63c4f6c843be62983a35e diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh index 25b69f8787f2..d6efeb44340b 100755 --- a/eng/common/dotnet-install.sh +++ b/eng/common/dotnet-install.sh @@ -49,13 +49,8 @@ while [[ $# > 0 ]]; do shift done -# Use uname to determine what the CPU is. -cpuname=$(uname -p) -# Some Linux platforms report unknown for platform, but the arch for machine. -if [[ "$cpuname" == "unknown" ]]; then - cpuname=$(uname -m) -fi - +# Use uname to determine what the CPU is, see https://en.wikipedia.org/wiki/Uname#Examples +cpuname=$(uname -m) case $cpuname in aarch64) buildarch=arm64 diff --git a/global.json b/global.json index bd88fef5f8a7..e202b86750d6 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21101.7" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21105.5" } } From b3e51833cc8c2e7c7bfe6d9347f0f01b9806c290 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 8 Feb 2021 11:25:26 -0800 Subject: [PATCH 1320/2702] Implement GetDocumentDiagnosticsAsync in CodeFix DiagnosticProvider --- src/Analyzers/SolutionCodeFixApplier.cs | 5 +- .../ThirdPartyAnalyzerFormatterTests.cs | 46 +++++++++++++++++++ .../analyzer_project/NuGet.config | 8 ++++ .../analyzer_project/analyzer_project.csproj | 1 + 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 tests/projects/for_analyzer_formatter/analyzer_project/NuGet.config diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index 0f565c032409..c9ae6bfa6b0b 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -109,9 +109,10 @@ public override Task> GetAllDiagnosticsAsync(Project pro return GetProjectDiagnosticsAsync(project, cancellationToken); } - public override Task> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) + public override async Task> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) { - throw new NotImplementedException(); + var projectDiagnostics = await GetProjectDiagnosticsAsync(document.Project, cancellationToken); + return projectDiagnostics.Where(diagnostic => diagnostic.Location.SourceTree?.FilePath == document.FilePath).ToImmutableArray(); } public override Task> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken) diff --git a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs index 7893f46d033e..3d463bd73091 100644 --- a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs +++ b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs @@ -118,5 +118,51 @@ void M() await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Analyzers, analyzerReferences: analyzerReferences); } + + [Fact] + public async Task TestIDisposableAnalyzer_Loads() + { + var analyzerReferences = GetAnalyzerReferences("IDisposable"); + + var testCode = @" +using System.IO; + +class C +{ + void M() + { + var stream = File.OpenRead(string.Empty); + var b = stream.ReadByte(); + stream.Dispose(); + } +} +"; + + var expectedCode = @" +using System.IO; + +class C +{ + void M() + { + using (var stream = File.OpenRead(string.Empty)) + { + var b = stream.ReadByte(); + } + } +} +"; + + var editorConfig = new Dictionary() + { + // Turn off all diagnostics analyzers + ["dotnet_analyzer_diagnostic.severity"] = "none", + + // Prefer using. IDISP017 + ["dotnet_diagnostic.IDISP017.severity"] = "error", + }; + + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Analyzers, analyzerReferences: analyzerReferences); + } } } diff --git a/tests/projects/for_analyzer_formatter/analyzer_project/NuGet.config b/tests/projects/for_analyzer_formatter/analyzer_project/NuGet.config new file mode 100644 index 000000000000..b7fb18432b1a --- /dev/null +++ b/tests/projects/for_analyzer_formatter/analyzer_project/NuGet.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj b/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj index 5f0d40f60ce9..b106a32018b9 100644 --- a/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj +++ b/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj @@ -9,6 +9,7 @@ all runtime; build; native; contentfiles; analyzers + From 5a6bf2d9e92c5a7342006b0a041a04788ad153b6 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 8 Feb 2021 12:00:03 -0800 Subject: [PATCH 1321/2702] Isolate each Analyzer assembly by loading into its own context. --- .../AnalyzerReferenceInformationProvider.cs | 4 +- .../ThirdPartyAnalyzerFormatterTests.cs | 49 ++++++++++++++++++- .../analyzer_project/analyzer_project.csproj | 1 + 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/Analyzers/AnalyzerReferenceInformationProvider.cs b/src/Analyzers/AnalyzerReferenceInformationProvider.cs index eaae51abedad..9ab076289d99 100644 --- a/src/Analyzers/AnalyzerReferenceInformationProvider.cs +++ b/src/Analyzers/AnalyzerReferenceInformationProvider.cs @@ -23,10 +23,8 @@ public ImmutableDictionary GetAnalyzersAndFixers( private AnalyzersAndFixers GetAnalyzersAndFixers(Project project) { - var context = new AnalyzerLoadContext(); - var analyzerAssemblies = project.AnalyzerReferences - .Select(reference => TryLoadAssemblyFrom(reference.FullPath, context)) + .Select(reference => TryLoadAssemblyFrom(reference.FullPath, new AnalyzerLoadContext())) .OfType() .ToImmutableArray(); diff --git a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs index 3d463bd73091..f430e9d6af14 100644 --- a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs +++ b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs @@ -120,7 +120,7 @@ void M() } [Fact] - public async Task TestIDisposableAnalyzer_Loads() + public async Task TestIDisposableAnalyzer_AddsUsing() { var analyzerReferences = GetAnalyzerReferences("IDisposable"); @@ -141,6 +141,53 @@ void M() var expectedCode = @" using System.IO; +class C +{ + void M() + { + using (var stream = File.OpenRead(string.Empty)) + { + var b = stream.ReadByte(); + } + } +} +"; + + var editorConfig = new Dictionary() + { + // Turn off all diagnostics analyzers + ["dotnet_analyzer_diagnostic.severity"] = "none", + + // Prefer using. IDISP017 + ["dotnet_diagnostic.IDISP017.severity"] = "error", + }; + + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Analyzers, analyzerReferences: analyzerReferences); + } + + [Fact] + public async Task TestLoadingAllAnalyzers_LoadsDependenciesFromAllSearchPaths() + { + // Loads all analyzer references. + var analyzerReferences = _analyzerReferencesProject.AnalyzerReferences; + + var testCode = @" +using System.IO; + +class C +{ + void M() + { + var stream = File.OpenRead(string.Empty); + var b = stream.ReadByte(); + stream.Dispose(); + } +} +"; + + var expectedCode = @" +using System.IO; + class C { void M() diff --git a/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj b/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj index b106a32018b9..ad9d39ed6d91 100644 --- a/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj +++ b/tests/projects/for_analyzer_formatter/analyzer_project/analyzer_project.csproj @@ -9,6 +9,7 @@ all runtime; build; native; contentfiles; analyzers + From 21869c239b76aa1fd7503898fd614f51a15f05e9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 9 Feb 2021 13:24:53 +0000 Subject: [PATCH 1322/2702] Update dependencies from https://github.com/dotnet/arcade build 20210205.12 (#962) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 27 ++++++++++++++++++++------- eng/common/tools.sh | 23 ++++++++++++++++++----- global.json | 2 +- 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b807222dd4e8..58d081e0498d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - fc83e59329203724d4a63c4f6c843be62983a35e + 938b3e8b4edcd96ca0f0cbbae63c87b3f51f7afe diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 10e98593e0c8..572da3b9f12c 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -508,7 +508,7 @@ function InitializeBuildTool() { ExitWithExitCode 1 } $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') - $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp2.1' } + $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp3.1' } } elseif ($msbuildEngine -eq "vs") { try { $msbuildPath = InitializeVisualStudioMSBuild -install:$restore @@ -644,13 +644,26 @@ function MSBuild() { } $toolsetBuildProject = InitializeToolset - $path = Split-Path -parent $toolsetBuildProject - $path = Join-Path $path (Join-Path $buildTool.Framework 'Microsoft.DotNet.ArcadeLogging.dll') - if (-not (Test-Path $path)) { - $path = Split-Path -parent $toolsetBuildProject - $path = Join-Path $path (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll') + $basePath = Split-Path -parent $toolsetBuildProject + $possiblePaths = @( + # new scripts need to work with old packages, so we need to look for the old names/versions + (Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.ArcadeLogging.dll')), + (Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll')), + (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.ArcadeLogging.dll')), + (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.Arcade.Sdk.dll')) + ) + $selectedPath = $null + foreach ($path in $possiblePaths) { + if (Test-Path $path -PathType Leaf) { + $selectedPath = $path + break + } + } + if (-not $selectedPath) { + Write-PipelineTelemetryError -Category 'Build' -Message 'Unable to find arcade sdk logger assembly.' + ExitWithExitCode 1 } - $args += "/logger:$path" + $args += "/logger:$selectedPath" } MSBuild-Core @args diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 0920f5965b69..9019b7f5cc91 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -307,7 +307,7 @@ function InitializeBuildTool { # return values _InitializeBuildTool="$_InitializeDotNetCli/dotnet" _InitializeBuildToolCommand="msbuild" - _InitializeBuildToolFramework="netcoreapp2.1" + _InitializeBuildToolFramework="netcoreapp3.1" } # Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116 @@ -414,11 +414,24 @@ function MSBuild { fi local toolset_dir="${_InitializeToolset%/*}" - local logger_path="$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.ArcadeLogging.dll" - if [[ ! -f $logger_path ]]; then - logger_path="$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" + # new scripts need to work with old packages, so we need to look for the old names/versions + local selectedPath= + local possiblePaths=() + possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.ArcadeLogging.dll" ) + possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" ) + possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.ArcadeLogging.dll" ) + possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" ) + for path in "${possiblePaths[@]}"; do + if [[ -f $path ]]; then + selectedPath=$path + break + fi + done + if [[ -z "$selectedPath" ]]; then + Write-PipelineTelemetryError -category 'Build' "Unable to find arcade sdk logger assembly." + ExitWithExitCode 1 fi - args=( "${args[@]}" "-logger:$logger_path" ) + args+=( "-logger:$selectedPath" ) fi MSBuild-Core ${args[@]} diff --git a/global.json b/global.json index e202b86750d6..a4eb412004ce 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21105.5" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21105.12" } } From 10cb1372c1e5ea38316d1e77c4682b3bf950870f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 9 Feb 2021 19:25:15 +0000 Subject: [PATCH 1323/2702] [master] Update dependencies from dotnet/roslyn (#963) [master] Update dependencies from dotnet/roslyn - Add vs-impl to nuget.config for new dependency - Add MessagePack to Signing.props --- NuGet.config | 1 + eng/Signing.props | 3 ++- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NuGet.config b/NuGet.config index c2f0ca50d87e..078b79b456aa 100644 --- a/NuGet.config +++ b/NuGet.config @@ -6,6 +6,7 @@ + diff --git a/eng/Signing.props b/eng/Signing.props index 898175b44674..228b3adaf303 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -1,6 +1,7 @@ - + + \ No newline at end of file diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 58d081e0498d..c1bc019ba910 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - b72ed3eb15901f1e0f8adac1fb2a68897b6b69b4 + 0892a9d11c7cde79ba85511c41b2a627ee524737 diff --git a/eng/Versions.props b/eng/Versions.props index 060846e2d34d..56b190c0bfb4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.9.0-4.21067.2 + 3.10.0-1.21109.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From e61485b07e9129d504bc8c34e76ca91ba67b8ab2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 10 Feb 2021 13:23:51 +0000 Subject: [PATCH 1324/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210210.14 (#966) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c1bc019ba910..9d6768d5c94b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 0892a9d11c7cde79ba85511c41b2a627ee524737 + 8902ca78b074d9a46fa15a26d0afd052b58f13c1 diff --git a/eng/Versions.props b/eng/Versions.props index 56b190c0bfb4..4c357a0f2430 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-1.21109.12 + 3.10.0-1.21110.14 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 296e5177d090417e20586007a422e2531a1401d7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 11 Feb 2021 13:23:47 +0000 Subject: [PATCH 1325/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210211.18 (#967) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9d6768d5c94b..d341ce9b948a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 8902ca78b074d9a46fa15a26d0afd052b58f13c1 + 297a67e23b9e42ba575aa942adc08c97f46c99d0 diff --git a/eng/Versions.props b/eng/Versions.props index 4c357a0f2430..9a016e47cb47 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-1.21110.14 + 3.10.0-1.21111.18 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 0839279635b204860acad229405ee145e1e548bb Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 11 Feb 2021 10:05:29 -0800 Subject: [PATCH 1326/2702] Move to SetScale build pool --- azure-pipelines-official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 14ea42809274..0961f39c9581 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -21,7 +21,7 @@ stages: - job: OfficialBuild displayName: Official Build pool: - name: VSEng-MicroBuildVS2017 + name: VSEngSS-MicroBuild2019 demands: - cmd From 4c1316c5702f850d77a576c23ea84c3ccb2f82e5 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Thu, 11 Feb 2021 10:55:32 -0800 Subject: [PATCH 1327/2702] Update Versions.props --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 9a016e47cb47..a0b58f123f28 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - 5 + 6 0 From 422e3ee0bb5e273f921f833922012fb0397e178b Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 11 Feb 2021 11:18:06 -0800 Subject: [PATCH 1328/2702] Update readme and version for release --- README.md | 110 ++++++++++++++++++++++----------------------- eng/Versions.props | 2 +- 2 files changed, 54 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index ce8e8815189c..f8da42fdeb0c 100644 --- a/README.md +++ b/README.md @@ -10,32 +10,60 @@ `dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](./docs/Supported-.editorconfig-options.md). -### New in v4.0.130203 +### New in v5.0.211103 -#### Breaking Changes: -- Added an imports formatter for sorting imports. -- Format now runs on the latest installed Runtime. -- `--check` and `--dry-run` have combined into a single option. -- `--include` and `--exclude` use space-separated paths instead of comma-separated. +### New Features +- Can now apply codestyle fixes automatically with `dotnet format --fix-codestyle` +- Can now apply analyzer codefixes automatically with `dotnet format --fix-analyzers` -#### Deprecations: -- Added warning to use the default argument instead of `--workspace` option. Use `dotnet format ./format.sln` instead of `dotnet format -w ./format.sln` -- Added warning to use the default argument to specify the folder path when using the `--folder` option. Use `dotnet format ./src -f` instead of `dotnet format -f ./src` -- Added warning to use `--include` instead of `--files` alias. -- Added warning to use `--check` instead of `--dry-run` alias. +### Breaking Changes + +Removed Deprecated options from 4.0: +- Removed `--dry-run` should use `--check` instead +- Removed `--files` should use `--include` instead +- Removed `--workspace` this option is now implied #### Changes: -- [Add Imports Formatter (693)](https://www.github.com/dotnet/format/pull/693) -- [Always run on the latest Runtime (694)](https://www.github.com/dotnet/format/pull/694) -- [Move to Roslyn's editorconfig support (590)](https://www.github.com/dotnet/format/pull/590) -- [Command line argument for solution/project as positional argument (681)](https://www.github.com/dotnet/format/pull/681) -- [Add option to format generated code files. (673)](https://www.github.com/dotnet/format/pull/673) -- [Produce a binlog when verbosity is set to detailed (605)](https://www.github.com/dotnet/format/pull/605) -- [Fix #581 - Add final newline false positive (633)](https://www.github.com/dotnet/format/pull/633) -- [Combine --check and --dry-run into a single option. (541)](https://github.com/dotnet/format/pull/541) -- [Use space-separated paths instead of comma-separated for --include and --exclude (551)](https://github.com/dotnet/format/pull/551) -- [Support loading commandline options from response files (552)](https://github.com/dotnet/format/pull/552) -- [Support file globbing in --include and --exclude options (555)](https://github.com/dotnet/format/pull/555) +- [Isolate each Analyzer assembly into its own LoadContext. (959)](https://www.github.com/dotnet/format/pull/959) +- [Implement GetDocumentDiagnosticsAsync in CodeFix DiagnosticProvider (958)](https://www.github.com/dotnet/format/pull/958) +- [Fix missing ` in README.md (914)](https://www.github.com/dotnet/format/pull/914) +- [Add unit test for 3rd party fixer formatting (896)](https://www.github.com/dotnet/format/pull/896) +- [Add unit test for code style fixer formatting (893)](https://www.github.com/dotnet/format/pull/893) +- [Improve FixAll support by using equivalence key when available (884)](https://www.github.com/dotnet/format/pull/884) +- [Only run analyzers against specified project when workspace is a project (865)](https://www.github.com/dotnet/format/pull/865) +- [When matching all files don't rely on FileMatcher (864)](https://www.github.com/dotnet/format/pull/864) +- [Fix markdown formatting in example table (858)](https://www.github.com/dotnet/format/pull/858) +- [Add ability to read --{in,ex}clude value from stdin (790)](https://www.github.com/dotnet/format/pull/790) +- [Add test to ensure code containing comment is treated as generated. (857)](https://www.github.com/dotnet/format/pull/857) +- [Fixes #834 : error reportfile without directory specified (842)](https://www.github.com/dotnet/format/pull/842) +- [Log there were warnings loading the workspace if diagnostics are reported (841)](https://www.github.com/dotnet/format/pull/841) +- [Fix CommandLine_AllArguments_Bind test (818)](https://www.github.com/dotnet/format/pull/818) +- [Fix Run argument names (817)](https://www.github.com/dotnet/format/pull/817) +- [Add option for whitespace formatting (774)](https://www.github.com/dotnet/format/pull/774) +- [Load analyzer assemlbies in their own AssemblyLoadContext (746)](https://www.github.com/dotnet/format/pull/746) +- [Check that file exists before considering it for formatting (775)](https://www.github.com/dotnet/format/pull/775) +- [Report formatted files and counts based based on reported issues. (776)](https://www.github.com/dotnet/format/pull/776) +- [Support generated_code editorconfig setting (780)](https://www.github.com/dotnet/format/pull/780) +- [Create integrations.md (777)](https://www.github.com/dotnet/format/pull/777) +- [Fix warnings and apply suggestions. (767)](https://www.github.com/dotnet/format/pull/767) +- [Improve folder workspace performance (763)](https://www.github.com/dotnet/format/pull/763) +- [Improve folder performance (760)](https://www.github.com/dotnet/format/pull/760) +- [Update --include and --exclude documentation (761)](https://www.github.com/dotnet/format/pull/761) +- [Remove aliases for the fix style and fix analyzers options (753)](https://www.github.com/dotnet/format/pull/753) +- [Run analyzers during integration tests (728)](https://www.github.com/dotnet/format/pull/728) +- [Remove unnecessary imports (749)](https://www.github.com/dotnet/format/pull/749) +- [Only include compiler diagnostics if a fixer supports them (750)](https://www.github.com/dotnet/format/pull/750) +- [Added CodeFormatter tests for `--fix-style` (751)](https://www.github.com/dotnet/format/pull/751) +- [Format one solution per repo during integration tests (739)](https://www.github.com/dotnet/format/pull/739) +- [Filter analyzers by project language before running (725)](https://www.github.com/dotnet/format/pull/725) +- [Run all analyzers even when a fixer isn't present (723)](https://www.github.com/dotnet/format/pull/723) +- [Update documentation for analyzers (722)](https://www.github.com/dotnet/format/pull/722) +- [Add devcontainer to better support Codespaces (721)](https://www.github.com/dotnet/format/pull/721) +- [Add validation when specifying --folder and analyzers (715)](https://www.github.com/dotnet/format/pull/715) +- [Merge in Feature/analyzers (713)](https://www.github.com/dotnet/format/pull/713) +- [Remove deprecated options and aliases (710)](https://www.github.com/dotnet/format/pull/710) +- [Added reflection based discovery of analyzers and fixes (698)](https://www.github.com/dotnet/format/pull/698) +- [Only run Imports formatter when is has configuration in the .editorconfig (701)](https://www.github.com/dotnet/format/pull/701) ### How To Install @@ -54,43 +82,11 @@ Development builds of `dotnet-format` are being hosted on Azure Packages. You ca You can install the latest build of the tool using the following command. ```console -dotnet tool install -g dotnet-format --version 5.0.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json +dotnet tool install -g dotnet-format --version 5.1.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json ``` ### How To Use -#### Latest release v4.1.131201 - -By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory you will need to specify the workspace to format using the `-w` or `-f` options. You can control how verbose the output will be by using the `-v` option. - -```sh -Usage: - dotnet-format [options] - -Options: - --folder, -f Whether to treat the `` path as a folder of files. - --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. - --exclude A list of relative file or folder paths to exclude from formatting. - --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - --report Accepts a file path, which if provided, will produce a json report in the given directory. - --verbosity, -v Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - --version Display version information -``` - -Add `format` after `dotnet` and before the command arguments that you want to run: - -| Examples | Description | -| ---------------------------------------------------------- |---------------------------------------------------------------------------------------------- | -| dotnet **format** | Formats the project or solution in the current directory. | -| dotnet **format** <workspace> | Formats a specific project or solution. | -| dotnet **format** <folder> -f | Formats a particular folder and subfolders. | -| dotnet **format** -v diag | Formats with very verbose logging. | -| dotnet **format** --include Programs.cs Utility\Logging.cs | Formats the files Program.cs and Utility\Logging.cs | -| dotnet **format** --check | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | -| dotnet **format** --report <report-path> | Formats and saves a json report file to the given directory. | - -#### Development builds v5.x - By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory, you will need to specify the workspace to format. You can control how verbose the output will be by using the `-v` option. ```console @@ -147,8 +143,8 @@ You can build and package the tool using the following commands. The instruction ```console build -pack # The final line from the build will read something like -# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.5.0.0-dev.nupkg'. -# Use the value that is in the form `5.0.0-dev` as the version in the next command. +# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.5.1.0-dev.nupkg'. +# Use the value that is in the form `5.1.0-dev` as the version in the next command. dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version dotnet format ``` diff --git a/eng/Versions.props b/eng/Versions.props index 9a016e47cb47..5e358ae5a9d5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,7 +2,7 @@ 5 - 0 + 1 From 2fee254d856af07a89285e47a2f0442e7905720a Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 11 Feb 2021 11:20:00 -0800 Subject: [PATCH 1329/2702] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f8da42fdeb0c..5829f50e79b4 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Development builds of `dotnet-format` are being hosted on Azure Packages. You ca You can install the latest build of the tool using the following command. ```console -dotnet tool install -g dotnet-format --version 5.1.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json +dotnet tool install -g dotnet-format --version 6.0.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json ``` ### How To Use @@ -143,8 +143,8 @@ You can build and package the tool using the following commands. The instruction ```console build -pack # The final line from the build will read something like -# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.5.1.0-dev.nupkg'. -# Use the value that is in the form `5.1.0-dev` as the version in the next command. +# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.6.0.0-dev.nupkg'. +# Use the value that is in the form `6.0.0-dev` as the version in the next command. dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version dotnet format ``` From 9df12becc789afc47d3a3df0a24ce39e90c47356 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 11 Feb 2021 11:21:16 -0800 Subject: [PATCH 1330/2702] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5829f50e79b4..20fee5a83152 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ### New in v5.0.211103 ### New Features -- Can now apply codestyle fixes automatically with `dotnet format --fix-codestyle` +- Can now apply codestyle codefixes automatically with `dotnet format --fix-codestyle` - Can now apply analyzer codefixes automatically with `dotnet format --fix-analyzers` ### Breaking Changes From d8ba1c35cffc6d5ec7dd052307fddef2d2feca6a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 12 Feb 2021 13:23:34 +0000 Subject: [PATCH 1331/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210211.42 (#974) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d341ce9b948a..510ec9a18b86 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 297a67e23b9e42ba575aa942adc08c97f46c99d0 + a16a9a089e0648b1cd07c1c00e2a58187b68db9a diff --git a/eng/Versions.props b/eng/Versions.props index a0b58f123f28..5bd070427049 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-1.21111.18 + 3.10.0-1.21111.42 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 7d0a6396f1c0aecf8206146b04f9a9ecc8a4a2b4 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 12 Feb 2021 16:20:35 -0800 Subject: [PATCH 1332/2702] Replace Windows_Spanish with a Linux_Spanish job in CI --- azure-pipelines.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ad8392731e17..67b530105cd1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -53,7 +53,7 @@ jobs: _configuration: Debug Release: _configuration: Release - timeoutInMinutes: 90 + timeoutInMinutes: 20 steps: - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine displayName: Build and Test @@ -73,12 +73,12 @@ jobs: continueOnError: true condition: not(succeeded()) -- job: Windows_Spanish +- job: Linux_Spanish pool: - name: NetCorePublic-Pool - queue: buildpool.windows.10.amd64.es.vs2017.open + vmImage: 'ubuntu-latest' variables: - _os: Windows + _os: Linux + LC_ALL: es_ES.UTF-8 strategy: maxParallel: 4 matrix: @@ -88,19 +88,22 @@ jobs: _configuration: Release timeoutInMinutes: 20 steps: - - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine + - script: sudo locale-gen es_ES.utf8 && export LC_ALL=es_ES.UTF-8 + displayName: Set es_ES locale + - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine displayName: Build and Test - - task: PublishTestResults@1 + - task: PublishTestResults@2 + displayName: Publish xUnit Test Results inputs: testRunner: XUnit - testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml' + testResultsFiles: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_configuration)/*.xml' mergeTestResults: true testRunTitle: 'Spanish $(_os) $(_configuration)' condition: always() - task: PublishBuildArtifacts@1 displayName: Publish Logs inputs: - PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_configuration)' ArtifactName: 'Spanish $(_os) $(_configuration)' continueOnError: true condition: not(succeeded()) @@ -118,4 +121,4 @@ jobs: PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\' ArtifactName: 'Formatting Check' continueOnError: true - condition: not(succeeded()) + condition: not(succeeded()) \ No newline at end of file From 0ecee32cc41fe9dbe037183a32da5fee0043133c Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 12 Feb 2021 16:41:54 -0800 Subject: [PATCH 1333/2702] Reduce timeouts and remove unneeded local-gen call --- azure-pipelines.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 67b530105cd1..3482cc26f1a0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,7 +22,7 @@ jobs: _configuration: Debug Release: _configuration: Release - timeoutInMinutes: 20 + timeoutInMinutes: 10 steps: - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine displayName: Build and Test @@ -53,7 +53,7 @@ jobs: _configuration: Debug Release: _configuration: Release - timeoutInMinutes: 20 + timeoutInMinutes: 10 steps: - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine displayName: Build and Test @@ -86,10 +86,8 @@ jobs: _configuration: Debug Release: _configuration: Release - timeoutInMinutes: 20 + timeoutInMinutes: 10 steps: - - script: sudo locale-gen es_ES.utf8 && export LC_ALL=es_ES.UTF-8 - displayName: Set es_ES locale - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine displayName: Build and Test - task: PublishTestResults@2 From d37f33fa49c6048b2dd1f322672239a88ebd6875 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 14 Feb 2021 13:23:31 +0000 Subject: [PATCH 1334/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210213.12 (#977) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 510ec9a18b86..fd81a070bbf9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - a16a9a089e0648b1cd07c1c00e2a58187b68db9a + 69f354dd21df8dac374c35169bdabb9000cfdea3 diff --git a/eng/Versions.props b/eng/Versions.props index 5bd070427049..4da49216c33a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-1.21111.42 + 3.10.0-1.21113.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From f02a72e1c516b49aabcedb747bbdefe2b587a5db Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 16 Feb 2021 13:23:46 +0000 Subject: [PATCH 1335/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210216.4 (#980) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fd81a070bbf9..46ad173fbb53 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 69f354dd21df8dac374c35169bdabb9000cfdea3 + 07b9d1dcd6991eb33a30bfdd29183a0a64348379 diff --git a/eng/Versions.props b/eng/Versions.props index 4da49216c33a..63023aaff31c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-1.21113.12 + 3.10.0-1.21116.4 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 5a80629b953bc0dafe6ec05ce7a9829e595b08af Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 16 Feb 2021 11:00:18 -0800 Subject: [PATCH 1336/2702] Only report fixable compiler diagnostics. --- src/Analyzers/AnalyzerFormatter.cs | 18 +-- src/Analyzers/AnalyzerRunner.cs | 22 ++-- src/Analyzers/Interfaces/IAnalyzerRunner.cs | 4 +- .../CodeStyleAnalyzerFormatterTests.cs | 15 +++ tests/Formatters/AbstractFormatterTests.cs | 108 +++++++++++++++--- 5 files changed, 134 insertions(+), 33 deletions(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 07bed02a8cc9..067864326fe4 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -68,9 +68,9 @@ public async Task FormatAsync( var allFixers = projectAnalyzersAndFixers.Values.SelectMany(analyzersAndFixers => analyzersAndFixers.Fixers).ToImmutableArray(); // Only include compiler diagnostics if we have a fixer that can fix them. - var includeCompilerDiagnostics = allFixers.Any( - codefix => codefix.FixableDiagnosticIds.Any( - id => id.StartsWith("CS") || id.StartsWith("BC"))); + var fixableCompilerDiagnostics = allFixers + .SelectMany(codefix => codefix.FixableDiagnosticIds.Where(id => id.StartsWith("CS") || id.StartsWith("BC"))) + .ToImmutableHashSet(); var analysisStopwatch = Stopwatch.StartNew(); logger.LogTrace(Resources.Running_0_analysis, _name); @@ -86,7 +86,7 @@ public async Task FormatAsync( var projectAnalyzers = await FilterBySeverityAsync(solution, projectAnalyzersAndFixers, formattablePaths, severity, cancellationToken).ConfigureAwait(false); // Determine which diagnostics are being reported for each project. - var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, formatOptions, severity, includeCompilerDiagnostics, logger, formattedFiles, cancellationToken).ConfigureAwait(false); + var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, formatOptions, severity, fixableCompilerDiagnostics, logger, formattedFiles, cancellationToken).ConfigureAwait(false); var projectDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds; logger.LogTrace(Resources.Complete_in_0_ms, projectDiagnosticsMS); @@ -97,7 +97,7 @@ public async Task FormatAsync( logger.LogTrace(Resources.Fixing_diagnostics); // Run each analyzer individually and apply fixes if possible. - solution = await FixDiagnosticsAsync(solution, projectAnalyzers, allFixers, projectDiagnostics, formattablePaths, severity, includeCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); + solution = await FixDiagnosticsAsync(solution, projectAnalyzers, allFixers, projectDiagnostics, formattablePaths, severity, fixableCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); var fixDiagnosticsMS = analysisStopwatch.ElapsedMilliseconds - projectDiagnosticsMS; logger.LogTrace(Resources.Complete_in_0_ms, fixDiagnosticsMS); @@ -114,7 +114,7 @@ private async Task>> Get ImmutableHashSet formattablePaths, FormatOptions options, DiagnosticSeverity severity, - bool includeCompilerDiagnostics, + ImmutableHashSet fixableCompilerDiagnostics, ILogger logger, List formattedFiles, CancellationToken cancellationToken) @@ -132,7 +132,7 @@ private async Task>> Get } // Run all the filtered analyzers to determine which are reporting diagnostic. - await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, includeCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); + await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, fixableCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); } LogDiagnosticLocations(solution, result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger, formattedFiles); @@ -179,7 +179,7 @@ private async Task FixDiagnosticsAsync( ImmutableDictionary> projectDiagnostics, ImmutableHashSet formattablePaths, DiagnosticSeverity severity, - bool includeCompilerDiagnostics, + ImmutableHashSet fixableCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken) { @@ -217,7 +217,7 @@ private async Task FixDiagnosticsAsync( var analyzers = projectAnalyzers[project.Id] .Where(analyzer => analyzer.SupportedDiagnostics.Any(descriptor => descriptor.Id == diagnosticId)) .ToImmutableArray(); - await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, includeCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); + await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, fixableCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); } var hasDiagnostics = result.Diagnostics.Any(kvp => kvp.Value.Count > 0); diff --git a/src/Analyzers/AnalyzerRunner.cs b/src/Analyzers/AnalyzerRunner.cs index ce656e748c6a..0b481e46bc8d 100644 --- a/src/Analyzers/AnalyzerRunner.cs +++ b/src/Analyzers/AnalyzerRunner.cs @@ -17,10 +17,10 @@ public Task RunCodeAnalysisAsync( Project project, ImmutableHashSet formattableDocumentPaths, DiagnosticSeverity severity, - bool includeCompilerDiagnostics, + ImmutableHashSet fixableCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken) - => RunCodeAnalysisAsync(result, ImmutableArray.Create(analyzers), project, formattableDocumentPaths, severity, includeCompilerDiagnostics, logger, cancellationToken); + => RunCodeAnalysisAsync(result, ImmutableArray.Create(analyzers), project, formattableDocumentPaths, severity, fixableCompilerDiagnostics, logger, cancellationToken); public async Task RunCodeAnalysisAsync( CodeAnalysisResult result, @@ -28,13 +28,13 @@ public async Task RunCodeAnalysisAsync( Project project, ImmutableHashSet formattableDocumentPaths, DiagnosticSeverity severity, - bool includeCompilerDiagnostics, + ImmutableHashSet fixableCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken) { // If are not running any analyzers and are not reporting compiler diagnostics, then there is // nothing to report. - if (analyzers.IsEmpty && includeCompilerDiagnostics) + if (analyzers.IsEmpty && fixableCompilerDiagnostics.IsEmpty) { return; } @@ -53,10 +53,16 @@ public async Task RunCodeAnalysisAsync( return; } + var compilerDiagnostics = !fixableCompilerDiagnostics.IsEmpty + ? compilation.GetDiagnostics(cancellationToken) + .Where(diagnostic => fixableCompilerDiagnostics.Contains(diagnostic.Id)) + .ToImmutableArray() + : ImmutableArray.Empty; + ImmutableArray diagnostics; if (analyzers.IsEmpty) { - diagnostics = compilation.GetDiagnostics(cancellationToken); + diagnostics = compilerDiagnostics; } else { @@ -69,9 +75,9 @@ public async Task RunCodeAnalysisAsync( logAnalyzerExecutionTime: false, reportSuppressedDiagnostics: false); var analyzerCompilation = compilation.WithAnalyzers(analyzers, analyzerOptions); - diagnostics = includeCompilerDiagnostics - ? await analyzerCompilation.GetAllDiagnosticsAsync(cancellationToken).ConfigureAwait(false) - : await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken).ConfigureAwait(false); + + diagnostics = await analyzerCompilation.GetAnalyzerDiagnosticsAsync(cancellationToken).ConfigureAwait(false); + diagnostics = diagnostics.AddRange(compilerDiagnostics); } // filter diagnostics diff --git a/src/Analyzers/Interfaces/IAnalyzerRunner.cs b/src/Analyzers/Interfaces/IAnalyzerRunner.cs index beb19d1ebb5d..0bca9d462af2 100644 --- a/src/Analyzers/Interfaces/IAnalyzerRunner.cs +++ b/src/Analyzers/Interfaces/IAnalyzerRunner.cs @@ -16,7 +16,7 @@ Task RunCodeAnalysisAsync( Project project, ImmutableHashSet formattableDocumentPaths, DiagnosticSeverity severity, - bool includeCompilerDiagnostics, + ImmutableHashSet fixableCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken); @@ -26,7 +26,7 @@ Task RunCodeAnalysisAsync( Project project, ImmutableHashSet formattableDocumentPaths, DiagnosticSeverity severity, - bool includeCompilerDiagnostics, + ImmutableHashSet fixableCompilerDiagnostics, ILogger logger, CancellationToken cancellationToken); } diff --git a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs index 1dbf7d60201d..01dd7b51f556 100644 --- a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs +++ b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs @@ -59,5 +59,20 @@ void M() await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.CodeStyle); } + + [Fact] + public async Task TestNonFixableCompilerDiagnostics_AreNotReported() + { + var testCode = @" +class C +{ + public int M() + { + return null; // Cannot convert null to 'int' because it is a non-nullable value type (CS0037) + } +}"; + + await AssertNoReportedFileChangesAsync(testCode, "root = true", fixCategory: FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Warning); + } } } diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 49a0f49f822b..d7447493482a 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -86,6 +86,46 @@ private protected string ToEditorConfig(IReadOnlyDictionary edit { string.Join(Environment.NewLine, editorConfig.Select(kvp => $"{kvp.Key} = {kvp.Value}")) } "; + private protected Task AssertNoReportedFileChangesAsync( + string code, + IReadOnlyDictionary editorConfig, + Encoding? encoding = null, + FixCategory fixCategory = FixCategory.Whitespace, + IEnumerable? analyzerReferences = null, + DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + { + return AssertNoReportedFileChangesAsync(code, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + } + + private protected async Task AssertNoReportedFileChangesAsync( + string code, + string editorConfig, + Encoding? encoding = null, + FixCategory fixCategory = FixCategory.Whitespace, + IEnumerable? analyzerReferences = null, + DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + { + var (formattedText, formattedFiles, logger) = await ApplyFormatterAsync(code, editorConfig, encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + + try + { + // Ensure the code is unchanged + Assert.Equal(code, formattedText.ToString()); + + // Ensure no non-fixable diagnostics were reported + Assert.Empty(formattedFiles); + } + catch + { + TestOutputHelper?.WriteLine(logger.GetLog()); + throw; + } + + return formattedText; + } + private protected Task AssertCodeUnchangedAsync( string code, IReadOnlyDictionary editorConfig, @@ -95,7 +135,32 @@ private protected Task AssertCodeUnchangedAsync( DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { - return AssertCodeChangedAsync(code, code, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + return AssertCodeUnchangedAsync(code, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + } + + private protected async Task AssertCodeUnchangedAsync( + string code, + string editorConfig, + Encoding? encoding = null, + FixCategory fixCategory = FixCategory.Whitespace, + IEnumerable? analyzerReferences = null, + DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + { + var (formattedText, _, logger) = await ApplyFormatterAsync(code, editorConfig, encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + + try + { + // Ensure the code is unchanged + Assert.Equal(code, formattedText.ToString()); + } + catch + { + TestOutputHelper?.WriteLine(logger.GetLog()); + throw; + } + + return formattedText; } private protected Task AssertCodeChangedAsync( @@ -121,7 +186,31 @@ private protected async Task AssertCodeChangedAsync( DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) { - var text = SourceText.From(testCode, encoding ?? Encoding.UTF8); + var (formattedText, _, logger) = await ApplyFormatterAsync(testCode, editorConfig, encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + + try + { + Assert.Equal(expectedCode, formattedText.ToString()); + } + catch + { + TestOutputHelper?.WriteLine(logger.GetLog()); + throw; + } + + return formattedText; + } + + private protected async Task<(SourceText FormattedText, List FormattedFiles, TestLogger Logger)> ApplyFormatterAsync( + string code, + string editorConfig, + Encoding? encoding = null, + FixCategory fixCategory = FixCategory.Whitespace, + IEnumerable? analyzerReferences = null, + DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + { + var text = SourceText.From(code, encoding ?? Encoding.UTF8); TestState.Sources.Add(text); var solution = await GetSolutionAsync(TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), editorConfig, analyzerReferences); @@ -145,22 +234,13 @@ private protected async Task AssertCodeChangedAsync( var pathsToFormat = GetOnlyFileToFormat(solution); var logger = new TestLogger(); + var formattedFiles = new List(); - var formattedSolution = await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, logger, new List(), default); + var formattedSolution = await Formatter.FormatAsync(solution, pathsToFormat, formatOptions, logger, formattedFiles, default); var formattedDocument = GetOnlyDocument(formattedSolution); var formattedText = await formattedDocument.GetTextAsync(); - try - { - Assert.Equal(expectedCode, formattedText.ToString()); - } - catch - { - TestOutputHelper?.WriteLine(logger.GetLog()); - throw; - } - - return formattedText; + return (formattedText, formattedFiles, logger); } /// From e90c06e5d6293b1ca2fabed27e4a82d434121b87 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 16 Feb 2021 15:49:15 -0800 Subject: [PATCH 1337/2702] Log warnings and errors to the standard error stream --- src/Logging/SimpleConsoleLogger.cs | 32 +++++++++++++------ .../SimpleConsoleLoggerFactoryExtensions.cs | 4 +-- src/Logging/SimpleConsoleLoggerProvider.cs | 10 +++--- src/Program.cs | 6 ++-- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/Logging/SimpleConsoleLogger.cs b/src/Logging/SimpleConsoleLogger.cs index e091fd5dc508..9e73c4caf9ed 100644 --- a/src/Logging/SimpleConsoleLogger.cs +++ b/src/Logging/SimpleConsoleLogger.cs @@ -15,7 +15,8 @@ internal class SimpleConsoleLogger : ILogger private readonly IConsole _console; private readonly ITerminal _terminal; - private readonly LogLevel _logLevel; + private readonly LogLevel _minimalLogLevel; + private readonly LogLevel _minimalErrorLevel; private static ImmutableDictionary LogLevelColorMap => new Dictionary { @@ -28,11 +29,12 @@ internal class SimpleConsoleLogger : ILogger [LogLevel.None] = ConsoleColor.White, }.ToImmutableDictionary(); - public SimpleConsoleLogger(IConsole console, LogLevel logLevel) + public SimpleConsoleLogger(IConsole console, LogLevel minimalLogLevel, LogLevel minimalErrorLevel) { _terminal = console.GetTerminal(); _console = console; - _logLevel = logLevel; + _minimalLogLevel = minimalLogLevel; + _minimalErrorLevel = minimalErrorLevel; } public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) @@ -45,20 +47,21 @@ public void Log(LogLevel logLevel, EventId eventId, TState state, Except lock (_gate) { var message = formatter(state, exception); + var logToErrorStream = logLevel >= _minimalErrorLevel; if (_terminal is null) { - LogToConsole(message); + LogToConsole(_console, message, logToErrorStream); } else { - LogToTerminal(message, logLevel); + LogToTerminal(message, logLevel, logToErrorStream); } } } public bool IsEnabled(LogLevel logLevel) { - return (int)logLevel >= (int)_logLevel; + return (int)logLevel >= (int)_minimalLogLevel; } public IDisposable BeginScope(TState state) @@ -66,17 +69,26 @@ public IDisposable BeginScope(TState state) return NullScope.Instance; } - private void LogToTerminal(string message, LogLevel logLevel) + private void LogToTerminal(string message, LogLevel logLevel, bool logToErrorStream) { var messageColor = LogLevelColorMap[logLevel]; _terminal.ForegroundColor = messageColor; - _terminal.Out.Write($" {message}{Environment.NewLine}"); + + LogToConsole(_terminal, message, logToErrorStream); + _terminal.ResetColor(); } - private void LogToConsole(string message) + private void LogToConsole(IConsole console, string message, bool logToErrorStream) { - _console.Out.Write($" {message}{Environment.NewLine}"); + if (logToErrorStream) + { + console.Error.Write($" {message}{Environment.NewLine}"); + } + else + { + console.Out.Write($" {message}{Environment.NewLine}"); + } } } } diff --git a/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs index 0f75b1557c0d..5795b9e3bd7d 100644 --- a/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs +++ b/src/Logging/SimpleConsoleLoggerFactoryExtensions.cs @@ -7,9 +7,9 @@ namespace Microsoft.CodeAnalysis.Tools.Logging { internal static class SimpleConsoleLoggerFactoryExtensions { - public static ILoggerFactory AddSimpleConsole(this ILoggerFactory factory, IConsole console, LogLevel logLevel) + public static ILoggerFactory AddSimpleConsole(this ILoggerFactory factory, IConsole console, LogLevel minimalLogLevel, LogLevel minimalErrorLevel) { - factory.AddProvider(new SimpleConsoleLoggerProvider(console, logLevel)); + factory.AddProvider(new SimpleConsoleLoggerProvider(console, minimalLogLevel, minimalErrorLevel)); return factory; } } diff --git a/src/Logging/SimpleConsoleLoggerProvider.cs b/src/Logging/SimpleConsoleLoggerProvider.cs index 81516f0fe728..1b98c212df40 100644 --- a/src/Logging/SimpleConsoleLoggerProvider.cs +++ b/src/Logging/SimpleConsoleLoggerProvider.cs @@ -8,17 +8,19 @@ namespace Microsoft.CodeAnalysis.Tools.Logging internal class SimpleConsoleLoggerProvider : ILoggerProvider { private readonly IConsole _console; - private readonly LogLevel _logLevel; + private readonly LogLevel _minimalLogLevel; + private readonly LogLevel _minimalErrorLevel; - public SimpleConsoleLoggerProvider(IConsole console, LogLevel logLevel) + public SimpleConsoleLoggerProvider(IConsole console, LogLevel minimalLogLevel, LogLevel minimalErrorLevel) { _console = console; - _logLevel = logLevel; + _minimalLogLevel = minimalLogLevel; + _minimalErrorLevel = minimalErrorLevel; } public ILogger CreateLogger(string name) { - return new SimpleConsoleLogger(_console, _logLevel); + return new SimpleConsoleLogger(_console, _minimalLogLevel, _minimalErrorLevel); } public void Dispose() diff --git a/src/Program.cs b/src/Program.cs index b02dc3f20fec..83ca628e2a99 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -62,7 +62,7 @@ public static async Task Run( // Setup logging. var logLevel = GetLogLevel(verbosity); - var logger = SetupLogging(console, logLevel); + var logger = SetupLogging(console, minimalLogLevel: logLevel, minimalErrorLevel: LogLevel.Warning); // Hook so we can cancel and exit when ctrl+c is pressed. var cancellationTokenSource = new CancellationTokenSource(); @@ -288,10 +288,10 @@ internal static DiagnosticSeverity GetSeverity(string? severity) }; } - private static ILogger SetupLogging(IConsole console, LogLevel logLevel) + private static ILogger SetupLogging(IConsole console, LogLevel minimalLogLevel, LogLevel minimalErrorLevel) { var serviceCollection = new ServiceCollection(); - serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, logLevel)); + serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, minimalLogLevel, minimalErrorLevel)); serviceCollection.AddLogging(); var serviceProvider = serviceCollection.BuildServiceProvider(); From 06e778ebaa4a9a7f9bdb94e0242f504ce4b069cf Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 17 Feb 2021 10:18:04 -0800 Subject: [PATCH 1338/2702] Revert version to 5.1 for bugfix releases --- README.md | 4 ++-- eng/Versions.props | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 20fee5a83152..c30bd6bda0ba 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,10 @@ dotnet tool install -g dotnet-format Development builds of `dotnet-format` are being hosted on Azure Packages. You can visit the [dotnet-format Azure Packages page](https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&view=versions&package=dotnet-format&protocolType=NuGet). -You can install the latest build of the tool using the following command. +You can install the latest build of the tool using the following command. ```console -dotnet tool install -g dotnet-format --version 6.0.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json +dotnet tool install -g dotnet-format --version 5.1.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json ``` ### How To Use diff --git a/eng/Versions.props b/eng/Versions.props index 63023aaff31c..a4d6b136ab12 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,8 +1,8 @@ - 6 - 0 + 5 + 1 From 2c86c8ea8e358521f545789dede4795d7204be6b Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 17 Feb 2021 10:19:57 -0800 Subject: [PATCH 1339/2702] Bump version to 6.0 for feature releases --- README.md | 2 +- eng/Versions.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c30bd6bda0ba..6cf4a62c9f24 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Development builds of `dotnet-format` are being hosted on Azure Packages. You ca You can install the latest build of the tool using the following command. ```console -dotnet tool install -g dotnet-format --version 5.1.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json +dotnet tool install -g dotnet-format --version 6.0.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json ``` ### How To Use diff --git a/eng/Versions.props b/eng/Versions.props index a4d6b136ab12..63023aaff31c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,8 +1,8 @@ - 5 - 1 + 6 + 0 From 0fa6b76db4830585d4e17d0ee3744a2596654f91 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 17 Feb 2021 12:38:42 -0800 Subject: [PATCH 1340/2702] Fix localized build badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c30bd6bda0ba..aeb6105df85d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ |Branch| Windows (Debug)| Windows (Release)| Linux (Debug) | Linux (Release) | Localization (Debug) | Localization (Release) | |---|:--:|:--:|:--:|:--:|:--:|:--:| -[master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows_Spanish&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)| +[master](https://github.com/dotnet/format/tree/master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Windows&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux_Spanish&_configuration=debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/format/dotnet.format?branchName=master&jobName=Linux_Spanish&_configuration=release&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=347&branchName=master)| `dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](./docs/Supported-.editorconfig-options.md). From 3a10a511a6034bee6414cfca26a5b79664241e03 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 18 Feb 2021 13:18:37 +0000 Subject: [PATCH 1341/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210218.24 (#984) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 46ad173fbb53..68969b402214 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 07b9d1dcd6991eb33a30bfdd29183a0a64348379 + 14f53cbd3050330f60050ec05ba68784928cd6e8 diff --git a/eng/Versions.props b/eng/Versions.props index a4d6b136ab12..90378c05e8d0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-1.21116.4 + 3.10.0-2.21118.24 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 63da4ca793658666eb72e39ffcea8724da502e9d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 19 Feb 2021 13:24:06 +0000 Subject: [PATCH 1342/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210218.48 (#987) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 68969b402214..9c8e7fbda3b2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 14f53cbd3050330f60050ec05ba68784928cd6e8 + 6e48f428a2d6e9086620d45b8c9b12507ac84f55 diff --git a/eng/Versions.props b/eng/Versions.props index 90378c05e8d0..ca741b5c82ca 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-2.21118.24 + 3.10.0-2.21118.48 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 6f064ca035d9e6cf7a59e5d7eccc0f335e06f174 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 21 Feb 2021 13:23:11 +0000 Subject: [PATCH 1343/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210221.14 (#989) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9c8e7fbda3b2..343d91a49600 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 6e48f428a2d6e9086620d45b8c9b12507ac84f55 + 475b525d8d2294c2b11166f3d4996b01772e144a diff --git a/eng/Versions.props b/eng/Versions.props index ca741b5c82ca..a166d5028e14 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-2.21118.48 + 3.10.0-2.21121.14 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From dbec967f9929e3cf257cb02d0ebcb79a3c1c529b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 22 Feb 2021 13:23:17 +0000 Subject: [PATCH 1344/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210222.2 (#991) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 343d91a49600..7464adb5bc4b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 475b525d8d2294c2b11166f3d4996b01772e144a + 686f13c61b1e26071ae89e107b0a3407a6b93a74 diff --git a/eng/Versions.props b/eng/Versions.props index a166d5028e14..d9d1586d32b4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-2.21121.14 + 3.10.0-2.21122.2 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 389f8e32296285adedd600704b286c35239cf8bc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 23 Feb 2021 13:18:26 +0000 Subject: [PATCH 1345/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210223.18 (#994) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7464adb5bc4b..951f74a5551f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 686f13c61b1e26071ae89e107b0a3407a6b93a74 + 9c6d28c22bc12863b20baf4103bec95a7f32f939 diff --git a/eng/Versions.props b/eng/Versions.props index d9d1586d32b4..55b0d609838c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-2.21122.2 + 3.10.0-2.21123.18 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 692529069cfe7fa9f6e6ce1f885203c41706d6eb Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 23 Feb 2021 10:41:14 -0800 Subject: [PATCH 1346/2702] add icon --- src/Resources/icon.png | Bin 0 -> 94541 bytes src/dotnet-format.csproj | 1 + 2 files changed, 1 insertion(+) create mode 100644 src/Resources/icon.png diff --git a/src/Resources/icon.png b/src/Resources/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..992a8f583faf9370ae997ce1cd692ccc496e6e9d GIT binary patch literal 94541 zcmeFYga=LO)UAd5Dcbcma$Jgp42?=ghrn1W_m}MLOJFPqE zJE=Z5X`(CAOfEa=P?^F|mV`e!O^_u;%;$RqbY*PC)|{HcG7#u0l#4gIH|gG8GGB*-PiY~Z7$)o-5ajBuqlp@95m}mNL6)s4+KM)4$!H~Fj z7i8LAvmiwX7x=uqYU0VJpkZ%#JgcvJQusQ*ELudFx^c17g+(lXdpeVLQ$uxQxbJ+Y zi*Iu-EByJpz5e%Rv-Zn_5t`=Y-F~relJ#C6(fPBG6m8PU7t_lzp|E7B{b{`c+9wjd(h5J!cSSmUx+k{j-RL7um1U1qK=7 z)xxPi$kAfsX#I$GLog}6_pai$zW=DD=OkZ1SoK+qR>(&JrPe#$1^b=wC?0A(2x;DX znwWPa-ApA1-Tc*FM2q8Rb8@ugjxwyKP&CTBrX+p07mnKsq)s1865)Ev+^$CAH(CjF zQL~lY#b{whn(v}Nd_YUHhov!ud7o}PfPA#1f}2)L(6DH~4;n-F^_B)L>9tN#3nRm5 z>?a3xhHC{^sX;+f+~r@=Znj0?6IR4sEu86QkIl*W;>i@TS;Q8YJ!!XN6uMsWQf@cm zZHuREnH<0BeWlvT(CPMobpBX*kMO7NQDq0?2pYqymo{Hdt6%)Wt@d7^^Movg{SqM( zhH{^Jl7&a1f11ot9~gc9q3rtQcKi2TxgUb=#JZSDcjYh&M0~f3xAL|`J99SIlBhIS z-t&Fa{n|J9V^7q?)c~@iVPa_hxa!uV=q95(R6Ix!O5#rWvS+F?S4pBe!e6UAXWnYB z#MhZN=9Fg7^L=u^YQNEjk&lsd$qMExx&9M|xxv`4@4{;yqHzlO9$@J|#R%9WOKdJp z<$?6?ygnB^iYPvpq8*G3Sld^F%o*NJ&<|MioPbdJV?!2)OvE;lcK7tqI!1BZ9_SQJ z%=cqK)dO*TbKV4sR^G;~r1qFYyS&efxJ7iI^AWt*^!8>o;)CVgWSl>NpR1}Wfn~fG#C-|7GJDW<_!T>H;I${F9I4y zd<@x~cb<%Q6cwuRF>+-7(9O~=_mSse{)`x>lV%8e7uScDNAxjD;-UAuq&{?FS?eOG zP3TniqB>1{lzevhs;dCjkV51rp(~m}_(YD+i2Na=H%4o;d-m`M6x-B*jHssjDKE{N z;LqmPdd$pSB&HU6XgZOCrd+!LZ4qu}ev>|FulXHGwqd%Cj2W*E_I!PzZIl(A9`jMB z)|c$p_&dGQM5}PEApTD=9Zbq}&k0@-DPi1sMfFPd75}dFI$aALVYqURzve+SIl~p$X%k|FVvpZO$9;I~{b;Ap;5k;cxM*6M zeB#@rw;X-VUwZp=`_%e^iH#z-KF1I~CQ$#QuA^D6Wx$%mCK-Rfg!+31xr|EQ3oTMD zj$)i~{&AmiT>}FH9fLN5xVmnG$XfQgW9#%E-bF_l1!^uiPF7=9m{XWjs#6$Kc2gW; z>GleE1%;zns~oFthgyf|haOYdTUAp}?E;S}#vjqW4 z?Wuu$Wp^oWXYS!V6JNy6?L}IdI&=v339$;Fe#!csHLE`B*kV>~_Rg$sUZabfxu^D- zbIQlTgu$ypib1^GLHQ~L37m!xo5cp@;fwsy~KiU_o9T;Up5WZ4!L#={^IOZwy7W8 zjMvW;9g~=pnD$LS<2x|M3YE(WnKV!T>=ZexAId4jk@Vz?*wA`|K;4^KZ9V%s+Xl+o z>IS811M|8c>urMHr+UT4ywlxE-P)rglI(>Q`)Mr+!Z7Px@K@ zcz!ZI)0gqm#MZRb3cv`>uqdPsEMf<I*B$bmRH@riPErGYUoQxKWqnD{srUSLR+e?=8fJIY0!VKtZ+>5^u}rGr zt4>N~i+8XiNh<}jINsh#raqN5)qQJ$&r>9{s!{1yN$aVwOH|Jwp4u9ACDASTki?mF ziK{n;KhuSt7%K|Fg=L2~hW8k=6w?Ra{!YdnW11P7`MZ3=3lACT?y)<&EvbCCn>1X$ zc&v7qAri2##%iGbK>Nvfu2rFxzUu&^>$h&jmn^>{tD@d@3w#dJv)`PWyl^^pI&*4Q zW>$?(eJXk8)M9wqa_WNd=2Z$tGtmrVDB}m^mei%Ud5>&VCKNLgpC(-jF$q|xDE)|c z()y$JG2SMYUDZyNA)l#m>k&mVxscn{c!qVxm{Q^IWP9mWtMib%%>2%llZq6KOf^ z{doHH`qzY4;sMF9k4UCuzy|F3{hpwSkO{2EB*&Z)dbKb4+?>8Hm?SlF>(?wD3A4@C z#wRCmvaekWEli(lZfWYT4eeaEPgfJ0up3Xc4LpqJ0o$vdd*z2B~jn-Kc&tenH}#QSRSh?KoY*Y>B( z@2ts@CwGm0wv4`5EQz8iefZ=@scgx~MDhe@saLaNe>&_8h;CJ$?3%U8K)1^%}aKE1X5Ei8F~eyMNvhGg>jyZJ2gF>G!TR)|hR! zoXUvKd=Ow`?`S>Ql=QK|mu9kX^5kN8O?q~crmp=6IUE=oT#x<|mk&2VkUq+V{37+C ziqTN`0i@|v+-w4y`j;hG&CY~lA|8?HlBNI3{Er` z7Nj+~d+)Cu^J`ds&BT%RS*N`CwRZqriFvx)?0A|p{JG$g@)GokD9()W>4%L=Coqb6#X)&u!(QHH{Wzc-th8jlX$x3@?=Fn6$L zj9gmD1vOj9rxA~uYhgY{xFu{8tGUm9e?M`@qN+tgVyYpY&tfz9xXdGUXhVO zWr*=M9GQW6f=dNaFDx1MV!uCbsdWc-gHbvh#J&eJwd92;MnYbP`os@8PCif$_E^@D zr{h8m|pWo)2xakf@gj$DJnMu6ioUV$U4x zxXqqBm|Jjr+Bt%!ArJ{qF>q;T;c7gUo@S7yPm8+|x7!Qw!hX=O@KevOkB@dsd zs3;HbJ)V2_xWE%!E?)MoW}aO3E)4&?b+*>4sNcJ^z_76SX9Kc3^K<|34k<@o(S0EnC^yNuH<7Hq_M-wC|73%=jNB3?Hm)EBN`fu4}WXyni?| zGgHzKd|L(r2S1xEmF`;x7wLzK*^9GqU0q#gC#N;%T~T3S;SEv$<=jQeb`T&NG8T35 z@bES){bOJ-T2l$&lX^C^p2J}Z7y^QV8qc0FxcM)iaC)BAef;>-yAt``Fc30f7(-`_ z4}tO%IlhAEyyuCuBI)w=^!7H8<7?mNGwncfS12{$1OVGyCqP1UVz?xNk?ZhN3{Gh~ zJ1Z-Z^ZuZQ#kmc6F8mJpE&U}lAod~5o46zAszWVSAK!!Wl5uKaV8DCVr!5-HDT@ls zX=)AYAq>_^IG5e)=H{k=N772w+3-W@c02IWySVb+KvpQd>2v5W6NM_W7j&D8i_iRy zj*jZu!g#l1C_e-v#o)Ba@AH@yw5I$}>WrsaTC#O@brU~u=U>*y2J5_n2wC;gbAdI< z67tqSw##MpiEGG?4-Ul7BfNTBM?1an)uVxbcjlbOfZNh{m?y=ouiI?QzedZm#ngV5 zK#LTdphKXe)P4>E$1n6W)g(RQi;D|GIVTwzj+ppB9}xPdNF;V(NeTP9 zh~D8okqNOESmFMl`YqJ>G&u-tQfUA3VKSPNsVQw0?Vl4=6g&o+tdF6w36^Pxdm>!q z64z50oCBH4KJA6 z?G5$3MM_vpA$R0Vb@jcCQtFfMZn&b;h9QvpbSfKE#6#v{fbnW+CtSD~7<43^m;D!{ zxnM$+k0G#AJ!X+xum^Cx!|FLMHnu8UJCYJO!)G9nBa|>2Wvw!9KuQUNQ~}ig-rxff zPEKs|Q!+6Tvlrm@i*3IpZk4R^@~DW&$l}`C@$)?0DJVOuJOrl47w-s11%(nKpjRrV zOq^XUGm_5i?CkD?*BUY%gJ9E#eqHn#B}4EW{;;%i`t!Bulckn~0$~dwE@0L8>hVBf zIU;uMJzaVFh_J9Q!!V`kO~jr1GQD81+b=JKkr6B^D#~@Kk6e@^Bo>sag*ElkfiKT(3yWZvA zM@glJ zjeJW7HdJ=NtKQ$=Ux!Y@YJ_$LEim!Ej0G6Yek;_+j>yX1zCbn%S3iWOU11at*vHl3 z9eOm>HX}^^{LnqI^85N8nbW=5ia-4B@wz?$47}nG3V~wmrWup8`I>5Q___1KE2S=Q zG=c%Ni37s@FVf|9=RO5ncOaqXDzJCKGAv+Jy6If`9!BLZ7bj;erpcn^%S~)LWYq8W zK3up=haS-2(QM}BLlJiNh?dsYqfG33ynia~AvYFB0g8ph?YV5vM>F=tVsbG_nSCN~*Qs1CXr{2|1NeUVo znuzG=f{~Gt?WEniZ~+BijxI()NLwa#U0sEbA3t`($UdKfmqpF?_Td9 zVaXx9Smwm|BkW+J<;U0yvGg6CNnzr-$tY{`Iwwy7i(AbE*Vh;7%(qBBNeGam!D}A@ z36ZTq$*(Ztlaj_}T75#c%&aK?D(vxdl=6I0*E@?D_bA2PInmJ2j$AQTWIC*Y-1Jat zoN3vt*4A`fN)e=8)MjAOK@)z5*pAFAJTQ4{WtppM`+Q;EaSnf&zsIfNPbp?|#f;p1Y>xQof#Qr?%g|LA|eJGTycE$ zS6~!9+5AIm7zjz-3#76c3Cu4k15gJ1U-#pgA^#HHsFRaZH<63GDEo_Nr`skij% zIy&-q@7^7snqq%~*Yk%Sgt8CU^7X)-oihW+ymPH3?hPVzDFS#@jb^q}bZ8KyCrL&N zj){d;esN*L&I->}1e$oiNdgB!6ate3D&Ho+QgvtOh&tLTys1IuF%M;@O?6TtLluPl>SPqwBNn3$MCzo3T~ zp*GvE#|ms21Rf7&Sw^hra*Bb4l{=cNkjkL{e9aNO1y>>Zwm6ZMwRQI4p=(K5*`_b~ z&iyPC@W~Z@5EOObtU`glUNk)r4uqqj>C5pBfsn%GQbSvt zaRnQ#Jqs`(cW3l0ufMJmL}N}UR)G;>_xRD?-rmyU;@Gl;6cSkuUTVh_<}E~2R9svY zVd4*a1B2BA1=c4}t_Pw5+9H^mc*e(f21_g*myF4oh+HJH6^zl{HxqrbL`fXs1~cC}jxwe{I6Tbbd)6ZZ-^lM0pk#qphKl!EW$!(mZS^^M za7kYNEIl3%UK!VstB)F283T#_rQuNuOi4C%ljzRL;}HelN{%7z5u{<&X~M%8%&Z5+_cLM71M-!HXdyMZmyb3AQmJ$ z0S>BB`T;m3VCScR5tOC3@jhVW^zV(LP`G?Zh6aBQ-aJ4U+)5l+UoT|P?%%3SMHY-i zfaMS!s%vF{ zWUN-xO|nxqUTGY8Xy7$a{)qzOM?OLuz${(g#1iE>5%SC7}M8gKEJVGFd3?Z9m-AkAMtc{H}V2E+{Cd zh&rH?0N70$2Ni+%0f9w>X>5v2Sgql~Zr#St!XRQcmEvu~?*;ZEbsIyq4}Y@3fhHk7 zzE3-l3&HvTXq(`TBM4a#7%pm2_=8q?6oHkMyyTMJt_?M(R_ll|ZDruci2sSR4>RiOBzxw>GWKy-{2C4#x~=z51)RXaO7%_CFn|6BLo z%yaAON<=KGwf67EYtX*Fj{>Ik)B9<*@7UNF0GZl!4vx2A`(US*Q?hUWMS79oiJHD# zBW8SZawXtOkWiQonC2<{BO+FI_ME{%al75T^%kelcbp(;1!N(cZ zpFELMh^EY5STNsM-*4&l^z!<6H22bXe0*Hp&W`K*_wNK1awC(IR#$w@J}2AMvWr~2 zVr^ZQzmNC!=uAvZ_CYZ2=#T;VLk@^Gn$Mr-9ld`2y0UFwg_0PY&P77g(O-Kf!8eJn zl$Q-5H$7QoagdwxnDB7E7tVc3$w0ll>|{FH+9Mf~K9EjY_-U9l7L=rw6Z2FC3Khhl z6mdjW*VKfYxHvoi%K;Q+Wg+j~yEkq-^g8fM-lg<2ejRN%bco25 zZcw3DMfe)$l{q$Su_vl#1|ldg)YplE==JLS*6HKp+9e-82w5MWtEHZFVj&Qf)SSK= zGBP-@OW`1g`275Q0-nTPpOBiye+ZloIn{ldB`4o4}RAmP^^R%>5iB@*Dirn%g0) z-epB~f#SJIz*XHhmDQ=)7Ow-V!`0D=1O=}n4S#9dNnWFsS94(JuN9D)xCe1&86}@O z$>gNrr=d(S>-YIsz>#%1Zq}Y?De9gmH!MHc%wzAIoQLb}?rYv~dV9@qVJ`nvYUEnSZ`Z(tuptqiM5`faWyBhtTS1TkETV8EmV8Dhp>fdf8soq0k7t_*5x?N=VhRQ}4iaYe6rElPP;u)_a)x_~@Z&k);^Bp@KEW+r zlib_2n5lmibF}fpFpNKyI^q^YIbAH_HXgODQF5fii#>Cr7FMboy~R`mUsq1eA6^<2 z(Px*oF$6TYtE>W0m>>S!=Q=&aL6mHU!kZiw7{KTGtE*Oax5J9G0mWO!ZhR%aBE4`~ zi!SE__gprR@?_vD2>Q@88zStud{1}vW4Pn>UAtrcS=Xg>nED_J@ISrc zO6MBh6L(#G>nf?O9tPPl`cY+s6)IBNHOXmw_NAMr{nA`=#&Z#;CND|?4Z-=e@ogyf zUFX9&7DnIQON-4+HV8g5?Z_>te^$pv@vZ~=OeUEe1zb$$rM^eCaB~L!nSsq z52oww#>|#_uu}qj<>ln&*`oNGf6(cd8#YAie0ZuTeSOMcH(B|K&Mt@G8NnP~Fo5fo z)C>yIj8dN0_h>Gk-vz-b%K^sej|D*DbjOihcxf~}uk|;^1vVzuKfu}AX0#=K6#!9C z%vPa^o}E<*8Q{2|CIeU@xvS2UJ&awVFo*W532)zsYp*{Cyg5jQl8W}d7KH0eh!Lyt$nQ%LWL-jH(lrs7qI^&vhnG{ftiU(U!k^Wf|fEEsfyT* zQZlxUFU-#piGkcibt+wcUEEnsq(f4vJZ0Iku&~fyDOqKF+7%+|zNxoC-4^;78>9FE zQkUXte}HGLw4yC%r|m*DL8x{?pj$jz;@4GQ*Y~hrzgxci{v7%1spOaMpQD~~qQ5I$ zw#u(R7P4`0$e*ZxVPoe|+ajdtVklWxJFcl^$n`{sa$HHNAo|&-AT$B9PWS>%rtdD% zb7Fj62I$OV&z+gp7s^INqR+T1nVUYD-3OQvyUw57#>%R4d#^b2brca>;*zkcNlCh* ziVBY3@lVUcvz5%T_M0n*x>T*9fW~2w{S#`X>kN%0;SOg{`PgA(;L;+2>I`*uBEzc| zi6Ac657`8=_XZ`!+4*nQQ~QfPoFTpo-O*4PGb^!X&0Ftz(9e3NnczNO>j48kFvl%G zbtX4X*J`;v@-GoF>HW=1awx#1vZLtWRJ_^(73?Pz4bkza^MZn4=?`DN;q{tSQC7xA zgTu)f=$>bj2lBL?21%VQ5uKkd#yoi`Yu&2>9b@hGAx69C(WunLMmy8P-I*tGD$SIO zo0>{3u9oWEUrLS%*47BDGdv#`{^iFugamx&kFn=Oo7qRZ>Ic6rN<4 zautGnXdSOmq3iL%fsq1nFaBI%8z=HF47$GA&5e=DY2I!sya7z`^=XQa6% zV(Sd(3|N`7p_dqfkB&UGzw_CGMB}MJ(*0$(6f&Li2Rn=`EMrc+R0=MC2I)w8^#!Rs-5)1Qa^*l(jZjJQuE2P z4;I^dbo~_umYL7S>m%krx~zNy5vFV>5Dq_7&dSLN0s*w><465r>s5O9Hm@G6{cN&S z5R0oWblJscq?ow4R7!B)EMx4dOU|$mO;dcS;g`iJ#}0|XkxUQ0JzS7|zlKxIyYM}< zmD$DCy1b#x{P$t+XnzIHxVir5`(Z=fI{Wh6f(ddP`?@mw-j=sHj5Q%oaH*(=GToyn^W}I zbTF9@Bobxz47=OfKwGMxE6RKHFRKyq8o*23x7geG(=%O{h3u$;XZW96H!UX`Mz?0| zr>tg)3UEHB#=(-xxQ+f*{i9%`2T7p&z_Gg9&}Z!*R-$F4#)djA^<}vF+gnn^8BS=y?TXzv-M4)VV?H2_3@p<|A6&Yg#%rl&YpF^84WRqR3g_OmNOY3* z6T9lN>BA9O*I~&M)(jE{1!5v+_9$%e&()sa z89!fjWq(9e@^V)URO6O&S4=yk45Zyp$)8;(hgER4I?g}X-~;a1XeDSaN(Dl%_xn03 zI=Y8?X`SA^1Tde43qMpB4IAv4{4w9;NIOvo(dV(=Ps`*^EPTuQnDH2?4=&)|6x-4yNvxBIB9#agF*iA%-h*W z;YLi`R%8NO+@jK|fM!_+nTTW@`@uCBr} z=}n_kWF09=-ihzD#8G=K5u`ek6F3t_VM<3XbPm&+3?ou~vj`EaDp|$(@1w^za~9rf zvzPo-6vr~rZNm6|xi`CaFf5(P-Lm^&VQT}d1q(hkHTC)=TtOoYauZN7K4j%a|4P>o z!02hEuQErKqfOrF;i8P|Rf0_`-@a)AIwnquU(69Vop0N3p9aRd`qC|a(`eg&E@M_FJaPs89x-eTx&5vazt^@3=8l}jq?^G z{$VJ5)t^`Av?#w2;-MbT^fo#95flpT7Yh;ABAA;`x;gEY&T}@7KMh}A+o3NOTE@W)fxA0`2kdo$atv~!#=3A-0RJ{Wzq znW@}rYHl7oTpPnl%}gN*h6uUr7&@;MD!1fGMO4EV78b1LIs#Er#|Y*=8nt*gDu-hx zt0pO*#VFsI3_||F&>pAB>g+#?H>t{~Cv7V$_B^{8O|@?dPvkaIYHMqIAA$2JIZQ@F zgJAEq6tM-yuKS~ww`>trAit(4mCmpE($|*-5)P0$jfe*p6|s`@nLpgQ-3Wsb!na#b zjJE2?3(`_DFQ@W1G z@jbkkKbk_SEG$3sVZ(P#i`YQozIl;s@9rP z$o<2p4$4;I9@_$z`|K9!Z{N~NQYq%E&*{(sH;5THo=Z`7U1nQ>LnD<2fOc7#mgg-f z7S!+rtw+n$*H2~+4;JuxK9jZiP(e&{L(i#0EqJH>#@`hUA@WA%{(UHwgy)Fa*4@_Z z*RK%~QBi{4?+g0zV3XRve+&LpNfpv?;SW`G&o`fDnPG`Oi3D!24zY{3YB7+g_%W08 z0Q`+5yq^K&MPq$?Ty{8>>(BV$E?douHvmY#>zhRMsAo^1ct*4M|t z$Hbp|GE=CUUV>z49Ki%yD?fY{yx0+Y)(=xtQlba3+9JJ^0^v&E(KY26{n7U0S>wHZ z*Q5%TY23~GGBNP?h8wJQgW?5b`pIf|3TV zgP|QNiWfPLrs|m>gK~f}Mn>r>k!42dv8wlH_-w+^Z)izdzRM|D^wEh1rv-4V?7#~uI0aZ zQexAeo=oq&^4l5+X(qEu%V4$?N zwpRV!bT$fEQNgoUuK=9MBUnp70~Z4>cgm%>9GW?lTH*N4)II9J^bm)U#9sj#iodBp z$AUx;NGUYGox3gkWH{4bQ%o`ej4Y-~hKyOU+4pQ3#Z$(-3E zr~o{cJK?0`F5kJJp}o=r2Nh$l<%GlYjpULM3YxTrn2u;F@uK?r2`Lulil}!1J!dfB z{R(+P?#+kb3pvbiKF7+P!RY?{d9)+&mXC199pG#I>Sld*B)zZCRzjRtT60$hQ)ID7 zII{pgQXFQw0ftz1^oo4rx$A|*=GAWu^qC;!Z+Hp0^IAihkCobJnEOT3Qtac^-yXAd z(|D9f84nnW*}1wn@sN%hj)fPfq{;)zDYnk^1BxRw*dRz){B&tz0U1sc)w-*&o8tp3 z)hW-h%=AmtDbq94<+exck7dU1A8-MUuGi3}$ zSq_IXBF}|4dl!J4WHP42LW9RMqdF1tjoyEyiJ8O1z~D2Qk$+4Eo3xUgQj?Nktf{Q5 zq~UnF9SPYv8}PZwNlxwPPv9u;JPD)mS0{$!MYUa@Z>%+KeAxK0)8w|%mzc`e@U@&t zm~`0xstd(}N6YxRuwA7&#aUeBEj!<7)<2-UNiy;OIIZsshh89dGdfy?c_X&qrzbQw zxDQAFDePpr9!}oqlKs8&*H~DS@sV%kFaa=E|f!(#XjFZ29nb z+F_uvAl@vXaM7IlEy`O%piVHugN(w=lUYvVZ1jO?hxT-8zr#`L4|BwbN%^e0x&$HH zNmE0M@oK^j|Bjwhda&cUG$GYQr($ALP}ibRCc!ldx+y9p!+r9_xSmX zi;5nxc@!Kz8|dTE3i{^w4ZnkYn=)Uv^uvex56Y#rCj4g<(*6=>7Z<5)7E4pNpc#*8 zNJu8S?i{J^U7GrncMF>}k@{;Mf{f2Y`Zq|~2}r+nRwY|bvM@e{L&Y)11*mfZc0Rsw zX4jeCT&o$D%60iF+WY6c2mwpS(0=k{^n+2eSZ1e>BCG`qv2!~p2UYnw-x6Qz^V%_) zxkdKb9oD#EDK4J-eJLT;i|K_z(hpi|nHMvj7*|c6a7-;!yK~sZdnSK-W4G$NlrBVL=T%LeDo1K}Q)GL1#EMkl5 z4!kAMs`K-s3(NQM@l`?J!rmcincLW8bB7}MNFh`?D>f-9Nh|p5@?dyv6KIS)m`gfZ zEj%EkN5RNx9DN4V0*Vw&zh6&Vxy;lE33f0@d%_WzfLG7T&JL`%|7}x2F*dO>KP-Vw zF4qoxCn&u+8zMBhc;dIuS(=(xi;#wv2DLiW{MT3cJoBlXQs z^S3rN4)9=lq&;m8o!#L?;VUb-tEgrJsS6dc_1IX#sRoBkz_^_TLqeq&Q%8sbBO)*{ zadEfTG%HpLa9YEaHjXuP)=pZdCcWpuiKm;%bzC1W{>J@5@k^G>4#7W`)FA{j*=j-_ z-x-LZ)o*mnK2+hJrhmxAK-9r&b>Zy+xK`X*oX)n_8qNHm*6~#U`%>zk`Vw|pws$cI za(aGRl5O56zEjqP1Uq9K1}|{hlU_u(gq2WWTItSDA6|U2$axa7=^0~AJ#`GW8|$YB z853^P8&wt0)tu$z(B z$8@1(3E9#b`C)Or$d}s_pQKf&YB~bN-AvUn1a; zwG0hYBe=-M>YAIyRWhZ1Cx4;i_>34#6^_xVFy`8HFy4$45IlE~oT4e2Qhs@FC+}B; zproABigDk>_qUI#Dof2H)RSy{1u?(I!ww`Al{ zn?pfc06O#=7b>$px_-)|xu~5@J|Hgt(v+)4QOE60l~b<6v5N(eN=gTdILWub>V$N) zql=8sJdvOtUzzZ)g5OVr-{VJ~pA^;9)U^0VUhd;}cyEb@H}ZAM!E}VRYy-w|5K_mF zXaP7fH#hfgnV9}U@#4 zY;U_RJ?p}OB%Z?0k$g6?RRT= z2^|AgC*F!Rj)!cJUP!oBUqYDrhf(s>7)tN=F}SXzdtg2zyW>v6MSfFUc?E#wC{N1c zkgYAjG``Ip0r5XjpWj(hpt{N!xIC?zlZLq`h&FlUv(u_TYT{e<{4puT_1@)UFSHUdR6soIV|@s34(AV4pPxL*p>afzr6Ry z+tdxnJUja1fPxs040>CKig}zGtS`N{JQ}u^U!Q}Tc2=eHt=0y&dgVI{A77^m*~OxO z!YXaYjX!ABbNB5or49U>T5UDu2Ae)f7De@c#ff(i4DI}^31eqxryPyXo+7*V9Dze2 zG^j30ch?PLHxY49_RClDhBSFR2?h3|^-$Qk)YWj}XJ`M|63fWF!`124)5$Qq;s`Mm z2E{++yShDPd|DkJR?&X_{;S9$_FrVi{5CF5_U!BoNvB9FB9h$m<}QOi)*k~9#L7a9 z)kQ?CdeUD`HY{0jJyTDuc7VFe?2hV z&)o1;N;nBfPf=*QMgL?Erx1vjBr39&c*s*0wS8vJW2q*2q!_! zemYw{-gZg!`qc2Kj^(9<-Rh8l@V3)G$Ov>$?C772Hc@^gAOm^QH!Z$RY@+WtG9ZjX zv5J3=#B6VG3;3P8QrP4~)Szsv8C~1H9kdfpRG3sabM&}MyZljp#vEFv&D2r)pueoC zO=Qi7oZ35Rh;K{u5(;dHFm)qRyT!f-x_?4WZ;nX;&|e5bpk8~Vrv1y%CzB>uHp!!L zElfFx@C$kr(&f)D)%(zL>s4uKDM)zw_`nLOx_(-h15EHOk;^b`qRp5B7lG(7a&2|b zh+AwsnlQ}wN2*d^>WY~i^1I9VWgRM#OnQAtTZJcT`V0U#Kw4#?hT&ICKE8Cy^-v*i#?AMd)h zuXoda{+#i1clV^u-8y9z@a;kWTv3-lkN7Gr$y^m=!%FK%#SO@df4NJ8^ zoO%z$ty}uokgR|zw>IPMR>pv}$LK{T7pHMcaw3ljH>z996c!Q^f~q5Qyk+btl{v5( zVLe9$i;C;m==#RSWWZN8C8FT9OVT= z$VNKGT%e*Q`NGcP!our9>a0~%V?f*aV=;qYqjB;t%8_@n>=r`}0`T=dIx}(URmxz7 z5q4#X3!hr7pT%qJTdZigxA#6ZZ6@f1g8q)V@~F7AM|LHSztyD9UVRnckudWi3zG5k zleC+z$Dw7!FzwD_HY&THK7E=u)ns$djd>K6 zR5F&iC+x#rP@5BT!5`Pu=Bmo%)p+*kdmtb1jec;UB?;B`7r&V{pMQyEI-D?cz?kmB zhfhsUTmNoygU~4=3nkdz$r3Ow@RAiJ$WFSUM`?3gokpWK{okL*XnAhJ@WBmg{ zrXy+bjGKW2k;K14>K9HQ4+9=06^O{AC9+BMkfQgRW4scCB0Pb18tEx(Kp5zk9!4~Y6gK#O!z$Fow2 zR}^yry_L6L^Kz3JAa+keenj6VVEGpxwQ$F@7z3RB_p7&$f+qh-iHd$8p_0A-&^u6m zS*2*^4%siyPtaYvFQ>j=aM6nlOA$!$t=ovP8K=;FkKQJ&MTdDa(Kc6$N8aTe$^9|o z?)ysu)b+k*zb4u}ILHN^QvXe*yBYQ^4HOX~fqRR+aqaExo@jbOGBof4<&+1YINyF@bcjVAfHggj|LU5`4qlZcQ%I=t8e;<)phKB0@HpH+U@OkGybt62#o*8g0 znhq+ooyWWa!l?HAg^)`1Zj95@(-DxHeCFuT{1-*Fj`m5qg@T;??{<29SLWg2x%DD6 zKJ7k|G~4UkdatlNl2AHZW8S$`Vfy`#lBmX=nW z(oEEvkf^A>_mT0lSQ#B9e7!1jv~;JQyPY4H@!B#}$?Te0@7S-lhaN|mDq#Oi9KtxJ zHPwdMZE+oT+c?Z0lJFRF*5PMXJ|iQKm3jOa%kEd>=-ZFQ3FAoUt=9_P+5h%vQ-671 zml{{e8XZSBxBU2c;+le(mM63wvi+V8)+q~C8Xwsgb*9p8)Kc(crZV`iIU;bxw^l7% zK)WC?n^X!GO{XpUYgVap%qTV+fw=QX3{rZ-4As$*?z{h`lbhwCksM2JJELty-n`m{eV!efvmFi1 z!D|b?GQ$MyTWugFdec?b?Bbl$UA;H{K<)Eh_lQc^{#O;L<83&o2yXHFAioW>Q7?z& z@Sxb2b)GdVI^^FK!8okO8-fc%F1AlUb0#oi;iweWQG^GE7<@mi-X}I5YIFKTPdFMr?ttb_@LaL;ZEGf zzIhyk!C|e}_c!1{P^4Lrjd*LTobT89UYY=9K-;w0MP(7@A76uD`|r$4K*DFFw3FnZ+_7G7|J74LP@Y zrrK15n24|<4aJtlAE68E)$u|o`0ccwd;^d1{Pjr`r&SOQTvGE9*+n;aV->9z(mV{+-ch2 z_Fl~nQy#z!A0RN@8=xnXdjqK-CSJ@FC1|>uVL6Gk5Zc#$%?o_(F z;m)m|@0@#|=lcV&_F8j}ImTPlI43KQi4+fY8UbMh`#pA>-`&;1#!?tLHz^ghElB`S z?Eu3>+N)1WI!pktk&Y&N)!uuO{1h~ySEUQUAh-6=kw@x zq(Xq<4k`ry%aix>k^Fhbm=Kr)$Cwhy*!CNq2zp{k8N;#DG2`K(=iu|cJeQyaRyZJh zTnt28{}nBQU*i2|7U5NzoF@tudTUaQ=4Rm_{^hZWNPw%S?Wf$bFaOu!+$P-i`ep!A z>3j(#yalj*TZOGznH|Z3d@rwG+WqeS@cNSpI`kvV$oImm;dI(2#DdV+Y3d&b1?vEJ;iGm`_Eo}X<;z}CMHlW zD7_*d#rkJcXds)QyMz*_n>@M4SD@1?`i`LJ6;+#45qzdM@BoS+e*1P*Q!fi*SNyM3 z;>sCEblzLN4ujmtgzrT4y*Px*r)7BA=I?zzgMtl&{m<`04Tf4Y1m={2fl`D&;480n zOGKC35jcl~!@@@L)H1(Enj!*xVbPD%>{M@b#9_Ig@?0rNhVwsJ00qD2a5sZkD7ViG z(ioAQDF&ykKrPpn<*jVqX)62CyS0^+vrz?neI>yQTOwLmghz9WsIa}Z!4WT2vwn3I0+TZo?i zP3JpOo3zOH;aVt7U<7yWz|%$!knr}2#|4!=NHQk*1uc*JB zFR6el(0dod|M~!$-hCt_g;D=}d^oe6PM{f?UQzMUb#K1-Ia=rIot+)v$5VQ$rQR)F z2`g#2wDtrOTgWf{r)D@(Fh$&&FbZ(q9w3i$ljW>UVBjflcMurIPP-~iK6!vHX9A?I zn#RWV-Ls>z*0XhvxP*jxp*H85AHe4dcc@-$C@2Vb-I>k~QFX=+`qwKGlvB#y;4Dg& zxj$hZdOe&+V7dIh^-bb8xZThn5TJ+a*)GdhW37NObYA(SP5d6Ft{&6|K$pDoay9gc z&|^N|Yj+@2=Xq%-t&9qt>~6OCQJj+#>bg5?wa@%XVPI}9IY%Y6BuT;@8X%0kf9;(j zLaq0ZiZxTCtA!PA`+^|cdzhCukfA-^g=TRIPTgUecmwzZ=!64TFLLqld?5*xJjJ0^ zd<-=4Z;9E*prG4iISvee0u0qdt9@Ud*?!e2G5kZbbm+)YkSO82Pe6LK$`M+k*on@f z z1}b&=9XP&eOB6@Ik_g%#6J}`0Cz6fk;>zHdOYn-;0j~)!XdWn4H8sPb=p?;pZK1sf zgWvC466XO#0rZao@cyxVBu9w~xY7SKb0jFB1;!RZ2O?#3=w!^y~VNd25ykMrXrDwYy-35kFGA6UP7(MX%K{j3yA=uA?LnGW<p508#GUfs&h9>7=|)+sN+YY8D~@ik|?KqsVzV-LVwfi>xM zPNi3VroI#mq5|lJjl5^5O}p4R9|ZuTy1bGSmw}Nr4K5y@6yWbvdxWkF;BHc>Iz7ka z)KnD^j-!VnbL2=(OREm->Z`vb{W~f4dpQOMhqDzzaQNM>Cvb6G3&08lTu!9KjMzb^DJktcB<{;;`B}6BBDp`TwTP+Iy4_b5D>jzR&Qn3jM z`2cZs6fy551T-GEvUs=T5zO~$hbNK4;+;cMr3`B((YL*aV5!`|^kx!)Rtbr*U|xFV z1Szkk{7s@>VP19dhiR6(`bLirxrOBD`^c2`XC~q3BFTEp6QM{0G;GmWSNHspu+G{3 z!#zA)bp+P!e3$#dq~8V|U_e<2M__HvpY4dZbi$nWyc1FQT-x)csx=Ckw*0QS8gKd_`C0 zvz{&sg?sDrh^2s#a%Z|)VT?QSxA$nCTAjXK7RHzyYtzTy;FJl@=n&Tt|C|+NO^jM3 zp>V`Bp_j5dE;|vQkG0M9aha+=7aWkW`SV}-LmZ+nk#=p3^Y*mOLsu+e-rkJG;u zs*Cvh7oX}RS!gqkj@!QJbiy6+Gp?00yR2b60s6nPdY`kKnVH5TU~Ab1z2cCPvl_sF>UjBNxJv>LQ9RV!Lr zScVW(B+FO$|&I6s<8NT$xlFb#mZ6->p zvlAJ%9+2|mGMOh>?KCKvBKY;B9+Xce$80@f!>i<}(Cks?|6loU~qJ1pWly!tqG8;L&m`6t$gu5Kqe z^>JSw#e^E=Mz~{V{X+I`al$r>yVcJVo1gIQdPgc=!wyCG3vzx3M|6baa0VW%4BtyC z4*5TO?VGck$DqE4Gfa@M-tgn%bm?Ct}$m0FBJ=H7|XN9fz`kicNu4Gos)E& zEMmU+;w~e|tPr>jdQEp2r&N>7I`%5dmuo-Dy6kObzM@mL>nIiX=uPB`@V&cnqtGV| zfUte<=6Rv^|NeVWhVqIOQ$--p+J3?@&Coos&e zbyR9!9cK(!?k!<%l$q^KH>^GfK8($wIG=O(U=7JONn)Z3|4xjCH-dB5o>gOqKf*7W zr(MR_*?iA$QPi!H4c88Wk2? zbp}jq2*D79dDfWPKFJ}tb;{@Ti}R=;QXUY{G^FSAHK*3?=smJ$~k%ILqZV;GLijuW(gUKm1 zG`F)=`mLHmk!!V*)UnxSy{2k)`hw>vp?lrs$67D?3orBx$lem}%c%kG?{sm2KGM2I zGP$WdZXOz_`&hzHxc; z`-67w-ea3|6y{fK6KIn&N?>I9MA0^*68VTveR67)!Y|V!GbM|BxFly(!d~C}qy}Z; z+00;{3#9&InAw|}MyWba9SojjA$tLNFRw3L^EIdV);9Jv4+iXN1j|eI>LMqMkb58b z^7IjV7_(_RPCtO982pkceibF259E}^$KP>Okf++aXJMOLTUImNiq%**_$EDyYUH;iyAydBI5;>Aj~}*bH_ zr5?-9?#70yD9qKzgTs0%DmRR`_Bbkqb)bLhLqO72-af5&~r?%@$Uy$j)Tkpun% zcA-|+Jcn)I8F)13@C_Y446q>x(tp^xa{Se)W?}-LrELD0_~%5~tEAqsh1PT*1XjO> zl{D`1dv0XM$2uXa48zQ`sfRK#uRod7(#cKi6pB0ci%qwhk~ZJ$&`wvkzUST+o{aZM zooM&&)T#M8J(Y{jN*oPgyFI<^lwA5g?{j7d*Dk^#IU^`Yv2fmB6gz^x@AV$elKZ{0 z!vbfn|G~w47|eE$k>KefIxs+4XQDI#R^xc0^>%EiFGC0|AZC?rM8;lN5)4QZie_yt z$cyjz3u||C2}Ev^Q59_UM+=WAElGtBtZku)pGekkiYr56t^stsemtTA$2vVw_K9(u zj2?s&A~44>cFGlM0j=Z?5#Dn9;pwuf$2kXP5SXH6aCCs@urFC)VyG{%MhFwrjsGI} zrRUuV5!HxAS(?_UnASCu2D@>wk<(-%oB_s*cftxn8oVb9 zes{^{eTg)nqdR)|&oKR&!2jjyB&){5&z*3TZJfe7^d17Uay&sBoSYDC8-lr$jkg6D z5@^46eqe4Hy>@1Fn5(hAbXDS{(;$RmVkgM#$!q8^qfq6uCcL53PkiU!)SItD&e(o_KpBO-o)cO z2ImdU?KuWSrLIo>!<1a((*@=v1WYSZ&hCQ+mnDcP06+n2lN}m*zwdkIiYU9hYELs2 zJ_!)}(MjkWEZ=YHMv%XQYt!DYxq*Y71GzUexr+KWQ8ELhS(2%NYu2pi}A|X+gMeR2s9rq!tMby^F%)H!gkC1Vdm$0Sr33A z!rcr+9jr%-0w4R%WO=3thru0N00`$$btv=k`gSkJ2`&tYZL^b|-IZQ^Uq*mQZsoBM{ zA~#pSLpRj=^3qey-;8Uu?7e7s5Aj**$&LqxBx!KBY& z(X7rj-ZMX9H7HywUjRQhT+sH+Db(o&7CjqVF32SzrXoUm8GuBM;a~I`2c9N1{_zS( zrl!kGgW|-8otgip=A>^BVkbR8`MtI_GMH}Ik)oKRZQyyo`JjF7=`&d^NDnUop6^rP zsT#UgX{@%SFA;Z~zSyihq}sOiLs;;Ebp=_I>-R8EBU?^j!O2g)omGZ*H>e@|2HoY_ z-qKvj@vS2;+roK?Gdq8#$NR?6zq2C>S>V4WUJ1?_0^x5_hmqP7TH6q63?6>|X;y5? z`G?G6i#pJn5?C@Xcc?m#w{y`q-+qwgaZfg&M+n8$b>;?zJ@t#r^0O*e3C31DMvKUc zwx@o_-k_0XkXeivb+YvP!Sj=E`&&$5M3~tD{{i9vYs>j_PtXcp?!QrZypI&n)Fk+` zuMZJJ3_1yw!-@^<1HOe>KI`E7pfGbiefklMmEW1#9>Q>`O$s5xb!Q~R+??wC50Oo* zUJm2Egzb}_38_R2-IO?x$OV;TA)>IMff6GO6+ku0980Lx&?t1m4_A^TyU*_rGVAXIc6nC? zmEj%(!Mpf1gv?`=$A5W=xmF5hP9-q>jLc&{w^w_) za08LY^?EVVMxc{QT)~Lx1B6*I@n&rzgkH7o-g~DNy>~ZX%*fcoJz?%8dtP5G)Rc}W zPKZD3dtYq)a2`weF-|OmvdA;<9#m4djEWM?&c%dagpjBmD7}%|2J*_@YU{}SSMm=) zm5l9e+YL{k(=lZ=-|<*myZMSljy14^!%|YhI;v-Ng(He=qBdMJ^8>HFBoWW9*_{lXj8K*ba92yZQji9qZ^ zB?2GjMP6Wn?3wiqR9IPxr$T^EIYHT@??fEt?~9$DtmpxX$(g3iYJ@gX*vE4s#>X3V z|1A4w`)9`SY=8K?^Zn7ZGKogaSNXeY zj22*o~^w@L_NkeOhm)=y;wWd;ie!r}Lr zy<&i#J`roBKF!BSnfQ~Pzvh_c7VjQPB-=ZvMBHUqBK%8DpT0`Em7B<{VMYZwb)*=%Ikh6h<~ zy&;3v1qI6)fuC<6L-!YD`opA(!(K|0!;p|vbxU^8j(|gJ)XJys174f9!P(>HllgFA zLDy#I`ExwZr?z4fG3PHi0(LG+2cwDns_R=SnYg*QK7h!+%5S1q#B}iZl1A5^VfWZ+ z6gD7I1Xn z+cR6xF!4rW27E-xeJehOzoV~JxQF>l3LYc0e=5_2{t#@?B6O-wxh;4DxkrJw90b7+ z3m?1vuKQKp1A2RVtEoZNg8UH1uJ-r*%Q#F<_m|N{xb6>I82(teM_}i%`JTjTJ})ylgVS*;|qzT#3oI;>^yW_xDf@sveYj<-|A z0%7)I`I}0M5~lDaKNsh8?IeD*5r74Ew&5{dGSErVEE(qJlwim%UQ`JyptTAbV^Q$E z5F(r&prE7&2fy%ZdgBE)?WD55eH)MtqYCiaCfs{unt*1j@D&HdA^sQxUu}zfHzR@0 zfMK?Kecx%l==)0hX+`MFk#P=Jf?sY7et0_Zf;qVoQLJAUa$PT?R6l9(X+5bxd&**-lCXb zF5VJtfJ7Y~Hlb{jq`Db8BpkP^-|k=a_@IE4$N=yvnt;K@sM}YkTp2{S*c(vuo@>ZG)Eu0RVs-m1(_e z<6BFTF!nwODf<={Zz$u}YWB9w$3g<`Oc?cGWAf)iCAhO{{|fW!8a7rR4&ISM_vk)4 zB&BCss>00q?q=CZl&x`{)APz~X7#x^ zr0_0ERUdNY9z23x*%8(oVSYXA_dKtFK^yqU-2V7f9AgT;b&6yeDhXgVGZ@&Pc3)X_ zI$YHgzgMy8Z&J~&R4m?XbpAGRyqCKm_C2%L*Kj32)7Zu_@to@BL;+CWix36XV_ON8GIJK zQMhSvkP0E?s>jJ6AZPnk)b{o>_OWlPp-eJ>wReS?MOA;*rvhRrbo1C;N)gUjfpN}wnCxVdy~O zbF))A_ht9!2v{Plra2Fmj(qsPNqu{`D20#th}UHDI#$^h(9P71Lg~X#+ESka!sXLa zo&ekDBZ_&me*uX`2yu_o9wQ|9*-8Z7%i}z=_@WmEsX_UoNuv*QQ2!Yc+o10q-46^5 zAEPbmG!1-+L~4F!miG7z1fSQ9GaO^%f zZHeqYM?)h(G9+{o7g)agSCEN&Y-yk^CML!S5@deSzUk#uY6H<*0Lcn|e(d0unR9p| zUNaX35BF2Mtz?0o$5!4+i(FIB=jKLx#CJ;m#MIqon3)Tk&$J)8XTFFgCvf%A&Whc=@FVOJ{m-JfmqV}eN@e= zqG=+~Mz_5j;J*d6ZcZH1iWqgm1*I%S&m+ZSIaEwm6fJOAV-#$~T&i(#Gk2cQ}DpPW&!jz1kU@mkP8Ph#+&o14q8 z*PW_gym|7~#pmHdud{;mrJStcad#0#oj1?t!wisU=;&}n z-U7q83=T3TW-c%SESYQYcuT$oHj8Zu2pUz*)F3{>_07Q6`lu8SN-fbUM_h^GJOz+x zrwe^c6}Vc`5r>Db&{Ug>(O$K#c}|em#zws@e0HdtaiNYPT_G?-p$IVYfnV26C9QE-vxj zAl60^0i>oXHZ`!ppERweCeC$Rb=6$gc!zL>xJLA;yvpqdBoN4QsliJE4z0+a*1SMp z3{RaXgxO%J`nQ3=6f3}lwx^Ia-<3LF4J+KGHXlKv3)U~s(|IJ2twsl-0g!;f2*mQV z=VBf0Hi#X8f#-}Zrx+QO^4O}el!2tGs^w_%r6}n%qQpXovh?YfE8ABgZd1)?yR$W3 zJ$@-+VRH!}Lg$(`_+~GekIL5A92vnty1l8j8rkHX^v=aVp`LQO>&fm2*9UTiy z1(|PoLBM72r;)Jb@5f_1`5xfk(CM#jb1-*{4~cBrb4n5Pe0&K7+NHa$58fq+z{+04 zsn1E4ok)?E0=367CLaA`EL$k1$ThoC0%b~;#o*k;NY|c7DZe7J$ym3h+aRNVqmd_D zv0kOFd()eOzV!gIOV@M7>p}!lAsXMCkLnIL)85J`Pk2VAXU{e!9vtk<$_sy*E_fE1 zWlF$gQA2uV!NTuyn)i{UwT8>jN1Sw~_P8*;Xe~rs zzAK5uZHpECKR~p(#R;q4bO-Ps|`;U)xmZWhG6?m zii7cGRx1G=5#X$WvSgXm1O<8@`}}0Wcq5#t1nV?zvV!52Ua@dFh&E+^-WRHe$c~xk zO2TiOF&O}=r^xeXeu%uu`Ezs?cwBmbN8Qx#G+9TExu*7P+}YD!HkQapqaSd9wQ^hs z%7g%=Awk;t)2_}=b#Lz`cO)IX6wpnr#CJDA+;*m=rlzJ=(HGeVyh{qyv*j_q;N`qP zg0B4hgo9CO{pqK(;GMnc)l<+3K7F`)Q!E1+_}uJ&U-&pNXE9OANa<$g?b|NQIGVxq zhbQ9t8YT$*9XvLoL?o-8MHNn`YQM%Okk%c2E8Px@E8^I=4J33!T4S5>E*sO1r!%J! zN`wwwUS>fsO8pq{@ZP3sul6p1_+Ux@z1tN5c!#oxO8rFHwIUEwGh$8jh^a(e9jOX9 zR5UBim0Xg6 zl3`QDH(<0gCSxd2n}gR{*n{79kC?%K%+_yh0S^R-@Z0yh--EWmfH+an`vC?}b{fkN z5)m-~Z>K(Jr)oN$Cg4!-`fGH3s%_opCd9=;<_-V>Q&`4^w0afXJ~C0uSvZg%7yghq zsuu>$MhJpdn-j;~tqV`7)2#6_^W;13eABgGH~7mdlXHJBRa1UC(vsa7wVAS3;NaJ#$$5+mBb9pW(gzRu180sQINeOjfERkays79q5zDPsNDYBl89 ztuBvW8wEX$7ewzKaU`esnN=7!8%WKSDLcEZt*j-k740b1hu!g?2@ggzxMWzWbYced zQqM#^Y%}h?`DE9+ru*Yb7UM+?w0}1O3YCWepxY8exX9C59#Q%;y>Bw%{S7Ef34HY} z&i62}Bm@+XSRlf1ZkUR2c~hvir!{|8q)0NiRYKy;zSTiL8#ftxSQEQEMC4+d*VCfib}1eB)D_SOSb_E|T>xeOjt;PByGc!P6y_bu`F zpa`}Hh))Fskxg8J4-{1YR)$is<*oOUJ$dnAgB&WeOxC;QK@hDFg_v?|=w~D{o(m`9 z+ff~*Cxl}R+ku;!Rc9)fmaDa#=R+St>yp`5f`x5i)eT+ubiY=bzsM=5L{hq zN!n*HGSVFh`e3UU|KmGi8js_uxpkt z*l219#<*b+lDL*n^Aae|m`wa}{44HjY=c{;M@#HHr*275|(7PxgQJlvVIMD*k8^D{kUlg84t{&RTI^(W$ln4T z%Ag!P{)iI3!4K=G$EaH>O`urP&B@B8q+N?CQUa&6iSA5JZ;ziT9j z_j4ulyEMGqtVK^WU}Y3Knvq%VEsd=d*!B9b>Rm5eAXibMT{$#bJ%qz~v1hL7tZu+7 za&m5Xyjmzh;}fn)OymD;^E87><~z>f5-RnFF~?dZIXRSKL#7nP{<*3*VEap=6LUHU z-0$imhfX>w6xfLai!3N=+%CxmwtW^)fCSn=5u$;Kh%kTKJCi1*5axHp$QOzhjYc-mKwMOfFD(tHZ&diZT zFhqZrVjmPFCZWE_cdz%-G)EtJYvi8MJwlB@b&NuRO_sY0E_lPCZV?t2)-SC9p z&RXx41)UIGbj!I13yWU)*g#29hE>evaYwJ(D1)w#`d1cx4uIvGH3vB4D1n-eWq*bP_NVNbdahX-*0qN z<%syv)7*6(0l_xx+0!S|1|eA(cFFuMdAgP6oBY7n^5C&*i2oZ_m9G}l?z#Mq^0*HPXqcx+b_O#VI39|=0+`fy5I)sHO$&U)g+7AO}+lFw`gj~h@QP{MqvI%a$!)bWL`3cwm&WK#-mDLj~$OpSf1|+ z)1x=T+EDZ^wp8?FOG@MCAzzhspZVr6!_Y*?w%4E6+c|rAOrqz>Q_^A+|C`oHYOmz@ zs21mUV#rn$R-0pSN#?BKRY;csaO%12Og{rEx?L*&7xtUug8cl6dR3O`B{)T|;PWVc z&r7@aK#&>x<%`YkV~oRh!N?eTiX=+epfxXe7;me0gGf_jODQPv|MwH}2YdBi@U@!v zMU@(O?%fPz<>WQ)7Ego?zvFTOzlm?o=3WxWgRHh`Ns&-7a; z*iF;;0MU6>uDE*t$A8$RtnUQBU`#JS%ysg!!tb?Q16SLxHr;k;+Qqux5>mmkb=y_o z#RFAB!-^h{tr1NBNQW^4ExBG~?ox(yVq48Kep&qG9|Fe@%{>wKfv{4uamnoP-g%W~ zf#zG~6kLKH;kkox8koaLc0-{p}e3Z9jU4&D`2bj`P~?bAV{o)+kBVU$(fq%R-1?JfQ%S|FP#nVZ8-Q_ z-&vQ4A8s*g3>BDZOgCLRC1|;ffuH_m&sSWfl~>JORXDNIx7od&8HjY9aS?udtJNko z9Thz92>;(Nfb_P=f0K}kDUIK#Y+S|UbbIPg5Qad*(P^R8xaPsD46L?xOD+;|h>i5x z#Lxo-!S#}@jbCyDS5ev7;-!$5lU<9ALXTEdOdk;EJTjWE0R-CX%Fy$oT)VjgU9fKi zbiux{s#c7|YsDS=+QBB}(qvMc3J>6V%ke%UZtKcOaluzudi2p51TALR4jEhC%Zj4~#P;Fed6r#Mz?aysDt+vX#xNx-Em+5V|678)v@KUd0{hlds=)uQspu5RD+Hzm|6lAq=h}-H}jQ64X8-vIdLGj$pTq*+=}MiUABj`66QehHnVotW zm02ww4ViDIizcQ%#v|hgN>=~`{rjj%@Q=y|FNW}s`l>@QoM7QW!M&L@v3u5|c^?{- zfkiSIHj2EM#eEQ4;r(v^4Ol&Soc~tOL4r2z(E1aO>&6C`!b!p)fXkpm0#is5a13!a(n84Y$hLD0pTIQ(q7v^RubYtrEAoi|#YfN|S@wZc zmGs%mKrL`SU82OY8K+1NTyp(wW!VJj|M%4z)G$VQ8gX}*8rgJgc5vitglYZzv0etQ zp$Q=&k1eqv}kIJ+_nXs$l4eOuj}<|O(fjbM`J(+ z=L@xlIox!aC>o+A zzy=Zt6n+;ddq=bZKZhZgg-}e#6CR=C?I8l_B-s{jEPdtQ=}wHO2PLS=Y9tiI^CYw5 z^?s#=F=`dbTJ$Gjztif|U;!Vo=c!%HtphJkECii9(;4fxqCfkX;IA)5w@!)Tr33o)C|Q*hG{sdiu1XSlHfxCz;R zG#<@%g7^R+mOi2lCDM%(1whCKs9@~}@ZX6VP5~g%&s4+)(qR|`TdtlL*~uI6d-D@J zT{8h%fH)1FI{sbxtI3d|Wp}<=01TjtL-zra&-8xu=E34oGQW{)6^NqvRgi$o(L$k# zgdd+(_zThI23DX|EKjGLgyjlDV2)&@2RpIz`8yjI(v{um(isK|zg6ZzY5Zd7`Q=PX z8luQG%_9)U)g%rg(=&j4ZcYyFUIn=2ET0E@WhaIR`k?JNB6QLm&D^~1`m1MOB9}SF z68!>5^=hS&L;Bf41*+Nr7ZpNW zde5qkg_V_+Gl&K4>K|BtOL4DiNV0eh1jBmTJRE)lt~XigVv~a(8quPXlCT3c#3Asv zG@RW;u`vc_0vQsjuU|g}mnJB~8!dpiGPj&wOF4l{IRNH1{SmA+ zmiWG=G)HAg(iv962Gwl&PopkCjbTZx3QnKtM(u0wv_#BP5TZyRCB*}*A!RT{k;DrY zbYJHz|Li8YooTN8$5+}O_o7(zU=FP_GJ~}X5eqVc&%YxB#c?gC^cy=n3Wvkra(c~r zcWMZ=`{KR?Zbh81GJ$bj_c(C=z(pvgUbQ4OHWTky>lUH4FWRny0NO^Qd9-(QoW7z7 z2EX)mfS<8%JO!ejkb%;p<<<#}(n9j%LT!zqCf!Hb_UC#^1Qhx#P@PxMB6vs|Kt4j2 z13q}6;1UpMSX&o(A><`_WJ*Wni3Qzf^!hq$2hPBqn&-4#U*h9sK#nVI^zx%Ka2p12 z1+65Zn9|144rWN9{p{|>dUr5bvcMo{u#HCizuWwCyxaTdiJLw1-j3jeY+Ao3cjw7i zjlB4?+ADVc$Vbmzhq~>d^osR2;0_08>z6{Jyad5Jk)Ez7)g&MTnw;7y^mGMMt}2jf z{pS!&?H(&NUML>vY6?<(%)lTw);iFuw4nB@j$d3&9D-&#Yz9LpLQ8#VQLP)}lRSG< z+QNAh6z^T=(yGnm&r!3c9`XB2NY_fT%=Jr5L>Lr%ve}CVWG*8)??#3J!=c*S&d@Yu3Jr5Hc+a(U;O~K^`Kq&3Z762yI=}L=e_)F*8 z1$STd=B#410mUN6H|ZKt#|FTQj#ii{9AJRSjuhs3vMCio5JC4tw`pCXp)PllNDSG8 z6pd;U3|LsPs2t7E^R21Ojnyr$LPE7(&0@&zj34jK{>alOYuQ@SBDcIzqyk!hmUbCP z4rgR$c4mWo;^^8TV+@!YeFUA%L9;NQ#A@4IUyjd)w~oq-i8dwao@}?$om#pa*Up4C?%$BXVRN0*QE;)XH zC=hLD1EYw_?qtrpdybxg?mXTL#; zG6KuC*#zdUTd2ii4Noaz;uHt~I~Yf6Xpzq$ZVJ#Agxh2FyA5u8$}2tbZo9B296eZs zoR(N1D$tNO1+!B`0`ozWS~mzQK#pOhLN+lxrxsXvJ;8B&a=k!3Bgt6&*k5C$Mx$}} z?jg#=iy)Xzd!B*4`)V(dUitHoExtFoLaT@B^D zFMytsl%zOTs9mek{bno&7K%x({HyaV-A^Kp*Px@>R!*P#-{rh!VdR@C-O8a+!J=yR za>wE4z%9-DgdA5c6@O#W8|-GzLy0BF^V+$eNP{=mu zO8!+8m5QU>)H_i(bYETgV~8K|PB-jsiJB))kAdsbe8_V|;@&K@?876DK)7u&1FQ3E zg8u+eb6i%Wl~K{rxgZXelx%Q}6<%2?)WsrW2JQ~|;3p9{=rZ|TzVGVc9U(Jey{Fxu z_uBKQXqB(MoDja4G(0}tlDHwEwtnnSlSXKOh+xY;sO~1FZL=PSFWt)_-sv-BwRxNkljllP~Vhvy={IBbiwwM3^M_ z+KaAtn$_0N${Y}Y7?XgxVw&O5uLNW+YR~jlpAHQTje_Dj(NB(pNfr=-MlcMbTImEA z0S~Oek<&!~5)*+rSS}tLR>taGkxccAHMc!Ts$%CgdQ6v)5+?fa>9J0~g>G{m#Hh(x z=%iuuYlR)c-D<7|&@-Z1BHaU_XrQ2jYeA6+17V)W>tfe5IN?X|!NV_#s}IZSsH2?X zRSPeZ&L&lv^%&#kbai1_jJ{n%QcDt_{Qqu@mjX7;s8)ag(5zLCEix8D&w#q0`*jZ2 z$)%!Uj^%66={0*+!y6qX6VSt*w@Y?JLrSVO5eBq89RHIA(6gEYDxa}vWxI-!QZ@+p zubdU=XY;kv@7>8Xz;#O>IEcM(Q zy)HPQHv5s7gTnTUS{Jy?65#tbRI2Lg;(#B=+4a^f?LXdvmQ#!Tw-Dt{9)PA&v))xj zie#a)Bw2qXe4%4+^mK=O9lY+pd>ASE?_C1{Ixg|JX(!%&5H^Rr2=Q-9bWG|)3q>;$ zhcudes8)Oek~!ga_3T2XD^W<}>nVw+R$OZ_o~{ZRt$r7>^veHTUmDv@Sxd(LpD1x4U{6O1 zXVri7Vlxfc@Zqd-DS(c|L_sznwC=@g1-;7OIO%Ht?Hp9fk2b6I^Ay<1A8Zusb7faO zTVAunLyEJ)#coUWJ)oL%xl?#bc3ntCMa3W@ve1ga_4u(E1VxD^jb3v}UICF8!!{7& zx|l)ygvKDHf2DUGVC|)72}tpUUzBKQhH8T(Spzjbupm zxU+)mEH@ozT6@u#@0uf!7hjtiYIX!3wH7$k&!59DuZ@da^~A`4fchnk$EbzjYS8eE|D&;MoVP z?$9%qJgHuv|JL|3cEY^4JPAz3WviVpejKdSR6NH+Fc7GxtKM{1(A5D|g^D`~kqneK zlzoo_K=Hm!Y@EmVp*VK}2gOQGw7B$706L?5xoo}*_`?h&P zwpSz-|1b;9=bzPsexTqqFU!KgLHWL~Z}{`wr%H`5GRhOGJ74<-@$rx;yes7)FGOCv zutGdO^{Q-=(D0rEh4KxNl(^+FO_|%C(R962u07X$58!d*5Pl6>Bb$V=7GaMpS5h^t zJfvX{0MZZZ$ud(D2_1ib45;7r0n*7Xi?2(MzkX>3A9*VyXGYSSC*rC$S|v2C!;@nQvV5TV;5qhSq-!2__IN0fL_ zya=5qPL2<<*5EHE5<5^``SUuSuexv48*Svz_o={3i2^Sr{qz6(Qc}($NR{X#l2cd5 z@?ZEKmQ)<<*WRG)j~L(9i=il{fod~a@T~CvdKUP7D)5eIZ!&-^Gc)sTZC<*+e*(G%}cgFfc@)s$<8Y+`xnNuBs=${R$tlLGJ`neo~n%Lx1bY9 zt}D3T2QKZ50QKqBdmf9%r3ZsaDBuR`UTSvu1!~3bGgjWFyA6I;i$+Q4`GX%Pu@5o* zrD?zo&C==z6(r4%Bqg5MM6F!kcd`?Vdt_`ctcBH9$Zaw5>&2Q!SoV1X@Fc?H1T2H3 zvG)IH==s6zd|;g@VEtjpTRCvg;6lm)y}}fR2xI)O^v_}MMa2M=R)s^zWsM6@gm1@4 z@v_EhzHOHfKYdNvi7duIr+AF|hrnQh{U6HS1Dfji{~y2ix^WS%SvF;rSt25{h_Xs% zRw-GLyHo%8>GI*xO~eUI08zMkXpd^|1$ z-PNs`R}m%a(f*xJf1S=6%lmfVek>z)sduZ*`i;`EEh#6c4W&ux4AWm*l%9MkL(X+K zf3vD=^Ez$R1fo&BU})PXKJ~q;hKdCs2}m=Wfi?dUkioxab*SN>(swH{t`7Qekz!7z;n~)m7Vc zWu9*G?{#R9FIe6>b8Nh)B+(5q1*2-^28Y(PsgUF>x+NU{o9huC^AtM_R z_#c*Kuo0?wC|)_XR(wE)r+L7q8j;yxu_mkQr_Gh+Y=o(tvPmVaNL z5%sR7;L0eDq%S^!B){%sb;cPj2J!vO0nqc;4Nzhc+1-Lz(;OLxYNHlY&8CCg0#m^e zrsMom1K}Pa1Z%PQ$mHR#Q(P>OhPFa8CsUj!pMTl(S|xvp%G|b}-5T9DG2;)|Q%w-c zDB56HV!>kQq;5}O3k}Qovf20Vp3iok>C~-sx<2Mei@1xzCfcMmr5f%E2BW>>G z=U2}nUMZw!P6fhFIh@o}qlQpL#&F8t8bML7MDb8S8SIYcRQ!379NzOuIMt1Tu1m8G z3*UqP?>03{n_`U7+HkGOd$qPv#|I>o6rk($@(abo;7ke#2_ZO@a}qh7VG58o%LB?= zxtAVuF0hd`%`7rjKfStrn30ijc5NbN0sin&OUpU;3ruDE$UI_m3TCv&ok(XLF z-2dBV#n2IrFA z`$wKj6RFq@Zv(03?3xY{@a=LN=FD}u{%+cRtp={s>>1!dzYJnRQ6#!Jv|dLGmFdvo*c*Q zR7T6!=e$BF;i~(Mf7oqphd>;bzcBNL`qjDN=w}?CrB|g_!4y%_R5`po6d9c_{J#u` zI*L>7qSC_?BzAcHcbh_VoG^R#gtNy;Kdh5Q1cD{je<4s=)Vpsb$h-b-Z13>GAIPwOKuVLLhd z2|URP69MefXZcIB8Cw1u)XK}Qu^gvw&c1&fDR~o%=EeBvBBFNyTl?vc@gWl%-4`_> zf}GMu4t-^(UB4wf^;W%1GnP&LM{|QfFvLQu7=#7N4GTy$XJ7O00b>m^gF9_#E>VL4eOxzKn~LDQh4s< ziYz(bG|=*$b)vZXp;*6|L&Ey~ncwVD0jMl;ArTR#1@b@Hc_$1N;L~@&1*;8%{+ZKz zKY=sFBP?owD?3f$#tpvZ)9=9{b(!mrKB}9CAH*}oAcF=p?0(0sx-uU_GK>{*1Gjwm z%n<&)8?<9(0YDi;?*_>Rq_pvG*C#VZ6@Mzf6I%D{r8_RN*fUub@DdNGSQNSN=sHY9 zv62!@KrCB=puPxL8a6cDOC_YTY6ta2EwdjV3DNJU723*%!}lNKBiup?br3s0_@ z$uZ4`D4>w;f4ZlN!fg5rC4h>GV2|Q`NRaH?_KCb0NVb8>>T3C!@!7Z5E46iN>Uj|F zf~Qb^7Fp4T$ZIC3$;z+B2#&-@U@%_431k7v%yFP-7FKTBV>yQhc;d`Bk@X17{zcuL zIVok)QT{MwgtWb>E~>mc$uRmNM_bD2kV>)C#B1c-zs>XibM8Mu?Ru`y^g1-Djx>__ zM6cGPXf( z;j<5hMsAbKcXK?ffkYzj!1>BgOt}BS^?1!dtSx#Kt7rdiox^nb2T)uCQ{$tBi02QK zPgErlL557%By~nl+h?H7NC*49>VOPv_NA5#_1mA*GFoD8+HV{a=PYbJyu8ku?nKji<# zI7^kbe3SqPzyRUD0|!=ok_rg~bcqnqjsHhLmt{^qmiMYHZ!CK=W4MNK6?o%DaweeW zgyeTZ7Xm3okbo|Nx$)g^Iq;Y1(--)FizD(*^WNc;{1o0EA*k}Vr-r280h{6ba{EuZ z8acKz{VygqW+Q#S{8v;-n-HS{50L>6!Tlehc9uDAZ2k1&ql8|UMGKO;h2H#o{G%!g z%E0#wSuJz)xyO7yWlC^%G)GxX3BYv37->551(oqkT;T>1F`gbCGaRbhI?!xN_;b~tqmR_f1WMX2O?@L|yjp5L{&*<=JVl~j_ ze9-puwZ4LrdB#?IW#9fQfP0qoEU#9#=CeKoaLXMCAnKn1oFQg&KwiJcWTXDf&-DWy zH2iC6tEz0LT+X#HsQ~{l*qvZH9jImU^6^Ff`)rVIv_?3GpqQ-oo&SynidJceDH3jw znaI3+Vx_wO(OhxmW;)GpRMx+|i_>JyV+SrSui%kL&iX$hxhN(CUL8VuddJB6!MX1z zd8626k~sW#ZZC>~_veE2T{a@{6{yht$Flqz;ipV~wlD=P^zv+`Olo-vZ~@;lT0j(Y zgzr@R19kfAX9o&YbPnjQt-62Rw09E~n~-dFE?3=b?g&)460)+2-|pKEByhr7lIMwMJa+6@Z;hvOtEBEJL{qwKU?6VD zezY!QeR0$wTr?NzIBwe%##Vmvzt-qYT>CEfljH6px@devnSv#(x`d<)EDDSiDtpf% zCOR5XSw42nKspjG^)Tr}dh7h>%6sbz!?rQbVV)r*MvKJ5-V}0)y9I;`wnq$qGTFRG=MtKuUqgfJwj1wxLd@VqEX%i?EkM{z)nZ9&9qH zcawbT%a<{E8*~Alh>0`5N`Wpk%+Vkx)dcoL2J)rhhY%R*AwkDiZbUBT=#iex6pgMy zw{NTm4yZ!W=LJ$l;(|vd4R9%C_1kU(os0x>-Di5ykmJa<3)aJnMJPnGNT`eVeA8OG zcG1HT#HF;=fpy`6`^qT-Hb4QqViMYI2bn*l+6zeLu1-S#^yF#pb?qBBo_zDWHK$$c z~9dwn?ZgLm;;j379 z!=L?EenkC+X=o33*|U4F+CWMBv!s3dz*X$#`4o5s1EHhAB$x%h?pkkmqjI~{YHss& z#lvy&@k(G)$v=9yv4;Z=hJ%V>1IgHrraj9%=6|h2pF2l@e$3efvW}M}l>~9v0OG6L zlV5?}iY7iA8z2#i0xvF|^(rtyodES4Uhx+Jgq+_ZysusjYG-M>ym3dZcJBYzMQ;NU zA8_wJTbL=Q{u@M9Xt1un6bpa^%v~lS0|mgdJa!k~cdOxcZ&Jm^}{qo#eH3U1*bPl={eHAwJ5=cm*A zgbS(XK??5W&7KB^QAY}l3hhBTA1Ps@7cI^eC(Z5!dpxHksbh$G_2BF#n+-9LNkPli3rhl4_-U90SKesdpLoI%s z9QGD?hg}*|N{zi|%uUFssUqzVK72Tc8XAq`PR>-l4*Aw;V%)wT3*raxHLpa-+Fb#x z%XN%Y)syzOt%VSqo0~z!BNTf8H0qQ_@N~Pw$70p#~*dL-7Q#cbA-; zN+p7nb)NvktR!Qxc)F-bRWCFBvD-|Hf_jfYJ}ONLb0z2>Q$rveL^BbEg2C#n%@17~ zLKVg!HPx2u5^fjq!~jpdKc)x?IsUa0%#Q~^RNez}EE*imyAUybuMai40USLcX>HqZ zw3{ydbu3Ac$o!v!b%8G~DM0a2jfqq=zJuJCN}opCN2vH+Mv{NK|zAh;Iir53)v9 z!mWV>!Bcl! zo5OVhWW@z2aaG%!3)HSSzTVecWFk}cxl!~VPmG+uAQ3@&%4;nTPKs}YF2`F&-}gEg zkw9!oJrGrQI)N~82~uH*ZvrVYIDP(M4{{EdKm*OYt}YrAl;pumr4WkVLgSOHXCm>@ zu!8J(G{UwTwrHR4n}R0U{p9~Prv@RYl~>_~*dism$uB&J^H=!fwet}Hfowo=f%E6N z0LO?L_!yn{58eQA!9O=NH^%%4)?u>yo-+0onHVE0;cpo1c6@VMJIV?sH4l~^VyXX{ z1UxE$3oqrjBL&wM!5tp*#?5~z+t{{_0Eh^sMDiL^&_U$TdCU4FHPYF8-cZ&4bBNpd zORhFk07NBfi)6?n7!>`0(f!5peteY?oY*!Il`VddaS%x>EYA-O3%dk5fG=ECME`wi ze@ji~<+UJFTLm-KnS#5)4W|GU>wZR+*sIue%>C0r`R6i1;jnj+nE(4w8GrcUkIn*Y zR%J6)*3m2&13~Gq4H?HV6sTNF`6O-Uz8&CPmN@rsHria`ZwBwy%MzgjS^&#F!pHZ< z={7eP(qMSMv2WefaHkXpD-_Dg?|ix`{xQ7xQ<%XX{x@ufESB4_&dMU;r*e?4JofE+26nsB5T!IAPJjkIImk=14e$OC2q4x0Nvb{Y;H z0ESpwU0ofgQa%v(>f?LUxySs_%XWH=Z7{hje94d&4x7ZImmdI55KfMNvm`<4ty|2>?;UW;Y#-TT_}5aCZI>u9OTAKNus9c(C*4S;A{w~kgAc1!sovD*`8jGOP6f7gJV zYH)v%iS42q_K25d5H;ObJT(cLO=(k)HBDUJne-;SF%%!rFKq`jVLNe|Lz202QZyg2 zGwF)vfHQ2Wj?h-%GQe(flkIYnU#R{AXbiTY&E0|;KQlD?(pgvnu`>-mN4fQYZ=mG{-K9Yj*|Wpc^U^PR36_kVywslegG zjl~>{yV&^nc*xPWBM1d^gs+=^yg>pNOh92BaoN>AEdVqDLL*n{ea~l4I*gBIruxmD__R*4GepgGY3b2HTGGMAvF3h+<{e*R_+BJffPX9TiC>8fL~TN{o@Pk$tq77--h4ykdQ6z z)iMlQ1mBe?5%j*xim*Z1PV^qcVFMw8mJ&!g7LE;orP>48XI>+1-m{2wJt7R$7kuhI zI3eY;4a~HX<;3tyO(zKx1?JY&@bu2F8U%5{5Z*cFwOqTxM_?yR$dkQ7pGi+N5dwdr z^djlo)WpQIz>y+3_{@2DTuy4HsLcrtq)rz04HQnLfDLC z{*7d&aJzxugu={CWUm7zQ2evZd#gWApS07hTlX2TC7<+aTi+nJGn;WB$MpRe^4(5njN?LUP6OkO}OX%^HvVDVru z3#RDTfOg;hk{^bQBC*HJe4F&SatI0nU?0Nb<=&765Ru?cJTT-Xj*B^I`v+0)=8yJ* zK@!YhS)yRCX2U(q$c0=z|?==?KAsJh}wh(g@AU_`rxwAkx0toUD z=pA7fyEmp0Ab((GMw#I!GBJxE^CNd4IrRdz!)0Id3%ymYwtzBV(k3XhAP?a~jz{4H z;4k%{Hgty$p>%)z_^}~G8=(k5444ZdT}jSZB3dMj%Tl>_{VSJ6r9l_*)%Lk`MxhRV z*f4U}qEL{R1&fyxR+qy=5WL&_VJ7VGP8_y56F&C6^48M_(`Q)I7dXzcqwQ|%Ks(1Y z+)y%Ev?hpP3OmG${DFTSZY(@qas^?e@3)kgS2sw`zi-RQVPS`Ux(eDE+#LE-!+oGm~mAI}H%4l-zhNCPvd$Q6v87a{Cz&2Xw~Y2^ZDT}#ia zE~)U*qbB8qy^iIcpi{2j5LD%r#LM^YF|6E91Pamjpq@1gr;*G0yy4R;mB()%uLDrR z1dT4#1l>Cp`KF0`SxBa3RdEMe;7fP75sSH@_W zW5<5m2t+)3((NhSGjwG(Mh`sqE!@nQdDU4?t}Px zf>Mtr*P%lVtIgM;t>A@>qSgn*%LT>UT#jbF3Q!6RJebfC>+ z&QxPk?e>^bw5A)+0&KI=h#n8(nJe#vG>~&@rOLRA`2PAa5W0U94vwnvP}Z+cpA{W% zG80H&I&i4{+C)=CC>2F&@BdNh!j$%aMR-_%D6!x!u?iqOyA^7Cm-;! z*5@5douY0WK-XDDYwx*I#*!Bxu)*|*{ z#XXkHuZp||A(q#VqMx_(5oZWnvSN{bm~%0YvvPVkphCpQg7t@q3v)Qo*gTN|b8!I*KeI}z%eg$$>eCbJOw5|R6;7*i_b&BY2U~s(vxf?T}(U&>P zfR|<{cwBxEtC=Y~J4E3--JWVr^L=nx$}@{`Z`4W1F%`-~ZG`7Wu8=-hWW` zRM}B0!?S4gGy0MTsOd*%MQhjSmWvqfHZc20w~1S|d@1Nk|CQQ20fF~vV~Z_Hxz2E* zZ?SLFPq`k2s*<|pX7=FHhj>`Xcj43*kmc~_LQD_;&;jwIW_7a5WLllej$=f0m(GC^ zbz!4Sj|uXwRBN4|=7S*n;r+Bzezgn7&-aD>luu@I?9ZhxYI%*B!c-q@_+rfg;Q>?c z!Wl|>9dBU(IvVBW#P*TTkJe{_r+w>(m^~xs-rn2#uFXBygl@oMQB%2(>uf3G_f)%v zbakS5358v6R)SADlN)HD_J9hOBZvR^T$@OB`#nn$IXTm&^zvK7-&*5pEL-Wgy+ssCEV^>^qMp`u2pG zgikMBUZFr2oZ%0)uNk&PfL88jR_N&%u8~7Mw|O-H32on;3Oxy_SVAIp33PHI|IMr~G(Bz z7UOOHj?)b_&5A}|NQ5AbEjUCl96P<%t(V?)iQDZ_4-xXWRZZ^b197tC`+G6J)nj`0E`az7+$1+U{{28zbe+qw$AgJGuwm z$?n&`fU{Pdi6x+mxV&|esZL;;Zj9!^js`0QZZLvy8QRARFK^>dm=jTu)Ji^b)06c( zu%BJ`-IyP`H{!FZG2~Xp!l#jT#(BE^u4|W;FCx!43PriVj8p8oZG||MlL!$J%5ew)zYAbWf(2kiz zq{osrU%~8zh)|BhBixsXyHl%-3iDW|q@a*h({y~Sv|6&Dcf7;>pkRln8oAg5B@BlLvuC&FL3!}U(s65I!x5^-I^`FVsY2Ck?LfN1nb4F znIJRYAD0cyd_+>kUCExomX2I_HAy`r>H-+)2!FkHxs5mE@B0f34@=u?O1_bAOQ&oA zJuN#1waw?p(RHjT^gTH#S_Efq#|Qn|-|de3hvu-NF;duhIJdr4>T76_w&8uQLs! zZ#tI<&5!Y$Y%XHzT(mo&>e2%ZKkQN3vRaP-z3$xlT#EK1oUEEP!=eX6vO04gJvv7X zWgh*W)h>C_p(l?)q>EBw?Kvx2F7vI7)@GTI`Vwxb^Q>QZW7c(@HE^H$yR=(K_?^dd zYj&EFi*GBCi=Z_d?g0|#JJ0Lpn4bMScpLN%B2)!}th~~P{U$zEyF0W>mK~L5ExqC- z?-#qDT-Hidbe z&5f2g?)aNB?h6H*mIkHw6cZ7&;LJOoBkn@$?Q(NntqG5UFMD{rn(_Oh?ISfVy6;Po zI>nn`M0LZgpvv>apH_z;RgRPxOk5XU-qk-0INip`10q~R8rOu*p=y+3OKyu*@RsH{ zWT__h+@bD&U?pXq4*WqyL053kwEETRl1t`k26BQkQ4W(WhfBtRghL~ zcaX2XXk;^hG}Ls4W_uV& z2*4`+z^2r9-)l?q{{C{{9R&wTZqZj8AWC=v$A&!Xu8I#($@~3Kxx6IZ4}ts7N|@Tz ztLxY5srhsfe4*Ut7>QaJGz#TXv!6OwK3n*uYyhiEMYctkaTL2tCzR|fs zMDyL_3M5MtzU#(AXz%VfkzjhgGZf%{IPsVL@Xa7r=t9Rh$bEu#lZnd3_`TIH_U$b` zxv2K58a2P}7JpPgqxtc;M3m_(#~eFS3%Na(Nc*~xxk|vedx67L`>eBe+P)Y%++;RJ z@(%3mDb)M@;u*gEKx~AGnUzX~(f1EkX^0&{9Tsn!qyWHo`zH>h>3E-rsIsG;j-R53?zNcS%?dkWupNsY9BTtpZ zTO6_X_giV@&-YxNw#hYr^=tRn&sjtba;3tXjn$v49WsvMiYdX#?EBXG! zOcygWyf5#JvodZzJ+*s(&vAOUR9@430*7vQk56ROlxwzfXxp70*x{*|*D^FtJ-zG3 z5de<)DTj+Gcjw51ffP&SdZ+24@urWkm0pF?_emNy8>Sxk< zk;*fYB&EfLLyLxSa$v3F8<#u>A+|YJZe4f?*g5?M5}0M_geJ4+J3TNiPO(auggFAmjwmn$diICywUBh^;fV+%pTv~a7_#GMf4Ju-VsW+_Lm+czvm z8$QK!oHCn}Nox5yVCJ8(>67U&-gNzdiOXGwmqi-@U*`3T{ARpK*;>6=_o?EP<>E|N zmKNgtjBcja+}T%<2~9a+9NVWtP?=bn>%7saVV618L5R4lZs{r-lRh7L&oqZXpeGMj zLOI9t=dV84S-ha>7#jHtR7a;Oy*k}@Am(EBW1A>#6Io?TTxP$MwcmL~_!&cHwQj$a z+_ScbtSBKT<0((JI-8cG*P%)Agy)K7y`#s;#z$)RcE0uLBGh#IjQQ!ugw`&a)k%AH zrrbXP2_I{bDqHAMIjN*7HMUykvv2@}Wz@MCFe!@(Q@J5^yb11m+ixze?`F7<M(h+MMY53i$}vl}qUJ6D#Z z^gd$V4wNHOc7C^4k{m}^igN#?9yAXVx@I(ub?jFIQ2lR&%|&-eD8pNpNqss+K~7?M zwFx_{0Z-!rX!3ZiW|8_GrwQyOy`!AIYj?lAJd?im6?*?q2GMS4a|v#8llGzO!|4+}-sciUxqb29cxa;EFTVZMU0(iCS`7!H-H~o%k%7=HXHNn$=1kMfPD!K6~oR z-IKBD705qwv*;c@QBUST$4RCAAPeb~3Ci&X+T@rjasZ!uoN?6AxqHjZ(Hv2&=PNw$ z`_A){e~J#mY}`sD=t*R0`Xf;#$hX$FUIDGCOyOcbD(-@meA`);psYZ_g*9Je2@IsLg}iOHq2(;@L95DWQ;K6e=R zH@m|myi%z5gF}mOc|7nrCAl4dR5snvzk5g|tqZx43DK!I=XSj(MA6_0JuU<_Eq?c+ z)mgyl^Z#V%aKRrZS)$iCf|i5^7eG}c%|5Q%h8#!}=HgR`ZdOg2DVcVXJdBn5 zreB5kK@}?Y{W^)l~PtrqGo#0J16SBhBBFwyN!6$oLAS zehSubLhp7gUpq5Ead z4X|eXBOe!yr7lTX?H{=GCxvyAb}ZxI&WX*z=htqfl?%>*I@$YDWz>CaztSz~pqqef z5MrQJLI;ff9weG0FfA{?SQaLH77!FXzf$!CoM!JLOnf>aM&0je>x`{$8*Fa1-?q%P zWkeomm2?dZzMkBLB0EwVM|Sd;wueh3@$iHK>#b(m2#Gy z@&dGho4DV-GI7|3(=f`_Ddq%dz^5 z=4?oM9CmvI*2kG%-;Su&!x%|ixuQ9fdpRAWRU7f)cqY? z6*=Zho^};lFREElpLllKr!D&A$T@uz*F*+?u6X1@R4Zj~~q z1xDkk6^P1zNnR8h(U8~GFggQ9n@HLtY?UxYV+qLxs)@XV6xjK*TnU(zGID?Ldg6&5 ztS218sLvW!Iz29EkvRO}`39RbdD7?0N;}w;ENs{Vz#oPigsU;`ay7KJwF^0!B`q&B1|s&TlNv$)kd4!yWMzH-Y=^iS;Sli1pyIeqKRFFm&GdCSkn;l{X78^XoJHc>TK z^bo9#UTH_W`bd&+;)|%aCss5qapvOsv~|Pk1pl|I^cK5LG|hg$$4ML+r?jt0iz`z! z9a1y4hb&*Yu_2LAsI>Kao{49-9;riMdO=N+S3=J)<2`+?Du-t<>HdS-H*7wR?qJhG zigd>_goVOAh668es!e~cbmk2MpfYPTv$#rWM~k|gfBUD1t@HHx$3ddaW}qlT_udg# zpMkHyUm!etzarncRP5m`7HA`Fic-gm1*5WPkZQ7;@2qtT$`Md{IP*&-bc%>6!&czy zkmUIQ9`_O@=Qf`*W1ZStTUvwjF>?g3Jg}4_%WwM#q+`wEuR-VI2awC=`P82GWzN~} z*AIQQ0r2@UFAPE3Zk*l8()fFc9qH1S`lrY^eH0+~nq+^n)B>WCNaI4)sDp|%nm3Zc z(9;#iUKyVs_sK}s0m2}G_$3m|3KmGNWV3#82Tw5@=EF}P^}(tqF9^8hDRUL#gor&* zAH;X7aP?wR9!`Hzhm2FzJQi}Y$|r|i?%7q-QmIcQ|026~zj#A-^CNZVQy&05FMe|_ zmL@rFWh%KnGVDx}P-jqTNxs~Ft+K&gS{_^jr;aDRWOP9_zBRCtpG0+NCdQlIu4W!k z+?OUEJ7=;v>jEae<{5OfDJaCD{F&R#oGff#aFyUwk&)v7EL*}83R4scL#uX1QMZKj z)s!#+FfKVIC1NBsulM0z-A8gF#YAI=+OvqYoxkd`@Hy4MkvXGx0pyyHv@ufSm>(26 zV`xWOz0^MmNk$DfgI!Eq)`>K3H>pqJ{>QlWJ*tm69H4OOhO~DiblO2?qzanK zsc7sW&A$dwO53)uei7Sp;<=sRkrqgc@Mvse(8n+U32Lf$h!Z*=rC$Qn9~y^1{D;mU z`qq}RDCHgbl5BM?q^_RV@OZ;bkT zciOB-+EqHW@+NmfH3R5OinG8YS^i-C_^KscUR2cnG@trRt^zH@^~-5{)53StccT1F6DUT_I*iw&Mesxw`Ve_Mo*&^5nqZgSnSp}b z1iOXxQCOt+mXu(m^&T7V65BYxGEP55Vd49jJQcAJ9VZ|+WgjDeQg5{nc^an&_$=(Or zfsSm7EUxTK1wX$!e%h=nofJPfdXxnre?GQHf1^+TZ|AQ!EK7-7|r1@oevRCr; zA0lm~1=FUtFJJD0Mg8fbWU0<0xta4hn2zfJ=A;5HSbL(IJZ@s-j@>gj zpp*TDhYv;-9xv<4bY9Q=)v@~Zu1lwpZNFEtk566MM!N?)8>{7{jO zgaHv*1E4hcNN#FsN>^K30n$BeGvfK<7Fx1!2}o1KH*ze0jzt1XBoC`Zj!0V~&{XIU z1;q2Fnr~WK8psoeLp!wwFr%gPE-djE)ot4#i=D>5r8f&cdINX}G923>H?llJDMQ4= z=8Pncjd3m8o^^H>cXf9^ztu3vhS}LmXAA=eoAJ}t;q<_upd%nx2PDGbqjA>&UH2-C z(1#V%A08RebpL#t44j3_6d3=TZvsUH1j0AP4Vdce?d^L%emu%J1Dd*zWEN{Ky?e|4 zrvBG=huK*Fork@;fU%t{E)@DwTU#43`pVVCMf=*d!_hG@>djsYl`{h3;+Nj3zC7li zeH+R+A6i<%mvqr+^dx6VXh_IikcOk8qKdAMu(!6(85uDhm$GZ&>`(XGp1mkn`UX!d zZ8E39EF30sa+Tqy_pB_<* zT)L{SuTO7AwL2rfXRTh-8n`t2CQ;v1%?i9uOTHwp9q=@tz>%%!sX3GGOpTzTSW57GK@Nh((dtV#(kNRLaWVAw};nQ(W>JGp6_a&PWR2gO@l1 z6BOrz=8E0Aot3u9tRhaY_Nc{(hzJ)D1{_lP!fq-~IhJhd6#;~UH2#ALS&;2fs)DFF z!Xc;p!`RCaAh|o_3nTL+_t%uDf2v637dp^@5WeJ_wpoAj)Aa`&T~Y9__M( z;z_s+Jc&8blTSt5gyt}GHO{;!d7z-~N5AnJbbiM;+?=8y8EJ_)**zi3{-(=+*LnM` z{O)g?13d>*LzbXeJKIPj&sI-y?F752*6xpD{|vwNvMgq* z@lsA~NgIw9g%v`2Fl!{C-1>Hf@-7#lp3s7K1%<2iFKFgh5HGBu>0{T`|T<|GT z1e1MBcYiEtro+aVlwn)_D9GXSBgV{ZbC8w4?#)tXi%$WA!@CBbO^Q>CgmzAqH*em= zlu5@wr1z8G*`$+OumSrsnM-Z9jYb_xArPz)=TA98fh#*0mL^>R zjsg=(zLaPx_cOVEbAe_52ITqmn%H0m8MK!8oJ~QN!+wCwA^b)6yBKH{i3nfpjrV7S z@M4;TjkGad2A@0Pp;qu~!3i340j}V6NnKstq;0>4ub!i0$!h^eztMer@GBqbdqr=0qdwX>OGvqv3 zkb(p_u-Qz1DV6`BOU`_F)fHP+RRxNfbgInx%JWGrFtTFGV4CLwN@^riLc};92ct1u zOK0IN&AtSTDiCepp$q$Izg$zr_yp5ZnwiesvG9lAMtZ?|#1(`!Y;SFW-tfoGWi<|U z^oKwKFHE{|sqi@ptQ<@d7`Po2CKR_MT?c676DLksws30p!!HW*_>o!llClHHKb+)u zJQ{_NB?alV9Y(N($W^N4TRN+-9;!1dD^51n*3WOnx3uHIy;2^0;to4D^R9_-O>OOw z)2G?1Ae%Eey_-f$W(qjVP|7=6xgK(Pk29~!rTMXmzhqLiAKx7sFq(Fh+B2R zK7INW_K?#laoI&YvKLsWki8HM1N7;Y=Q-bt@UwdlUehBb8NjyMvBqZxqM8;N9ND%3 zi}>ITvf*r3OMtXBAwAu0^=OCDY*LjGGcY^{01;oVQ)tD-(XmI8c)MWw-v$Hu1 z3k%DO;OEkfi2YzdXrI!gouA}Bd0WF}{yRe;b_j>V!L%`{>{AY-8{2pdaA@b7Kh}@l zA0=D8_%tpqZdsJ6Mw0_i6miQcrgL|7)v>bT2Uj@C?3mjzp3fS5#4O7WaPh(Y2I>Y! zuCd=;&)1?;6$r2*Cl^szKK|}cpUwlymBY+bs**8t8H=uaz{cZ&%x+RveFB6%^g z3I5PDtWDno6i$#WHd%4PTTal{3YNwz`NG1&CZ$)8A7A%r6mI^&y~BWg@bDq9IoVQB z%I?GTBWUU25iar5aMigXech>30fB)Sn_IWsPU8<963)V-7{54n?mVJ{ z^0AyLgqeqUzzJzF?Pk4Igl}nSIe4JX;N1*GbC)kSLEdWoZk9)_qp$C;P2u+(YQ%th zEB1#WHOL}A+8!|V(DFAr*?Kar+#VUYa@TWL&}g|s2?M{Vsi}{K$HdXojy?AF(UU5k zYyRtNQ>ji4uWepXU}`-0jeIFB0&tQ)=q*SA8U$8Yjf<8Pi-k*31_q`c#w{h9)nTG? zGEsL%f`hT?rVsEE*b=2zDoU#&@B8}tn#k^4%j1p9%+v(G+=gG#<^OS!b*zo8ZGJ() zg`cNRn{ZK%f?}c5HgoO5R}$bC7GO;Ysz|cpjxt%_PrT=72*pb|i+f}HE_ERT&gR`d z|C@Y&UgqiUA+(=-6$F{0a^a&Fc!?FK0G=`SD=%L+mzosu31a2jR0WoAd7GG+aCDu0 zi`{I00UX}!=an_m;9C6!IRbB2z#bIW9tdM)Z0uebZPUAQ)$slaZhd;$UpgBzR{xH@Q-$+Q=Je)M1 ziu<4-0D$&x*{Syf11IZ9gNiAxrKl1=eY&3{WC#dZ^z^>7Ja{prqo7rRmKytn8$1~* zF4;l}^vHKlz_XkfcAEhSyRz}w9#tk~r zipCNIGC#N0;K&Eg&!j3JGd1dM7tYes5}(x=3YURX$L?he7w0f?nGuWLle7Wb+g?YH z97+9pM3zsD5G#rJ83jmVg4gL|3ACmq`z>VNwT_NvK?|8*@1zF`D~rITKd=*bG~r_N zFJc~!fCN#DgO7xm80w%19dRGy0rXKfIPv!nW{d;3RDO0gG2@brw7!uM3&?)j8nQ-~ zio#R=T&GU`bPs0g^v}?OX!^XOBEGt3_(ln&_X9!w8sR+z5r2oF_-D|n#Z=90w0~rn zMLO}=TQ+4mIk`6^M0)H6@K5cIYX_4ASc40pMS|0^J!@`h84Re#yvrI3BB29Y(_g-5 z1NB&S?i-(Y7-Zgnq1QDJ9|l1@%N=NPld0eS6^f=v9X>7iIx?F}>0P{hIWaV`GM5Krj3+*v;qn`9{M2U%UI*_@9e+EEMWbt*-xdKBT4I}JdvM(TcLR#W zAqE@{{3s>@mR=aQ)He#WP7cWWal!gPdY6d||Wr%g+TeFC0@>^?Tx$5a6bY*$MwR`SQIXK^4C8sp$KRkS4* zTM1LpF=ah;Gbku%l9kOsQjwBBDLFaJgdc9?z22eSFDxwVGDbuz*J-*25(rhpvkD{O$;I#5Sr-fqnfvk3Yu0eWpi_L0^m(gMKfl~#iROvai}$A)&m`VnS;pn=pP&_n~ps3vf>^oNL}$t zW;iM41K7aK7<^`hIGW9uXS6mh4i7RucWVyI3L!hnNmwUK+uK_P8nK^coqNa}7#Mi7 zHJ+E{a`44@=rkC-#jafEhRneR^`X6d-2CA4ATMw4Trd=>cw(lQD(d-iF+Ak0Ou_u* zgao{UZ!EW_`R>jZa2$&)pa9j62qr{`(NbWsFkh4kff2&wE-o(JP|>hYtk~j%Rft(Ey>crRCDAVe+v<;aA9f zeSMK+SJUXRHN;(1<)pg&`o6{T6N7_Su{%3EH=83F|8%#2VY$DbVO+tS1@7_z)$pO5 zx5RVx1`7*Isr~MPrYuM?{eN`5by!tV_bm*^qZ~>p0R;&`QbLh#5Rh&GNkt_@LApa} z5L6_jLrRg5Qo2ErMnI4TNeSux<_6#Q{_c10^$(wiM>+fKz1Ny+&N0Ur6Z)6Kq8z_9 zAvWsL8wmS0T_pO#3HAtT_wT<$7SunT!c7d(OSslmZ2XK8dhbH7={x6PByI==SCrke z;%T^!ewBdBmm@`twV&^Y1|OsyKXp(?7XEOvbWYJz2=zdbMDu|ByZ zBdUb>8xI`GOsL+4DQYBr+{MU;m)k4cP5g{^6^CMItQAIn2qH^-JdlNsP66)k4cX!% zm;sBoIz!ghiT&XM`?_tU7GL^a#& zoi8L@Tm*mg_Rijp`s8Y}p>yF*IF3KorZaxdD+vb&UTrNcU4{!GWdqWH#cJ zU^7?42)D%KbCZ&Y2)5r<4Bo>MIyGZs)hk!7l(hWlk^fs}Y;+Wog2a6fH+Dn4lU<;= zC)h;~#Mn=Tg$cSsmYYbaea@%3C=3GP;y~Xcy=~C?Wu>Rfv<`mfw1nRG4bvuq!urdJ ze(**0vo74eH5CxWfaQ8=d(hWo!oinH zx#>iR--{QPVt%-z+}DX|eSEKpVjKL5NqlvdoTx^~zH91YzH$|%TFxnQ*n%heTVizy z3D7R(v#<{6B}l*ob6$RaeNpA`nP#Vr0<5M^L=$!>8kI{_Dj7n*wzZWBF){>^h8iH@ z@3O?_=iW#_lsDlnz3Kx;Q0LfK@`JTPg?k{N1smaqk@hbGq~M+5jSuqLLoosx;^y4B za$f6roW|3M-~btf*fTj#X>$^Ea!oC=<}mOfa#*!_ zM{*|6ew3h>paYjzC=X6wy^BKSLO?`LI7x{p_`X-K4d}nZ8r}U~Dq*UmY65$xhpJWz z*$j7zy7n*U8{G`GKsEz6Y=$4OjI~K+-HEp0R2}2`TVo9cTAcAJlP;wu=~&1GclA^C z7vTRSbeYYuL2o9js7PzD!{RJ4F)>)4&lG)9&%=Qg;D#lXVUMuNCP2ldc4%qy_!$fW$CGz)=r$4?P3Of_fa`F+A?SzI7#Z&AU-|?d?-{N9r?} zELaCQuQ~5Mujzt+4}bVfZc!$=tSolBlDerEt)Zd8!prMm$sqFKJUpF`gBDM&{X10c zo?B9K0MY6?4-an+!4*BEV2LdAF^ETy4_w2(@+JUi0N&{?zeW1KwY@z9C?lko>3t31 zaSx?y(zK91l50qYrdoHMA3o^APovI2tfoTafG*59=B z&>PY2kv77E4`KIyui5f~ioYA0K`K|?8sR%W#6yvoMF~QYUxzPyHA;Tn)YC(hX zSiDUDafJ_ykdtl<2{jaBwLd1&+Y_ga8){-=v6c_NmrIzQsB(8X3^|r*TFNo^l$5c! zk~P`T?Cp&>O<%Z^UwqN${d>0eIXOjl?nJdRpX@!3XbKVyM3~57JS4X~ zKc5Pv!cf)OAEz5&c#^EF|GWj!Xe~U3OTXOTED^)q($t2@D_{P1Kr+en@Dt=6O*_<3 zwj-_yIi89-!hpDdEo$VZU2OgLw>+%;{QVXW(v0|#Ba6XG=`_j|K5o^_#0;tVU@PDCM4$#iES5RhWwCF zMlcG=fOg2~YgzxB0p-_dDk0$lYg_`p>{+WatFLfWM>sr<7p3)SkfXor?ac=N@V@0T zCq_vLmdQO%=U$rs?9|O$eb4ozu-u5Ma5CZiq;oG<0>(@qGLHCFX=!Q9wHyfvq~K)a zhK_j%vO12jh?-%yiCM(pZ0Rk=Ru;zHlF{8_v` z)FC-`P8+#|d!>OJ`~m_o(8s$9>+U10=SM$OcpDeNmde%DwHMvb!j^~qySRpuE*UYk z#d{x!`(MbffX`=X=?OHoqKhMnBpg#xQV>5x{QJ+yej!EIaKmGPQ7AF93JZJu-`FPS>~`eXr!ia_2OkWtLx{8VA5+6aS~+>}&X zgx;2UW2|%yj?VhtOgK6Xk#g?1!*LasmfpSmQaqoG3?>*PQ=}ji)y4pAVHjd{HI9}< z^8_${e3^obOwG=&kZ&W4?LN@!-@JU8%qB7+6c6`Re}tu0H3S>K{E{HkjUb7~k2xYE zBj1uKk8*Cu$Ss9vC<9Zx$kw-so+l9Q(%1WM}w>*x9 zVq%HcuV24`L_;K3I$!2Z9gm>w^22=}`T(1MpO@GFf#viMFo9QtAxqC%FcuE*8g4JY zJpI>nwe>QksU=ER5e8L>Ec{>YX61}-1u;1UF7PT7`t9a|cQ(zc2rt6# zs;jHNNk|YaCQdw!jbJ2%&z@6ZC?UXG5mEmVQ9w`gP4e!nPoQrE^TdaN0V?F*W1v*dz;xX zD7!au%ZFbJVw;4yISYruXB#+l@c+*6eu>JOfQ?A+(9lA`&Y$bo`jDgO_Y5xR$~FI7?(6MU zb8-3N={l~QH}*ew>&B;o6#$0U`Mv(>qwaZhSfVdn#Wk8A{h}8!OFp*ocUTU1hILL zR8!$&XJ=I1qKRckap5%lx^d+yE03S|{bt6}Xq_b4t~CBGoi@pgGGPhC49 z^?Xc-6>(}(-lb05j+c;Oin^8wPJ0~Y+hQI$A3vp&4u*NG`SjxVD8W4@Y zhL54XOvm8u0bdZ`+B#X;t-;#oiIr6Y@zns6$?|M?x{Wq}Nqm9r0v3H1PIsD!~0Q-stC+QL7`B9f9+0iU;g_J|w?dlmZM$$~C9KJTe)foBp99#jtYA%EUc zjV&vxR&KKXVIva1ZUcB$MYCgg6Bc$MJh2dBq~{8e|9?KxhmhGqJ1U*&^FwtQP5LOy z@0$-+i5kz#UAZsB-4tn2W(~MOD(oY0P+T%)bqiF3`8%lc&9(Q*8n{dWJb*Y z_GN)^ZDAs@sAs|vGLA(?n-r94@Dk_uD zGC)S}a9_XmFL+vZ4hcR10J#Xn0W)Nw3gU1YBCTZZ3;*D>&iks9t4BnEVPP52DPIBC zL0I0ACNgS7F>fR+w0SlN0}ncT49X;XD?k!fjxV*ybyv9C)#y^GDBC1)9yr%^v zlm!TT|L0dH=zAUbw9#k&UcAWzBm=tkWCewth7M+rGdHo(Z4ni@@zQg(fvUj_CxpP* z*w{V)DhiL!9|HiXx~XXzy>X`C-DUDjhy9~@FuQy>n*QD&EJDwNO&JvD|NltI^4|Pi zEvUYVc

+x8)h9`S+=$=p6uhW23gXX_?~9jRGzQ$S>49D!2Wu0=@_>$${5jv3rFH z_!n&&ezqJ*w}sTLZc~L%NlEG5`no+cgTx;^Se5L)A)R#G*gnrbow-OuJd|bm(3#ut zs52=mU3#&>x28q{@}@YG+ahRGE-8@y(*_6c^q&%>L!t9e#fnG<5!H}N)Ji9jjv2D? zTMex2oZ7a~KmotC^t+?q2AZGa@&c%s|SyhX6Zy3Osi7IQ|j0*T5ttD>{g^p$%3 zeSOuOoJ!p_;Kg900Q=T5G~_VBjes1FIPYt-4LR&avkm>SJ0ttS{Izv4i4rGhw5l~s zW%-{m@^8q3Z>8x&|L${3ho?5ygA!u60duglrqJiQ8jmKB925W7izN|3V{&v0o;k~- z{0kw134a*v{_%HJ&YggyX&t?Nd~_o(9#Rs?^VcLz?xE65TfH`;1M^ZsL-5j;e;rb9 z;4fVSC%fm$!A!E@a>{gSnwru;2xPk1Esmyr-q1{c_rG<(V;voeKO>d;gB?L$SAHZmdR-io}u$ zKj*C2ak_E6#M-|l2B-|HDwRlXg)~vmQ&4=sd^G(2uRZGMkdmB@MEJJm)s6`nt$o#h zz(C_A6I>JtY@RD7wPXNSbc%D|x}wcdr>-%9Uxhd;m z#OX!$7vZ^eD1^Q%^xXB$KlnS{T2T9rn}hNji8-7tFdL_(Ot71VDn{tj9~c<^y$WBa z?a?h~4qW6-k{$#G2F?-Q#YUY$4l3_66i~+|f5=Q?TNw1MjJQ`nR}q&;UUD?AQ>_5g z6bq2nwuC>{GIwH964&H}uKq~H8~$sJ|7!_W`T1L?*Ty8)fJ&WJM8w?{nNsu*UpS2> zATeK_PmlFKdw03h#A|mX;fUSJt546Y3mFe%bxxY-C4J}5pYm>-i?5zO&EZ&X5rbU1 zxo^3*4t&i9U24l*UTDY#Y{y~M=HH10=a)b!DXF3yLK&Ath%Pg3-URW|$?25=^Krs{ z_%s(UWW>?z6y_g1h&Gf3>BVthUcz6($%!BASQMKY3rgIXwkllKsP(Hg@xd3|a_02H zNP#KN#^xs89pND>2*hO6)QeV_ETaps#U7XwQ=-EzcMc57D1RK56BYY;O8HNMeaBIS z=+7QGQ6R$i_W)nd{kW0zovvniX#0Q)dB}CAjcaQD`-lcX4&1e}l8>y{C{9BKA0Ho; ztCx7ok>s0-&J>Sm`LIatd7rK6FO zWIZv@49l&;O%nbqDQ--=+aD&i+v64&?rzyVngmwQWx$wZ_MlPq_GU+)!NIX;jpE4l zwRy7~UA2A%FLWKDY42%H>|3EBM zDw@qwKfByXqD6$eCVXV~zHnu^%D%xU_^f+Z0jUwcF@P9y!ZG2k?XzNl)qnP;Z<1#Q zL&StK3tNtXo04Z|!Hub9Xh^>uw~vkv(sErQvhNarqo-@P_40EwlCj>m!kL{J+2{W_ zs(tx>hb%ZcAl5y{DHVZFSC={v8lQ)Tq&+SO%3d3U4tqr+zRs_c0+O`EsSNQoNC?B) zU`J3TB2KC2HNm%};Gg$p-I#(A_z@9DDpy~hc zX<2pAU4^*%q|g@x>9j}l4=gQ7h53S<5~fA@xFsa6!18`twtw_UL*w=5Q&%4YiD+Px zLrX{EUneO}q7b-kvAn(arU9GIp~vg_vLl??-5>TBJ z#P1A7hCcE94$->h1qMDxhpf4!n3HMV&j~IjgKZVU2pn-1!~* zIAhF#j4_1w=3Sw4!!|S=@o}j(XM7WbC9IF=BDG7E9{ly2K|*ONZ*>}+_Pq7(A09|Q z-#-7FOUd6D(PyCZ>9Vfz9P)oHl{6IyfFJE#ISeg4J;jPkO97GpfsJerC)Hu-(~n#E z=^1_A!V3v*&`i ztI~icV0Qv(+A-t=FG$AHO77_EzbF&_#>L3!yUoH#FayV`qe@;ndt+w61i1W71d9J? z#)2^$02;q4HiF!)WAj}>x}vi*d;1NR&gk5Vz0>3GKssfQ2po^eM;M=z!kvF&{ub@8 z#+jTFI1N9HYW$GG3Yk;@FJ7QEKE=^}_76tq;|svrv|6*gIFwyksLFy%Yi(_5zL0Eu zxMVH0X=OhhsnZR@=qpHo=9Wr+|2`OM#TTE2x}gZsdklf|cD3J!OBXMuB13S7gonAo zqyg+R6T-0nZK>QwDQPUX68iJSAM1pLaJKilGxjxH58E8-B0f*7 z;N?1oL*CNxg_TT)ud8M(pUAs&3~RSlPJeFL!Od^+=PZ}k4!*~N{wPUF06m71zGlJ8 za!{(xe4e zW%O9r$2MkgVJ@x#iox_iNR7=?)>`R4%kb`YoYw6g#`wV5r}A~!cQGhZDBLL#`&g9~ z0-D%BEU%XMH*aoqX*w%O!>wK9`w{v&-z}M1#ww8x4Cd&@$WUC>`_~QKR~zf56N}iQ zpOo#BLC}mNIuW z5y34PiXLd`^)pf5;CRYpXuozugm3nW7<#@Aa^AO;2E1$TqitfF@81vebcgQeo47c) zbyDY>2odm3$&ZcHl~mSdB9v|z1vFM!(N#Nb*4@TOyE@~x%U_nP?p)(CgqhLcsKfpR z*?^KW?__)4io3?kHs_WEg%%avVB_MVxaLQQ`K*MsJUvA;Q5jFoC9Dr!@Gow7cFiFf z0tW7uEHL(wZtMmMsO1b*X|nbeI}0CJ8CleNsU4X}&CQqI{RSlCt;>9`FJ`xILlw`g zc28z3Q1Y$;xBV-urQZ>!FxXd{Tig4J$I$Wq{pDn{la(e2#@^D~FBdMWdCGsZ(Qt2|3%f(ybXuAMx2UM7 z6B@Dxp%c_jBkwo`1%C>j7XGY(F~Q;Y`qT|$ud-7l_mykzKaKw@@Z{}Ng-ms3ObhYn zv1jINEgo`BjB+g2t23}_w`B>-ya z{SnP6 z(8?r1n#lLH(0Th7O5n%jt;@TIXR&jvtqFCSxT5w`gXm?)6peRDzFOHcke|OzhlO%v zCL$q`0!fq91LttVOYTRki&z|J#aHU4iWI!X4)}6O!t7C1Pur}0{{SIBpZ*mT8?ln! z%L3p?_xwT%H8BIor+~9I5qKxTh!LINbA)2bqBX-(#d;7NVDsb`nav6rM&J$Bs4FFG zbc2J?PCC~=h$K1j25sVC~?)?qf0TB!P)w zl`hxie{nN2!SQ0{TDvgBO|S0jyN80t#3cbKJLvo9mC$?%*MrGFMVmc_bwMKAW6$lu zDDU_*_)h2TVK~Kd&s0;;$g$WTtK`uP+4S(h0Afsg91c$Uk{j#<=Y2q%c9RY)8Mg^k zx>jdnLs*zaC65CRCH2LO)L^FZtb$i5_D6QholA8W?Pn>mWWQWS5qQm!3uwSH zo>b<%DoM-P3VSA->LMiJiy&C}z7AxkT3&ibf|>>*gBWs`)=&BIqR^ z8%}beFzY}ol!B$L`;Of$+RN-g%IDW`=vOa!H2jKy>V$AUX+*lYuW?~LChVI&# z)~Hf&6q=tU630>Jt9r6|a@>B@*UQ3zsCpWendB){d9XQDM;vAxB_n=xXaO(#Mv{bs zGysx8v`5hquOyg_Hv(-g1NA{mUH!NaLth7h>P`uI6&s z-0W&QI*7GlYrf<}?Xf$TdA#Zh!3S8=<+Z@DbmH4#5n%T8UGv-dyURH8?v!+V4H)gQ za&xOe)(FRus+YT2p$(t- zZddp$fA!9b;{)O<3OG(h(Bdns6TIC1pCaz&M->hdBq2^peqxk_7;WPw)=EbZ*Mv*~ zJ4yf}5K)6T9f9n(+GbVvh&@!{?cJjqx=5{JO!Lg8WLlST>A|u*gMk@{fa$OuRFTsG zbZ-W~UNV0Ho#(2<-rvNP{1YP4H$s<^;^Hn~hyLP@5YrsvyWrs(q##j4fD#lGLoRc(}w3Bd7mKF6IS3i02H+&Lu=fy|o$4CdC{ z$IqMbfROa1{B<#$Od5s>+d?c~R|em%9Rp;?SLOCWr2J1lkDs|q>4WWAwAr-)n={K_ z!bKT>W1SH1^wtIa!UU)@G8L(P-T>48&PTOCJ8`W>wRxFwmVp}!mvVObp=;l<-y%&N1KKH&8VddOk&DnR_y0YV6 zt3!Nh>DhA0#6PjIU5+twH6yJoeUfK02!3KIAo@Ld*L>Jj2XDD-O#(@4Xt*YF7R{k4 z1)tpVwm;|bK)$5peGlmg45Noz$Ttazs2arh1cbH$`EhyS{FQq{NpM)I5&DD`5az$X z!dIgZ94Gn6^FSz4iyx1LXpHS|etdX7NEN5;a*zO>i5EiPYFJpjDc6@H;JP1W9THowLX7>BF#ozn z+FV_dC`ZM^m}R_|KgpEU-(v7lzUBKk=ZVu%msRJ}+Xx7IdNoD#PY2<`{*fR2VLh>^%*>71=j zu6*amv+s#??vzsD`vd%r)1~%{c=@w|!I+fj(cxRm`}*#ua%c}%0@mT|ylsy+ z;NyKA<^Jk9m!nA_aUifTjRv2kAY@k2JvPH1fO8^s%wR|Mf6&c;7dw<51Ic~nLT-d` z>(T+|WG1*QdF`PLyKhfLu+&}pvX~jG$3sdyo?ao6! zJ-bBF&cwsv-~MG>ex8<+$upq8(yd%I3Ngb~pT*oF85_a{(agJw>#t4cvW*Qc!#d|h50<-TXGpq_hHTGryH5F?vsfFsKJNPj zRQYA#80m+kYVV;MXeIvLBevapjsRg;FZ6591)oU7q>$C{k0|kPH8f#XnqF0s0R!x`_1_K*R3xMpiW_EUVn+B`G>)C7| z20v9?d|g`IZh#f!i9c_idR{M8=XaVSQ2H?+!9k9h)_+v-H!q~^bCbi8)hxDgpT4{p52=Fj!tan=gwy;if? zXNAo!u^&H2=SlVvEJb_YGkcm2rc}eLQ^qoeEWjZK7X0x;T%zmj?Y#+-iKQ5Y5J4NV z*W{1m^D&q)+ya3G$sF8Q3tM0c4I?6y5M&gx10u+$GoT;!`pYiTW%Y7fl)KZLCr$im z!ON6EdhRX%p$x4x`6xT$mi7)jxAkxgvLqS)Q;ED_(=f){bXV^fAmssa;j=Qo-&6c{ zAQ=CoCfld#7cRQG(a4$Gw@h{&4N~QJ*ZJ)A5w~Ue(_$9doWu4ztQun6x8;&E3K9l| z_k5XSBFW@+Mh;NCMS-KN8{iw)3C2fUA~>+jFQHcwRTKaI(>nYOTggXAjEbdl9=5~7 z!^mii4N{96r^E<*v);0t2I4NL6-cauZCA!5?{d-7TDvZniX-{9E6VS@>CDmDppT=Q z7xjraR=>%0vs2Q#(>vtvt_hFtZXS zfW#s0x7iw16#@}Y%I67KX(>N2aB~aXY>b>JAM-zhqxM*nYIt*~)HfnHJUp|kOz0R_ z7Dm>0SNpebsk5`@5X|+F4#c$nJHA?AtWA8l2+Jd%A(@g{*T?$_8fK3ug0??HOHXXX zRL3i+;fFD+dGL!J%Cs`3RsFY+2G7p*A4(=Y;UH>X4CQH0u0GUuufIB815IqwlXhs@ zHj@pLlEnhiKbhmg#h3dh+{cM5xfLmv{wEbg-&UXTVrHeh!^I;+#im*nn{p40f<9E= z-lh82)EVUr|aYNCj_VeX|!BMAzO`YJk!l7G{z4&?Kzc+?{ z&OOzbIl6a{CtMaNXh7fD-7ST4HgMT|>6<~>_Px0{&V>DnvzW0CJ%PW>7?Uq0TqmuZ zsd!L=)0sR%xi5CrcyDV$Rleag&Exj+J83Aog|FNUDj2t4=2`A+f5vt<37o&84`GtU zF--YO+1rU_6l&e_%;F7q=Vh~nP30I7^op-;{3>0T#Oq}qvD0tN&YUC4XZI1`A3x{c zXKQ3Ts8F`}{f8rm{!m58N&owE)fbBb`=uAE8rDb2`5oX7bfr=+*2V@hPkFS>Ruc6s zYCp#2*0V^VJNr77`dDrx;cliVV==(A`0wN^`AQK46Xrh4nm`^5+(gdvjBJ;E57%oV zk?p9O?6tU^MiMj`zRl*DT+MIjIkZ;yb!T@sEP+de5dm0M$Pm*#4LP}h%#70E3IV*Y zjvR4(cQIoY#B-0l6R@UTTg`+Y-oM`>SPS({O%z&1aGJ~&Y;e-;st?}t%ndZ!y*n67 zj>1}=_|@5cMMQr6JCW=3bB^QsSFA#Q0yw?Lu`Ka2*u+Y0Y-~Ut=eRb3CK@WX8uSGl z4Via&*znL6{=m!u7FJgIlUP>5u(CILl$iT@0&lLuj)!E9U%Xsx@Z8yX+&4dp)U1=X zKYj<)V=kcD-Dke3k1!-G>2N)By@eq>5XlfkWRpuuqF}h72w(LuQuFOA^!AM(@orLKis)X7*i%pg=s0g9GpZ^1yDR zkscoqucF&`;`2DtKeP+09Nz|rht&)twj+N9=F<)4m&YV}{z@(mb*Qv;qf zrmpKu zU#bYrG0sg?R0JmO?;NFtzM-@*7RX}e7P+o)`oV-$6wkM>ftfwIJA?&!v(A9c&Boic z6Y~aK!Z^p*05FwRT|GMKGH}J`G(I_uAdE5WmPzaZTtD&5%Uo4{US4&W%bh#@)`)^O z;B{QwBUb}78k-0pu`0hGEd_L$IqhjwoT5K3%Fu9~XVz(0t*_`7 zZ0XxGRsI}gRcy%K%18NhcWXe-Qz*q&(n1fjje(hN^@{y<{7LCjRP^6=N77O23>IQZ zGz*p;`pDdi^pL-so2h0`szWs<3V14Ri0})xEFFHgc#zrL^;X<7^h|)PZ=pN*P|fWw z`4)>m9;0O(UnT+MS*56P0)GwS0cm3R1b@>N{y`et~ zCuc(!Xc(#-?%4l&+I-0#1`Hh64_9TdD5R$bebQb|IqUtrh#L4dtp0`yV$dlnz&$}3 z{n`!=Qg86y0EdmvctJaa%&+EIU9oiaj-Yi3y|KWTaEW6qG-yjegz@F(8?7#{>XlbE zuZ>L2ObE}NBON{S0?ru5eADK$^MC#no6ggGy&y;Lf-Zk8PY=ARVn;PY>1`4+=nQmTDKf*R$2uWi>Ck;(sY7mzO57Sq}L!PhYAm?3tW<_ko6Z^KL!3UO{5? zhYu2?=iZSR5TIx(zu1m-VxL|LGJu?vIqSn)Qj{*Cj-ng~Cnr-CArZ9iMmaA~P#kL$ zu&@E1mN>@4;ERp-YHBuaqF z2Goxi-!pWMh8uZ~;gDSnH5?&yroX1(+ z`Ts}?KgPsfv74CW-qBSe*n>4#;&m>ay(ZTSVEL0?-AN|2B7iNH6xo>9C2Zszk>-{w z92Ygy_Sc!?mPDxc;?L?sPcbr@ixScM{e|~P_nYUz*Ywyv5)utMm{EA@)G1_i)ra&4 zbM7{5f$2jG@!+4rL?J9_1c8p7$fOI7{)O%{TsjF})CqPI8tiYLQ=@TP zo_L-oy`WI-_J?*o{ITCNp3ZHY)T`9c&c{JHtFrXVR4~7pe4zaZwvMB$y3ux#>RGE3 zma^K(8B22|9}qzyn6N-V>(KBu$!>zAY<_=I^bQVFG(%^Pu*7t+t?=N(jK)rjela%Q zE~wX4lidFXy*U?(_**zG{gQ`t>$Y--t;=|>L~C(_niNrufBw(@?31pO=_u+~yo-_& z!D`7CCDbRIbSu%-Fi4_m``$%r>KpMZLF{(sZBDAZi|6Dzh=7qoHMIZU*xA;ozcMc; zie{%Cr%udj8)}R$Fvq$I6%!H6OFS`OD6w>nYQ^8H)6Ko&Px1_l&$q2g<;9B^T3TB7 zk1wjAfcNjBeatK1B##VmR|3G~M*QOY(}i=nkJ_&vUzGA9O-kKg+3c@7i=$MuJ8J{l zrmOr%Fm=scywkU`?JxzE+M1(C~0&=n4r0RW5%Qg11Bg4bW^z`&~ zYv7faqmumLLkQUGJ>Iy%5n=4^E&`)8b(v@x@13wTOE&5*)YyImlUj)8WBaOtmaq=D zh+Ep*nT+axfAijU@JpQW7!q>JE-8>^dnK6NW#3My+6_(j{88Xj|QSn(NTf0wEK?1wf{YKHQXZDab zX;Ongz%A;8eoBDLOiWH9vEW4BRcM_{3SnvV=x}R2VcA{o_~ALAD$MF&^4`b9jP$?t zZqkay^=j8o79%*-x-d#n+=RJcCc?Td=LerDCou{QO?#ZIJC=z)6RNbaCQV6s=py^ z$BH@?!s9*d3_0H~$+4Wm_Ecm%^>nsP@2ge}2XXSf#b2XK1#4b1a?l4Tc699Npmme( zeei4PZ!1?Oj5I)M4>}VH6j%=1&i%44@3pv{2;I)BuMC7q-rZJqj>(R#G&9!_>nnG9RVc8pD#gVH{^P7v)| zARWp8MR#g>nTwYK_Ae(I3`0~QjdhgopLBtqad>IXG$4eAvgS!x0;hCyb>Nh^0oKz{ z+`^pX7!~il3dD-9;qpM_wG7i)H#1trnWT!kNbZ$ljL*D3fNJv;?M=-?ArIRzsfvdS zdUt9048GW2dHn0M`tjW{qfUTF>&!QzvFu?j>nxs{OaWMYr_)5Atw_$ej|l=91Df(+ zCr-}e4})O6Nsgy-R_@M!;B4Lm_>))1{dv_V#-3?i4BY>LX`E4H=wr_-JlnHr#?{;O zkB6DJj_7C$Hj48+lpnGUJoEktXnKl4xea+fH5dCGFcTLs&7@*9&IYR4ETRXfY;_Hl!{1;8C8nhN^>zf+Mn(|W+jR$1^{A+G4JrnG&Q#%CE8HfSzn(<44SV7aMA zYS5DfwcyALKdcg`qj#V97nIX`-|_MNexd5_;qll2TLTAskH~p0J$iQjLmtz}$C1#d zo4BUJqQ>3{iESnp>68a>9Ywf~f54gU56jjWTYasD;}g}*%!$r*3eyY}L~2qd&dxC) zIDN-hk}C;J`C&aUK-f|h*!u^9=2!L*dbqpK#+ZgZJti$Yp|=4DxCh*gAAd7A^sKV4 zf56;>+ghj;6hPN^S*?e=WV2N9$scQ14aNkg9?cs9jGi0O;UX6)iNuWu?!0+Ph-o1m zOK6vqZ8&<-(vcjE1JT?`9J#Xi_~O$u`P}cH)+Z;^Aztf}Af*|()h zjfgr*w8$-Ff-EO3?@aCbuo!QWA}u-j?@gC$DT1)w+Q!XySlnv_Y3;-4Wlg}F=!W$O zqJDr5@GVjSFo(AQJ3o*DZDdE#Z?K!*kq?_fWhEx}Hzj4OgQ$`I}9%!kvZ}Hdbcpa^e zJlwUJ6w6LMMgzdxG~L~V0C)q)40$-k9J%Tr?{t8D8<5w2@zF9}Ke6cKp!x^`BeM$% z_ROrTK`?0H$~d+r@HXZ!@iuk1>&Fh5O#ANkH!%nEnKSAN?(g!?5&V%qQ8=7Qe?9Y| zdS-;XWNob_D?ceZx__Hv=kq6qPy+v0qJOk|<@f5wvM1#C4@npv7T_7?pg(Lpi$dCT zh6x)ah32xyZ9HFe$isjli5esHQuUE%8T7M)!Uwq@<-|m*Y#BI}=#3LK*ZqUJm-@c1 zyp(YL{lcqz*YJu)`Gs)H{2?VRN0R=429^$AHKj(vqx#V*U3607JOW zo?Gr2nYhSWO{yyL3jBTh~yYKXjtkp-UNf$0`dC&Z@nKGA0np7+>k?iSknzg0qC0>VEqfBGL@?(An{dx;!OX z^7djHV76Sesk@#Q+;zBaFVmA0M5z8c^PHrEZ-fk?g7 zfLT#l8{KZ=5A1k-!>&Qrzl$qRG_E@$pRrac*D+ALr&HyRp@&ActPHw`qk0Elo4-VH zC&6*hV!gEbKp8oXl1Z_RIFTMof`Wz-c*xi`d}D%K%fC;^XEl{+6u%> zx?YDg=u`SazfX|8QQ1k`09&fhz)j$dl#5YlGK# zm%67O(nIO}^H*r|Ngt56Tat%iM6@?N@;rad@6iwC%HN z81q{ufN1pg^rYQ=V5xBDgvas$H!Mp5&}#O^M=!?q?=^8*A_&2LGe{YbIOBZ^*Bzqj zdgZc5xPrn|Sj^kAKL$>V2+hTal&$`a$mD5UyGY9YX;r&spvm0Y{ZoS20A1;%vyBb+ z$jYPrQs3?=3`{`ua_6XskGA_r0Zy`zWwxI-nfylY{rHziSMSi^ATnw-^>$~J^)85tQG3JSsgkttxKr7|`V!j*x{P?43D4aIp|(_>~;C@9vm^?ofpX-rRK z>IN#(;bZR)1}A(wa~rJTBal{oey@(F1N96q-?yDx%2-g3T=!5e>F#JBp%LgZ3f_Lah-(jH=nUUGsu8RfDS*4}@>-Vo~n$D#x zbfk^ZQ42m4GN3wR^=CGvjA>_M>dFto^?_DfD&uR3P$~E$cqr9tsc&@2{#YYi-<~$^ z$p{+V{sd$q4Sup|4I?8J@U}$AL{VV8JCqFD>MQuEj=*HH-d|U}gy-#lJv((US8jGm zag@6JZwNL@$;8~*7q4|XuSr(UxARyRw0Ta!XG)&};69{FMbw!f;o(s^=O#S+{ptyh zV9%*OGzjLakN?d0ff{L?FR$aN(jMs(i?`&&1UHyg0Fde-EeW-{hqej zd(4X%J|;EoQQ3sy1C8_BAXdb;&dYpJu9&`G(d4KBv`Lz#vSJ)~5k>3*8tRwf}GiNK4v|x1H6zX$|*ZMB0zDvd4Rq@+y#US1j0> z(}5n0y?5kFDPKZ|3z!nT{!a3nZj1mWzVrv}Vt=%hL zhz;MNOPGgYg{u6c?uCHxO4Q(@g@lCi`HVhwA~Pyuh{fgMdzSFff}wcp>Un#Gz^0wR)bH`;{k?-SFFp=;rc-mdIdLTDdQh1ym5j7 ze%6{D8Xc{$n^Ha8kpJQup1^O2Of0g(g*IwU1A6;&`6XdTrF}-4gqJn{#3pq!E6EP< zVD(G+Gwy?5u^d3{{8yqhpIy~22}Pl7II}f(Ke{ErpGh5eaX8XIaH*~F#5;*A!J+Q* z?nr4>Dx=u5c^U7cvs=-8lx*{=%hohQ8((e?Zk3N7aEk6N7Iu5Woih{9E-z=o@FKzN z`_YdKVT1%Yv3{Y(!TyC9WK~uSi%~r>dnH$OuMrR2*CL#JaWJ}pSV^O9U^NatzuM3H z@BJ;1ExntN$JTJC>Ejdgv@p&u4B?bF#gE)wK|=t2A}o{&V+|EUF3hhAN~g*dJdW4- z<7s!jX>5J5Hi?{_l;OBg00ECvzkNwk0KbA>v1R0+1qtkS`Wl_m-0DNu!7p~1-KlA2 z{$Y8mqEBT?x?PA2R8jQ|Xd>L_TdmW*e5E~kiEjOB50JSimw?m+P%Rpza;1hjUKyrNjdSXpj>0Ek%PBRJ`nCckT^rbX08^8_8k~9q_dvE+3nFYHoQ41xS*T9 zM)&y;4Pv(J^h&uhwJJP^R#UH(Lmzq|9N|FownGsKWAQ2`AkJ!tyL&f~7&MOWAZo(7 zu7{9|9^6S`dUb4p_)7e`lrmpm_&5EZYf+of!Qwsc0U+aG!HzNYMlqI`vCzhVi+$T^ zW|jn;+62ku;6&71-@Aza2H1cgPRq~6Ah)i^wl2Pm|E&#pNBQQf7oL|0O zN7CLNJl>#{u5*yzf&`qB7X&R}E&uNB1D3D3=-je-Hdn|rA~Tnl7o?eKB6vz_f5?BE zsYAEZbq)`Sm&|F$rQAE(>@ZyK%JA@a2f07%l`D+^O-t0wp`FEp5@~jX`QpEE06}6q zit%b80t*YvL zI4I%pnz2r9kP{JEdtMRVB-80BwBA?jd;IG#w|ptpcz=T8_+`>bG%(}YJA9?p{;lPB z(sp0${rgy-A6Q%Z%uxa%#y=jNZoFO)a6W0e$*kRZHL>TpDEh6ek!`enIOu%;%{ zwRN7Bl5$;s+xt~1V@s)xV6;Nc?(0idvp=@&gKkItYw^rHGdX{ANAd2C{B+CPnA4lH z-Q%Tj9pS$ut1po>{9~$gu(q&V=0T+G(X#QYrl#;vVuyP6;qBmOSg7{XNOKB?gR~0= z>MB+a-JfcCMI7g_lBtNI-siQlI|ExU8oXxt7FNcaQDu>pPb^d=!TSuFb1lehMEP5> z+nx_^`~Pwz)NvQZPLGH{e+qkZYe#*}48!}h%Is^1#vOGJjif)7DRG^%8R2ATA{*vp zIkS1<*f-l~=t10HpY2-J&WPegG1l~5^%M7594ZaBBO)}%IZMp~l)WnJ+< zxBlyw7~la=PRxxIP86o-GB`AU9VYuYP_(`Y{sRy8w^unl8r;b7Ut;N32pIX60M(zB zg=Ho6!>#oc{htfR7bdf@J-p$V$$Kn2An7QM+*0thXak_o6q|cF4 zWu>rn80mIjaBe=m^2sI3?r3+Wb)les`8|Iyne6yel+<<2(5|fSTww_bJTTMc|5(UX zzJPe%PWw35yAnlc2+31t`!7fKRGW&r9(|!#O}ImiV#5}Y;I@uY zCoY+e&{7Ah!1+}4UQPI%iA=1)6_vWpcO|Uy4Gt(#(?g~v?x?YYHU8(8zYkhUVb9r| zqm@JRGg*9mT+nVI&RSYAE{y&)IZz$YI@ug4C*8WL7K#z`u=s7M04#hqTT)}C{At?f z@jO=uQF??3t9|9s-a_y(oN@z<3QQ)?umG-F6VKZk7!yvi;I~|f6suSTxUbCEY1Mf=g zB+(8z~xTp!IX*_ zIumD*)?V{ISsx2jxy|6$1;30Fx69%?lCflZ>ZkC`F7W_pzv*=9xO>C1mUljxM$Vs| z1;w(eE$iYlketT728XQC=9!8bg|VL2*Bmie6d0&gU`UwFLWV)%K4{tui}Ht#xd&&F zF5CPL+9Rj3O+2Vu?QnCo!Ch8#1D`Ug{`hdk{tF?sn7IZUhU^Mu7wLsfabx8J&{Au9 zzwSk1hGL>uxzAD<3qHi5bX|ttv5=idsht^pF+rMXE2wZT=D21;IaB0*NVbpkLiLO> z7Rqt)%O_n;+tnMFnB8Vscb8r27b>Jk$z>Z(rLkoE;OvEMI#i6TnBfk#fM~z0-sl=VW2C^%3bbUTuq2^`eWs_M` z>lQHa+mxGSu6Eqyl|D6p-Ut5s7xw{$Yi6wWGzH!fHHeoq>m$#$pLv9Ehnt|Nr!-aGBl zF?O50-^(*h|Ex?jm9cYTN7V8r4q6wwTAPH!cksajhF zaug$*nTA(6IBs#OC($^aoMx8A0EqUTH*b+f6-Gn(?u8x@2fE#{w&{khl}>F7SS z?U1^kR0E)YNMjBwnn;X#2wcANRN}`gW4ldXEI+sy12Y6y+!sYLbBggWfg_;q%gWEc zJXwObc01hPj%|+Qavx-sVhv-#F639MLnG2-q2Fn!+NrrzeTzQ-mOmH7bPae<6~ATF zSpVT|8Rq@T>8Nc5<`q1H>4yKgX9Z=~#*~VR3eJfleE_UVG|&OxGW+=_j)&M*Y@n!L z2l~F%VN9UzVbZyT)A(hao;tWv(>CjjXcRf3)csp!c#R}Y6=Y3r$9a)NG3Uj6V(ai; zJzUURc>2p97a|8$1=-L;Icn!l2lMXSkvS|Xw{E@K54qSQS8k1)#P@21Hd%fXRHGPQ z{q*duU^g=-6q4v21c_=~=-S}i47fsqzHz<+!ntQKHcBCVdjV&VvcJ2jVD+9s8r!qZ z)7&B8AXy|+Tc@jKJ-SeF2)x8k_nl`t&qy%E`4h2psTu=`C(MBEUzDnQZs3zjuUB5Q zOG#mzsNLv01hvkW6hoOd({julyWgo$$4j|83vssc$#El==hZ8dL~8zu*)zL)aJ_e@ zBF&A`-k099Kb>r}=DHp|RczguzIDp{-Oru1iCdzh=`237>x3^HJ1j}vwidYsO>C*7 z<8{|9A_=&>Nj-v*xwH3lbmkUl9?jQ)++VX9t+}H1x>8{klYdUh)_%c$e+@^epzM=cvS=%n0AXDc&7EfmTjMV;&2ip;;rRS7c2 zyDJI!?ww|hASm~t$S(hE`RgLMr;idMRvg49f&?d{G}YHU8BWSJ2w=(C6q^2g3ka^N z-x2Jcnl4C2q~*(nre=ZY2z%4eru$m`E#CDz*hQ(ugNmqdHpLdGneq+3jVJQEotB<{ zLn~jOHiLFoCK`HNT0s9EG6#}NQn8@6qI&B(@bMp^Cwm`VB6bniCMznO#zJ-W@_jy7FuD_9~uh3`mo;%UZZF|&KcoZ?+#X3{2CP9*< z0Q;BivrPL+F9pt4B>+mTq5&F<+QZj2OH2;e(U2^uf{M%j`*)%BTm|tL;DO>hF>cjL~KUhxjZX zeX5q#{7X$EW}60M*1wPWBxn(VLsN9-h%g*RRJppk9+8rLO%b+(Y#8yMwzzvy7=#N> ze5Gb1D5nj1r3N9f-;Tq@hKT8$y)@15ezuj_&~Uk;_Uv_&HX4{fm72MRn4Ke%*^_Uw z>%}%jFYdcDUwaxDL@(NLB>TEBo`Bd^Fl5y;Q^t%z+@9Toa>Gsmq$E0BE?`d#ZNL^r zgQ`s)!#jWerK#AOkysZMM?lN*2+g6^$S_qQHf{DJTh(gRUVvSv!6V!rEvdiwTwKgCr*`2J! zO@uL!-6jA6<~M6XP+?gX(UaOp5cG%7D$GcqmGDQ0#)%hJyBA!oerRcz^wtOHl~*l% zdq5zh0A2y1qvrKq((}VhLX%YZ@UysH9|}Gc#kg@^tX=7WNN1cXo}nKm4sG~DPU0rk zp+j5|VXe(<$_}FEtgl+K2h;LdLssJ&oa*r6H*}3(4(H1Hi|tzt8<)!dK;fi(=Y@CR zTj9`d0SY&6U~xBeFCNrtx-Yd{eg0v6xcUN3S$Z)eno7}vz5031jDPk-ND}xx zZzkuoWugu!Tx5uhpig}rKsa$?tOyZH7zS0VnF(s2nC+BHlTsvSvk&UTO9^bCf;yUE z{S{2siiPQ?ejYKS8lX>Hdy1YYu1I7nVj|eP(&bJ~gs;@DQN+80g6ayhIK_`oNdM8kyy5VQTlfKYWp_noGmD6++eoto`>ejy>9xuxYInI^&NUtPD z8u7fN>gb&D-1ug-K7VStlb{xIjnAO1!B8Xoh)lLY5u2$P+VV4)-jjhf$siSS7d=p^ zYpZ_wd&x!A*|op(eIbkzoVi+gB)fdIsZ6FQcN^u#X%BDSt%|!FWlWQS2uW@DGk_Dj*0WF$oR`1%Z zvtD+3h7P3W7+v{l>fU{~zBSoIXXZB?^}=cr3e_-Ri@Vru)0|c!X66S@tmgvuDTys6 zqS6bL;giOi`0}h<#cx zaf1F7lAu<`^WyEkL;5!way%2xcWu(NeKwV^5Mm374X7=Z<$78<#XJD*#Aw{rj3r-Q#TmIWXCw-D1;5`EOsPq`B^RDby=2 zTn8N2p@es<0%0&}M;yW>?-PEdrnO}@2nBUAWAB@)24FOQ3Yi~;Gc%ou7t6gS(4fVf z1=6Y|R@&{$mHK4{7Ne-goV?jntoMpxNO>jn=;Abjm_YVPurLD|Ae7>vVf!F#5W~o>=9KzW}mR zf+#f)VU)A3Gjm(yvD-kRUW!w|4B*ADnOx){F0>_v+1MqUeWZnWYTy4Q-1)h=lu{(G zA78eejyF{fILp{Z--CwS|0jcLEtAd^D~1otM0pZ&ng`_Xt$)8)c5xlhOHGau)wYh* zj*UOG&nzqIklNOFUC1lf-H+RbjcPzc8Ql7x0Ope~PBx!5I6nRb1E?nn8=8=Kk+GLB z7xs(slz{H?_J+N-glxEjxtSE z#p&i2)Tj07rKs?J)XVKz-d}KGh~hF_o4!PeLmfkTU5tPSb{IGODhG{5U1(})iI58z zSs^DgMk}Uo&vwh1bR^9IU=kq!;KhOP?b{frqzkGvs`t9~tmV9E@bg!)vKZ;@%FbqJ ztq#sezG7c^Fqo_jn#8^p{h+_BSY~)vXDL{%d1FIO+f!y}w*7K`)rmT$*NFO!IWcVj zr#sk3de{i+3=($P%`YaQk}f^>{>h5kYV5Bv++GEC~>q2Y@!c9KH!1lVz+*<`Nl&<2dD z^N~VAObjO&f-M&^w{0~a%#f&V_4Vl>(V2y-uIo?d#_H=g&YHc3j5v}RbOj*_y2vQ~ z!slSScI*o1U~iJX0p`e&Y*SC(Tyw@qzC+`;HAm^9oy$(kBRWhk#!=m-Ufe`1WTeQz zpkF|fEX296#s{490x$_+t3tavx=8 zBuwwgnwTlZaj4N7%w6tOSJAQ#uUYLl`7737y!5TflK(m8%PaNA(#IXbnt$jqUj-U) z*p9&$kS^-U(O{lo?7H>=0&S%!jgfI^5CN?{|DBX3BOEVY(W@@OFE99*hp3cq6_{+b znSgmYM#gdq*LPGq8G6p6I$FbZUmp8}G#K`(HS1IH^!M`MIxqKrXV=|BH3h5RA3Y$d zZ$dPl7L~Ld0XB>TnOyTRH`%6!`d&;$wlEBsn*(26-|55CRDdTuE&l4syIm+uAy&Og z9e4GK|7`yI^O&!f$0vDKos4!%_1#A29_82x*RQvjH@7&|b*nmieW=+9-7Ma}laebI zB08X#0-3C29M{zodTEh|cjR$hZBJ?^yQ((eaQ_VR2r?7{%zN0*#GI`viEyCYaJ zn2y6Okp(pL=@HLuoIQ9~bZR9U1P8EJ5EQD(5RzW%1C=MOENDv!5obfp8b z-mkZj-r~BgvVth#omwv`!bicJ1kS19tg(y3;+xc(_T)uY)AN)Zq5iwn%e&c5c04w7A1` z6O7KNnGf-T1sq53*;J3B)$BMM2+2*YManLsK0gU=#kSmIoZikc!lm1y$0 z#Rs%9UNtpP*c1^HGyNbI?@NGYC4>H|aDZ|Hj5(X*Z-QxlHsAN5nKtRJ6!<1vLDy&) zi^yZDonT5(Gz23q$z600O5o^xtB?2bp&3l6s0V?W)s+-+#;x=BRrhycu#+ zfG00XJH{%4RHEHl*v8_D)X(|f76s89Dlw%Gf;(YVGmyI02pGg0*fDxo`ir2oHl0)| zj9|Esgg7W2CU`?7d3*!;H_^VuUnO9!F8@iS5xkj3i1PHh-$^FQouk3Tan57qUL+^> zV{SPw^?B_I>EE;c*^}i(MRQ5)p>K|ix1gidR{EV{ileXW5C-yoLB~?(60yU(fMnl= zuA32OxqWtk3AtQR6jB~mR(W7xMY_NFn@i$|R7AgLu#gdA+uBs)Ax2!gpQ?*rxhD3m zz)oVAzM>ZAI*4UkpD*T5v9^C_qHW+5Ex9`x`FVq!8BN4~7pQx16At9x|JNIZVB61) zU>Ew04o`)>l)aDXkXVs)h1QecY>DS>WV`L>3a*$xahNJ@na|Fxi@vAl(snnlN_=2U zW{8hhbj7K!u1o=tnMj%A-Og*?(xz9+O}_6Fv8-yKY7-R;(3(lag|r_9Md^WTWVnJy zy0P>h0IqY}HOkgS#(G4I_S)0i6q;@gX-QrttqiA#(jsUbEovA>Tx>E-*#G!j=m;e3eooWCz97d0I7`nHn?V2 zBNhV5$(j?ox@-_gw%=pFOeVFjX5*V(K{?KR)5WXwY>JPelMug)(Y9;6jG$Qk)ng#1 zmrvbjx2eMYdd_Y68@F3FrT27c>x6o>S&>0wc5)fQ+TO|*D%taQrsg#Pq-@w5UWLZo zZyS?XD(#hrYh#RjFk(9vvt}nHPb~&6WhpTDdr=VE_&prg8{3PK+!}hKAjpu^qnM(L z=g$;r{JT}GuRmHHKd*nmdr8o=b8``G}G5|txSz&EKcn6`XyknAD* z$z{y$f7=gi>WRCN7YPVhuuAeb?q7`JXYifzsnt23Lb&xa-0&qEVs6^CQ+TOUrEtHM z=3Q$lUs2`%)hlr_;#=eAk(mFOsv$DKT;;X%jkyKqGIrP;y2FIRkeO+ZH-)nm+lnsgwQBEF zruD_nd_nWbz?L6s&GX?e?X~5Wq@%cOJ`Hik>$v9cJ^!$lBfZJ(3hkeIdx6_zvIw$) z4-cW@)hg8sC0RP1m6M|au;@P32XZ2i6j{E=?Hl$qRW8{{rx%ksqzL6$00@5b_HFRX z+P#g9$&YWRY0K7f?Uh`kCnsYo=cNJg8r`u?oax*(zXOA7qXL-RZeOlHu-CrY1Bguq zzwK-nYj=q^_c9@LyRrcdoAVgC)WiRP4eVTjFj-aU*}IKk!wAZ<iOAv@*UNKh~$~eYk42?VnwyABVDvsRDs!EwlnYk}3Q=)npigIdMpud(J0YN5XxR&N!+3>>DGQw>bq5g?}^j{WT@d zMgANSMxF)6*TbyBpp3)6rlu{VvB^*Re!gun9GU-QS5sn=Q_~-HF#oH;koxe?e6+S< zIDn5YaKeYIKC&1>(1+YG6pB2la$9r2J9g7rM)?J#tG<=Q{1gPngD?P#=>axxMN2aG z6rW!4*Bn3Rz2gi06Ju9W^fU6&3neyHtPfIJ+w&Y>R(fXtP&gzY zI{G4W(4ZGInEZVf85twT63sWF=-wQSSnv;AdueO`YfS|L%PaU(@6=FIrzHdhOWLoe9<0_>MowgRrG$>5u|S8T42gnLR>=fUh|Zr4e9~dsR1p0P zF4Ax@h0+_j@}GnJ>)fM6v(v(mA|7>A5FmPZc@=C-^DF8Et`aYO!hD$lmLKmF-xbbH zeVz^JNZ45(TIsA0t}<;<5vXPV7I4mmo@a?1kW;4sNI;lSs{;slz0r!r-WPxEosZHa}eU-$Y{C-%uQXLy7^t{a4%D}Ui zYV6}sZojgfS6H+jyG_9;H@(YliReqF^mO__1JBKVI|X@R3|K!eRL4Q^7|&>eX0~d$ z*Wum|y<|5OIrwHxH+N~L!S|R1qwaN zgvMzKCX!h;E4Kr34i9j$|LAE>&@SPswe1}of`_})AWu&5931hCPC`vGqUwfUrm6f; zP9m5vT}u3XeVjj*wye8lN-;N)V$A%*C;NJr8;_p9J9yH5R;R9eQQRal4F)TFxI(|G z8j@j#)ER}DnHkyPvn(c0`89RprZCoPV3by_XL0=};reEh@T*nV(U5~sgiJo(JQdi# zuxIFmn#2kfy*;9X=$VYFBeH|@>`7XJ8_ho4P;!01x8~`6xEv$BHCYRpoko!gdwZvm zNP<}m3UiSS>97PWC8W)RQuwa5w|bQ0-$quHdQD|CTfR<-g5!+rn{qT_POm=s`C^#6 zmen}D;Rm%5gGA#1d#N4U$>z*sy9c>yH6z_Rr@DvVjTuyD&Xwi%U&VP{d9iBjI*vWX zz(_vjZ222}H$2iYW8=Z;j*n_HZCmb~Ho0Mb1I>`tzkYQ9l+|r#=g*;R^5qNNnTjg9 zy1I_2IM=6`>yER=l7qKIy_HNfXmOvCW9jvtHzw@Vl{@DgWX?@#&;2UN8S&U?M*xs| z|1={In6&r?$U;m(6+!#x1icLgKO=Iu8%&`N3e`40ckL4lUwzUUN+X(eLm$0&=C!oS z%^NIjXyA7W%Smx-F?;jecdvP3+f#60+RVwyQgmj$g)UQCH}_Nd_4;z_oC0l+P4VMa zfqMNEkM-t(uj8I@OGw(|s&8%Erth#_@!WHq>(7mqN$$1y*DKw^AS8#NcnZ1F!fsuA z^cADnspKDoo%7RgXnruRmw#k*&Et-D=Tk?A-0i_73YpZke&bGXdvvNCxf5}&pY0uy z#4-`IASsz-dna!Hpp=VSnB``2OE|?*g9xR8-bB2eSJKsZyAu({Pp;8nRL9-N_EXmE zWY_|-n!XawRHuAkGQ}TN;ffze*2~bOc)s5dgPhKt;V0JZL`7K&KA3e6(->JO!{tN%s;Ao5GR{O)b^Ya@}sO-A)CtwOH7oGag1%vWHaiR6!+h&*yC>$RnaijQDlx7>< zJ&8N;3RvCC$G%gL+6{K{yPK)dy!z)Gr65fvOPDbh8I}c;2rp;eJ(YtGm#A|MznfSa zumLAZs@QIuHPbmeS}}-*eE8Qc^aEb8QvPQ{D6v4qAnw>S=Di?EEHs`xt9~@m71YyhX;#Q^fiBFwq%>(MLVGFznJqh~J`7X6Fyp~j?eLMAZD;`h2B=YOCsGjst zp`P<%r&W1=BFUa_7cwNE5=!)Oj&gd))<+XibLp?q3J;iiZ_*koS3o54t+p=2q#U3x zZUF(8z8D1)G~`u7r4%6%Yg*#pr_f-JRb=+OkCfw0T=I5W7}T{YvEE1Ne0~%PdLB4< zshQ8vT#>b|oVrjs5h77D8zK$90!k5$MEBsY0yJyamjags{3-f_W=?`|hBFJ?_e7=T z(Me#jVS(5Y0X%Ft(~igIWojS*XTJjJqHe*TYAsaM9ns>NGIfGCx7l~nxaSTRh8I+; z?CxtH)AyBlK;&$wxP)Ysh+c5q(beUF8i0)7Up@JHGo+-yHB>JjT@m%)k~j;C!r!=*^Li_ zJnVZI8LqSVf=z^3ZFDREa-?sVTohl2fWzxJ@cTu!+olUtA^co28_)A$`jK&b#bxPt z|8U40DHcOKTVe@7mwJ~O*SW~>a8@Yd3DtN0^^D8ANrDJc$P^gIR4UJbL3~98yC2;i zYp2-68RP`sl+obaDIy?VZM@*o|I+7Z{Nu5#W`sZ(;AVS&o3bVg2+8A4>)U=IT!+H% zI8n#$o1#Llt6xq{EtYgTcb`^64)zKLZ^ni*y=4?Nd3u)cWG!0tbqqXm>A>)d&rq~k zWQyI?P+lj*@1DnHJpv7*Pp*DsPlm<%jNXlSZ!`)MEyUNMTv#2lHKt^&50Fb9Bc$b1 z;EiW=?#-`RBNu)!24w`VrBD3Ni+5W>k%=c$+~ZiEQ97xoO=O7THNcXSqVtG6ATJXQ zouT>B8o2ty9|B%?Q(UKMy~HO|A`pa}4GYbO&F$?|TBf0rwTu3y-nD&aw189li*7-d zd~W>*eV7FftT`OdJWg8ar9nh+&8#bJ=+Dxk@z7_gR8FIY(E7}=gK5zzXi8T(nhXRj zN@hmUm6{0SwAf{2WIi`jUD_gcoa^CmUbX@Dsio5)fgT_hTghS!CuXfA+(a0E7@}&U zO#zQ7l7ATam;^0CGFw@#62oW5n2-|h38Ow*G`#mT2R*w{Xd;&JS3W6YdJiAcxUbE| zQD+=&UIogWp^2wQ!Lpqqa2|(iuE+fN{OH?BAfYPe58!reqpenjHf14 z_8w+LpKzdl5U6*e^sFm6xQhfY!G&!zd^l@={PfsoUzw{SMVB zWuj&mPuDcSeDl_!ytX{Gr!Wv<9Y*0a0j{Z+`xVdwA0Jb+n`*cru3xbh|4wFQ_AT36 zNw&`!nZREC)2pNCBF)R&2_W!2v%V6mpvR`be0@nK2yf&_lVEdR7~tRPdHT>rwNGY~ zPy0~!xUXcR!i|BND;g$_U48sr={N@Ik}Ap!!mlt9f*jfMrV(30)5xsOq+7zPI=s8u zi_m(ZH7iR?M~U-G{M0m1L>5FR+_HX&Sb!Xi=j%IX|IolThaP4N`Ds2;_D5Ikm(~f< z4rJ|qkL7G^q@0}argI)M-^AnbS~3&9#zc~b_+I<|2iiYUepF2-SWM2y9J^jYb16ec ztO}vue0y!$C5_OlvusQ_$S&cUcoRQd~=q&c_O&7_&87wyu zyNc|w;!l6W<{ndhWYblRfy>B*^nI{T0NT=Hiq(Xu3bL+WE^=CsKob2m<9f=cHCoZ% z@bKM+-X@_0=zsIA&{?vF9+3N?h0wauX?(){wiw(v7_E1yf1n zE|q{dJ4onWr|zm%ah%}wy#MxPgB_Un35tWc+iAcG6Cx8Z@%{uI>-ZhG5GzAF5^}S{ zvvZ-6SvlC)P5;TJ^VobGm>9B|mUM8vKPU%cBB1YjXi1srx~o7?BsPXANB zx!`cX|DKiu9_~`!=THZJUfxKUH2+TtMwh-1rlRuH7%Lcne~Tsfhl}U>Prm#TxsHhqWep!37rtK%wmNzm>3gQ09wCfH&H;82$VvzT|_eTm@Z}6dwB?dWE@6I{YBc~7!t^ae~wjZb9bLKmlqtBoO%ko$8Ek_4F z60{d&p!Ydc>XGBK4U0LN*fY_HX1wkg29?kcAW5;gmgwETnW@l|qAP{vTgQV4Nau`T|yY3*VBOIbykUmLssN5bbcn zlF(aaNia#iC=6njk?uLEItm*zG!k^d9}PX-VSoQV{-$+bG0h70@U!R6c{r$rO7Mm3 zej-J_6DQAvK^4WTC)e68ro-bAPlZeyR|(=_LX*5`BdmTj+)6tFfsu)JAhWhuZx^L7 z+nW=r8h`B-V`^sUEK^4`W=Kx8%G>~EZ;8ZUw6(R%4PR@JU4i;Tk%kN&Sc$NwaBFq} z*+Boni4dXPB}l*pn*6vA-a9(!_EKQzyXFEz;(@1eFMaf2L&{&4BC3%B_Bu&y;Yw&9 zKoJkuhan4hMI*9umk%C7@Cr_pTFeb^#z&lAP+)U}8e=s^G%}Hb6KprjYj_c*@8_Dk z+lLif>6$=Mj@{rL zBLe1Z4fNs(9)q7;Y2|V&BbAzfi~Y5b<;SSQdPt*u1rR5p6%;(b5sS(ZT|st)I^ zkIC1#^9@wZe9J3#YaESA;1{(@Dk@-B%i#($@^; z8lq8o`S$HwUm04HFf#bq?}{K1V!dC(%W(yT&pvJNK|z5speNyR0+FgUuquDsX^Tja zDRRoz*4FgGJ49G-P)Hl1C=f6r#PhQq;E4~1qR;z3Ll_g=$Y>Z0RTEJkVu+2_gg}rhDIi-GdAfXtM&D5=8>6 zF;X>RQAH5sPSf13OS<% z@P4%xk!?*#i6SMZ>Udn{)5|w8jhv{E@r+Z?TM#dh{b2!-CYjh>AIy$CX`KQH%Oa$> zKf8NIkQ)FqDjYh)>&}aDL4RlkzanpFc)+421)Pg#8N|r4!d~~A!s4f5=MbQF718H% zZDfwZAiPQ{DyP4w#@!@?jqbqz#~Cb&@SsmJbShq(n9OG?t5kT;f_78Soz?NkoKV%zi{W~k(PqO zNo`NLx}P_anTT!gXoplJ5(`0`1Ll>3i!0~Xz6Yfte04RSAG&R^tFZ9_Hfnl_-Gz_7 zJ?(pcm%*lwj%X_#MU0#B}%2j?UQbMRj z6@qA3_i6+Pu`FPmPd$nb>@Grd`>aZ+MuwjXJcIs1vn6Px5!k*zdShUBeo~A9$`fE? z-*%}FK1??>mhhO25U+MmZr+>p)=k}eP5Sxa`xz&%r z!6I2Fr?RJ}rYeSpDHGCWW}zU*QWiJZk%-A1ezrtRII+Ph=YLyQH(}PQ^E~Dy59qhP zXg2FcG>BIbEX>#}9se`Qq1V za*8ffzs+6a+Kc)iF6r^7+&@B~VknaVC)Nyk6VqByMSO0#C3P=;ii#~LWc{b4|5kh0 z=~?w|H{pk&cYp=_%&w)cj1-c9Vub;<*jdDfs~>RlDqwn+rR~8@ra<$B=<6G(~sz{}f+lx%^N3{xsE&Pci8137AeEMR0h>7koKi7ZI(%Udjd#zaxk z(XS232L=IHeo5{an8}V5>RkgAm?#+pXFax5GeyU$CB?mG#}Q`R&Va@5AYFo()e5H-K*jieF->SF zCW-dMGt(sCna0z;Dg{}!H(g^UFY>Hi@mlE#9n`P4?E zJ3Tb>l39-esBI+N2bR;RPb#?8vgyCPc6LvRz7Js@v z8vI`$5AlNcxAL2e_J9BGznk>m7ys{N`9Fo|zoljM7*#JT;A@rQQAq&*Dcw?+&%bH> G@_zuE!DOZY literal 0 HcmV?d00001 diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 90baa1fbcdaa..f9f77ca10d2d 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -10,6 +10,7 @@ Enable $(NoWarn);8002 + Resources/icon.png Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings. From cb7dd093bddab26f7df42802af1125762ce859ee Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 23 Feb 2021 12:55:18 -0800 Subject: [PATCH 1347/2702] Run CI on release branches --- azure-pipelines-integration.yml | 2 ++ azure-pipelines.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index ef5da3257217..e6edf809a9f8 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -2,11 +2,13 @@ trigger: - master - feature/* +- release/* # Branches that trigger builds on PR pr: - master - feature/* +- release/* jobs: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ad8392731e17..1a6cc6d89afe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,11 +2,13 @@ trigger: - master - feature/* +- release/* # Branches that trigger builds on PR pr: - master - feature/* +- release/* jobs: From ba2f7abd04ee54d5ecc97de20e20da5926aee47a Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 23 Feb 2021 14:20:21 -0800 Subject: [PATCH 1348/2702] =?UTF-8?q?delete=20the=20old=20icong=20(?= =?UTF-8?q?=E2=8A=99=5F=E2=8A=99;)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packageicon.png | Bin 7006 -> 0 bytes src/dotnet-format.csproj | 1 - 2 files changed, 1 deletion(-) delete mode 100644 packageicon.png diff --git a/packageicon.png b/packageicon.png deleted file mode 100644 index a0f1fdbf4d5eae0e561018cccee74f6a454cdb9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7006 zcmeHMXH-+`n%)#eMU;C)kZw7O2nvFLpcE@A^-u+AN(mh$UH*JD5Jjm{4}uUR zs5C(zdURn*zrcHqdVxK)P)7322TAMVbNR4HRzo3_~zdgjvf?Ot98@H{LHdy zK*)TM=g&B9f}+9IKfm=aF5e3_{PQJ$ zY4?9DHvtd+Y14o8TQs=)&+P)Wjb3|LIT@*NDqyYm#gu^q*EFSow<%yKVx`_Ka)!0 z2YAaQr%LYyQ%n$Rjx)e%JeM5_ov70FUMveJTS(J+%C4(L)~h*MQ8!wJtf_X{`Ol?k z;{27%#**2uiR&R6-eaRK1Mdgl2xHQ=uS(~VqsTVrsUnQhc zRIK5>@(05w3gHYdsI0;;sOO66pUEl)DGyD(D4>$7drUDFZ|uxx;-nWj7d|rj=u+D@ z-HU+mLOInrsXdSL1Z6nVB&D z@>f4!yq=_B+16+qw5k=4o#*tf;6Oe*F;`&L!)bT{U7Wc3YmG2;NRxb%woCt~*Yr2E zfwiUdS=7SK&5>df-aqY8lp~SEUG*ziXGvHMLp_#vgvVMQ*&{+d@(a>v4;7p_%Jte0Ga5zNbUI28WAgY5f?FX^;q`1WTw2~t|P54N&e^@=nFqDj}W#o z_-kZBWDQ%($YJH43Y7YrbjfsUrAEjla>?j0;YLdXxjK}P@xDGc%r&c)6`t?XW=*{r z%Z^p)?6*7obKU_;NZK_ejh9n&?qzO0#(}Uo+KSm|e}q1+f$wM!G8>lLvKK1UK^uz5 zDk&5(DuUnzQy{aQ8%b~*_4Ri`TOj}Dd{0OCls}^VD8=qDC%Q9tSSt5LZoxd!|ai3oGtf&cOy(`^W9zMNR;bII|OS+Pe(-9=f!m6}w zV>f(mH^BYE-=Wl=)Q2s2TF*j&tRkN0KOu3-(VN?4?-v|?W^Xj)@u4^bNB%bN+f|D= z?r1ey$UbahYv!qISaxV8>+1Mnz!M&S1o+~titx|65MA`iQMjscL!+LOGjZ?p>}x6d z4`FiZV9i-E6F8c|Fq37-TTTtJOdIZ9<*YrJU86UuQr6dipNC%AxT?lXa9U=`iq+2= zOT!CFUlJM1&INj~InR!=@x@{Z8BnvgL~_>nN)y@!r<0$uGCJ<0B-q!vZn@~#5^Ig8B}}g&dYBee=x50Wv$R^^f%aTE~g_a7&8Y(5L>! zkYgCl@1ZVqFSwkH(ns-EtYbOFLrarf#r6W9#x8rO<<_6h33faYV{<&_gBahO#ga9j z$|}=ea)vEm|Hb`E%L9Gn#Osxg( z&sxXz7lsse+_i@<_LUl@8$916h*m6!R?~zr_ZQU^H3F(aC1is#I$VP$GO(s!pT&Y# z85JYcwQqu6Ja6sje&x*)nOdx;bt1hNMTSwSikFeKE)+MRrW?mg=8mp^AR_kz{C%e* z32H_>c600^d$9)ob+$yzpyxHa+k0Sz7GG41I0A59bKJf?X}E6mX$pU~Wc%_?$2w1s zZEbk$svZ4U+WH;XPEb^-IqhGQX1U|z8KWp8&jVlWFPP+7Um6;oMy?>TFU`cMT5bYx z;7_~MfZ(sumPQHg++U)9PT=+=zxu+qmP==xJ&oI%XgD8=YZo%*rGq2U_J^D4d%7H`}jau-;<_^n?THcf9*rKD^J#%p%l zA8DILPr+wPY^MpxQbxGXG2f0xcjxSw;wjl53EsXe0poYHgfc(T;v5J;H$neUhElxe zrX0NdQ4e#4L4e-JmsN$%C+#BKX8TYA1YlhN`|QyqnlH{Igil*i0?NrD9qi2Fw_&~eMSk3UGyWzcay4oPaWE~nJ{R}-u+%oE z^4pk7G%~M66x6$a(@21!KD)Us1JG?!Xn4Zb;NYOn2SGc%JK!@mQv*PGMGxMb{#a4F z_#t!~GhhJR9)$w;fi20azFx86@7j4yB zpC7-bK<170rK@aOPg zDv69Iy;oMY0yq-ORy`~=Y8>ZQ_}+6m=ElBFD(BO@q9)h-K%)s9-^rh(;7T`vu={0p zCzf*G!~Iex?wWwWS?rOOYx{i!_Lh~OXJ7gYPR(bWfke`)l(GCjjtT06t7+0hHGHhh zA9y}JSM5#_xw|dqtlV?PVqZwGRm*pM)dvDj|LAzkF?4x}RLkCA#>G3V21ZLIt^gG< zQI&0O8}Rf;Def0;ZbweV+|x(R-?(Vnj5F9~eOT)4!nDr7Yq-5!y1bz1t;HjQSLn-A zt1qf%FzvKZ`+#!ufUYj;;FE!eL$>Pcse)qp0BW@>*U{2zo_CWHpgvHpnGofD&KYKY z+!}avbdRD^hZQf zU#$@f{W=^JvL7g)bcEZ<)O9tw4?Dxp&lksZ;$I_{?{l;o=>&}=tF-5MU&27^*rhJT zcd0DiLPxBSPJ<5cx}JGQAds^*(&j4-nHoTwx>dVUGJHkMM7w*nPbN5n_W)JJ zoSF~F)URWm1xS-QkhpAB(#}xq`0?;AQ=#^xj8iv{-*?l`8a;)kpuatAQXeVT+=;#A zT0rvGu`_`{>KMvxzgLkb$EeCy`RyvAx+nC!D381cssru;3nBjt{S>AGvQAs(kxLO{ zIp*xXImIAQJ>kiL&b~R(P_(nAu2z<~Dc*-_c3=C`sjCz@AZVOwgE5s@G#uy{iQNJ} z*pY1bjnx4K{yik#93ftw2}MI#Dt>w>)q5vp~-G zX7!=BUrYpB-3#04(mvmC$-Y!WY8${8gcraWB}q}i z(|PAS*SoXp)9`8tTYTuy7`=#uWFoR#J2(AVcxr-9uF+7kB$GxNkA$Vfoz}l40*Ydo zXReR;i`X4$Te~{&2?RE~^39WlS?>E>my@CS3|paiTe-zGjS$iwI*YbAHOwW*PD@wI z=Nl-L-*Y(4b+hX{-tb98arKb!Q^EK+RA0Lfp4`cv&x7o<`~ghNZ#@Z$`B6O*2R6%R z+kg>9tGG(TtYgVXWD_X)ySeq_3Tq2*GEPMlF@o;BBxfbxC%!xOuwUa+?wXac%Dce> z+d&$P_VsrSw*$bMY#z8~U%K$AIc8vOosw2D4`XdBe5NKVuc+s10x-cw)v;&2Yd`@# z6UL-Y1G;FY$G$?{@cwL6zaRL5p_lTzugeI5PB@eSk^x^LJ=N!qHsScr*=1fnx>1;L zY5eqB8dlecz6GSs<7{=#sl?FWEY66Ejk>f}1odw~P?}i0yH&4d%vKKZ@hTi7-IW8%;{(vI`&L;i z@`wN4O!SHFV&u%JzXt*g%E%4J$^z@6FOtA7Yc(*Rz2%_90Exxp+}r^Vb|pF?C;F8w zu&f+_Jsvg^Wp?I6!+uV$Bi#fzohClm^T{PdQzz%Nn}GENT0zaz{xqo+NWJ!QdLYKf zBHdX|LMnBh5jXZ;>OoAWv*rOX&O8Sbzjyl*y-%<2V2oE_*lEG(1GlpzBZ6aoOp%y8 ze&=uJp63A7*h}C9j-sY70bc4bHQr`@q#!@&!5LxUu`)c;-&WVK?$9+vP%D`7v^_`5 zrOcY7w(+sWUl!hkCI>q|qg_*OZ$os^0Fsg`di5ki_Tzr$8gh}#WNKHtX|hlAupfW6 zk_ZWVB&Hjb9ZbLk!Ie1lMyGd?qhgq8>{#iC>Kg^*taLx^YuW+VQG;}IK{6+Y@0i7& z6iRAQBlI8*LwK}P>x0;cL*en^{8^OvUg%KTXIa~~>xA%u_2)y{h_+YQ?tpDgX9rIe zOo3t5%oVK)PzXFaqN#F2^qJbgB3HzT`{nJcFO`#ATLWNBXfYU5CYHs&PnH^f*Wl6k z?<0KM*e@M?auAvtBi}A#6V#ej{yvSOE8v?4^Jb8y4~i{ zSIC{Kc9#!&HhKqJI9L>s*NbwiwWXI+w-X6TM}&3$PlPOE+G8HP8Hi(#UMtyKy= zLo(ZOb7qTQ^r{NHBg^h=C`gbboZigk0*;z5+XW@P;EzUwQZv5|SZ6W0tBbATVDt$& z4th!!{t_tBc>V9qZE^8&@=VbaMh;!ivCF~IC28PzN2Z{@`)H;y3+{?j%eQl6gP|I9 z-agi;Y>P($m>0yG48Z>=AC0W_h5((46THSuk)X||?u=A_N-{J)`M9Q^WnUMh84VTQ zIvQlFtG4Z5X~3!o0K!K+^E@{TZ;5W3XkNzy z*j?DZB4J)s(LK@K0K1T4u&xvPHDTX zs$=NfQalJo9RXF+0@j1~t~aK@*DAWgsI@Sl{8AP8%T`P`Vu~Tv_%ZmbJz^#V>NJZl-TbST^RMK5DlNOs$kegkbICLYRJk-}g{l-Wn^Vya`SL3T1tiIw^Z zm~h)cx+UimpKrqQ=$a*_BCrvMGi%5Nr5qU)hq|P1Tjp!gLgpIqRRIs`qsDGjcel*OH-c~&6W812bsUI z>umkx8_8Ottu&n?L`^t@;63h8!Nb19V4*G1v2?3e;$WrvvX7%#JaxH?R) zN@KLmgq3q$NONDrj=7c`8~kK5VTf>xS$Q2C8@T{(7ygTX1N^6hZ&3*F7Z@!5FaMz+ n@b3Qu^xx$8Uk}h2jH{d|uJ4jrSC|P(2)ca1@;v^m$K8JeR7TPQ diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index f9f77ca10d2d..f6271e40783b 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -22,7 +22,6 @@ true true - packageicon.png From 9c8f8876c39090202704b7a1d988b9bdb08a3a48 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 24 Feb 2021 13:18:17 +0000 Subject: [PATCH 1350/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210224.12 (#1002) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 951f74a5551f..4735ef8306ae 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 9c6d28c22bc12863b20baf4103bec95a7f32f939 + 4affc3fa9e5777a0a865cc0750dd19de5a10385d diff --git a/eng/Versions.props b/eng/Versions.props index 55b0d609838c..62e7415812c7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-2.21123.18 + 3.10.0-2.21124.12 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From e3aa1d2b1501cc1be9c71d24477acfed6e282884 Mon Sep 17 00:00:00 2001 From: Warren Ferrell Date: Wed, 24 Feb 2021 12:08:58 -0700 Subject: [PATCH 1351/2702] Update integrations.md correct directory where pre-commit should be placed --- docs/integrations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations.md b/docs/integrations.md index db833b3f309f..d4acd469525f 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -3,7 +3,7 @@ Collection of advice how to auto check/format. Every sample expects dotnet forma ## Pre-commit hook to reformat -Create file `.git/pre-commit` with following contents: +Create file `.git/hooks/pre-commit` with following contents: ```sh #!/bin/sh LC_ALL=C From 15305ccf113fcf801d9b075e3e7e775cc60f2457 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 25 Feb 2021 18:31:26 -0800 Subject: [PATCH 1352/2702] Add option to filter diagnostics by id --- README.md | 6 ++- docs/README.md | 14 +++++ perf/FormattedFiles.cs | 4 ++ perf/NoFilesFormatted.cs | 4 ++ perf/RealWorldSolution.cs | 3 ++ src/Analyzers/AnalyzerFormatter.cs | 18 ++++++- src/FormatCommand.cs | 5 ++ src/FormatOptions.cs | 6 +++ src/Formatters/UnnecessaryImportsFormatter.cs | 7 +++ src/Program.cs | 3 ++ src/Resources.resx | 3 ++ src/xlf/Resources.cs.xlf | 5 ++ src/xlf/Resources.de.xlf | 5 ++ src/xlf/Resources.es.xlf | 5 ++ src/xlf/Resources.fr.xlf | 5 ++ src/xlf/Resources.it.xlf | 5 ++ src/xlf/Resources.ja.xlf | 5 ++ src/xlf/Resources.ko.xlf | 5 ++ src/xlf/Resources.pl.xlf | 5 ++ src/xlf/Resources.pt-BR.xlf | 5 ++ src/xlf/Resources.ru.xlf | 5 ++ src/xlf/Resources.tr.xlf | 5 ++ src/xlf/Resources.zh-Hans.xlf | 5 ++ src/xlf/Resources.zh-Hant.xlf | 5 ++ .../CodeStyleAnalyzerFormatterTests.cs | 44 +++++++++++++++ tests/Analyzers/FilterDiagnosticsTests.cs | 49 ++++++++++++++++- tests/CodeFormatterTests.cs | 5 +- tests/Formatters/AbstractFormatterTests.cs | 34 +++++++----- tests/Formatters/FormattedFilesTests.cs | 2 + .../UnnecessaryImportsFormatterTests.cs | 53 +++++++++++++++++++ tests/ProgramTests.cs | 5 ++ 31 files changed, 310 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index aeb6105df85d..b0c9893d219a 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ Options: --fix-whitespace, -w Run whitespace formatting. Run by default when not applying fixes. --fix-style, -s Run code style analyzers and apply fixes. --fix-analyzers, -a Run 3rd party analyzers and apply fixes. + --diagnostics A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party analyzers. --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. --exclude A list of relative file or folder paths to exclude from formatting. --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. @@ -117,6 +118,7 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | `dotnet format ` | Formats a specific project or solution. | | `dotnet format -f` | Formats a particular folder and subfolders. | | `dotnet format --fix-style warn` | Fixes only codestyle analyzer warnings. | +| `dotnet format --fix-style --diagnostics IDE0005` | Fixes only codestyle analyzer errors for the IDE0005 diagnostic. | | `dotnet format --fix-whitespace --fix-style` | Formats and fixes codestyle analyzer errors. | | `dotnet format --fix-analyzers` | Fixes only 3rd party analyzer errors. | | `dotnet format -wsa` | Formats, fixes codestyle errors, and fixes 3rd party analyzer errors. | @@ -143,8 +145,8 @@ You can build and package the tool using the following commands. The instruction ```console build -pack # The final line from the build will read something like -# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.6.0.0-dev.nupkg'. -# Use the value that is in the form `6.0.0-dev` as the version in the next command. +# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.5.1.0-dev.nupkg'. +# Use the value that is in the form `5.1.0-dev` as the version in the next command. dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version dotnet format ``` diff --git a/docs/README.md b/docs/README.md index 52a6d4026b55..362eb7498979 100644 --- a/docs/README.md +++ b/docs/README.md @@ -82,6 +82,20 @@ Running 3rd party analysis requires the use of a MSBuild solution or project fil - `--fix-analyzers ` - Runs analysis and attempts to fix issues with severity equal or greater than specified. If no severity is specified then this defaults to error. +#### Filter diagnostics to fix + +Typically when running codestyle or 3rd party analysis, all diagnostics of sufficient severity are reported and fixed. The `--diagnostics` option allows you to target a particular diagnostic or set of diagnostics of sufficient severity. + +- `--diagnostics ` - When used in conjunction with `--fix-style` or `--fix-analyzer`, allows you to apply targeted fixes for particular analyzers. + +*Example:* + +Run code-style analysis and fix unused using directive errors. + +```console +dotnet-format ./format.sln --fix-style --diagnostics IDE0005 +``` + ### Filter files to format You can further narrow the list of files to be formatted by specifying a list of paths to include or exclude. When specifying folder paths the path must end with a directory separator. File globbing is supported. diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index 16f74f506fdb..8252e700a082 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; using Microsoft.CodeAnalysis.Tools.Utilities; @@ -36,6 +37,7 @@ public void FilesFormattedFolder() fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, analyzerSeverity: DiagnosticSeverity.Error, + diagnostics: ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -55,6 +57,7 @@ public void FilesFormattedProject() fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, analyzerSeverity: DiagnosticSeverity.Error, + diagnostics: ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -74,6 +77,7 @@ public void FilesFormattedSolution() fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, analyzerSeverity: DiagnosticSeverity.Error, + diagnostics: ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index 7dfbfc2cd411..2d68b474e586 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; using Microsoft.CodeAnalysis.Tools.Utilities; @@ -36,6 +37,7 @@ public void NoFilesFormattedFolder() fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, analyzerSeverity: DiagnosticSeverity.Error, + diagnostics: ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -55,6 +57,7 @@ public void NoFilesFormattedProject() fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, analyzerSeverity: DiagnosticSeverity.Error, + diagnostics: ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -74,6 +77,7 @@ public void NoFilesFormattedSolution() fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, analyzerSeverity: DiagnosticSeverity.Error, + diagnostics: ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index 1427082ebf1b..e778cda2ecfa 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; using BenchmarkDotNet.Diagnosers; @@ -38,6 +39,7 @@ public void FilesFormattedSolution() fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, analyzerSeverity: DiagnosticSeverity.Error, + diagnostics: ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, @@ -57,6 +59,7 @@ public void FilesFormattedFolder() fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, analyzerSeverity: DiagnosticSeverity.Error, + diagnostics: ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, AllFileMatcher, diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 067864326fe4..8554c76862eb 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -72,6 +72,12 @@ public async Task FormatAsync( .SelectMany(codefix => codefix.FixableDiagnosticIds.Where(id => id.StartsWith("CS") || id.StartsWith("BC"))) .ToImmutableHashSet(); + // Filter compiler diagnostics + if (!fixableCompilerDiagnostics.IsEmpty && !formatOptions.Diagnostics.IsEmpty) + { + fixableCompilerDiagnostics.Intersect(formatOptions.Diagnostics); + } + var analysisStopwatch = Stopwatch.StartNew(); logger.LogTrace(Resources.Running_0_analysis, _name); @@ -83,7 +89,7 @@ public async Task FormatAsync( var severity = _informationProvider.GetSeverity(formatOptions); // Filter to analyzers that report diagnostics with equal or greater severity. - var projectAnalyzers = await FilterBySeverityAsync(solution, projectAnalyzersAndFixers, formattablePaths, severity, cancellationToken).ConfigureAwait(false); + var projectAnalyzers = await FilterAnalyzersAsync(solution, projectAnalyzersAndFixers, formattablePaths, severity, formatOptions.Diagnostics, cancellationToken).ConfigureAwait(false); // Determine which diagnostics are being reported for each project. var projectDiagnostics = await GetProjectDiagnosticsAsync(solution, projectAnalyzers, formattablePaths, formatOptions, severity, fixableCompilerDiagnostics, logger, formattedFiles, cancellationToken).ConfigureAwait(false); @@ -248,11 +254,12 @@ static ImmutableDictionary> CreateFixerM } } - internal static async Task>> FilterBySeverityAsync( + internal static async Task>> FilterAnalyzersAsync( Solution solution, ImmutableDictionary projectAnalyzersAndFixers, ImmutableHashSet formattablePaths, DiagnosticSeverity minimumSeverity, + ImmutableHashSet diagnostics, CancellationToken cancellationToken) { // We only want to run analyzers for each project that have the potential for reporting a diagnostic with @@ -273,6 +280,13 @@ internal static async Task DoesAnalyzerSupportLanguage(analyzer, project.Language)); foreach (var analyzer in filteredAnalyzer) { + // Filter by diagnostics + if (!diagnostics.IsEmpty && + !analyzer.SupportedDiagnostics.Any(descriptor => diagnostics.Contains(descriptor.Id))) + { + continue; + } + // Always run naming style analyzers because we cannot determine potential severity. // The reported diagnostics will be filtered by severity when they are run. if (analyzer.GetType().FullName?.EndsWith("NamingStyleDiagnosticAnalyzer") == true) diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 3c5ea14810ae..d37173252bb7 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -18,6 +18,7 @@ internal delegate Task Handler( bool fixWhitespace, string? fixStyle, string? fixAnalyzers, + string[] diagnostics, string? verbosity, bool check, string[] include, @@ -49,6 +50,10 @@ internal static RootCommand CreateCommandLineOptions() { Argument = new Argument("severity") { Arity = ArgumentArity.ZeroOrOne }.FromAmong(SeverityLevels) }, + new Option(new[] { "--diagnostics" }, Resources.A_space_separated_list_of_diagnostic_ids_to_use_as_a_filter_when_fixing_code_style_or_3rd_party_issues) + { + Argument = new Argument(() => Array.Empty()) + }, new Option(new[] { "--include" }, Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) { Argument = new Argument(() => Array.Empty()) diff --git a/src/FormatOptions.cs b/src/FormatOptions.cs index 55edf9fa10b7..20a82c8867d3 100644 --- a/src/FormatOptions.cs +++ b/src/FormatOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System.Collections.Immutable; using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; @@ -13,6 +14,7 @@ internal class FormatOptions public FixCategory FixCategory { get; } public DiagnosticSeverity CodeStyleSeverity { get; } public DiagnosticSeverity AnalyzerSeverity { get; } + public ImmutableHashSet Diagnostics { get; } public bool SaveFormattedFiles { get; } public bool ChangesAreErrors { get; } public SourceFileMatcher FileMatcher { get; } @@ -26,6 +28,7 @@ public FormatOptions( FixCategory fixCategory, DiagnosticSeverity codeStyleSeverity, DiagnosticSeverity analyzerSeverity, + ImmutableHashSet diagnostics, bool saveFormattedFiles, bool changesAreErrors, SourceFileMatcher fileMatcher, @@ -38,6 +41,7 @@ public FormatOptions( FixCategory = fixCategory; CodeStyleSeverity = codeStyleSeverity; AnalyzerSeverity = analyzerSeverity; + Diagnostics = diagnostics; SaveFormattedFiles = saveFormattedFiles; ChangesAreErrors = changesAreErrors; FileMatcher = fileMatcher; @@ -52,6 +56,7 @@ public void Deconstruct( out FixCategory fixCategory, out DiagnosticSeverity codeStyleSeverity, out DiagnosticSeverity analyzerSeverity, + out ImmutableHashSet diagnostics, out bool saveFormattedFiles, out bool changesAreErrors, out SourceFileMatcher fileMatcher, @@ -64,6 +69,7 @@ public void Deconstruct( fixCategory = FixCategory; codeStyleSeverity = CodeStyleSeverity; analyzerSeverity = AnalyzerSeverity; + diagnostics = Diagnostics; saveFormattedFiles = SaveFormattedFiles; changesAreErrors = ChangesAreErrors; fileMatcher = FileMatcher; diff --git a/src/Formatters/UnnecessaryImportsFormatter.cs b/src/Formatters/UnnecessaryImportsFormatter.cs index 533bbcdc8b1a..d9d895ef6c4d 100644 --- a/src/Formatters/UnnecessaryImportsFormatter.cs +++ b/src/Formatters/UnnecessaryImportsFormatter.cs @@ -41,6 +41,13 @@ internal override async Task FormatFileAsync( return sourceText; } + // If diagnostics are being filtered and IDE0005 isn't specified, then make no changes. + if (!formatOptions.Diagnostics.IsEmpty && + !formatOptions.Diagnostics.Contains(IDE0005)) + { + return sourceText; + } + var tree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); if (tree is null) { diff --git a/src/Program.cs b/src/Program.cs index 83ca628e2a99..c3bc353899e1 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.Parsing; @@ -47,6 +48,7 @@ public static async Task Run( bool fixWhitespace, string? fixStyle, string? fixAnalyzers, + string[] diagnostics, string? verbosity, bool check, string[] include, @@ -164,6 +166,7 @@ public static async Task Run( fixType, codeStyleSeverity: GetSeverity(fixStyle ?? FixSeverity.Error), analyzerSeverity: GetSeverity(fixAnalyzers ?? FixSeverity.Error), + diagnostics: diagnostics.ToImmutableHashSet(), saveFormattedFiles: !check, changesAreErrors: check, fileMatcher, diff --git a/src/Resources.resx b/src/Resources.resx index 7982a8dfc5f7..13a22a535271 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -297,4 +297,7 @@ The dotnet format version is '{0}'. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index a558bcbedf55..99b221a6652d 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -17,6 +17,11 @@ Cesta k souboru řešení, souboru projektu nebo složce obsahující soubor řešení nebo projektu. Pokud cesta není zadaná, použije se aktuální adresář. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. Přijímá cestu k souboru. Pokud se zadá, vytvoří se v daném adresáři sestava JSON. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index be1f8c18ac1a..249c273e3cc9 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -17,6 +17,11 @@ Ein Pfad zu einer Projektmappendatei, einer Projektdatei oder einem Ordner, die bzw. der eine Projektmappe oder Projektdatei enthält. Wenn kein Pfad angegeben wird, wird das aktuelle Verzeichnis verwendet. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. Akzeptiert einen Dateipfad, der bei Bereitstellung einen JSON-Bericht im angegebenen Verzeichnis erstellt. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 24738b533677..8c347e62b35d 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -17,6 +17,11 @@ Ruta de acceso a un archivo de solución, a un archivo del proyecto o a una carpeta que contiene archivo de proyecto o solución. Si no se especifica ninguna ruta de acceso, se usa el directorio actual. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. Acepta una ruta de acceso de archivo que, si se proporciona, generará un informe JSON en el directorio dado. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 9c41a66598fc..a82888360ff9 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -17,6 +17,11 @@ Chemin d'un fichier solution, d'un fichier projet ou d'un dossier contenant un fichier solution ou un fichier projet. Si aucun chemin n'est spécifié, le répertoire actif est utilisé. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accepte un chemin de fichier, qui, s'il est fourni, produit un rapport JSON dans le répertoire donné. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 4f8e29bcc282..e42bb11d58cc 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -17,6 +17,11 @@ Percorso di un file di soluzione, un file di progetto o una cartella contenente una soluzione o un file di progetto. Se non si specifica alcun percorso, viene usata la directory corrente. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. Accetta un percorso file che, se specificato, produrrà un report JSON nella directory specificata. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index 515540a891a4..fbc29791b3a6 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -17,6 +17,11 @@ ソリューション ファイル、プロジェクト ファイル、またはソリューション ファイルかプロジェクト ファイルを含むフォルダーへのパス。パスが指定されていない場合は、現在のディレクトリが使用されます。 + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. ファイル パスを受け入れると (指定されている場合)、指定されたディレクトリに JSON レポートが生成されます。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 6e6e344fbd4e..ed61b7cc3fe0 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -17,6 +17,11 @@ 솔루션 파일, 프로젝트 파일이나 솔루션 또는 프로젝트 파일이 포함된 폴더의 경로입니다. 경로를 지정하지 않으면 현재 디렉터리가 사용됩니다. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. 제공된 경우 지정된 디렉터리에 json 보고서를 생성할 파일 경로를 허용합니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 9be4b307d025..e075eca3976a 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -17,6 +17,11 @@ Ścieżka do pliku rozwiązania, pliku projektu albo folderu zawierającego plik rozwiązania lub plik projektu. Jeśli ścieżka nie zostanie określona, zostanie użyty bieżący katalog. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. Akceptuje ścieżkę pliku, która, jeśli zostanie podana, wygeneruje raport JSON w danym katalogu. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index c44fb3ec4fdf..fceabd1938f5 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -17,6 +17,11 @@ Um caminho para um arquivo de solução, um arquivo de projeto ou uma pasta contendo um arquivo de solução ou de projeto. Se não for especificado um caminho, o diretório atual será usado. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. Aceita um caminho de arquivo, que, se fornecido, produzirá um relatório JSON no diretório especificado. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index b783798e7084..6ef10772c479 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -17,6 +17,11 @@ Путь к файлу решения, файлу проекта или папке, содержащей файл решения или проекта. Если путь не указан, используется текущий каталог. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. Принимает путь к файлу. Если путь к файлу указан, создает отчет JSON в указанном каталоге. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index c7d3d5dcdfaf..80eab9359076 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -17,6 +17,11 @@ Çözüm dosyasının, proje dosyasının veya çözüm ya da proje dosyasını içeren klasörün yolu. Yol belirtilmezse geçerli dizin kullanılır. + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. Sağlanırsa, verilen dizinde json raporu oluşturacak bir dosya yolunu kabul eder. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index edb5ec33b463..a1ca40ca9ddc 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -17,6 +17,11 @@ 指向解决方案文件、项目文件或包含解决方案或项目文件的文件夹的路径。如果未指定路径,则使用当前目录。 + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. 接受文件路径(若提供)将在给定目录中生成 json 报表。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index fae3baef6815..55504ed49513 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -17,6 +17,11 @@ 解決方案檔、專案檔,或包含解決方案或專案檔之資料夾的路徑。若未指定路徑,就會使用目前的目錄。 + + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + Accepts a file path, which if provided, will produce a json report in the given directory. 接受檔案路徑 (如果有提供) 將在指定的目錄中產生 json 報告。 diff --git a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs index 01dd7b51f556..08ee41c7df43 100644 --- a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs +++ b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs @@ -74,5 +74,49 @@ public int M() await AssertNoReportedFileChangesAsync(testCode, "root = true", fixCategory: FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Warning); } + + [Fact] + public async Task TestUnusedImport_AppliesWhenIDE0005InDiagnosticsList() + { + var testCode = @" +using System.Buffers; +using System.Collections.Generic; + +class C +{ + void M() + { + object obj = new object(); + List list = new List(); + int count = 5; + } +}"; + + var expectedCode = @" +using System.Collections.Generic; + +class C +{ + void M() + { + object obj = new object(); + List list = new List(); + int count = 5; + } +}"; + + var editorConfig = new Dictionary() + { + /// IDE0005: Using directive is unnecessary + ["dotnet_diagnostic.IDE0005.severity"] = "error", + /// Prefer "var" everywhere + ["dotnet_diagnostic.IDE0007.severity"] = "error", + ["csharp_style_var_for_built_in_types"] = "true:error", + ["csharp_style_var_when_type_is_apparent"] = "true:error", + ["csharp_style_var_elsewhere"] = "true:error", + }; + + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.CodeStyle, diagnostics: new[] { "IDE0005" }); + } } } diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs index 00c5c8852416..02f1c7d5cd4d 100644 --- a/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -24,11 +24,13 @@ public async Task TestFilterWarning() var project = solution.Projects.First(); var formattablePaths = ImmutableHashSet.Create(project.Documents.First().FilePath); var minimumSeverity = DiagnosticSeverity.Warning; - var result = await AnalyzerFormatter.FilterBySeverityAsync( + var diagnostics = ImmutableHashSet.Empty; + var result = await AnalyzerFormatter.FilterAnalyzersAsync( solution, projectAnalyzersAndFixers, formattablePaths, minimumSeverity, + diagnostics, CancellationToken.None); var (_, analyzers) = Assert.Single(result); Assert.Single(analyzers); @@ -42,16 +44,59 @@ public async Task TestFilterError() var project = solution.Projects.First(); var formattablePaths = ImmutableHashSet.Create(project.Documents.First().FilePath); var minimumSeverity = DiagnosticSeverity.Error; - var result = await AnalyzerFormatter.FilterBySeverityAsync( + var diagnostics = ImmutableHashSet.Empty; + var result = await AnalyzerFormatter.FilterAnalyzersAsync( solution, projectAnalyzersAndFixers, formattablePaths, minimumSeverity, + diagnostics, CancellationToken.None); var (_, analyzers) = Assert.Single(result); Assert.Empty(analyzers); } + [Fact] + public async Task TestFilterDiagnostics_NotInDiagnosticsList() + { + var solution = await GetSolutionAsync(); + var projectAnalyzersAndFixers = await GetProjectAnalyzersAndFixersAsync(solution); + var project = solution.Projects.First(); + var formattablePaths = ImmutableHashSet.Create(project.Documents.First().FilePath); + var minimumSeverity = DiagnosticSeverity.Warning; + var diagnostics = ImmutableHashSet.Create("IDE0005"); + var result = await AnalyzerFormatter.FilterAnalyzersAsync( + solution, + projectAnalyzersAndFixers, + formattablePaths, + minimumSeverity, + diagnostics, + CancellationToken.None); + var (_, analyzers) = Assert.Single(result); + Assert.Empty(analyzers); + } + + [Fact] + public async Task TestFilterDiagnostics_InDiagnosticsList() + { + var solution = await GetSolutionAsync(); + var projectAnalyzersAndFixers = await GetProjectAnalyzersAndFixersAsync(solution); + var project = solution.Projects.First(); + var formattablePaths = ImmutableHashSet.Create(project.Documents.First().FilePath); + var minimumSeverity = DiagnosticSeverity.Warning; + var diagnostics = ImmutableHashSet.Create("DiagnosticAnalyzerId"); + var result = await AnalyzerFormatter.FilterAnalyzersAsync( + solution, + projectAnalyzersAndFixers, + formattablePaths, + minimumSeverity, + diagnostics, + CancellationToken.None); + var (_, analyzers) = Assert.Single(result); + Assert.Single(analyzers); + } + + private static async Task GetAnalyzersAndFixersAsync() { var assemblies = new[] diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 814f6cb274cb..3f627ed5ad7a 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -508,7 +509,8 @@ internal async Task TestFormatWorkspaceAsync( int expectedFileCount, FixCategory fixCategory = FixCategory.Whitespace, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error, + string[] diagnostics = null) { var currentDirectory = Environment.CurrentDirectory; Environment.CurrentDirectory = TestProjectsPathHelper.GetProjectsDirectory(); @@ -541,6 +543,7 @@ internal async Task TestFormatWorkspaceAsync( fixCategory, codeStyleSeverity, analyzerSeverity, + diagnostics?.ToImmutableHashSet() ?? default, saveFormattedFiles: false, changesAreErrors: false, fileMatcher, diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index d7447493482a..86ac28f2e946 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -93,9 +93,10 @@ private protected Task AssertNoReportedFileChangesAsync( FixCategory fixCategory = FixCategory.Whitespace, IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error, + string[]? diagnostics = null) { - return AssertNoReportedFileChangesAsync(code, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + return AssertNoReportedFileChangesAsync(code, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity, diagnostics); } private protected async Task AssertNoReportedFileChangesAsync( @@ -105,9 +106,10 @@ private protected async Task AssertNoReportedFileChangesAsync( FixCategory fixCategory = FixCategory.Whitespace, IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error, + string[]? diagnostics = null) { - var (formattedText, formattedFiles, logger) = await ApplyFormatterAsync(code, editorConfig, encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + var (formattedText, formattedFiles, logger) = await ApplyFormatterAsync(code, editorConfig, encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity, diagnostics); try { @@ -133,9 +135,10 @@ private protected Task AssertCodeUnchangedAsync( FixCategory fixCategory = FixCategory.Whitespace, IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error, + string[]? diagnostics = null) { - return AssertCodeUnchangedAsync(code, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + return AssertCodeUnchangedAsync(code, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity, diagnostics); } private protected async Task AssertCodeUnchangedAsync( @@ -145,9 +148,10 @@ private protected async Task AssertCodeUnchangedAsync( FixCategory fixCategory = FixCategory.Whitespace, IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error, + string[]? diagnostics = null) { - var (formattedText, _, logger) = await ApplyFormatterAsync(code, editorConfig, encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + var (formattedText, _, logger) = await ApplyFormatterAsync(code, editorConfig, encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity, diagnostics); try { @@ -171,9 +175,10 @@ private protected Task AssertCodeChangedAsync( FixCategory fixCategory = FixCategory.Whitespace, IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error, + string[]? diagnostics = null) { - return AssertCodeChangedAsync(testCode, expectedCode, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + return AssertCodeChangedAsync(testCode, expectedCode, ToEditorConfig(editorConfig), encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity, diagnostics); } private protected async Task AssertCodeChangedAsync( @@ -184,9 +189,10 @@ private protected async Task AssertCodeChangedAsync( FixCategory fixCategory = FixCategory.Whitespace, IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error, + string[]? diagnostics = null) { - var (formattedText, _, logger) = await ApplyFormatterAsync(testCode, editorConfig, encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity); + var (formattedText, _, logger) = await ApplyFormatterAsync(testCode, editorConfig, encoding, fixCategory, analyzerReferences, codeStyleSeverity, analyzerSeverity, diagnostics); try { @@ -208,7 +214,8 @@ private protected async Task AssertCodeChangedAsync( FixCategory fixCategory = FixCategory.Whitespace, IEnumerable? analyzerReferences = null, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, - DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error) + DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error, + string[]? diagnostics = null) { var text = SourceText.From(code, encoding ?? Encoding.UTF8); TestState.Sources.Add(text); @@ -225,6 +232,7 @@ private protected async Task AssertCodeChangedAsync( fixCategory, codeStyleSeverity, analyzerSeverity, + (diagnostics ?? Array.Empty()).ToImmutableHashSet(), saveFormattedFiles: true, changesAreErrors: false, fileMatcher, diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index ddf267a836a5..145a0735970d 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -67,6 +68,7 @@ private async Task> TestFormattedFiles(string testCode) fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, analyzerSeverity: DiagnosticSeverity.Error, + diagnostics: ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, fileMatcher, diff --git a/tests/Formatters/UnnecessaryImportsFormatterTests.cs b/tests/Formatters/UnnecessaryImportsFormatterTests.cs index 66b33e088ce7..39692c0fc91e 100644 --- a/tests/Formatters/UnnecessaryImportsFormatterTests.cs +++ b/tests/Formatters/UnnecessaryImportsFormatterTests.cs @@ -105,5 +105,58 @@ class C await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Warning); } + + [Theory] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, Severity.Warning)] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, Severity.Error)] + [InlineData(RemoveUnnecessaryImportCategoryKey, Severity.Warning)] + [InlineData(RemoveUnnecessaryImportCategoryKey, Severity.Error)] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, Severity.Warning)] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, Severity.Error)] + public async Task WhenIDE0005SeverityEqualOrGreaterThanFixSeverity_AndHasUnusedImports_AndIncludedInDiagnosticsList_ImportRemoved(string key, string severity) + { + var testCode = +@"using System; + +class C +{ +}"; + + var expectedCode = +@"class C +{ +}"; + + var editorConfig = new Dictionary() + { + [key] = severity + }; + + await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Warning, diagnostics: new[] { UnnecessaryImportsFormatter.IDE0005 }); + } + + [Theory] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, Severity.Warning)] + [InlineData(RemoveUnnecessaryImportDiagnosticKey, Severity.Error)] + [InlineData(RemoveUnnecessaryImportCategoryKey, Severity.Warning)] + [InlineData(RemoveUnnecessaryImportCategoryKey, Severity.Error)] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, Severity.Warning)] + [InlineData(AnalyzerOptionsExtensions.DotnetAnalyzerDiagnosticSeverityKey, Severity.Error)] + public async Task WhenIDE0005SeverityEqualOrGreaterThanFixSeverity_AndHasUnusedImports_AndNotIncludedInDiagnosticsList_ImportNotRemoved(string key, string severity) + { + var testCode = +@"using System; + +class C +{ +}"; + + var editorConfig = new Dictionary() + { + [key] = severity + }; + + await AssertCodeUnchangedAsync(testCode, editorConfig, fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Warning, diagnostics: new[] { "IDE0073" }); + } } } diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 4e2b00b96348..cdd40cb2bf78 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -184,6 +184,7 @@ Task TestRun( bool fixWhitespace, string fixStyle, string fixAnalyzers, + string[] diagnostics, string verbosity, bool check, string[] include, @@ -197,6 +198,7 @@ Task TestRun( Assert.True(fixWhitespace); Assert.Equal("warn", fixStyle); Assert.Equal("info", fixAnalyzers); + Assert.Equal(new[] { "IDE0005", "IDE0073" }, diagnostics); Assert.Equal("diag", verbosity); Assert.True(check); Assert.Equal(new[] { "*.cs" }, include); @@ -214,6 +216,9 @@ Task TestRun( warn --fix-analyzers info +--diagnostics +IDE0005 +IDE0073 --verbosity diag --check From dd81e20638b46d3701ba4b7d1eb523dec4c58c37 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 26 Feb 2021 13:19:07 +0000 Subject: [PATCH 1353/2702] Update dependencies from https://github.com/dotnet/arcade build 20210225.5 (#1008) [master] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 +- eng/common/cross/build-rootfs.sh | 36 +++++++--- eng/common/performance/performance-setup.ps1 | 8 --- eng/common/performance/performance-setup.sh | 23 ++++--- eng/common/sdl/execute-all-sdl-tools.ps1 | 4 -- eng/common/sdl/init-sdl.ps1 | 1 - eng/common/sdl/push-gdn.ps1 | 69 ------------------- .../templates/job/source-index-stage1.yml | 2 +- .../templates/post-build/post-build.yml | 2 +- eng/common/tools.ps1 | 2 +- eng/common/tools.sh | 3 +- global.json | 2 +- 12 files changed, 45 insertions(+), 111 deletions(-) delete mode 100644 eng/common/sdl/push-gdn.ps1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4735ef8306ae..81d091445cd3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 938b3e8b4edcd96ca0f0cbbae63c87b3f51f7afe + 15246f4af00a1cb2e580783d32ec2937b1878a64 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index ae0cd1aac7b4..b26622444f5b 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -6,7 +6,7 @@ usage() { echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [--skipunmount] --rootfsdir ]" echo "BuildArch can be: arm(default), armel, arm64, x86" - echo "CodeName - optional, Code name for Linux, can be: trusty, xenial(default), zesty, bionic, alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." + echo "CodeName - optional, Code name for Linux, can be: trusty, xenial(default), zesty, bionic, alpine, alpine3.9 or alpine3.13. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." echo " for FreeBSD can be: freebsd11 or freebsd12." echo " for illumos can be: illumos." echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FReeBSD" @@ -183,9 +183,20 @@ while :; do __UbuntuRepo= __Tizen=tizen ;; - alpine) + alpine|alpine3.9) __CodeName=alpine __UbuntuRepo= + __AlpineVersion=3.9 + ;; + alpine3.13) + __CodeName=alpine + __UbuntuRepo= + __AlpineVersion=3.13 + # Alpine 3.13 has all the packages we need in the 3.13 repository + __AlpinePackages+=$__AlpinePackagesEdgeCommunity + __AlpinePackagesEdgeCommunity= + __AlpinePackages+=$__AlpinePackagesEdgeMain + __AlpinePackagesEdgeMain= ;; freebsd11) __FreeBSDBase="11.3-RELEASE" @@ -243,7 +254,6 @@ __RootfsDir="$( cd "$__RootfsDir" && pwd )" if [[ "$__CodeName" == "alpine" ]]; then __ApkToolsVersion=2.9.1 - __AlpineVersion=3.9 __ApkToolsDir=$(mktemp -d) wget https://github.com/alpinelinux/apk-tools/releases/download/v$__ApkToolsVersion/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -P $__ApkToolsDir tar -xf $__ApkToolsDir/apk-tools-$__ApkToolsVersion-x86_64-linux.tar.gz -C $__ApkToolsDir @@ -256,15 +266,19 @@ if [[ "$__CodeName" == "alpine" ]]; then -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ add $__AlpinePackages - $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/main \ - -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ - add $__AlpinePackagesEdgeMain + if [[ -n "$__AlpinePackagesEdgeMain" ]]; then + $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ + -X http://dl-cdn.alpinelinux.org/alpine/edge/main \ + -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ + add $__AlpinePackagesEdgeMain + fi - $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/community \ - -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ - add $__AlpinePackagesEdgeCommunity + if [[ -n "$__AlpinePackagesEdgeCommunity" ]]; then + $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ + -X http://dl-cdn.alpinelinux.org/alpine/edge/community \ + -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ + add $__AlpinePackagesEdgeCommunity + fi rm -r $__ApkToolsDir elif [[ "$__CodeName" == "freebsd" ]]; then diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index 0edb2ae276ed..c6f1045e3d7f 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -79,14 +79,6 @@ $CommonSetupArguments="--channel master --queue $Queue --build-number $BuildNumb $SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments" -#This grabs the LKG version number of dotnet and passes it to our scripts -$VersionJSON = Get-Content global.json | ConvertFrom-Json -$DotNetVersion = $VersionJSON.tools.dotnet -# TODO: Change this back to parsing when we have a good story for dealing with TFM changes or when the LKG in runtime gets updated to include net6.0 -# $SetupArguments = "--dotnet-versions $DotNetVersion $SetupArguments" -$SetupArguments = "--dotnet-versions 6.0.100-alpha.1.20553.6 $SetupArguments" - - if ($RunFromPerformanceRepo) { $SetupArguments = "--perf-hash $CommitSha $CommonSetupArguments" diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 7321feb5c7e6..cd4f233d57e6 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -88,6 +88,10 @@ while (($# > 0)); do internal=true shift 1 ;; + --alpine) + alpine=true + shift 1 + ;; --llvm) llvm=true shift 1 @@ -143,6 +147,7 @@ while (($# > 0)); do echo " --monodotnet Pass the path to the mono dotnet for mono performance testing." echo " --wasm Path to the unpacked wasm runtime pack." echo " --latestdotnet --dotnet-versions will not be specified. --dotnet-versions defaults to LKG version in global.json " + echo " --alpine Set for runs on Alpine" echo "" exit 0 ;; @@ -198,12 +203,20 @@ if [[ "$internal" == true ]]; then else queue=Ubuntu.1804.Amd64.Tiger.Perf fi + + if [[ "$alpine" = "true" ]]; then + queue=alpine.amd64.tiger.perf + fi else if [[ "$architecture" = "arm64" ]]; then queue=ubuntu.1804.armarch.open else queue=Ubuntu.1804.Amd64.Open fi + + if [[ "$alpine" = "true" ]]; then + queue=alpine.amd64.tiger.perf + fi fi if [[ "$mono_dotnet" != "" ]] && [[ "$monointerpreter" == "false" ]]; then @@ -224,16 +237,6 @@ fi common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture" setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" - -if [[ "$use_latest_dotnet" = false ]]; then - # Get the tools section from the global.json. - # This grabs the LKG version number of dotnet and passes it to our scripts - dotnet_version=`cat global.json | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["tools"]["dotnet"])'` - # TODO: Change this back to parsing when we have a good story for dealing with TFM changes or when the LKG in runtime gets updated to include net6.0 - # setup_arguments="--dotnet-versions $dotnet_version $setup_arguments" - setup_arguments="--dotnet-versions 6.0.100-alpha.1.20553.6 $setup_arguments" -fi - if [[ "$run_from_perf_repo" = true ]]; then payload_directory= workitem_directory=$source_directory diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index b681d797cdae..81b729f74a4d 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -87,10 +87,6 @@ try { & $(Join-Path $PSScriptRoot 'run-sdl.ps1') -GuardianCliLocation $guardianCliLocation -WorkingDirectory $workingDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams } - if ($UpdateBaseline) { - & (Join-Path $PSScriptRoot 'push-gdn.ps1') -Repository $RepoName -BranchName $BranchName -GdnFolder $GdnFolder -AzureDevOpsAccessToken $AzureDevOpsAccessToken -PushReason 'Update baseline' - } - if ($TsaPublish) { if ($TsaBranchName -and $BuildNumber) { if (-not $TsaRepositoryName) { diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 index bb6a42971108..1fe9271193cc 100644 --- a/eng/common/sdl/init-sdl.ps1 +++ b/eng/common/sdl/init-sdl.ps1 @@ -46,7 +46,6 @@ try { Write-PipelineTelemetryError -Force -Category 'Build' -Message "Guardian baseline failed with exit code $LASTEXITCODE." ExitWithExitCode $LASTEXITCODE } - & $(Join-Path $PSScriptRoot 'push-gdn.ps1') -Repository $Repository -BranchName $BranchName -GdnFolder $gdnFolder -AzureDevOpsAccessToken $AzureDevOpsAccessToken -PushReason 'Initialize gdn folder' ExitWithExitCode 0 } catch { diff --git a/eng/common/sdl/push-gdn.ps1 b/eng/common/sdl/push-gdn.ps1 deleted file mode 100644 index d8fd2d82a68d..000000000000 --- a/eng/common/sdl/push-gdn.ps1 +++ /dev/null @@ -1,69 +0,0 @@ -Param( - [string] $Repository, - [string] $BranchName='master', - [string] $GdnFolder, - [string] $AzureDevOpsAccessToken, - [string] $PushReason -) - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 2.0 -$disableConfigureToolsetImport = $true -$LASTEXITCODE = 0 - -try { - # `tools.ps1` checks $ci to perform some actions. Since the SDL - # scripts don't necessarily execute in the same agent that run the - # build.ps1/sh script this variable isn't automatically set. - $ci = $true - . $PSScriptRoot\..\tools.ps1 - - # We create the temp directory where we'll store the sdl-config repository - $sdlDir = Join-Path $env:TEMP 'sdl' - if (Test-Path $sdlDir) { - Remove-Item -Force -Recurse $sdlDir - } - - Write-Host "git clone https://dnceng:`$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir" - git clone https://dnceng:$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git clone failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - # We copy the .gdn folder from our local run into the git repository so it can be committed - $sdlRepositoryFolder = Join-Path (Join-Path (Join-Path $sdlDir $Repository) $BranchName) '.gdn' - if (Get-Command Robocopy) { - Robocopy /S $GdnFolder $sdlRepositoryFolder - } else { - rsync -r $GdnFolder $sdlRepositoryFolder - } - # cd to the sdl-config directory so we can run git there - Push-Location $sdlDir - # git add . --> git commit --> git push - Write-Host 'git add .' - git add . - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git add failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`"" - git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName" - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git commit failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - Write-Host 'git push' - git push - if ($LASTEXITCODE -ne 0) { - Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Git push failed with exit code $LASTEXITCODE." - ExitWithExitCode $LASTEXITCODE - } - - # Return to the original directory - Pop-Location -} -catch { - Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category 'Sdl' -Message $_ - ExitWithExitCode 1 -} diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index 612633074552..c002a2b1b0a3 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -1,6 +1,6 @@ parameters: runAsPublic: false - sourceIndexPackageVersion: 1.0.0-beta5 + sourceIndexPackageVersion: 1.0.1-20210225.1 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 822ff5975b01..c84ac55ebf8e 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -128,7 +128,7 @@ stages: - job: displayName: Signing Validation dependsOn: setupMaestroVars - condition: eq( ${{ parameters.enableSigningValidation }}, 'true') + condition: and( eq( ${{ parameters.enableSigningValidation }}, 'true'), ne( variables['PostBuildSign'], 'true')) variables: - template: common-variables.yml - name: AzDOProjectName diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 572da3b9f12c..be5ce4a2ed56 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -169,7 +169,7 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { Set-Content -Path $sdkCacheFileTemp -Value $dotnetRoot try { - Rename-Item -Force -Path $sdkCacheFileTemp 'sdk.txt' + Move-Item -Force $sdkCacheFileTemp (Join-Path $ToolsetDir 'sdk.txt') } catch { # Somebody beat us Remove-Item -Path $sdkCacheFileTemp diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 9019b7f5cc91..5fad1846e5a5 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -273,8 +273,7 @@ function GetDotNetInstallScript { if command -v curl > /dev/null; then # first, try directly, if this fails we will retry with verbose logging curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { - if command -v openssl &> /dev/null - then + if command -v openssl &> /dev/null; then echo "Curl failed; dumping some information about dotnet.microsoft.com for later investigation" echo | openssl s_client -showcerts -servername dotnet.microsoft.com -connect dotnet.microsoft.com:443 fi diff --git a/global.json b/global.json index a4eb412004ce..86995a1f633c 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "dotnet": "5.0.100" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21105.12" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21125.5" } } From c8793cbdd5790128e22cb19d7fcd382f961b2091 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 26 Feb 2021 13:24:12 +0000 Subject: [PATCH 1354/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210225.24 (#1009) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 81d091445cd3..9623b08a8b42 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 4affc3fa9e5777a0a865cc0750dd19de5a10385d + dcb26800f22490adc754a430f6ee80edacacc0f2 diff --git a/eng/Versions.props b/eng/Versions.props index 62e7415812c7..41c2d24c1f39 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-2.21124.12 + 3.10.0-2.21125.24 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From ed79a06ebae9a59fbf5c4f05a90db2ed85aeb013 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 08:27:54 -0800 Subject: [PATCH 1355/2702] Add warning when --diagnostics specified in wrong context --- src/FormatCommand.cs | 4 ++-- src/Program.cs | 5 +++++ src/Resources.resx | 9 +++++++++ src/xlf/Resources.cs.xlf | 15 +++++++++++++++ src/xlf/Resources.de.xlf | 15 +++++++++++++++ src/xlf/Resources.es.xlf | 15 +++++++++++++++ src/xlf/Resources.fr.xlf | 15 +++++++++++++++ src/xlf/Resources.it.xlf | 15 +++++++++++++++ src/xlf/Resources.ja.xlf | 15 +++++++++++++++ src/xlf/Resources.ko.xlf | 15 +++++++++++++++ src/xlf/Resources.pl.xlf | 15 +++++++++++++++ src/xlf/Resources.pt-BR.xlf | 15 +++++++++++++++ src/xlf/Resources.ru.xlf | 15 +++++++++++++++ src/xlf/Resources.tr.xlf | 15 +++++++++++++++ src/xlf/Resources.zh-Hans.xlf | 15 +++++++++++++++ src/xlf/Resources.zh-Hant.xlf | 15 +++++++++++++++ 16 files changed, 211 insertions(+), 2 deletions(-) diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index d37173252bb7..0de958fa9788 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -89,7 +89,7 @@ internal static RootCommand CreateCommandLineOptions() var folder = symbolResult.ValueForOption("--folder"); var fixAnalyzers = symbolResult.OptionResult("--fix-analyzers"); return folder && fixAnalyzers != null - ? "Cannot specify the '--folder' option when running analyzers." + ? Resources.Cannot_specify_the_folder_option_when_running_analyzers : null; } @@ -98,7 +98,7 @@ internal static RootCommand CreateCommandLineOptions() var folder = symbolResult.ValueForOption("--folder"); var fixStyle = symbolResult.OptionResult("--fix-style"); return folder && fixStyle != null - ? "Cannot specify the '--folder' option when fixing style." + ? Resources.Cannot_specify_the_folder_option_when_fixing_style : null; } diff --git a/src/Program.cs b/src/Program.cs index c3bc353899e1..99a349306ed6 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -150,6 +150,11 @@ public static async Task Run( fixType |= FixCategory.Analyzers; } + if (fixType == FixCategory.None && diagnostics.Length > 0) + { + logger.LogWarning(Resources.The_diagnostics_option_only_applies_when_fixing_style_or_running_analyzers); + } + if (fixType == FixCategory.None || fixWhitespace) { fixType |= FixCategory.Whitespace; diff --git a/src/Resources.resx b/src/Resources.resx index 13a22a535271..7039987d3b3c 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -300,4 +300,13 @@ A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + + The '--diagnostics' option only applies when fixing style or running analyzers. + + + Cannot specify the '--folder' option when running analyzers. + + + Cannot specify the '--folder' option when fixing style. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 99b221a6652d..cf11606b5de6 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -42,6 +42,16 @@ {0} obsahuje jak soubor projektu MSBuild, tak soubor řešení. Určete, který soubor chcete použít, pomocí argumentu <workspace>. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style Styl kódu @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. Verze .NET CLI je {0}. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 249c273e3cc9..8fc9c319c543 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -42,6 +42,16 @@ In "{0}" wurden eine MSBuild-Projektdatei und eine Projektmappendatei gefunden. Geben Sie die zu verwendende Datei mit dem <workspace>-Argument an. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style Codeformat @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. Die dotnet-CLI-Version ist "{0}". diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 8c347e62b35d..bb11f12b9eb3 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -42,6 +42,16 @@ Se encontró un archivo del proyecto y un archivo de solución MSBuild en "{0}". Especifique cuál debe usarse con el argumento <workspace>. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style Estilo de código @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. La versión de la CLI de dotnet es "{0}". diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index a82888360ff9..de2b7a6b5c15 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -42,6 +42,16 @@ Fichier projet et fichier solution MSBuild trouvés dans '{0}'. Spécifiez celui qui doit être utilisé avec l'argument <espace de travail>. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style Style de code @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. La version de l'interface CLI dotnet est '{0}'. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index e42bb11d58cc..7f15b91ff9e3 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -42,6 +42,16 @@ In '{0}' sono stati trovati sia un file di progetto che un file di soluzione MSBuild. Per specificare quello desiderato, usare l'argomento <workspace>. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style Stile codice @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. La versione dell'interfaccia della riga di comando di dotnet è '{0}'. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index fbc29791b3a6..db9480d7cfa7 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -42,6 +42,16 @@ MSBuild のプロジェクト ファイルとソリューション ファイルの両方が '{0}' で見つかりました。使用するものを <workspace> 引数で指定してください。 + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style コード スタイル @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. dotnet CLI バージョンは '{0}' です。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index ed61b7cc3fe0..02ad457f859c 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -42,6 +42,16 @@ '{0}'에 MSBuild 프로젝트 파일 및 솔루션 파일이 모두 있습니다. <workspace> 인수를 사용하여 사용할 파일을 지정하세요. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style 코드 스타일 @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. dotnet CLI 버전은 '{0}'입니다. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index e075eca3976a..c5ec97c4bf76 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -42,6 +42,16 @@ W elemencie „{0}” znaleziono zarówno plik rozwiązania, jak i plik projektu MSBuild. Określ plik do użycia za pomocą argumentu <workspace>. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style Styl kodu @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. Wersja interfejsu wiersza polecenia dotnet to „{0}”. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index fceabd1938f5..bf778f4b146c 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -42,6 +42,16 @@ Foram encontrados um arquivo de solução e um arquivo de projeto do MSBuild em '{0}'. Especifique qual será usado com o argumento <workspace>. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style Estilo do Código @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. A versão do CLI do dotnet é '{0}'. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 6ef10772c479..2d8461cca2f6 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -42,6 +42,16 @@ В "{0}" обнаружены как файл проекта, так и файл решения MSBuild. Укажите используемый файл с помощью аргумента <workspace>. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style Стиль кода @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. Версия CLI dotnet: "{0}". diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 80eab9359076..d6a8eb19f306 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -42,6 +42,16 @@ '{0}' içinde hem MSBuild proje dosyası hem de çözüm dosyası bulundu. Hangisinin <çalışma alanı> bağımsız değişkeni ile kullanılacağını belirtin. + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style Kod Stili @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. dotnet CLI sürümü: '{0}'. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index a1ca40ca9ddc..b36cb4220bab 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -42,6 +42,16 @@ 在“{0}”中同时找到 MSBuild 项目文件和解决方案文件。请指定要用于 <workspace> 参数的文件。 + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style 代码样式 @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. dotnet CLI 版本为“{0}”。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 55504ed49513..31373bec3813 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -42,6 +42,16 @@ 在 '{0}' 中同時找到 MSBuild 專案檔與解決方案檔。請指定要用於 <workspace> 引數的檔案。 + + Cannot specify the '--folder' option when fixing style. + Cannot specify the '--folder' option when fixing style. + + + + Cannot specify the '--folder' option when running analyzers. + Cannot specify the '--folder' option when running analyzers. + + Code Style 程式碼樣式 @@ -217,6 +227,11 @@ Standard input markers ('/dev/stdin', '-') can only be used either with `--include` or `--exclude`, but not both. + + The '--diagnostics' option only applies when fixing style or running analyzers. + The '--diagnostics' option only applies when fixing style or running analyzers. + + The dotnet CLI version is '{0}'. dotnet CLI 版本為 '{0}'。 From 7f621992ab994b7ff7db4777bf380784d1ab3097 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 08:51:42 -0800 Subject: [PATCH 1356/2702] Fix tests --- .../CodeStyleAnalyzerFormatterTests.cs | 44 ------------------- tests/CodeFormatterTests.cs | 2 +- 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs index 08ee41c7df43..01dd7b51f556 100644 --- a/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs +++ b/tests/Analyzers/CodeStyleAnalyzerFormatterTests.cs @@ -74,49 +74,5 @@ public int M() await AssertNoReportedFileChangesAsync(testCode, "root = true", fixCategory: FixCategory.CodeStyle, codeStyleSeverity: DiagnosticSeverity.Warning); } - - [Fact] - public async Task TestUnusedImport_AppliesWhenIDE0005InDiagnosticsList() - { - var testCode = @" -using System.Buffers; -using System.Collections.Generic; - -class C -{ - void M() - { - object obj = new object(); - List list = new List(); - int count = 5; - } -}"; - - var expectedCode = @" -using System.Collections.Generic; - -class C -{ - void M() - { - object obj = new object(); - List list = new List(); - int count = 5; - } -}"; - - var editorConfig = new Dictionary() - { - /// IDE0005: Using directive is unnecessary - ["dotnet_diagnostic.IDE0005.severity"] = "error", - /// Prefer "var" everywhere - ["dotnet_diagnostic.IDE0007.severity"] = "error", - ["csharp_style_var_for_built_in_types"] = "true:error", - ["csharp_style_var_when_type_is_apparent"] = "true:error", - ["csharp_style_var_elsewhere"] = "true:error", - }; - - await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.CodeStyle, diagnostics: new[] { "IDE0005" }); - } } } diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 3f627ed5ad7a..2f43c2f85275 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -543,7 +543,7 @@ internal async Task TestFormatWorkspaceAsync( fixCategory, codeStyleSeverity, analyzerSeverity, - diagnostics?.ToImmutableHashSet() ?? default, + diagnostics?.ToImmutableHashSet() ?? ImmutableHashSet.Empty, saveFormattedFiles: false, changesAreErrors: false, fileMatcher, From 39a3aed8bd467d6d7502a79ebad41d61ba852425 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 11:31:17 -0800 Subject: [PATCH 1357/2702] LogDebug each project's applied .editorconfig Resolves #937 --- src/CodeFormatter.cs | 11 +++++++++++ src/Resources.resx | 3 +++ src/xlf/Resources.cs.xlf | 5 +++++ src/xlf/Resources.de.xlf | 5 +++++ src/xlf/Resources.es.xlf | 5 +++++ src/xlf/Resources.fr.xlf | 5 +++++ src/xlf/Resources.it.xlf | 5 +++++ src/xlf/Resources.ja.xlf | 5 +++++ src/xlf/Resources.ko.xlf | 5 +++++ src/xlf/Resources.pl.xlf | 5 +++++ src/xlf/Resources.pt-BR.xlf | 5 +++++ src/xlf/Resources.ru.xlf | 5 +++++ src/xlf/Resources.tr.xlf | 5 +++++ src/xlf/Resources.zh-Hans.xlf | 5 +++++ src/xlf/Resources.zh-Hant.xlf | 5 +++++ 15 files changed, 79 insertions(+) diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index e69e55dc043e..6fcef0474198 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -51,6 +51,17 @@ public static async Task FormatWorkspaceAsync( return new WorkspaceFormatResult(filesFormatted: 0, fileCount: 0, exitCode: 1); } + if (formatOptions.LogLevel <= LogLevel.Debug) + { + foreach (var project in workspace.CurrentSolution.Projects) + { + foreach (var configDocument in project.AnalyzerConfigDocuments) + { + logger.LogDebug(Resources.Project_0_is_using_configuration_from_1, project.Name, configDocument.FilePath); + } + } + } + var loadWorkspaceMS = workspaceStopwatch.ElapsedMilliseconds; logger.LogTrace(Resources.Complete_in_0_ms, loadWorkspaceMS); diff --git a/src/Resources.resx b/src/Resources.resx index 7039987d3b3c..3f5cae89cff3 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -309,4 +309,7 @@ Cannot specify the '--folder' option when fixing style. + + Project {0} is using configuration from '{1}'. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index cf11606b5de6..9c24173201fc 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -167,6 +167,11 @@ {0} obsahuje více souborů řešení MSBuild. Určete, který soubor chcete použít, pomocí argumentu <workspace>. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 8fc9c319c543..661bd22842fe 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -167,6 +167,11 @@ In "{0}" wurden mehrere MSBuild-Projektmappendateien gefunden. Geben Sie die zu verwendende Datei mit dem <workspace>-Argument an. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index bb11f12b9eb3..241faf51062a 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -167,6 +167,11 @@ Se encontraron varios archivos de solución MSBuild en "{0}". Especifique cuál debe usarse con el argumento <workspace>. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index de2b7a6b5c15..4e39052f2f02 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -167,6 +167,11 @@ Plusieurs fichiers solution MSBuild trouvés dans '{0}'. Spécifiez celui qui doit être utilisé avec l'argument <espace de travail>. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 7f15b91ff9e3..467d3385f185 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -167,6 +167,11 @@ In '{0}' sono stati trovati più file di soluzione MSBuild. Per specificare quello desiderato, usare l'argomento <workspace>. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index db9480d7cfa7..e5b98932fa21 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -167,6 +167,11 @@ 複数の MSBuild ソリューション ファイルが '{0}' で見つかりました。使用するものを <workspace> 引数で指定してください。 + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 02ad457f859c..cdedac47b65c 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -167,6 +167,11 @@ '{0}'에 여러 MSBuild 솔루션 파일이 있습니다. <workspace> 인수를 사용하여 사용할 파일을 지정하세요. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index c5ec97c4bf76..022d7fc182ab 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -167,6 +167,11 @@ W elemencie „{0}” znaleziono wiele plików rozwiązań MSBuild. Określ plik do użycia za pomocą argumentu <workspace>. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index bf778f4b146c..5728116f8a9f 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -167,6 +167,11 @@ Foram encontrados vários arquivos de solução do MSBuild em '{0}'. Especifique qual será usado com o argumento <workspace>. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 2d8461cca2f6..2947c5d82fcd 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -167,6 +167,11 @@ В "{0}" обнаружено несколько файлов решения MSBuild. Укажите используемый файл с помощью аргумента <workspace>. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index d6a8eb19f306..b307a38ba27a 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -167,6 +167,11 @@ '{0}' içinde birden fazla MSBuild çözüm dosyası bulundu. Hangisinin <çalışma alanı> bağımsız değişkeni ile kullanılacağını belirtin. + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index b36cb4220bab..2d8f53cf8bdc 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -167,6 +167,11 @@ 在“{0}”中找到多个 MSBuild 解决方案文件。请指定要用于 <workspace> 参数的文件。 + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 31373bec3813..1435b741b422 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -167,6 +167,11 @@ 在 '{0}' 中找到多個 MSBuild 解決方案檔。請指定要用於 <workspace> 引數的檔案。 + + Project {0} is using configuration from '{1}'. + Project {0} is using configuration from '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. From edd466ba151fe27976f4cf5ae500bd7c36f1ceab Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 13:49:35 -0800 Subject: [PATCH 1358/2702] Perform implicit restore when running analysis. Adds --no-restore option. Resolves #848 --- README.md | 2 ++ docs/README.md | 7 ++++--- perf/FormattedFiles.cs | 3 +++ perf/NoFilesFormatted.cs | 3 +++ perf/RealWorldSolution.cs | 2 ++ src/CodeFormatter.cs | 16 ++++++++++++--- src/FormatCommand.cs | 12 +++++++++++ src/FormatOptions.cs | 5 +++++ src/Program.cs | 2 ++ src/Resources.resx | 6 ++++++ src/Utilities/DotNetHelper.cs | 24 ++++++++++++++++++++++ src/xlf/Resources.cs.xlf | 10 +++++++++ src/xlf/Resources.de.xlf | 10 +++++++++ src/xlf/Resources.es.xlf | 10 +++++++++ src/xlf/Resources.fr.xlf | 10 +++++++++ src/xlf/Resources.it.xlf | 10 +++++++++ src/xlf/Resources.ja.xlf | 10 +++++++++ src/xlf/Resources.ko.xlf | 10 +++++++++ src/xlf/Resources.pl.xlf | 10 +++++++++ src/xlf/Resources.pt-BR.xlf | 10 +++++++++ src/xlf/Resources.ru.xlf | 10 +++++++++ src/xlf/Resources.tr.xlf | 10 +++++++++ src/xlf/Resources.zh-Hans.xlf | 10 +++++++++ src/xlf/Resources.zh-Hant.xlf | 10 +++++++++ tests/CodeFormatterTests.cs | 19 +++-------------- tests/Formatters/AbstractFormatterTests.cs | 1 + tests/Formatters/FormattedFilesTests.cs | 1 + tests/ProgramTests.cs | 16 +++++++++++++++ 28 files changed, 227 insertions(+), 22 deletions(-) create mode 100644 src/Utilities/DotNetHelper.cs diff --git a/README.md b/README.md index b0c9893d219a..a6c5a9e7dc20 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ Arguments: A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. Options: + --no-restore Doesn't execute an implicit restore before formatting. --folder, -f Whether to treat the `` argument as a simple folder of files. --fix-whitespace, -w Run whitespace formatting. Run by default when not applying fixes. --fix-style, -s Run code style analyzers and apply fixes. @@ -118,6 +119,7 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | `dotnet format ` | Formats a specific project or solution. | | `dotnet format -f` | Formats a particular folder and subfolders. | | `dotnet format --fix-style warn` | Fixes only codestyle analyzer warnings. | +| `dotnet format --fix-style --no-restore` | Fixes only codestyle analyzer errors without performing an implicit restore. | | `dotnet format --fix-style --diagnostics IDE0005` | Fixes only codestyle analyzer errors for the IDE0005 diagnostic. | | `dotnet format --fix-whitespace --fix-style` | Formats and fixes codestyle analyzer errors. | | `dotnet format --fix-analyzers` | Fixes only 3rd party analyzer errors. | diff --git a/docs/README.md b/docs/README.md index 362eb7498979..4bd0c8f67372 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,6 +10,7 @@ A workspace path is needed when running dotnet-format. By default, the current folder will be used as the workspace path. The workspace path and type of workspace determines which code files are considered for formatting. - Solutions and Projects - By default dotnet-format will open the workspace path as a MSBuild solution or project. +- `--no-restore` - When formatting a solution or project the no restore option will stop dotnet-format from performing an implicit package restore. - `--folder` - When the folder options is specified the workspace path will be treated as a folder of code files. *Example:* @@ -34,7 +35,7 @@ dotnet-format ./src --folder ### Whitespace formatting -Whitespace formatting includes the core .editorconfig settings along with the placement of spaces and newlines. The whitespace formatter is run by default when not running analysis. When you want to run analysis and fix formatting issues you must specify both. +Whitespace formatting includes the core .editorconfig settings along with the placement of spaces and newlines. The whitespace formatter is run by default when not running analysis. When only performing whitespace formatting, an implicit restore is not perfomed. When you want to run analysis and fix formatting issues you must specify both. Whitespace formatting run by default. @@ -52,7 +53,7 @@ dotnet-format ./format.sln --fix-whitespace --fix-style #### CodeStyle analysis -Running codestyle analysis requires the use of a MSBuild solution or project file as the workspace. Enforces the .NET [Language conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019) and [Naming conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2019). +Running codestyle analysis requires the use of a MSBuild solution or project file as the workspace. By default an implicit restore on the solution or project is performed. Enforces the .NET [Language conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019) and [Naming conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2019). - `--fix-style ` - Runs analysis and attempts to fix issues with severity equal or greater than specified. If severity is not specified then severity defaults to error. @@ -78,7 +79,7 @@ dotnet-format ./src --folder --fix-style #### 3rd party analysis -Running 3rd party analysis requires the use of a MSBuild solution or project file as the workspace. 3rd party analyzers are discovered from the `` specified in the workspace project files. +Running 3rd party analysis requires the use of a MSBuild solution or project file as the workspace. By default an implicit restore on the solution or project is performed. 3rd party analyzers are discovered from the `` specified in the workspace project files. - `--fix-analyzers ` - Runs analysis and attempts to fix issues with severity equal or greater than specified. If no severity is specified then this defaults to error. diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index 8252e700a082..443b41dacf9c 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -33,6 +33,7 @@ public void FilesFormattedFolder() var options = new FormatOptions( workspacePath, workspaceType, + noRestore: false, LogLevel.Error, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, @@ -53,6 +54,7 @@ public void FilesFormattedProject() var options = new FormatOptions( workspacePath, workspaceType, + noRestore: false, LogLevel.Error, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, @@ -73,6 +75,7 @@ public void FilesFormattedSolution() var options = new FormatOptions( workspacePath, workspaceType, + noRestore: false, LogLevel.Error, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index 2d68b474e586..fe9116e88a4a 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -33,6 +33,7 @@ public void NoFilesFormattedFolder() var options = new FormatOptions( workspacePath, workspaceType, + noRestore: false, LogLevel.Error, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, @@ -53,6 +54,7 @@ public void NoFilesFormattedProject() var options = new FormatOptions( workspacePath, workspaceType, + noRestore: false, LogLevel.Error, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, @@ -73,6 +75,7 @@ public void NoFilesFormattedSolution() var options = new FormatOptions( workspacePath, workspaceType, + noRestore: false, LogLevel.Error, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index e778cda2ecfa..ad99f7e358a7 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -35,6 +35,7 @@ public void FilesFormattedSolution() var options = new FormatOptions( workspacePath, workspaceType, + noRestore: false, LogLevel.Error, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, @@ -55,6 +56,7 @@ public void FilesFormattedFolder() var options = new FormatOptions( workspacePath, workspaceType, + noRestore: false, LogLevel.Error, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, diff --git a/src/CodeFormatter.cs b/src/CodeFormatter.cs index 6fcef0474198..c68f4fd6c61b 100644 --- a/src/CodeFormatter.cs +++ b/src/CodeFormatter.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Analyzers; using Microsoft.CodeAnalysis.Tools.Formatters; +using Microsoft.CodeAnalysis.Tools.Tests.Utilities; using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.CodeAnalysis.Tools.Workspaces; using Microsoft.Extensions.Logging; @@ -44,7 +45,7 @@ public static async Task FormatWorkspaceAsync( using var workspace = formatOptions.WorkspaceType == WorkspaceType.Folder ? OpenFolderWorkspace(formatOptions.WorkspaceFilePath, formatOptions.FileMatcher) - : await OpenMSBuildWorkspaceAsync(formatOptions.WorkspaceFilePath, formatOptions.WorkspaceType, createBinaryLog, logWorkspaceWarnings, logger, cancellationToken).ConfigureAwait(false); + : await OpenMSBuildWorkspaceAsync(formatOptions.WorkspaceFilePath, formatOptions.WorkspaceType, formatOptions.NoRestore, formatOptions.FixCategory != FixCategory.Whitespace, createBinaryLog, logWorkspaceWarnings, logger, cancellationToken).ConfigureAwait(false); if (workspace is null) { @@ -120,15 +121,24 @@ private static Workspace OpenFolderWorkspace(string workspacePath, SourceFileMat return folderWorkspace; } - private static Task OpenMSBuildWorkspaceAsync( + private static async Task OpenMSBuildWorkspaceAsync( string solutionOrProjectPath, WorkspaceType workspaceType, + bool noRestore, + bool requiresSemantics, bool createBinaryLog, bool logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken) { - return MSBuildWorkspaceLoader.LoadAsync(solutionOrProjectPath, workspaceType, createBinaryLog, logWorkspaceWarnings, logger, cancellationToken); + if (requiresSemantics && + !noRestore && + await DotNetHelper.PerformRestoreAsync(solutionOrProjectPath, logger) != 0) + { + throw new Exception("Restore operation failed."); + } + + return await MSBuildWorkspaceLoader.LoadAsync(solutionOrProjectPath, workspaceType, createBinaryLog, logWorkspaceWarnings, logger, cancellationToken); } private static async Task RunCodeFormattersAsync( diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 0de958fa9788..8cdad1c1e9c3 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -14,6 +14,7 @@ internal static class FormatCommand // so that values bind correctly. internal delegate Task Handler( string? workspace, + bool noRestore, bool folder, bool fixWhitespace, string? fixStyle, @@ -40,6 +41,7 @@ internal static RootCommand CreateCommandLineOptions() Arity = ArgumentArity.ZeroOrOne, Description = Resources.A_path_to_a_solution_file_a_project_file_or_a_folder_containing_a_solution_or_project_file_If_a_path_is_not_specified_then_the_current_directory_is_used }.LegalFilePathsOnly(), + new Option(new[] { "--no-restore" }, Resources.Doesnt_execute_an_implicit_restore_before_formatting), new Option(new[] { "--folder", "-f" }, Resources.Whether_to_treat_the_workspace_argument_as_a_simple_folder_of_files), new Option(new[] { "--fix-whitespace", "-w" }, Resources.Run_whitespace_formatting_Run_by_default_when_not_applying_fixes), new Option(new[] { "--fix-style", "-s" }, Resources.Run_code_style_analyzers_and_apply_fixes) @@ -80,6 +82,7 @@ internal static RootCommand CreateCommandLineOptions() rootCommand.Description = "dotnet-format"; rootCommand.AddValidator(EnsureFolderNotSpecifiedWhenFixingStyle); rootCommand.AddValidator(EnsureFolderNotSpecifiedWhenFixingAnalyzers); + rootCommand.AddValidator(EnsureFolderNotSpecifiedWithNoRestore); return rootCommand; } @@ -102,6 +105,15 @@ internal static RootCommand CreateCommandLineOptions() : null; } + internal static string? EnsureFolderNotSpecifiedWithNoRestore(CommandResult symbolResult) + { + var folder = symbolResult.ValueForOption("--folder"); + var noRestore = symbolResult.OptionResult("--no-restore"); + return folder && noRestore != null + ? Resources.Cannot_specify_the_folder_option_with_no_restore + : null; + } + internal static bool WasOptionUsed(this ParseResult result, params string[] aliases) { return result.Tokens diff --git a/src/FormatOptions.cs b/src/FormatOptions.cs index 20a82c8867d3..8b15b4aaf28c 100644 --- a/src/FormatOptions.cs +++ b/src/FormatOptions.cs @@ -10,6 +10,7 @@ internal class FormatOptions { public string WorkspaceFilePath { get; } public WorkspaceType WorkspaceType { get; } + public bool NoRestore { get; } public LogLevel LogLevel { get; } public FixCategory FixCategory { get; } public DiagnosticSeverity CodeStyleSeverity { get; } @@ -24,6 +25,7 @@ internal class FormatOptions public FormatOptions( string workspaceFilePath, WorkspaceType workspaceType, + bool noRestore, LogLevel logLevel, FixCategory fixCategory, DiagnosticSeverity codeStyleSeverity, @@ -37,6 +39,7 @@ public FormatOptions( { WorkspaceFilePath = workspaceFilePath; WorkspaceType = workspaceType; + NoRestore = noRestore; LogLevel = logLevel; FixCategory = fixCategory; CodeStyleSeverity = codeStyleSeverity; @@ -52,6 +55,7 @@ public FormatOptions( public void Deconstruct( out string workspaceFilePath, out WorkspaceType workspaceType, + out bool noRestore, out LogLevel logLevel, out FixCategory fixCategory, out DiagnosticSeverity codeStyleSeverity, @@ -65,6 +69,7 @@ public void Deconstruct( { workspaceFilePath = WorkspaceFilePath; workspaceType = WorkspaceType; + noRestore = NoRestore; logLevel = LogLevel; fixCategory = FixCategory; codeStyleSeverity = CodeStyleSeverity; diff --git a/src/Program.cs b/src/Program.cs index 99a349306ed6..4e163e2bd7a9 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -44,6 +44,7 @@ private static async Task Main(string[] args) public static async Task Run( string? workspace, + bool noRestore, bool folder, bool fixWhitespace, string? fixStyle, @@ -167,6 +168,7 @@ public static async Task Run( var formatOptions = new FormatOptions( workspacePath, workspaceType, + noRestore, logLevel, fixType, codeStyleSeverity: GetSeverity(fixStyle ?? FixSeverity.Error), diff --git a/src/Resources.resx b/src/Resources.resx index 3f5cae89cff3..51818d9d3b52 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -312,4 +312,10 @@ Project {0} is using configuration from '{1}'. + + Doesn't execute an implicit restore before formatting. + + + Cannot specify the '--folder' option with '--no-restore'. + \ No newline at end of file diff --git a/src/Utilities/DotNetHelper.cs b/src/Utilities/DotNetHelper.cs new file mode 100644 index 000000000000..d74eeab9b9ed --- /dev/null +++ b/src/Utilities/DotNetHelper.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Utilities; +using Microsoft.Extensions.Logging; + +#nullable enable + +namespace Microsoft.CodeAnalysis.Tools.Tests.Utilities +{ + internal static class DotNetHelper + { + public static async Task PerformRestoreAsync(string workspaceFilePath, ILogger logger) + { + var processInfo = ProcessRunner.CreateProcess("dotnet", $"restore \"{workspaceFilePath}\"", captureOutput: true, displayWindow: false); + var restoreResult = await processInfo.Result; + + logger.LogDebug(string.Join(Environment.NewLine, restoreResult.OutputLines)); + + return restoreResult.ExitCode; + } + } +} diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 9c24173201fc..1a3ed791c884 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style Styl kódu @@ -82,6 +87,11 @@ Určují se soubory, které se dají formátovat. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} Nepovedlo se použít opravu kódu {0} pro {1}: {2} diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 661bd22842fe..90c7c19cfef8 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style Codeformat @@ -82,6 +87,11 @@ Formatierbare Dateien werden ermittelt. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} Fehler beim Anwenden der Codekorrektur "{0}" für "{1}": {2} diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 241faf51062a..5e534f7ad675 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style Estilo de código @@ -82,6 +87,11 @@ Determinando los archivos formateables. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} No se pudo aplicar la corrección de código {0} para {1}: {2} diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 4e39052f2f02..f3735d9a327c 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style Style de code @@ -82,6 +87,11 @@ Identification des fichiers pouvant être mis en forme. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} Échec de l'application du correctif de code {0} pour {1} : {2} diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 467d3385f185..1da275bc9968 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style Stile codice @@ -82,6 +87,11 @@ Determinazione dei file formattabili. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} Non è stato possibile applicare la correzione del codice {0} per {1}: {2} diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index e5b98932fa21..4bd5c7ff517d 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style コード スタイル @@ -82,6 +87,11 @@ 書式設定可能なファイルを判定しています。 + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} {1} のコード修正プログラム {0} を適用できませんでした: {2} diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index cdedac47b65c..ff4fb140cfe7 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style 코드 스타일 @@ -82,6 +87,11 @@ 서식 지정 가능한 파일을 확인하는 중입니다. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} {1}에 대한 코드 수정 사항 {0}을(를) 적용하지 못했습니다. {2} diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 022d7fc182ab..cfd65e2923d7 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style Styl kodu @@ -82,6 +87,11 @@ Określanie plików, które można formatować. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} Nie można zastosować poprawki kodu {0} dla elementu {1}: {2} diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 5728116f8a9f..88ec758f31ed 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style Estilo do Código @@ -82,6 +87,11 @@ Determinando arquivos formatáveis. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} Falha ao aplicar a correção de código {0} para {1}: {2} diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 2947c5d82fcd..0932bbf0c1c7 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style Стиль кода @@ -82,6 +87,11 @@ Определение форматируемых файлов. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} Не удалось применить исправление кода {0} для {1}: {2} diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index b307a38ba27a..0573cab266ab 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style Kod Stili @@ -82,6 +87,11 @@ Biçimlendirilebilir dosyalar belirleniyor. + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} {1} için {0} kod düzeltmesi uygulanamadı: {2} diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 2d8f53cf8bdc..67d733def925 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style 代码样式 @@ -82,6 +87,11 @@ 正在确定可格式化的文件。 + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} 未能对 {1} 应用代码修复 {0}: {2} diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 1435b741b422..08032b79f583 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -52,6 +52,11 @@ Cannot specify the '--folder' option when running analyzers. + + Cannot specify the '--folder' option with '--no-restore'. + Cannot specify the '--folder' option with '--no-restore'. + + Code Style 程式碼樣式 @@ -82,6 +87,11 @@ 正在判斷可格式化的檔案。 + + Doesn't execute an implicit restore before formatting. + Doesn't execute an implicit restore before formatting. + + Failed to apply code fix {0} for {1}: {2} 無法為 {1} 套用程式碼修正 {0}: {2} diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index 2f43c2f85275..1edf20d47a66 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -414,9 +414,6 @@ await TestFormatWorkspaceAsync( [MSBuildFact] public async Task NoFilesFormattedInCodeStyleSolution_WhenNotFixingCodeStyle() { - var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilePath, _output); - Assert.Equal(0, restoreExitCode); - await TestFormatWorkspaceAsync( s_codeStyleSolutionFilePath, include: EmptyFilesList, @@ -431,9 +428,6 @@ await TestFormatWorkspaceAsync( [MSBuildFact] public async Task NoFilesFormattedInCodeStyleSolution_WhenFixingCodeStyleErrors() { - var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilePath, _output); - Assert.Equal(0, restoreExitCode); - await TestFormatWorkspaceAsync( s_codeStyleSolutionFilePath, include: EmptyFilesList, @@ -449,9 +443,6 @@ await TestFormatWorkspaceAsync( [MSBuildFact] public async Task FilesFormattedInCodeStyleSolution_WhenFixingCodeStyleWarnings() { - var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilePath, _output); - Assert.Equal(0, restoreExitCode); - await TestFormatWorkspaceAsync( s_codeStyleSolutionFilePath, include: EmptyFilesList, @@ -467,9 +458,6 @@ await TestFormatWorkspaceAsync( [MSBuildFact] public async Task NoFilesFormattedInAnalyzersSolution_WhenNotFixingAnalyzers() { - var restoreExitCode = await NuGetHelper.PerformRestore(s_analyzersSolutionFilePath, _output); - Assert.Equal(0, restoreExitCode); - await TestFormatWorkspaceAsync( s_analyzersSolutionFilePath, include: EmptyFilesList, @@ -484,9 +472,6 @@ await TestFormatWorkspaceAsync( [MSBuildFact] public async Task FilesFormattedInAnalyzersSolution_WhenFixingAnalyzerErrors() { - var restoreExitCode = await NuGetHelper.PerformRestore(s_analyzersSolutionFilePath, _output); - Assert.Equal(0, restoreExitCode); - await TestFormatWorkspaceAsync( s_analyzersSolutionFilePath, include: EmptyFilesList, @@ -510,7 +495,8 @@ internal async Task TestFormatWorkspaceAsync( FixCategory fixCategory = FixCategory.Whitespace, DiagnosticSeverity codeStyleSeverity = DiagnosticSeverity.Error, DiagnosticSeverity analyzerSeverity = DiagnosticSeverity.Error, - string[] diagnostics = null) + string[] diagnostics = null, + bool noRestore = false) { var currentDirectory = Environment.CurrentDirectory; Environment.CurrentDirectory = TestProjectsPathHelper.GetProjectsDirectory(); @@ -539,6 +525,7 @@ internal async Task TestFormatWorkspaceAsync( var formatOptions = new FormatOptions( workspacePath, workspaceType, + noRestore, LogLevel.Trace, fixCategory, codeStyleSeverity, diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 86ac28f2e946..db2af29e8582 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -228,6 +228,7 @@ private protected async Task AssertCodeChangedAsync( var formatOptions = new FormatOptions( workspaceFilePath: project.FilePath!, workspaceType: WorkspaceType.Solution, + noRestore: false, logLevel: LogLevel.Trace, fixCategory, codeStyleSeverity, diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index 145a0735970d..3e8b14b8d2f6 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -64,6 +64,7 @@ private async Task> TestFormattedFiles(string testCode) var formatOptions = new FormatOptions( workspaceFilePath: project.FilePath, workspaceType: WorkspaceType.Folder, + noRestore: false, logLevel: LogLevel.Trace, fixCategory: FixCategory.Whitespace, codeStyleSeverity: DiagnosticSeverity.Error, diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index cdd40cb2bf78..b4ad5996ed5f 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -155,6 +155,19 @@ public void CommandLine_FolderValidation_FailsIfFixStyleSpecified() Assert.Equal(1, result.Errors.Count); } + [Fact] + public void CommandLine_FolderValidation_FailsIfNoRestoreSpecified() + { + // Arrange + var sut = FormatCommand.CreateCommandLineOptions(); + + // Act + var result = sut.Parse(new[] { "--folder", "--no-restore" }); + + // Assert + Assert.Equal(1, result.Errors.Count); + } + [Fact] public void CommandLine_AnalyzerOptions_CanSpecifyBothWithDefaults() { @@ -180,6 +193,7 @@ public async Task CommandLine_AllArguments_Bind() Task TestRun( string workspace, + bool noRestore, bool folder, bool fixWhitespace, string fixStyle, @@ -194,6 +208,7 @@ Task TestRun( IConsole console = null) { Assert.Equal("./src", workspace); + Assert.True(noRestore); Assert.False(folder); Assert.True(fixWhitespace); Assert.Equal("warn", fixStyle); @@ -211,6 +226,7 @@ Task TestRun( var args = @" ./src +--no-restore --fix-whitespace --fix-style warn From 4f859812ce6e34c2f641e33199ad7c76b388c265 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 13:51:22 -0800 Subject: [PATCH 1359/2702] No implicit restore during integration tests. --- eng/format-verifier.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index 21b86bfcaa79..bc894e590e72 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -70,7 +70,7 @@ try { if ($stage -eq "format-workspace") { Write-Output "$(Get-Date) - $solutionFile - Formatting Workspace" - $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/netcoreapp2.1/dotnet-format.dll" $solution -wsa -v diag --check | Out-String + $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/netcoreapp2.1/dotnet-format.dll" $solution --no-restore -wsa -v diag --check | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. From 86e23b51f04b06389fe1e3db261e30cb568ccca0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 13:55:27 -0800 Subject: [PATCH 1360/2702] Fix formatting. --- src/Utilities/DotNetHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utilities/DotNetHelper.cs b/src/Utilities/DotNetHelper.cs index d74eeab9b9ed..d1b1edc24c89 100644 --- a/src/Utilities/DotNetHelper.cs +++ b/src/Utilities/DotNetHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.Threading.Tasks; From 333c336f8ddb49b05993ff710dc1e06df584ed24 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 14:32:23 -0800 Subject: [PATCH 1361/2702] Use csc-style format for diagnostic errors --- src/Analyzers/AnalyzerFormatter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 8554c76862eb..7840e5dc3121 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -151,7 +151,7 @@ static void LogDiagnosticLocations(Solution solution, IEnumerable di foreach (var diagnostic in diagnostics) { - var message = $"{diagnostic.GetMessage()} ({diagnostic.Id})"; + var message = $"{diagnostic.Severity.ToString().ToLower()} {diagnostic.Id}: {diagnostic.GetMessage()}"; var document = solution.GetDocument(diagnostic.Location.SourceTree); if (document is null) { From 79a0b3d0742cbc2520dbd3aa09a49c8ebd287e20 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 15:06:59 -0800 Subject: [PATCH 1362/2702] Log all formatter error messages in a csc-style. --- src/Analyzers/AnalyzerFormatter.cs | 2 +- src/Formatters/CharsetFormatter.cs | 1 + src/Formatters/DocumentFormatter.cs | 23 +++++++++---------- src/Formatters/EndOfLineFormatter.cs | 1 + src/Formatters/FinalNewlineFormatter.cs | 1 + src/Formatters/OrganizeImportsFormatter.cs | 1 + src/Formatters/UnnecessaryImportsFormatter.cs | 1 + src/Formatters/WhitespaceFormatter.cs | 1 + src/Logging/SimpleConsoleLogger.cs | 2 +- 9 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 7840e5dc3121..dc50e1925de6 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -163,7 +163,7 @@ static void LogDiagnosticLocations(Solution solution, IEnumerable di var mappedLineSpan = diagnostic.Location.GetMappedLineSpan(); var changePosition = mappedLineSpan.StartLinePosition; - var formatMessage = $"{Path.GetRelativePath(workspaceFolder, filePath)}({changePosition.Line + 1},{changePosition.Character + 1}): {message}"; + var formatMessage = $"{filePath}({changePosition.Line + 1},{changePosition.Character + 1}): {message} [{document.Project.FilePath}]"; formattedFiles.Add(new FormattedFile(document!, new[] { new FileChange(changePosition, message) })); if (changesAreErrors) diff --git a/src/Formatters/CharsetFormatter.cs b/src/Formatters/CharsetFormatter.cs index e5a2c1c2761a..e6e3cd4ab3e0 100644 --- a/src/Formatters/CharsetFormatter.cs +++ b/src/Formatters/CharsetFormatter.cs @@ -20,6 +20,7 @@ internal sealed class CharsetFormatter : DocumentFormatter private static Encoding Utf8 => new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); private static Encoding Latin1 => Encoding.GetEncoding("iso-8859-1"); + public override string Name => "CHARSET"; public override FixCategory Category => FixCategory.Whitespace; internal override Task FormatFileAsync( diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index 64e4439c9b58..a8fa402f0a01 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -20,6 +20,11 @@ internal abstract class DocumentFormatter : ICodeFormatter { protected abstract string FormatWarningDescription { get; } + ///

+ /// Gets the fix name to use when logging. + /// + public abstract string Name { get; } + /// /// Gets the fix category this formatter belongs to. /// @@ -113,7 +118,7 @@ internal abstract Task FormatFileAsync( /// Applies the changed to each formatted . ///
private async Task ApplyFileChangesAsync( - Solution solution, + Solution solution, ImmutableArray<(Document, Task<(SourceText originalText, SourceText? formattedText)>)> formattedDocuments, FormatOptions formatOptions, ILogger logger, @@ -141,7 +146,7 @@ private async Task ApplyFileChangesAsync( continue; } - var fileChanges = GetFileChanges(formatOptions, formatOptions.WorkspaceFilePath, document.FilePath, originalText, formattedText, formatOptions.ChangesAreErrors, logger); + var fileChanges = GetFileChanges(formatOptions, document, originalText, formattedText, formatOptions.ChangesAreErrors, logger); formattedFiles.Add(new FormattedFile(document, fileChanges)); formattedSolution = formattedSolution.WithDocumentText(document.Id, formattedText, PreservationMode.PreserveIdentity); @@ -150,14 +155,8 @@ private async Task ApplyFileChangesAsync( return formattedSolution; } - private ImmutableArray GetFileChanges(FormatOptions formatOptions, string workspacePath, string filePath, SourceText originalText, SourceText formattedText, bool changesAreErrors, ILogger logger) + private ImmutableArray GetFileChanges(FormatOptions formatOptions, Document document, SourceText originalText, SourceText formattedText, bool changesAreErrors, ILogger logger) { - var workspaceFolder = Path.GetDirectoryName(workspacePath); - if (workspaceFolder is null) - { - throw new Exception($"Unable to find directory name for '{workspacePath}'"); - } - var fileChanges = ImmutableArray.CreateBuilder(); var changes = formattedText.GetChangeRanges(originalText); @@ -171,16 +170,16 @@ private ImmutableArray GetFileChanges(FormatOptions formatOptions, s if (!formatOptions.SaveFormattedFiles || formatOptions.LogLevel == LogLevel.Trace) { - LogFormattingChanges(filePath, changesAreErrors, logger, workspaceFolder, fileChange); + LogFormattingChanges(document, changesAreErrors, logger, fileChange); } } return fileChanges.ToImmutable(); } - private static void LogFormattingChanges(string filePath, bool changesAreErrors, ILogger logger, string workspaceFolder, FileChange fileChange) + private void LogFormattingChanges(Document document, bool changesAreErrors, ILogger logger, FileChange fileChange) { - var formatMessage = $"{Path.GetRelativePath(workspaceFolder, filePath)}({fileChange.LineNumber},{fileChange.CharNumber}): {fileChange.FormatDescription}"; + var formatMessage = $"{document.FilePath}({fileChange.LineNumber},{fileChange.CharNumber}): error {Name}: {fileChange.FormatDescription} [{document.Project.FilePath}]"; if (changesAreErrors) { logger.LogError(formatMessage); diff --git a/src/Formatters/EndOfLineFormatter.cs b/src/Formatters/EndOfLineFormatter.cs index 203d7fc81de4..e15603f0640a 100644 --- a/src/Formatters/EndOfLineFormatter.cs +++ b/src/Formatters/EndOfLineFormatter.cs @@ -15,6 +15,7 @@ internal sealed class EndOfLineFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_end_of_line_marker; + public override string Name => "ENDOFLINE"; public override FixCategory Category => FixCategory.Whitespace; internal override Task FormatFileAsync( diff --git a/src/Formatters/FinalNewlineFormatter.cs b/src/Formatters/FinalNewlineFormatter.cs index 4113bb84d061..19c6c90250e6 100644 --- a/src/Formatters/FinalNewlineFormatter.cs +++ b/src/Formatters/FinalNewlineFormatter.cs @@ -14,6 +14,7 @@ internal sealed class FinalNewlineFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_final_newline; + public override string Name => "FINALNEWLINE"; public override FixCategory Category => FixCategory.Whitespace; internal override async Task FormatFileAsync( diff --git a/src/Formatters/OrganizeImportsFormatter.cs b/src/Formatters/OrganizeImportsFormatter.cs index 78d459bd6e8f..1ac40f1401d9 100644 --- a/src/Formatters/OrganizeImportsFormatter.cs +++ b/src/Formatters/OrganizeImportsFormatter.cs @@ -20,6 +20,7 @@ internal sealed class OrganizeImportsFormatter : DocumentFormatter protected override string FormatWarningDescription => Resources.Fix_imports_ordering; private readonly DocumentFormatter _endOfLineFormatter = new EndOfLineFormatter(); + public override string Name => "IMPORTS"; public override FixCategory Category => FixCategory.Whitespace; internal override async Task FormatFileAsync( diff --git a/src/Formatters/UnnecessaryImportsFormatter.cs b/src/Formatters/UnnecessaryImportsFormatter.cs index d9d895ef6c4d..93b4528300c1 100644 --- a/src/Formatters/UnnecessaryImportsFormatter.cs +++ b/src/Formatters/UnnecessaryImportsFormatter.cs @@ -20,6 +20,7 @@ internal sealed class UnnecessaryImportsFormatter : DocumentFormatter protected override string FormatWarningDescription => Resources.Remove_unnecessary_import; + public override string Name => IDE0005; public override FixCategory Category => FixCategory.CodeStyle; internal override async Task FormatFileAsync( diff --git a/src/Formatters/WhitespaceFormatter.cs b/src/Formatters/WhitespaceFormatter.cs index 20616b600639..b7fecac6c543 100644 --- a/src/Formatters/WhitespaceFormatter.cs +++ b/src/Formatters/WhitespaceFormatter.cs @@ -17,6 +17,7 @@ internal sealed class WhitespaceFormatter : DocumentFormatter { protected override string FormatWarningDescription => Resources.Fix_whitespace_formatting; + public override string Name => "WHITESPACE"; public override FixCategory Category => FixCategory.Whitespace; internal override async Task FormatFileAsync( diff --git a/src/Logging/SimpleConsoleLogger.cs b/src/Logging/SimpleConsoleLogger.cs index 9e73c4caf9ed..79c87c2e46cd 100644 --- a/src/Logging/SimpleConsoleLogger.cs +++ b/src/Logging/SimpleConsoleLogger.cs @@ -83,7 +83,7 @@ private void LogToConsole(IConsole console, string message, bool logToErrorStrea { if (logToErrorStream) { - console.Error.Write($" {message}{Environment.NewLine}"); + console.Error.Write($"{message}{Environment.NewLine}"); } else { From b220323872c23497a5f26140a8aad3c9e77ac225 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 15:11:30 -0800 Subject: [PATCH 1363/2702] Fix formatting --- src/Formatters/DocumentFormatter.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index a8fa402f0a01..7766f5dbc23d 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -1,9 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.IO; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; From 4e67387cfeffd96722d5ff8c85bb684ac2582439 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 16:20:03 -0800 Subject: [PATCH 1364/2702] Extract out issue logging and make it pluggable to support other formats --- src/Analyzers/AnalyzerFormatter.cs | 24 ++++++------------ src/Formatters/DocumentFormatter.cs | 17 ++----------- src/Logging/IIssueFormatter.cs | 9 +++++++ src/Logging/ILoggerExtensions.cs | 37 ++++++++++++++++++++++++++++ src/Logging/MSBuildIssueFormatter.cs | 10 ++++++++ 5 files changed, 65 insertions(+), 32 deletions(-) create mode 100644 src/Logging/IIssueFormatter.cs create mode 100644 src/Logging/ILoggerExtensions.cs create mode 100644 src/Logging/MSBuildIssueFormatter.cs diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index dc50e1925de6..081f1c1078a6 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -141,39 +141,29 @@ private async Task>> Get await _runner.RunCodeAnalysisAsync(result, analyzers, project, formattablePaths, severity, fixableCompilerDiagnostics, logger, cancellationToken).ConfigureAwait(false); } - LogDiagnosticLocations(solution, result.Diagnostics.SelectMany(kvp => kvp.Value), options.WorkspaceFilePath, options.ChangesAreErrors, logger, formattedFiles); + LogDiagnosticLocations(solution, result.Diagnostics.SelectMany(kvp => kvp.Value), options.SaveFormattedFiles, options.ChangesAreErrors, logger, options.LogLevel, formattedFiles); return result.Diagnostics.ToImmutableDictionary(kvp => kvp.Key.Id, kvp => kvp.Value.Select(diagnostic => diagnostic.Id).ToImmutableHashSet()); - static void LogDiagnosticLocations(Solution solution, IEnumerable diagnostics, string workspacePath, bool changesAreErrors, ILogger logger, List formattedFiles) + static void LogDiagnosticLocations(Solution solution, IEnumerable diagnostics, bool saveFormattedFiles, bool changesAreErrors, ILogger logger, LogLevel logLevel, List formattedFiles) { - var workspaceFolder = Path.GetDirectoryName(workspacePath) ?? workspacePath; - foreach (var diagnostic in diagnostics) { - var message = $"{diagnostic.Severity.ToString().ToLower()} {diagnostic.Id}: {diagnostic.GetMessage()}"; var document = solution.GetDocument(diagnostic.Location.SourceTree); if (document is null) { continue; } - var filePath = document.FilePath ?? document.Name; - var mappedLineSpan = diagnostic.Location.GetMappedLineSpan(); - var changePosition = mappedLineSpan.StartLinePosition; - - var formatMessage = $"{filePath}({changePosition.Line + 1},{changePosition.Character + 1}): {message} [{document.Project.FilePath}]"; - formattedFiles.Add(new FormattedFile(document!, new[] { new FileChange(changePosition, message) })); + var diagnosticPosition = mappedLineSpan.StartLinePosition; - if (changesAreErrors) + if (!saveFormattedFiles || logLevel == LogLevel.Debug) { - logger.LogError(formatMessage); - } - else - { - logger.LogWarning(formatMessage); + logger.LogDiagnosticIssue(document, diagnosticPosition, diagnostic, changesAreErrors); } + + formattedFiles.Add(new FormattedFile(document, new[] { new FileChange(diagnosticPosition, $"{diagnostic.Severity.ToString().ToLower()} {diagnostic.Id}: {diagnostic.GetMessage()}") })); } } } diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index 7766f5dbc23d..d7f82636d89c 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -166,28 +166,15 @@ private ImmutableArray GetFileChanges(FormatOptions formatOptions, D var fileChange = new FileChange(changePosition, FormatWarningDescription); fileChanges.Add(fileChange); - if (!formatOptions.SaveFormattedFiles || formatOptions.LogLevel == LogLevel.Trace) + if (!formatOptions.SaveFormattedFiles || formatOptions.LogLevel == LogLevel.Debug) { - LogFormattingChanges(document, changesAreErrors, logger, fileChange); + logger.LogFormattingIssue(document, Name, fileChange, changesAreErrors); } } return fileChanges.ToImmutable(); } - private void LogFormattingChanges(Document document, bool changesAreErrors, ILogger logger, FileChange fileChange) - { - var formatMessage = $"{document.FilePath}({fileChange.LineNumber},{fileChange.CharNumber}): error {Name}: {fileChange.FormatDescription} [{document.Project.FilePath}]"; - if (changesAreErrors) - { - logger.LogError(formatMessage); - } - else - { - logger.LogWarning(formatMessage); - } - } - protected static async Task IsSameDocumentAndVersionAsync(Document a, Document b, CancellationToken cancellationToken) { if (a == b) diff --git a/src/Logging/IIssueFormatter.cs b/src/Logging/IIssueFormatter.cs new file mode 100644 index 000000000000..e89d1323a8b7 --- /dev/null +++ b/src/Logging/IIssueFormatter.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Tools.Logging +{ + public interface IIssueFormatter + { + string FormatIssue(Document document, string severity, string issueId, int lineNumber, int charNumber, string message); + } +} diff --git a/src/Logging/ILoggerExtensions.cs b/src/Logging/ILoggerExtensions.cs new file mode 100644 index 000000000000..905559250ffa --- /dev/null +++ b/src/Logging/ILoggerExtensions.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Text; +using Microsoft.CodeAnalysis.Tools.Logging; +using Microsoft.Extensions.Logging; + +namespace Microsoft.CodeAnalysis.Tools +{ + internal static class ILoggerExtensions + { + private static readonly string s_errorSeverityString = DiagnosticSeverity.Error.ToString().ToLower(); + + public static IIssueFormatter IssueFormatter { get; set; } = new MSBuildIssueFormatter(); + + public static string LogFormattingIssue(this ILogger logger, Document document, string formatterName, FileChange fileChange, bool changesAreErrors) + => LogIssue(logger, document, s_errorSeverityString, formatterName, fileChange.LineNumber, fileChange.CharNumber, fileChange.FormatDescription, changesAreErrors); + + public static string LogDiagnosticIssue(this ILogger logger, Document document, LinePosition diagnosticPosition, Diagnostic diagnostic, bool changesAreErrors) + => LogIssue(logger, document, diagnostic.Severity.ToString().ToLower(), diagnostic.Id, diagnosticPosition.Line + 1, diagnosticPosition.Character + 1, diagnostic.GetMessage(), changesAreErrors); + + private static string LogIssue(ILogger logger, Document document, string severity, string issueId, int lineNumber, int charNumber, string message, bool changesAreErrors) + { + var formattedMessage = IssueFormatter.FormatIssue(document, severity, issueId, lineNumber, charNumber, message); + + if (changesAreErrors) + { + logger.LogError(formattedMessage); + } + else + { + logger.LogWarning(formattedMessage); + } + + return formattedMessage; + } + } +} diff --git a/src/Logging/MSBuildIssueFormatter.cs b/src/Logging/MSBuildIssueFormatter.cs new file mode 100644 index 000000000000..0793efab3054 --- /dev/null +++ b/src/Logging/MSBuildIssueFormatter.cs @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Tools.Logging +{ + internal sealed class MSBuildIssueFormatter : IIssueFormatter + { + public string FormatIssue(Document document, string severity, string issueId, int lineNumber, int charNumber, string message) + => $"{document.FilePath ?? document.Name}({lineNumber},{charNumber}): {severity} {issueId}: {message} [{document.Project.FilePath}]"; + } +} From ac00cc5c778702e167bfb2816e6bdeb9dcd7000f Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 16:50:42 -0800 Subject: [PATCH 1365/2702] Enhance whitespace issue logging with a detailed TextChange message --- src/Formatters/DocumentFormatter.cs | 25 +++++++++++++++++++++++-- src/Resources.resx | 9 +++++++++ src/xlf/Resources.cs.xlf | 15 +++++++++++++++ src/xlf/Resources.de.xlf | 15 +++++++++++++++ src/xlf/Resources.es.xlf | 15 +++++++++++++++ src/xlf/Resources.fr.xlf | 15 +++++++++++++++ src/xlf/Resources.it.xlf | 15 +++++++++++++++ src/xlf/Resources.ja.xlf | 15 +++++++++++++++ src/xlf/Resources.ko.xlf | 15 +++++++++++++++ src/xlf/Resources.pl.xlf | 15 +++++++++++++++ src/xlf/Resources.pt-BR.xlf | 15 +++++++++++++++ src/xlf/Resources.ru.xlf | 15 +++++++++++++++ src/xlf/Resources.tr.xlf | 15 +++++++++++++++ src/xlf/Resources.zh-Hans.xlf | 15 +++++++++++++++ src/xlf/Resources.zh-Hant.xlf | 15 +++++++++++++++ 15 files changed, 227 insertions(+), 2 deletions(-) diff --git a/src/Formatters/DocumentFormatter.cs b/src/Formatters/DocumentFormatter.cs index 64e4439c9b58..18850fb9019e 100644 --- a/src/Formatters/DocumentFormatter.cs +++ b/src/Formatters/DocumentFormatter.cs @@ -159,14 +159,16 @@ private ImmutableArray GetFileChanges(FormatOptions formatOptions, s } var fileChanges = ImmutableArray.CreateBuilder(); - var changes = formattedText.GetChangeRanges(originalText); + var changes = formattedText.GetTextChanges(originalText); for (var index = 0; index < changes.Count; index++) { var change = changes[index]; + var changeMessage = BuildChangeMessage(change); + var changePosition = originalText.Lines.GetLinePosition(change.Span.Start); - var fileChange = new FileChange(changePosition, FormatWarningDescription); + var fileChange = new FileChange(changePosition, $"{FormatWarningDescription}{changeMessage}"); fileChanges.Add(fileChange); if (!formatOptions.SaveFormattedFiles || formatOptions.LogLevel == LogLevel.Trace) @@ -176,6 +178,25 @@ private ImmutableArray GetFileChanges(FormatOptions formatOptions, s } return fileChanges.ToImmutable(); + + static string BuildChangeMessage(TextChange change) + { + var isDelete = string.IsNullOrEmpty(change.NewText); + var isAdd = change.Span.Length == 0; + if (isDelete && isAdd) + { + return string.Empty; + } + + // Escape characters in the text changes so that it can be more easily read. + var textChange = change.NewText?.Replace(" ", "\\s").Replace("\t", "\\t").Replace("\n", "\\n").Replace("\r", "\\r"); + var message = isDelete + ? string.Format(Resources.Delete_0_characters, change.Span.Length) + : isAdd + ? string.Format(Resources.Insert_0, textChange) + : string.Format(Resources.Replace_0_characters_with_1, change.Span.Length, textChange); + return $" {message}"; + } } private static void LogFormattingChanges(string filePath, bool changesAreErrors, ILogger logger, string workspaceFolder, FileChange fileChange) diff --git a/src/Resources.resx b/src/Resources.resx index 3f5cae89cff3..3df29ecc2672 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -312,4 +312,13 @@ Project {0} is using configuration from '{1}'. + + Delete {0} characters. + + + Insert '{0}'. + + + Replace {0} characters with '{1}'. + \ No newline at end of file diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 9c24173201fc..8690b56e7375 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -72,6 +72,11 @@ {0} nejde formátovat. Formátovat jde v současné době jenom projekty v jazycích C# a Visual Basic. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... Zjišťuje se diagnostika... @@ -152,6 +157,11 @@ Zahrňte do operací formátování vygenerované soubory kódu. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. Načítá se pracovní prostor. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 661bd22842fe..9e1bc2e10a3b 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -72,6 +72,11 @@ "{0}" konnte nicht formatiert werden. Derzeit wird die Formatierung nur für C#- und Visual Basic-Projekte unterstützt. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... Diagnose wird ermittelt... @@ -152,6 +157,11 @@ Hiermit werden generierte Codedateien in Formatierungsvorgänge einbezogen. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. Arbeitsbereich wird geladen. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 241faf51062a..50fd71207085 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -72,6 +72,11 @@ No se pudo dar formato a "{0}". El formato admite solo proyectos de C# y Visual Basic en este momento. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... Determinando los diagnósticos... @@ -152,6 +157,11 @@ Incluya los archivos de código generados en las operaciones de formato. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. Cargando área de trabajo. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index 4e39052f2f02..58c3c70de32d 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -72,6 +72,11 @@ Impossible de mettre en forme '{0}'. L'opération Mettre en forme prend uniquement en charge les projets C# et Visual Basic pour le moment. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... Détermination des diagnostics... @@ -152,6 +157,11 @@ Ajoutez des fichiers de code générés dans les opérations de mise en forme. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. Chargement de l'espace de travail. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index 467d3385f185..c408172201c4 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -72,6 +72,11 @@ Non è stato possibile formattare '{0}'. Il formato supporta attualmente solo progetti C# e Visual Basic. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... Determinazione della diagnostica... @@ -152,6 +157,11 @@ Includere i file del codice generato nelle operazioni di formattazione. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. Caricamento dell'area di lavoro. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index e5b98932fa21..6f670844e6ac 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -72,6 +72,11 @@ '{0}' をフォーマットできませんでした。フォーマットは、C# および Visual Basic のプロジェクトでのみサポートされています。 + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... 診断を決定しています... @@ -152,6 +157,11 @@ 生成されたコード ファイルを書式設定操作に含めます。 + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. ワークスペースを読み込んでいます。 @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index cdedac47b65c..9e44cd4d2fe5 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -72,6 +72,11 @@ '{0}'의 서식을 지정할 수 없습니다. 서식 지정은 현재 C# 및 Visual Basic 프로젝트만 지원합니다. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... 진단을 확인하는 중... @@ -152,6 +157,11 @@ 서식 지정 작업에서 생성된 코드 파일을 포함합니다. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. 작업 영역을 로드하는 중입니다. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index 022d7fc182ab..175f2d84a478 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -72,6 +72,11 @@ Nie można sformatować elementu „{0}”. Obecnie format obsługuje tylko projekty C# i Visual Basic. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... Trwa określanie diagnostyki... @@ -152,6 +157,11 @@ Uwzględnij wygenerowane pliki kodu w operacjach formatowania. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. Ładowanie obszaru roboczego. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index 5728116f8a9f..7c87ed614cfc 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -72,6 +72,11 @@ Não foi possível formatar '{0}'. O formato atualmente suporta apenas projetos do Visual Basic e C#. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... Determinando os diagnósticos... @@ -152,6 +157,11 @@ Incluir arquivos de código gerados em operações de formatação. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. Carregando espaço de trabalho. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 2947c5d82fcd..7d1cb6fc9dd6 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -72,6 +72,11 @@ Не удалось отформатировать "{0}". Форматирование сейчас поддерживается только для проектов C# и Visual Basic. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... Определение диагностики… @@ -152,6 +157,11 @@ Включить созданные файлы кода в операции форматирования. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. Загрузка рабочей области. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index b307a38ba27a..568269c8793f 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -72,6 +72,11 @@ '{0}' biçiminde değil. Biçimi şu anda yalnızca C# ve Visual Basic projeleri desteklemektedir. + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... Tanılama belirleniyor... @@ -152,6 +157,11 @@ Biçimlendirme işlemlerinde oluşturulan kod dosyalarını ekleyin. + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. Çalışma alanı yükleniyor. @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index 2d8f53cf8bdc..6f06c6f56f45 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -72,6 +72,11 @@ 无法设置“{0}”的格式。该格式当前仅支持 C# 和 Visual Basic 项目。 + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... 正在确定诊断… @@ -152,6 +157,11 @@ 在格式化操作中包含所生成的代码文件。 + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. 正在加载工作区。 @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 1435b741b422..3b4b93e99ecc 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -72,6 +72,11 @@ 無法將 '{0}' 格式化。格式化目前只支援 C# 和 Visual Basic 專案。 + + Delete {0} characters. + Delete {0} characters. + + Determining diagnostics... 正在判斷診斷... @@ -152,6 +157,11 @@ 在格式化作業中包含產生的程式碼檔案。 + + Insert '{0}'. + Insert '{0}'. + + Loading workspace. 正在載入工作區。 @@ -172,6 +182,11 @@ Project {0} is using configuration from '{1}'. + + Replace {0} characters with '{1}'. + Replace {0} characters with '{1}'. + + Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. Required references did not load for {0} or referenced project. Run `dotnet restore` prior to formatting. From 5ac861d978811a0fa4cfefa6376d74b96f57a03d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 26 Feb 2021 16:56:35 -0800 Subject: [PATCH 1366/2702] Fix formatting. --- src/Analyzers/AnalyzerFormatter.cs | 1 - src/Logging/IIssueFormatter.cs | 2 +- src/Logging/ILoggerExtensions.cs | 2 +- src/Logging/MSBuildIssueFormatter.cs | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 081f1c1078a6..b4ef67df67ff 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/src/Logging/IIssueFormatter.cs b/src/Logging/IIssueFormatter.cs index e89d1323a8b7..b2da7937cc3e 100644 --- a/src/Logging/IIssueFormatter.cs +++ b/src/Logging/IIssueFormatter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. namespace Microsoft.CodeAnalysis.Tools.Logging { diff --git a/src/Logging/ILoggerExtensions.cs b/src/Logging/ILoggerExtensions.cs index 905559250ffa..0adaa9503013 100644 --- a/src/Logging/ILoggerExtensions.cs +++ b/src/Logging/ILoggerExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Tools.Logging; diff --git a/src/Logging/MSBuildIssueFormatter.cs b/src/Logging/MSBuildIssueFormatter.cs index 0793efab3054..bbcb8f539890 100644 --- a/src/Logging/MSBuildIssueFormatter.cs +++ b/src/Logging/MSBuildIssueFormatter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. namespace Microsoft.CodeAnalysis.Tools.Logging { From 48777c3ed7e2cf56037252cfd2460218d532ba9d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 27 Feb 2021 13:17:51 +0000 Subject: [PATCH 1367/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210227.6 (#1018) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9623b08a8b42..ec859dec8a6e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - dcb26800f22490adc754a430f6ee80edacacc0f2 + f2eff7c14183c8eebb968988a922abac9618a1fc diff --git a/eng/Versions.props b/eng/Versions.props index 41c2d24c1f39..a4ab3aa7eed1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-2.21125.24 + 3.10.0-2.21127.6 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From 7b75c31ec1bc41385b74baef0acf0fc19157200b Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Sun, 28 Feb 2021 15:09:46 -0800 Subject: [PATCH 1368/2702] Reenabled .NET Core 2.1 support --- src/dotnet-format.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 6ce02427c31a..188a3bde1d2b 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -19,7 +19,7 @@ true - 2.1.0-rc1 + 2.1.0 LatestMajor true From 406fd9ee2ffee75ae39b3477358746b88f070fd9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 13:18:09 +0000 Subject: [PATCH 1369/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210301.4 (#1022) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ec859dec8a6e..312cd4cf841b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - f2eff7c14183c8eebb968988a922abac9618a1fc + c933ed58c3edd70916d2fd676db49c40035b5cac diff --git a/eng/Versions.props b/eng/Versions.props index a4ab3aa7eed1..7cddf9d080e1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,7 +16,7 @@ 0.12.1 15.3.409 - 3.10.0-2.21127.6 + 3.10.0-2.21151.4 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 From d8571de967050dcd35d82e7072393a7fa6c9a6b2 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Mon, 1 Mar 2021 09:31:53 -0800 Subject: [PATCH 1370/2702] expand try block --- src/Analyzers/SolutionCodeFixApplier.cs | 81 +++++++++++++------------ 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index c9ae6bfa6b0b..4ae797e732ad 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; + using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.Extensions.Logging; @@ -22,54 +23,54 @@ public async Task ApplyCodeFixesAsync( ILogger logger, CancellationToken cancellationToken) { - var fixAllProvider = codeFix.GetFixAllProvider(); - if (fixAllProvider?.GetSupportedFixAllScopes()?.Contains(FixAllScope.Solution) != true) + try { - logger.LogWarning(Resources.Unable_to_fix_0_Code_fix_1_doesnt_support_Fix_All_in_Solution, diagnosticId, codeFix.GetType().Name); - return solution; - } - - var diagnostic = result.Diagnostics - .SelectMany(kvp => kvp.Value) - .Where(diagnostic => diagnostic.Location.SourceTree != null) - .FirstOrDefault(); + var fixAllProvider = codeFix.GetFixAllProvider(); + if (fixAllProvider?.GetSupportedFixAllScopes()?.Contains(FixAllScope.Solution) != true) + { + logger.LogWarning(Resources.Unable_to_fix_0_Code_fix_1_doesnt_support_Fix_All_in_Solution, diagnosticId, codeFix.GetType().Name); + return solution; + } - if (diagnostic is null) - { - return solution; - } + var diagnostic = result.Diagnostics + .SelectMany(kvp => kvp.Value) + .Where(diagnostic => diagnostic.Location.SourceTree != null) + .FirstOrDefault(); - var document = solution.GetDocument(diagnostic.Location.SourceTree); + if (diagnostic is null) + { + return solution; + } - if (document is null) - { - return solution; - } + var document = solution.GetDocument(diagnostic.Location.SourceTree); - CodeAction? action = null; - var context = new CodeFixContext(document, diagnostic, - (a, _) => + if (document is null) { - if (action == null) + return solution; + } + + CodeAction? action = null; + var context = new CodeFixContext(document, diagnostic, + (a, _) => { - action = a; - } - }, - cancellationToken); - - await codeFix.RegisterCodeFixesAsync(context).ConfigureAwait(false); - - var fixAllContext = new FixAllContext( - document: document, - codeFixProvider: codeFix, - scope: FixAllScope.Solution, - codeActionEquivalenceKey: action?.EquivalenceKey!, // FixAllState supports null equivalence key. This should still be supported. - diagnosticIds: new[] { diagnosticId }, - fixAllDiagnosticProvider: new DiagnosticProvider(result), - cancellationToken: cancellationToken); + if (action == null) + { + action = a; + } + }, + cancellationToken); + + await codeFix.RegisterCodeFixesAsync(context).ConfigureAwait(false); + + var fixAllContext = new FixAllContext( + document: document, + codeFixProvider: codeFix, + scope: FixAllScope.Solution, + codeActionEquivalenceKey: action?.EquivalenceKey!, // FixAllState supports null equivalence key. This should still be supported. + diagnosticIds: new[] { diagnosticId }, + fixAllDiagnosticProvider: new DiagnosticProvider(result), + cancellationToken: cancellationToken); - try - { var fixAllAction = await fixAllProvider.GetFixAsync(fixAllContext).ConfigureAwait(false); if (fixAllAction is null) { From 872559b3469694a6ff369a38fe177e9e50f15812 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Mon, 1 Mar 2021 10:11:26 -0800 Subject: [PATCH 1371/2702] use central package management --- .gitignore | 1 + Directory.Build.props | 8 +++++ Directory.Packages.props | 47 ++++++++++++++++++++++++++ eng/Versions.props | 30 ----------------- perf/dotnet-format.Performance.csproj | 4 +-- src/dotnet-format.csproj | 48 +++++++++++++-------------- tests/dotnet-format.UnitTests.csproj | 38 ++++++++++----------- 7 files changed, 101 insertions(+), 75 deletions(-) create mode 100644 Directory.Packages.props diff --git a/.gitignore b/.gitignore index 49fa1d588d75..c0582a8dc342 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ bld/ [Oo]bj/ [Ll]og/ [Tt]emp/ +**/packages.lock.json # Visual Studio 2015/2017 cache/options directory .vs/ diff --git a/Directory.Build.props b/Directory.Build.props index a430b5ef27ad..88d303eefe88 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,6 +6,14 @@ + + + + true + + true + + $(CopyrightMicrosoft) MIT diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 000000000000..e9842bb715ba --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,47 @@ + + + + + 15.3.409 + 5.0.0-preview.7.20364.11 + + 5.8.0-preview.3.6823 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eng/Versions.props b/eng/Versions.props index 7cddf9d080e1..e668c8d5b83d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,42 +13,12 @@ true - 0.12.1 - 15.3.409 3.10.0-2.21151.4 - 5.0.0-preview.7.20364.11 - - 5.8.0-preview.3.6823 - - $(BenchmarkDotNetVersion) - 2.0.0-beta1.20371.2 - 0.3.0-alpha.20371.2 - $(MicrosoftBuildVersion) - 1.2.6 - 1.0.1-beta1.20413.3 - $(MicrosoftExtensionsVersion) - $(MicrosoftExtensionsVersion) - $(MicrosoftExtensionsVersion) - 3.3.0 - $(MicrosoftNETCoreCompilersPackageVersion) - $(NuGetVersion) - $(NuGetVersion) - $(NuGetVersion) - $(NuGetVersion) - $(NuGetVersion) - $(NuGetVersion) - $(MicrosoftExtensionsVersion) - - 12.0.2 - true diff --git a/perf/dotnet-format.Performance.csproj b/perf/dotnet-format.Performance.csproj index 696025494bd7..c4a99d2e17c7 100644 --- a/perf/dotnet-format.Performance.csproj +++ b/perf/dotnet-format.Performance.csproj @@ -9,8 +9,8 @@ Release
- - + + diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 6ce02427c31a..4287e6dc5c75 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -33,35 +33,35 @@
- - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 80bdcd994ed6..d903ec4fce49 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -24,30 +24,30 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + From c0a0fc002a75419df4658278f52911f64cdf256d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 2 Mar 2021 13:17:32 +0000 Subject: [PATCH 1372/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210302.18 (#1029) [master] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 312cd4cf841b..d49bd44bef3d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c933ed58c3edd70916d2fd676db49c40035b5cac + cd57586b0a1f998e46f0cedc1d4ae25f9d5408f8 diff --git a/eng/Versions.props b/eng/Versions.props index e668c8d5b83d..a8d7f65a0097 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 3.10.0-2.21151.4 + 3.10.0-2.21152.18 - + 15.3.409 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 - + @@ -15,7 +15,7 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 20d1c931eefd..e31ad79103ee 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - cd57586b0a1f998e46f0cedc1d4ae25f9d5408f8 + 9f95d538a8836b5f36c7ec374eb8be917824fee3 diff --git a/eng/Versions.props b/eng/Versions.props index a8d7f65a0097..81e40939c3e1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 3.10.0-2.21152.18 + 3.10.0-2.21156.4 - 3.10.0-2.21156.4 + 3.10.0-2.21159.8 - 3.10.0-2.21159.8 + 3.10.0-2.21160.8 - 3.10.0-2.21160.8 + 3.10.0-2.21161.2 - 3.10.0-2.21161.2 + 3.10.0-2.21162.18 - 3.10.0-2.21162.18 + 3.10.0-2.21163.2 - 3.10.0-2.21163.2 + 3.10.0-2.21165.4 - 3.10.0-2.21165.4 + 3.10.0-2.21166.2 - 3.10.0-2.21166.2 + 3.10.0-2.21166.52 - 3.10.0-2.21166.52 + 3.10.0-2.21168.6 - 3.10.0-2.21168.6 + 3.10.0-2.21169.14 - 3.10.0-2.21169.14 + 3.10.0-2.21169.30 - 3.10.0-2.21169.30 + 3.10.0-2.21170.16 - 3.10.0-2.21170.16 + 3.10.0-2.21173.8 - 3.10.0-2.21173.8 + 3.10.0-2.21175.26 - 3.10.0-2.21175.26 + 3.10.0-2.21177.2 - 3.10.0-2.21177.2 + 3.10.0-2.21178.4 - 3.10.0-2.21178.4 + 3.10.0-2.21180.20 - 3.10.0-2.21180.20 + 3.10.0-3.21181.10 - 3.10.0-3.21181.10 + 3.10.0-3.21201.10 - 3.10.0-3.21201.10 + 3.10.0-3.21202.20 - 3.10.0-3.21202.20 + 3.10.0-3.21205.4 - 3.10.0-3.21205.4 + 3.10.0-3.21206.28 - 3.10.0-3.21206.28 + 3.10.0-3.21208.2 - 3.10.0-3.21208.2 + 3.10.0-3.21208.16 -
\ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 08135adcfa96..edd89ca694a1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -113,7 +113,7 @@ jobs: vmImage: 'ubuntu-latest' timeoutInMinutes: 5 steps: - - script: ./restore.sh && dotnet run --project ./src/dotnet-format.csproj -c Release -- @validate.rsp + - script: ./restore.sh && ./.dotnet/dotnet run --project ./src/dotnet-format.csproj -c Release -- @validate.rsp displayName: Build and Run dotnet-format - task: PublishBuildArtifacts@1 displayName: Publish Logs diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b43722613a5d..4eaa0fdf02c4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 7f13798e5f567b72ffe63205bf49839245f0f8c1 + 814754c257edd24aeff89615106e4557d07632d8
diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh index 42516bbeebc3..c29c8267e7a4 100755 --- a/eng/common/cross/build-android-rootfs.sh +++ b/eng/common/cross/build-android-rootfs.sh @@ -106,6 +106,7 @@ __AndroidPackages+=" libandroid-glob" __AndroidPackages+=" liblzma" __AndroidPackages+=" krb5" __AndroidPackages+=" openssl" +__AndroidPackages+=" openldap" for path in $(wget -qO- http://termux.net/dists/stable/main/binary-$__AndroidArch/Packages |\ grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index b26622444f5b..81e641a57b53 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -55,11 +55,13 @@ __UbuntuPackages+=" libcurl4-openssl-dev" __UbuntuPackages+=" libkrb5-dev" __UbuntuPackages+=" libssl-dev" __UbuntuPackages+=" zlib1g-dev" +__UbuntuPackages+=" libldap2-dev" __AlpinePackages+=" curl-dev" __AlpinePackages+=" krb5-dev" __AlpinePackages+=" openssl-dev" __AlpinePackages+=" zlib-dev" +__AlpinePackages+=" openldap-dev" __FreeBSDBase="12.1-RELEASE" __FreeBSDPkg="1.12.0" @@ -68,11 +70,13 @@ __FreeBSDPackages+=" icu" __FreeBSDPackages+=" libinotify" __FreeBSDPackages+=" lttng-ust" __FreeBSDPackages+=" krb5" +__FreeBSDPackages+=" libslapi-2.4" __IllumosPackages="icu-64.2nb2" __IllumosPackages+=" mit-krb5-1.16.2nb4" __IllumosPackages+=" openssl-1.1.1e" __IllumosPackages+=" zlib-1.2.11" +__IllumosPackages+=" openldap-client-2.4.49" __UseMirror=0 diff --git a/eng/common/generate-locproject.ps1 b/eng/common/generate-locproject.ps1 new file mode 100644 index 000000000000..7225ddc66690 --- /dev/null +++ b/eng/common/generate-locproject.ps1 @@ -0,0 +1,101 @@ +Param( + [Parameter(Mandatory=$true)][string] $SourcesDirectory, # Directory where source files live; if using a Localize directory it should live in here + [string] $LanguageSet = 'VS_Main_Languages', # Language set to be used in the LocProject.json + [switch] $UseCheckedInLocProjectJson, # When set, generates a LocProject.json and compares it to one that already exists in the repo; otherwise just generates one + [switch] $CreateNeutralXlfs # Creates neutral xlf files. Only set to false when running locally +) + +# Generates LocProject.json files for the OneLocBuild task. OneLocBuildTask is described here: +# https://ceapex.visualstudio.com/CEINTL/_wiki/wikis/CEINTL.wiki/107/Localization-with-OneLocBuild-Task + +Set-StrictMode -Version 2.0 +$ErrorActionPreference = "Stop" +. $PSScriptRoot\tools.ps1 + +Import-Module -Name (Join-Path $PSScriptRoot 'native\CommonLibrary.psm1') + +$exclusionsFilePath = "$SourcesDirectory\Localize\LocExclusions.json" +$exclusions = @{ Exclusions = @() } +if (Test-Path -Path $exclusionsFilePath) +{ + $exclusions = Get-Content "$exclusionsFilePath" | ConvertFrom-Json +} + +Push-Location "$SourcesDirectory" # push location for Resolve-Path -Relative to work + +# Template files +$jsonFiles = @() +$jsonFiles += Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\en\..+\.json" } # .NET templating pattern +$jsonFiles += Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern + +$xlfFiles = @() + +$allXlfFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory\*\*.xlf" +$langXlfFiles = @() +if ($allXlfFiles) { + $null = $allXlfFiles[0].FullName -Match "\.([\w-]+)\.xlf" # matches '[langcode].xlf' + $firstLangCode = $Matches.1 + $langXlfFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory\*\*.$firstLangCode.xlf" +} +$langXlfFiles | ForEach-Object { + $null = $_.Name -Match "(.+)\.[\w-]+\.xlf" # matches '[filename].[langcode].xlf + + $destinationFile = "$($_.Directory.FullName)\$($Matches.1).xlf" + $xlfFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru +} + +$locFiles = $jsonFiles + $xlfFiles + +$locJson = @{ + Projects = @( + @{ + LanguageSet = $LanguageSet + LocItems = @( + $locFiles | ForEach-Object { + $outputPath = "$(($_.DirectoryName | Resolve-Path -Relative) + "\")" + $continue = $true + foreach ($exclusion in $exclusions.Exclusions) { + if ($outputPath.Contains($exclusion)) + { + $continue = $false + } + } + $sourceFile = ($_.FullName | Resolve-Path -Relative) + if (!$CreateNeutralXlfs -and $_.Extension -eq '.xlf') { + Remove-Item -Path $sourceFile + } + if ($continue) + { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnName" + OutputPath = $outputPath + } + } + } + ) + } + ) +} + +$json = ConvertTo-Json $locJson -Depth 5 +Write-Host "LocProject.json generated:`n`n$json`n`n" +Pop-Location + +if (!$UseCheckedInLocProjectJson) { + New-Item "$SourcesDirectory\Localize\LocProject.json" -Force # Need this to make sure the Localize directory is created + Set-Content "$SourcesDirectory\Localize\LocProject.json" $json +} +else { + New-Item "$SourcesDirectory\Localize\LocProject-generated.json" -Force # Need this to make sure the Localize directory is created + Set-Content "$SourcesDirectory\Localize\LocProject-generated.json" $json + + if ((Get-FileHash "$SourcesDirectory\Localize\LocProject-generated.json").Hash -ne (Get-FileHash "$SourcesDirectory\Localize\LocProject.json").Hash) { + Write-PipelineTelemetryError -Category "OneLocBuild" -Message "Existing LocProject.json differs from generated LocProject.json. Download LocProject-generated.json and compare them." + + exit 1 + } + else { + Write-Host "Generated LocProject.json and current LocProject.json are identical." + } +} \ No newline at end of file diff --git a/eng/common/performance/blazor_perf.proj b/eng/common/performance/blazor_perf.proj deleted file mode 100644 index 3b25359c4380..000000000000 --- a/eng/common/performance/blazor_perf.proj +++ /dev/null @@ -1,30 +0,0 @@ - - - python3 - $(HelixPreCommands);chmod +x $HELIX_WORKITEM_PAYLOAD/SOD/SizeOnDisk - - - - - %(Identity) - - - - - %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\ - $(ScenarioDirectory)blazor\ - - - $HELIX_CORRELATION_PAYLOAD/performance/src/scenarios/ - $(ScenarioDirectory)blazor/ - - - - - $(WorkItemDirectory) - cd $(BlazorDirectory);$(Python) pre.py publish --msbuild %27/p:_TrimmerDumpDependencies=true%27 --msbuild-static AdditionalMonoLinkerOptions=%27"%24(AdditionalMonoLinkerOptions) --dump-dependencies"%27 --binlog %27./traces/blazor_publish.binlog%27 - $(Python) test.py sod --scenario-name "%(Identity)" - $(Python) post.py - - - \ No newline at end of file diff --git a/eng/common/performance/crossgen_perf.proj b/eng/common/performance/crossgen_perf.proj deleted file mode 100644 index eb8bdd9c440c..000000000000 --- a/eng/common/performance/crossgen_perf.proj +++ /dev/null @@ -1,110 +0,0 @@ - - - - - %(Identity) - - - - - - py -3 - $(HelixPreCommands) - %HELIX_CORRELATION_PAYLOAD%\Core_Root - %HELIX_CORRELATION_PAYLOAD%\performance\src\scenarios\ - $(ScenarioDirectory)crossgen\ - $(ScenarioDirectory)crossgen2\ - - - python3 - $(HelixPreCommands);chmod +x $HELIX_WORKITEM_PAYLOAD/startup/Startup;chmod +x $HELIX_WORKITEM_PAYLOAD/startup/perfcollect;sudo apt update;chmod +x $HELIX_WORKITEM_PAYLOAD/SOD/SizeOnDisk - $HELIX_CORRELATION_PAYLOAD/Core_Root - $HELIX_CORRELATION_PAYLOAD/performance/src/scenarios/ - $(ScenarioDirectory)crossgen/ - $(ScenarioDirectory)crossgen2/ - - - - - - - - - - - - - - - - - - - - - - - $(WorkItemDirectory) - $(Python) $(CrossgenDirectory)test.py crossgen --core-root $(CoreRoot) --test-name %(Identity) - - - - - - $(WorkItemDirectory) - $(Python) $(Crossgen2Directory)test.py crossgen2 --core-root $(CoreRoot) --single %(Identity) - - - - - - $(WorkItemDirectory) - $(Python) $(Crossgen2Directory)test.py crossgen2 --core-root $(CoreRoot) --single %(Identity) --singlethreaded True - - - - - - $(WorkItemDirectory) - $(Python) $(CrossgenDirectory)pre.py crossgen --core-root $(CoreRoot) --single %(Identity) - $(Python) $(CrossgenDirectory)test.py sod --scenario-name "Crossgen %(Identity) Size" --dirs ./crossgen.out/ - $(Python) $(CrossgenDirectory)post.py - - - - - - $(WorkItemDirectory) - $(Python) $(Crossgen2Directory)pre.py crossgen2 --core-root $(CoreRoot) --single %(Identity) - $(Python) $(Crossgen2Directory)test.py sod --scenario-name "Crossgen2 %(Identity) Size" --dirs ./crossgen.out/ - $(Python) $(Crossgen2Directory)post.py - - - - - - - 4:00 - - - - 4:00 - - - 4:00 - - - $(WorkItemDirectory) - $(Python) $(Crossgen2Directory)test.py crossgen2 --core-root $(CoreRoot) --composite $(Crossgen2Directory)framework-r2r.dll.rsp - 1:00 - - - 4:00 - - - 4:00 - - - \ No newline at end of file diff --git a/eng/common/performance/microbenchmarks.proj b/eng/common/performance/microbenchmarks.proj deleted file mode 100644 index 318ca5f1b8d4..000000000000 --- a/eng/common/performance/microbenchmarks.proj +++ /dev/null @@ -1,144 +0,0 @@ - - - - %HELIX_CORRELATION_PAYLOAD%\performance\scripts\benchmarks_ci.py --csproj %HELIX_CORRELATION_PAYLOAD%\performance\$(TargetCsproj) - --dotnet-versions %DOTNET_VERSION% --cli-source-info args --cli-branch %PERFLAB_BRANCH% --cli-commit-sha %PERFLAB_HASH% --cli-repository https://github.com/%PERFLAB_REPO% --cli-source-timestamp %PERFLAB_BUILDTIMESTAMP% - py -3 - %HELIX_CORRELATION_PAYLOAD%\Core_Root\CoreRun.exe - %HELIX_CORRELATION_PAYLOAD%\Baseline_Core_Root\CoreRun.exe - - $(HelixPreCommands);call %HELIX_CORRELATION_PAYLOAD%\performance\tools\machine-setup.cmd;set PYTHONPATH=%HELIX_WORKITEM_PAYLOAD%\scripts%3B%HELIX_WORKITEM_PAYLOAD% - %HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts - %HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts_Baseline - %HELIX_CORRELATION_PAYLOAD%\performance\src\tools\ResultsComparer\ResultsComparer.csproj - %HELIX_CORRELATION_PAYLOAD%\performance\tools\dotnet\$(Architecture)\dotnet.exe - %25%25 - %HELIX_WORKITEM_ROOT%\testResults.xml - - - - $HELIX_CORRELATION_PAYLOAD - $(BaseDirectory)/performance - - - - $HELIX_WORKITEM_PAYLOAD - $(BaseDirectory) - - - - $(PerformanceDirectory)/scripts/benchmarks_ci.py --csproj $(PerformanceDirectory)/$(TargetCsproj) - --dotnet-versions $DOTNET_VERSION --cli-source-info args --cli-branch $PERFLAB_BRANCH --cli-commit-sha $PERFLAB_HASH --cli-repository https://github.com/$PERFLAB_REPO --cli-source-timestamp $PERFLAB_BUILDTIMESTAMP - python3 - $(BaseDirectory)/Core_Root/corerun - $(BaseDirectory)/Baseline_Core_Root/corerun - $(HelixPreCommands);chmod +x $(PerformanceDirectory)/tools/machine-setup.sh;. $(PerformanceDirectory)/tools/machine-setup.sh - $(BaseDirectory)/artifacts/BenchmarkDotNet.Artifacts - $(BaseDirectory)/artifacts/BenchmarkDotNet.Artifacts_Baseline - $(PerformanceDirectory)/src/tools/ResultsComparer/ResultsComparer.csproj - $(PerformanceDirectory)/tools/dotnet/$(Architecture)/dotnet - %25 - $HELIX_WORKITEM_ROOT/testResults.xml - - - - $(CliArguments) --wasm - - - - --corerun %HELIX_CORRELATION_PAYLOAD%\dotnet-mono\shared\Microsoft.NETCore.App\6.0.0\corerun.exe - - - --corerun $(BaseDirectory)/dotnet-mono/shared/Microsoft.NETCore.App/6.0.0/corerun - - - - --corerun $(CoreRun) - - - - --corerun $(BaselineCoreRun) - - - - $(Python) $(WorkItemCommand) --incremental no --architecture $(Architecture) -f $(_Framework) $(PerfLabArguments) - - - - $(WorkItemCommand) $(CliArguments) - - - - 2:30 - 0:15 - - - - - %(Identity) - - - - - 30 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - - - - - - $(WorkItemDirectory) - $(WorkItemCommand) --bdn-artifacts $(BaselineArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" - $(WorkItemCommand) --bdn-artifacts $(ArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" - $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults);$(FinalCommand) - $(WorkItemTimeout) - - - - - - $(WorkItemDirectory) - $(WorkItemCommand) --bdn-artifacts $(BaselineArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument)" - $(WorkItemCommand) --bdn-artifacts $(ArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument)" - $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults) - 4:00 - - - diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 deleted file mode 100644 index 9a64b07e692f..000000000000 --- a/eng/common/performance/performance-setup.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -Param( - [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, - [string] $CoreRootDirectory, - [string] $BaselineCoreRootDirectory, - [string] $Architecture="x64", - [string] $Framework="net5.0", - [string] $CompilationMode="Tiered", - [string] $Repository=$env:BUILD_REPOSITORY_NAME, - [string] $Branch=$env:BUILD_SOURCEBRANCH, - [string] $CommitSha=$env:BUILD_SOURCEVERSION, - [string] $BuildNumber=$env:BUILD_BUILDNUMBER, - [string] $RunCategories="Libraries Runtime", - [string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj", - [string] $Kind="micro", - [switch] $LLVM, - [switch] $MonoInterpreter, - [switch] $MonoAOT, - [switch] $Internal, - [switch] $Compare, - [string] $MonoDotnet="", - [string] $Configurations="CompilationMode=$CompilationMode RunKind=$Kind", - [string] $LogicalMachine="" -) - -$RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") -or ($Repository -eq "dotnet-performance") -$UseCoreRun = ($CoreRootDirectory -ne [string]::Empty) -$UseBaselineCoreRun = ($BaselineCoreRootDirectory -ne [string]::Empty) - -$PayloadDirectory = (Join-Path $SourceDirectory "Payload") -$PerformanceDirectory = (Join-Path $PayloadDirectory "performance") -$WorkItemDirectory = (Join-Path $SourceDirectory "workitem") -$ExtraBenchmarkDotNetArguments = "--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" -$Creator = $env:BUILD_DEFINITIONNAME -$PerfLabArguments = "" -$HelixSourcePrefix = "pr" - -$Queue = "" - -if ($Internal) { - switch ($LogicalMachine) { - "perftiger" { $Queue = "Windows.10.Amd64.19H1.Tiger.Perf" } - "perfowl" { $Queue = "Windows.10.Amd64.20H2.Owl.Perf" } - "perfsurf" { $Queue = "Windows.10.Arm64.Perf.Surf" } - Default { $Queue = "Windows.10.Amd64.19H1.Tiger.Perf" } - } - $PerfLabArguments = "--upload-to-perflab-container" - $ExtraBenchmarkDotNetArguments = "" - $Creator = "" - $HelixSourcePrefix = "official" -} -else { - $Queue = "Windows.10.Amd64.ClientRS4.DevEx.15.8.Open" -} - -if($MonoInterpreter) -{ - $ExtraBenchmarkDotNetArguments = "--category-exclusion-filter NoInterpreter" -} - -if($MonoDotnet -ne "") -{ - $Configurations += " LLVM=$LLVM MonoInterpreter=$MonoInterpreter MonoAOT=$MonoAOT" - if($ExtraBenchmarkDotNetArguments -eq "") - { - #FIX ME: We need to block these tests as they don't run on mono for now - $ExtraBenchmarkDotNetArguments = "--exclusion-filter *Perf_Image* *Perf_NamedPipeStream*" - } - else - { - #FIX ME: We need to block these tests as they don't run on mono for now - $ExtraBenchmarkDotNetArguments += " --exclusion-filter *Perf_Image* *Perf_NamedPipeStream*" - } -} - -# FIX ME: This is a workaround until we get this from the actual pipeline -$CommonSetupArguments="--channel master --queue $Queue --build-number $BuildNumber --build-configs $Configurations --architecture $Architecture" -$SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments" - - -if ($RunFromPerformanceRepo) { - $SetupArguments = "--perf-hash $CommitSha $CommonSetupArguments" - - robocopy $SourceDirectory $PerformanceDirectory /E /XD $PayloadDirectory $SourceDirectory\artifacts $SourceDirectory\.git -} -else { - git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $PerformanceDirectory -} - -if($MonoDotnet -ne "") -{ - $UsingMono = "true" - $MonoDotnetPath = (Join-Path $PayloadDirectory "dotnet-mono") - Move-Item -Path $MonoDotnet -Destination $MonoDotnetPath -} - -if ($UseCoreRun) { - $NewCoreRoot = (Join-Path $PayloadDirectory "Core_Root") - Move-Item -Path $CoreRootDirectory -Destination $NewCoreRoot -} -if ($UseBaselineCoreRun) { - $NewBaselineCoreRoot = (Join-Path $PayloadDirectory "Baseline_Core_Root") - Move-Item -Path $BaselineCoreRootDirectory -Destination $NewBaselineCoreRoot -} - -$DocsDir = (Join-Path $PerformanceDirectory "docs") -robocopy $DocsDir $WorkItemDirectory - -# Set variables that we will need to have in future steps -$ci = $true - -. "$PSScriptRoot\..\pipeline-logging-functions.ps1" - -# Directories -Write-PipelineSetVariable -Name 'PayloadDirectory' -Value "$PayloadDirectory" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'PerformanceDirectory' -Value "$PerformanceDirectory" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'WorkItemDirectory' -Value "$WorkItemDirectory" -IsMultiJobVariable $false - -# Script Arguments -Write-PipelineSetVariable -Name 'Python' -Value "py -3" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'ExtraBenchmarkDotNetArguments' -Value "$ExtraBenchmarkDotNetArguments" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'SetupArguments' -Value "$SetupArguments" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'PerfLabArguments' -Value "$PerfLabArguments" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'BDNCategories' -Value "$RunCategories" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'TargetCsproj' -Value "$Csproj" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'Kind' -Value "$Kind" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'Architecture' -Value "$Architecture" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'UseCoreRun' -Value "$UseCoreRun" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'UseBaselineCoreRun' -Value "$UseBaselineCoreRun" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'RunFromPerfRepo' -Value "$RunFromPerformanceRepo" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'Compare' -Value "$Compare" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'MonoDotnet' -Value "$UsingMono" -IsMultiJobVariable $false - -# Helix Arguments -Write-PipelineSetVariable -Name 'Creator' -Value "$Creator" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'Queue' -Value "$Queue" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name 'HelixSourcePrefix' -Value "$HelixSourcePrefix" -IsMultiJobVariable $false -Write-PipelineSetVariable -Name '_BuildConfig' -Value "$Architecture.$Kind.$Framework" -IsMultiJobVariable $false - -exit 0 \ No newline at end of file diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh deleted file mode 100755 index 33b60b503374..000000000000 --- a/eng/common/performance/performance-setup.sh +++ /dev/null @@ -1,297 +0,0 @@ -#!/usr/bin/env bash - -source_directory=$BUILD_SOURCESDIRECTORY -core_root_directory= -baseline_core_root_directory= -architecture=x64 -framework=net5.0 -compilation_mode=tiered -repository=$BUILD_REPOSITORY_NAME -branch=$BUILD_SOURCEBRANCH -commit_sha=$BUILD_SOURCEVERSION -build_number=$BUILD_BUILDNUMBER -internal=false -compare=false -mono_dotnet= -kind="micro" -llvm=false -monointerpreter=false -monoaot=false -run_categories="Libraries Runtime" -csproj="src\benchmarks\micro\MicroBenchmarks.csproj" -configurations="CompliationMode=$compilation_mode RunKind=$kind" -run_from_perf_repo=false -use_core_run=true -use_baseline_core_run=true -using_mono=false -wasm_runtime_loc= -using_wasm=false -use_latest_dotnet=false -logical_machine= - -while (($# > 0)); do - lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" - case $lowerI in - --sourcedirectory) - source_directory=$2 - shift 2 - ;; - --corerootdirectory) - core_root_directory=$2 - shift 2 - ;; - --baselinecorerootdirectory) - baseline_core_root_directory=$2 - shift 2 - ;; - --architecture) - architecture=$2 - shift 2 - ;; - --framework) - framework=$2 - shift 2 - ;; - --compilationmode) - compilation_mode=$2 - shift 2 - ;; - --logicalmachine) - logical_machine=$2 - shift 2 - ;; - --repository) - repository=$2 - shift 2 - ;; - --branch) - branch=$2 - shift 2 - ;; - --commitsha) - commit_sha=$2 - shift 2 - ;; - --buildnumber) - build_number=$2 - shift 2 - ;; - --kind) - kind=$2 - configurations="CompilationMode=$compilation_mode RunKind=$kind" - shift 2 - ;; - --runcategories) - run_categories=$2 - shift 2 - ;; - --csproj) - csproj=$2 - shift 2 - ;; - --internal) - internal=true - shift 1 - ;; - --alpine) - alpine=true - shift 1 - ;; - --llvm) - llvm=true - shift 1 - ;; - --monointerpreter) - monointerpreter=true - shift 1 - ;; - --monoaot) - monoaot=true - shift 1 - ;; - --monodotnet) - mono_dotnet=$2 - shift 2 - ;; - --wasm) - wasm_runtime_loc=$2 - shift 2 - ;; - --compare) - compare=true - shift 1 - ;; - --configurations) - configurations=$2 - shift 2 - ;; - --latestdotnet) - use_latest_dotnet=true - shift 1 - ;; - *) - echo "Common settings:" - echo " --corerootdirectory Directory where Core_Root exists, if running perf testing with --corerun" - echo " --architecture Architecture of the testing being run" - echo " --configurations List of key=value pairs that will be passed to perf testing infrastructure." - echo " ex: --configurations \"CompilationMode=Tiered OptimzationLevel=PGO\"" - echo " --help Print help and exit" - echo "" - echo "Advanced settings:" - echo " --framework The framework to run, if not running in master" - echo " --compliationmode The compilation mode if not passing --configurations" - echo " --sourcedirectory The directory of the sources. Defaults to env:BUILD_SOURCESDIRECTORY" - echo " --repository The name of the repository in the / format. Defaults to env:BUILD_REPOSITORY_NAME" - echo " --branch The name of the branch. Defaults to env:BUILD_SOURCEBRANCH" - echo " --commitsha The commit sha1 to run against. Defaults to env:BUILD_SOURCEVERSION" - echo " --buildnumber The build number currently running. Defaults to env:BUILD_BUILDNUMBER" - echo " --csproj The relative path to the benchmark csproj whose tests should be run. Defaults to src\benchmarks\micro\MicroBenchmarks.csproj" - echo " --kind Related to csproj. The kind of benchmarks that should be run. Defaults to micro" - echo " --runcategories Related to csproj. Categories of benchmarks to run. Defaults to \"coreclr corefx\"" - echo " --internal If the benchmarks are running as an official job." - echo " --monodotnet Pass the path to the mono dotnet for mono performance testing." - echo " --wasm Path to the unpacked wasm runtime pack." - echo " --latestdotnet --dotnet-versions will not be specified. --dotnet-versions defaults to LKG version in global.json " - echo " --alpine Set for runs on Alpine" - echo "" - exit 0 - ;; - esac -done - -if [ "$repository" == "dotnet/performance" ] || [ "$repository" == "dotnet-performance" ]; then - run_from_perf_repo=true -fi - -if [ -z "$configurations" ]; then - configurations="CompilationMode=$compilation_mode" -fi - -if [ -z "$core_root_directory" ]; then - use_core_run=false -fi - -if [ -z "$baseline_core_root_directory" ]; then - use_baseline_core_run=false -fi - -payload_directory=$source_directory/Payload -performance_directory=$payload_directory/performance -workitem_directory=$source_directory/workitem -extra_benchmark_dotnet_arguments="--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" -perflab_arguments= -queue=Ubuntu.1804.Amd64.Open -creator=$BUILD_DEFINITIONNAME -helix_source_prefix="pr" - -if [[ "$internal" == true ]]; then - perflab_arguments="--upload-to-perflab-container" - helix_source_prefix="official" - creator= - extra_benchmark_dotnet_arguments= - - if [[ "$architecture" = "arm64" ]]; then - queue=Ubuntu.1804.Arm64.Perf - else - if [[ "$logical_machine" = "perfowl" ]]; then - queue=Ubuntu.1804.Amd64.Owl.Perf - else - queue=Ubuntu.1804.Amd64.Tiger.Perf - fi - fi - - if [[ "$alpine" = "true" ]]; then - queue=alpine.amd64.tiger.perf - fi -else - if [[ "$architecture" = "arm64" ]]; then - queue=ubuntu.1804.armarch.open - else - queue=Ubuntu.1804.Amd64.Open - fi - - if [[ "$alpine" = "true" ]]; then - queue=alpine.amd64.tiger.perf - fi -fi - -if [[ "$mono_dotnet" != "" ]] && [[ "$monointerpreter" == "false" ]]; then - configurations="$configurations LLVM=$llvm MonoInterpreter=$monointerpreter MonoAOT=$monoaot" - extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --category-exclusion-filter NoMono" -fi - -if [[ "$wasm_runtime_loc" != "" ]]; then - configurations="CompilationMode=wasm RunKind=$kind" - extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --category-exclusion-filter NoInterpreter NoWASM NoMono" -fi - -if [[ "$mono_dotnet" != "" ]] && [[ "$monointerpreter" == "true" ]]; then - configurations="$configurations LLVM=$llvm MonoInterpreter=$monointerpreter MonoAOT=$monoaot" - extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --category-exclusion-filter NoInterpreter NoMono" -fi - -common_setup_arguments="--channel master --queue $queue --build-number $build_number --build-configs $configurations --architecture $architecture" -setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" - -if [[ "$run_from_perf_repo" = true ]]; then - payload_directory= - workitem_directory=$source_directory - performance_directory=$workitem_directory - setup_arguments="--perf-hash $commit_sha $common_setup_arguments" -else - git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $performance_directory - - docs_directory=$performance_directory/docs - mv $docs_directory $workitem_directory -fi - -if [[ "$wasm_runtime_loc" != "" ]]; then - using_wasm=true - wasm_dotnet_path=$payload_directory/dotnet-wasm - mv $wasm_runtime_loc $wasm_dotnet_path - extra_benchmark_dotnet_arguments="$extra_benchmark_dotnet_arguments --wasmMainJS \$HELIX_CORRELATION_PAYLOAD/dotnet-wasm/runtime-test.js --wasmEngine /home/helixbot/.jsvu/v8 --customRuntimePack \$HELIX_CORRELATION_PAYLOAD/dotnet-wasm" -fi - -if [[ "$mono_dotnet" != "" ]]; then - using_mono=true - mono_dotnet_path=$payload_directory/dotnet-mono - mv $mono_dotnet $mono_dotnet_path -fi - -if [[ "$use_core_run" = true ]]; then - new_core_root=$payload_directory/Core_Root - mv $core_root_directory $new_core_root -fi - -if [[ "$use_baseline_core_run" = true ]]; then - new_baseline_core_root=$payload_directory/Baseline_Core_Root - mv $baseline_core_root_directory $new_baseline_core_root -fi - -ci=true - -_script_dir=$(pwd)/eng/common -. "$_script_dir/pipeline-logging-functions.sh" - -# Make sure all of our variables are available for future steps -Write-PipelineSetVariable -name "UseCoreRun" -value "$use_core_run" -is_multi_job_variable false -Write-PipelineSetVariable -name "UseBaselineCoreRun" -value "$use_baseline_core_run" -is_multi_job_variable false -Write-PipelineSetVariable -name "Architecture" -value "$architecture" -is_multi_job_variable false -Write-PipelineSetVariable -name "PayloadDirectory" -value "$payload_directory" -is_multi_job_variable false -Write-PipelineSetVariable -name "PerformanceDirectory" -value "$performance_directory" -is_multi_job_variable false -Write-PipelineSetVariable -name "WorkItemDirectory" -value "$workitem_directory" -is_multi_job_variable false -Write-PipelineSetVariable -name "Queue" -value "$queue" -is_multi_job_variable false -Write-PipelineSetVariable -name "SetupArguments" -value "$setup_arguments" -is_multi_job_variable false -Write-PipelineSetVariable -name "Python" -value "python3" -is_multi_job_variable false -Write-PipelineSetVariable -name "PerfLabArguments" -value "$perflab_arguments" -is_multi_job_variable false -Write-PipelineSetVariable -name "ExtraBenchmarkDotNetArguments" -value "$extra_benchmark_dotnet_arguments" -is_multi_job_variable false -Write-PipelineSetVariable -name "BDNCategories" -value "$run_categories" -is_multi_job_variable false -Write-PipelineSetVariable -name "TargetCsproj" -value "$csproj" -is_multi_job_variable false -Write-PipelineSetVariable -name "RunFromPerfRepo" -value "$run_from_perf_repo" -is_multi_job_variable false -Write-PipelineSetVariable -name "Creator" -value "$creator" -is_multi_job_variable false -Write-PipelineSetVariable -name "HelixSourcePrefix" -value "$helix_source_prefix" -is_multi_job_variable false -Write-PipelineSetVariable -name "Kind" -value "$kind" -is_multi_job_variable false -Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false -Write-PipelineSetVariable -name "Compare" -value "$compare" -is_multi_job_variable false -Write-PipelineSetVariable -name "MonoDotnet" -value "$using_mono" -is_multi_job_variable false -Write-PipelineSetVariable -name "WasmDotnet" -value "$using_wasm" -is_multi_job_variable false diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml new file mode 100644 index 000000000000..928a70cda2c5 --- /dev/null +++ b/eng/common/templates/job/onelocbuild.yml @@ -0,0 +1,78 @@ +parameters: + # Optional: dependencies of the job + dependsOn: '' + + # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool + pool: + vmImage: vs2017-win2016 + + CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex + GithubPat: $(BotAccount-dotnet-bot-repo-PAT) + + SourcesDirectory: $(Build.SourcesDirectory) + CreatePr: true + UseCheckedInLocProjectJson: false + LanguageSet: VS_Main_Languages + LclSource: lclFilesInRepo + LclPackageId: '' + RepoType: gitHub + +jobs: +- job: OneLocBuild + + dependsOn: ${{ parameters.dependsOn }} + + displayName: OneLocBuild + + pool: ${{ parameters.pool }} + + variables: + - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat + - name: _GenerateLocProjectArguments + value: -SourcesDirectory ${{ parameters.SourcesDirectory }} + -LanguageSet "${{ parameters.LanguageSet }}" + -CreateNeutralXlfs + - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}: + - name: _GenerateLocProjectArguments + value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson + + + steps: + - task: Powershell@2 + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 + arguments: $(_GenerateLocProjectArguments) + displayName: Generate LocProject.json + + - task: OneLocBuild@2 + displayName: OneLocBuild + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + inputs: + locProj: Localize/LocProject.json + outDir: $(Build.ArtifactStagingDirectory) + lclSource: ${{ parameters.LclSource }} + lclPackageId: ${{ parameters.LclPackageId }} + isCreatePrSelected: ${{ parameters.CreatePr }} + packageSourceAuth: patAuth + patVariable: ${{ parameters.CeapexPat }} + ${{ if eq(parameters.RepoType, 'gitHub') }}: + repoType: ${{ parameters.RepoType }} + gitHubPatVariable: "${{ parameters.GithubPat }}" + condition: always() + + - task: PublishBuildArtifacts@1 + displayName: Publish Localization Files + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/loc' + PublishLocation: Container + ArtifactName: Loc + condition: always() + + - task: PublishBuildArtifacts@1 + displayName: Publish LocProject.json + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/Localize/' + PublishLocation: Container + ArtifactName: Loc + condition: always() \ No newline at end of file diff --git a/eng/common/templates/job/performance.yml b/eng/common/templates/job/performance.yml deleted file mode 100644 index f877fd7a8980..000000000000 --- a/eng/common/templates/job/performance.yml +++ /dev/null @@ -1,95 +0,0 @@ -parameters: - steps: [] # optional -- any additional steps that need to happen before pulling down the performance repo and sending the performance benchmarks to helix (ie building your repo) - variables: [] # optional -- list of additional variables to send to the template - jobName: '' # required -- job name - displayName: '' # optional -- display name for the job. Will use jobName if not passed - pool: '' # required -- name of the Build pool - container: '' # required -- name of the container - osGroup: '' # required -- operating system for the job - extraSetupParameters: '' # optional -- extra arguments to pass to the setup script - frameworks: ['netcoreapp3.0'] # optional -- list of frameworks to run against - continueOnError: 'false' # optional -- determines whether to continue the build if the step errors - dependsOn: '' # optional -- dependencies of the job - timeoutInMinutes: 320 # optional -- timeout for the job - enableTelemetry: false # optional -- enable for telemetry - -jobs: -- template: ../jobs/jobs.yml - parameters: - dependsOn: ${{ parameters.dependsOn }} - enableTelemetry: ${{ parameters.enableTelemetry }} - enablePublishBuildArtifacts: true - continueOnError: ${{ parameters.continueOnError }} - - jobs: - - job: '${{ parameters.jobName }}' - - ${{ if ne(parameters.displayName, '') }}: - displayName: '${{ parameters.displayName }}' - ${{ if eq(parameters.displayName, '') }}: - displayName: '${{ parameters.jobName }}' - - timeoutInMinutes: ${{ parameters.timeoutInMinutes }} - - variables: - - - ${{ each variable in parameters.variables }}: - - ${{ if ne(variable.name, '') }}: - - name: ${{ variable.name }} - value: ${{ variable.value }} - - ${{ if ne(variable.group, '') }}: - - group: ${{ variable.group }} - - - IsInternal: '' - - HelixApiAccessToken: '' - - HelixPreCommand: '' - - - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if eq( parameters.osGroup, 'Windows_NT') }}: - - HelixPreCommand: 'set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"' - - IsInternal: -Internal - - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - - HelixPreCommand: 'export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' - - IsInternal: --internal - - - group: DotNet-HelixApi-Access - - group: dotnet-benchview - - workspace: - clean: all - pool: - ${{ parameters.pool }} - container: ${{ parameters.container }} - strategy: - matrix: - ${{ each framework in parameters.frameworks }}: - ${{ framework }}: - _Framework: ${{ framework }} - steps: - - checkout: self - clean: true - # Run all of the steps to setup repo - - ${{ each step in parameters.steps }}: - - ${{ step }} - - powershell: $(Build.SourcesDirectory)\eng\common\performance\performance-setup.ps1 $(IsInternal) -Framework $(_Framework) ${{ parameters.extraSetupParameters }} - displayName: Performance Setup (Windows) - condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - - script: $(Build.SourcesDirectory)/eng/common/performance/performance-setup.sh $(IsInternal) --framework $(_Framework) ${{ parameters.extraSetupParameters }} - displayName: Performance Setup (Unix) - condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - continueOnError: ${{ parameters.continueOnError }} - - script: $(Python) $(PerformanceDirectory)/scripts/ci_setup.py $(SetupArguments) - displayName: Run ci setup script - # Run perf testing in helix - - template: /eng/common/templates/steps/perf-send-to-helix.yml - parameters: - HelixSource: '$(HelixSourcePrefix)/$(Build.Repository.Name)/$(Build.SourceBranch)' # sources must start with pr/, official/, prodcon/, or agent/ - HelixType: 'test/performance/$(Kind)/$(_Framework)/$(Architecture)' - HelixAccessToken: $(HelixApiAccessToken) - HelixTargetQueues: $(Queue) - HelixPreCommands: $(HelixPreCommand) - Creator: $(Creator) - WorkItemTimeout: 4:00 # 4 hours - WorkItemDirectory: '$(WorkItemDirectory)' # WorkItemDirectory can not be empty, so we send it some docs to keep it happy - CorrelationPayloadDirectory: '$(PayloadDirectory)' # it gets checked out to a folder with shorter path than WorkItemDirectory so we can avoid file name too long exceptions \ No newline at end of file diff --git a/eng/common/templates/steps/perf-send-to-helix.yml b/eng/common/templates/steps/perf-send-to-helix.yml deleted file mode 100644 index 3427b311a728..000000000000 --- a/eng/common/templates/steps/perf-send-to-helix.yml +++ /dev/null @@ -1,50 +0,0 @@ -# Please remember to update the documentation if you make changes to these parameters! -parameters: - ProjectFile: '' # required -- project file that specifies the helix workitems - HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ - HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' - HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number - HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues - HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group - HelixPreCommands: '' # optional -- commands to run before Helix work item execution - HelixPostCommands: '' # optional -- commands to run after Helix work item execution - WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects - CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload - IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion - DotNetCliPackageType: '' # optional -- either 'sdk', 'runtime' or 'aspnetcore-runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases.json - DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases.json - EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control - WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." - Creator: '' # optional -- if the build is external, use this to specify who is sending the job - DisplayNamePrefix: 'Send job to Helix' # optional -- rename the beginning of the displayName of the steps in AzDO - condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() - continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false - osGroup: '' # required -- operating system for the job - - -steps: -- template: /eng/pipelines/common/templates/runtimes/send-to-helix-inner-step.yml - parameters: - osGroup: ${{ parameters.osGroup }} - sendParams: $(Build.SourcesDirectory)/eng/common/performance/${{ parameters.ProjectFile }} /restore /t:Test /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog - displayName: ${{ parameters.DisplayNamePrefix }} - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - environment: - BuildConfig: $(_BuildConfig) - HelixSource: ${{ parameters.HelixSource }} - HelixType: ${{ parameters.HelixType }} - HelixBuild: ${{ parameters.HelixBuild }} - HelixTargetQueues: ${{ parameters.HelixTargetQueues }} - HelixAccessToken: ${{ parameters.HelixAccessToken }} - HelixPreCommands: ${{ parameters.HelixPreCommands }} - HelixPostCommands: ${{ parameters.HelixPostCommands }} - WorkItemDirectory: ${{ parameters.WorkItemDirectory }} - CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} - IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} - DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} - DotNetCliVersion: ${{ parameters.DotNetCliVersion }} - EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} - WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} - Creator: ${{ parameters.Creator }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index 8e336b7d16b3..65ee5992bf46 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -36,7 +36,7 @@ steps: ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ --configuration $buildConfig \ - --restore --build --pack --publish \ + --restore --build --pack --publish -bl \ $officialBuildArgs \ $targetRidArgs \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index bc894e590e72..e5a62079e237 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -10,7 +10,7 @@ Param( if ($stage -eq "prepare") { Write-Output "$(Get-Date) - Building dotnet-format." - dotnet.exe build ./src -c Release + .\build.cmd -c Release } $currentLocation = Get-Location diff --git a/global.json b/global.json index c4f5c2600cc7..944fcf5373f1 100644 --- a/global.json +++ b/global.json @@ -2,7 +2,10 @@ "tools": { "dotnet": "6.0.100-preview.1.21103.13" }, + "sdk": { + "version": "6.0.100-preview.1.21103.13" + }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21160.7" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21208.2" } } diff --git a/perf/Utilities/MSBuildRegister.cs b/perf/Utilities/MSBuildRegister.cs index 59585672d6cf..620020fa9c85 100644 --- a/perf/Utilities/MSBuildRegister.cs +++ b/perf/Utilities/MSBuildRegister.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System.Linq; using System.Threading; -using Microsoft.CodeAnalysis.Tools.MSBuild; namespace Microsoft.CodeAnalysis.Tools.Perf { @@ -14,9 +12,7 @@ public static void RegisterInstance() { if (Interlocked.Exchange(ref s_registered, 1) == 0) { - var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); - LooseVersionAssemblyLoader.Register(msBuildInstance.MSBuildPath); - Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); + Build.Locator.MSBuildLocator.RegisterDefaults(); } } } diff --git a/src/MSBuild/LooseVersionAssemblyLoader.cs b/src/MSBuild/LooseVersionAssemblyLoader.cs deleted file mode 100644 index 0606b01a09b3..000000000000 --- a/src/MSBuild/LooseVersionAssemblyLoader.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.Loader; -using Microsoft.CodeAnalysis.Tools.Utilities; -using Microsoft.Extensions.Logging; - -namespace Microsoft.CodeAnalysis.Tools.MSBuild -{ - internal static class LooseVersionAssemblyLoader - { - private static readonly Dictionary s_pathsToAssemblies = new Dictionary(StringComparer.OrdinalIgnoreCase); - private static readonly Dictionary s_namesToAssemblies = new Dictionary(); - - private static readonly object s_guard = new object(); - - /// - /// Register an assembly loader that will load assemblies with higher version than what was requested. - /// - public static void Register(string searchPath, ILogger? logger = null) - { - AssemblyLoadContext.Default.Resolving += (AssemblyLoadContext context, AssemblyName assemblyName) => - { - lock (s_guard) - { - if (s_namesToAssemblies.TryGetValue(assemblyName.FullName, out var cachedAssembly)) - { - return cachedAssembly; - } - - var assembly = AssemblyResolver.TryResolveAssemblyFromPaths(context, assemblyName, searchPath, s_pathsToAssemblies, logger: logger); - - // Cache assembly - if (assembly != null) - { - var name = assembly.FullName; - if (name is null) - { - throw new Exception($"Could not get name for assembly '{assembly}'"); - } - - s_pathsToAssemblies[assembly.Location] = assembly; - s_namesToAssemblies[name] = assembly; - } - - return assembly; - } - }; - } - } -} diff --git a/src/Program.cs b/src/Program.cs index 95d3459b7c0a..87f266a07cc6 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -14,8 +14,8 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Logging; -using Microsoft.CodeAnalysis.Tools.MSBuild; using Microsoft.CodeAnalysis.Tools.Utilities; +using Microsoft.CodeAnalysis.Tools.Workspaces; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -361,15 +361,7 @@ private static bool TryLoadMSBuild([NotNullWhen(returnValue: true)] out string? { // Since we are running as a dotnet tool we should be able to find an instance of // MSBuild in a .NET Core SDK. - var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); - - // Since we do not inherit msbuild.deps.json when referencing the SDK copy - // of MSBuild and because the SDK no longer ships with version matched assemblies, we - // register an assembly loader that will load assemblies from the msbuild path with - // equal or higher version numbers than requested. - LooseVersionAssemblyLoader.Register(msBuildInstance.MSBuildPath); - Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); - + var msBuildInstance = Build.Locator.MSBuildLocator.RegisterDefaults(); msBuildPath = msBuildInstance.MSBuildPath; return true; } diff --git a/src/MSBuild/MSBuildWorkspaceFinder.cs b/src/Workspaces/MSBuildWorkspaceFinder.cs similarity index 99% rename from src/MSBuild/MSBuildWorkspaceFinder.cs rename to src/Workspaces/MSBuildWorkspaceFinder.cs index 167ee66497c3..e520be013e17 100644 --- a/src/MSBuild/MSBuildWorkspaceFinder.cs +++ b/src/Workspaces/MSBuildWorkspaceFinder.cs @@ -10,7 +10,7 @@ using System.IO; using System.Linq; -namespace Microsoft.CodeAnalysis.Tools.MSBuild +namespace Microsoft.CodeAnalysis.Tools.Workspaces { internal class MSBuildWorkspaceFinder { diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 33efbe40af5d..1aa8b184df4c 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -56,12 +56,6 @@ - - - diff --git a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs index c7aca0325570..fd993d4ea8ae 100644 --- a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs +++ b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs @@ -42,7 +42,7 @@ public async Task InitializeAsync() // Load the analyzer_project into a MSBuildWorkspace. var workspacePath = Path.Combine(TestProjectsPathHelper.GetProjectsDirectory(), s_analyzerProjectFilePath); - MSBuildRegistrar.RegisterInstance(logger); + MSBuildRegistrar.RegisterInstance(); var analyzerWorkspace = await MSBuildWorkspaceLoader.LockedLoadAsync(workspacePath, WorkspaceType.Project, binaryLogPath: null, logWorkspaceWarnings: true, logger, CancellationToken.None); // From this project we can get valid AnalyzerReferences to add to our test project. diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index e83af4414489..7ef9222666a0 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -120,7 +120,7 @@ public async Task GeneratedFilesFormattedInUnformattedProject() var logLines = log.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries); Assert.Contains(logLines, line => line.Contains("unformatted_project.AssemblyInfo.cs")); - Assert.Contains(logLines, line => line.Contains("NETCoreApp,Version=v3.0.AssemblyAttributes.cs")); + Assert.Contains(logLines, line => line.Contains("NETCoreApp,Version=v3.1.AssemblyAttributes.cs")); } [MSBuildFact] @@ -536,7 +536,7 @@ internal async Task TestFormatWorkspaceAsync( } var logger = new TestLogger(); - var msBuildPath = MSBuildRegistrar.RegisterInstance(logger); + var msBuildPath = MSBuildRegistrar.RegisterInstance(); logger.LogDebug(Resources.The_dotnet_runtime_version_is_0, Program.GetRuntimeVersion()); logger.LogTrace(Resources.Using_msbuildexe_located_in_0, msBuildPath); diff --git a/tests/MSBuild/MSBuildWorkspaceFinderTests.cs b/tests/MSBuild/MSBuildWorkspaceFinderTests.cs index 2ff51f1855aa..d660a85ab745 100644 --- a/tests/MSBuild/MSBuildWorkspaceFinderTests.cs +++ b/tests/MSBuild/MSBuildWorkspaceFinderTests.cs @@ -1,8 +1,8 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.IO; -using Microsoft.CodeAnalysis.Tools.MSBuild; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; +using Microsoft.CodeAnalysis.Tools.Workspaces; using Xunit; namespace Microsoft.CodeAnalysis.Tools.Tests.MSBuild diff --git a/tests/Utilities/MSBuildRegistrar.cs b/tests/Utilities/MSBuildRegistrar.cs index 029832eca798..37ef23473a67 100644 --- a/tests/Utilities/MSBuildRegistrar.cs +++ b/tests/Utilities/MSBuildRegistrar.cs @@ -1,9 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System.Linq; using System.Threading; -using Microsoft.CodeAnalysis.Tools.MSBuild; -using Microsoft.Extensions.Logging; #nullable enable @@ -19,16 +16,12 @@ public sealed class MSBuildRegistrar private static string? s_msBuildPath; - public static string RegisterInstance(ILogger? logger = null) + public static string RegisterInstance() { if (Interlocked.Exchange(ref s_registered, 1) == 0) { - var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances().First(); - + var msBuildInstance = Build.Locator.MSBuildLocator.RegisterDefaults(); s_msBuildPath = msBuildInstance.MSBuildPath; - - LooseVersionAssemblyLoader.Register(s_msBuildPath, logger); - Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); } return s_msBuildPath!; diff --git a/tests/projects/for_code_formatter/analyzers_solution/console_project/console_project.csproj b/tests/projects/for_code_formatter/analyzers_solution/console_project/console_project.csproj index c454b7479108..5fe28f3cdd73 100644 --- a/tests/projects/for_code_formatter/analyzers_solution/console_project/console_project.csproj +++ b/tests/projects/for_code_formatter/analyzers_solution/console_project/console_project.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/tests/projects/for_code_formatter/codestyle_solution/console_project/console_project.csproj b/tests/projects/for_code_formatter/codestyle_solution/console_project/console_project.csproj index 78bfae4dacfa..b5fd59fc927b 100644 --- a/tests/projects/for_code_formatter/codestyle_solution/console_project/console_project.csproj +++ b/tests/projects/for_code_formatter/codestyle_solution/console_project/console_project.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/tests/projects/for_code_formatter/formatted_project/formatted_project.csproj b/tests/projects/for_code_formatter/formatted_project/formatted_project.csproj index 958d2f1daae3..c73e0d1692ab 100644 --- a/tests/projects/for_code_formatter/formatted_project/formatted_project.csproj +++ b/tests/projects/for_code_formatter/formatted_project/formatted_project.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj b/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj index f8d4c9246f6a..7486254df818 100644 --- a/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj +++ b/tests/projects/for_code_formatter/fsharp_project/fsharp_project.fsproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/tests/projects/for_code_formatter/generated_project/generated_project.csproj b/tests/projects/for_code_formatter/generated_project/generated_project.csproj index 958d2f1daae3..c73e0d1692ab 100644 --- a/tests/projects/for_code_formatter/generated_project/generated_project.csproj +++ b/tests/projects/for_code_formatter/generated_project/generated_project.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj b/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj index 958d2f1daae3..c73e0d1692ab 100644 --- a/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj +++ b/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/tests/projects/for_workspace_finder/multiple_projects/project_a.csproj b/tests/projects/for_workspace_finder/multiple_projects/project_a.csproj index 958d2f1daae3..c73e0d1692ab 100644 --- a/tests/projects/for_workspace_finder/multiple_projects/project_a.csproj +++ b/tests/projects/for_workspace_finder/multiple_projects/project_a.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/tests/projects/for_workspace_finder/multiple_projects/project_b.csproj b/tests/projects/for_workspace_finder/multiple_projects/project_b.csproj index 958d2f1daae3..c73e0d1692ab 100644 --- a/tests/projects/for_workspace_finder/multiple_projects/project_b.csproj +++ b/tests/projects/for_workspace_finder/multiple_projects/project_b.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/tests/projects/for_workspace_finder/project_and_solution/project_and_solution.csproj b/tests/projects/for_workspace_finder/project_and_solution/project_and_solution.csproj index 958d2f1daae3..c73e0d1692ab 100644 --- a/tests/projects/for_workspace_finder/project_and_solution/project_and_solution.csproj +++ b/tests/projects/for_workspace_finder/project_and_solution/project_and_solution.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 diff --git a/tests/projects/for_workspace_finder/single_project/single_project.csproj b/tests/projects/for_workspace_finder/single_project/single_project.csproj index 958d2f1daae3..c73e0d1692ab 100644 --- a/tests/projects/for_workspace_finder/single_project/single_project.csproj +++ b/tests/projects/for_workspace_finder/single_project/single_project.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 From 056369e21b6490539b5a1c01e2a0578350a1ad15 Mon Sep 17 00:00:00 2001 From: Scott Sauber Date: Fri, 9 Apr 2021 21:02:16 -0500 Subject: [PATCH 1426/2702] Fix typo in examples --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7880fecd16e5..8f86783fa122 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ Add `format` after `dotnet` and before the command arguments that you want to ru | `dotnet format --fix-analyzers` | Fixes only 3rd party analyzer errors. | | `dotnet format -wsa` | Formats, fixes codestyle errors, and fixes 3rd party analyzer errors. | | `dotnet format -v diag` | Formats with very verbose logging. | -| `dotnet format --include Programs.cs Utility\Logging.cs` | Formats the files Program.cs and Utility\Logging.cs | +| `dotnet format --include Program.cs Utility\Logging.cs` | Formats the files Program.cs and Utility\Logging.cs | | `dotnet format --check` | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | | `dotnet format --report ` | Formats and saves a json report file to the given directory. | | `dotnet format --include test/Utilities/*.cs --folder` | Formats the files expanded from native shell globbing (e.g. bash). Space-separated list of files are fed to formatter in this case. Also applies to `--exclude` option. | From c84dab4e6cefc4dc6f5952c576365f4778dbeaa6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 10 Apr 2021 13:00:18 +0000 Subject: [PATCH 1427/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210410.2 (#1084) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4eaa0fdf02c4..91c75f74cec9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 289228c5e3d03e9f72da410f5c55363d861e0b88 + b70ecbb38ae8da56924ae5f84b394fe79e221587 diff --git a/eng/Versions.props b/eng/Versions.props index 90877937a59b..c01dbcf04a07 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 3.10.0-3.21208.16 + 3.10.0-3.21210.2 - 3.10.0-3.21210.2 + 3.10.0-3.21213.6 - 3.10.0-3.21213.6 + 3.10.0-3.21213.18 - 3.10.0-3.21213.18 + 3.10.0-3.21215.16 - 3.10.0-3.21215.16 + 3.10.0-3.21215.28 - 3.10.0-3.21215.28 + 3.10.0-3.21216.10 - 3.10.0-3.21216.10 + 3.10.0-3.21222.20 - 3.10.0-3.21222.20 + 3.10.0-3.21223.23 - 3.10.0-3.21223.23 + 4.0.0-2.21227.16 - 4.0.0-2.21227.16 + 4.0.0-2.21227.22 - 4.0.0-2.21227.22 + 4.0.0-2.21229.16 - 4.0.0-2.21229.16 + 4.0.0-2.21229.30 - 4.0.0-2.21229.30 + 4.0.0-2.21251.2 - 4.0.0-2.21251.2 + 4.0.0-2.21253.8 - 15.3.409 + 16.5.0 5.0.0-preview.7.20364.11 5.8.0-preview.3.6823 @@ -38,5 +38,8 @@ + + + \ No newline at end of file diff --git a/NuGet.config b/NuGet.config index 078b79b456aa..a8cfab73f59b 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,6 +2,7 @@ + diff --git a/perf/dotnet-format.Performance.csproj b/perf/dotnet-format.Performance.csproj index c4a99d2e17c7..81ea651073a2 100644 --- a/perf/dotnet-format.Performance.csproj +++ b/perf/dotnet-format.Performance.csproj @@ -1,6 +1,6 @@  - netcoreapp2.1 + netcoreapp3.1 AnyCPU diff --git a/src/Program.cs b/src/Program.cs index 87f266a07cc6..8c6b37c67a13 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -266,8 +266,14 @@ static bool TryReadFromStandardInput(ref string[] subject) for (var i = 0; Console.In.Peek() != -1; ++i) { + var line = Console.In.ReadLine(); + if (line is null) + { + continue; + } + Array.Resize(ref subject, subject.Length + 1); - subject[i] = Console.In.ReadLine(); + subject[i] = line; } return true; @@ -331,11 +337,11 @@ private static ILogger SetupLogging(IConsole console, LogLevel minimalL return logger!; } - private static string GetVersion() + private static string? GetVersion() { return Assembly.GetExecutingAssembly() .GetCustomAttribute() - .InformationalVersion; + ?.InformationalVersion; } private static bool TryGetDotNetCliVersion([NotNullWhen(returnValue: true)] out string? dotnetVersion) diff --git a/src/Utilities/Annotations.cs b/src/Utilities/Annotations.cs deleted file mode 100644 index 4e01cf930b0f..000000000000 --- a/src/Utilities/Annotations.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -namespace System.Diagnostics.CodeAnalysis -{ - /// Specifies that null is allowed as an input even if the corresponding type disallows it. - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)] - internal sealed class AllowNullAttribute : Attribute - { - } - - /// Specifies that null is disallowed as an input even if the corresponding type allows it. - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)] - internal sealed class DisallowNullAttribute : Attribute - { - } - - /// Specifies that an output can be even if the corresponding type disallows it. - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)] - internal sealed class MaybeNullAttribute : Attribute - { - } - - /// Specifies that an output will not be null even if the corresponding type allows it. - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)] - internal sealed class NotNullAttribute : Attribute - { - } - - /// Specifies that when a method returns , the parameter can be even if the corresponding type disallows it. - [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] - internal sealed class MaybeNullWhenAttribute : Attribute - { - /// - /// Initializes a new instance of the class. - /// - /// - /// The return value condition. If the method returns this value, the associated parameter can be . - /// - public MaybeNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; - - /// Gets the return value condition. - public bool ReturnValue { get; } - } - - /// Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. - [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] - internal sealed class NotNullWhenAttribute : Attribute - { - /// - /// Initializes a new instance of the class. - /// - /// - /// The return value condition. If the method returns this value, the associated parameter will not be null. - /// - public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; - - /// Gets the return value condition. - public bool ReturnValue { get; } - } - - /// Specifies that the output will be non-null if the named parameter is non-null. - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] - internal sealed class NotNullIfNotNullAttribute : Attribute - { - /// - /// Initializes a new instance of the class. - /// - /// - /// The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null. - /// - public NotNullIfNotNullAttribute(string parameterName) => ParameterName = parameterName; - - /// Gets the associated parameter name. - public string ParameterName { get; } - } - - /// Applied to a method that will never return under any circumstance. - [AttributeUsage(AttributeTargets.Method, Inherited = false)] - internal sealed class DoesNotReturnAttribute : Attribute - { - } - - /// Specifies that the method will not return if the associated Boolean parameter is passed the specified value. - [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] - internal sealed class DoesNotReturnIfAttribute : Attribute - { - /// - /// Initializes a new instance of the class. - /// - /// - /// The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to - /// the associated parameter matches this value. - /// - public DoesNotReturnIfAttribute(bool parameterValue) => ParameterValue = parameterValue; - - /// Gets the condition parameter value. - public bool ParameterValue { get; } - } -} diff --git a/src/Utilities/Index.cs b/src/Utilities/Index.cs deleted file mode 100644 index 623ceeda8b21..000000000000 --- a/src/Utilities/Index.cs +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; - -namespace System -{ - /// Represent a type can be used to index a collection either from the start or the end. - /// - /// Index is used by the C# compiler to support the new index syntax - /// - /// int[] someArray = new int[5] { 1, 2, 3, 4, 5 } ; - /// int lastElement = someArray[^1]; // lastElement = 5 - /// - /// - internal readonly struct Index : IEquatable - { - private readonly int _value; - - /// Construct an Index using a value and indicating if the index is from the start or from the end. - /// The index value. it has to be zero or positive number. - /// Indicating if the index is from the start or from the end. - /// - /// If the Index constructed from the end, index value 1 means pointing at the last element and index value 0 means pointing at beyond last element. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Index(int value, bool fromEnd = false) - { - if (value < 0) - { - throw new ArgumentOutOfRangeException(nameof(value), value, "Non-negative number required."); - } - - if (fromEnd) - _value = ~value; - else - _value = value; - } - - // The following private constructors mainly created for perf reason to avoid the checks - private Index(int value) - { - _value = value; - } - - /// Create an Index pointing at first element. - public static Index Start => new Index(0); - - /// Create an Index pointing at beyond last element. - public static Index End => new Index(~0); - - /// Create an Index from the start at the position indicated by the value. - /// The index value from the start. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Index FromStart(int value) - { - if (value < 0) - { - throw new ArgumentOutOfRangeException(nameof(value), value, "Non-negative number required."); - } - - return new Index(value); - } - - /// Create an Index from the end at the position indicated by the value. - /// The index value from the end. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Index FromEnd(int value) - { - if (value < 0) - { - throw new ArgumentOutOfRangeException(nameof(value), value, "Non-negative number required."); - } - - return new Index(~value); - } - - /// Returns the index value. - public int Value - { - get - { - if (_value < 0) - return ~_value; - else - return _value; - } - } - - /// Indicates whether the index is from the start or the end. - public bool IsFromEnd => _value < 0; - - /// Calculate the offset from the start using the giving collection length. - /// The length of the collection that the Index will be used with. length has to be a positive value - /// - /// For performance reason, we don't validate the input length parameter and the returned offset value against negative values. - /// we don't validate either the returned offset is greater than the input length. - /// It is expected Index will be used with collections which always have non negative length/count. If the returned offset is negative and - /// then used to index a collection will get out of range exception which will be same affect as the validation. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public int GetOffset(int length) - { - var offset = _value; - if (IsFromEnd) - { - // offset = length - (~value) - // offset = length + (~(~value) + 1) - // offset = length + value + 1 - - offset += length + 1; - } - return offset; - } - - /// Indicates whether the current Index object is equal to another object of the same type. - /// An object to compare with this object - public override bool Equals(object? value) => value is Index index && _value == index._value; - - /// Indicates whether the current Index object is equal to another Index object. - /// An object to compare with this object - public bool Equals(Index other) => _value == other._value; - - /// Returns the hash code for this instance. - public override int GetHashCode() => _value; - - /// Converts integer number to an Index. - public static implicit operator Index(int value) => FromStart(value); - - /// Converts the value of the current Index object to its equivalent string representation. - public override string ToString() - { - if (IsFromEnd) - return $"^{(uint)Value}"; - - return ((uint)Value).ToString(); - } - } -} diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 1aa8b184df4c..2191061ec5eb 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.1 Exe 9.0 true @@ -19,7 +19,7 @@ true - 2.1.0-rc1 + 3.1.0-preview3.19553.2 LatestMajor true @@ -56,6 +56,11 @@ + + + + + diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 0d7548f54b49..d2ee6371db3a 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp3.1 9.0 false Microsoft.CodeAnalysis.Tools.Tests From 5ce057d56855c47e7c2d2eccfac80e3019248e88 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 13:00:46 +0000 Subject: [PATCH 1446/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210504.8 (#1125) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index da071bb45744..1e0227233f0e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 5b972bceb846f5d15f991a479e285067a75103e4 + 28bd07cc74ebb4c3d5b2d9cb22b2fd60f5c580dd diff --git a/eng/Versions.props b/eng/Versions.props index d0306b783737..80b5021ccffa 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-2.21253.8 + 4.0.0-2.21254.8 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fcd4d84c90d1..913eb8bd6aff 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -113,9 +113,8 @@ jobs: vmImage: 'ubuntu-latest' timeoutInMinutes: 5 steps: - - script: ./restore.sh + - script: ./restore.sh && echo "##vso[task.setvariable variable=PATH]$(Build.SourcesDirectory)/.dotnet:${PATH}" displayName: Restore dependencies - - script: echo "##vso[task.setvariable variable=PATH]$(Build.SourcesDirectory)/.dotnet:${PATH}" - script: dotnet run --project ./src/dotnet-format.csproj -c Release -- @validate.rsp displayName: Run dotnet-format - task: PublishBuildArtifacts@1 diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 2191061ec5eb..98c3f6f970c6 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -57,7 +57,7 @@ - + From bea77b343663d56011c72888d7c3bd8f3abeb0c3 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 4 May 2021 15:28:50 -0700 Subject: [PATCH 1451/2702] Use AssemblyDependencyResolver when loading analyzers --- .../AnalyzerReferenceInformationProvider.cs | 77 ++++++++++++++----- src/Utilities/AssemblyResolver.cs | 19 +---- 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/src/Analyzers/AnalyzerReferenceInformationProvider.cs b/src/Analyzers/AnalyzerReferenceInformationProvider.cs index 45fd9eea9411..476e13c4ffff 100644 --- a/src/Analyzers/AnalyzerReferenceInformationProvider.cs +++ b/src/Analyzers/AnalyzerReferenceInformationProvider.cs @@ -15,6 +15,8 @@ namespace Microsoft.CodeAnalysis.Tools.Analyzers internal class AnalyzerReferenceInformationProvider : IAnalyzerInformationProvider { private static readonly Dictionary s_pathsToAssemblies = new(StringComparer.OrdinalIgnoreCase); + private static readonly Dictionary s_namesToAssemblies = new(StringComparer.OrdinalIgnoreCase); + private static readonly object s_guard = new(); public ImmutableDictionary GetAnalyzersAndFixers( @@ -53,18 +55,7 @@ private AnalyzersAndFixers GetAnalyzersAndFixers(Project project) try { - var analyzerDirectory = new DirectoryInfo(Path.GetDirectoryName(path)); - - // Analyzer packages will put language specific assemblies in subfolders. - if (analyzerDirectory.Name == "cs" || analyzerDirectory.Name == "vb") - { - // Get the root analyzer folder. - analyzerDirectory = analyzerDirectory.Parent; - } - - var context = new AnalyzerLoadContext(analyzerDirectory.FullName); - - // First try loading the assembly from disk. + var context = new AnalyzerLoadContext(path); var assembly = context.LoadFromAssemblyPath(path); s_pathsToAssemblies.Add(path, assembly); @@ -74,7 +65,6 @@ private AnalyzersAndFixers GetAnalyzersAndFixers(Project project) catch { } } - // Give up. return null; } @@ -83,18 +73,51 @@ private AnalyzersAndFixers GetAnalyzersAndFixers(Project project) internal sealed class AnalyzerLoadContext : AssemblyLoadContext { internal string AssemblyFolderPath { get; } + internal AssemblyDependencyResolver DependencyResolver { get; } - public AnalyzerLoadContext(string assemblyFolderPath) + public AnalyzerLoadContext(string assemblyPath) { - AssemblyFolderPath = assemblyFolderPath; + var analyzerDirectory = new DirectoryInfo(Path.GetDirectoryName(assemblyPath)); + + // Analyzer packages will put language specific assemblies in subfolders. + if (analyzerDirectory.Name == "cs" || analyzerDirectory.Name == "vb") + { + // Get the root analyzer folder. + analyzerDirectory = analyzerDirectory.Parent; + } + + AssemblyFolderPath = analyzerDirectory.FullName; + DependencyResolver = new AssemblyDependencyResolver(assemblyPath); } - protected override Assembly Load(AssemblyName assemblyName) + protected override Assembly? Load(AssemblyName assemblyName) { - // Since we build against .NET Core 2.1 we do not have access to the - // AssemblyDependencyResolver which resolves depenendency assembly paths - // from AssemblyName by using the .deps.json. + if (s_namesToAssemblies.TryGetValue(assemblyName.FullName, out var assembly)) + { + return assembly; + } + assembly = TryLoad(assemblyName); + if (assembly is not null) + { + s_namesToAssemblies[assemblyName.FullName] = assembly; + } + + return assembly; + } + + private Assembly? TryLoad(AssemblyName assemblyName) + { + // If the analyzer was packaged with a .deps.json file which described + // its dependencies, then the DependencyResolver should locate them for us. + var resolvedPath = DependencyResolver.ResolveAssemblyToPath(assemblyName); + if (resolvedPath is not null) + { + return LoadFromAssemblyPath(resolvedPath); + } + + // The dependency resolver failed to locate the dependency so fall back to inspecting + // the analyzer package folder. foreach (var searchPath in new[] { @@ -116,8 +139,20 @@ protected override Assembly Load(AssemblyName assemblyName) catch { } } - // Try to load the requested assembly from the default load context. - return AssemblyLoadContext.Default.LoadFromAssemblyName(assemblyName); + return null; + } + + protected override IntPtr LoadUnmanagedDll(string unmanagedDllName) + { + // If the analyzer was packaged with a .deps.json file which described + // its dependencies, then the DependencyResolver should locate them for us. + var resolvedPath = DependencyResolver.ResolveUnmanagedDllToPath(unmanagedDllName); + if (resolvedPath is not null) + { + return LoadUnmanagedDllFromPath(resolvedPath); + } + + return base.LoadUnmanagedDll(unmanagedDllName); } } } diff --git a/src/Utilities/AssemblyResolver.cs b/src/Utilities/AssemblyResolver.cs index 5b85efe78fc5..c2d21f677f9b 100644 --- a/src/Utilities/AssemblyResolver.cs +++ b/src/Utilities/AssemblyResolver.cs @@ -42,24 +42,11 @@ internal static class AssemblyResolver continue; } - try - { - var assembly = context.LoadFromAssemblyPath(candidatePath); + var assembly = context.LoadFromAssemblyPath(candidatePath); - logger?.LogTrace($"Loaded assembly from {candidatePath}."); + logger?.LogTrace($"Loaded assembly from {candidatePath}."); - return assembly; - } - catch - { - if (assemblyName.Name != null) - { - // We were unable to load the assembly from the file path. It is likely that - // a different version of the assembly has already been loaded into the context. - // Be forgiving and attempt to load assembly by name without specifying a version. - return context.LoadFromAssemblyName(new AssemblyName(assemblyName.Name)); - } - } + return assembly; } } From 26b9161c10082b2453edc51d63313cccc82ff398 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 4 May 2021 16:41:24 -0700 Subject: [PATCH 1452/2702] updating perf scripts to run --- eng/perf.ps1 | 9 ++++--- global.json | 7 +++++- perf/FormattedFiles.cs | 6 +++-- perf/NoFilesFormatted.cs | 7 ++++-- perf/Program.cs | 10 ++++++++ perf/RealWorldSolution.cs | 2 +- perf/Utilities/MSBuildRegister.cs | 34 +++++++++++++++++++++++++-- perf/dotnet-format.Performance.csproj | 11 +++++++-- 8 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 perf/Program.cs diff --git a/eng/perf.ps1 b/eng/perf.ps1 index 7db05866dab1..1e243a9e1cc3 100644 --- a/eng/perf.ps1 +++ b/eng/perf.ps1 @@ -32,7 +32,6 @@ try { Invoke-Expression 'eng\common\build.ps1 -build -configuration release' Write-Output "running tests" - Invoke-Expression 'dotnet tool restore ' if ($real -or $all) { # Real-World case, download the project @@ -41,21 +40,21 @@ try { } } - Invoke-Expression 'cd artifacts\bin\dotnet-format.Performance\Release\netcoreapp2.1' + Invoke-Expression 'cd perf' if ($micro) { # Default case, run very small tests - Invoke-Expression 'dotnet benchmark dotnet-format.Performance.dll --memory --join --filter *Formatted*' + Invoke-Expression 'dotnet run -c Release -f netcoreapp2.1 --runtimes netcoreapp3.1 --project dotnet-format.Performance.csproj -- --memory --join --filter *Formatted*' exit 0 } if ($real) { - Invoke-Expression 'dotnet benchmark dotnet-format.Performance.dll --memory --join --filter RealWorldSolution' + Invoke-Expression 'dotnet run -c Release -f netcoreapp2.1 --runtimes netcoreapp3.1 --project dotnet-format.Performance.csproj -- --memory --join --filter RealWorldSolution' exit 0 } if ($all) { - Invoke-Expression 'dotnet benchmark dotnet-format.Performance.dll --memory --join --filter *' + Invoke-Expression 'dotnet run -c Release -f netcoreapp2.1 --runtimes netcoreapp3.1 --project dotnet-format.Performance.csproj -- --memory --join --filter *' exit 0 } } diff --git a/global.json b/global.json index 944fcf5373f1..c6c16a0971b7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,11 @@ { "tools": { - "dotnet": "6.0.100-preview.1.21103.13" + "dotnet": "6.0.100-preview.1.21103.13", + "runtimes": { + "dotnet": [ + "3.1.7" + ] + } }, "sdk": { "version": "6.0.100-preview.1.21103.13" diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index 443b41dacf9c..42c58fefe757 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -2,14 +2,16 @@ using System; using System.Collections.Immutable; + using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; + using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools.Perf { - [SimpleJob(RuntimeMoniker.NetCoreApp21)] + [SimpleJob(RuntimeMoniker.NetCoreApp31)] public class FormattedFiles { private const string UnformattedProjectPath = "tests/projects/for_code_formatter/unformatted_project/"; @@ -22,8 +24,8 @@ public class FormattedFiles [IterationSetup] public void NoFilesFormattedSetup() { - MSBuildRegister.RegisterInstance(); SolutionPathSetter.SetCurrentDirectory(); + MSBuildRegister.RegisterInstance(Environment.CurrentDirectory); } [Benchmark(Description = "Whitespace Formatting (folder)")] diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index fe9116e88a4a..36d33e55af80 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -2,6 +2,9 @@ using System; using System.Collections.Immutable; +using System.IO; +using System.Threading; + using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; using Microsoft.CodeAnalysis.Tools.Utilities; @@ -9,7 +12,7 @@ namespace Microsoft.CodeAnalysis.Tools.Perf { - [SimpleJob(RuntimeMoniker.NetCoreApp21)] + [SimpleJob(RuntimeMoniker.NetCoreApp31)] public class NoFilesFormatted { private const string FormattedProjectPath = "tests/projects/for_code_formatter/formatted_project/"; @@ -22,8 +25,8 @@ public class NoFilesFormatted [IterationSetup] public void NoFilesFormattedSetup() { - MSBuildRegister.RegisterInstance(); SolutionPathSetter.SetCurrentDirectory(); + MSBuildRegister.RegisterInstance(Environment.CurrentDirectory); } [Benchmark(Description = "No Files are Formatted (folder)")] diff --git a/perf/Program.cs b/perf/Program.cs new file mode 100644 index 000000000000..d54c88957797 --- /dev/null +++ b/perf/Program.cs @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using BenchmarkDotNet.Running; + +public class Program +{ + public static void Main(string[] args) + => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); +} + diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index ad99f7e358a7..219b4d6da7d0 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -24,8 +24,8 @@ public class RealWorldSolution [IterationSetup] public void RealWorldSolutionIterationSetup() { - MSBuildRegister.RegisterInstance(); SolutionPathSetter.SetCurrentDirectory(); + MSBuildRegister.RegisterInstance(Environment.CurrentDirectory); } [Benchmark(Description = "Formatting Solution")] diff --git a/perf/Utilities/MSBuildRegister.cs b/perf/Utilities/MSBuildRegister.cs index 620020fa9c85..8909b331aa4c 100644 --- a/perf/Utilities/MSBuildRegister.cs +++ b/perf/Utilities/MSBuildRegister.cs @@ -1,5 +1,9 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Threading; namespace Microsoft.CodeAnalysis.Tools.Perf @@ -8,11 +12,37 @@ public static class MSBuildRegister { private static int s_registered; - public static void RegisterInstance() + public static void RegisterInstance(string solutionDir) { if (Interlocked.Exchange(ref s_registered, 1) == 0) { - Build.Locator.MSBuildLocator.RegisterDefaults(); + var pathsToSearch = new List(); + var sdkDirectory = new DirectoryInfo(Path.Combine(solutionDir, @".dotnet\sdk")); + pathsToSearch.AddRange(sdkDirectory.EnumerateDirectories().Select(x => x.FullName)); + + var programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); + if (programFiles is not null) + { + var sdkPath = Path.Combine(programFiles, "dotnet","sdk"); + if (Directory.Exists(sdkPath)) + { + sdkDirectory = new DirectoryInfo(Path.Combine(programFiles, @"dotnet\sdk")); + pathsToSearch.AddRange(sdkDirectory.EnumerateDirectories().Select(x => x.FullName)); + } + } + + var programFilesX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); + if (programFilesX86 is not null) + { + var installs = Path.Combine(programFiles, "Microsoft Visual Studio", "2019"); + if (Directory.Exists(installs)) + { + pathsToSearch.AddRange(new DirectoryInfo(installs).EnumerateDirectories() + .Select(install => Path.Combine(install.FullName, "MSBuild", "Current", "Bin"))); + } + } + + Build.Locator.MSBuildLocator.RegisterMSBuildPath(pathsToSearch.ToArray()); } } } diff --git a/perf/dotnet-format.Performance.csproj b/perf/dotnet-format.Performance.csproj index c4a99d2e17c7..606df57cbeb6 100644 --- a/perf/dotnet-format.Performance.csproj +++ b/perf/dotnet-format.Performance.csproj @@ -1,16 +1,23 @@  netcoreapp2.1 + Exe + 9.0 AnyCPU true true Release + + true + + + LatestMajor - - + + From 6b36dec8c317544ece219a592d03d401da469fb8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 5 May 2021 00:25:40 +0000 Subject: [PATCH 1453/2702] [main] Update dependencies from dotnet/arcade (#1083) [main] Update dependencies from dotnet/arcade - Enable Arcade v3 publishing --- azure-pipelines-official.yml | 1 + eng/Publishing.props | 6 ++ eng/Version.Details.xml | 4 +- eng/common/cross/arm64/tizen-fetch.sh | 2 +- eng/common/generate-locproject.ps1 | 17 +++- .../post-build/sourcelink-validation.ps1 | 2 +- eng/common/post-build/symbols-validation.ps1 | 96 ++++++++++--------- eng/common/templates/job/onelocbuild.yml | 11 ++- .../templates/job/source-index-stage1.yml | 2 +- global.json | 4 +- 10 files changed, 87 insertions(+), 58 deletions(-) create mode 100644 eng/Publishing.props diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 86d586a66001..ae521b72c8d3 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -112,6 +112,7 @@ stages: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - template: eng\common\templates\post-build\post-build.yml parameters: + publishingInfraVersion: 3 # Symbol validation is not entirely reliable as of yet, so should be turned off until # https://github.com/dotnet/arcade/issues/2871 is resolved. enableSymbolValidation: false diff --git a/eng/Publishing.props b/eng/Publishing.props new file mode 100644 index 000000000000..797de4ea1dec --- /dev/null +++ b/eng/Publishing.props @@ -0,0 +1,6 @@ + + + + 3 + + \ No newline at end of file diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1e0227233f0e..3c43b7e0b1ab 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - 814754c257edd24aeff89615106e4557d07632d8 + e9fd640e1ec1890489ea66ad0f59e733448056da
diff --git a/eng/common/cross/arm64/tizen-fetch.sh b/eng/common/cross/arm64/tizen-fetch.sh index a48a6f51c49d..16d1301f21e4 100644 --- a/eng/common/cross/arm64/tizen-fetch.sh +++ b/eng/common/cross/arm64/tizen-fetch.sh @@ -157,7 +157,7 @@ fetch_tizen_pkgs() Inform "Initialize arm base" fetch_tizen_pkgs_init standard base Inform "fetch common packages" -fetch_tizen_pkgs aarch64 gcc glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel +fetch_tizen_pkgs aarch64 gcc glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils Inform "fetch coreclr packages" fetch_tizen_pkgs aarch64 lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu Inform "fetch corefx packages" diff --git a/eng/common/generate-locproject.ps1 b/eng/common/generate-locproject.ps1 index 7225ddc66690..24c00b5be98b 100644 --- a/eng/common/generate-locproject.ps1 +++ b/eng/common/generate-locproject.ps1 @@ -66,10 +66,19 @@ $locJson = @{ } if ($continue) { - return @{ - SourceFile = $sourceFile - CopyOption = "LangIDOnName" - OutputPath = $outputPath + if ($_.Directory.Name -eq 'en' -and $_.Extension -eq '.json') { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnPath" + OutputPath = "$($_.Directory.Parent.FullName | Resolve-Path -Relative)\" + } + } + else { + return @{ + SourceFile = $sourceFile + CopyOption = "LangIDOnName" + OutputPath = $outputPath + } } } } diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 1c46f7b63414..8c554729b612 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -14,7 +14,7 @@ param( $global:RepoFiles = @{} # Maximum number of jobs to run in parallel -$MaxParallelJobs = 6 +$MaxParallelJobs = 16 # Wait time between check for system load $SecondsBetweenLoadChecks = 10 diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 index 99bf28cd5c1b..788321d773d6 100644 --- a/eng/common/post-build/symbols-validation.ps1 +++ b/eng/common/post-build/symbols-validation.ps1 @@ -1,13 +1,14 @@ param( - [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored - [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation - [Parameter(Mandatory=$true)][string] $DotnetSymbolVersion, # Version of dotnet symbol to use - [Parameter(Mandatory=$false)][switch] $ContinueOnError, # If we should keep checking symbols after an error - [Parameter(Mandatory=$false)][switch] $Clean # Clean extracted symbols directory after checking symbols + [Parameter(Mandatory = $true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored + [Parameter(Mandatory = $true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation + [Parameter(Mandatory = $true)][string] $DotnetSymbolVersion, # Version of dotnet symbol to use + [Parameter(Mandatory = $false)][switch] $CheckForWindowsPdbs, # If we should check for the existence of windows pdbs in addition to portable PDBs + [Parameter(Mandatory = $false)][switch] $ContinueOnError, # If we should keep checking symbols after an error + [Parameter(Mandatory = $false)][switch] $Clean # Clean extracted symbols directory after checking symbols ) # Maximum number of jobs to run in parallel -$MaxParallelJobs = 6 +$MaxParallelJobs = 16 # Max number of retries $MaxRetry = 5 @@ -19,9 +20,15 @@ $SecondsBetweenLoadChecks = 10 Set-Variable -Name "ERROR_BADEXTRACT" -Option Constant -Value -1 Set-Variable -Name "ERROR_FILEDOESNOTEXIST" -Option Constant -Value -2 +$WindowsPdbVerificationParam = "" +if ($CheckForWindowsPdbs) { + $WindowsPdbVerificationParam = "--windows-pdbs" +} + $CountMissingSymbols = { param( - [string] $PackagePath # Path to a NuGet package + [string] $PackagePath, # Path to a NuGet package + [string] $WindowsPdbVerificationParam # If we should check for the existence of windows pdbs in addition to portable PDBs ) . $using:PSScriptRoot\..\tools.ps1 @@ -34,7 +41,7 @@ $CountMissingSymbols = { if (!(Test-Path $PackagePath)) { Write-PipelineTaskError "Input file does not exist: $PackagePath" return [pscustomobject]@{ - result = $using:ERROR_FILEDOESNOTEXIST + result = $using:ERROR_FILEDOESNOTEXIST packagePath = $PackagePath } } @@ -57,24 +64,25 @@ $CountMissingSymbols = { Write-Host "Something went wrong extracting $PackagePath" Write-Host $_ return [pscustomobject]@{ - result = $using:ERROR_BADEXTRACT + result = $using:ERROR_BADEXTRACT packagePath = $PackagePath } } Get-ChildItem -Recurse $ExtractPath | - Where-Object {$RelevantExtensions -contains $_.Extension} | - ForEach-Object { - $FileName = $_.FullName - if ($FileName -Match '\\ref\\') { - Write-Host "`t Ignoring reference assembly file " $FileName - return - } + Where-Object { $RelevantExtensions -contains $_.Extension } | + ForEach-Object { + $FileName = $_.FullName + if ($FileName -Match '\\ref\\') { + Write-Host "`t Ignoring reference assembly file " $FileName + return + } - $FirstMatchingSymbolDescriptionOrDefault = { + $FirstMatchingSymbolDescriptionOrDefault = { param( - [string] $FullPath, # Full path to the module that has to be checked - [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + [string] $FullPath, # Full path to the module that has to be checked + [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + [string] $WindowsPdbVerificationParam, # Parameter to pass to potential check for windows-pdbs. [string] $SymbolsPath ) @@ -99,7 +107,7 @@ $CountMissingSymbols = { # DWARF file for a .dylib $DylibDwarf = $SymbolPath.Replace($Extension, '.dylib.dwarf') - + $dotnetSymbolExe = "$env:USERPROFILE\.dotnet\tools" $dotnetSymbolExe = Resolve-Path "$dotnetSymbolExe\dotnet-symbol.exe" @@ -107,7 +115,7 @@ $CountMissingSymbols = { while ($totalRetries -lt $using:MaxRetry) { # Save the output and get diagnostic output - $output = & $dotnetSymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath --diagnostics | Out-String + $output = & $dotnetSymbolExe --symbols --modules $WindowsPdbVerificationParam $TargetServerParam $FullPath -o $SymbolsPath --diagnostics | Out-String if (Test-Path $PdbPath) { return 'PDB' @@ -136,30 +144,30 @@ $CountMissingSymbols = { return $null } - $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault $FileName '--microsoft-symbol-server' $SymbolsPath - $SymbolsOnSymWeb = & $FirstMatchingSymbolDescriptionOrDefault $FileName '--internal-server' $SymbolsPath + $SymbolsOnMSDL = & $FirstMatchingSymbolDescriptionOrDefault $FileName '--microsoft-symbol-server' $SymbolsPath $WindowsPdbVerificationParam + $SymbolsOnSymWeb = & $FirstMatchingSymbolDescriptionOrDefault $FileName '--internal-server' $SymbolsPath $WindowsPdbVerificationParam - Write-Host -NoNewLine "`t Checking file " $FileName "... " + Write-Host -NoNewLine "`t Checking file " $FileName "... " - if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { - Write-Host "Symbols found on MSDL ($SymbolsOnMSDL) and SymWeb ($SymbolsOnSymWeb)" + if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { + Write-Host "Symbols found on MSDL ($SymbolsOnMSDL) and SymWeb ($SymbolsOnSymWeb)" + } + else { + $MissingSymbols++ + + if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) { + Write-Host 'No symbols found on MSDL or SymWeb!' } else { - $MissingSymbols++ - - if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) { - Write-Host 'No symbols found on MSDL or SymWeb!' + if ($SymbolsOnMSDL -eq $null) { + Write-Host 'No symbols found on MSDL!' } else { - if ($SymbolsOnMSDL -eq $null) { - Write-Host 'No symbols found on MSDL!' - } - else { - Write-Host 'No symbols found on SymWeb!' - } + Write-Host 'No symbols found on SymWeb!' } } } + } if ($using:Clean) { Remove-Item $ExtractPath -Recurse -Force @@ -168,16 +176,16 @@ $CountMissingSymbols = { Pop-Location return [pscustomobject]@{ - result = $MissingSymbols - packagePath = $PackagePath - } + result = $MissingSymbols + packagePath = $PackagePath + } } function CheckJobResult( - $result, - $packagePath, - [ref]$DupedSymbols, - [ref]$TotalFailures) { + $result, + $packagePath, + [ref]$DupedSymbols, + [ref]$TotalFailures) { if ($result -eq $ERROR_BADEXTRACT) { Write-PipelineTelemetryError -Category 'CheckSymbols' -Message "$packagePath has duplicated symbol files" $DupedSymbols.Value++ @@ -222,7 +230,7 @@ function CheckSymbolsAvailable { return } - Start-Job -ScriptBlock $CountMissingSymbols -ArgumentList $FullName | Out-Null + Start-Job -ScriptBlock $CountMissingSymbols -ArgumentList @($FullName,$WindowsPdbVerificationParam) | Out-Null $NumJobs = @(Get-Job -State 'Running').Count diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml index 928a70cda2c5..b27d6faf3035 100644 --- a/eng/common/templates/job/onelocbuild.yml +++ b/eng/common/templates/job/onelocbuild.yml @@ -11,11 +11,13 @@ parameters: SourcesDirectory: $(Build.SourcesDirectory) CreatePr: true + AutoCompletePr: false UseCheckedInLocProjectJson: false LanguageSet: VS_Main_Languages LclSource: lclFilesInRepo LclPackageId: '' RepoType: gitHub + condition: '' jobs: - job: OneLocBuild @@ -43,6 +45,7 @@ jobs: filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1 arguments: $(_GenerateLocProjectArguments) displayName: Generate LocProject.json + condition: ${{ parameters.condition }} - task: OneLocBuild@2 displayName: OneLocBuild @@ -54,12 +57,14 @@ jobs: lclSource: ${{ parameters.LclSource }} lclPackageId: ${{ parameters.LclPackageId }} isCreatePrSelected: ${{ parameters.CreatePr }} + ${{ if eq(parameters.CreatePr, true) }}: + isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} packageSourceAuth: patAuth patVariable: ${{ parameters.CeapexPat }} ${{ if eq(parameters.RepoType, 'gitHub') }}: repoType: ${{ parameters.RepoType }} gitHubPatVariable: "${{ parameters.GithubPat }}" - condition: always() + condition: ${{ parameters.condition }} - task: PublishBuildArtifacts@1 displayName: Publish Localization Files @@ -67,7 +72,7 @@ jobs: PathtoPublish: '$(Build.ArtifactStagingDirectory)/loc' PublishLocation: Container ArtifactName: Loc - condition: always() + condition: ${{ parameters.condition }} - task: PublishBuildArtifacts@1 displayName: Publish LocProject.json @@ -75,4 +80,4 @@ jobs: PathtoPublish: '$(Build.SourcesDirectory)/Localize/' PublishLocation: Container ArtifactName: Loc - condition: always() \ No newline at end of file + condition: ${{ parameters.condition }} \ No newline at end of file diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index c002a2b1b0a3..a649d2b5990c 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -1,6 +1,6 @@ parameters: runAsPublic: false - sourceIndexPackageVersion: 1.0.1-20210225.1 + sourceIndexPackageVersion: 1.0.1-20210421.1 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] diff --git a/global.json b/global.json index 944fcf5373f1..8cf2f1f5fc6d 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-preview.1.21103.13" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21208.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21253.2" } -} +} \ No newline at end of file From 5273dc6c023c5b41c948343edb55254e7deabeef Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 4 May 2021 17:59:52 -0700 Subject: [PATCH 1454/2702] Update readme for 5.1 release --- README.md | 80 +++++++++++++++++++++---------------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index b0c9893d219a..f85ff62385d0 100644 --- a/README.md +++ b/README.md @@ -10,60 +10,42 @@ `dotnet-format` is a code formatter for `dotnet` that applies style preferences to a project or solution. Preferences will be read from an `.editorconfig` file, if present, otherwise a default set of preferences will be used. At this time `dotnet-format` is able to format C# and Visual Basic projects with a subset of [supported .editorconfig options](./docs/Supported-.editorconfig-options.md). -### New in v5.0.211103 +### New in v5.1 ### New Features -- Can now apply codestyle codefixes automatically with `dotnet format --fix-codestyle` -- Can now apply analyzer codefixes automatically with `dotnet format --fix-analyzers` + +- Can now specify that format run against a solution filter with `dotnet format solution.slnf` +- Can now filter diagnostics with `dotnet format --fix-analyzers --diagnostics ID0001` +- Can now generate a MSBuild binary log with `dotnet format --binary-log PATH` +- Now with support for analyzers such as the [PublicApiAnalyzers](https://github.com/dotnet/roslyn-analyzers#microsoftcodeanalysispublicapianalyzers) which update non-code files ### Breaking Changes -Removed Deprecated options from 4.0: -- Removed `--dry-run` should use `--check` instead -- Removed `--files` should use `--include` instead -- Removed `--workspace` this option is now implied - -#### Changes: -- [Isolate each Analyzer assembly into its own LoadContext. (959)](https://www.github.com/dotnet/format/pull/959) -- [Implement GetDocumentDiagnosticsAsync in CodeFix DiagnosticProvider (958)](https://www.github.com/dotnet/format/pull/958) -- [Fix missing ` in README.md (914)](https://www.github.com/dotnet/format/pull/914) -- [Add unit test for 3rd party fixer formatting (896)](https://www.github.com/dotnet/format/pull/896) -- [Add unit test for code style fixer formatting (893)](https://www.github.com/dotnet/format/pull/893) -- [Improve FixAll support by using equivalence key when available (884)](https://www.github.com/dotnet/format/pull/884) -- [Only run analyzers against specified project when workspace is a project (865)](https://www.github.com/dotnet/format/pull/865) -- [When matching all files don't rely on FileMatcher (864)](https://www.github.com/dotnet/format/pull/864) -- [Fix markdown formatting in example table (858)](https://www.github.com/dotnet/format/pull/858) -- [Add ability to read --{in,ex}clude value from stdin (790)](https://www.github.com/dotnet/format/pull/790) -- [Add test to ensure code containing comment is treated as generated. (857)](https://www.github.com/dotnet/format/pull/857) -- [Fixes #834 : error reportfile without directory specified (842)](https://www.github.com/dotnet/format/pull/842) -- [Log there were warnings loading the workspace if diagnostics are reported (841)](https://www.github.com/dotnet/format/pull/841) -- [Fix CommandLine_AllArguments_Bind test (818)](https://www.github.com/dotnet/format/pull/818) -- [Fix Run argument names (817)](https://www.github.com/dotnet/format/pull/817) -- [Add option for whitespace formatting (774)](https://www.github.com/dotnet/format/pull/774) -- [Load analyzer assemlbies in their own AssemblyLoadContext (746)](https://www.github.com/dotnet/format/pull/746) -- [Check that file exists before considering it for formatting (775)](https://www.github.com/dotnet/format/pull/775) -- [Report formatted files and counts based based on reported issues. (776)](https://www.github.com/dotnet/format/pull/776) -- [Support generated_code editorconfig setting (780)](https://www.github.com/dotnet/format/pull/780) -- [Create integrations.md (777)](https://www.github.com/dotnet/format/pull/777) -- [Fix warnings and apply suggestions. (767)](https://www.github.com/dotnet/format/pull/767) -- [Improve folder workspace performance (763)](https://www.github.com/dotnet/format/pull/763) -- [Improve folder performance (760)](https://www.github.com/dotnet/format/pull/760) -- [Update --include and --exclude documentation (761)](https://www.github.com/dotnet/format/pull/761) -- [Remove aliases for the fix style and fix analyzers options (753)](https://www.github.com/dotnet/format/pull/753) -- [Run analyzers during integration tests (728)](https://www.github.com/dotnet/format/pull/728) -- [Remove unnecessary imports (749)](https://www.github.com/dotnet/format/pull/749) -- [Only include compiler diagnostics if a fixer supports them (750)](https://www.github.com/dotnet/format/pull/750) -- [Added CodeFormatter tests for `--fix-style` (751)](https://www.github.com/dotnet/format/pull/751) -- [Format one solution per repo during integration tests (739)](https://www.github.com/dotnet/format/pull/739) -- [Filter analyzers by project language before running (725)](https://www.github.com/dotnet/format/pull/725) -- [Run all analyzers even when a fixer isn't present (723)](https://www.github.com/dotnet/format/pull/723) -- [Update documentation for analyzers (722)](https://www.github.com/dotnet/format/pull/722) -- [Add devcontainer to better support Codespaces (721)](https://www.github.com/dotnet/format/pull/721) -- [Add validation when specifying --folder and analyzers (715)](https://www.github.com/dotnet/format/pull/715) -- [Merge in Feature/analyzers (713)](https://www.github.com/dotnet/format/pull/713) -- [Remove deprecated options and aliases (710)](https://www.github.com/dotnet/format/pull/710) -- [Added reflection based discovery of analyzers and fixes (698)](https://www.github.com/dotnet/format/pull/698) -- [Only run Imports formatter when is has configuration in the .editorconfig (701)](https://www.github.com/dotnet/format/pull/701) +- Implicit restore when fixing code style or 3rd party analyzers. Opt-out with `--no-restore` options. +- Adopt csc style warnings and errors +- Write warnings and errors to standard error stream + +### Changes +- [Update System.CommandLine to 2.0.0-beta1.21216.1 (1118)](https://www.github.com/dotnet/format/pull/1118) +- [Support AdditionalDocument changes (1106)](https://www.github.com/dotnet/format/pull/1106) +- [Fix typo in examples (1082)](https://www.github.com/dotnet/format/pull/1082) +- [Run CodeStyle formatter before removing unnecessary imports (1071)](https://www.github.com/dotnet/format/pull/1071) +- [Allow Solution Filter files to be passed as the workspace path (1059)](https://www.github.com/dotnet/format/pull/1059) +- [Add .pre-commit-hooks.yaml (872)](https://www.github.com/dotnet/format/pull/872) +- [Add implicit restore when running analysis. Adds `--no-restore` option. (1015)](https://www.github.com/dotnet/format/pull/1015) +- [Add separate command for binary log (1044)](https://www.github.com/dotnet/format/pull/1044) +- [Use correct flag for codestyle codefixes (1037)](https://www.github.com/dotnet/format/pull/1037) +- [Enhance whitespace issue logging with a detailed TextChange message (1017)](https://www.github.com/dotnet/format/pull/1017) +- [Log all formatter error messages in a csc-style (1016)](https://www.github.com/dotnet/format/pull/1016) +- [LogDebug each project's applied .editorconfig (1013)](https://www.github.com/dotnet/format/pull/1013) +- [Add option to filter diagnostics by id (1007)](https://www.github.com/dotnet/format/pull/1007) +- [Fix pre-commit directory (1004)](https://www.github.com/dotnet/format/pull/1004) +- [Log warnings and errors to the standard error stream (982)](https://www.github.com/dotnet/format/pull/982) +- [Only report fixable compiler diagnostics. (981)](https://www.github.com/dotnet/format/pull/981) + +### .NET Core 2.1 SDK Support + +The dotnet-format 5.x releases will continue to support users who only have .NET Core 2.1 SDK installed. Releases with bug fixes will continue until it reaches [end of support](https://dotnet.microsoft.com/platform/support/policy/dotnet-core) on August 21, 2021. Version 6.0 will require .NET Core SDK 3.1 or higher. ### How To Install From f70ee4c49e9e23482ece6751747eac59c4b02005 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 4 May 2021 18:02:45 -0700 Subject: [PATCH 1455/2702] Fix typo --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ad2f3fd254c9..2c886fd98088 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ #### Breaking Changes -- Implicit restore when fixing code style or 3rd party analyzers. Opt-out with `--no-restore` options. -- Adopt csc style warnings and errors -- Write warnings and errors to standard error stream +- Implicit restore when fixing code style or 3rd party analyzers (disable with `--no-restore`) +- Adopt csc style for warnings and errors +- Warnings and errors are now written to the standard error stream #### Changes - [Update System.CommandLine to 2.0.0-beta1.21216.1 (1118)](https://www.github.com/dotnet/format/pull/1118) From d5d1a1bb17663b8f3fb5515b7183211c9fafeecf Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 4 May 2021 16:57:11 -0700 Subject: [PATCH 1456/2702] filter tests better --- eng/perf.ps1 | 4 ++-- perf/FormattedFiles.cs | 2 +- perf/NoFilesFormatted.cs | 3 +-- perf/RealWorldSolution.cs | 2 +- perf/Utilities/SolutionPathSetter.cs | 15 +++++++++++++-- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/eng/perf.ps1 b/eng/perf.ps1 index 1e243a9e1cc3..44c7d17ac258 100644 --- a/eng/perf.ps1 +++ b/eng/perf.ps1 @@ -44,12 +44,12 @@ try { if ($micro) { # Default case, run very small tests - Invoke-Expression 'dotnet run -c Release -f netcoreapp2.1 --runtimes netcoreapp3.1 --project dotnet-format.Performance.csproj -- --memory --join --filter *Formatted*' + Invoke-Expression 'dotnet run -c Release -f netcoreapp2.1 --runtimes netcoreapp3.1 --project dotnet-format.Performance.csproj -- --memory --join --filter Microsoft.CodeAnalysis.Tools.Perf.Micro*' exit 0 } if ($real) { - Invoke-Expression 'dotnet run -c Release -f netcoreapp2.1 --runtimes netcoreapp3.1 --project dotnet-format.Performance.csproj -- --memory --join --filter RealWorldSolution' + Invoke-Expression 'dotnet run -c Release -f netcoreapp2.1 --runtimes netcoreapp3.1 --project dotnet-format.Performance.csproj -- --memory --join --filter Microsoft.CodeAnalysis.Tools.Perf.Real*' exit 0 } diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index 42c58fefe757..ec451fda01fb 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -9,7 +9,7 @@ using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; -namespace Microsoft.CodeAnalysis.Tools.Perf +namespace Microsoft.CodeAnalysis.Tools.Perf.Micro { [SimpleJob(RuntimeMoniker.NetCoreApp31)] public class FormattedFiles diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index 36d33e55af80..c4507ed17bd5 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -2,11 +2,10 @@ using System; using System.Collections.Immutable; -using System.IO; -using System.Threading; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; + using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index 219b4d6da7d0..09b12b460536 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -10,7 +10,7 @@ using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; -namespace Microsoft.CodeAnalysis.Tools.Perf +namespace Microsoft.CodeAnalysis.Tools.Perf.Real { [Config(typeof(RealWorldConfig))] public class RealWorldSolution diff --git a/perf/Utilities/SolutionPathSetter.cs b/perf/Utilities/SolutionPathSetter.cs index 157f78871f63..b30e5deca04f 100644 --- a/perf/Utilities/SolutionPathSetter.cs +++ b/perf/Utilities/SolutionPathSetter.cs @@ -17,8 +17,19 @@ public static void SetCurrentDirectory() if (Interlocked.Increment(ref s_registered) == 1) { s_currentDirectory = Environment.CurrentDirectory; - var solutionPath = RepositoryRootDirectory; - Environment.CurrentDirectory = solutionPath; + var info = new DirectoryInfo(s_currentDirectory); + while (true) + { + if (File.Exists(Path.Combine(info.FullName, "format.sln"))) + { + break; + } + + info = info.Parent; + } + + + Environment.CurrentDirectory = info.FullName; } } From 19b220df0ce06df831e7a230897a1e600e02a34c Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 4 May 2021 17:17:09 -0700 Subject: [PATCH 1457/2702] restore solution --- eng/perf.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/perf.ps1 b/eng/perf.ps1 index 44c7d17ac258..197990f6248a 100644 --- a/eng/perf.ps1 +++ b/eng/perf.ps1 @@ -36,7 +36,8 @@ try { if ($real -or $all) { # Real-World case, download the project if (-not (Test-Path -LiteralPath "temp\project-system\ProjectSystem.sln")) { - Invoke-Expression 'eng\format-verifier.ps1 -repo https://github.com/dotnet/project-system -sha fc3b12e47adaad6e4813dc600acf190156fecc24 -testPath temp -stage prepare' + Invoke-Expression 'eng\format-verifier.ps1 -repo https://github.com/dotnet/project-system -sha 88387e5b7f3c9ccd342562a157e67f4a639ef421 -testPath temp -stage prepare' + Invoke-Expression 'dotnet restore temp\project-system\ProjectSystem.sln' } } From 67fcc375e28d5b3b98d8cddd0a21a2fd06ed5ac7 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 4 May 2021 18:13:32 -0700 Subject: [PATCH 1458/2702] Add commas --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c886fd98088..e381d3e3cf6c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ - Can now specify that format run against a solution filter with `dotnet format solution.slnf` - Can now filter diagnostics with `dotnet format --fix-analyzers --diagnostics ID0001` - Can now generate a MSBuild binary log with `dotnet format --binary-log PATH` -- Now with support for analyzers such as the [PublicApiAnalyzers](https://github.com/dotnet/roslyn-analyzers#microsoftcodeanalysispublicapianalyzers) which update non-code files +- Now with support for analyzers, such as the [PublicApiAnalyzers](https://github.com/dotnet/roslyn-analyzers#microsoftcodeanalysispublicapianalyzers), which update non-code files #### Breaking Changes From 9e6b4631be6395a3a0677379056dcc805d3e46af Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 5 May 2021 12:14:31 +0000 Subject: [PATCH 1459/2702] Update dependencies from https://github.com/dotnet/arcade build 20210504.3 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.21253.2 -> To Version 6.0.0-beta.21254.3 --- eng/Version.Details.xml | 4 ++-- eng/common/cross/build-rootfs.sh | 4 ++++ eng/common/templates/job/onelocbuild.yml | 2 ++ global.json | 8 ++++---- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3c43b7e0b1ab..e8e699bfb72e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -7,9 +7,9 @@ - + https://github.com/dotnet/arcade - e9fd640e1ec1890489ea66ad0f59e733448056da + 0cfaf935894a4c98ff7445c903f1b4c32990b127
diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 81e641a57b53..df0dfa5781cd 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -78,6 +78,10 @@ __IllumosPackages+=" openssl-1.1.1e" __IllumosPackages+=" zlib-1.2.11" __IllumosPackages+=" openldap-client-2.4.49" +# ML.NET dependencies +__UbuntuPackages+=" libomp5" +__UbuntuPackages+=" libomp-dev" + __UseMirror=0 __UnprocessedBuildArgs= diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml index b27d6faf3035..958db4064cf0 100644 --- a/eng/common/templates/job/onelocbuild.yml +++ b/eng/common/templates/job/onelocbuild.yml @@ -12,6 +12,7 @@ parameters: SourcesDirectory: $(Build.SourcesDirectory) CreatePr: true AutoCompletePr: false + UseLfLineEndings: true UseCheckedInLocProjectJson: false LanguageSet: VS_Main_Languages LclSource: lclFilesInRepo @@ -59,6 +60,7 @@ jobs: isCreatePrSelected: ${{ parameters.CreatePr }} ${{ if eq(parameters.CreatePr, true) }}: isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }} + isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }} packageSourceAuth: patAuth patVariable: ${{ parameters.CeapexPat }} ${{ if eq(parameters.RepoType, 'gitHub') }}: diff --git a/global.json b/global.json index 8cf2f1f5fc6d..04c5d2777787 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "tools": { - "dotnet": "6.0.100-preview.1.21103.13" + "dotnet": "6.0.100-preview.3.21202.5" }, "sdk": { - "version": "6.0.100-preview.1.21103.13" + "version": "6.0.100-preview.3.21202.5" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21253.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21254.3" } -} \ No newline at end of file +} From 93a040367d414877e66ad924c03c0ce3ddb10b51 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 5 May 2021 12:55:44 +0000 Subject: [PATCH 1460/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210504.26 (#1131) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3c43b7e0b1ab..d64207794577 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 28bd07cc74ebb4c3d5b2d9cb22b2fd60f5c580dd + 7b996850bb82a370ca74c3f57e0a4d4df1c90049 diff --git a/eng/Versions.props b/eng/Versions.props index 80b5021ccffa..939e0c18d3a0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-2.21254.8 + 4.0.0-2.21254.26 - 4.0.0-2.21254.26 + 4.0.0-2.21256.25 - 4.0.0-2.21256.25 + 4.0.0-2.21258.12 - 4.0.0-2.21258.12 + 4.0.0-2.21260.14 - 4.0.0-2.21260.14 + 4.0.0-2.21262.14 - 4.0.0-2.21262.14 + 4.0.0-2.21262.28 - 4.0.0-2.21262.28 + 4.0.0-2.21263.6 - 4.0.0-2.21263.6 + 4.0.0-2.21264.4 - 4.0.0-2.21264.4 + 4.0.0-1.21265.8 - 4.0.0-1.21265.8 + 4.0.0-1.21267.2 - 4.0.0-1.21267.2 + 4.0.0-1.21267.34 - 4.0.0-1.21267.34 + 4.0.0-1.21268.32 - 4.0.0-1.21268.32 + 4.0.0-1.21269.24 - 4.0.0-1.21269.24 + 4.0.0-1.21271.16 - 4.0.0-1.21271.16 + 4.0.0-1.21273.2 - 4.0.0-1.21273.2 + 4.0.0-1.21274.3 - 4.0.0-1.21274.3 + 4.0.0-1.21275.5 - 4.0.0-1.21275.5 + 4.0.0-1.21277.15 - 4.0.0-1.21277.15 + 4.0.0-1.21302.11 - 4.0.0-1.21302.11 + 4.0.0-1.21303.3 - 4.0.0-1.21303.3 + 4.0.0-1.21304.5 - 5.8.0-preview.3.6823 + 5.10.0-preview.2.7190 From fb0d541e10ea12ad4533d31fb91a6d9ad3fca537 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 10 Jun 2021 12:53:45 +0000 Subject: [PATCH 1505/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210609.13 (#1165) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a086ca1a6c78..e1d8e0126de4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - b6a9f8c39f7a71b02b9a8b929f002777e4efd6f1 + 0458b94e587b106819b771f82e940c7db7705e9a diff --git a/eng/Versions.props b/eng/Versions.props index 01534020f758..4ecd63cd0421 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-1.21304.5 + 4.0.0-1.21309.13 - 4.0.0-1.21309.13 + 4.0.0-2.21310.45 - 4.0.0-2.21310.45 + 4.0.0-2.21313.1 - 4.0.0-2.21313.1 + 4.0.0-2.21314.7 - 5.8.0-preview.3.6823 + 5.10.0 diff --git a/global.json b/global.json index a5c22e0b57ba..b0fc0e58dbb3 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "6.0.100-preview.1.21103.13", + "dotnet": "6.0.100-preview.4.21255.9", "runtimes": { "dotnet": [ "3.1.7" @@ -8,9 +8,9 @@ } }, "sdk": { - "version": "6.0.100-preview.1.21103.13" + "version": "6.0.100-preview.4.21255.9" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21253.2" } -} +} \ No newline at end of file From 6ad2441173294cf55b9cd10bb2694d406fc1e03d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 15 Jun 2021 18:35:37 -0700 Subject: [PATCH 1518/2702] Add 2 minute timeout for running unit test in CI --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 913eb8bd6aff..fa991686d632 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,7 +26,7 @@ jobs: _configuration: Release timeoutInMinutes: 10 steps: - - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine + - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine /p:TestTimeout=120000 displayName: Build and Test - task: PublishTestResults@2 inputs: @@ -57,7 +57,7 @@ jobs: _configuration: Release timeoutInMinutes: 10 steps: - - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine + - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine /p:TestTimeout=120000 displayName: Build and Test - task: PublishTestResults@2 displayName: Publish xUnit Test Results @@ -90,7 +90,7 @@ jobs: _configuration: Release timeoutInMinutes: 10 steps: - - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine + - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine /p:TestTimeout=120000 displayName: Build and Test - task: PublishTestResults@2 displayName: Publish xUnit Test Results From 463bc6d074723cd0035c1f4fe27425c9e14c92b5 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 15 Jun 2021 18:47:20 -0700 Subject: [PATCH 1519/2702] Pass -verbose to log test running when timeout reached --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fa991686d632..a495868db562 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,7 +26,7 @@ jobs: _configuration: Release timeoutInMinutes: 10 steps: - - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine /p:TestTimeout=120000 + - script: eng\common\cibuild.cmd -configuration $(_configuration) -prepareMachine /p:TestTimeout=120000 /p:TestRunnerAdditionalArguments="-verbose" displayName: Build and Test - task: PublishTestResults@2 inputs: @@ -57,7 +57,7 @@ jobs: _configuration: Release timeoutInMinutes: 10 steps: - - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine /p:TestTimeout=120000 + - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine /p:TestTimeout=120000 /p:TestRunnerAdditionalArguments="-verbose" displayName: Build and Test - task: PublishTestResults@2 displayName: Publish xUnit Test Results @@ -90,7 +90,7 @@ jobs: _configuration: Release timeoutInMinutes: 10 steps: - - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine /p:TestTimeout=120000 + - script: ./eng/common/cibuild.sh --configuration $(_configuration) --prepareMachine /p:TestTimeout=120000 /p:TestRunnerAdditionalArguments="-verbose" displayName: Build and Test - task: PublishTestResults@2 displayName: Publish xUnit Test Results From 359293f80d7ea2896c1544511bd9389f52e47403 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 16 Jun 2021 08:42:59 -0700 Subject: [PATCH 1520/2702] Skip tests that stall when run on CI --- tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs | 2 +- tests/CodeFormatterTests.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs index 7565061e6170..9e60f5692f0e 100644 --- a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs +++ b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs @@ -121,7 +121,7 @@ void M() await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Analyzers, analyzerReferences: analyzerReferences); } - [Fact] + [Fact(Skip = "Test stalls when run on CI with NET6 Preview 4")] public async Task TestIDisposableAnalyzer_AddsUsing() { var analyzerReferences = GetAnalyzerReferences("IDisposable"); diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index da287568d63b..be00d7f7be2b 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -413,7 +413,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 3); } - [MSBuildFact] + [MSBuildFact(Skip = "Test stalls when run on CI with NET6 Preview 4")] public async Task NoFilesFormattedInCodeStyleSolution_WhenNotFixingCodeStyle() { await TestFormatWorkspaceAsync( @@ -427,7 +427,7 @@ await TestFormatWorkspaceAsync( fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle); } - [MSBuildFact] + [MSBuildFact(Skip = "Test stalls when run on CI with NET6 Preview 4")] public async Task NoFilesFormattedInCodeStyleSolution_WhenFixingCodeStyleErrors() { await TestFormatWorkspaceAsync( @@ -442,7 +442,7 @@ await TestFormatWorkspaceAsync( codeStyleSeverity: DiagnosticSeverity.Error); } - [MSBuildFact] + [MSBuildFact(Skip = "Test stalls when run on CI with NET 6 Preview 4")] public async Task FilesFormattedInCodeStyleSolution_WhenFixingCodeStyleWarnings() { await TestFormatWorkspaceAsync( @@ -457,7 +457,7 @@ await TestFormatWorkspaceAsync( codeStyleSeverity: DiagnosticSeverity.Warning); } - [MSBuildFact] + [MSBuildFact(Skip = "Test stalls when run on CI with NET 6 Preview 4")] public async Task FilesFormattedInCodeStyleSolutionFilter_WhenFixingCodeStyleWarnings() { var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilterFilePath, _output); @@ -475,7 +475,7 @@ await TestFormatWorkspaceAsync( codeStyleSeverity: DiagnosticSeverity.Warning); } - [MSBuildFact] + [MSBuildFact(Skip = "Test stalls when run on CI with NET6 Preview 4")] public async Task NoFilesFormattedInAnalyzersSolution_WhenNotFixingAnalyzers() { await TestFormatWorkspaceAsync( @@ -489,7 +489,7 @@ await TestFormatWorkspaceAsync( fixCategory: FixCategory.Whitespace); } - [MSBuildFact] + [MSBuildFact(Skip = "Test stalls when run on CI with NET 6 Preview 4")] public async Task FilesFormattedInAnalyzersSolution_WhenFixingAnalyzerErrors() { await TestFormatWorkspaceAsync( From 2e001cedf63f6cd7aa3e0cb96b5c57950db59dde Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 16 Jun 2021 21:02:13 +0000 Subject: [PATCH 1521/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210615.3 (#1171) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 46b3673c2931..bf0f6ae38c1c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - a7e93be30a9d60049bf37ea0fd5d62bc86b0a7a2 + a5797021074d6bace834abbf03baf6c13fce337f diff --git a/eng/Versions.props b/eng/Versions.props index 36ac13256923..7989a0fe783c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-2.21314.7 + 4.0.0-2.21315.3 - 4.0.0-2.21315.3 + 4.0.0-3.21316.29 - 4.0.0-3.21316.29 + 4.0.0-2.21317.30 - 4.0.0-2.21317.30 + 4.0.0-2.21318.13 - 4.0.0-2.21318.13 + 4.0.0-2.21319.2 - 4.0.0-2.21319.2 + 4.0.0-2.21320.2 - 4.0.0-2.21320.2 + 4.0.0-2.21321.3 - 4.0.0-2.21321.3 + 4.0.0-2.21322.50 - 4.0.0-2.21322.50 + 4.0.0-2.21324.2 - 4.0.0-2.21324.2 + 4.0.0-2.21325.9 - 4.0.0-2.21325.9 + 4.0.0-2.21327.2 - 4.0.0-2.21327.2 + 4.0.0-2.21327.4 - 4.0.0-2.21327.4 + 4.0.0-2.21328.17 - 4.0.0-2.21328.17 + 4.0.0-2.21329.25 - 4.0.0-2.21329.25 + 4.0.0-2.21352.2 - 4.0.0-2.21352.2 + 4.0.0-2.21352.6 - 4.0.0-2.21352.6 + 4.0.0-2.21353.4 - 4.0.0-2.21353.4 + 4.0.0-2.21356.1 - 4.0.0-2.21356.1 + 4.0.0-2.21358.2 - 4.0.0-2.21358.2 + 4.0.0-2.21359.14 - 4.0.0-2.21359.14 + 4.0.0-2.21362.3 - 4.0.0-2.21362.3 + 4.0.0-3.21364.1 powershell invocations # as dot sourcing isn't possible. @@ -632,6 +672,17 @@ function ExitWithExitCode([int] $exitCode) { exit $exitCode } +# Check if $LASTEXITCODE is a nonzero exit code (NZEC). If so, print a Azure Pipeline error for +# diagnostics, then exit the script with the $LASTEXITCODE. +function Exit-IfNZEC([string] $category = "General") { + Write-Host "Exit code $LASTEXITCODE" + if ($LASTEXITCODE -ne 0) { + $message = "Last command failed with exit code $LASTEXITCODE." + Write-PipelineTelemetryError -Force -Category $category -Message $message + ExitWithExitCode $LASTEXITCODE + } +} + function Stop-Processes() { Write-Host 'Killing running build processes...' foreach ($processName in $processesToStopOnExit) { diff --git a/global.json b/global.json index 8058d7ea478b..1756e7173764 100644 --- a/global.json +++ b/global.json @@ -11,6 +11,6 @@ "version": "6.0.100-preview.4.21255.9" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21363.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21364.3" } } From de50f551e854802261b761b48f518f5f8ad4be72 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 13:18:51 +0000 Subject: [PATCH 1562/2702] [main] Update dependencies from dotnet/roslyn (#1217) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 53a65ff3e354..7cd03adb88d1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 4b08003567c2f78395ade495e362bee169ac86df + 475cf7802d401b2de3d68c42ed08a3bd1475344d diff --git a/eng/Versions.props b/eng/Versions.props index ac2d2ed92094..9efa6bef1f40 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21364.1 + 4.0.0-3.21366.3 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 53a65ff3e354..9c3539cbc3a6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,6 +5,14 @@ https://github.com/dotnet/roslyn 4b08003567c2f78395ade495e362bee169ac86df + + https://github.com/dotnet/command-line-api + d6d49b068ffa199ca60a2aa4a2d31e748c4dbe73 + + + https://github.com/dotnet/command-line-api + d6d49b068ffa199ca60a2aa4a2d31e748c4dbe73 + diff --git a/eng/Versions.props b/eng/Versions.props index ac2d2ed92094..347b532c0c9a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -11,10 +11,15 @@ due to the shim executable containing a hardcoded path which includes the release version. --> true + + 4.0.0-3.21364.1 + + 2.0.0-beta1.21364.1 + 0.3.0-alpha.21364.1 true - - From 1410d87a9cd41edf25655e40d9befbd4e6264185 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 16 Jul 2021 15:27:17 -0700 Subject: [PATCH 1565/2702] Fix formatting --- src/CommandLineExtensions.cs | 4 ++-- src/FormatCommand.cs | 2 -- tests/ProgramTests.cs | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/CommandLineExtensions.cs b/src/CommandLineExtensions.cs index 57a584533778..91ccfbda3a68 100644 --- a/src/CommandLineExtensions.cs +++ b/src/CommandLineExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; using System.CommandLine.Parsing; @@ -72,4 +72,4 @@ internal static bool WasOptionUsed(this ParseResult result, params string[] alia .Any(token => aliases.Contains(token.Value)); } } -} \ No newline at end of file +} diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index 50cba49cb3ee..ad745849e3d9 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -3,8 +3,6 @@ using System; using System.CommandLine; using System.CommandLine.Parsing; -using System.Diagnostics.CodeAnalysis; -using System.Linq; using System.Threading.Tasks; namespace Microsoft.CodeAnalysis.Tools diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 09af3b3a16e3..7bcb67795679 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -5,7 +5,6 @@ using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.Parsing; -using System.Linq; using System.Threading.Tasks; using Xunit; From ed2dce906aaf56109df2e8c9a508da464a20442f Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 16 Jul 2021 15:35:28 -0700 Subject: [PATCH 1566/2702] Fix brace placement --- src/FormatCommand.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs index ad745849e3d9..8952e8c7ea22 100644 --- a/src/FormatCommand.cs +++ b/src/FormatCommand.cs @@ -52,10 +52,12 @@ internal static RootCommand CreateCommandLineOptions() { AllowMultipleArgumentsPerToken = true }, - new Option(new[] { "--include" }, () => Array.Empty(), Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) { + new Option(new[] { "--include" }, () => Array.Empty(), Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) + { AllowMultipleArgumentsPerToken = true }, - new Option(new[] { "--exclude" }, () => Array.Empty(), Resources.A_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) { + new Option(new[] { "--exclude" }, () => Array.Empty(), Resources.A_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) + { AllowMultipleArgumentsPerToken = true }, new Option(new[] { "--check" }, Resources.Formats_files_without_saving_changes_to_disk_Terminates_with_a_non_zero_exit_code_if_any_files_were_formatted), From 7a34550f40bb10fe9cf55f272763ce5d75b6a4b0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 17 Jul 2021 02:54:49 +0000 Subject: [PATCH 1567/2702] Update dependencies from https://github.com/dotnet/arcade build 20210715.11 (#1219) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5055b3300319..8a50447ee2a3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 6a8491b61e0c243cbb6a7ff4966b48e6d1e075b1 + 7b88b24068ecb4f6cf1da8395dbc2dee25a700bd diff --git a/global.json b/global.json index 1756e7173764..29463dabea05 100644 --- a/global.json +++ b/global.json @@ -11,6 +11,6 @@ "version": "6.0.100-preview.4.21255.9" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21364.3" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21365.11" } } From 5380d9de8ed60be3a63052dd5677c9274b8a216f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 17 Jul 2021 13:01:04 +0000 Subject: [PATCH 1568/2702] Update dependencies from https://github.com/dotnet/arcade build 20210716.1 (#1224) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8a50447ee2a3..6aa84c9c4b8d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 7b88b24068ecb4f6cf1da8395dbc2dee25a700bd + b03966cd85285e425ffe56003c0ab57e103dd14e diff --git a/global.json b/global.json index 29463dabea05..ad0429e20b29 100644 --- a/global.json +++ b/global.json @@ -11,6 +11,6 @@ "version": "6.0.100-preview.4.21255.9" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21365.11" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21366.1" } } From b90fa93c3658154b7f3eaadf04ecc8588d38dd58 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 17 Jul 2021 13:06:43 +0000 Subject: [PATCH 1569/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210716.21 (#1225) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6aa84c9c4b8d..f6eba1e748d6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 475cf7802d401b2de3d68c42ed08a3bd1475344d + 51dcd69e8c58039719f02fbb6044db030d60fd02 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 2af88fb8c922..8678036a0c9b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21366.3 + 4.0.0-3.21366.21 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 91cdf692cd49954309ea8cd8f2d266c9c4a1602f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 18 Jul 2021 12:51:34 +0000 Subject: [PATCH 1570/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210717.2 (#1227) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f6eba1e748d6..75b440f2338a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 51dcd69e8c58039719f02fbb6044db030d60fd02 + 0adab879c8b4fb2bc264e6d4bcc4d4686ad94525 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 8678036a0c9b..4609e07c5957 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21366.21 + 4.0.0-3.21367.2 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 4e6ed0908ba14dc19da1478326ab08872ee41baa Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 19 Jul 2021 12:36:24 +0000 Subject: [PATCH 1571/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210719.1 (#1229) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 75b440f2338a..105765ba3689 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 0adab879c8b4fb2bc264e6d4bcc4d4686ad94525 + ea623578b108856d3416af28af61060ed3d695e8 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 4609e07c5957..37881fcf1820 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21367.2 + 4.0.0-3.21369.1 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From ad1653f54f90d5007dd321366dc7cdfcf8bdd101 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 20 Jul 2021 12:56:44 +0000 Subject: [PATCH 1572/2702] Update dependencies from https://github.com/dotnet/arcade build 20210719.3 (#1233) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 105765ba3689..9973c336869a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - b03966cd85285e425ffe56003c0ab57e103dd14e + e97027cf100d2b532adce387e5cb93a373de93c9 diff --git a/global.json b/global.json index ad0429e20b29..cf412b7b22b5 100644 --- a/global.json +++ b/global.json @@ -11,6 +11,6 @@ "version": "6.0.100-preview.4.21255.9" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21366.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21369.3" } } From f6be21e133b2a385fd87beb603a007b6eb541976 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 20 Jul 2021 12:57:22 +0000 Subject: [PATCH 1573/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210720.5 (#1234) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9973c336869a..6aefdb0bcfa4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ea623578b108856d3416af28af61060ed3d695e8 + f9052e66a1c71b14a9f3e653a1a34baa50b22b4d https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 37881fcf1820..2cfef7724dd2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21369.1 + 4.0.0-3.21370.5 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From b56d0c4749d4796e31ce9d0d45de493f304e07d5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 21 Jul 2021 13:05:49 +0000 Subject: [PATCH 1574/2702] Update dependencies from https://github.com/dotnet/arcade build 20210720.12 (#1236) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6aefdb0bcfa4..d19f59fee28c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - e97027cf100d2b532adce387e5cb93a373de93c9 + 89806f0b9e93ad2bbe32c654412835c0801a2032 diff --git a/global.json b/global.json index cf412b7b22b5..2248ed94bfcb 100644 --- a/global.json +++ b/global.json @@ -11,6 +11,6 @@ "version": "6.0.100-preview.4.21255.9" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21369.3" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21370.12" } } From 22a170cdcb965fd11a60926cfab0460960a45603 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 21 Jul 2021 13:11:54 +0000 Subject: [PATCH 1575/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210720.20 (#1237) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d19f59fee28c..98b752415b6e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - f9052e66a1c71b14a9f3e653a1a34baa50b22b4d + 9e22877bb6fe2bc9aa31be05f2f2e0ffe07a774b https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 2cfef7724dd2..e5974ae54d31 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21370.5 + 4.0.0-3.21370.20 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 955d8084f4a232884d6dbd0a567ee0af4f55c71c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 22 Jul 2021 12:41:14 +0000 Subject: [PATCH 1576/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210721.14 (#1240) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 98b752415b6e..92604b093cc1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 9e22877bb6fe2bc9aa31be05f2f2e0ffe07a774b + 4319ccf0a51018e2673ab2e6c2fe80bdbbab9a0c https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index e5974ae54d31..a4c088e5c3c7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21370.20 + 4.0.0-3.21371.14 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 72c80f6d5116afb50c5441c5b81c15909317d7df Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 23 Jul 2021 16:28:19 +0000 Subject: [PATCH 1577/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210722.2 (#1242) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 92604b093cc1..e0359263cc30 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 4319ccf0a51018e2673ab2e6c2fe80bdbbab9a0c + c9d1842832e43b36bd79e6c223c18b3bca3a0096 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index a4c088e5c3c7..8752ac0fb020 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21371.14 + 4.0.0-3.21372.2 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From a4c6893e78105730f979e3784abfb69bb9a02e9c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 24 Jul 2021 12:44:31 +0000 Subject: [PATCH 1578/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210723.8 (#1244) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e0359263cc30..c522d9d43ea1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c9d1842832e43b36bd79e6c223c18b3bca3a0096 + 5f124755232afa7b9903d6bdfcaeb47f39c8838e https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 8752ac0fb020..fb76e2c1f525 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21372.2 + 4.0.0-3.21373.8 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 34d9c87fc7b264944ba6266f73f0cb1634c48d09 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 27 Jul 2021 12:44:39 +0000 Subject: [PATCH 1579/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210726.22 (#1245) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c522d9d43ea1..d7849d075023 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 5f124755232afa7b9903d6bdfcaeb47f39c8838e + e27f7efccbaae080da912af40d12ae36a8268dfb https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index fb76e2c1f525..8bca40a70570 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21373.8 + 4.0.0-3.21376.22 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 39e3fb2d3314b57cf21b96b94906788d372a281c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 28 Jul 2021 12:54:49 +0000 Subject: [PATCH 1580/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210727.25 (#1246) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d7849d075023..bb2589f421b8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - e27f7efccbaae080da912af40d12ae36a8268dfb + b1874706298929978bfd46b266ac30227769db32 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 8bca40a70570..dfa01a42d564 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21376.22 + 4.0.0-3.21377.25 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 798dfa5405786e2df045acee60d9e40b2d5a778d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 29 Jul 2021 13:05:39 +0000 Subject: [PATCH 1581/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210728.8 (#1247) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bb2589f421b8..d1686a2de3db 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - b1874706298929978bfd46b266ac30227769db32 + d0f606931d664cdcd332294253541993bc3fe944 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index dfa01a42d564..27acae47e9d2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-3.21377.25 + 4.0.0-4.21378.8 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 97f9da043b0eeac1acf20c1e6d07e6088f340947 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 30 Jul 2021 13:04:54 +0000 Subject: [PATCH 1582/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210729.14 (#1249) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d1686a2de3db..6c334e2e8385 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - d0f606931d664cdcd332294253541993bc3fe944 + 3a06c12480787c39e37354dd5d171fa6d91dece1 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 27acae47e9d2..74a01a8d3e06 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21378.8 + 4.0.0-4.21379.14 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From bb72c051b8c07a4c1c594d5218600f8ada212304 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 Aug 2021 12:42:54 +0000 Subject: [PATCH 1583/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210803.24 (#1251) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6c334e2e8385..05339b9b1540 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 3a06c12480787c39e37354dd5d171fa6d91dece1 + 45ebe48aca16136619ef7e53ad399a5a3b7fd82b https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 74a01a8d3e06..a64677f8fffb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21379.14 + 4.0.0-4.21403.24 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 2858bcebae5f7a17ce9aa9aa7bf354bca6ea573a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 Aug 2021 13:03:19 +0000 Subject: [PATCH 1584/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210804.8 (#1252) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 05339b9b1540..c8184ae7184f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 45ebe48aca16136619ef7e53ad399a5a3b7fd82b + 38582c4d3f32679e5cc29bf86c4bde012ed2baee https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index a64677f8fffb..656b01bc3cf7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21403.24 + 4.0.0-4.21404.8 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From b9dd70a0e7ebac5471bf8f62d2c27095b799726a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 6 Aug 2021 12:41:37 +0000 Subject: [PATCH 1585/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210805.11 (#1254) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c8184ae7184f..429506e6cd2d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 38582c4d3f32679e5cc29bf86c4bde012ed2baee + 11fd8546d403c08900d1f7cd199064ef4efebf9d https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 656b01bc3cf7..ae4af7ee9418 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21404.8 + 4.0.0-4.21405.11 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 4cfc122a8bf0aea36964569367829577f3a663fc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 7 Aug 2021 13:16:15 +0000 Subject: [PATCH 1586/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210806.11 (#1257) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 429506e6cd2d..0b2a5e5234fb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 11fd8546d403c08900d1f7cd199064ef4efebf9d + cbbcf5cce5bde875fb196e19fcee46c1a62b38a0 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index ae4af7ee9418..091491f28f03 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21405.11 + 4.0.0-4.21406.11 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 9ebf034a0f51c1bacb9b6d60e9cbff70104e3d5e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 12:41:49 +0000 Subject: [PATCH 1587/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210809.4 (#1259) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0b2a5e5234fb..44c6244269d5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - cbbcf5cce5bde875fb196e19fcee46c1a62b38a0 + 1febdfa3452149ec0476831ecc0786ec5a243038 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 091491f28f03..ed2f793e79da 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21406.11 + 4.0.0-4.21409.4 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From a9d93dafdec8a62fc72794b2fb31608d83509126 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 11 Aug 2021 12:43:18 +0000 Subject: [PATCH 1588/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210810.7 (#1262) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 44c6244269d5..900bf36a359d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 1febdfa3452149ec0476831ecc0786ec5a243038 + d06c4494fbd2d7036623afaa35febfb67b6bf135 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index ed2f793e79da..96c1ac1c002e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21409.4 + 4.0.0-4.21410.7 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From ebf4c55d976e98f2db6c4d4854c467f6b43f4df7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 11 Aug 2021 19:43:08 +0000 Subject: [PATCH 1589/2702] [main] Update dependencies from dotnet/arcade (#1261) [main] Update dependencies from dotnet/arcade - Remove 3.1 runtime install - Update NuGet packages to fix unit tests - Unskip tests that were hanging on NET 6 Preview 4 - Remove unnecessary using directive --- Directory.Packages.props | 2 +- eng/Version.Details.xml | 4 +- eng/common/cross/arm/sources.list.trusty | 11 -- eng/common/cross/arm/trusty-lttng-2.4.patch | 71 ---------- eng/common/cross/arm/trusty.patch | 97 ------------- eng/common/cross/arm64/sources.list.trusty | 11 -- eng/common/cross/build-rootfs.sh | 36 +++-- eng/common/cross/x86/sources.list.trusty | 11 -- eng/common/internal/Tools.csproj | 3 +- .../templates/job/publish-build-assets.yml | 26 +++- eng/common/templates/phases/base.yml | 130 ------------------ .../templates/phases/publish-build-assets.yml | 52 ------- eng/common/templates/steps/source-build.yml | 31 +++++ global.json | 13 +- .../ThirdPartyAnalyzerFormatterTests.cs | 3 +- tests/CodeFormatterTests.cs | 12 +- 16 files changed, 88 insertions(+), 425 deletions(-) delete mode 100644 eng/common/cross/arm/sources.list.trusty delete mode 100644 eng/common/cross/arm/trusty-lttng-2.4.patch delete mode 100644 eng/common/cross/arm/trusty.patch delete mode 100644 eng/common/cross/arm64/sources.list.trusty delete mode 100644 eng/common/cross/x86/sources.list.trusty delete mode 100644 eng/common/templates/phases/base.yml delete mode 100644 eng/common/templates/phases/publish-build-assets.yml diff --git a/Directory.Packages.props b/Directory.Packages.props index 402fd0db96fe..b7f9fce0444b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ 16.5.0 5.0.0-preview.7.20364.11 - 5.10.0 + 6.0.0-preview.3.179 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 900bf36a359d..748c251687c8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 89806f0b9e93ad2bbe32c654412835c0801a2032 + 382667fff0b58c362855a42c3529ba294fd0514c diff --git a/eng/common/cross/arm/sources.list.trusty b/eng/common/cross/arm/sources.list.trusty deleted file mode 100644 index 07d8f88d82e8..000000000000 --- a/eng/common/cross/arm/sources.list.trusty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/arm/trusty-lttng-2.4.patch b/eng/common/cross/arm/trusty-lttng-2.4.patch deleted file mode 100644 index 8e4dd7ae7191..000000000000 --- a/eng/common/cross/arm/trusty-lttng-2.4.patch +++ /dev/null @@ -1,71 +0,0 @@ -From e72c9d7ead60e3317bd6d1fade995c07021c947b Mon Sep 17 00:00:00 2001 -From: Mathieu Desnoyers -Date: Thu, 7 May 2015 13:25:04 -0400 -Subject: [PATCH] Fix: building probe providers with C++ compiler - -Robert Daniels wrote: -> > I'm attempting to use lttng userspace tracing with a C++ application -> > on an ARM platform. I'm using GCC 4.8.4 on Linux 3.14 with the 2.6 -> > release of lttng. I've compiled lttng-modules, lttng-ust, and -> > lttng-tools and have been able to get a simple test working with C -> > code. When I attempt to run the hello.cxx test on my target it will -> > segfault. -> -> -> I spent a little time digging into this issue and finally discovered the -> cause of my segfault with ARM C++ tracepoints. -> -> There is a struct called 'lttng_event' in ust-events.h which contains an -> empty union 'u'. This was the cause of my issue. Under C, this empty union -> compiles to a zero byte member while under C++ it compiles to a one byte -> member, and in my case was four-byte aligned which caused my C++ code to -> have the 'cds_list_head node' offset incorrectly by four bytes. This lead -> to an incorrect linked list structure which caused my issue. -> -> Since this union is empty, I simply removed it from the struct and everything -> worked correctly. -> -> I don't know the history or purpose behind this empty union so I'd like to -> know if this is a safe fix. If it is I can submit a patch with the union -> removed. - -That's a very nice catch! - -We do not support building tracepoint probe provider with -g++ yet, as stated in lttng-ust(3): - -"- Note for C++ support: although an application instrumented with - tracepoints can be compiled with g++, tracepoint probes should be - compiled with gcc (only tested with gcc so far)." - -However, if it works fine with this fix, then I'm tempted to take it, -especially because removing the empty union does not appear to affect -the layout of struct lttng_event as seen from liblttng-ust, which must -be compiled with a C compiler, and from probe providers compiled with -a C compiler. So all we are changing is the layout of a probe provider -compiled with a C++ compiler, which is anyway buggy at the moment, -because it is not compatible with the layout expected by liblttng-ust -compiled with a C compiler. - -Reported-by: Robert Daniels -Signed-off-by: Mathieu Desnoyers ---- - include/lttng/ust-events.h | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/usr/include/lttng/ust-events.h b/usr/include/lttng/ust-events.h -index 328a875..3d7a274 100644 ---- a/usr/include/lttng/ust-events.h -+++ b/usr/include/lttng/ust-events.h -@@ -407,8 +407,6 @@ struct lttng_event { - void *_deprecated1; - struct lttng_ctx *ctx; - enum lttng_ust_instrumentation instrumentation; -- union { -- } u; - struct cds_list_head node; /* Event list in session */ - struct cds_list_head _deprecated2; - void *_deprecated3; --- -2.7.4 - diff --git a/eng/common/cross/arm/trusty.patch b/eng/common/cross/arm/trusty.patch deleted file mode 100644 index 2f2972f8eb59..000000000000 --- a/eng/common/cross/arm/trusty.patch +++ /dev/null @@ -1,97 +0,0 @@ -diff -u -r a/usr/include/urcu/uatomic/generic.h b/usr/include/urcu/uatomic/generic.h ---- a/usr/include/urcu/uatomic/generic.h 2014-03-28 06:04:42.000000000 +0900 -+++ b/usr/include/urcu/uatomic/generic.h 2017-02-13 10:35:21.189927116 +0900 -@@ -65,17 +65,17 @@ - switch (len) { - #ifdef UATOMIC_HAS_ATOMIC_BYTE - case 1: -- return __sync_val_compare_and_swap_1(addr, old, _new); -+ return __sync_val_compare_and_swap_1((uint8_t *) addr, old, _new); - #endif - #ifdef UATOMIC_HAS_ATOMIC_SHORT - case 2: -- return __sync_val_compare_and_swap_2(addr, old, _new); -+ return __sync_val_compare_and_swap_2((uint16_t *) addr, old, _new); - #endif - case 4: -- return __sync_val_compare_and_swap_4(addr, old, _new); -+ return __sync_val_compare_and_swap_4((uint32_t *) addr, old, _new); - #if (CAA_BITS_PER_LONG == 64) - case 8: -- return __sync_val_compare_and_swap_8(addr, old, _new); -+ return __sync_val_compare_and_swap_8((uint64_t *) addr, old, _new); - #endif - } - _uatomic_link_error(); -@@ -100,20 +100,20 @@ - switch (len) { - #ifdef UATOMIC_HAS_ATOMIC_BYTE - case 1: -- __sync_and_and_fetch_1(addr, val); -+ __sync_and_and_fetch_1((uint8_t *) addr, val); - return; - #endif - #ifdef UATOMIC_HAS_ATOMIC_SHORT - case 2: -- __sync_and_and_fetch_2(addr, val); -+ __sync_and_and_fetch_2((uint16_t *) addr, val); - return; - #endif - case 4: -- __sync_and_and_fetch_4(addr, val); -+ __sync_and_and_fetch_4((uint32_t *) addr, val); - return; - #if (CAA_BITS_PER_LONG == 64) - case 8: -- __sync_and_and_fetch_8(addr, val); -+ __sync_and_and_fetch_8((uint64_t *) addr, val); - return; - #endif - } -@@ -139,20 +139,20 @@ - switch (len) { - #ifdef UATOMIC_HAS_ATOMIC_BYTE - case 1: -- __sync_or_and_fetch_1(addr, val); -+ __sync_or_and_fetch_1((uint8_t *) addr, val); - return; - #endif - #ifdef UATOMIC_HAS_ATOMIC_SHORT - case 2: -- __sync_or_and_fetch_2(addr, val); -+ __sync_or_and_fetch_2((uint16_t *) addr, val); - return; - #endif - case 4: -- __sync_or_and_fetch_4(addr, val); -+ __sync_or_and_fetch_4((uint32_t *) addr, val); - return; - #if (CAA_BITS_PER_LONG == 64) - case 8: -- __sync_or_and_fetch_8(addr, val); -+ __sync_or_and_fetch_8((uint64_t *) addr, val); - return; - #endif - } -@@ -180,17 +180,17 @@ - switch (len) { - #ifdef UATOMIC_HAS_ATOMIC_BYTE - case 1: -- return __sync_add_and_fetch_1(addr, val); -+ return __sync_add_and_fetch_1((uint8_t *) addr, val); - #endif - #ifdef UATOMIC_HAS_ATOMIC_SHORT - case 2: -- return __sync_add_and_fetch_2(addr, val); -+ return __sync_add_and_fetch_2((uint16_t *) addr, val); - #endif - case 4: -- return __sync_add_and_fetch_4(addr, val); -+ return __sync_add_and_fetch_4((uint32_t *) addr, val); - #if (CAA_BITS_PER_LONG == 64) - case 8: -- return __sync_add_and_fetch_8(addr, val); -+ return __sync_add_and_fetch_8((uint64_t *) addr, val); - #endif - } - _uatomic_link_error(); diff --git a/eng/common/cross/arm64/sources.list.trusty b/eng/common/cross/arm64/sources.list.trusty deleted file mode 100644 index 07d8f88d82e8..000000000000 --- a/eng/common/cross/arm64/sources.list.trusty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse \ No newline at end of file diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 735a4c828389..5c05b39f1019 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -6,10 +6,10 @@ usage() { echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [--skipunmount] --rootfsdir ]" echo "BuildArch can be: arm(default), armel, arm64, x86" - echo "CodeName - optional, Code name for Linux, can be: trusty, xenial(default), zesty, bionic, alpine, alpine3.9 or alpine3.13. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." - echo " for FreeBSD can be: freebsd11 or freebsd12." + echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine, alpine3.9 or alpine3.13. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." + echo " for FreeBSD can be: freebsd11, freebsd12, freebsd13" echo " for illumos can be: illumos." - echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FReeBSD" + echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FreeBSD" echo "--skipunmount - optional, will skip the unmount of rootfs folder." echo "--use-mirror - optional, use mirror URL to fetch resources, when available." exit 1 @@ -60,13 +60,15 @@ __AlpinePackages+=" krb5-dev" __AlpinePackages+=" openssl-dev" __AlpinePackages+=" zlib-dev" -__FreeBSDBase="12.1-RELEASE" +__FreeBSDBase="12.2-RELEASE" __FreeBSDPkg="1.12.0" +__FreeBSDABI="12" __FreeBSDPackages="libunwind" __FreeBSDPackages+=" icu" __FreeBSDPackages+=" libinotify" __FreeBSDPackages+=" lttng-ust" __FreeBSDPackages+=" krb5" +__FreeBSDPackages+=" terminfo-db" __IllumosPackages="icu-64.2nb2" __IllumosPackages+=" mit-krb5-1.16.2nb4" @@ -144,11 +146,6 @@ while :; do no-lldb) unset __LLDB_Package ;; - trusty) # Ubuntu 14.04 - if [ "$__CodeName" != "jessie" ]; then - __CodeName=trusty - fi - ;; xenial) # Ubuntu 16.04 if [ "$__CodeName" != "jessie" ]; then __CodeName=xenial @@ -208,12 +205,20 @@ while :; do ;; freebsd11) __FreeBSDBase="11.3-RELEASE" + __FreeBSDABI="11" ;& freebsd12) __CodeName=freebsd __BuildArch=x64 __SkipUnmount=1 ;; + freebsd13) + __CodeName=freebsd + __FreeBSDBase="13.0-RELEASE" + __FreeBSDABI="13" + __BuildArch=x64 + __SkipUnmount=1 + ;; illumos) __CodeName=illumos __BuildArch=x64 @@ -291,9 +296,9 @@ if [[ "$__CodeName" == "alpine" ]]; then rm -r $__ApkToolsDir elif [[ "$__CodeName" == "freebsd" ]]; then mkdir -p $__RootfsDir/usr/local/etc + JOBS="$(getconf _NPROCESSORS_ONLN)" wget -O - https://download.freebsd.org/ftp/releases/amd64/${__FreeBSDBase}/base.txz | tar -C $__RootfsDir -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version - # For now, ask for 11 ABI even on 12. This can be revisited later. - echo "ABI = \"FreeBSD:11:amd64\"; FINGERPRINTS = \"${__RootfsDir}/usr/share/keys\"; REPOS_DIR = [\"${__RootfsDir}/etc/pkg\"]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO;" > ${__RootfsDir}/usr/local/etc/pkg.conf + echo "ABI = \"FreeBSD:${__FreeBSDABI}:amd64\"; FINGERPRINTS = \"${__RootfsDir}/usr/share/keys\"; REPOS_DIR = [\"${__RootfsDir}/etc/pkg\"]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO;" > ${__RootfsDir}/usr/local/etc/pkg.conf echo "FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly", mirror_type: \"srv\", signature_type: \"fingerprints\", fingerprints: \"${__RootfsDir}/usr/share/keys/pkg\", enabled: yes }" > ${__RootfsDir}/etc/pkg/FreeBSD.conf mkdir -p $__RootfsDir/tmp # get and build package manager @@ -301,7 +306,7 @@ elif [[ "$__CodeName" == "freebsd" ]]; then cd $__RootfsDir/tmp/pkg-${__FreeBSDPkg} # needed for install to succeed mkdir -p $__RootfsDir/host/etc - ./autogen.sh && ./configure --prefix=$__RootfsDir/host && make && make install + ./autogen.sh && ./configure --prefix=$__RootfsDir/host && make -j "$JOBS" && make install rm -rf $__RootfsDir/tmp/pkg-${__FreeBSDPkg} # install packages we need. INSTALL_AS_USER=$(whoami) $__RootfsDir/host/sbin/pkg -r $__RootfsDir -C $__RootfsDir/usr/local/etc/pkg.conf update @@ -364,13 +369,6 @@ elif [[ -n $__CodeName ]]; then umount $__RootfsDir/* || true fi - if [[ "$__BuildArch" == "arm" && "$__CodeName" == "trusty" ]]; then - pushd $__RootfsDir - patch -p1 < $__CrossDir/$__BuildArch/trusty.patch - patch -p1 < $__CrossDir/$__BuildArch/trusty-lttng-2.4.patch - popd - fi - if [[ "$__BuildArch" == "armel" && "$__CodeName" == "jessie" ]]; then pushd $__RootfsDir patch -p1 < $__CrossDir/$__BuildArch/armel.jessie.patch diff --git a/eng/common/cross/x86/sources.list.trusty b/eng/common/cross/x86/sources.list.trusty deleted file mode 100644 index 9b3085436e9a..000000000000 --- a/eng/common/cross/x86/sources.list.trusty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe -deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe - -deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted -deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted - -deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse -deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index f46d5efe2e32..beb9c4648ea1 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -1,5 +1,4 @@ - - + net472 diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 3b9e2524ff37..fe9dfdf720cf 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -94,7 +94,31 @@ jobs: PathtoPublish: '$(Build.StagingDirectory)/ReleaseConfigs.txt' PublishLocation: Container ArtifactName: ReleaseConfigs - + + - task: powershell@2 + displayName: Check if SymbolPublishingExclusionsFile.txt exists + inputs: + targetType: inline + script: | + $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" + if(Test-Path -Path $symbolExclusionfile) + { + Write-Host "SymbolExclusionFile exists" + Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]true" + } + else{ + Write-Host "Symbols Exclusion file does not exists" + Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]false" + } + + - task: PublishBuildArtifacts@1 + displayName: Publish SymbolPublishingExclusionsFile Artifact + condition: eq(variables['SymbolExclusionFile'], 'true') + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' + PublishLocation: Container + ArtifactName: ReleaseConfigs + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - template: /eng/common/templates/steps/publish-logs.yml parameters: diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml deleted file mode 100644 index 0123cf43b168..000000000000 --- a/eng/common/templates/phases/base.yml +++ /dev/null @@ -1,130 +0,0 @@ -parameters: - # Optional: Clean sources before building - clean: true - - # Optional: Git fetch depth - fetchDepth: '' - - # Optional: name of the phase (not specifying phase name may cause name collisions) - name: '' - # Optional: display name of the phase - displayName: '' - - # Optional: condition for the job to run - condition: '' - - # Optional: dependencies of the phase - dependsOn: '' - - # Required: A defined YAML queue - queue: {} - - # Required: build steps - steps: [] - - # Optional: variables - variables: {} - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. - runAsPublic: false - - ## Telemetry variables - - # Optional: enable sending telemetry - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _HelixBuildConfig - differentiate between Debug, Release, other - # _HelixSource - Example: build/product - # _HelixType - Example: official/dotnet/arcade/$(Build.SourceBranch) - enableTelemetry: false - - # Optional: Enable installing Microbuild plugin - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _TeamName - the name of your team - # _SignType - 'test' or 'real' - enableMicrobuild: false - -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - -phases: -- phase: ${{ parameters.name }} - - ${{ if ne(parameters.displayName, '') }}: - displayName: ${{ parameters.displayName }} - - ${{ if ne(parameters.condition, '') }}: - condition: ${{ parameters.condition }} - - ${{ if ne(parameters.dependsOn, '') }}: - dependsOn: ${{ parameters.dependsOn }} - - queue: ${{ parameters.queue }} - - ${{ if ne(parameters.variables, '') }}: - variables: - ${{ insert }}: ${{ parameters.variables }} - - steps: - - checkout: self - clean: ${{ parameters.clean }} - ${{ if ne(parameters.fetchDepth, '') }}: - fetchDepth: ${{ parameters.fetchDepth }} - - - ${{ if eq(parameters.enableTelemetry, 'true') }}: - - template: /eng/common/templates/steps/telemetry-start.yml - parameters: - buildConfig: $(_HelixBuildConfig) - helixSource: $(_HelixSource) - helixType: $(_HelixType) - runAsPublic: ${{ parameters.runAsPublic }} - - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - # Internal only resource, and Microbuild signing shouldn't be applied to PRs. - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: MicroBuildSigningPlugin@2 - displayName: Install MicroBuild plugin - inputs: - signType: $(_SignType) - zipSources: false - feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json - - env: - TeamName: $(_TeamName) - continueOnError: false - condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - - # Run provided build steps - - ${{ parameters.steps }} - - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - # Internal only resources - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: MicroBuildCleanup@1 - displayName: Execute Microbuild cleanup tasks - condition: and(always(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - env: - TeamName: $(_TeamName) - - - ${{ if eq(parameters.enableTelemetry, 'true') }}: - - template: /eng/common/templates/steps/telemetry-end.yml - parameters: - helixSource: $(_HelixSource) - helixType: $(_HelixType) - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: CopyFiles@2 - displayName: Gather Asset Manifests - inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' - TargetFolder: '$(Build.StagingDirectory)/AssetManifests' - continueOnError: false - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) - - task: PublishBuildArtifacts@1 - displayName: Push Asset Manifests - inputs: - PathtoPublish: '$(Build.StagingDirectory)/AssetManifests' - PublishLocation: Container - ArtifactName: AssetManifests - continueOnError: false - condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) diff --git a/eng/common/templates/phases/publish-build-assets.yml b/eng/common/templates/phases/publish-build-assets.yml deleted file mode 100644 index 4e51e472e2bb..000000000000 --- a/eng/common/templates/phases/publish-build-assets.yml +++ /dev/null @@ -1,52 +0,0 @@ -parameters: - dependsOn: '' - queue: {} - configuration: 'Debug' - condition: succeeded() - continueOnError: false - runAsPublic: false - publishUsingPipelines: false -phases: - - phase: Asset_Registry_Publish - displayName: Publish to Build Asset Registry - dependsOn: ${{ parameters.dependsOn }} - queue: ${{ parameters.queue }} - variables: - _BuildConfig: ${{ parameters.configuration }} - steps: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download artifact - inputs: - artifactName: AssetManifests - downloadPath: '$(Build.StagingDirectory)/Download' - checkDownloadedFiles: true - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - task: AzureKeyVault@1 - inputs: - azureSubscription: 'DotNet-Engineering-Services_KeyVault' - KeyVaultName: EngKeyVault - SecretsFilter: 'MaestroAccessToken' - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - task: PowerShell@2 - displayName: Publish Build Assets - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet - /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) - /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com - /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} - /p:Configuration=$(_BuildConfig) - condition: ${{ parameters.condition }} - continueOnError: ${{ parameters.continueOnError }} - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' - PublishLocation: Container - ArtifactName: $(Agent.Os)_Asset_Registry_Publish - continueOnError: true - condition: always() diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml index e20637ed6a17..ba40dc82f141 100644 --- a/eng/common/templates/steps/source-build.yml +++ b/eng/common/templates/steps/source-build.yml @@ -18,6 +18,35 @@ steps: set -x df -h + # If building on the internal project, the artifact feeds variable may be available (usually only if needed) + # In that case, call the feed setup script to add internal feeds corresponding to public ones. + # In addition, add an msbuild argument to copy the WIP from the repo to the target build location. + # This is because SetupNuGetSources.sh will alter the current NuGet.config file, and we need to preserve those + # changes. + $internalRestoreArgs= + if [ '$(dn-bot-dnceng-artifact-feeds-rw)' != '$''(dn-bot-dnceng-artifact-feeds-rw)' ]; then + # Temporarily work around https://github.com/dotnet/arcade/issues/7709 + chmod +x $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh + $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh $(Build.SourcesDirectory)/NuGet.config $(dn-bot-dnceng-artifact-feeds-rw) + internalRestoreArgs='/p:CopyWipIntoInnerSourceBuildRepo=true' + + # The 'Copy WIP' feature of source build uses git stash to apply changes from the original repo. + # This only works if there is a username/email configured, which won't be the case in most CI runs. + git config --get user.email + if [ $? -ne 0 ]; then + git config user.email dn-bot@microsoft.com + git config user.name dn-bot + fi + fi + + # If building on the internal project, the internal storage variable may be available (usually only if needed) + # In that case, add variables to allow the download of internal runtimes if the specified versions are not found + # in the default public locations. + internalRuntimeDownloadArgs= + if [ '$(dotnetclimsrc-read-sas-token-base64)' != '$''(dotnetclimsrc-read-sas-token-base64)' ]; then + internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetclimsrc.blob.core.windows.net/dotnet /p:DotNetRuntimeSourceFeedKey=$(dotnetclimsrc-read-sas-token-base64) --runtimesourcefeed https://dotnetclimsrc.blob.core.windows.net/dotnet --runtimesourcefeedkey $(dotnetclimsrc-read-sas-token-base64)' + fi + buildConfig=Release # Check if AzDO substitutes in a build config from a variable, and use it if so. if [ '$(_BuildConfig)' != '$''(_BuildConfig)' ]; then @@ -43,6 +72,8 @@ steps: --configuration $buildConfig \ --restore --build --pack $publishArgs -bl \ $officialBuildArgs \ + $internalRuntimeDownloadArgs \ + $internalRestoreArgs \ $targetRidArgs \ /p:SourceBuildNonPortable=${{ parameters.platform.nonPortable }} \ /p:ArcadeBuildFromSource=true diff --git a/global.json b/global.json index 2248ed94bfcb..4c9820a2bb15 100644 --- a/global.json +++ b/global.json @@ -1,16 +1,11 @@ { "tools": { - "dotnet": "6.0.100-preview.4.21255.9", - "runtimes": { - "dotnet": [ - "3.1.7" - ] - } + "dotnet": "6.0.100-rc.1.21379.2" }, "sdk": { - "version": "6.0.100-preview.4.21255.9" + "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21370.12" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21406.6" } -} +} \ No newline at end of file diff --git a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs index be063a58535f..7565061e6170 100644 --- a/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs +++ b/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Tools.Formatters; using Microsoft.CodeAnalysis.Tools.Tests.Formatters; using Microsoft.CodeAnalysis.Tools.Tests.Utilities; -using Microsoft.CodeAnalysis.Tools.Tests.XUnit; using Microsoft.CodeAnalysis.Tools.Workspaces; using Xunit; using Xunit.Abstractions; @@ -122,7 +121,7 @@ void M() await AssertCodeChangedAsync(testCode, expectedCode, editorConfig, fixCategory: FixCategory.Analyzers, analyzerReferences: analyzerReferences); } - [ConditionalFact(typeof(WindowsOnly))] + [Fact] public async Task TestIDisposableAnalyzer_AddsUsing() { var analyzerReferences = GetAnalyzerReferences("IDisposable"); diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index b0ee1f697980..da287568d63b 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -413,7 +413,7 @@ await TestFormatWorkspaceAsync( expectedFileCount: 3); } - [MSBuildFact(typeof(WindowsOnly))] + [MSBuildFact] public async Task NoFilesFormattedInCodeStyleSolution_WhenNotFixingCodeStyle() { await TestFormatWorkspaceAsync( @@ -427,7 +427,7 @@ await TestFormatWorkspaceAsync( fixCategory: FixCategory.Whitespace | FixCategory.CodeStyle); } - [MSBuildFact(typeof(WindowsOnly))] + [MSBuildFact] public async Task NoFilesFormattedInCodeStyleSolution_WhenFixingCodeStyleErrors() { await TestFormatWorkspaceAsync( @@ -442,7 +442,7 @@ await TestFormatWorkspaceAsync( codeStyleSeverity: DiagnosticSeverity.Error); } - [MSBuildFact(typeof(WindowsOnly))] + [MSBuildFact] public async Task FilesFormattedInCodeStyleSolution_WhenFixingCodeStyleWarnings() { await TestFormatWorkspaceAsync( @@ -457,7 +457,7 @@ await TestFormatWorkspaceAsync( codeStyleSeverity: DiagnosticSeverity.Warning); } - [MSBuildFact(typeof(WindowsOnly))] + [MSBuildFact] public async Task FilesFormattedInCodeStyleSolutionFilter_WhenFixingCodeStyleWarnings() { var restoreExitCode = await NuGetHelper.PerformRestore(s_codeStyleSolutionFilterFilePath, _output); @@ -475,7 +475,7 @@ await TestFormatWorkspaceAsync( codeStyleSeverity: DiagnosticSeverity.Warning); } - [MSBuildFact(typeof(WindowsOnly))] + [MSBuildFact] public async Task NoFilesFormattedInAnalyzersSolution_WhenNotFixingAnalyzers() { await TestFormatWorkspaceAsync( @@ -489,7 +489,7 @@ await TestFormatWorkspaceAsync( fixCategory: FixCategory.Whitespace); } - [MSBuildFact(typeof(WindowsOnly))] + [MSBuildFact] public async Task FilesFormattedInAnalyzersSolution_WhenFixingAnalyzerErrors() { await TestFormatWorkspaceAsync( From 7a54bfad2af433493ce536f4ca853cbbedca0167 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 12 Aug 2021 13:00:44 +0000 Subject: [PATCH 1590/2702] Update dependencies from https://github.com/dotnet/arcade build 20210810.8 (#1266) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 748c251687c8..1965a4106939 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 382667fff0b58c362855a42c3529ba294fd0514c + e10772e3594e46a031574c20a4145441737ac56d diff --git a/global.json b/global.json index 4c9820a2bb15..3a090682e3b7 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21406.6" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21410.8" } -} \ No newline at end of file +} From 03f9b2d2086616707a2b7e07eacdd5d9d2bd250a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 13 Aug 2021 12:55:50 +0000 Subject: [PATCH 1591/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210812.9 (#1269) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1965a4106939..290590603bad 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - d06c4494fbd2d7036623afaa35febfb67b6bf135 + f1fde28830e4ef51b824ddb03334d2cd8510f914 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 96c1ac1c002e..9ec7d475a80c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21410.7 + 4.0.0-4.21412.9 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 3963b61d1e8055cc4f4d2974b95f8f0baac27f42 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 14 Aug 2021 12:44:12 +0000 Subject: [PATCH 1592/2702] Update dependencies from https://github.com/dotnet/arcade build 20210812.1 (#1271) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 290590603bad..ae3a85faedf7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - e10772e3594e46a031574c20a4145441737ac56d + 58ac7035021bd7277ef7582338afd25403fc9aea diff --git a/global.json b/global.json index 3a090682e3b7..447354221e76 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21410.8" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21412.1" } } From 7959360907289bbdbc77b2c4f6fafeab1e9f71da Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 12:54:30 +0000 Subject: [PATCH 1593/2702] Update dependencies from https://github.com/dotnet/arcade build 20210813.4 (#1273) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ae3a85faedf7..570cd35c93fb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 58ac7035021bd7277ef7582338afd25403fc9aea + 9b7027ba718462aa6410cef61a8be5a4283e7528 diff --git a/global.json b/global.json index 447354221e76..97cdec7c6f37 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21412.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21413.4" } } From 727a4ec856a56e39e1dea812107b876199865e32 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 12:54:59 +0000 Subject: [PATCH 1594/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210816.10 (#1274) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 570cd35c93fb..476ca840c9bd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - f1fde28830e4ef51b824ddb03334d2cd8510f914 + d3c561af0682fd0182b5897fb4f4d95a16da95c3 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 9ec7d475a80c..8cd4d364557c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21412.9 + 4.0.0-4.21416.10 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 624afb5283ab901837c7ed7af734586d21a8f8ed Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 18 Aug 2021 13:06:38 +0000 Subject: [PATCH 1595/2702] Update dependencies from https://github.com/dotnet/arcade build 20210817.1 (#1277) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 476ca840c9bd..34bb44def579 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 9b7027ba718462aa6410cef61a8be5a4283e7528 + df04f7bfcf0bdd315d5468e158a8cf6696760190 diff --git a/global.json b/global.json index 97cdec7c6f37..3d30f8ea8624 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21413.4" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21417.1" } } From 6a2ea5f44ba86ab450572de863f9425333fdcc44 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 12:52:32 +0000 Subject: [PATCH 1596/2702] Update dependencies from https://github.com/dotnet/arcade build 20210818.12 (#1278) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/build.sh | 1 + .../post-build/sourcelink-validation.ps1 | 17 ++++++++++----- eng/common/sdk-task.ps1 | 1 + .../templates/job/source-index-stage1.yml | 21 +++++++------------ eng/common/tools.ps1 | 21 +++++++++++++++++++ eng/common/tools.sh | 7 +++++++ global.json | 2 +- 8 files changed, 53 insertions(+), 21 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 34bb44def579..70c4334efe0c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - df04f7bfcf0bdd315d5468e158a8cf6696760190 + ac8b7514ca8bcac1d071a16b7a92cb52f7058871 diff --git a/eng/common/build.sh b/eng/common/build.sh index 55b298f16ccd..9d3042a943e4 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -187,6 +187,7 @@ function InitializeCustomToolset { } function Build { + TryLogClientIpAddress InitializeToolset InitializeCustomToolset diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 85c89861719a..3b6fc9533373 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -17,6 +17,7 @@ $global:RepoFiles = @{} $MaxParallelJobs = 16 $MaxRetries = 5 +$RetryWaitTimeInSeconds = 30 # Wait time between check for system load $SecondsBetweenLoadChecks = 10 @@ -99,9 +100,9 @@ $ValidatePackage = { $Status = 200 $Cache = $using:RepoFiles - $totalRetries = 0 + $attempts = 0 - while ($totalRetries -lt $using:MaxRetries) { + while ($attempts -lt $using:MaxRetries) { if ( !($Cache.ContainsKey($FilePath)) ) { try { $Uri = $Link -as [System.URI] @@ -113,7 +114,7 @@ $ValidatePackage = { else { # If it's not a github link, we want to break out of the loop and not retry. $Status = 0 - $totalRetries = $using:MaxRetries + $attempts = $using:MaxRetries } } catch { @@ -123,9 +124,15 @@ $ValidatePackage = { } if ($Status -ne 200) { - $totalRetries++ + $attempts++ - if ($totalRetries -ge $using:MaxRetries) { + if ($attempts -lt $using:MaxRetries) + { + $attemptsLeft = $using:MaxRetries - $attempts + Write-Warning "Download failed, $attemptsLeft attempts remaining, will retry in $using:RetryWaitTimeInSeconds seconds" + Start-Sleep -Seconds $using:RetryWaitTimeInSeconds + } + else { if ($NumFailedLinks -eq 0) { if ($FailedFiles.Value -eq 0) { Write-Host diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index b1bca63ab1d8..7ffa3591e9ca 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -83,6 +83,7 @@ try { } if ($restore) { + Try-LogClientIpAddress Build 'Restore' } diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index b58d42364b9e..1cc0c29e4fda 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -34,29 +34,24 @@ jobs: inputs: packageType: sdk version: 3.1.x - - - task: UseDotNet@2 - displayName: Use .NET Core sdk - inputs: - useGlobalJson: true + installationPath: $(Agent.TempDirectory)/dotnet + workingDirectory: $(Agent.TempDirectory) - script: | - dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path .source-index/tools - dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path .source-index/tools - echo ##vso[task.prependpath]$(Build.SourcesDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools displayName: Download Tools + # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. + workingDirectory: $(Agent.TempDirectory) - script: ${{ parameters.sourceIndexBuildCommand }} displayName: Build Repository - - script: BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output + - script: $(Agent.TempDirectory)/.source-index/tools/BinLogToSln -i $(BinlogPath) -r $(Build.SourcesDirectory) -n $(Build.Repository.Name) -o .source-index/stage1output displayName: Process Binlog into indexable sln - env: - DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2 - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - script: UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) + - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) displayName: Upload stage1 artifacts to source index env: BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) - DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 5d526c74d518..e607aa436976 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -154,6 +154,9 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { return $global:_DotNetInstallDir } + # In case of network error, try to log the current IP for reference + Try-LogClientIpAddress + # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism $env:DOTNET_MULTILEVEL_LOOKUP=0 @@ -872,3 +875,21 @@ if (!$disableConfigureToolsetImport) { } } } + +function Try-LogClientIpAddress() +{ + Write-Host "Attempting to log this client's IP for Azure Package feed telemetry purposes" + try + { + $result = Invoke-WebRequest -Uri "http://co1.msedge.net/fdv2/diagnostics.aspx" -UseBasicParsing + $lines = $result.Content.Split([Environment]::NewLine) + $socketIp = $lines | Select-String -Pattern "^Socket IP:.*" + Write-Host $socketIp + $clientIp = $lines | Select-String -Pattern "^Client IP:.*" + Write-Host $clientIp + } + catch + { + Write-Host "Unable to get this machine's effective IP address for logging: $_" + } +} diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 828119be411b..3c5f3a12c0a6 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -399,6 +399,13 @@ function StopProcesses { return 0 } +function TryLogClientIpAddress () { + echo 'Attempting to log this client''s IP for Azure Package feed telemetry purposes' + if command -v curl > /dev/null; then + curl -s 'http://co1.msedge.net/fdv2/diagnostics.aspx' | grep ' IP: ' + fi +} + function MSBuild { local args=$@ if [[ "$pipelines_log" == true ]]; then diff --git a/global.json b/global.json index 3d30f8ea8624..0b3303cfbea6 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21417.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21418.12" } } From d082a0d4107a4a61dbb87db989f0597f7e1d33b0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 12:53:10 +0000 Subject: [PATCH 1597/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210818.3 (#1279) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 70c4334efe0c..968f31c8ae92 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - d3c561af0682fd0182b5897fb4f4d95a16da95c3 + ec4452b89959159c8ba196e56a0d57de8414bdcb https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 8cd4d364557c..625fe97e4a91 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21416.10 + 4.0.0-4.21418.3 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 8eb7367edd4114c4cf7c28ce9d95a3c6ae2dd9e8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 20 Aug 2021 12:52:48 +0000 Subject: [PATCH 1598/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210820.2 (#1282) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 968f31c8ae92..bd0dacfe3d26 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ec4452b89959159c8ba196e56a0d57de8414bdcb + e8f2ac7e048cd62daaad888f13eff28f2684c63b https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 625fe97e4a91..89fb459b1501 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21418.3 + 4.0.0-4.21420.2 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From da19cd28ed7506d0bb3c93b262741b88e8cb988e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 20 Aug 2021 12:57:20 +0000 Subject: [PATCH 1599/2702] Update dependencies from https://github.com/dotnet/arcade build 20210819.2 (#1281) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bd0dacfe3d26..60a6ef2026d0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - ac8b7514ca8bcac1d071a16b7a92cb52f7058871 + 23372e950114fb772652f79d9990129db55edff8 diff --git a/global.json b/global.json index 0b3303cfbea6..a01c69ad5a30 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21418.12" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21419.2" } } From 83e30f559544553f73d0fb6e589505b48ae1d2c5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 21 Aug 2021 12:41:58 +0000 Subject: [PATCH 1600/2702] Update dependencies from https://github.com/dotnet/arcade build 20210820.4 (#1283) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/init-tools-native.sh | 2 +- eng/common/native/common-library.sh | 8 ++++++-- global.json | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 60a6ef2026d0..07520182d407 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 23372e950114fb772652f79d9990129db55edff8 + fe787bd48ed72e51a98eb5e4e5e5af74edb531e5 diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh index 5bd205b5da3b..3e6a8d6acf2f 100755 --- a/eng/common/init-tools-native.sh +++ b/eng/common/init-tools-native.sh @@ -10,7 +10,7 @@ force=false download_retries=5 retry_wait_time_seconds=30 global_json_file="$(dirname "$(dirname "${scriptroot}")")/global.json" -declare -A native_assets +declare -a native_assets . $scriptroot/pipeline-logging-functions.sh . $scriptroot/native/common-library.sh diff --git a/eng/common/native/common-library.sh b/eng/common/native/common-library.sh index bf272dcf55a5..080c2c283ae4 100755 --- a/eng/common/native/common-library.sh +++ b/eng/common/native/common-library.sh @@ -148,8 +148,12 @@ function NewScriptShim { fi if [[ ! -f $tool_file_path ]]; then - Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Specified tool file path:'$tool_file_path' does not exist" - return 1 + # try to see if the path is lower cased + tool_file_path="$(echo $tool_file_path | tr "[:upper:]" "[:lower:]")" + if [[ ! -f $tool_file_path ]]; then + Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Specified tool file path:'$tool_file_path' does not exist" + return 1 + fi fi local shim_contents=$'#!/usr/bin/env bash\n' diff --git a/global.json b/global.json index a01c69ad5a30..4799d8913b1e 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21419.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21420.4" } } From 7e05791723459806c6e7fdf805c38275006fc39f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 21 Aug 2021 12:42:37 +0000 Subject: [PATCH 1601/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210820.19 (#1284) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 07520182d407..ef281be2fc22 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - e8f2ac7e048cd62daaad888f13eff28f2684c63b + 158f906df6b1e4ca99fe7cf6ed78822515d64230 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 89fb459b1501..c789874d4d7c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21420.2 + 4.0.0-4.21420.19 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From de954bb1cbc0ed25d3b4f8a6e5225971c3a5373b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 13:02:05 +0000 Subject: [PATCH 1602/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210823.7 (#1285) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ef281be2fc22..daf9d22ed462 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 158f906df6b1e4ca99fe7cf6ed78822515d64230 + c051d9d7f02cc8d4a8bb4ebf111245dc309e0baa https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index c789874d4d7c..44d88f5d7437 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21420.19 + 4.0.0-4.21423.7 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 6af261cf5d452cb573828dc111961909c5b1ef0b Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 17 Aug 2021 18:16:09 -0700 Subject: [PATCH 1603/2702] [wip] moving to different command structure --- perf/FormattedFiles.cs | 57 ++-- perf/NoFilesFormatted.cs | 57 ++-- perf/RealWorldSolution.cs | 38 ++- perf/dotnet-format.Performance.csproj | 2 +- src/Commands/FormatAnalyzersCommand.cs | 75 +++++ src/Commands/FormatCommandCommon.cs | 276 +++++++++++++++ src/Commands/FormatStyleCommand.cs | 67 ++++ src/Commands/FormatWhitespaceCommand.cs | 87 +++++ src/Commands/RootFormatCommand.cs | 79 +++++ src/FormatCommand.cs | 124 ------- src/FormatOptions.cs | 105 ++---- src/Program.cs | 374 +-------------------- src/Properties/launchSettings.json | 6 +- src/Resources.resx | 81 +++-- src/dotnet-format.csproj | 30 +- src/xlf/Resources.cs.xlf | 45 +++ src/xlf/Resources.de.xlf | 45 +++ src/xlf/Resources.es.xlf | 45 +++ src/xlf/Resources.fr.xlf | 45 +++ src/xlf/Resources.it.xlf | 45 +++ src/xlf/Resources.ja.xlf | 45 +++ src/xlf/Resources.ko.xlf | 45 +++ src/xlf/Resources.pl.xlf | 45 +++ src/xlf/Resources.pt-BR.xlf | 45 +++ src/xlf/Resources.ru.xlf | 45 +++ src/xlf/Resources.tr.xlf | 45 +++ src/xlf/Resources.zh-Hans.xlf | 45 +++ src/xlf/Resources.zh-Hant.xlf | 45 +++ tests/CodeFormatterTests.cs | 7 +- tests/Formatters/AbstractFormatterTests.cs | 17 +- tests/Formatters/FormattedFilesTests.cs | 25 +- tests/ProgramTests.cs | 34 +- tests/dotnet-format.UnitTests.csproj | 2 +- 33 files changed, 1399 insertions(+), 729 deletions(-) create mode 100644 src/Commands/FormatAnalyzersCommand.cs create mode 100644 src/Commands/FormatCommandCommon.cs create mode 100644 src/Commands/FormatStyleCommand.cs create mode 100644 src/Commands/FormatWhitespaceCommand.cs create mode 100644 src/Commands/RootFormatCommand.cs delete mode 100644 src/FormatCommand.cs diff --git a/perf/FormattedFiles.cs b/perf/FormattedFiles.cs index ec451fda01fb..26f26287e5ef 100644 --- a/perf/FormattedFiles.cs +++ b/perf/FormattedFiles.cs @@ -35,17 +35,18 @@ public void FilesFormattedFolder() var options = new FormatOptions( workspacePath, workspaceType, - noRestore: false, + NoRestore: false, LogLevel.Error, - fixCategory: FixCategory.Whitespace, - codeStyleSeverity: DiagnosticSeverity.Error, - analyzerSeverity: DiagnosticSeverity.Error, - diagnostics: ImmutableHashSet.Empty, - saveFormattedFiles: false, - changesAreErrors: false, + FixCategory: FixCategory.Whitespace, + CodeStyleSeverity: DiagnosticSeverity.Error, + AnalyzerSeverity: DiagnosticSeverity.Error, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: false, + ChangesAreErrors: false, AllFileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -56,17 +57,18 @@ public void FilesFormattedProject() var options = new FormatOptions( workspacePath, workspaceType, - noRestore: false, + NoRestore: false, LogLevel.Error, - fixCategory: FixCategory.Whitespace, - codeStyleSeverity: DiagnosticSeverity.Error, - analyzerSeverity: DiagnosticSeverity.Error, - diagnostics: ImmutableHashSet.Empty, - saveFormattedFiles: false, - changesAreErrors: false, + FixCategory: FixCategory.Whitespace, + CodeStyleSeverity: DiagnosticSeverity.Error, + AnalyzerSeverity: DiagnosticSeverity.Error, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: false, + ChangesAreErrors: false, AllFileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -77,17 +79,18 @@ public void FilesFormattedSolution() var options = new FormatOptions( workspacePath, workspaceType, - noRestore: false, + NoRestore: false, LogLevel.Error, - fixCategory: FixCategory.Whitespace, - codeStyleSeverity: DiagnosticSeverity.Error, - analyzerSeverity: DiagnosticSeverity.Error, - diagnostics: ImmutableHashSet.Empty, - saveFormattedFiles: false, - changesAreErrors: false, + FixCategory: FixCategory.Whitespace, + CodeStyleSeverity: DiagnosticSeverity.Error, + AnalyzerSeverity: DiagnosticSeverity.Error, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: false, + ChangesAreErrors: false, AllFileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } diff --git a/perf/NoFilesFormatted.cs b/perf/NoFilesFormatted.cs index c4507ed17bd5..87b7f3d01981 100644 --- a/perf/NoFilesFormatted.cs +++ b/perf/NoFilesFormatted.cs @@ -35,17 +35,18 @@ public void NoFilesFormattedFolder() var options = new FormatOptions( workspacePath, workspaceType, - noRestore: false, + NoRestore: false, LogLevel.Error, - fixCategory: FixCategory.Whitespace, - codeStyleSeverity: DiagnosticSeverity.Error, - analyzerSeverity: DiagnosticSeverity.Error, - diagnostics: ImmutableHashSet.Empty, - saveFormattedFiles: false, - changesAreErrors: false, + FixCategory: FixCategory.Whitespace, + CodeStyleSeverity: DiagnosticSeverity.Error, + AnalyzerSeverity: DiagnosticSeverity.Error, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: false, + ChangesAreErrors: false, AllFileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -56,17 +57,18 @@ public void NoFilesFormattedProject() var options = new FormatOptions( workspacePath, workspaceType, - noRestore: false, + NoRestore: false, LogLevel.Error, - fixCategory: FixCategory.Whitespace, - codeStyleSeverity: DiagnosticSeverity.Error, - analyzerSeverity: DiagnosticSeverity.Error, - diagnostics: ImmutableHashSet.Empty, - saveFormattedFiles: false, - changesAreErrors: false, + FixCategory: FixCategory.Whitespace, + CodeStyleSeverity: DiagnosticSeverity.Error, + AnalyzerSeverity: DiagnosticSeverity.Error, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: false, + ChangesAreErrors: false, AllFileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -77,17 +79,18 @@ public void NoFilesFormattedSolution() var options = new FormatOptions( workspacePath, workspaceType, - noRestore: false, + NoRestore: false, LogLevel.Error, - fixCategory: FixCategory.Whitespace, - codeStyleSeverity: DiagnosticSeverity.Error, - analyzerSeverity: DiagnosticSeverity.Error, - diagnostics: ImmutableHashSet.Empty, - saveFormattedFiles: false, - changesAreErrors: false, + FixCategory: FixCategory.Whitespace, + CodeStyleSeverity: DiagnosticSeverity.Error, + AnalyzerSeverity: DiagnosticSeverity.Error, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: false, + ChangesAreErrors: false, AllFileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } diff --git a/perf/RealWorldSolution.cs b/perf/RealWorldSolution.cs index 09b12b460536..7eda06626610 100644 --- a/perf/RealWorldSolution.cs +++ b/perf/RealWorldSolution.cs @@ -35,17 +35,18 @@ public void FilesFormattedSolution() var options = new FormatOptions( workspacePath, workspaceType, - noRestore: false, + NoRestore: false, LogLevel.Error, - fixCategory: FixCategory.Whitespace, - codeStyleSeverity: DiagnosticSeverity.Error, - analyzerSeverity: DiagnosticSeverity.Error, - diagnostics: ImmutableHashSet.Empty, - saveFormattedFiles: false, - changesAreErrors: false, + FixCategory: FixCategory.Whitespace, + CodeStyleSeverity: DiagnosticSeverity.Error, + AnalyzerSeverity: DiagnosticSeverity.Error, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: false, + ChangesAreErrors: false, AllFileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } @@ -56,17 +57,18 @@ public void FilesFormattedFolder() var options = new FormatOptions( workspacePath, workspaceType, - noRestore: false, + NoRestore: false, LogLevel.Error, - fixCategory: FixCategory.Whitespace, - codeStyleSeverity: DiagnosticSeverity.Error, - analyzerSeverity: DiagnosticSeverity.Error, - diagnostics: ImmutableHashSet.Empty, - saveFormattedFiles: false, - changesAreErrors: false, + FixCategory: FixCategory.Whitespace, + CodeStyleSeverity: DiagnosticSeverity.Error, + AnalyzerSeverity: DiagnosticSeverity.Error, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: false, + ChangesAreErrors: false, AllFileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); _ = CodeFormatter.FormatWorkspaceAsync(options, EmptyLogger, default).GetAwaiter().GetResult(); } diff --git a/perf/dotnet-format.Performance.csproj b/perf/dotnet-format.Performance.csproj index 71d4fb7dd9d5..19097121b760 100644 --- a/perf/dotnet-format.Performance.csproj +++ b/perf/dotnet-format.Performance.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net6.0 Exe 9.0 diff --git a/src/Commands/FormatAnalyzersCommand.cs b/src/Commands/FormatAnalyzersCommand.cs new file mode 100644 index 000000000000..8c9edd63bda6 --- /dev/null +++ b/src/Commands/FormatAnalyzersCommand.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.CommandLine.Parsing; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using static Microsoft.CodeAnalysis.Tools.FormatCommandCommon; + +namespace Microsoft.CodeAnalysis.Tools.Commands +{ + internal static class FormatAnalyzersCommand + { + private static readonly FormatAnalyzersHandler s_analyzerHandler = new(); + + internal static Symbol GetCommand() + { + var command = new Command("analyzers", Resources.Run_3rd_party_analyzers__and_apply_fixes) + { + DiagnosticsOption, + SeverityOption, + }; + command.AddCommonOptions(); + command.Handler = s_analyzerHandler; + return command; + } + + private class FormatAnalyzersHandler : ICommandHandler + { + public async Task InvokeAsync(InvocationContext context) + { + var parseResult = context.ParseResult; + var formatOptions = parseResult.ParseVerbosityOption(FormatOptions.Instance); + var logger = context.Console.SetupLogging(minimalLogLevel: formatOptions.LogLevel, minimalErrorLevel: LogLevel.Warning); + formatOptions = parseResult.ParseCommonOptions(formatOptions, logger); + formatOptions = parseResult.ParseWorkspaceOptions(formatOptions); + + if (parseResult.HasOption(SeverityOption) && + parseResult.ValueForOption(SeverityOption) is string { Length: > 0 } analyzerSeverity) + { + formatOptions = formatOptions with { AnalyzerSeverity = GetSeverity(analyzerSeverity) }; + } + + if (parseResult.HasOption(DiagnosticsOption) && + parseResult.ValueForOption(DiagnosticsOption) is string[] { Length: > 0 } diagnostics) + { + formatOptions = formatOptions with { Diagnostics = diagnostics.ToImmutableHashSet() }; + } + + formatOptions = formatOptions with { FixCategory = FixCategory.Analyzers }; + + var formatResult = await CodeFormatter.FormatWorkspaceAsync( + formatOptions, + logger, + context.GetCancellationToken(), + binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); + return formatResult.GetExitCode(formatOptions.ChangesAreErrors); + + static DiagnosticSeverity GetSeverity(string? severity) + { + return severity?.ToLowerInvariant() switch + { + "" => DiagnosticSeverity.Error, + FixSeverity.Error => DiagnosticSeverity.Error, + FixSeverity.Warn => DiagnosticSeverity.Warning, + FixSeverity.Info => DiagnosticSeverity.Info, + _ => throw new ArgumentOutOfRangeException(nameof(severity)), + }; + } + } + } + } +} diff --git a/src/Commands/FormatCommandCommon.cs b/src/Commands/FormatCommandCommon.cs new file mode 100644 index 000000000000..d984ca952870 --- /dev/null +++ b/src/Commands/FormatCommandCommon.cs @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.CommandLine; +using System.CommandLine.Parsing; +using System.IO; +using System.Linq; +using System.Text; +using Microsoft.CodeAnalysis.Tools.Logging; +using Microsoft.CodeAnalysis.Tools.Utilities; +using Microsoft.CodeAnalysis.Tools.Workspaces; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace Microsoft.CodeAnalysis.Tools +{ + internal static class FormatCommandCommon + { + internal const int UnhandledExceptionExitCode = 1; + internal const int CheckFailedExitCode = 2; + internal const int UnableToLocateMSBuildExitCode = 3; + internal const int UnableToLocateDotNetCliExitCode = 4; + + private static string[] VerbosityLevels => new[] { "q", "quiet", "m", "minimal", "n", "normal", "d", "detailed", "diag", "diagnostic" }; + private static string[] SeverityLevels => new[] { "info", "warn", "error" }; + + public static readonly Argument SlnOrProjectArgument = new Argument(Resources.SolutionOrProjectArgumentName) + { + Description = Resources.SolutionOrProjectArgumentDescription, + Arity = ArgumentArity.ZeroOrOne + }.DefaultToCurrentDirectory(); + + internal static readonly Option FolderOption = new(new[] { "--folder" }, Resources.Whether_to_treat_the_workspace_argument_as_a_simple_folder_of_files); + internal static readonly Option NoRestoreOption = new(new[] { "--no-restore" }, Resources.Doesnt_execute_an_implicit_restore_before_formatting); + internal static readonly Option VerifyNoChanges = new(new[] { "--verify-no-changes" }, Resources.Verify_no_formatting_changes_would_be_performed_Terminates_with_a_non_zero_exit_code_if_any_files_would_have_been_formatted); + internal static readonly Option DiagnosticsOption = new(new[] { "--diagnostics" }, () => Array.Empty(), Resources.A_space_separated_list_of_diagnostic_ids_to_use_as_a_filter_when_fixing_code_style_or_3rd_party_issues) + { + AllowMultipleArgumentsPerToken = true + }; + internal static readonly Option SeverityOption = new Option("--severity", Resources.The_severity_of_diagnostics_to_fix_Allowed_values_are_info_warn_and_error).FromAmong(SeverityLevels); + internal static readonly Option IncludeOption = new(new[] { "--include" }, () => Array.Empty(), Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) + { + AllowMultipleArgumentsPerToken = true + }; + internal static readonly Option ExcludeOption = new(new[] { "--exclude" }, () => Array.Empty(), Resources.A_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) + { + AllowMultipleArgumentsPerToken = true + }; + internal static readonly Option IncludeGeneratedOption = new(new[] { "--include-generated" }, Resources.Format_files_generated_by_the_SDK); + internal static readonly Option VerbosityOption = new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic).FromAmong(VerbosityLevels); + internal static readonly Option BinarylogOption = new Option(new[] { "--binarylog" }, Resources.Log_all_project_or_solution_load_information_to_a_binary_log_file, argumentType: typeof(string), arity: ArgumentArity.ZeroOrOne) + { + ArgumentHelpName = "binary-log-path" + }.LegalFilePathsOnly(); + internal static readonly Option ReportOption = new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_json_report_in_the_given_directory, argumentType: typeof(string), arity: ArgumentArity.ZeroOrOne) + { + ArgumentHelpName = "report-path" + }.LegalFilePathsOnly(); + + public static void AddCommonOptions(this Command command) + { + command.AddArgument(SlnOrProjectArgument); + command.AddOption(NoRestoreOption); + command.AddOption(VerifyNoChanges); + command.AddOption(IncludeOption); + command.AddOption(ExcludeOption); + command.AddOption(IncludeGeneratedOption); + command.AddOption(VerbosityOption); + command.AddOption(BinarylogOption); + command.AddOption(ReportOption); + } + + public static Argument DefaultToCurrentDirectory(this Argument arg) + { + arg.SetDefaultValue(EnsureTrailingSlash(Directory.GetCurrentDirectory())); + return arg; + } + + public static ILogger SetupLogging(this IConsole console, LogLevel minimalLogLevel, LogLevel minimalErrorLevel) + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, minimalLogLevel, minimalErrorLevel)); + serviceCollection.AddLogging(); + + var serviceProvider = serviceCollection.BuildServiceProvider(); + var logger = serviceProvider.GetService>(); + + return logger!; + } + + public static int GetExitCode(this WorkspaceFormatResult formatResult, bool check) + { + if (!check) + { + return formatResult.ExitCode; + } + + return formatResult.FilesFormatted == 0 ? 0 : CheckFailedExitCode; + } + + public static FormatOptions ParseVerbosityOption(this ParseResult parseResult, FormatOptions formatOptions) + { + if (parseResult.HasOption(VerbosityOption) && + parseResult.ValueForOption(VerbosityOption) is string { Length: > 0 } verbosity) + { + formatOptions = formatOptions with { LogLevel = GetLogLevel(verbosity) }; + } + else + { + formatOptions = formatOptions with { LogLevel = LogLevel.Warning }; + } + + return formatOptions; + } + + public static FormatOptions ParseCommonOptions(this ParseResult parseResult, FormatOptions formatOptions, ILogger logger) + { + if (parseResult.HasOption(NoRestoreOption)) + { + formatOptions = formatOptions with { NoRestore = true }; + } + + if (parseResult.HasOption(VerifyNoChanges)) + { + formatOptions = formatOptions with { ChangesAreErrors = true }; + formatOptions = formatOptions with { SaveFormattedFiles = false }; + } + + if (parseResult.HasOption(IncludeGeneratedOption)) + { + formatOptions = formatOptions with { IncludeGeneratedFiles = true }; + } + + if (parseResult.HasOption(IncludeOption) || parseResult.HasOption(ExcludeOption)) + { + var fileToInclude = parseResult.ValueForOption(IncludeOption) ?? Array.Empty(); + var fileToExclude = parseResult.ValueForOption(ExcludeOption) ?? Array.Empty(); + HandleStandardInput(logger, ref fileToInclude, ref fileToExclude); + formatOptions = formatOptions with { FileMatcher = SourceFileMatcher.CreateMatcher(fileToInclude, fileToExclude) }; + } + + if (parseResult.HasOption(ReportOption)) + { + formatOptions = formatOptions with { ReportPath = string.Empty }; + + if (parseResult.ValueForOption(ReportOption) is string { Length: > 0 } reportPath) + { + formatOptions = formatOptions with { ReportPath = reportPath }; + } + } + + if (parseResult.HasOption(BinarylogOption)) + { + formatOptions = formatOptions with { BinaryLogPath = "format.binlog" }; + + if (parseResult.ValueForOption(BinarylogOption) is string { Length: > 0 } binaryLogPath) + { + formatOptions = Path.GetExtension(binaryLogPath)?.Equals(".binlog") == false + ? (formatOptions with { BinaryLogPath = Path.ChangeExtension(binaryLogPath, ".binlog") }) + : (formatOptions with { BinaryLogPath = binaryLogPath }); + } + } + + return formatOptions; + + static void HandleStandardInput(ILogger logger, ref string[] include, ref string[] exclude) + { + string[] s_standardInputKeywords = { "/dev/stdin", "-" }; + const int CheckFailedExitCode = 2; + + var isStandardMarkerUsed = false; + if (include.Length == 1 && s_standardInputKeywords.Contains(include[0])) + { + if (TryReadFromStandardInput(ref include)) + { + isStandardMarkerUsed = true; + } + } + + if (exclude.Length == 1 && s_standardInputKeywords.Contains(exclude[0])) + { + if (isStandardMarkerUsed) + { + logger.LogCritical(Resources.Standard_input_used_multiple_times); + Environment.Exit(CheckFailedExitCode); + } + + TryReadFromStandardInput(ref exclude); + } + + static bool TryReadFromStandardInput(ref string[] subject) + { + if (!Console.IsInputRedirected) + { + return false; // pass + } + + // reset the subject array + Array.Clear(subject, 0, subject.Length); + Array.Resize(ref subject, 0); + + Console.InputEncoding = Encoding.UTF8; + using var reader = new StreamReader(Console.OpenStandardInput(8192)); + Console.SetIn(reader); + + for (var i = 0; Console.In.Peek() != -1; ++i) + { + var line = Console.In.ReadLine(); + if (line is null) + { + continue; + } + + Array.Resize(ref subject, subject.Length + 1); + subject[i] = line; + } + + return true; + } + } + } + + internal static LogLevel GetLogLevel(string? verbosity) + { + switch (verbosity) + { + case "q": + case "quiet": + return LogLevel.Error; + case "m": + case "minimal": + return LogLevel.Warning; + case "n": + case "normal": + return LogLevel.Information; + case "d": + case "detailed": + return LogLevel.Debug; + case "diag": + case "diagnostic": + return LogLevel.Trace; + default: + return LogLevel.Information; + } + } + + public static FormatOptions ParseWorkspaceOptions(this ParseResult parseResult, FormatOptions formatOptions) + { + var currentDirectory = Environment.CurrentDirectory; + + if (parseResult.ValueForArgument(SlnOrProjectArgument) is string { Length: > 0 } slnOrProject) + { + var (isSolution, workspaceFilePath) = MSBuildWorkspaceFinder.FindWorkspace(currentDirectory, slnOrProject); + formatOptions = formatOptions with { WorkspaceFilePath = workspaceFilePath }; + formatOptions = formatOptions with { WorkspaceType = isSolution ? WorkspaceType.Solution : WorkspaceType.Project }; + + // To ensure we get the version of MSBuild packaged with the dotnet SDK used by the + // workspace, use its directory as our working directory which will take into account + // a global.json if present. + var workspaceDirectory = Path.GetDirectoryName(workspaceFilePath); + if (workspaceDirectory is null) + { + throw new Exception($"Unable to find folder at '{workspaceFilePath}'"); + } + } + + return formatOptions; + } + + private static string EnsureTrailingSlash(string path) + => !string.IsNullOrEmpty(path) && + path[^1] != Path.DirectorySeparatorChar + ? path + Path.DirectorySeparatorChar + : path; + } +} diff --git a/src/Commands/FormatStyleCommand.cs b/src/Commands/FormatStyleCommand.cs new file mode 100644 index 000000000000..7f5156cf9047 --- /dev/null +++ b/src/Commands/FormatStyleCommand.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.CommandLine.Parsing; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using static Microsoft.CodeAnalysis.Tools.FormatCommandCommon; + +namespace Microsoft.CodeAnalysis.Tools.Commands +{ + internal static class FormatStyleCommand + { + private static readonly FormatStyleHandler s_styleHandler = new(); + + internal static Symbol GetCommand() + { + var command = new Command("style", Resources.Run_code_style_analyzers_and_apply_fixes) + { + SeverityOption, + }; + command.AddCommonOptions(); + command.Handler = s_styleHandler; + return command; + } + + private class FormatStyleHandler : ICommandHandler + { + public async Task InvokeAsync(InvocationContext context) + { + var parseResult = context.ParseResult; + var formatOptions = parseResult.ParseVerbosityOption(FormatOptions.Instance); + var logger = context.Console.SetupLogging(minimalLogLevel: formatOptions.LogLevel, minimalErrorLevel: LogLevel.Warning); + formatOptions = parseResult.ParseCommonOptions(formatOptions, logger); + formatOptions = parseResult.ParseWorkspaceOptions(formatOptions); + + if (parseResult.HasOption(SeverityOption) && + parseResult.ValueForOption(SeverityOption) is string { Length: > 0 } styleSeverity) + { + formatOptions = formatOptions with { CodeStyleSeverity = GetSeverity(styleSeverity) }; + } + + formatOptions = formatOptions with { FixCategory = FixCategory.CodeStyle }; + + var formatResult = await CodeFormatter.FormatWorkspaceAsync( + formatOptions, + logger, + context.GetCancellationToken(), + binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); + return formatResult.GetExitCode(formatOptions.ChangesAreErrors); + + static DiagnosticSeverity GetSeverity(string? severity) + { + return severity?.ToLowerInvariant() switch + { + "" => DiagnosticSeverity.Error, + FixSeverity.Error => DiagnosticSeverity.Error, + FixSeverity.Warn => DiagnosticSeverity.Warning, + FixSeverity.Info => DiagnosticSeverity.Info, + _ => throw new ArgumentOutOfRangeException(nameof(severity)), + }; + } + } + } + } +} diff --git a/src/Commands/FormatWhitespaceCommand.cs b/src/Commands/FormatWhitespaceCommand.cs new file mode 100644 index 000000000000..e4625f2338a5 --- /dev/null +++ b/src/Commands/FormatWhitespaceCommand.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System.CommandLine; +using System.CommandLine.Invocation; +using System.CommandLine.Parsing; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using static Microsoft.CodeAnalysis.Tools.FormatCommandCommon; + +namespace Microsoft.CodeAnalysis.Tools.Commands +{ + internal static class FormatWhitespaceCommand + { + // This delegate should be kept in Sync with the FormatCommand options and argument names + // so that values bind correctly. + internal delegate Task Handler( + bool folder, + string? workspace, + bool noRestore, + bool check, + string[] include, + string[] exclude, + bool includeGenerated, + string? verbosity, + string? binarylog, + string? report, + IConsole console); + + private static readonly FormatWhitespaceHandler s_formattingHandler = new(); + + internal static Symbol GetCommand() + { + var command = new Command("whitespace", Resources.Run_whitespace_formatting) + { + FolderOption + }; + command.AddCommonOptions(); + command.AddValidator(EnsureFolderNotSpecifiedWithNoRestore); + command.AddValidator(EnsureFolderNotSpecifiedWhenLoggingBinlog); + command.Handler = s_formattingHandler; + return command; + } + + internal static string? EnsureFolderNotSpecifiedWithNoRestore(CommandResult symbolResult) + { + var folder = symbolResult.GetValueForOption("--folder"); + var noRestore = symbolResult.GetOptionResult("--no-restore"); + return folder && noRestore != null + ? Resources.Cannot_specify_the_folder_option_with_no_restore + : null; + } + + internal static string? EnsureFolderNotSpecifiedWhenLoggingBinlog(CommandResult symbolResult) + { + var folder = symbolResult.GetValueForOption("--folder"); + var binarylog = symbolResult.GetOptionResult("--binarylog"); + return folder && binarylog is not null && !binarylog.IsImplicit + ? Resources.Cannot_specify_the_folder_option_when_writing_a_binary_log + : null; + } + + private class FormatWhitespaceHandler : ICommandHandler + { + public async Task InvokeAsync(InvocationContext context) + { + var parseResult = context.ParseResult; + var formatOptions = parseResult.ParseVerbosityOption(FormatOptions.Instance); + var logger = context.Console.SetupLogging(minimalLogLevel: formatOptions.LogLevel, minimalErrorLevel: LogLevel.Warning); + formatOptions = parseResult.ParseCommonOptions(formatOptions, logger); + formatOptions = parseResult.ParseWorkspaceOptions(formatOptions); + if (parseResult.HasOption(FolderOption)) + { + formatOptions = formatOptions with { WorkspaceType = WorkspaceType.Folder }; + } + + formatOptions = formatOptions with { FixCategory = FixCategory.Whitespace }; + + var formatResult = await CodeFormatter.FormatWorkspaceAsync( + formatOptions, + logger, + context.GetCancellationToken(), + binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); + return formatResult.GetExitCode(formatOptions.ChangesAreErrors); + } + } + } +} diff --git a/src/Commands/RootFormatCommand.cs b/src/Commands/RootFormatCommand.cs new file mode 100644 index 000000000000..aa1d7d708f12 --- /dev/null +++ b/src/Commands/RootFormatCommand.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.CommandLine.Parsing; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using static Microsoft.CodeAnalysis.Tools.FormatCommandCommon; + +namespace Microsoft.CodeAnalysis.Tools.Commands +{ + internal static class RootFormatCommand + { + private static readonly FormatCommandDefaultHandler s_formatCommandHandler = new(); + + public static RootCommand GetCommand() + { + var formatCommand = new RootCommand(Resources.Formats_code_to_match_editorconfig_settings) + { + FormatWhitespaceCommand.GetCommand(), + FormatStyleCommand.GetCommand(), + FormatAnalyzersCommand.GetCommand(), + DiagnosticsOption, + SeverityOption, + }; + formatCommand.AddCommonOptions(); + formatCommand.Handler = s_formatCommandHandler; + return formatCommand; + } + + private class FormatCommandDefaultHandler : ICommandHandler + { + public async Task InvokeAsync(InvocationContext context) + { + var parseResult = context.ParseResult; + var formatOptions = parseResult.ParseVerbosityOption(FormatOptions.Instance); + var logger = context.Console.SetupLogging(minimalLogLevel: formatOptions.LogLevel, minimalErrorLevel: LogLevel.Warning); + formatOptions = parseResult.ParseCommonOptions(formatOptions, logger); + formatOptions = parseResult.ParseWorkspaceOptions(formatOptions); + + if (parseResult.HasOption(SeverityOption) && + parseResult.ValueForOption(SeverityOption) is string { Length: > 0 } defaultSeverity) + { + formatOptions = formatOptions with { AnalyzerSeverity = GetSeverity(defaultSeverity) }; + formatOptions = formatOptions with { CodeStyleSeverity = GetSeverity(defaultSeverity) }; + } + + if (parseResult.HasOption(DiagnosticsOption) && + parseResult.ValueForOption(DiagnosticsOption) is string[] { Length: > 0 } diagnostics) + { + formatOptions = formatOptions with { Diagnostics = diagnostics.ToImmutableHashSet() }; + } + + formatOptions = formatOptions with { FixCategory = FixCategory.Whitespace | FixCategory.CodeStyle | FixCategory.Analyzers }; + + var formatResult = await CodeFormatter.FormatWorkspaceAsync( + formatOptions, + logger, + context.GetCancellationToken(), + binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); + return formatResult.GetExitCode(formatOptions.ChangesAreErrors); + + static DiagnosticSeverity GetSeverity(string? severity) + { + return severity?.ToLowerInvariant() switch + { + "" => DiagnosticSeverity.Error, + FixSeverity.Error => DiagnosticSeverity.Error, + FixSeverity.Warn => DiagnosticSeverity.Warning, + FixSeverity.Info => DiagnosticSeverity.Info, + _ => throw new ArgumentOutOfRangeException(nameof(severity)), + }; + } + } + } + } +} diff --git a/src/FormatCommand.cs b/src/FormatCommand.cs deleted file mode 100644 index 8952e8c7ea22..000000000000 --- a/src/FormatCommand.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.CommandLine; -using System.CommandLine.Parsing; -using System.Threading.Tasks; - -namespace Microsoft.CodeAnalysis.Tools -{ - internal static class FormatCommand - { - // This delegate should be kept in Sync with the FormatCommand options and argument names - // so that values bind correctly. - internal delegate Task Handler( - string? workspace, - bool noRestore, - bool folder, - bool fixWhitespace, - string fixStyle, - string fixAnalyzers, - string[] diagnostics, - string? verbosity, - bool check, - string[] include, - string[] exclude, - string? report, - bool includeGenerated, - string? binarylog, - IConsole console); - - internal static string[] VerbosityLevels => new[] { "q", "quiet", "m", "minimal", "n", "normal", "d", "detailed", "diag", "diagnostic" }; - internal static string[] SeverityLevels => new[] { FixSeverity.Info, FixSeverity.Warn, FixSeverity.Error }; - - internal static RootCommand CreateCommandLineOptions() - { - // Sync changes to option and argument names with the FormatCommant.Handler above. - var rootCommand = new RootCommand - { - new Argument("workspace", () => null, Resources.A_path_to_a_solution_file_a_project_file_or_a_folder_containing_a_solution_or_project_file_If_a_path_is_not_specified_then_the_current_directory_is_used).LegalFilePathsOnly(), - new Option(new[] { "--no-restore" }, Resources.Doesnt_execute_an_implicit_restore_before_formatting), - new Option(new[] { "--folder", "-f" }, Resources.Whether_to_treat_the_workspace_argument_as_a_simple_folder_of_files), - new Option(new[] { "--fix-whitespace", "-w" }, Resources.Run_whitespace_formatting_Run_by_default_when_not_applying_fixes), - new Option(new[] { "--fix-style", "-s" }, Resources.Run_code_style_analyzers_and_apply_fixes, argumentType: typeof(string), arity: ArgumentArity.ZeroOrOne) - { - ArgumentHelpName = "severity" - }.FromAmong(SeverityLevels), - new Option(new[] { "--fix-analyzers", "-a" }, Resources.Run_3rd_party_analyzers_and_apply_fixes, argumentType: typeof(string), arity: ArgumentArity.ZeroOrOne) - { - ArgumentHelpName = "severity" - }.FromAmong(SeverityLevels), - new Option(new[] { "--diagnostics" }, () => Array.Empty(), Resources.A_space_separated_list_of_diagnostic_ids_to_use_as_a_filter_when_fixing_code_style_or_3rd_party_issues) - { - AllowMultipleArgumentsPerToken = true - }, - new Option(new[] { "--include" }, () => Array.Empty(), Resources.A_list_of_relative_file_or_folder_paths_to_include_in_formatting_All_files_are_formatted_if_empty) - { - AllowMultipleArgumentsPerToken = true - }, - new Option(new[] { "--exclude" }, () => Array.Empty(), Resources.A_list_of_relative_file_or_folder_paths_to_exclude_from_formatting) - { - AllowMultipleArgumentsPerToken = true - }, - new Option(new[] { "--check" }, Resources.Formats_files_without_saving_changes_to_disk_Terminates_with_a_non_zero_exit_code_if_any_files_were_formatted), - new Option(new[] { "--report" }, Resources.Accepts_a_file_path_which_if_provided_will_produce_a_format_report_json_file_in_the_given_directory, argumentType: typeof(string), arity: ArgumentArity.ZeroOrOne) - { - ArgumentHelpName = "report-path" - }.LegalFilePathsOnly(), - new Option(new[] { "--verbosity", "-v" }, Resources.Set_the_verbosity_level_Allowed_values_are_quiet_minimal_normal_detailed_and_diagnostic).FromAmong(VerbosityLevels), - new Option(new[] { "--include-generated" }, Resources.Include_generated_code_files_in_formatting_operations) - { - IsHidden = true - }, - new Option(new[] { "--binarylog" }, Resources.Log_all_project_or_solution_load_information_to_a_binary_log_file, argumentType: typeof(string), arity: ArgumentArity.ZeroOrOne) - { - ArgumentHelpName = "binary-log-path" - }.LegalFilePathsOnly(), - }; - - rootCommand.Description = "dotnet-format"; - rootCommand.AddValidator(EnsureFolderNotSpecifiedWhenFixingStyle); - rootCommand.AddValidator(EnsureFolderNotSpecifiedWhenFixingAnalyzers); - rootCommand.AddValidator(EnsureFolderNotSpecifiedWithNoRestore); - rootCommand.AddValidator(EnsureFolderNotSpecifiedWhenLoggingBinlog); - - return rootCommand; - } - - internal static string? EnsureFolderNotSpecifiedWhenFixingAnalyzers(CommandResult symbolResult) - { - var folder = symbolResult.GetValueForOption("--folder"); - var fixAnalyzers = symbolResult.GetOptionResult("--fix-analyzers"); - return folder && fixAnalyzers != null - ? Resources.Cannot_specify_the_folder_option_when_running_analyzers - : null; - } - - internal static string? EnsureFolderNotSpecifiedWhenFixingStyle(CommandResult symbolResult) - { - var folder = symbolResult.GetValueForOption("--folder"); - var fixStyle = symbolResult.GetOptionResult("--fix-style"); - return folder && fixStyle != null - ? Resources.Cannot_specify_the_folder_option_when_fixing_style - : null; - } - - internal static string? EnsureFolderNotSpecifiedWithNoRestore(CommandResult symbolResult) - { - var folder = symbolResult.GetValueForOption("--folder"); - var noRestore = symbolResult.GetOptionResult("--no-restore"); - return folder && noRestore != null - ? Resources.Cannot_specify_the_folder_option_with_no_restore - : null; - } - - internal static string? EnsureFolderNotSpecifiedWhenLoggingBinlog(CommandResult symbolResult) - { - var folder = symbolResult.GetValueForOption("--folder"); - var binarylog = symbolResult.GetOptionResult("--binarylog"); - return folder && binarylog is not null && !binarylog.IsImplicit - ? Resources.Cannot_specify_the_folder_option_when_writing_a_binary_log - : null; - } - } -} diff --git a/src/FormatOptions.cs b/src/FormatOptions.cs index 8b15b4aaf28c..aae79ec15ed0 100644 --- a/src/FormatOptions.cs +++ b/src/FormatOptions.cs @@ -1,85 +1,42 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.Tools { - internal class FormatOptions + internal record FormatOptions( + string WorkspaceFilePath, + WorkspaceType WorkspaceType, + bool NoRestore, + LogLevel LogLevel, + FixCategory FixCategory, + DiagnosticSeverity CodeStyleSeverity, + DiagnosticSeverity AnalyzerSeverity, + ImmutableHashSet Diagnostics, + bool SaveFormattedFiles, + bool ChangesAreErrors, + SourceFileMatcher FileMatcher, + string? ReportPath, + string? BinaryLogPath, + bool IncludeGeneratedFiles) { - public string WorkspaceFilePath { get; } - public WorkspaceType WorkspaceType { get; } - public bool NoRestore { get; } - public LogLevel LogLevel { get; } - public FixCategory FixCategory { get; } - public DiagnosticSeverity CodeStyleSeverity { get; } - public DiagnosticSeverity AnalyzerSeverity { get; } - public ImmutableHashSet Diagnostics { get; } - public bool SaveFormattedFiles { get; } - public bool ChangesAreErrors { get; } - public SourceFileMatcher FileMatcher { get; } - public string? ReportPath { get; } - public bool IncludeGeneratedFiles { get; } - - public FormatOptions( - string workspaceFilePath, - WorkspaceType workspaceType, - bool noRestore, - LogLevel logLevel, - FixCategory fixCategory, - DiagnosticSeverity codeStyleSeverity, - DiagnosticSeverity analyzerSeverity, - ImmutableHashSet diagnostics, - bool saveFormattedFiles, - bool changesAreErrors, - SourceFileMatcher fileMatcher, - string? reportPath, - bool includeGeneratedFiles) - { - WorkspaceFilePath = workspaceFilePath; - WorkspaceType = workspaceType; - NoRestore = noRestore; - LogLevel = logLevel; - FixCategory = fixCategory; - CodeStyleSeverity = codeStyleSeverity; - AnalyzerSeverity = analyzerSeverity; - Diagnostics = diagnostics; - SaveFormattedFiles = saveFormattedFiles; - ChangesAreErrors = changesAreErrors; - FileMatcher = fileMatcher; - ReportPath = reportPath; - IncludeGeneratedFiles = includeGeneratedFiles; - } - - public void Deconstruct( - out string workspaceFilePath, - out WorkspaceType workspaceType, - out bool noRestore, - out LogLevel logLevel, - out FixCategory fixCategory, - out DiagnosticSeverity codeStyleSeverity, - out DiagnosticSeverity analyzerSeverity, - out ImmutableHashSet diagnostics, - out bool saveFormattedFiles, - out bool changesAreErrors, - out SourceFileMatcher fileMatcher, - out string? reportPath, - out bool includeGeneratedFiles) - { - workspaceFilePath = WorkspaceFilePath; - workspaceType = WorkspaceType; - noRestore = NoRestore; - logLevel = LogLevel; - fixCategory = FixCategory; - codeStyleSeverity = CodeStyleSeverity; - analyzerSeverity = AnalyzerSeverity; - diagnostics = Diagnostics; - saveFormattedFiles = SaveFormattedFiles; - changesAreErrors = ChangesAreErrors; - fileMatcher = FileMatcher; - reportPath = ReportPath; - includeGeneratedFiles = IncludeGeneratedFiles; - } + public static FormatOptions Instance = new( + WorkspaceFilePath: null!, // must be supplied + WorkspaceType: default, // must be supplied + NoRestore: false, + LogLevel: LogLevel.Warning, + FixCategory: default, // must be supplied + CodeStyleSeverity: DiagnosticSeverity.Warning, + AnalyzerSeverity: DiagnosticSeverity.Warning, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: true, + ChangesAreErrors: false, + FileMatcher: SourceFileMatcher.CreateMatcher(Array.Empty(), Array.Empty()), + ReportPath: null, + BinaryLogPath: null, + IncludeGeneratedFiles: false); } } diff --git a/src/Program.cs b/src/Program.cs index ceb3c7796e9e..74abc0d290a5 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -1,389 +1,19 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; -using System.Collections.Immutable; using System.CommandLine; -using System.CommandLine.Invocation; using System.CommandLine.Parsing; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading; using System.Threading.Tasks; - -using Microsoft.CodeAnalysis.Tools.Logging; -using Microsoft.CodeAnalysis.Tools.Utilities; -using Microsoft.CodeAnalysis.Tools.Workspaces; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Tools.Commands; namespace Microsoft.CodeAnalysis.Tools { internal class Program { - internal const int UnhandledExceptionExitCode = 1; - internal const int CheckFailedExitCode = 2; - internal const int UnableToLocateMSBuildExitCode = 3; - internal const int UnableToLocateDotNetCliExitCode = 4; - - private static readonly string[] s_standardInputKeywords = { "/dev/stdin", "-" }; - - private static ParseResult? s_parseResult; private static async Task Main(string[] args) { - var rootCommand = FormatCommand.CreateCommandLineOptions(); - rootCommand.Handler = CommandHandler.Create(new FormatCommand.Handler(Run)); - - // Parse the incoming args so we can give warnings when deprecated options are used. - s_parseResult = rootCommand.Parse(args); - + var rootCommand = RootFormatCommand.GetCommand(); return await rootCommand.InvokeAsync(args); } - - public static async Task Run( - string? workspace, - bool noRestore, - bool folder, - bool fixWhitespace, - string fixStyle, - string fixAnalyzers, - string[] diagnostics, - string? verbosity, - bool check, - string[] include, - string[] exclude, - string? report, - bool includeGenerated, - string? binarylog, - IConsole console = null!) - { - if (s_parseResult == null) - { - return 1; - } - - // Setup logging. - var logLevel = GetLogLevel(verbosity); - var logger = SetupLogging(console, minimalLogLevel: logLevel, minimalErrorLevel: LogLevel.Warning); - - // Hook so we can cancel and exit when ctrl+c is pressed. - var cancellationTokenSource = new CancellationTokenSource(); - Console.CancelKeyPress += (sender, e) => - { - e.Cancel = true; - cancellationTokenSource.Cancel(); - }; - - var currentDirectory = string.Empty; - - try - { - currentDirectory = Environment.CurrentDirectory; - - var formatVersion = GetVersion(); - logger.LogDebug(Resources.The_dotnet_format_version_is_0, formatVersion); - - string? workspaceDirectory; - string workspacePath; - WorkspaceType workspaceType; - - // The folder option means we should treat the project path as a folder path. - if (folder) - { - // If folder isn't populated, then use the current directory - workspacePath = Path.GetFullPath(workspace ?? ".", Environment.CurrentDirectory); - workspaceDirectory = workspacePath; - workspaceType = WorkspaceType.Folder; - } - else - { - var (isSolution, workspaceFilePath) = MSBuildWorkspaceFinder.FindWorkspace(currentDirectory, workspace); - - workspacePath = workspaceFilePath; - workspaceType = isSolution - ? WorkspaceType.Solution - : WorkspaceType.Project; - - // To ensure we get the version of MSBuild packaged with the dotnet SDK used by the - // workspace, use its directory as our working directory which will take into account - // a global.json if present. - workspaceDirectory = Path.GetDirectoryName(workspacePath); - if (workspaceDirectory is null) - { - throw new Exception($"Unable to find folder at '{workspacePath}'"); - } - } - - if (workspaceType != WorkspaceType.Folder) - { - var runtimeVersion = GetRuntimeVersion(); - logger.LogDebug(Resources.The_dotnet_runtime_version_is_0, runtimeVersion); - - // Load MSBuild - Environment.CurrentDirectory = workspaceDirectory; - - if (!TryGetDotNetCliVersion(out var dotnetVersion)) - { - logger.LogError(Resources.Unable_to_locate_dotnet_CLI_Ensure_that_it_is_on_the_PATH); - return UnableToLocateDotNetCliExitCode; - } - - logger.LogTrace(Resources.The_dotnet_CLI_version_is_0, dotnetVersion); - - if (!TryLoadMSBuild(out var msBuildPath)) - { - logger.LogError(Resources.Unable_to_locate_MSBuild_Ensure_the_NET_SDK_was_installed_with_the_official_installer); - return UnableToLocateMSBuildExitCode; - } - - logger.LogTrace(Resources.Using_msbuildexe_located_in_0, msBuildPath); - } - - var fixType = FixCategory.None; - if (s_parseResult.WasOptionUsed("--fix-style", "-s")) - { - fixType |= FixCategory.CodeStyle; - } - - if (s_parseResult.WasOptionUsed("--fix-analyzers", "-a")) - { - fixType |= FixCategory.Analyzers; - } - - if (fixType == FixCategory.None && diagnostics.Length > 0) - { - logger.LogWarning(Resources.The_diagnostics_option_only_applies_when_fixing_style_or_running_analyzers); - } - - if (fixType == FixCategory.None || fixWhitespace) - { - fixType |= FixCategory.Whitespace; - } - - HandleStandardInput(logger, ref include, ref exclude); - - var fileMatcher = SourceFileMatcher.CreateMatcher(include, exclude); - - var formatOptions = new FormatOptions( - workspacePath, - workspaceType, - noRestore, - logLevel, - fixType, - codeStyleSeverity: GetSeverity(fixStyle), - analyzerSeverity: GetSeverity(fixAnalyzers), - diagnostics: diagnostics.ToImmutableHashSet(), - saveFormattedFiles: !check, - changesAreErrors: check, - fileMatcher, - reportPath: report, - includeGenerated); - - var formatResult = await CodeFormatter.FormatWorkspaceAsync( - formatOptions, - logger, - cancellationTokenSource.Token, - binaryLogPath: GetBinaryLogPath(s_parseResult, binarylog)).ConfigureAwait(false); - - return GetExitCode(formatResult, check); - - static string? GetBinaryLogPath(ParseResult parseResult, string? binarylog) - { - if (parseResult.WasOptionUsed("--binarylog")) - { - if (binarylog is null) - { - return Path.Combine(Directory.GetCurrentDirectory(), "format.binlog"); - } - else if (Path.GetExtension(binarylog)?.Equals(".binlog") == false) - { - return Path.ChangeExtension(binarylog, ".binlog"); - } - - return binarylog; - } - - return null; - } - } - catch (FileNotFoundException fex) - { - logger.LogError(fex.Message); - return UnhandledExceptionExitCode; - } - catch (OperationCanceledException) - { - return UnhandledExceptionExitCode; - } - finally - { - if (!string.IsNullOrEmpty(currentDirectory)) - { - Environment.CurrentDirectory = currentDirectory; - } - } - } - - private static void HandleStandardInput(ILogger logger, ref string[] include, ref string[] exclude) - { - var isStandardMarkerUsed = false; - if (include.Length == 1 && s_standardInputKeywords.Contains(include[0])) - { - if (TryReadFromStandardInput(ref include)) - { - isStandardMarkerUsed = true; - } - } - - if (exclude.Length == 1 && s_standardInputKeywords.Contains(exclude[0])) - { - if (isStandardMarkerUsed) - { - logger.LogCritical(Resources.Standard_input_used_multiple_times); - Environment.Exit(CheckFailedExitCode); - } - - TryReadFromStandardInput(ref exclude); - } - - static bool TryReadFromStandardInput(ref string[] subject) - { - if (!Console.IsInputRedirected) - { - return false; // pass - } - - // reset the subject array - Array.Clear(subject, 0, subject.Length); - Array.Resize(ref subject, 0); - - Console.InputEncoding = Encoding.UTF8; - using var reader = new StreamReader(Console.OpenStandardInput(8192)); - Console.SetIn(reader); - - for (var i = 0; Console.In.Peek() != -1; ++i) - { - var line = Console.In.ReadLine(); - if (line is null) - { - continue; - } - - Array.Resize(ref subject, subject.Length + 1); - subject[i] = line; - } - - return true; - } - } - - internal static int GetExitCode(WorkspaceFormatResult formatResult, bool check) - { - if (!check) - { - return formatResult.ExitCode; - } - - return formatResult.FilesFormatted == 0 ? 0 : CheckFailedExitCode; - } - - internal static LogLevel GetLogLevel(string? verbosity) - { - switch (verbosity) - { - case "q": - case "quiet": - return LogLevel.Error; - case "m": - case "minimal": - return LogLevel.Warning; - case "n": - case "normal": - return LogLevel.Information; - case "d": - case "detailed": - return LogLevel.Debug; - case "diag": - case "diagnostic": - return LogLevel.Trace; - default: - return LogLevel.Information; - } - } - - internal static DiagnosticSeverity GetSeverity(string? severity) - { - return severity?.ToLowerInvariant() switch - { - "" => DiagnosticSeverity.Error, - FixSeverity.Error => DiagnosticSeverity.Error, - FixSeverity.Warn => DiagnosticSeverity.Warning, - FixSeverity.Info => DiagnosticSeverity.Info, - _ => throw new ArgumentOutOfRangeException(nameof(severity)), - }; - } - - private static ILogger SetupLogging(IConsole console, LogLevel minimalLogLevel, LogLevel minimalErrorLevel) - { - var serviceCollection = new ServiceCollection(); - serviceCollection.AddSingleton(new LoggerFactory().AddSimpleConsole(console, minimalLogLevel, minimalErrorLevel)); - serviceCollection.AddLogging(); - - var serviceProvider = serviceCollection.BuildServiceProvider(); - var logger = serviceProvider.GetService>(); - - return logger!; - } - - private static string? GetVersion() - { - return Assembly.GetExecutingAssembly() - .GetCustomAttribute() - ?.InformationalVersion; - } - - private static bool TryGetDotNetCliVersion([NotNullWhen(returnValue: true)] out string? dotnetVersion) - { - try - { - var processInfo = ProcessRunner.CreateProcess("dotnet", "--version", captureOutput: true, displayWindow: false); - var versionResult = processInfo.Result.GetAwaiter().GetResult(); - - dotnetVersion = versionResult.OutputLines[0].Trim(); - return true; - } - catch - { - dotnetVersion = null; - return false; - } - } - - private static bool TryLoadMSBuild([NotNullWhen(returnValue: true)] out string? msBuildPath) - { - try - { - // Since we are running as a dotnet tool we should be able to find an instance of - // MSBuild in a .NET Core SDK. - var msBuildInstance = Build.Locator.MSBuildLocator.RegisterDefaults(); - msBuildPath = msBuildInstance.MSBuildPath; - return true; - } - catch - { - msBuildPath = null; - return false; - } - } - - internal static string GetRuntimeVersion() - { - var pathParts = typeof(string).Assembly.Location.Split('\\', '/'); - var netCoreAppIndex = Array.IndexOf(pathParts, "Microsoft.NETCore.App"); - return pathParts[netCoreAppIndex + 1]; - } } } diff --git a/src/Properties/launchSettings.json b/src/Properties/launchSettings.json index 1c2b2cde45a0..65c353dbbf89 100644 --- a/src/Properties/launchSettings.json +++ b/src/Properties/launchSettings.json @@ -2,13 +2,13 @@ "profiles": { "dotnet-format (--dry-run)": { "commandName": "Project", - "commandLineArgs": "-w format.sln -v diag --dry-run", + "commandLineArgs": "format.sln -v diag --verify-no-changes", "workingDirectory": "$(SolutionDir)" }, "dotnet-format": { "commandName": "Project", - "commandLineArgs": "-w format.sln -v diag", + "commandLineArgs": "format.sln -v diag", "workingDirectory": "$(SolutionDir)" } } -} +} \ No newline at end of file diff --git a/src/Resources.resx b/src/Resources.resx index 8b90ce6ada03..b004cdd9ab4b 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -1,17 +1,17 @@ - @@ -333,4 +333,31 @@ Cannot specify the '--folder' option when writing a binary log. + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + Accepts a file path which if provided will produce a json report in the given directory. + + + Format files generated by the SDK. + + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + + Formats code to match editorconfig settings. + + + Run 3rd party analyzers and apply fixes. + + + Run whitespace formatting. + \ No newline at end of file diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 98c3f6f970c6..0e3799f1378c 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + netcoreapp6.0 Exe 9.0 true @@ -42,20 +42,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/src/xlf/Resources.cs.xlf b/src/xlf/Resources.cs.xlf index 81399a54d8c1..7168e476264b 100644 --- a/src/xlf/Resources.cs.xlf +++ b/src/xlf/Resources.cs.xlf @@ -27,6 +27,11 @@ Přijímá cestu k souboru. Pokud se zadá, vytvoří se v daném adresáři sestava JSON. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. Analýza se dokončila za {0} ms. @@ -147,6 +152,16 @@ Formátování se dokončilo za {0} ms. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formátuje soubory bez toho, aby se změny ukládaly na disk. Pokud se nějaké soubory naformátovaly, ukončí se s nenulovým ukončovacím kódem. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. Spustit analyzátory třetích stran a použít opravy @@ -227,6 +247,11 @@ Spustit analyzátory stylu kódu a použít opravy + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ Přeskočí se odkazovaný projekt {0}. + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects Řešení {0} nemá žádné projekty. @@ -297,6 +332,11 @@ Soubor projektu {0} neexistuje. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. Soubor řešení {0} neexistuje. @@ -347,6 +387,11 @@ Používá se MSBuild.exe umístěný v {0}. + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Při načítání pracovního prostoru se vygenerovala upozornění. Pokud chcete upozornění protokolovat, nastavte možnost verbosity na úroveň diagnostic. diff --git a/src/xlf/Resources.de.xlf b/src/xlf/Resources.de.xlf index 1cddefb19dad..a582c9829a32 100644 --- a/src/xlf/Resources.de.xlf +++ b/src/xlf/Resources.de.xlf @@ -27,6 +27,11 @@ Akzeptiert einen Dateipfad, der bei Bereitstellung einen JSON-Bericht im angegebenen Verzeichnis erstellt. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. Die Analyse wurde in {0} ms abgeschlossen. @@ -147,6 +152,16 @@ Die Formatierung wurde in {0} ms abgeschlossen. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formatiert Dateien ohne Speichern der Änderungen auf dem Datenträger. Wird mit einem Exitcode ungleich Null beendet, wenn Dateien formatiert wurden. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. Führen Sie Drittanbieter-Analysetools aus, und wenden Sie Korrekturen an. @@ -227,6 +247,11 @@ Führen Sie Codeformat-Analysetools aus, und wenden Sie Korrekturen an. + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ Überspringen von referenziertem Projekt "{0}". + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects Die Projektmappe "{0}" enthält keine Projekte. @@ -297,6 +332,11 @@ Die Projektdatei "{0}" ist nicht vorhanden. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. Die Projektmappendatei "{0}" ist nicht vorhanden. @@ -347,6 +387,11 @@ MSBuild.exe in "{0}" wird verwendet. + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Beim Laden des Arbeitsbereichs sind Warnungen aufgetreten. Legen Sie die Ausführlichkeitsoption auf "Diagnose" fest, um Warnungen zu protokollieren. diff --git a/src/xlf/Resources.es.xlf b/src/xlf/Resources.es.xlf index 9c3fba7f86f2..ed49aaae588d 100644 --- a/src/xlf/Resources.es.xlf +++ b/src/xlf/Resources.es.xlf @@ -27,6 +27,11 @@ Acepta una ruta de acceso de archivo que, si se proporciona, generará un informe JSON en el directorio dado. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. Análisis completado en {0} ms. @@ -147,6 +152,16 @@ Formato completado en {0} ms. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Da formato a los archivos sin guardar los cambios en el disco. Termina con un código de salida distinto de cero si se ha dado formato a algún archivo. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. Ejecute analizadores de terceros y aplique las correcciones. @@ -227,6 +247,11 @@ Ejecute analizadores de estilo de código y aplique las correcciones. + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ Omitiendo projecto al que se hace referencia "{0}". + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects La solución {0} no tiene ningún proyecto. @@ -297,6 +332,11 @@ El archivo de proyecto "{0}" no existe. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. El archivo de solución "{0}" no existe. @@ -347,6 +387,11 @@ Se está usando el archivo MSBuild.exe ubicado en "{0}". + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Se encontraron advertencias al cargar el área de trabajo. Establezca la opción de nivel de detalle en "diagnóstico" para registrar las advertencias. diff --git a/src/xlf/Resources.fr.xlf b/src/xlf/Resources.fr.xlf index d67842dc59c1..c8bd07f97110 100644 --- a/src/xlf/Resources.fr.xlf +++ b/src/xlf/Resources.fr.xlf @@ -27,6 +27,11 @@ Accepte un chemin de fichier, qui, s'il est fourni, produit un rapport JSON dans le répertoire donné. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. Analyse effectuée en {0} ms. @@ -147,6 +152,16 @@ Mise en forme effectuée en {0} ms. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Met en forme les fichiers sans enregistrer les changements sur le disque. Se termine par un code de sortie non nul si des fichiers ont été mis en forme. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. Exécutez des analyseurs tiers et appliquez des correctifs. @@ -227,6 +247,11 @@ Exécutez des analyseurs de style de code et appliquez des correctifs. + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ Saut du projet référencé '{0}'. + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects La solution {0} n'a aucun projet @@ -297,6 +332,11 @@ Le fichier projet '{0}' n'existe pas. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. Le fichier solution '{0}' n'existe pas. @@ -347,6 +387,11 @@ Utilisation de MSBuild.exe dans '{0}'. + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Des avertissements ont été rencontrés pendant le chargement de l'espace de travail. Définissez l'option verbosity sur le niveau « diagnostic » pour journaliser les avertissements. diff --git a/src/xlf/Resources.it.xlf b/src/xlf/Resources.it.xlf index a58815b31a41..ba1edaf588a3 100644 --- a/src/xlf/Resources.it.xlf +++ b/src/xlf/Resources.it.xlf @@ -27,6 +27,11 @@ Accetta un percorso file che, se specificato, produrrà un report JSON nella directory specificata. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. L'analisi è stata completata in {0} ms. @@ -147,6 +152,16 @@ La formattazione è stata completata in {0} ms. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formatta i file senza salvare le modifiche nel disco. Termina con un codice di uscita diverso da zero se sono stati formattati file. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. Esegue gli analizzatori di terze parti e applica le correzioni. @@ -227,6 +247,11 @@ Esegue gli analizzatori degli stili di codice e applica le correzioni. + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ Il progetto di riferimento '{0}' verrà ignorato. + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects La soluzione {0} non contiene progetti @@ -297,6 +332,11 @@ Il file di progetto '{0}' non esiste. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. Il file di soluzione '{0}' non esiste. @@ -347,6 +387,11 @@ Verrà usata la versione di MSBuild.exe disponibile in '{0}'. + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Sono stati rilevati avvisi durante il caricamento dell'area di lavoro. Impostare l'opzione del livello di dettaglio su 'diagnostic' per registrare gli avvisi. diff --git a/src/xlf/Resources.ja.xlf b/src/xlf/Resources.ja.xlf index f7c21b56ecae..ac4b96da7a3e 100644 --- a/src/xlf/Resources.ja.xlf +++ b/src/xlf/Resources.ja.xlf @@ -27,6 +27,11 @@ ファイル パスを受け入れると (指定されている場合)、指定されたディレクトリに JSON レポートが生成されます。 + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. {0} ミリ秒で分析が完了します。 @@ -147,6 +152,16 @@ {0} ミリ秒で書式設定が完了します。 + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. 変更をディスクに保存せずにファイルを書式設定します。いずれかのファイルが書式設定されている場合、0 以外の終了コードで終了します。 @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. サード パーティのアナライザーを実行し、修正プログラムを適用します。 @@ -227,6 +247,11 @@ コード スタイル アナライザーを実行し、修正プログラムを適用します。 + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ 参照プロジェクト '{0}' をスキップしています。 + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects ソリューション {0} にプロジェクトがありません @@ -297,6 +332,11 @@ プロジェクト ファイル '{0}' が存在しません。 + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. ソリューション ファイル '{0}' が存在しません。 @@ -347,6 +387,11 @@ '{0}' にある MSBuild.exe を使用しています。 + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. ワークスペースの読み込み中に警告が発生しました。詳細オプションを '診断' レベルに設定して、警告をログに記録してください。 diff --git a/src/xlf/Resources.ko.xlf b/src/xlf/Resources.ko.xlf index 4ca6b95d0ec2..c2a53d99588c 100644 --- a/src/xlf/Resources.ko.xlf +++ b/src/xlf/Resources.ko.xlf @@ -27,6 +27,11 @@ 제공된 경우 지정된 디렉터리에 json 보고서를 생성할 파일 경로를 허용합니다. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. {0}밀리초 후 분석이 완료됩니다. @@ -147,6 +152,16 @@ {0}ms 후 서식 지정이 완료됩니다. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. 디스크에 변경 내용을 저장하지 않고 파일의 서식을 지정합니다. 서식이 지정된 파일이 있는 경우 0이 아닌 종료 코드로 종료됩니다. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. 타사 분석기를 실행하고 수정 사항을 적용합니다. @@ -227,6 +247,11 @@ 코드 스타일 분석기를 실행하고 수정 사항을 적용합니다. + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ 참조된 프로젝트 '{0}'을(를) 건너뜁니다. + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects {0} 솔루션에 프로젝트가 없습니다. @@ -297,6 +332,11 @@ 프로젝트 파일 '{0}'이(가) 없습니다. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. 솔루션 파일 '{0}'이(가) 없습니다. @@ -347,6 +387,11 @@ '{0}'에 있는 MSBuild.exe를 사용합니다. + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. 작업 영역을 로드하는 동안 경고가 발생했습니다. 경고를 기록하려면 세부 정보 표시 옵션을 '진단' 수준으로 설정하세요. diff --git a/src/xlf/Resources.pl.xlf b/src/xlf/Resources.pl.xlf index b62d78f2e2c0..024372f05b0b 100644 --- a/src/xlf/Resources.pl.xlf +++ b/src/xlf/Resources.pl.xlf @@ -27,6 +27,11 @@ Akceptuje ścieżkę pliku, która, jeśli zostanie podana, wygeneruje raport JSON w danym katalogu. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. Analizę ukończono w {0} ms. @@ -147,6 +152,16 @@ Formatowanie zakończono w {0} ms. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formatuje pliki bez zapisywania zmian na dysku. Kończy się niezerowym kodem zakończenia, jeśli zostały sformatowane jakiekolwiek pliki. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. Uruchom analizatory innych firm i zastosuj poprawki. @@ -227,6 +247,11 @@ Uruchom analizatory stylu kodu i zastosuj poprawki. + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ Pomijanie przywoływanego projektu „{0}”. + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects Rozwiązanie {0} nie zawiera projektów @@ -297,6 +332,11 @@ Plik projektu „{0}” nie istnieje. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. Plik rozwiązania „{0}” nie istnieje. @@ -347,6 +387,11 @@ Używanie pliku MSBuild.exe znajdującego się w lokalizacji „{0}”. + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Podczas ładowania obszaru roboczego napotkano ostrzeżenia. Ustaw opcję poziomu szczegółowości na wartość „diagnostyka”, aby rejestrować ostrzeżenia. diff --git a/src/xlf/Resources.pt-BR.xlf b/src/xlf/Resources.pt-BR.xlf index d4a3d8bd06ec..cc16639beb43 100644 --- a/src/xlf/Resources.pt-BR.xlf +++ b/src/xlf/Resources.pt-BR.xlf @@ -27,6 +27,11 @@ Aceita um caminho de arquivo, que, se fornecido, produzirá um relatório JSON no diretório especificado. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. Análise concluída em {0} ms. @@ -147,6 +152,16 @@ Formatação concluída em {0} ms. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Formata arquivos sem salvar as alterações no disco. Termina com um código de saída diferente de zero se algum arquivo foi formatado. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. Executar analisadores de terceiros e aplicar correções. @@ -227,6 +247,11 @@ Executar analisadores de estilo de código e aplicar correções. + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ Ignorando o projeto referenciado '{0}'. + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects A solução {0} não tem nenhum projeto @@ -297,6 +332,11 @@ O arquivo de projeto '{0}' não existe. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. O arquivo de solução '{0}' não existe. @@ -347,6 +387,11 @@ Usando MSBuild.exe localizado em '{0}'. + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Foram encontrados avisos ao carregar o workspace. Defina a opção de detalhamento para o nível de 'diagnóstico' para registrar avisos. diff --git a/src/xlf/Resources.ru.xlf b/src/xlf/Resources.ru.xlf index 43aa6d87be26..b52fc7056de6 100644 --- a/src/xlf/Resources.ru.xlf +++ b/src/xlf/Resources.ru.xlf @@ -27,6 +27,11 @@ Принимает путь к файлу. Если путь к файлу указан, создает отчет JSON в указанном каталоге. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. Анализ завершен. Время анализа: {0} мс. @@ -147,6 +152,16 @@ Форматирование завершено. Время выполнения: {0} мс. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Форматирует файлы без сохранения изменений на диск. Завершается с ненулевым кодом завершения, если были отформатированы какие-либо файлы. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. Запустите сторонние анализаторы и примените исправления. @@ -227,6 +247,11 @@ Запустите анализаторы стиля кода и примените исправления. + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ Пропуск указанного проекта "{0}". + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects Решение {0} не содержит проектов. @@ -297,6 +332,11 @@ Файл проекта "{0}" не существует. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. Файл решения "{0}" не существует. @@ -347,6 +387,11 @@ Используется файл MSBuild.exe, расположенный в каталоге "{0}". + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. При загрузке рабочей области были обнаружены предупреждения. Задайте для параметра уровня детализации значение "Диагностика", чтобы вести журнал предупреждений. diff --git a/src/xlf/Resources.tr.xlf b/src/xlf/Resources.tr.xlf index 5215382f6d86..1b679f4b56f8 100644 --- a/src/xlf/Resources.tr.xlf +++ b/src/xlf/Resources.tr.xlf @@ -27,6 +27,11 @@ Sağlanırsa, verilen dizinde json raporu oluşturacak bir dosya yolunu kabul eder. + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. Analiz {0} ms içinde tamamlandı. @@ -147,6 +152,16 @@ Biçimlendirme {0} ms içinde tamamlandı. + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. Değişiklikleri diske kaydetmeden dosyaları biçimlendirir. Herhangi bir dosya biçimlendirildiyse sıfır olmayan bir çıkış koduyla sonlandırılır. @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. 3. taraf çözümleyicileri çalıştırıp düzeltmeleri uygulayın. @@ -227,6 +247,11 @@ Kod stili çözümleyicilerini çalıştırıp düzeltmeleri uygulayın. + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ Atlama projesi '{0}' başvuru. + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects {0} çözümünde proje yok @@ -297,6 +332,11 @@ Proje dosyası '{0}' yok. + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. Çözüm dosyası '{0}' yok. @@ -347,6 +387,11 @@ '{0}' içinde bulunan MSBuild.exe kullanılıyor. + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. Çalışma alanı yüklenirken uyarılarla karşılaşıldı. Uyarıları günlüğe kaydetmek için ayrıntı düzeyi seçeneğini 'tanılama' düzeyine ayarlayın. diff --git a/src/xlf/Resources.zh-Hans.xlf b/src/xlf/Resources.zh-Hans.xlf index d10d5d91d42a..e97afbceba33 100644 --- a/src/xlf/Resources.zh-Hans.xlf +++ b/src/xlf/Resources.zh-Hans.xlf @@ -27,6 +27,11 @@ 接受文件路径(若提供)将在给定目录中生成 json 报表。 + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. 将在 {0} 毫秒后完成分析。 @@ -147,6 +152,16 @@ 将在 {0} 毫秒后完成格式化。 + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. 将文件格式化且不将所作更改保存到磁盘中。如果有文件进行了格式化处理,则以非零退出代码终止。 @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. 运行第三方分析器并应用修补程序。 @@ -227,6 +247,11 @@ 运行代码样式分析器并应用修补程序。 + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ 正在跳过引用的项目“{0}”。 + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects 解决方案 {0} 不包含任何项目 @@ -297,6 +332,11 @@ 项目文件“{0}” 不存在。 + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. 解决方案文件“{0}”不存在。 @@ -347,6 +387,11 @@ 使用“{0}”中的 MSBuild.exe。 + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. 加载工作区时遇到警告。要记录警告,请将“详细级别”选项设置为“诊断”级别。 diff --git a/src/xlf/Resources.zh-Hant.xlf b/src/xlf/Resources.zh-Hant.xlf index 8b5c90f8045c..8b7e4cc840ee 100644 --- a/src/xlf/Resources.zh-Hant.xlf +++ b/src/xlf/Resources.zh-Hant.xlf @@ -27,6 +27,11 @@ 接受檔案路徑 (如果有提供) 將在指定的目錄中產生 json 報告。 + + Accepts a file path which if provided will produce a json report in the given directory. + Accepts a file path which if provided will produce a json report in the given directory. + + Analysis complete in {0}ms. 分析將於 {0} 毫秒後完成。 @@ -147,6 +152,16 @@ 格式化作業於 {0} 毫秒後完成。 + + Format files generated by the SDK. + Format files generated by the SDK. + + + + Formats code to match editorconfig settings. + Formats code to match editorconfig settings. + + Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. 將檔案格式化,但不將變更儲存到磁碟。如果有任何檔案已格式化,則作業會終止,並產生非零的結束代碼。 @@ -217,6 +232,11 @@ Remove unnecessary import. + + Run 3rd party analyzers and apply fixes. + Run 3rd party analyzers and apply fixes. + + Run 3rd party analyzers and apply fixes. 執行協力廠商分析器並套用修正。 @@ -227,6 +247,11 @@ 執行程式碼樣式分析器並套用修正。 + + Run whitespace formatting. + Run whitespace formatting. + + Run whitespace formatting. Run by default when not applying fixes. Run whitespace formatting. Run by default when not applying fixes. @@ -257,6 +282,16 @@ 跳過參考的專案 '{0}’。 + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + + + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. + + Solution {0} has no projects 解決方案 {0} 沒有任何專案 @@ -297,6 +332,11 @@ 專案檔 '{0}' 不存在。 + + The severity of diagnostics to fix. Allowed values are info, warn, and error. + The severity of diagnostics to fix. Allowed values are info, warn, and error. + + The solution file '{0}' does not exist. 解決方案檔 '{0}' 不存在。 @@ -347,6 +387,11 @@ 正在使用位於 '{0}' 的 MSBuild.exe。 + + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. + + Warnings were encountered while loading the workspace. Set the verbosity option to the 'diagnostic' level to log warnings. 載入工作區時發生警告。請將詳細程度選項設定為 [診斷] 層級以記錄警告。 diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index da287568d63b..d3f8c976c0f3 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -586,10 +586,11 @@ internal async Task TestFormatWorkspaceAsync( analyzerSeverity, diagnostics?.ToImmutableHashSet() ?? ImmutableHashSet.Empty, saveFormattedFiles, - changesAreErrors: false, + ChangesAreErrors: false, fileMatcher, - reportPath: string.Empty, - includeGenerated); + ReportPath: string.Empty, + IncludeGeneratedFiles: includeGenerated, + BinaryLogPath: null); var formatResult = await CodeFormatter.FormatWorkspaceAsync(formatOptions, logger, CancellationToken.None); Environment.CurrentDirectory = currentDirectory; diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index db2af29e8582..4b63f3629192 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -226,19 +226,20 @@ private protected async Task AssertCodeChangedAsync( var fileMatcher = SourceFileMatcher.CreateMatcher(new[] { document.FilePath! }, exclude: Array.Empty()); var formatOptions = new FormatOptions( - workspaceFilePath: project.FilePath!, - workspaceType: WorkspaceType.Solution, - noRestore: false, - logLevel: LogLevel.Trace, + WorkspaceFilePath: project.FilePath!, + WorkspaceType: WorkspaceType.Solution, + NoRestore: false, + LogLevel: LogLevel.Trace, fixCategory, codeStyleSeverity, analyzerSeverity, (diagnostics ?? Array.Empty()).ToImmutableHashSet(), - saveFormattedFiles: true, - changesAreErrors: false, + SaveFormattedFiles: true, + ChangesAreErrors: false, fileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); var pathsToFormat = GetOnlyFileToFormat(solution); diff --git a/tests/Formatters/FormattedFilesTests.cs b/tests/Formatters/FormattedFilesTests.cs index 3e8b14b8d2f6..62acd7b60ca4 100644 --- a/tests/Formatters/FormattedFilesTests.cs +++ b/tests/Formatters/FormattedFilesTests.cs @@ -62,19 +62,20 @@ private async Task> TestFormattedFiles(string testCode) var fileMatcher = SourceFileMatcher.CreateMatcher(new[] { document.FilePath }, exclude: Array.Empty()); var formatOptions = new FormatOptions( - workspaceFilePath: project.FilePath, - workspaceType: WorkspaceType.Folder, - noRestore: false, - logLevel: LogLevel.Trace, - fixCategory: FixCategory.Whitespace, - codeStyleSeverity: DiagnosticSeverity.Error, - analyzerSeverity: DiagnosticSeverity.Error, - diagnostics: ImmutableHashSet.Empty, - saveFormattedFiles: false, - changesAreErrors: false, + WorkspaceFilePath: project.FilePath, + WorkspaceType: WorkspaceType.Folder, + NoRestore: false, + LogLevel: LogLevel.Trace, + FixCategory: FixCategory.Whitespace, + CodeStyleSeverity: DiagnosticSeverity.Error, + AnalyzerSeverity: DiagnosticSeverity.Error, + Diagnostics: ImmutableHashSet.Empty, + SaveFormattedFiles: false, + ChangesAreErrors: false, fileMatcher, - reportPath: string.Empty, - includeGeneratedFiles: false); + ReportPath: string.Empty, + IncludeGeneratedFiles: false, + BinaryLogPath: null); var pathsToFormat = GetOnlyFileToFormat(solution); diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 7bcb67795679..ca004e363e57 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -6,6 +6,7 @@ using System.CommandLine.Invocation; using System.CommandLine.Parsing; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Tools.Commands; using Xunit; namespace Microsoft.CodeAnalysis.Tools.Tests @@ -43,7 +44,7 @@ public void ExitCodeIsSameWithoutCheck() public void CommandLine_OptionsAreParsedCorrectly() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { @@ -76,7 +77,7 @@ public void CommandLine_OptionsAreParsedCorrectly() public void CommandLine_ProjectArgument_Simple() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "workspaceValue" }); @@ -90,7 +91,7 @@ public void CommandLine_ProjectArgument_Simple() public void CommandLine_ProjectArgument_WithOption_AfterArgument() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "workspaceValue", "--verbosity", "detailed" }); @@ -105,7 +106,7 @@ public void CommandLine_ProjectArgument_WithOption_AfterArgument() public void CommandLine_ProjectArgument_WithOption_BeforeArgument() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--verbosity", "detailed", "workspaceValue" }); @@ -120,7 +121,7 @@ public void CommandLine_ProjectArgument_WithOption_BeforeArgument() public void CommandLine_ProjectArgument_FailsIfSpecifiedTwice() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "workspaceValue1", "workspaceValue2" }); @@ -133,7 +134,7 @@ public void CommandLine_ProjectArgument_FailsIfSpecifiedTwice() public void CommandLine_FolderValidation_FailsIfFixAnalyzersSpecified() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--folder", "--fix-analyzers" }); @@ -146,7 +147,7 @@ public void CommandLine_FolderValidation_FailsIfFixAnalyzersSpecified() public void CommandLine_FolderValidation_FailsIfFixStyleSpecified() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--folder", "--fix-style" }); @@ -159,7 +160,7 @@ public void CommandLine_FolderValidation_FailsIfFixStyleSpecified() public void CommandLine_FolderValidation_FailsIfNoRestoreSpecified() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--folder", "--no-restore" }); @@ -172,7 +173,7 @@ public void CommandLine_FolderValidation_FailsIfNoRestoreSpecified() public void CommandLine_AnalyzerOptions_CanSpecifyBothWithDefaults() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--fix-analyzers", "--fix-style" }); @@ -188,8 +189,7 @@ public async Task CommandLine_AllArguments_Bind() // Arrange var uniqueExitCode = 143; - var sut = FormatCommand.CreateCommandLineOptions(); - sut.Handler = CommandHandler.Create(new FormatCommand.Handler(TestRun)); + var sut = RootFormatCommand.GetCommand(); Task TestRun( string workspace, @@ -260,7 +260,7 @@ Task TestRun( public void CommandLine_BinaryLog_DoesNotFailIfPathNotSpecified() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--binarylog" }); @@ -274,7 +274,7 @@ public void CommandLine_BinaryLog_DoesNotFailIfPathNotSpecified() public void CommandLine_BinaryLog_DoesNotFailIfPathIsSpecified() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--binarylog", "log" }); @@ -288,7 +288,7 @@ public void CommandLine_BinaryLog_DoesNotFailIfPathIsSpecified() public void CommandLine_BinaryLog_FailsIfFolderIsSpecified() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--folder", "--binarylog" }); @@ -301,7 +301,7 @@ public void CommandLine_BinaryLog_FailsIfFolderIsSpecified() public void CommandLine_Diagnostics_FailsIfDiagnosticNoSpecified() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--diagnostics" }); @@ -314,7 +314,7 @@ public void CommandLine_Diagnostics_FailsIfDiagnosticNoSpecified() public void CommandLine_Diagnostics_DoesNotFailIfDiagnosticIsSpecified() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--diagnostics", "RS0016" }); @@ -327,7 +327,7 @@ public void CommandLine_Diagnostics_DoesNotFailIfDiagnosticIsSpecified() public void CommandLine_Diagnostics_DoesNotFailIfMultipleDiagnosticAreSpecified() { // Arrange - var sut = FormatCommand.CreateCommandLineOptions(); + var sut = RootFormatCommand.GetCommand(); // Act var result = sut.Parse(new[] { "--diagnostics", "RS0016", "RS0017", "RS0018" }); diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index d2ee6371db3a..867057b19c7b 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 9.0 false Microsoft.CodeAnalysis.Tools.Tests From be1bce5fa7fc25402dcf3a908e308a95b17dae5b Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 24 Aug 2021 16:12:57 -0700 Subject: [PATCH 1604/2702] fixup test build --- tests/CodeFormatterTests.cs | 1 - tests/ProgramTests.cs | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/CodeFormatterTests.cs b/tests/CodeFormatterTests.cs index d3f8c976c0f3..8e736116000c 100644 --- a/tests/CodeFormatterTests.cs +++ b/tests/CodeFormatterTests.cs @@ -572,7 +572,6 @@ internal async Task TestFormatWorkspaceAsync( var logger = new TestLogger(); var msBuildPath = MSBuildRegistrar.RegisterInstance(); - logger.LogDebug(Resources.The_dotnet_runtime_version_is_0, Program.GetRuntimeVersion()); logger.LogTrace(Resources.Using_msbuildexe_located_in_0, msBuildPath); var fileMatcher = SourceFileMatcher.CreateMatcher(include, exclude); diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index ca004e363e57..8183f82e7be1 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -17,16 +17,16 @@ public class ProgramTests public void ExitCodeIsOneWithCheckAndAnyFilesFormatted() { var formatResult = new WorkspaceFormatResult(filesFormatted: 1, fileCount: 0, exitCode: 0); - var exitCode = Program.GetExitCode(formatResult, check: true); + var exitCode = FormatCommandCommon.GetExitCode(formatResult, check: true); - Assert.Equal(Program.CheckFailedExitCode, exitCode); + Assert.Equal(FormatCommandCommon.CheckFailedExitCode, exitCode); } [Fact] public void ExitCodeIsZeroWithCheckAndNoFilesFormatted() { var formatResult = new WorkspaceFormatResult(filesFormatted: 0, fileCount: 0, exitCode: 42); - var exitCode = Program.GetExitCode(formatResult, check: true); + var exitCode = FormatCommandCommon.GetExitCode(formatResult, check: true); Assert.Equal(0, exitCode); } @@ -35,7 +35,7 @@ public void ExitCodeIsZeroWithCheckAndNoFilesFormatted() public void ExitCodeIsSameWithoutCheck() { var formatResult = new WorkspaceFormatResult(filesFormatted: 0, fileCount: 0, exitCode: 42); - var exitCode = Program.GetExitCode(formatResult, check: false); + var exitCode = FormatCommandCommon.GetExitCode(formatResult, check: false); Assert.Equal(formatResult.ExitCode, exitCode); } From 47ed79d5fbba41e78d658b1aeb0b7a0f1341c790 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 24 Aug 2021 16:23:41 -0700 Subject: [PATCH 1605/2702] fixing up analyzer warnings --- perf/.editorconfig | 4 + .../AnalyzerReferenceInformationProvider.cs | 15 +++- src/Logging/SimpleConsoleLogger.cs | 2 +- tests/.editorconfig | 4 + tests/ProgramTests.cs | 74 ------------------- 5 files changed, 22 insertions(+), 77 deletions(-) create mode 100644 perf/.editorconfig create mode 100644 tests/.editorconfig diff --git a/perf/.editorconfig b/perf/.editorconfig new file mode 100644 index 000000000000..8fc105f85254 --- /dev/null +++ b/perf/.editorconfig @@ -0,0 +1,4 @@ +# Code files +[*.{cs,csx,vb,vbx}] +# CA1822: Make member static +dotnet_diagnostic.CA1822.severity = none \ No newline at end of file diff --git a/src/Analyzers/AnalyzerReferenceInformationProvider.cs b/src/Analyzers/AnalyzerReferenceInformationProvider.cs index 476e13c4ffff..6b688878b48d 100644 --- a/src/Analyzers/AnalyzerReferenceInformationProvider.cs +++ b/src/Analyzers/AnalyzerReferenceInformationProvider.cs @@ -38,7 +38,7 @@ private AnalyzersAndFixers GetAnalyzersAndFixers(Project project) return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(analyzerAssemblies); } - private Assembly? TryLoadAssemblyFrom(string? path) + private static Assembly? TryLoadAssemblyFrom(string? path) { // Since we are not deploying these assemblies we need to ensure the files exist. if (path is null || !File.Exists(path)) @@ -77,7 +77,13 @@ internal sealed class AnalyzerLoadContext : AssemblyLoadContext public AnalyzerLoadContext(string assemblyPath) { - var analyzerDirectory = new DirectoryInfo(Path.GetDirectoryName(assemblyPath)); + var assemblyDirectory = Path.GetDirectoryName(assemblyPath); + if (assemblyDirectory is null) + { + throw new InvalidOperationException($"Assembly path invalid '{assemblyPath}'"); + } + + var analyzerDirectory = new DirectoryInfo(assemblyDirectory); // Analyzer packages will put language specific assemblies in subfolders. if (analyzerDirectory.Name == "cs" || analyzerDirectory.Name == "vb") @@ -86,6 +92,11 @@ public AnalyzerLoadContext(string assemblyPath) analyzerDirectory = analyzerDirectory.Parent; } + if (analyzerDirectory is null) + { + throw new InvalidOperationException($"Could not get parent directory for '{assemblyPath}'"); + } + AssemblyFolderPath = analyzerDirectory.FullName; DependencyResolver = new AssemblyDependencyResolver(assemblyPath); } diff --git a/src/Logging/SimpleConsoleLogger.cs b/src/Logging/SimpleConsoleLogger.cs index 79c87c2e46cd..c361f84a0493 100644 --- a/src/Logging/SimpleConsoleLogger.cs +++ b/src/Logging/SimpleConsoleLogger.cs @@ -79,7 +79,7 @@ private void LogToTerminal(string message, LogLevel logLevel, bool logToErrorStr _terminal.ResetColor(); } - private void LogToConsole(IConsole console, string message, bool logToErrorStream) + private static void LogToConsole(IConsole console, string message, bool logToErrorStream) { if (logToErrorStream) { diff --git a/tests/.editorconfig b/tests/.editorconfig new file mode 100644 index 000000000000..6f3d1d667a42 --- /dev/null +++ b/tests/.editorconfig @@ -0,0 +1,4 @@ +# Code files +[*.{cs,csx,vb,vbx}] +# CA1822: Make member static +dotnet_diagnostic.CA1822.severity = silent \ No newline at end of file diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 8183f82e7be1..3ab3814178fe 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -182,80 +182,6 @@ public void CommandLine_AnalyzerOptions_CanSpecifyBothWithDefaults() Assert.Equal(0, result.Errors.Count); } - [Fact] - // If this test fails that means FormatCommand options have changed, ensure the FormatCommand.Handler has been updated to match. - public async Task CommandLine_AllArguments_Bind() - { - // Arrange - var uniqueExitCode = 143; - - var sut = RootFormatCommand.GetCommand(); - - Task TestRun( - string workspace, - bool noRestore, - bool folder, - bool fixWhitespace, - string fixStyle, - string fixAnalyzers, - string[] diagnostics, - string verbosity, - bool check, - string[] include, - string[] exclude, - string report, - bool includeGenerated, - string binaryLogPath, - IConsole console = null) - { - Assert.Equal("./src", workspace); - Assert.True(noRestore); - Assert.False(folder); - Assert.True(fixWhitespace); - Assert.Equal("warn", fixStyle); - Assert.Equal("info", fixAnalyzers); - Assert.Equal(new[] { "IDE0005", "IDE0073" }, diagnostics); - Assert.Equal("diag", verbosity); - Assert.True(check); - Assert.Equal(new[] { "*.cs" }, include); - Assert.Equal(new[] { "*.vb" }, exclude); - Assert.Equal("report.json", report); - Assert.True(includeGenerated); - - return Task.FromResult(uniqueExitCode); - } - - var args = @" -./src ---no-restore ---fix-whitespace ---fix-style -warn ---fix-analyzers -info ---diagnostics -IDE0005 -IDE0073 ---verbosity -diag ---check ---include -*.cs ---exclude -*.vb ---report -report.json ---include-generated".Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries); - - // Act - var parseResult = sut.Parse(args); - var result = await sut.InvokeAsync(args); - - // Assert - Assert.Equal(0, parseResult.Errors.Count); - Assert.Equal(uniqueExitCode, result); - } - [Fact] public void CommandLine_BinaryLog_DoesNotFailIfPathNotSpecified() { From 2b74021451ca3c18f244918dc4ccd481393f95a9 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 24 Aug 2021 17:02:09 -0700 Subject: [PATCH 1606/2702] fixup parsing tests --- src/CommandLineExtensions.cs | 21 +++++++++++++++++++++ tests/ProgramTests.cs | 34 ++++++++++++---------------------- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/CommandLineExtensions.cs b/src/CommandLineExtensions.cs index 91ccfbda3a68..773bf71b8bb9 100644 --- a/src/CommandLineExtensions.cs +++ b/src/CommandLineExtensions.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.CommandLine; using System.CommandLine.Parsing; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -35,12 +36,32 @@ internal static T GetValueForArgument(this ParseResult result, string alias) return GetValueForArgument(result.CommandResult, alias); } + [return: MaybeNull] + internal static T GetValueForArgument(this ParseResult result, Argument argument) + { + return GetValueForArgument(result.CommandResult, argument); + } + [return: MaybeNull] internal static T GetValueForOption(this ParseResult result, string alias) { return GetValueForOption(result.CommandResult, alias); } + [return: MaybeNull] + internal static T GetValueForArgument(this CommandResult result, Argument argumentDefinition) + { + var arguments = result.Children.Where(x => x.Symbol.Name == argumentDefinition.Name).ToArray(); + if (arguments.Length == 1 && + arguments.SingleOrDefault() is ArgumentResult argument && + argument.GetValueOrDefault() is T t) + { + return t; + } + + return default; + } + [return: MaybeNull] internal static T GetValueForArgument(this CommandResult result, string alias) { diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index 3ab3814178fe..cb08d02b5c9e 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -5,6 +5,7 @@ using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.Parsing; +using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Commands; using Xunit; @@ -48,10 +49,11 @@ public void CommandLine_OptionsAreParsedCorrectly() // Act var result = sut.Parse(new[] { - "--folder", + "--no-restore", "--include", "include1", "include2", "--exclude", "exclude1", "exclude2", - "--check", + "--verify-no-changes", + "--binarylog", "binary-log-path", "--report", "report", "--verbosity", "detailed", "--include-generated"}); @@ -60,14 +62,15 @@ public void CommandLine_OptionsAreParsedCorrectly() Assert.Equal(0, result.Errors.Count); Assert.Equal(0, result.UnmatchedTokens.Count); Assert.Equal(0, result.UnparsedTokens.Count); - Assert.True(result.GetValueForOption("--folder")); + result.GetValueForOption("--no-restore"); Assert.Collection(result.GetValueForOption>("--include"), i0 => Assert.Equal("include1", i0), i1 => Assert.Equal("include2", i1)); Assert.Collection(result.GetValueForOption>("--exclude"), i0 => Assert.Equal("exclude1", i0), i1 => Assert.Equal("exclude2", i1)); - Assert.True(result.GetValueForOption("--check")); + Assert.True(result.GetValueForOption("--verify-no-changes")); + Assert.Equal("binary-log-path", result.GetValueForOption("--binarylog")); Assert.Equal("report", result.GetValueForOption("--report")); Assert.Equal("detailed", result.GetValueForOption("--verbosity")); Assert.True(result.GetValueForOption("--include-generated")); @@ -84,7 +87,7 @@ public void CommandLine_ProjectArgument_Simple() // Assert Assert.Equal(0, result.Errors.Count); - Assert.Equal("workspaceValue", result.GetValueForArgument("workspace")); + Assert.Equal("workspaceValue", result.GetValueForArgument(FormatCommandCommon.SlnOrProjectArgument)); } [Fact] @@ -98,7 +101,7 @@ public void CommandLine_ProjectArgument_WithOption_AfterArgument() // Assert Assert.Equal(0, result.Errors.Count); - Assert.Equal("workspaceValue", result.GetValueForArgument("workspace")); + Assert.Equal("workspaceValue", result.GetValueForArgument(FormatCommandCommon.SlnOrProjectArgument)); Assert.Equal("detailed", result.GetValueForOption("--verbosity")); } @@ -113,7 +116,7 @@ public void CommandLine_ProjectArgument_WithOption_BeforeArgument() // Assert Assert.Equal(0, result.Errors.Count); - Assert.Equal("workspaceValue", result.GetValueForArgument("workspace")); + Assert.Equal("workspaceValue", result.GetValueForArgument(FormatCommandCommon.SlnOrProjectArgument)); Assert.Equal("detailed", result.GetValueForOption("--verbosity")); } @@ -163,25 +166,12 @@ public void CommandLine_FolderValidation_FailsIfNoRestoreSpecified() var sut = RootFormatCommand.GetCommand(); // Act - var result = sut.Parse(new[] { "--folder", "--no-restore" }); + var result = sut.Parse(new[] { "whitespace", "--folder", "--no-restore" }); // Assert Assert.Equal(1, result.Errors.Count); } - [Fact] - public void CommandLine_AnalyzerOptions_CanSpecifyBothWithDefaults() - { - // Arrange - var sut = RootFormatCommand.GetCommand(); - - // Act - var result = sut.Parse(new[] { "--fix-analyzers", "--fix-style" }); - - // Assert - Assert.Equal(0, result.Errors.Count); - } - [Fact] public void CommandLine_BinaryLog_DoesNotFailIfPathNotSpecified() { @@ -217,7 +207,7 @@ public void CommandLine_BinaryLog_FailsIfFolderIsSpecified() var sut = RootFormatCommand.GetCommand(); // Act - var result = sut.Parse(new[] { "--folder", "--binarylog" }); + var result = sut.Parse(new[] { "whitespace", "--folder", "--binarylog" }); // Assert Assert.Equal(1, result.Errors.Count); From 3700694f992362b2a0cd4faedfcb61ed011984e8 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 24 Aug 2021 17:22:56 -0700 Subject: [PATCH 1607/2702] Fixup the analyzer tests --- Directory.Packages.props | 2 +- src/dotnet-format.csproj | 2 +- tests/Analyzers/AnalyzerAssemblyGenerator.cs | 12 ++++++------ tests/Formatters/AbstractFormatterTests.cs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index b7f9fce0444b..06f1a9f5efa6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -14,7 +14,7 @@ - + diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 0e3799f1378c..0890a977b19f 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -1,7 +1,7 @@  - netcoreapp6.0 + net6.0 Exe 9.0 true diff --git a/tests/Analyzers/AnalyzerAssemblyGenerator.cs b/tests/Analyzers/AnalyzerAssemblyGenerator.cs index 382fffdf4cfa..423d191da96c 100644 --- a/tests/Analyzers/AnalyzerAssemblyGenerator.cs +++ b/tests/Analyzers/AnalyzerAssemblyGenerator.cs @@ -25,14 +25,14 @@ private static async Task> GetReferencesAsync() { var references = new List() { - MetadataReference.CreateFromFile(Path.Combine(s_basePath, Path.GetFileName(typeof(ImmutableArray).Assembly.Location))), - MetadataReference.CreateFromFile(Path.Combine(s_basePath, Path.GetFileName(typeof(SharedAttribute).Assembly.Location))), - MetadataReference.CreateFromFile(Path.Combine(s_basePath, Path.GetFileName(typeof(CSharpCompilation).Assembly.Location))), - MetadataReference.CreateFromFile(Path.Combine(s_basePath, Path.GetFileName(typeof(DiagnosticAnalyzer).Assembly.Location))), - MetadataReference.CreateFromFile(Path.Combine(s_basePath, Path.GetFileName(typeof(CodeFixProvider).Assembly.Location))), + MetadataReference.CreateFromFile(typeof(ImmutableArray).Assembly.Location), + MetadataReference.CreateFromFile(typeof(SharedAttribute).Assembly.Location), + MetadataReference.CreateFromFile(typeof(CSharpCompilation).Assembly.Location), + MetadataReference.CreateFromFile(typeof(DiagnosticAnalyzer).Assembly.Location), + MetadataReference.CreateFromFile(typeof(CodeFixProvider).Assembly.Location), }; - var netcoreMetadataReferences = await ReferenceAssemblies.NetCore.NetCoreApp31.ResolveAsync(LanguageNames.CSharp, CancellationToken.None); + var netcoreMetadataReferences = await ReferenceAssemblies.Net.Net60.ResolveAsync(LanguageNames.CSharp, CancellationToken.None); references.AddRange(netcoreMetadataReferences.Where(reference => Path.GetFileName(reference.Display) != "System.Collections.Immutable.dll")); return references; diff --git a/tests/Formatters/AbstractFormatterTests.cs b/tests/Formatters/AbstractFormatterTests.cs index 4b63f3629192..5b1fd4812fc7 100644 --- a/tests/Formatters/AbstractFormatterTests.cs +++ b/tests/Formatters/AbstractFormatterTests.cs @@ -70,7 +70,7 @@ static AbstractFormatterTest() protected AbstractFormatterTest() { - TestState = new SolutionState(DefaultFilePathPrefix, DefaultFileExt); + TestState = new SolutionState("Test", Language, DefaultFilePathPrefix, DefaultFileExt); } /// From d908de2c9d742ba734e38504746fb036f3508eb6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 12:53:26 +0000 Subject: [PATCH 1608/2702] Update dependencies from https://github.com/dotnet/arcade build 20210824.3 (#1288) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/build.sh | 5 ++++- eng/common/sdk-task.ps1 | 4 +++- eng/common/tools.ps1 | 6 +++--- eng/common/tools.sh | 2 +- global.json | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index daf9d22ed462..d22209848c7a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - fe787bd48ed72e51a98eb5e4e5e5af74edb531e5 + 3dd12f0a1d25fa29b84e38b7d2345a693f4ae45e diff --git a/eng/common/build.sh b/eng/common/build.sh index 9d3042a943e4..bc07a1c68482 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -187,7 +187,10 @@ function InitializeCustomToolset { } function Build { - TryLogClientIpAddress + + if [[ "$ci" == true ]]; then + TryLogClientIpAddress + fi InitializeToolset InitializeCustomToolset diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index 7ffa3591e9ca..7ab9baac5c8d 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -83,7 +83,9 @@ try { } if ($restore) { - Try-LogClientIpAddress + if ($ci) { + Try-LogClientIpAddress + } Build 'Restore' } diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index e607aa436976..56ee4a577aca 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -154,9 +154,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { return $global:_DotNetInstallDir } - # In case of network error, try to log the current IP for reference - Try-LogClientIpAddress - # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism $env:DOTNET_MULTILEVEL_LOOKUP=0 @@ -166,6 +163,9 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { # Disable telemetry on CI. if ($ci) { $env:DOTNET_CLI_TELEMETRY_OPTOUT=1 + + # In case of network error, try to log the current IP for reference + Try-LogClientIpAddress } # Source Build uses DotNetCoreSdkDir variable diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 3c5f3a12c0a6..41e323104df4 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -402,7 +402,7 @@ function StopProcesses { function TryLogClientIpAddress () { echo 'Attempting to log this client''s IP for Azure Package feed telemetry purposes' if command -v curl > /dev/null; then - curl -s 'http://co1.msedge.net/fdv2/diagnostics.aspx' | grep ' IP: ' + curl -s 'http://co1.msedge.net/fdv2/diagnostics.aspx' | grep ' IP: ' || true fi } diff --git a/global.json b/global.json index 4799d8913b1e..083b9340d845 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21420.4" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21424.3" } } From c4dcd04da63379e0c4e7c0bd2fa3ef0fcf44a6c1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 12:59:09 +0000 Subject: [PATCH 1609/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210824.5 (#1289) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d22209848c7a..8bfbedd7c477 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c051d9d7f02cc8d4a8bb4ebf111245dc309e0baa + 8893e64d4a9f4ba78aae83e6c87f302ab14a60e9 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 44d88f5d7437..29aa460a99a5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21423.7 + 4.0.0-4.21424.5 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 88ae2dd999b08795a4547098aaf5a34f04c124de Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 11:08:09 -0700 Subject: [PATCH 1610/2702] Update the format validation .rsp to the new command structure --- validate.rsp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/validate.rsp b/validate.rsp index 7dc21a4a09ec..470f46f8f904 100644 --- a/validate.rsp +++ b/validate.rsp @@ -1,13 +1,8 @@ ./format.sln ---fix-whitespace ---fix-style -warn ---fix-analyzers -warn --exclude ./tests/projects/ ---check +--verify-no-changes --report ./artifacts/log/ -v -diag \ No newline at end of file +diag From ec84c70dbdceaa1cbed9eb5a737cd6ed50aac1c0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 11:09:01 -0700 Subject: [PATCH 1611/2702] Update the integration tests to the new command structure --- eng/format-verifier.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index 8d49ae04ca68..4011e720209f 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -70,7 +70,7 @@ try { if ($stage -eq "format-workspace") { Write-Output "$(Get-Date) - $solutionFile - Formatting Workspace" - $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/netcoreapp3.1/dotnet-format.dll" $solution --no-restore -wsa -v diag --check | Out-String + $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/net6.0/dotnet-format.dll" $solution --no-restore -v diag --verify-no-changes | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. @@ -92,7 +92,7 @@ try { if ($stage -eq "format-folder") { Write-Output "$(Get-Date) - $folderName - Formatting Folder" - $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/netcoreapp3.1/dotnet-format.dll" -f $repoPath -v diag --check | Out-String + $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/net6.0/dotnet-format.dll" -f $repoPath -v diag --check | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. From 153488745a7d850f86e65d6c45608b5a60c680b2 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 11:09:51 -0700 Subject: [PATCH 1612/2702] Update the integration tests to the new command structure --- eng/format-verifier.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index 4011e720209f..45935d8541c9 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -92,7 +92,7 @@ try { if ($stage -eq "format-folder") { Write-Output "$(Get-Date) - $folderName - Formatting Folder" - $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/net6.0/dotnet-format.dll" -f $repoPath -v diag --check | Out-String + $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/net6.0/dotnet-format.dll" whitespace -folder $repoPath -v diag --verify-no-changes | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. From 8ef919a3ca496343a2a927068e5387b51984c8b6 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 14:18:31 -0700 Subject: [PATCH 1613/2702] Use C# 10 --- perf/dotnet-format.Performance.csproj | 2 +- src/dotnet-format.csproj | 2 +- tests/dotnet-format.UnitTests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/perf/dotnet-format.Performance.csproj b/perf/dotnet-format.Performance.csproj index 19097121b760..dd4c95e2cced 100644 --- a/perf/dotnet-format.Performance.csproj +++ b/perf/dotnet-format.Performance.csproj @@ -2,7 +2,7 @@ net6.0 Exe - 9.0 + 10.0 AnyCPU diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 0890a977b19f..b88c7eb144bd 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -3,7 +3,7 @@ net6.0 Exe - 9.0 + 10.0 true Microsoft.CodeAnalysis.Tools true diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 867057b19c7b..b1ebf711537e 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -2,7 +2,7 @@ net6.0 - 9.0 + 10.0 false Microsoft.CodeAnalysis.Tools.Tests From 0a0a9de7357c369f9bc3edff3e1a92e23d8a13ac Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 14:18:54 -0700 Subject: [PATCH 1614/2702] Fix VSCode launch tasks --- .vscode/launch.json | 58 +++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 3bd5374d7164..5763ccee263d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,10 +10,10 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp3.1/dotnet-format.dll", + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/net6.0/dotnet-format.dll", "args": [ "@validate.rsp", - "--check" + "--verify-no-changes" ], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console @@ -22,17 +22,37 @@ "justMyCode": false }, { - "name": "format -f --check", + "name": "format format.sln --verify-no-changes", "type": "coreclr", "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp3.1/dotnet-format.dll", + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/net6.0/dotnet-format.dll", "args": [ - "-f", + "format.sln", + "-v", + "diag", + "--verify-no-changes" + ], + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false, + "justMyCode": false + }, + { + "name": "format whitespace --folder --verify-no-changes", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/net6.0/dotnet-format.dll", + "args": [ + "whitespace", + "--folder", "-v", "diag", - "--check" + "--verify-no-changes" ], "cwd": "${workspaceFolder}/src", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console @@ -41,17 +61,18 @@ "justMyCode": false }, { - "name": "format format.sln --check", + "name": "format whitespace format.sln --verify-no-changes", "type": "coreclr", "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp3.1/dotnet-format.dll", + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/net6.0/dotnet-format.dll", "args": [ + "whitespace", "format.sln", "-v", "diag", - "--check" + "--verify-no-changes" ], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console @@ -60,20 +81,18 @@ "justMyCode": false }, { - "name": "format format.sln --fix-style warn --check", + "name": "format style format.sln --verify-no-changes", "type": "coreclr", "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp3.1/dotnet-format.dll", + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/net6.0/dotnet-format.dll", "args": [ + "style", "format.sln", - "--fix-whitespace", - "--fix-style", - "warn", "-v", "diag", - "--check" + "--verify-no-changes" ], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console @@ -82,19 +101,18 @@ "justMyCode": false }, { - "name": "format format.sln --fix-analyzers warn --check", + "name": "format analyzers format.sln --verify-no-changes", "type": "coreclr", "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/netcoreapp3.1/dotnet-format.dll", + "program": "${workspaceFolder}/artifacts/bin/dotnet-format/Debug/net6.0/dotnet-format.dll", "args": [ + "analyzers", "format.sln", - "--fix-analyzers", - "warn", "-v", "diag", - "--check" + "--verify-no-changes" ], "cwd": "${workspaceFolder}", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console From e6f7f674a1e0669640a85be2832ef0f333776c7a Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 14:19:23 -0700 Subject: [PATCH 1615/2702] Load MSBuild when necessary; Handle --folder option. --- src/Commands/FormatAnalyzersCommand.cs | 20 +-- src/Commands/FormatCommandCommon.cs | 152 ++++++++++++++++--- src/Commands/FormatStyleCommand.cs | 20 +-- src/Commands/FormatWhitespaceCommand.cs | 11 +- src/Commands/RootFormatCommand.cs | 20 +-- src/Program.cs | 1 - tests/Analyzers/AnalyzerAssemblyGenerator.cs | 2 - tests/ProgramTests.cs | 4 - 8 files changed, 134 insertions(+), 96 deletions(-) diff --git a/src/Commands/FormatAnalyzersCommand.cs b/src/Commands/FormatAnalyzersCommand.cs index 8c9edd63bda6..322397ebf978 100644 --- a/src/Commands/FormatAnalyzersCommand.cs +++ b/src/Commands/FormatAnalyzersCommand.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Immutable; using System.CommandLine; using System.CommandLine.Invocation; @@ -51,24 +50,7 @@ public async Task InvokeAsync(InvocationContext context) formatOptions = formatOptions with { FixCategory = FixCategory.Analyzers }; - var formatResult = await CodeFormatter.FormatWorkspaceAsync( - formatOptions, - logger, - context.GetCancellationToken(), - binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); - return formatResult.GetExitCode(formatOptions.ChangesAreErrors); - - static DiagnosticSeverity GetSeverity(string? severity) - { - return severity?.ToLowerInvariant() switch - { - "" => DiagnosticSeverity.Error, - FixSeverity.Error => DiagnosticSeverity.Error, - FixSeverity.Warn => DiagnosticSeverity.Warning, - FixSeverity.Info => DiagnosticSeverity.Info, - _ => throw new ArgumentOutOfRangeException(nameof(severity)), - }; - } + return await FormatAsync(formatOptions, logger, context.GetCancellationToken()).ConfigureAwait(false); } } } diff --git a/src/Commands/FormatCommandCommon.cs b/src/Commands/FormatCommandCommon.cs index d984ca952870..79b1ac6f9067 100644 --- a/src/Commands/FormatCommandCommon.cs +++ b/src/Commands/FormatCommandCommon.cs @@ -3,9 +3,13 @@ using System; using System.CommandLine; using System.CommandLine.Parsing; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; +using System.Reflection; using System.Text; +using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Logging; using Microsoft.CodeAnalysis.Tools.Utilities; using Microsoft.CodeAnalysis.Tools.Workspaces; @@ -57,6 +61,54 @@ internal static class FormatCommandCommon ArgumentHelpName = "report-path" }.LegalFilePathsOnly(); + internal static async Task FormatAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) + { + var currentDirectory = Environment.CurrentDirectory; + + try + { + var workspaceDirectory = formatOptions.WorkspaceType == WorkspaceType.Folder + ? formatOptions.WorkspaceFilePath + : Path.GetDirectoryName(formatOptions.WorkspaceFilePath)!; + + if (formatOptions.WorkspaceType != WorkspaceType.Folder) + { + var runtimeVersion = GetRuntimeVersion(); + logger.LogDebug(Resources.The_dotnet_runtime_version_is_0, runtimeVersion); + + // Load MSBuild + Environment.CurrentDirectory = workspaceDirectory; + + if (!TryGetDotNetCliVersion(out var dotnetVersion)) + { + logger.LogError(Resources.Unable_to_locate_dotnet_CLI_Ensure_that_it_is_on_the_PATH); + return UnableToLocateDotNetCliExitCode; + } + + logger.LogTrace(Resources.The_dotnet_CLI_version_is_0, dotnetVersion); + + if (!TryLoadMSBuild(out var msBuildPath)) + { + logger.LogError(Resources.Unable_to_locate_MSBuild_Ensure_the_NET_SDK_was_installed_with_the_official_installer); + return UnableToLocateMSBuildExitCode; + } + + logger.LogTrace(Resources.Using_msbuildexe_located_in_0, msBuildPath); + } + + var formatResult = await CodeFormatter.FormatWorkspaceAsync( + formatOptions, + logger, + cancellationToken, + binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); + return formatResult.GetExitCode(formatOptions.ChangesAreErrors); + } + finally + { + Environment.CurrentDirectory = currentDirectory; + } + } + public static void AddCommonOptions(this Command command) { command.AddArgument(SlnOrProjectArgument); @@ -165,11 +217,11 @@ public static FormatOptions ParseCommonOptions(this ParseResult parseResult, For static void HandleStandardInput(ILogger logger, ref string[] include, ref string[] exclude) { - string[] s_standardInputKeywords = { "/dev/stdin", "-" }; + string[] standardInputKeywords = { "/dev/stdin", "-" }; const int CheckFailedExitCode = 2; var isStandardMarkerUsed = false; - if (include.Length == 1 && s_standardInputKeywords.Contains(include[0])) + if (include.Length == 1 && standardInputKeywords.Contains(include[0])) { if (TryReadFromStandardInput(ref include)) { @@ -177,7 +229,7 @@ static void HandleStandardInput(ILogger logger, ref string[] include, ref string } } - if (exclude.Length == 1 && s_standardInputKeywords.Contains(exclude[0])) + if (exclude.Length == 1 && standardInputKeywords.Contains(exclude[0])) { if (isStandardMarkerUsed) { @@ -222,26 +274,27 @@ static bool TryReadFromStandardInput(ref string[] subject) internal static LogLevel GetLogLevel(string? verbosity) { - switch (verbosity) + return verbosity switch { - case "q": - case "quiet": - return LogLevel.Error; - case "m": - case "minimal": - return LogLevel.Warning; - case "n": - case "normal": - return LogLevel.Information; - case "d": - case "detailed": - return LogLevel.Debug; - case "diag": - case "diagnostic": - return LogLevel.Trace; - default: - return LogLevel.Information; - } + "q" or "quiet" => LogLevel.Error, + "m" or "minimal" => LogLevel.Warning, + "n" or "normal" => LogLevel.Information, + "d" or "detailed" => LogLevel.Debug, + "diag" or "diagnostic" => LogLevel.Trace, + _ => LogLevel.Information, + }; + } + + internal static DiagnosticSeverity GetSeverity(string? severity) + { + return severity?.ToLowerInvariant() switch + { + "" => DiagnosticSeverity.Error, + FixSeverity.Error => DiagnosticSeverity.Error, + FixSeverity.Warn => DiagnosticSeverity.Warning, + FixSeverity.Info => DiagnosticSeverity.Info, + _ => throw new ArgumentOutOfRangeException(nameof(severity)), + }; } public static FormatOptions ParseWorkspaceOptions(this ParseResult parseResult, FormatOptions formatOptions) @@ -250,6 +303,13 @@ public static FormatOptions ParseWorkspaceOptions(this ParseResult parseResult, if (parseResult.ValueForArgument(SlnOrProjectArgument) is string { Length: > 0 } slnOrProject) { + if (parseResult.HasOption(FolderOption)) + { + formatOptions = formatOptions with { WorkspaceFilePath = slnOrProject }; + formatOptions = formatOptions with { WorkspaceType = WorkspaceType.Folder }; + return formatOptions; + } + var (isSolution, workspaceFilePath) = MSBuildWorkspaceFinder.FindWorkspace(currentDirectory, slnOrProject); formatOptions = formatOptions with { WorkspaceFilePath = workspaceFilePath }; formatOptions = formatOptions with { WorkspaceType = isSolution ? WorkspaceType.Solution : WorkspaceType.Project }; @@ -272,5 +332,53 @@ private static string EnsureTrailingSlash(string path) path[^1] != Path.DirectorySeparatorChar ? path + Path.DirectorySeparatorChar : path; + + internal static string? GetVersion() + { + return Assembly.GetExecutingAssembly() + .GetCustomAttribute() + ?.InformationalVersion; + } + + internal static bool TryGetDotNetCliVersion([NotNullWhen(returnValue: true)] out string? dotnetVersion) + { + try + { + var processInfo = ProcessRunner.CreateProcess("dotnet", "--version", captureOutput: true, displayWindow: false); + var versionResult = processInfo.Result.GetAwaiter().GetResult(); + + dotnetVersion = versionResult.OutputLines[0].Trim(); + return true; + } + catch + { + dotnetVersion = null; + return false; + } + } + + internal static bool TryLoadMSBuild([NotNullWhen(returnValue: true)] out string? msBuildPath) + { + try + { + // Since we are running as a dotnet tool we should be able to find an instance of + // MSBuild in a .NET Core SDK. + var msBuildInstance = Build.Locator.MSBuildLocator.RegisterDefaults(); + msBuildPath = msBuildInstance.MSBuildPath; + return true; + } + catch + { + msBuildPath = null; + return false; + } + } + + internal static string GetRuntimeVersion() + { + var pathParts = typeof(string).Assembly.Location.Split('\\', '/'); + var netCoreAppIndex = Array.IndexOf(pathParts, "Microsoft.NETCore.App"); + return pathParts[netCoreAppIndex + 1]; + } } } diff --git a/src/Commands/FormatStyleCommand.cs b/src/Commands/FormatStyleCommand.cs index 7f5156cf9047..30455c5bf1f1 100644 --- a/src/Commands/FormatStyleCommand.cs +++ b/src/Commands/FormatStyleCommand.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.Parsing; @@ -43,24 +42,7 @@ public async Task InvokeAsync(InvocationContext context) formatOptions = formatOptions with { FixCategory = FixCategory.CodeStyle }; - var formatResult = await CodeFormatter.FormatWorkspaceAsync( - formatOptions, - logger, - context.GetCancellationToken(), - binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); - return formatResult.GetExitCode(formatOptions.ChangesAreErrors); - - static DiagnosticSeverity GetSeverity(string? severity) - { - return severity?.ToLowerInvariant() switch - { - "" => DiagnosticSeverity.Error, - FixSeverity.Error => DiagnosticSeverity.Error, - FixSeverity.Warn => DiagnosticSeverity.Warning, - FixSeverity.Info => DiagnosticSeverity.Info, - _ => throw new ArgumentOutOfRangeException(nameof(severity)), - }; - } + return await FormatAsync(formatOptions, logger, context.GetCancellationToken()).ConfigureAwait(false); } } } diff --git a/src/Commands/FormatWhitespaceCommand.cs b/src/Commands/FormatWhitespaceCommand.cs index e4625f2338a5..6abe087e1c89 100644 --- a/src/Commands/FormatWhitespaceCommand.cs +++ b/src/Commands/FormatWhitespaceCommand.cs @@ -68,19 +68,10 @@ public async Task InvokeAsync(InvocationContext context) var logger = context.Console.SetupLogging(minimalLogLevel: formatOptions.LogLevel, minimalErrorLevel: LogLevel.Warning); formatOptions = parseResult.ParseCommonOptions(formatOptions, logger); formatOptions = parseResult.ParseWorkspaceOptions(formatOptions); - if (parseResult.HasOption(FolderOption)) - { - formatOptions = formatOptions with { WorkspaceType = WorkspaceType.Folder }; - } formatOptions = formatOptions with { FixCategory = FixCategory.Whitespace }; - var formatResult = await CodeFormatter.FormatWorkspaceAsync( - formatOptions, - logger, - context.GetCancellationToken(), - binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); - return formatResult.GetExitCode(formatOptions.ChangesAreErrors); + return await FormatAsync(formatOptions, logger, context.GetCancellationToken()).ConfigureAwait(false); } } } diff --git a/src/Commands/RootFormatCommand.cs b/src/Commands/RootFormatCommand.cs index aa1d7d708f12..741effb7f154 100644 --- a/src/Commands/RootFormatCommand.cs +++ b/src/Commands/RootFormatCommand.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Immutable; using System.CommandLine; using System.CommandLine.Invocation; @@ -55,24 +54,7 @@ public async Task InvokeAsync(InvocationContext context) formatOptions = formatOptions with { FixCategory = FixCategory.Whitespace | FixCategory.CodeStyle | FixCategory.Analyzers }; - var formatResult = await CodeFormatter.FormatWorkspaceAsync( - formatOptions, - logger, - context.GetCancellationToken(), - binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); - return formatResult.GetExitCode(formatOptions.ChangesAreErrors); - - static DiagnosticSeverity GetSeverity(string? severity) - { - return severity?.ToLowerInvariant() switch - { - "" => DiagnosticSeverity.Error, - FixSeverity.Error => DiagnosticSeverity.Error, - FixSeverity.Warn => DiagnosticSeverity.Warning, - FixSeverity.Info => DiagnosticSeverity.Info, - _ => throw new ArgumentOutOfRangeException(nameof(severity)), - }; - } + return await FormatAsync(formatOptions, logger, context.GetCancellationToken()).ConfigureAwait(false); } } } diff --git a/src/Program.cs b/src/Program.cs index 74abc0d290a5..5ffb0f8dbf44 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -9,7 +9,6 @@ namespace Microsoft.CodeAnalysis.Tools { internal class Program { - private static async Task Main(string[] args) { var rootCommand = RootFormatCommand.GetCommand(); diff --git a/tests/Analyzers/AnalyzerAssemblyGenerator.cs b/tests/Analyzers/AnalyzerAssemblyGenerator.cs index 423d191da96c..e68f69850dc6 100644 --- a/tests/Analyzers/AnalyzerAssemblyGenerator.cs +++ b/tests/Analyzers/AnalyzerAssemblyGenerator.cs @@ -19,8 +19,6 @@ namespace Microsoft.CodeAnalysis.Tools.Tests.Analyzers { public static class AnalyzerAssemblyGenerator { - private static readonly string s_basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - private static async Task> GetReferencesAsync() { var references = new List() diff --git a/tests/ProgramTests.cs b/tests/ProgramTests.cs index cb08d02b5c9e..32f4b2d2c462 100644 --- a/tests/ProgramTests.cs +++ b/tests/ProgramTests.cs @@ -1,12 +1,8 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.CommandLine; -using System.CommandLine.Invocation; using System.CommandLine.Parsing; -using System.Linq; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.Tools.Commands; using Xunit; From cca55c79764b1795a3bf904f85383c9876c832e5 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 15:04:50 -0700 Subject: [PATCH 1616/2702] Ignore Diagnostic default severity when determining effective severity --- src/Analyzers/Extensions.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Analyzers/Extensions.cs b/src/Analyzers/Extensions.cs index 189e9d54ebb0..bc376d2d27b5 100644 --- a/src/Analyzers/Extensions.cs +++ b/src/Analyzers/Extensions.cs @@ -145,11 +145,6 @@ private static DiagnosticSeverity GetSeverity( continue; } - - if (descriptor.DefaultSeverity > severity) - { - severity = descriptor.DefaultSeverity; - } } return severity; From a227135ef8149cbaff4e0ff6f29884f721031a04 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 15:40:43 -0700 Subject: [PATCH 1617/2702] Update integration test repo SHAs --- azure-pipelines-integration.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index 63cdf86d5e8e..3db2b21f2c68 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -23,49 +23,49 @@ jobs: _repoName: "dotnet/format" _targetSolution: "format.sln" _branchName: "main" - _sha: "3ad458b16ef0d630ef4393bca5bdeaa00628cfcf" + _sha: "c4dcd04da63379e0c4e7c0bd2fa3ef0fcf44a6c1" roslyn: _repo: "https://github.com/dotnet/roslyn" _repoName: "dotnet/roslyn" _targetSolution: "Compilers.sln" _branchName: "main" - _sha: "7e99a9ab877c4233b6a87c555d4c42b29f40c553" + _sha: "e9ed046c159bfc5caf33b875ab6928a73c5601f3" sdk: _repo: "https://github.com/dotnet/sdk" _repoName: "dotnet/sdk" _targetSolution: "sdk.sln" _branchName: "master" - _sha: "41cd7eb0d418f558c03459dfabef3601019d97b6" + _sha: "1404c8ebdfb5d7590fb7335e5cb5a2267de125c5" project-system: _repo: "https://github.com/dotnet/project-system" _repoName: "dotnet/project-system" _targetSolution: "ProjectSystem.sln" _branchName: "main" - _sha: "34c750bd2e793026bb190bd789e2ed07be5b621b" + _sha: "33c2c7d21f18e06731b59e9b2b5788d535768e59" msbuild: _repo: "https://github.com/dotnet/msbuild" _repoName: "dotnet/msbuild" _targetSolution: "MSBuild.sln" - _branchName: "master" + _branchName: "main" _sha: "0be0490bd1261ff4a6ad64267879b36a63a33faf" aspnetcore: _repo: "https://github.com/dotnet/aspnetcore" _repoName: "dotnet/aspnetcore" _targetSolution: "AspNetCore.sln" _branchName: "main" - _sha: "1e19c6fd19fe2f19af25da25f86d90b6fd2623fc" + _sha: "67f3befad2180b766ba3a1ad0eb1f37232a29b16" efcore: _repo: "https://github.com/dotnet/efcore" _repoName: "dotnet/efcore" _targetSolution: "All.sln" _branchName: "main" - _sha: "f1a0d8c9928668310336565e73861a7e1702ddaf" + _sha: "717ee2c6e6a2bfc40a200e2adb66c6ed4180962b" ef6: _repo: "https://github.com/dotnet/ef6" _repoName: "dotnet/ef6" _targetSolution: "EntityFramework.sln" _branchName: "main" - _sha: "ad101227fdf8ef7c2028f1b0ee2f73c426c56a33" + _sha: "df31fde50966a117180459313024d95c0a004162" timeoutInMinutes: 60 steps: - script: eng\integration-test.cmd -repo '$(_repo)' -branchName '$(_branchName)' -sha '$(_sha)' -targetSolution '$(_targetSolution)' -testPath '$(Build.SourcesDirectory)\temp' -stage 'prepare' From 046627e2f76120ba64718bccd1ebf32ea44943a0 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 16:45:40 -0700 Subject: [PATCH 1618/2702] Always use MSBuild from the latest .NET 6 SDK --- src/Commands/FormatCommandCommon.cs | 70 +++++++++++++---------------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/src/Commands/FormatCommandCommon.cs b/src/Commands/FormatCommandCommon.cs index 79b1ac6f9067..fb69853b6880 100644 --- a/src/Commands/FormatCommandCommon.cs +++ b/src/Commands/FormatCommandCommon.cs @@ -63,50 +63,34 @@ internal static class FormatCommandCommon internal static async Task FormatAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken) { - var currentDirectory = Environment.CurrentDirectory; - - try + if (formatOptions.WorkspaceType != WorkspaceType.Folder) { - var workspaceDirectory = formatOptions.WorkspaceType == WorkspaceType.Folder - ? formatOptions.WorkspaceFilePath - : Path.GetDirectoryName(formatOptions.WorkspaceFilePath)!; + var runtimeVersion = GetRuntimeVersion(); + logger.LogDebug(Resources.The_dotnet_runtime_version_is_0, runtimeVersion); - if (formatOptions.WorkspaceType != WorkspaceType.Folder) + if (!TryGetDotNetCliVersion(out var dotnetVersion)) { - var runtimeVersion = GetRuntimeVersion(); - logger.LogDebug(Resources.The_dotnet_runtime_version_is_0, runtimeVersion); - - // Load MSBuild - Environment.CurrentDirectory = workspaceDirectory; - - if (!TryGetDotNetCliVersion(out var dotnetVersion)) - { - logger.LogError(Resources.Unable_to_locate_dotnet_CLI_Ensure_that_it_is_on_the_PATH); - return UnableToLocateDotNetCliExitCode; - } - - logger.LogTrace(Resources.The_dotnet_CLI_version_is_0, dotnetVersion); + logger.LogError(Resources.Unable_to_locate_dotnet_CLI_Ensure_that_it_is_on_the_PATH); + return UnableToLocateDotNetCliExitCode; + } - if (!TryLoadMSBuild(out var msBuildPath)) - { - logger.LogError(Resources.Unable_to_locate_MSBuild_Ensure_the_NET_SDK_was_installed_with_the_official_installer); - return UnableToLocateMSBuildExitCode; - } + logger.LogTrace(Resources.The_dotnet_CLI_version_is_0, dotnetVersion); - logger.LogTrace(Resources.Using_msbuildexe_located_in_0, msBuildPath); + if (!TryLoadMSBuild(out var msBuildPath)) + { + logger.LogError(Resources.Unable_to_locate_MSBuild_Ensure_the_NET_SDK_was_installed_with_the_official_installer); + return UnableToLocateMSBuildExitCode; } - var formatResult = await CodeFormatter.FormatWorkspaceAsync( - formatOptions, - logger, - cancellationToken, - binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); - return formatResult.GetExitCode(formatOptions.ChangesAreErrors); - } - finally - { - Environment.CurrentDirectory = currentDirectory; + logger.LogTrace(Resources.Using_msbuildexe_located_in_0, msBuildPath); } + + var formatResult = await CodeFormatter.FormatWorkspaceAsync( + formatOptions, + logger, + cancellationToken, + binaryLogPath: formatOptions.BinaryLogPath).ConfigureAwait(false); + return formatResult.GetExitCode(formatOptions.ChangesAreErrors); } public static void AddCommonOptions(this Command command) @@ -361,9 +345,17 @@ internal static bool TryLoadMSBuild([NotNullWhen(returnValue: true)] out string? { try { - // Since we are running as a dotnet tool we should be able to find an instance of - // MSBuild in a .NET Core SDK. - var msBuildInstance = Build.Locator.MSBuildLocator.RegisterDefaults(); + // Get the latest .NET 6 SDK instance. + var msBuildInstance = Build.Locator.MSBuildLocator.QueryVisualStudioInstances() + .Where(instance => instance.Version.Major == 6) + .MaxBy(instance => instance.Version); + if (msBuildInstance is null) + { + msBuildPath = null; + return false; + } + + Build.Locator.MSBuildLocator.RegisterInstance(msBuildInstance); msBuildPath = msBuildInstance.MSBuildPath; return true; } From ee776c2c93effc148fc3dc495036ad6b4798cf41 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 16:47:42 -0700 Subject: [PATCH 1619/2702] Disable global usings --- Directory.Build.props | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index 88d303eefe88..fa68595530ad 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,6 +6,11 @@ + + + true + + From 44aa3fb71ad531c62c43166792d4055af3a2e771 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 17:58:11 -0700 Subject: [PATCH 1620/2702] Fix unit tests to configure severity in editorconfig --- tests/Analyzers/FilterDiagnosticsTests.cs | 8 +++++++- .../for_code_formatter/analyzers_solution/.editorconfig | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/Analyzers/FilterDiagnosticsTests.cs b/tests/Analyzers/FilterDiagnosticsTests.cs index bb771e6ed19a..b7ab9ee09819 100644 --- a/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/tests/Analyzers/FilterDiagnosticsTests.cs @@ -113,11 +113,17 @@ private Task GetSolutionAsync() var text = SourceText.From(""); TestState.Sources.Add(text); + var editorConfig = $@" +root = true +[*.cs] +dotnet_diagnostic.DiagnosticAnalyzerId.severity = warning +"; + return GetSolutionAsync( TestState.Sources.ToArray(), TestState.AdditionalFiles.ToArray(), TestState.AdditionalReferences.ToArray(), - "root = true"); + editorConfig); } private async Task> GetProjectAnalyzersAndFixersAsync(Solution solution) diff --git a/tests/projects/for_code_formatter/analyzers_solution/.editorconfig b/tests/projects/for_code_formatter/analyzers_solution/.editorconfig index ed359c7e50f0..d60a5519847a 100644 --- a/tests/projects/for_code_formatter/analyzers_solution/.editorconfig +++ b/tests/projects/for_code_formatter/analyzers_solution/.editorconfig @@ -216,3 +216,5 @@ dotnet_diagnostic.CA1027.severity = error # CA1028: Enum storage should be Int32 dotnet_diagnostic.CA1028.severity = error + +dotnet_diagnostic.RS0016.severity = warning \ No newline at end of file From 359c39d901ba6ac24acbabbf58a590fa3811ffac Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 25 Aug 2021 18:00:12 -0700 Subject: [PATCH 1621/2702] Update integration test runner --- eng/format-verifier.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/format-verifier.ps1 b/eng/format-verifier.ps1 index 45935d8541c9..f6a691ff756d 100644 --- a/eng/format-verifier.ps1 +++ b/eng/format-verifier.ps1 @@ -92,7 +92,7 @@ try { if ($stage -eq "format-folder") { Write-Output "$(Get-Date) - $folderName - Formatting Folder" - $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/net6.0/dotnet-format.dll" whitespace -folder $repoPath -v diag --verify-no-changes | Out-String + $output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/net6.0/dotnet-format.dll" whitespace $repoPath --folder -v diag --verify-no-changes | Out-String Write-Output $output.TrimEnd() # Ignore CheckFailedExitCode since we don't expect these repos to be properly formatted. From d63fd4fa9aad93d42aa43849dac8ef303371412f Mon Sep 17 00:00:00 2001 From: Richard Willis Date: Thu, 26 Aug 2021 08:13:56 +0100 Subject: [PATCH 1622/2702] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 688801d8a463..1cc81c733dd4 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Development builds of `dotnet-format` are being hosted on Azure Packages. You ca You can install the latest build of the tool using the following command. ```console -dotnet tool install -g dotnet-format --version 6.0.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json +dotnet tool install -g dotnet-format --version "6.0.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json ``` ### How To Use From f7041f216cf31e77ac0b27634e68f299289c75e8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 26 Aug 2021 12:58:02 +0000 Subject: [PATCH 1623/2702] Update dependencies from https://github.com/dotnet/arcade build 20210825.3 (#1295) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/post-build/sourcelink-validation.ps1 | 8 ++++++-- global.json | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8bfbedd7c477..01790819edb4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 3dd12f0a1d25fa29b84e38b7d2345a693f4ae45e + 809cbb58dea1d1e477ab0e12855d1758d50844a8 diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 3b6fc9533373..e8ab29afeb33 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -107,8 +107,12 @@ $ValidatePackage = { try { $Uri = $Link -as [System.URI] - # Only GitHub links are valid - if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { + if ($Link -match "submodules") { + # Skip submodule links until sourcelink properly handles submodules + $Status = 200 + } + elseif ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { + # Only GitHub links are valid $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode } else { diff --git a/global.json b/global.json index 083b9340d845..6cabb093f204 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21424.3" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21425.3" } } From a3afc066bd9c87e638cb8c2fa65fdc7ab7b2c12a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 26 Aug 2021 12:58:40 +0000 Subject: [PATCH 1624/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210826.1 (#1296) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 01790819edb4..d6b0c08282a1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 8893e64d4a9f4ba78aae83e6c87f302ab14a60e9 + 47f9542af99c0077f1d694152d000510a24fddaa https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 29aa460a99a5..fa7112e4ae44 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21424.5 + 4.0.0-4.21426.1 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From b20b7f955637e387484efb05c5c0c7afbd2c6df4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 27 Aug 2021 12:43:10 +0000 Subject: [PATCH 1625/2702] Update dependencies from https://github.com/dotnet/arcade build 20210826.2 (#1300) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d6b0c08282a1..4d845eb0750f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 809cbb58dea1d1e477ab0e12855d1758d50844a8 + e737b1f920e7e1a37f99dae198bbd957c293b9c8 diff --git a/global.json b/global.json index 6cabb093f204..442b1e5bf382 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21425.3" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21426.2" } } From 68ead90e72e96c4d51a4cd5dafdcf5d8c76271e3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 27 Aug 2021 12:53:50 +0000 Subject: [PATCH 1626/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210826.21 (#1301) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4d845eb0750f..90bd723a746b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 47f9542af99c0077f1d694152d000510a24fddaa + 415aa618828f775eef7fb6b225f767784a050221 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index fa7112e4ae44..153dfcb3633b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21426.1 + 4.0.0-4.21426.21 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 2916c5a2aedc9f097df0b67bb7175b76eaecf93a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 28 Aug 2021 12:38:10 +0000 Subject: [PATCH 1627/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210827.11 (#1304) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 90bd723a746b..0a19df4bd3cc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 415aa618828f775eef7fb6b225f767784a050221 + 7f1cd24517a65bac2e6e921bf89c9b8d4e2696ca https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 153dfcb3633b..0c8080bc67bb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21426.21 + 4.0.0-4.21427.11 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 2bb56d01580262a6172a89de4b1b7572305a411d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 28 Aug 2021 12:42:35 +0000 Subject: [PATCH 1628/2702] Update dependencies from https://github.com/dotnet/arcade build 20210827.6 (#1303) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- eng/common/templates/job/job.yml | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0a19df4bd3cc..62413320ec55 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - e737b1f920e7e1a37f99dae198bbd957c293b9c8 + 474307e526160c813c9fd58060eb8356ccca6099 diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 866967934802..37dceb1bab0a 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -103,7 +103,7 @@ jobs: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - task: MicroBuildSigningPlugin@2 + - task: MicroBuildSigningPlugin@3 displayName: Install MicroBuild plugin inputs: signType: $(_SignType) diff --git a/global.json b/global.json index 442b1e5bf382..a394e13cc285 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21426.2" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21427.6" } } From 5ddfe42a4009cddee9df84c1b6c58cd8fda9608c Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 30 Aug 2021 16:37:34 -0700 Subject: [PATCH 1629/2702] Style subcommand should support diagnostics. --- src/Commands/FormatStyleCommand.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Commands/FormatStyleCommand.cs b/src/Commands/FormatStyleCommand.cs index 30455c5bf1f1..b44398c94153 100644 --- a/src/Commands/FormatStyleCommand.cs +++ b/src/Commands/FormatStyleCommand.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. +using System.Collections.Immutable; using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.Parsing; @@ -17,6 +18,7 @@ internal static Symbol GetCommand() { var command = new Command("style", Resources.Run_code_style_analyzers_and_apply_fixes) { + DiagnosticsOption, SeverityOption, }; command.AddCommonOptions(); @@ -40,6 +42,12 @@ public async Task InvokeAsync(InvocationContext context) formatOptions = formatOptions with { CodeStyleSeverity = GetSeverity(styleSeverity) }; } + if (parseResult.HasOption(DiagnosticsOption) && + parseResult.ValueForOption(DiagnosticsOption) is string[] { Length: > 0 } diagnostics) + { + formatOptions = formatOptions with { Diagnostics = diagnostics.ToImmutableHashSet() }; + } + formatOptions = formatOptions with { FixCategory = FixCategory.CodeStyle }; return await FormatAsync(formatOptions, logger, context.GetCancellationToken()).ConfigureAwait(false); From a978832a087513a438c7536c4e687092d2e9c324 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 30 Aug 2021 16:37:51 -0700 Subject: [PATCH 1630/2702] Update documentation to reflect new command structure. --- docs/3rd-party-analyzers.md | 2 +- docs/README.md | 36 ++++++++++++------------- docs/Supported-.editorconfig-options.md | 8 +++--- docs/integrations.md | 16 +++++------ 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/docs/3rd-party-analyzers.md b/docs/3rd-party-analyzers.md index c8b7b765a2fc..6bd606478a6a 100644 --- a/docs/3rd-party-analyzers.md +++ b/docs/3rd-party-analyzers.md @@ -25,7 +25,7 @@ Add the StyleCop analyzer package to a simple console project file. ## How to configure analyzer severity -The options specified in .editorconfig files are recognized by the pattern `dotnet_diagnostic..severity = `. `` represents the diagnostic ID matched by the compiler, case-insensitively, to be configured. `` must be one of the following: error, warn, info, hidden, suppress. +The options specified in .editorconfig files are recognized by the pattern `dotnet_diagnostic..severity = `. `` represents the diagnostic ID matched by the compiler, case-insensitively, to be configured. `` must be one of the following: error, warn, info, hidden, suppress. Please read the [Code Analysis documentation](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-options#severity-level) for more details. *Example:* diff --git a/docs/README.md b/docs/README.md index bfa6d0d6fe0a..39a298411a5b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -18,35 +18,35 @@ A workspace path is needed when running dotnet-format. By default, the current f Format the code files used in the format solution. ```console -dotnet-format ./format.sln +dotnet format ./format.sln ``` Format the code files used in the dotnet-format project. ```console -dotnet-format ./src/dotnet-format.csproj +dotnet format ./src/dotnet-format.csproj ``` Format the code files from the `./src` folder. ```console -dotnet-format ./src --folder +dotnet format whitespace ./src --folder ``` ### Whitespace formatting Whitespace formatting includes the core .editorconfig settings along with the placement of spaces and newlines. The whitespace formatter is run by default when not running analysis. When only performing whitespace formatting, an implicit restore is not perfomed. When you want to run analysis and fix formatting issues you must specify both. -Whitespace formatting run by default. +Whitespace formatting run by default along with code-style and 3rd party analysis. ```console -dotnet-format ./format.sln +dotnet format ./format.sln ``` -Running the whitespace formatter along with code-style analysis. +Running the whitespace formatter alone. ```console -dotnet-format ./format.sln --fix-whitespace --fix-style +dotnet format whitespace ./format.sln ``` ### Running analysis @@ -55,46 +55,46 @@ dotnet-format ./format.sln --fix-whitespace --fix-style Running codestyle analysis requires the use of a MSBuild solution or project file as the workspace. By default an implicit restore on the solution or project is performed. Enforces the .NET [Language conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019) and [Naming conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2019). -- `--fix-style ` - Runs analysis and attempts to fix issues with severity equal or greater than specified. If severity is not specified then severity defaults to error. +- `dotnet format style --severity ` - Runs analysis and attempts to fix issues with severity equal or greater than specified. If severity is not specified then severity defaults to warning. *Example:* -Run code-style analysis against the format solution and fix errors. +Code-style analysis is run by default along with whitespace formatting and 3rd party analysis. ```console -dotnet-format ./format.sln --fix-style +dotnet format ./format.sln ``` -Run analysis against the dotnet-format project and fix warnings and errors. +Run code-style analysis alone against the dotnet-format project. ```console -dotnet-format ./src/dotnet-format.csproj --fix-style warn +dotnet format style ./src/dotnet-format.csproj --severity error ``` Errors when used with the `--folder` option. Analysis requires a MSBuild solution or project. ```console -dotnet-format ./src --folder --fix-style +dotnet format style ./src --folder ``` #### 3rd party analysis Running 3rd party analysis requires the use of a MSBuild solution or project file as the workspace. By default an implicit restore on the solution or project is performed. 3rd party analyzers are discovered from the `` specified in the workspace project files. -- `--fix-analyzers ` - Runs analysis and attempts to fix issues with severity equal or greater than specified. If no severity is specified then this defaults to error. +- `dotnet format analyzers --severity ` - Runs analysis and attempts to fix issues with severity equal or greater than specified. If no severity is specified then this defaults to warning. #### Filter diagnostics to fix Typically when running codestyle or 3rd party analysis, all diagnostics of sufficient severity are reported and fixed. The `--diagnostics` option allows you to target a particular diagnostic or set of diagnostics of sufficient severity. -- `--diagnostics ` - When used in conjunction with `--fix-style` or `--fix-analyzer`, allows you to apply targeted fixes for particular analyzers. +- `--diagnostics ` - When used in conjunction with `style` or `analyzer` subcommands, allows you to apply targeted fixes for particular analyzers. *Example:* Run code-style analysis and fix unused using directive errors. ```console -dotnet-format ./format.sln --fix-style --diagnostics IDE0005 +dotnet format style ./format.sln --diagnostics IDE0005 ``` ### Filter files to format @@ -111,7 +111,7 @@ Other repos built as part of your project can be included using git submodules. The following command sets the repo folder as the workspace. It then includes the `src` and `tests` folders for formatting. The `submodule-a` folder is excluded from the formatting validation. ```console -dotnet format -f --include ./src/ ./tests/ --exclude ./src/submodule-a/ --check +dotnet format whitespace --folder --include ./src/ ./tests/ --exclude ./src/submodule-a/ --verify-no-changes ``` ### Logging and Reports @@ -122,4 +122,4 @@ dotnet format -f --include ./src/ ./tests/ --exclude ./src/submodule-a/ --check ### Validate formatting -- `--check` - Formats files without saving changes to disk. Terminates with a non-zero exit code (`2`) if any files were formatted. +- `--verify-no-changes` - Formats files without saving changes to disk. Terminates with a non-zero exit code (`2`) if any files were formatted. diff --git a/docs/Supported-.editorconfig-options.md b/docs/Supported-.editorconfig-options.md index 9151fb1a06f5..e4a184e99514 100644 --- a/docs/Supported-.editorconfig-options.md +++ b/docs/Supported-.editorconfig-options.md @@ -1,5 +1,5 @@ # Supported .editorconfig options -The dotnet-format global tool supports the core set of [EditorConfig options](https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties)* as well as the [.NET coding convention settings for EditorConfig](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2019)**. +The dotnet-format global tool supports the core set of [EditorConfig options](https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties)* as well as the [.NET coding convention settings for EditorConfig](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference?view=vs-2019). ## Core options - indent_style @@ -12,10 +12,8 @@ The dotnet-format global tool supports the core set of [EditorConfig options](ht [*] The options `trim_trailing_whitespace` and `max_line_length` are not supported. Currently insignificant whitespace is **always** removed by the formatter. -[**] [Formatting conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-formatting-conventions?view=vs-2019) are enforced by default. Use the `--fix-style` option to enforce [Language conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019) and [Naming conventions](https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-naming-conventions?view=vs-2019). - ## Removing unnecessary imports -In order to remove unnecessary imports the IDE0005 (unnecessary import) diagnostic id must be configured in your .editorconfig. When running dotnet-format pass the `--fix-style` option and specify a severity that includes the configured IDE0005 severity. +In order to remove unnecessary imports the IDE0005 (unnecessary import) diagnostic id must be configured in your .editorconfig. When running dotnet-format specify a severity that includes the configured IDE0005 severity. *Example:* @@ -29,5 +27,5 @@ dotnet_diagnostic.IDE0005.severity = warning command ```console -dotnet-format ./format.sln --fix-style warn +dotnet format ./format.sln --severity warn ``` \ No newline at end of file diff --git a/docs/integrations.md b/docs/integrations.md index 965979588ee2..53e13c1d95bf 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -29,32 +29,32 @@ These instructions originally authored by [randulakoralage82](https://medium.com Add following to your build file: ```yaml -- task: DotNetCoreCLI@2 - displayName: 'Install dotnet tools' +- task: UseDotNet@2 + displayName: 'Use .NET 6 sdk' inputs: - command: 'custom' - custom: 'tool' - arguments: 'restore' + packageType: 'sdk' + version: '6.0.x' + includePreviewVersions: true - task: DotNetCoreCLI@2 displayName: 'dotnet-format' inputs: command: 'custom' custom: 'format' - arguments: '--check' + arguments: '--verify-no-changes' ``` These instructions originally authored by [leotsarev](https://github.com/joinrpg/joinrpg-net/). -## [pre-commit.com](https://pre-commit.com/) hook to reformat +## [pre-commit.com](https://pre-commit.com/) hook to reformat Add the following block to the `repos` section of your `.pre-commit-config.yaml` file: ```yaml - repo: https://github.com/dotnet/format - rev: "" # Specify a tag or sha here, or run "pre-commit autoupdate" + rev: "" # Specify a tag or sha here, or run "pre-commit autoupdate" hooks: - id: dotnet-format ``` From 43fad903d9f962406be926b04f52f83c85f5261f Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 30 Aug 2021 16:53:55 -0700 Subject: [PATCH 1631/2702] Update readme to reflect change in command structure. --- README.md | 110 +++++++++++++++++++++++++++--------------------------- 1 file changed, 54 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 688801d8a463..ec8c4d5b69b6 100644 --- a/README.md +++ b/README.md @@ -45,86 +45,76 @@ - [Log warnings and errors to the standard error stream (982)](https://www.github.com/dotnet/format/pull/982) - [Only report fixable compiler diagnostics. (981)](https://www.github.com/dotnet/format/pull/981) -### .NET Core 2.1 SDK Support +### How To Use -The dotnet-format 5.1.x releases will continue to support users who only have .NET Core 2.1 SDK installed. Releases with bug fixes will continue until it reaches [end of support](https://dotnet.microsoft.com/platform/support/policy/dotnet-core) on August 21, 2021. Version 6.0 will require .NET Core SDK 3.1 or higher. +Dotnet-format is now part of the .NET 6 SDK. Invoking the `dotnet format` command will fix whitespace, code style, and analyzer issues by default. `dotnet format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory, you will need to specify the workspace to format. You can control how verbose the output will be by using the `--verbosity` option. -### How To Install +There are also 3 subcommands to target specific scenarios: +- `dotnet format whitespace`: fixes whitespace +- `dotnet format style`: runs code style analyzers +- `dotnet format analyzers`: runs third party analyzers -The `dotnet-format` nuget package is [published to nuget.org](https://www.nuget.org/packages/dotnet-format/). +#### Common options for all commands +- `--no-restore`: Doesn't execute an implicit restore before formatting. +- `--include-generated`: Format files generated by the SDK +- `--include`: A list of relative file or folder paths to include in formatting. All files are formatted if empty. +- `--exclude`: A list of relative file or folder paths to exclude from formatting. +- `--verbosity`: Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] +- `--report`: Accepts a file path, which if provided, will produce a json report in the given directory. +- `--binarylog`: Log all project or solution load information to a binary log file. +- `--verify-no-changes`: Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have been formatted. -You can install the tool using the following command. +#### Unique options for `dotnet format` + - `--diagnostics`: A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + - `--severity`: The severity of diagnostics to fix. Allowed values are info, warn, and error. -```console -dotnet tool install -g dotnet-format -``` +Note: if the user specifies a severity here it is used for both style and analyzers. -#### Installing Development Builds +#### Unique options for `dotnet format whitespace` + - `--folder`: -Development builds of `dotnet-format` are being hosted on Azure Packages. You can visit the [dotnet-format Azure Packages page](https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&view=versions&package=dotnet-format&protocolType=NuGet). +#### Unique options for `dotnet format style` + - `--diagnostics`: A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + - `--severity`: The severity of diagnostics to fix. Allowed values are info, warn, and error. -You can install the latest build of the tool using the following command. +#### Unique options for `dotnet cleanup analyzers` + - `--diagnostics`: A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. + - `--severity`: The severity of diagnostics to fix. Allowed values are info, warn, and error. -```console -dotnet tool install -g dotnet-format --version 6.0.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json -``` - -### How To Use - -By default `dotnet-format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory, you will need to specify the workspace to format. You can control how verbose the output will be by using the `-v` option. - -```console -Usage: - dotnet-format [options] [] - -Arguments: - A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. - -Options: - --no-restore Doesn't execute an implicit restore before formatting. - --folder, -f Whether to treat the `` argument as a simple folder of files. - --fix-whitespace, -w Run whitespace formatting. Run by default when not applying fixes. - --fix-style, -s Run code style analyzers and apply fixes. - --fix-analyzers, -a Run 3rd party analyzers and apply fixes. - --diagnostics A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party analyzers. - --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. - --exclude A list of relative file or folder paths to exclude from formatting. - --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted. - --report Accepts a file path, which if provided, will produce a json report in the given directory. - --binarylog Log all project or solution load information to a binary log file. - --verbosity, -v Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] - --version Show version information -``` +### Examples Add `format` after `dotnet` and before the command arguments that you want to run: | Examples | Description | | ---------------------------------------------------------------- |--------------------------------------------------------------------------------------------------- | -| `dotnet format` | Formats the project or solution in the current directory. | -| `dotnet format ` | Formats a specific project or solution. | -| `dotnet format -f` | Formats a particular folder and subfolders. | -| `dotnet format --fix-style warn` | Fixes only codestyle analyzer warnings. | -| `dotnet format --fix-style --no-restore` | Fixes only codestyle analyzer errors without performing an implicit restore. | -| `dotnet format --fix-style --diagnostics IDE0005` | Fixes only codestyle analyzer errors for the IDE0005 diagnostic. | -| `dotnet format --fix-whitespace --fix-style` | Formats and fixes codestyle analyzer errors. | -| `dotnet format --fix-analyzers` | Fixes only 3rd party analyzer errors. | -| `dotnet format -wsa` | Formats, fixes codestyle errors, and fixes 3rd party analyzer errors. | -| `dotnet format -v diag` | Formats with very verbose logging. | -| `dotnet format --include Program.cs Utility\Logging.cs` | Formats the files Program.cs and Utility\Logging.cs | -| `dotnet format --check` | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | +| `dotnet format` | Formats and runs analysis for the project or solution in the current directory. | +| `dotnet format -v diag` | Formats and runs analysis with very verbose logging. | +| `dotnet format ` | Formats and runs analysis for a specific project or solution. | +| `dotnet format --severity error` | Formats, fixes codestyle errors, and fixes 3rd party analyzer errors. | +| `dotnet format whitespace --folder` | Formats a particular folder and subfolders. | +| `dotnet format style ` | Fixes only codestyle analyzer warnings. | +| `dotnet format style --serverity error --no-restore` | Fixes only codestyle analyzer errors without performing an implicit restore. | +| `dotnet format style --diagnostics IDE0005` | Fixes only codestyle analyzer warnings for the IDE0005 diagnostic. | +| `dotnet format analyzers --severity error` | Fixes only 3rd party analyzer errors. | +| `dotnet format --include Program.cs Utility\Logging.cs` | Formats the files Program.cs and Utility\Logging.cs | +| `dotnet format --verify-no-changes` | Formats but does not save. Returns a non-zero exit code if any files would have been changed. | | `dotnet format --report ` | Formats and saves a json report file to the given directory. | | `dotnet format --include test/Utilities/*.cs --folder` | Formats the files expanded from native shell globbing (e.g. bash). Space-separated list of files are fed to formatter in this case. Also applies to `--exclude` option. | | `dotnet format --include 'test/Utilities/*.cs' --folder` | With single quotes, formats the files expanded from built-in glob expansion. A single file pattern is fed to formatter, which gets expanded internally. Also applies to `--exclude` option. | | `ls tests/Utilities/*.cs \| dotnet format --include - --folder` | Formats the list of files redirected from pipeline via standard input. Formatter will iterate over `Console.In` to read the list of files. Also applies to `--exclude` option. | -### How To Uninstall +#### How to install Development Builds -You can uninstall the tool using the following command. +Development builds of `dotnet-format` are being hosted on Azure Packages. You can visit the [dotnet-format Azure Packages page](https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&view=versions&package=dotnet-format&protocolType=NuGet). + +You can install the latest build of the tool using the following command. ```console -dotnet tool uninstall -g dotnet-format +dotnet tool install -g dotnet-format --version 6.0.* --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json ``` +Note: After installing .NET 6 Preview 7 SDK or higher you will need to run the dotnet-format global tool by invoking `dotnet-format`. Invoking `dotnet format` will invoke the SDK's copy of dotnet-format. + ### How To Build From Source You can build and package the tool using the following commands. The instructions assume that you are in the root of the repository. @@ -139,3 +129,11 @@ dotnet format ``` > Note: On macOS and Linux, `.\artifacts` will need be switched to `./artifacts` to accommodate for the different slash directions. + +### How To Uninstall + +You can uninstall the tool using the following command. + +```console +dotnet tool uninstall -g dotnet-format +``` \ No newline at end of file From d9f4475ee46ceacaf710018458bf033a786b8af5 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 30 Aug 2021 16:56:49 -0700 Subject: [PATCH 1632/2702] Disable integration test for repos failing to build --- azure-pipelines-integration.yml | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index 3db2b21f2c68..8942c083effe 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -36,18 +36,18 @@ jobs: _targetSolution: "sdk.sln" _branchName: "master" _sha: "1404c8ebdfb5d7590fb7335e5cb5a2267de125c5" - project-system: - _repo: "https://github.com/dotnet/project-system" - _repoName: "dotnet/project-system" - _targetSolution: "ProjectSystem.sln" - _branchName: "main" - _sha: "33c2c7d21f18e06731b59e9b2b5788d535768e59" - msbuild: - _repo: "https://github.com/dotnet/msbuild" - _repoName: "dotnet/msbuild" - _targetSolution: "MSBuild.sln" - _branchName: "main" - _sha: "0be0490bd1261ff4a6ad64267879b36a63a33faf" +# project-system: +# _repo: "https://github.com/dotnet/project-system" +# _repoName: "dotnet/project-system" +# _targetSolution: "ProjectSystem.sln" +# _branchName: "main" +# _sha: "33c2c7d21f18e06731b59e9b2b5788d535768e59" +# msbuild: +# _repo: "https://github.com/dotnet/msbuild" +# _repoName: "dotnet/msbuild" +# _targetSolution: "MSBuild.sln" +# _branchName: "main" +# _sha: "0be0490bd1261ff4a6ad64267879b36a63a33faf" aspnetcore: _repo: "https://github.com/dotnet/aspnetcore" _repoName: "dotnet/aspnetcore" @@ -60,12 +60,12 @@ jobs: _targetSolution: "All.sln" _branchName: "main" _sha: "717ee2c6e6a2bfc40a200e2adb66c6ed4180962b" - ef6: - _repo: "https://github.com/dotnet/ef6" - _repoName: "dotnet/ef6" - _targetSolution: "EntityFramework.sln" - _branchName: "main" - _sha: "df31fde50966a117180459313024d95c0a004162" +# ef6: +# _repo: "https://github.com/dotnet/ef6" +# _repoName: "dotnet/ef6" +# _targetSolution: "EntityFramework.sln" +# _branchName: "main" +# _sha: "df31fde50966a117180459313024d95c0a004162" timeoutInMinutes: 60 steps: - script: eng\integration-test.cmd -repo '$(_repo)' -branchName '$(_branchName)' -sha '$(_sha)' -targetSolution '$(_targetSolution)' -testPath '$(Build.SourcesDirectory)\temp' -stage 'prepare' From 075aeaaaec9b86db91368aa17b9c7634a3fda31b Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 30 Aug 2021 17:03:33 -0700 Subject: [PATCH 1633/2702] Fix readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b7d607e4b563..030de43a8d04 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ### How To Use -Dotnet-format is now part of the .NET 6 SDK. Invoking the `dotnet format` command will fix whitespace, code style, and analyzer issues by default. `dotnet format` will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory, you will need to specify the workspace to format. You can control how verbose the output will be by using the `--verbosity` option. +dotnet-format is now part of the .NET 6 SDK. Invoking the `dotnet format` command will fix whitespace, code style, and analyzer issues by default. dotnet-format will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory, you will need to specify the workspace to format. You can control how verbose the output will be by using the `--verbosity` option. There are also 3 subcommands to target specific scenarios: - `dotnet format whitespace`: fixes whitespace @@ -71,7 +71,7 @@ There are also 3 subcommands to target specific scenarios: Note: if the user specifies a severity here it is used for both style and analyzers. #### Unique options for `dotnet format whitespace` - - `--folder`: + - `--folder`: Whether to treat the workspace argument as a simple folder of files. #### Unique options for `dotnet format style` - `--diagnostics`: A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. From b832d7ab86d8b8fa165185cbf7642608ce47ad3b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 31 Aug 2021 12:43:28 +0000 Subject: [PATCH 1634/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210830.4 (#1309) [main] Update dependencies from dotnet/roslyn --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 62413320ec55..29686efeaea6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 7f1cd24517a65bac2e6e921bf89c9b8d4e2696ca + 4cda89e2dddc3e34ffa211c6c3ffb143e5433f0b https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 0c8080bc67bb..91af995a2923 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21427.11 + 4.0.0-4.21430.4 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 5ce77b92f63de4d852f4400e6a78d4a9340eb131 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 31 Aug 2021 13:03:08 +0000 Subject: [PATCH 1635/2702] Update dependencies from https://github.com/dotnet/arcade build 20210830.1 (#1308) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 29686efeaea6..b7561c42b9ca 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 474307e526160c813c9fd58060eb8356ccca6099 + e0260cb677c04cb0244aad7537c33bec4adce422 diff --git a/global.json b/global.json index a394e13cc285..9a1ea353e713 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21379.2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21427.6" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21430.1" } } From 05c4b4de41f3ada1d776502dce77cb130fc9f7a5 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 31 Aug 2021 10:45:37 -0700 Subject: [PATCH 1636/2702] Set the minimal runtime version to NET 6 --- NuGet.config | 4 +--- src/dotnet-format.csproj | 2 +- tests/dotnet-format.UnitTests.csproj | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/NuGet.config b/NuGet.config index 474990b146a3..337b4889ce63 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,13 +2,11 @@ - - + - diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index 98c3f6f970c6..f554190aaaaa 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -19,7 +19,7 @@ true - 3.1.0-preview3.19553.2 + 6.0.0-preview.2.21154.6 LatestMajor true diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index d2ee6371db3a..7286c6a014a9 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -10,7 +10,7 @@ true - 2.1.0-rc1 + 6.0.0-preview.2.21154.6 LatestMajor From fbecbbbd6a5fb2211c23946376eb9c1e9954b251 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 31 Aug 2021 16:54:45 -0700 Subject: [PATCH 1637/2702] Add back vs-impl nuget feed --- NuGet.config | 1 + 1 file changed, 1 insertion(+) diff --git a/NuGet.config b/NuGet.config index 337b4889ce63..4e1f00c02d56 100644 --- a/NuGet.config +++ b/NuGet.config @@ -7,6 +7,7 @@ + From 8fe79561995d38fe32e051dce3744a052bb65ae3 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 31 Aug 2021 17:10:14 -0700 Subject: [PATCH 1638/2702] Use minimum runtime NET 6 preview 7 --- src/dotnet-format.csproj | 2 +- tests/dotnet-format.UnitTests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index f554190aaaaa..eefd8e290308 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -19,7 +19,7 @@ true - 6.0.0-preview.2.21154.6 + 6.0.0-preview.7.21317.1 LatestMajor true diff --git a/tests/dotnet-format.UnitTests.csproj b/tests/dotnet-format.UnitTests.csproj index 7286c6a014a9..6632d39ff694 100644 --- a/tests/dotnet-format.UnitTests.csproj +++ b/tests/dotnet-format.UnitTests.csproj @@ -10,7 +10,7 @@ true - 6.0.0-preview.2.21154.6 + 6.0.0-preview.7.21317.1 LatestMajor From 45733eba6acaae694ced97c2f7178d4c563dfa24 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 31 Aug 2021 21:21:51 -0700 Subject: [PATCH 1639/2702] Bump version to 7.0 --- README.md | 6 +++--- eng/Versions.props | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 030de43a8d04..df384a4dbeeb 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Development builds of `dotnet-format` are being hosted on Azure Packages. You ca You can install the latest build of the tool using the following command. ```console -dotnet tool install -g dotnet-format --version "6.0.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json +dotnet tool install -g dotnet-format --version "7.0.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json ``` Note: After installing .NET 6 Preview 7 SDK or higher you will need to run the dotnet-format global tool by invoking `dotnet-format`. Invoking `dotnet format` will invoke the SDK's copy of dotnet-format. @@ -122,8 +122,8 @@ You can build and package the tool using the following commands. The instruction ```console build -pack # The final line from the build will read something like -# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.6.0.0-dev.nupkg'. -# Use the value that is in the form `6.0.0-dev` as the version in the next command. +# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.7.0.0-dev.nupkg'. +# Use the value that is in the form `7.0.0-dev` as the version in the next command. dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version dotnet format ``` diff --git a/eng/Versions.props b/eng/Versions.props index 91af995a2923..93d04bd62c93 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,7 +1,7 @@ - 6 + 7 0 From a54898406d3c21722945ed0fcebb1be943b930d6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 1 Sep 2021 04:34:36 +0000 Subject: [PATCH 1640/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210831.20 Microsoft.NETCore.Compilers From Version 4.0.0-4.21430.4 -> To Version 4.0.0-4.21431.20 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b7561c42b9ca..9bae1d270c69 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 4cda89e2dddc3e34ffa211c6c3ffb143e5433f0b + 86952a3a120b6b5be6a44514629040b3ff21b58e https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 91af995a2923..11da827270f8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21430.4 + 4.0.0-4.21431.20 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From e9fcbb9df9c735ea64d5a3befe87a2cd6c253fe2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 1 Sep 2021 04:39:34 +0000 Subject: [PATCH 1641/2702] Update dependencies from https://github.com/dotnet/command-line-api build 20210817.2 System.CommandLine , System.CommandLine.Rendering From Version 2.0.0-beta1.21364.1 -> To Version 2.0.0-beta1.21417.2 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b7561c42b9ca..62c6b3c52b93 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,13 +5,13 @@ https://github.com/dotnet/roslyn 4cda89e2dddc3e34ffa211c6c3ffb143e5433f0b - + https://github.com/dotnet/command-line-api - d6d49b068ffa199ca60a2aa4a2d31e748c4dbe73 + bd9c63c9e74681617fccf2e371cd90f00d01cef7 - + https://github.com/dotnet/command-line-api - d6d49b068ffa199ca60a2aa4a2d31e748c4dbe73 + bd9c63c9e74681617fccf2e371cd90f00d01cef7 diff --git a/eng/Versions.props b/eng/Versions.props index 91af995a2923..a1a2cf9dc196 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,8 +16,8 @@ 4.0.0-4.21430.4 - 2.0.0-beta1.21364.1 - 0.3.0-alpha.21364.1 + 2.0.0-beta1.21417.2 + 0.3.0-alpha.21417.2 - 4.0.0-4.21431.20 + 4.0.0-4.21431.26 2.0.0-beta1.21364.1 0.3.0-alpha.21364.1 From 72904609a54fc3472cc40f4fd46a0cfdad177010 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 2 Sep 2021 12:32:20 +0000 Subject: [PATCH 1643/2702] Update dependencies from https://github.com/dotnet/arcade build 20210901.3 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.21430.1 -> To Version 6.0.0-beta.21451.3 --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 11 +++++++++++ eng/common/tools.sh | 9 +++++++++ global.json | 6 +++--- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 76adaa93e475..05e9905601d4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - e0260cb677c04cb0244aad7537c33bec4adce422 + 923c95ec2e9512285f801c84145a8af3728b1e3b diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 56ee4a577aca..02347914f5db 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -709,6 +709,15 @@ function MSBuild() { Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20' } + if ($ci) { + $env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true' + $env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6 + $env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 + Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true' + Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6' + Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' + } + $toolsetBuildProject = InitializeToolset $basePath = Split-Path -parent $toolsetBuildProject $possiblePaths = @( @@ -717,6 +726,8 @@ function MSBuild() { (Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll')), (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.ArcadeLogging.dll')), (Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.Arcade.Sdk.dll')) + (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.ArcadeLogging.dll')), + (Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.Arcade.Sdk.dll')) ) $selectedPath = $null foreach ($path in $possiblePaths) { diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 41e323104df4..6a4871ef72b7 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -417,6 +417,13 @@ function MSBuild { export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" + + export NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY=true + export NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT=6 + export NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS=1000 + Write-PipelineSetVariable -name "NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY" -value "true" + Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT" -value "6" + Write-PipelineSetVariable -name "NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS" -value "1000" fi local toolset_dir="${_InitializeToolset%/*}" @@ -427,6 +434,8 @@ function MSBuild { possiblePaths+=( "$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" ) possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.ArcadeLogging.dll" ) possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" ) + possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" ) + possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" ) for path in "${possiblePaths[@]}"; do if [[ -f $path ]]; then selectedPath=$path diff --git a/global.json b/global.json index 9a1ea353e713..e8e1b6748c4e 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "tools": { - "dotnet": "6.0.100-rc.1.21379.2" + "dotnet": "6.0.100-rc.1.21430.12" }, "sdk": { - "version": "6.0.100-rc.1.21379.2" + "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21430.1" + "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21451.3" } } From 953481085263fc349f2a6b1dd396a94d9caaf856 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 2 Sep 2021 12:32:28 +0000 Subject: [PATCH 1644/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210902.1 Microsoft.NETCore.Compilers From Version 4.0.0-4.21431.26 -> To Version 4.0.0-5.21452.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 76adaa93e475..a2d8caf12d6a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - a8b10ae673b6c5fc4b72b42e85ad1bf42cd16749 + e67ab95b6cddaf9bb524e8f7a2b72e57ee834a17 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index c2eb05036015..a2b1f91a8820 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21431.26 + 4.0.0-5.21452.1 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 5a979bda72d12317d97559e47a3d61d94d85f74e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 3 Sep 2021 12:32:40 +0000 Subject: [PATCH 1645/2702] Update dependencies from https://github.com/dotnet/arcade build 20210902.4 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.21430.1 -> To Version 7.0.0-beta.21452.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 05e9905601d4..d08521f2a604 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 923c95ec2e9512285f801c84145a8af3728b1e3b + 00949c51badfda4edd51d217a82ba607db7c4576 diff --git a/global.json b/global.json index e8e1b6748c4e..b9fdf23557d8 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21451.3" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21452.4" } } From e075cd3e58f3a5ea3ed6c2d35d606e5a059455f4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 3 Sep 2021 12:40:22 +0000 Subject: [PATCH 1646/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210902.29 Microsoft.NETCore.Compilers From Version 4.0.0-4.21431.26 -> To Version 4.0.0-5.21452.29 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a2d8caf12d6a..4258ecc582c8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - e67ab95b6cddaf9bb524e8f7a2b72e57ee834a17 + 878e4639bbe5b591f74368e9acf77920b84e9caf https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index a2b1f91a8820..5db9e17da580 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21452.1 + 4.0.0-5.21452.29 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 1b5a60292428398d6d21899ab9b4a51222e11a12 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 3 Sep 2021 13:19:36 -0700 Subject: [PATCH 1647/2702] Update NuGet version to fix tests --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 06f1a9f5efa6..439a3a7a441c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ 16.5.0 5.0.0-preview.7.20364.11 - 6.0.0-preview.3.179 + 6.0.0-preview.4.221 From 65680070f85b5e4a8df2aab2d5b1fbbdb1b0d085 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 3 Sep 2021 13:23:20 -0700 Subject: [PATCH 1648/2702] Remove unused packages --- Directory.Packages.props | 10 ++-------- src/dotnet-format.csproj | 7 ------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 439a3a7a441c..57c27350ad7d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,8 +2,8 @@ - 16.5.0 - 5.0.0-preview.7.20364.11 + 16.11.0 + 5.0.0 6.0.0-preview.4.221 @@ -37,11 +37,5 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-format.csproj b/src/dotnet-format.csproj index ac256b1aa494..dbc94b86858e 100644 --- a/src/dotnet-format.csproj +++ b/src/dotnet-format.csproj @@ -36,8 +36,6 @@ - - @@ -56,11 +54,6 @@ - - - - - From 5e4d27d699e7438ccd73963d6e02a0971f61d19f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 4 Sep 2021 12:27:46 +0000 Subject: [PATCH 1649/2702] Update dependencies from https://github.com/dotnet/arcade build 20210903.2 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.21430.1 -> To Version 7.0.0-beta.21453.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d08521f2a604..7a66e264c2ae 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 00949c51badfda4edd51d217a82ba607db7c4576 + 0ec8dbacaefa7ccdb4bc96e120e07dc60c6eda98 diff --git a/global.json b/global.json index b9fdf23557d8..bd50bd0bf22f 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21452.4" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21453.2" } } From ad54337c2f4c7eb00b0aed5a6f2550cc4cb354f3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 4 Sep 2021 12:28:12 +0000 Subject: [PATCH 1650/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210903.15 Microsoft.NETCore.Compilers From Version 4.0.0-5.21452.29 -> To Version 4.0.0-5.21453.15 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4258ecc582c8..1e1e621174dc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 878e4639bbe5b591f74368e9acf77920b84e9caf + 2bbf85baa30a90f9d491699734e814050356da32 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 5db9e17da580..b52123b325da 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21452.29 + 4.0.0-5.21453.15 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From cea42bf2c7a042795d257c93f5302c9ec6370169 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 7 Sep 2021 12:32:38 +0000 Subject: [PATCH 1651/2702] Update dependencies from https://github.com/dotnet/arcade build 20210906.1 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.21430.1 -> To Version 7.0.0-beta.21456.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7a66e264c2ae..de8b307195e8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 0ec8dbacaefa7ccdb4bc96e120e07dc60c6eda98 + 7309c692126e24bc10702f39fe45b2a295b224d2 diff --git a/global.json b/global.json index bd50bd0bf22f..baf6f50c73f9 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21453.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21456.1" } } From cde5299410ec3cbf11474dcb8bd477ae148921e8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 8 Sep 2021 12:36:08 +0000 Subject: [PATCH 1652/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210907.19 Microsoft.NETCore.Compilers From Version 4.0.0-5.21452.29 -> To Version 4.0.0-5.21457.19 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1e1e621174dc..e7b37722ba93 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 2bbf85baa30a90f9d491699734e814050356da32 + dae39045cd460ba44053ff2af2217da126c25dbf https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index b52123b325da..90a6aa851a1b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21453.15 + 4.0.0-5.21457.19 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 782aa3075c7ed0d4bd9c9457b24cd39862615b78 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 9 Sep 2021 12:35:19 +0000 Subject: [PATCH 1653/2702] Update dependencies from https://github.com/dotnet/arcade build 20210907.3 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.21430.1 -> To Version 7.0.0-beta.21457.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index de8b307195e8..d6c896fd56b7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 7309c692126e24bc10702f39fe45b2a295b224d2 + 1e11251dfea77c00eea2228660c1afa011347d17 diff --git a/global.json b/global.json index baf6f50c73f9..e52d779cca70 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21456.1" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21457.3" } } From 1ebcae002fee9fecaca0df139e1191aa1ca90fb0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 9 Sep 2021 12:35:47 +0000 Subject: [PATCH 1654/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210908.2 Microsoft.NETCore.Compilers From Version 4.0.0-5.21452.29 -> To Version 4.0.0-4.21458.2 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e7b37722ba93..a0f70bdeda51 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - dae39045cd460ba44053ff2af2217da126c25dbf + 2bfff7b9348e779628a06b86af04b5239d3a926d https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 90a6aa851a1b..ee0bb2922fc6 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21457.19 + 4.0.0-4.21458.2 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 6ed411204855a80a5c3c499b4abd8ef1d0b31523 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 10 Sep 2021 12:34:08 +0000 Subject: [PATCH 1655/2702] Update dependencies from https://github.com/dotnet/arcade build 20210909.5 Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.21430.1 -> To Version 7.0.0-beta.21459.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d6c896fd56b7..08b88548a37f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 1e11251dfea77c00eea2228660c1afa011347d17 + fa4a48044d33222537e6dbd000f8a2adaa7a15c7 diff --git a/global.json b/global.json index e52d779cca70..61da7015a0aa 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21457.3" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21459.5" } } From d1f9c3fb5442c8793177bd98a2f6e629bfd8b084 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 14 Sep 2021 12:37:34 +0000 Subject: [PATCH 1656/2702] Update dependencies from https://github.com/dotnet/arcade build 20210913.4 Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.21459.5 -> To Version 7.0.0-beta.21463.4 --- eng/Version.Details.xml | 4 +- eng/common/cross/build-rootfs.sh | 40 ++------ eng/common/cross/toolchain.cmake | 9 +- ...nd-native-compiler.sh => init-compiler.sh} | 98 ++++++++++--------- global.json | 2 +- 5 files changed, 69 insertions(+), 84 deletions(-) rename eng/common/native/{find-native-compiler.sh => init-compiler.sh} (52%) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cc3805b3984f..fc5d9b8d66b4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - fa4a48044d33222537e6dbd000f8a2adaa7a15c7 + 4b7c80f398fd3dcea03fdc4e454789b61181d300 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 5c05b39f1019..6fa2c8aa5511 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -6,7 +6,7 @@ usage() { echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [--skipunmount] --rootfsdir ]" echo "BuildArch can be: arm(default), armel, arm64, x86" - echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine, alpine3.9 or alpine3.13. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." + echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine, alpine3.13 or alpine3.14. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen." echo " for FreeBSD can be: freebsd11, freebsd12, freebsd13" echo " for illumos can be: illumos." echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FreeBSD" @@ -32,9 +32,9 @@ __UbuntuPackages="build-essential" __AlpinePackages="alpine-base" __AlpinePackages+=" build-base" __AlpinePackages+=" linux-headers" -__AlpinePackagesEdgeCommunity=" lldb-dev" -__AlpinePackagesEdgeMain+=" python3" -__AlpinePackagesEdgeMain+=" libedit" +__AlpinePackages+=" lldb-dev" +__AlpinePackages+=" python3" +__AlpinePackages+=" libedit" # symlinks fixer __UbuntuPackages+=" symlinks" @@ -185,23 +185,17 @@ while :; do __UbuntuRepo= __Tizen=tizen ;; - alpine|alpine3.9) + alpine|alpine3.13) __CodeName=alpine __UbuntuRepo= - __AlpineVersion=3.9 - __AlpinePackagesEdgeMain+=" llvm11-libs" - __AlpinePackagesEdgeMain+=" clang-libs" + __AlpineVersion=3.13 + __AlpinePackages+=" llvm10-libs" ;; - alpine3.13) + alpine3.14) __CodeName=alpine __UbuntuRepo= - __AlpineVersion=3.13 - # Alpine 3.13 has all the packages we need in the 3.13 repository - __AlpinePackages+=$__AlpinePackagesEdgeCommunity - __AlpinePackagesEdgeCommunity= - __AlpinePackages+=$__AlpinePackagesEdgeMain - __AlpinePackagesEdgeMain= - __AlpinePackages+=" llvm10-libs" + __AlpineVersion=3.14 + __AlpinePackages+=" llvm11-libs" ;; freebsd11) __FreeBSDBase="11.3-RELEASE" @@ -279,20 +273,6 @@ if [[ "$__CodeName" == "alpine" ]]; then -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ add $__AlpinePackages - if [[ -n "$__AlpinePackagesEdgeMain" ]]; then - $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/main \ - -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ - add $__AlpinePackagesEdgeMain - fi - - if [[ -n "$__AlpinePackagesEdgeCommunity" ]]; then - $__ApkToolsDir/apk-tools-$__ApkToolsVersion/apk \ - -X http://dl-cdn.alpinelinux.org/alpine/edge/community \ - -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ - add $__AlpinePackagesEdgeCommunity - fi - rm -r $__ApkToolsDir elif [[ "$__CodeName" == "freebsd" ]]; then mkdir -p $__RootfsDir/usr/local/etc diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index fc11001aa76c..6501c3a955f7 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -44,7 +44,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86") set(TOOLCHAIN "i686-linux-gnu") elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") set(CMAKE_SYSTEM_PROCESSOR "x86_64") - set(triple "x86_64-unknown-freebsd11") + set(triple "x86_64-unknown-freebsd12") elseif (ILLUMOS) set(CMAKE_SYSTEM_PROCESSOR "x86_64") set(TOOLCHAIN "x86_64-illumos") @@ -91,6 +91,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") set(CMAKE_CXX_COMPILER_TARGET ${triple}) set(CMAKE_ASM_COMPILER_TARGET ${triple}) set(CMAKE_SYSROOT "${CROSS_ROOTFS}") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=lld") elseif(ILLUMOS) set(CMAKE_SYSROOT "${CROSS_ROOTFS}") @@ -138,8 +141,8 @@ function(add_toolchain_linker_flag Flag) if (NOT Config STREQUAL "") set(CONFIG_SUFFIX "_${Config}") endif() - set("CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE) - set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE) + set("CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_EXE_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE) + set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}_INIT} ${Flag}" PARENT_SCOPE) endfunction() if(CMAKE_SYSTEM_NAME STREQUAL "Linux") diff --git a/eng/common/native/find-native-compiler.sh b/eng/common/native/init-compiler.sh similarity index 52% rename from eng/common/native/find-native-compiler.sh rename to eng/common/native/init-compiler.sh index aed19d07d506..1daadf32a524 100644 --- a/eng/common/native/find-native-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -1,39 +1,32 @@ #!/usr/bin/env bash # -# This file locates the native compiler with the given name and version and sets the environment variables to locate it. +# This file detects the C/C++ compiler and exports it to the CC/CXX environment variables # -source="${BASH_SOURCE[0]}" - -# resolve $SOURCE until the file is no longer a symlink -while [[ -h $source ]]; do - scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - source="$(readlink "$source")" - - # if $source was a relative symlink, we need to resolve it relative to the path where the - # symlink file was located - [[ $source != /* ]] && source="$scriptroot/$source" -done -scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" - -if [ $# -lt 0 ] -then +if [[ "$#" -lt 2 ]]; then echo "Usage..." - echo "find-native-compiler.sh " + echo "init-compiler.sh " + echo "Specify the target architecture." echo "Specify the name of compiler (clang or gcc)." echo "Specify the major version of compiler." echo "Specify the minor version of compiler." exit 1 fi -. $scriptroot/../pipeline-logging-functions.sh +. "$( cd -P "$( dirname "$0" )" && pwd )"/../pipeline-logging-functions.sh -compiler="$1" +build_arch="$1" +compiler="$2" cxxCompiler="$compiler++" -majorVersion="$2" -minorVersion="$3" +majorVersion="$3" +minorVersion="$4" -if [ "$compiler" = "gcc" ]; then cxxCompiler="g++"; fi +# clear the existing CC and CXX from environment +CC= +CXX= +LDFLAGS= + +if [[ "$compiler" == "gcc" ]]; then cxxCompiler="g++"; fi check_version_exists() { desired_version=-1 @@ -50,38 +43,38 @@ check_version_exists() { echo "$desired_version" } -if [ -z "$CLR_CC" ]; then +if [[ -z "$CLR_CC" ]]; then # Set default versions - if [ -z "$majorVersion" ]; then + if [[ -z "$majorVersion" ]]; then # note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero. - if [ "$compiler" = "clang" ]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) - elif [ "$compiler" = "gcc" ]; then versions=( 9 8 7 6 5 4.9 ); fi + if [[ "$compiler" == "clang" ]]; then versions=( 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 ) + elif [[ "$compiler" == "gcc" ]]; then versions=( 11 10 9 8 7 6 5 4.9 ); fi for version in "${versions[@]}"; do parts=(${version//./ }) desired_version="$(check_version_exists "${parts[0]}" "${parts[1]}")" - if [ "$desired_version" != "-1" ]; then majorVersion="${parts[0]}"; break; fi + if [[ "$desired_version" != "-1" ]]; then majorVersion="${parts[0]}"; break; fi done - if [ -z "$majorVersion" ]; then + if [[ -z "$majorVersion" ]]; then if command -v "$compiler" > /dev/null; then - if [ "$(uname)" != "Darwin" ]; then + if [[ "$(uname)" != "Darwin" ]]; then Write-PipelineTelemetryError -category "Build" -type "warning" "Specific version of $compiler not found, falling back to use the one in PATH." fi - export CC="$(command -v "$compiler")" - export CXX="$(command -v "$cxxCompiler")" + CC="$(command -v "$compiler")" + CXX="$(command -v "$cxxCompiler")" else Write-PipelineTelemetryError -category "Build" "No usable version of $compiler found." exit 1 fi else - if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then - if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then + if [[ "$compiler" == "clang" && "$majorVersion" -lt 5 ]]; then + if [[ "$build_arch" == "arm" || "$build_arch" == "armel" ]]; then if command -v "$compiler" > /dev/null; then Write-PipelineTelemetryError -category "Build" -type "warning" "Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH." - export CC="$(command -v "$compiler")" - export CXX="$(command -v "$cxxCompiler")" + CC="$(command -v "$compiler")" + CXX="$(command -v "$cxxCompiler")" else Write-PipelineTelemetryError -category "Build" "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH." exit 1 @@ -91,31 +84,40 @@ if [ -z "$CLR_CC" ]; then fi else desired_version="$(check_version_exists "$majorVersion" "$minorVersion")" - if [ "$desired_version" = "-1" ]; then + if [[ "$desired_version" == "-1" ]]; then Write-PipelineTelemetryError -category "Build" "Could not find specific version of $compiler: $majorVersion $minorVersion." exit 1 fi fi - if [ -z "$CC" ]; then - export CC="$(command -v "$compiler$desired_version")" - export CXX="$(command -v "$cxxCompiler$desired_version")" - if [ -z "$CXX" ]; then export CXX="$(command -v "$cxxCompiler")"; fi + if [[ -z "$CC" ]]; then + CC="$(command -v "$compiler$desired_version")" + CXX="$(command -v "$cxxCompiler$desired_version")" + if [[ -z "$CXX" ]]; then CXX="$(command -v "$cxxCompiler")"; fi fi else - if [ ! -f "$CLR_CC" ]; then + if [[ ! -f "$CLR_CC" ]]; then Write-PipelineTelemetryError -category "Build" "CLR_CC is set but path '$CLR_CC' does not exist" exit 1 fi - export CC="$CLR_CC" - export CXX="$CLR_CXX" + CC="$CLR_CC" + CXX="$CLR_CXX" fi -if [ -z "$CC" ]; then - Write-PipelineTelemetryError -category "Build" "Unable to find $compiler." +if [[ -z "$CC" ]]; then + Write-PipelineTelemetryError -category "Build" "Unable to find $compiler." exit 1 fi -export CCC_CC="$CC" -export CCC_CXX="$CXX" -export SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")" +if [[ "$compiler" == "clang" ]]; then + if command -v "lld$desired_version" > /dev/null; then + # Only lld version >= 9 can be considered stable + if [[ "$majorVersion" -ge 9 ]]; then + LDFLAGS="-fuse-ld=lld" + fi + fi +fi + +SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")" + +export CC CXX LDFLAGS SCAN_BUILD_COMMAND diff --git a/global.json b/global.json index 61da7015a0aa..c7dbdf0e51ab 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21459.5" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21463.4" } } From ec794df7626dac3e7a865d09a43e5ab86fdaffc9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 15 Sep 2021 12:30:43 +0000 Subject: [PATCH 1657/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210914.17 Microsoft.NETCore.Compilers From Version 4.0.0-4.21458.2 -> To Version 4.0.0-4.21464.17 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fc5d9b8d66b4..ee565415ccaa 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 2bfff7b9348e779628a06b86af04b5239d3a926d + c3add9eb2d93b6bebfb8981ed7a9d8d7bbb773bc https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index ee0bb2922fc6..b2246b07cb0a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21458.2 + 4.0.0-4.21464.17 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 3a2dcebd9b578df5b97df8c33e21f56623240f1b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 16 Sep 2021 12:26:58 +0000 Subject: [PATCH 1658/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210916.1 Microsoft.NETCore.Compilers From Version 4.0.0-4.21464.17 -> To Version 4.0.0-5.21466.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ee565415ccaa..2432c67b4f38 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c3add9eb2d93b6bebfb8981ed7a9d8d7bbb773bc + 912ac0cc52a1f8c89aba0a68332ffa0e78cfbe75 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index b2246b07cb0a..d1f316e0dc6c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-4.21464.17 + 4.0.0-5.21466.1 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 7cc2c2ad8d2c866916454f6e2c78eb78baace863 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 17 Sep 2021 12:36:57 +0000 Subject: [PATCH 1659/2702] Update dependencies from https://github.com/dotnet/arcade build 20210916.4 Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.21463.4 -> To Version 7.0.0-beta.21466.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2432c67b4f38..84847d4f44fe 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 4b7c80f398fd3dcea03fdc4e454789b61181d300 + 734d875ba2abfb5c8f5f52368e7d4711ee366e31 diff --git a/global.json b/global.json index c7dbdf0e51ab..81f19669f75a 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21463.4" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21466.4" } } From e9bd4af82096032ef75aef908f05b2523a76b181 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 17 Sep 2021 12:37:19 +0000 Subject: [PATCH 1660/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210916.6 Microsoft.NETCore.Compilers From Version 4.0.0-5.21466.1 -> To Version 4.0.0-5.21466.6 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2432c67b4f38..768af3e2b2a3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 912ac0cc52a1f8c89aba0a68332ffa0e78cfbe75 + 2e350201a39c4576bc122e3ff5b61ebc90030da2 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index d1f316e0dc6c..75daa85b9db3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21466.1 + 4.0.0-5.21466.6 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 05b1d152d9bc4117b4f8bf8c6cad7ac324066beb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 18 Sep 2021 12:25:37 +0000 Subject: [PATCH 1661/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210917.16 Microsoft.NETCore.Compilers From Version 4.0.0-5.21466.1 -> To Version 4.0.0-5.21467.16 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 768af3e2b2a3..3c756804fb7b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 2e350201a39c4576bc122e3ff5b61ebc90030da2 + 37957501728e65d2da3e61b620a585c8f2bbb862 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 75daa85b9db3..6c660137f0ae 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21466.6 + 4.0.0-5.21467.16 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 86c667f37f1f78246d4a44d6141dd1f20e74d7ce Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 19 Sep 2021 12:24:40 +0000 Subject: [PATCH 1662/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210918.3 Microsoft.NETCore.Compilers From Version 4.0.0-5.21466.1 -> To Version 4.0.0-5.21468.3 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3c756804fb7b..88453815ae90 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 37957501728e65d2da3e61b620a585c8f2bbb862 + 0fcee59313255295b69bad4469d86b07e2a11724 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 6c660137f0ae..5efbf1585b26 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21467.16 + 4.0.0-5.21468.3 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From ba46d0bbb801a7de6ef8c34b41a051699605beac Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 20 Sep 2021 12:32:22 +0000 Subject: [PATCH 1663/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210919.2 Microsoft.NETCore.Compilers From Version 4.0.0-5.21466.1 -> To Version 4.0.0-5.21469.2 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 88453815ae90..296a122e1c4b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 0fcee59313255295b69bad4469d86b07e2a11724 + c1d8c6f043bc80425c6828455eb57f8a404759c6 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 5efbf1585b26..7af0071342da 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21468.3 + 4.0.0-5.21469.2 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From ef38785f22cdecc1d6ba3f427695797031e36ce0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 21 Sep 2021 12:35:34 +0000 Subject: [PATCH 1664/2702] Update dependencies from https://github.com/dotnet/arcade build 20210920.4 Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.21463.4 -> To Version 7.0.0-beta.21470.4 --- eng/Version.Details.xml | 4 ++-- eng/common/tools.ps1 | 26 ++++++++++++++++++-------- global.json | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 84847d4f44fe..4dffc22b82b9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 734d875ba2abfb5c8f5f52368e7d4711ee366e31 + f959b455e6feceeaee50f95e07dac7b8e470bc2e diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 02347914f5db..44484289943e 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -709,14 +709,7 @@ function MSBuild() { Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20' } - if ($ci) { - $env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true' - $env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6 - $env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 - Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true' - Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6' - Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' - } + Enable-Nuget-EnhancedRetry $toolsetBuildProject = InitializeToolset $basePath = Split-Path -parent $toolsetBuildProject @@ -764,6 +757,8 @@ function MSBuild-Core() { } } + Enable-Nuget-EnhancedRetry + $buildTool = InitializeBuildTool $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" @@ -904,3 +899,18 @@ function Try-LogClientIpAddress() Write-Host "Unable to get this machine's effective IP address for logging: $_" } } + +# +# If $ci flag is set, turn on (and log that we did) special environment variables for improved Nuget client retry logic. +# +function Enable-Nuget-EnhancedRetry() { + if ($ci) { + Write-Host "Setting NUGET enhanced retry environment variables" + $env:NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY = 'true' + $env:NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT = 6 + $env:NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 + Write-PipelineSetVariable -Name 'NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY' -Value 'true' + Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_MAX_NETWORK_TRY_COUNT' -Value '6' + Write-PipelineSetVariable -Name 'NUGET_EXPERIMENTAL_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' + } +} diff --git a/global.json b/global.json index 81f19669f75a..71222e7bde63 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21466.4" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21470.4" } } From d1a1ab58b15f6b0f47ba7b47d63ace5ba4a2ae83 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 21 Sep 2021 12:35:58 +0000 Subject: [PATCH 1665/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210921.1 Microsoft.NETCore.Compilers From Version 4.0.0-5.21466.1 -> To Version 4.0.0-5.21471.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 296a122e1c4b..28ff17ff6230 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c1d8c6f043bc80425c6828455eb57f8a404759c6 + c5b7c5c4a1c339db642aa55ce7244700740363bc https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 7af0071342da..94ba1dffadd5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21469.2 + 4.0.0-5.21471.1 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 1090ebce062a6316d814dbb7df746473aa2c1b58 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 22 Sep 2021 12:34:41 +0000 Subject: [PATCH 1666/2702] Update dependencies from https://github.com/dotnet/arcade build 20210921.3 Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.21463.4 -> To Version 7.0.0-beta.21471.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4dffc22b82b9..19ef70c1ba54 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - f959b455e6feceeaee50f95e07dac7b8e470bc2e + 42b72b125d07dbc8fb3145fc10a8f332961bc0ba diff --git a/global.json b/global.json index 71222e7bde63..51b6846305db 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21470.4" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21471.3" } } From 954049dadcc14ca755716a7410e536a1cc00432c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 22 Sep 2021 12:35:06 +0000 Subject: [PATCH 1667/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210921.19 Microsoft.NETCore.Compilers From Version 4.0.0-5.21466.1 -> To Version 4.0.0-5.21471.19 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 28ff17ff6230..25cebbf0e374 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - c5b7c5c4a1c339db642aa55ce7244700740363bc + 2cb3d482e3c09760d1b204c597be93f49dba3349 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 94ba1dffadd5..2bb8ba231e85 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21471.1 + 4.0.0-5.21471.19 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 75ba0bae24d8f3ba0e09db2df27c2de234c95088 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 23 Sep 2021 12:35:35 +0000 Subject: [PATCH 1668/2702] Update dependencies from https://github.com/dotnet/arcade build 20210922.4 Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.21471.3 -> To Version 7.0.0-beta.21472.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 05fa0db2a0cf..27ac44530555 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 42b72b125d07dbc8fb3145fc10a8f332961bc0ba + 8b2142306838fb8e155e12c1d8a9f59c9c4cd73f diff --git a/global.json b/global.json index 51b6846305db..13ab7048f059 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21471.3" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21472.4" } } From b4d3f8804112662b917fbf657ce2a79d10bc15c2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 23 Sep 2021 12:35:57 +0000 Subject: [PATCH 1669/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210922.17 Microsoft.NETCore.Compilers From Version 4.0.0-5.21471.19 -> To Version 4.0.0-5.21472.17 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 05fa0db2a0cf..5c9ddea6c98a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 2cb3d482e3c09760d1b204c597be93f49dba3349 + 2dfaf7afbccd94a7618d3e43a32788d5d88dbf40 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 2bb8ba231e85..0fb1534cb70e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21471.19 + 4.0.0-5.21472.17 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 6b40e475b85749187f2f67bac456cce25efb5a31 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 24 Sep 2021 12:30:41 +0000 Subject: [PATCH 1670/2702] Update dependencies from https://github.com/dotnet/arcade build 20210923.1 Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.21472.4 -> To Version 7.0.0-beta.21473.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 01031d0ca2d6..13e1397abe26 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 8b2142306838fb8e155e12c1d8a9f59c9c4cd73f + c7546c02b92d9d5cbad2345e15a5962253bf6560 diff --git a/global.json b/global.json index 13ab7048f059..65bbe19d94c8 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21472.4" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21473.1" } } From c88a45afe25aa82758afa841ac634709c3467c66 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 24 Sep 2021 12:31:01 +0000 Subject: [PATCH 1671/2702] Update dependencies from https://github.com/dotnet/command-line-api build 20210923.1 System.CommandLine , System.CommandLine.Rendering From Version 2.0.0-beta1.21417.2 -> To Version 2.0.0-beta1.21473.1 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 01031d0ca2d6..5f698aa9612d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,13 +5,13 @@ https://github.com/dotnet/roslyn 2dfaf7afbccd94a7618d3e43a32788d5d88dbf40 - + https://github.com/dotnet/command-line-api - bd9c63c9e74681617fccf2e371cd90f00d01cef7 + 82273cb56c83b589e8e5b63da0ac9745ffc6e105 - + https://github.com/dotnet/command-line-api - bd9c63c9e74681617fccf2e371cd90f00d01cef7 + 82273cb56c83b589e8e5b63da0ac9745ffc6e105 diff --git a/eng/Versions.props b/eng/Versions.props index 0fb1534cb70e..bdc3c0b6b9b7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -16,8 +16,8 @@ 4.0.0-5.21472.17 - 2.0.0-beta1.21417.2 - 0.3.0-alpha.21417.2 + 2.0.0-beta1.21473.1 + 0.3.0-alpha.21473.1 - 4.0.0-5.21472.17 + 4.0.0-5.21474.1 2.0.0-beta1.21417.2 0.3.0-alpha.21417.2 From 0ea359728df490545e81c93dd3fcf9df55e7a9cd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 25 Sep 2021 12:29:59 +0000 Subject: [PATCH 1673/2702] Update dependencies from https://github.com/dotnet/arcade build 20210924.2 Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.21473.1 -> To Version 7.0.0-beta.21474.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8fdec79726ff..0341951ed43a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - c7546c02b92d9d5cbad2345e15a5962253bf6560 + 3ea0d860c6973f2cbadc9e895c7ec2cbdaec4ad5 diff --git a/global.json b/global.json index 65bbe19d94c8..660a72251e47 100644 --- a/global.json +++ b/global.json @@ -6,6 +6,6 @@ "version": "6.0.100-rc.1.21430.12" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21473.1" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21474.2" } } From 09709fc0f9a3c129dfd8f14619782a63431d4457 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 25 Sep 2021 12:30:20 +0000 Subject: [PATCH 1674/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210925.2 Microsoft.NETCore.Compilers From Version 4.0.0-5.21474.1 -> To Version 4.0.0-5.21475.2 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8fdec79726ff..61d69bee296c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - d4f02467038be6633e30802fe006e3df70aa4033 + ad21f2e96cfac5bca12a7bdc7d977b236e96cfa0 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index fb8ce1c1d561..5dc251ec780b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21474.1 + 4.0.0-5.21475.2 2.0.0-beta1.21473.1 0.3.0-alpha.21473.1 From 81ef48baadc9c31784e37ed619cb7b23041b5a38 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 26 Sep 2021 12:17:55 +0000 Subject: [PATCH 1675/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210925.4 Microsoft.NETCore.Compilers From Version 4.0.0-5.21474.1 -> To Version 4.0.0-5.21475.4 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 61d69bee296c..72d4aa523d88 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - ad21f2e96cfac5bca12a7bdc7d977b236e96cfa0 + 2bc98dbe0ce1d5e29d0a9949f408d9338a1ae149 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 5dc251ec780b..49306d106353 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21475.2 + 4.0.0-5.21475.4 2.0.0-beta1.21473.1 0.3.0-alpha.21473.1 From 90fa2e434d37489b42034e3b490af71dd17d41df Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 27 Sep 2021 12:17:36 +0000 Subject: [PATCH 1676/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210926.2 Microsoft.NETCore.Compilers From Version 4.0.0-5.21474.1 -> To Version 4.0.0-5.21476.2 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 72d4aa523d88..208a0cd494bc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 2bc98dbe0ce1d5e29d0a9949f408d9338a1ae149 + 171c2f20ea4d586cf4f101f30ee41f625e01455e https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 49306d106353..637cbcefb7dd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21475.4 + 4.0.0-5.21476.2 2.0.0-beta1.21473.1 0.3.0-alpha.21473.1 From 2d9ee97f1e9723c7b2227d808fd6f367d34f4c51 Mon Sep 17 00:00:00 2001 From: Leonid Tsarev Date: Tue, 28 Sep 2021 09:04:23 +0300 Subject: [PATCH 1677/2702] Add instructions how to use pre-commit in "local" mode --- docs/integrations.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/integrations.md b/docs/integrations.md index 53e13c1d95bf..5bf76924e9a0 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -58,6 +58,17 @@ Add the following block to the `repos` section of your `.pre-commit-config.yaml` hooks: - id: dotnet-format ``` -Note that this will install dotnet format to an isolated environment, using the system installation of the dotnet CLI. See the [pre-commit.com documentation](https://pre-commit.com/#dotnet) for more details. +Note that this will compile and install dotnet format to an isolated environment, using the system installation of the dotnet CLI. See the [pre-commit.com documentation](https://pre-commit.com/#dotnet) for more details. The problem is that dotnet format is using *preview* SDK (even for 5.x versions), and you have to install preview SDK on your machine for compiling it. Another option is to use local feature of pre-commit, as follows: -These instructions originally authored by [rkm](https://github.com/rkm) +```yaml +- repo: local + hooks: + #Use dotnet format already installed on your machine + - id: dotnet-format + name: dotnet-format + language: system + entry: dotnet format --include + types_or: ["c#", "vb"] +``` + +These instructions originally authored by [rkm](https://github.com/rkm) & [leotsarev](https://github.com/joinrpg/joinrpg-net/). From 99e10dfc732c6048a1aef461ae5fef31ca51b0ea Mon Sep 17 00:00:00 2001 From: Leonid Tsarev Date: Tue, 28 Sep 2021 09:50:44 +0300 Subject: [PATCH 1678/2702] Add instruction how to reformat on save in Rider --- docs/integrations.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/integrations.md b/docs/integrations.md index 53e13c1d95bf..0e03c00ebce9 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -61,3 +61,20 @@ Add the following block to the `repos` section of your `.pre-commit-config.yaml` Note that this will install dotnet format to an isolated environment, using the system installation of the dotnet CLI. See the [pre-commit.com documentation](https://pre-commit.com/#dotnet) for more details. These instructions originally authored by [rkm](https://github.com/rkm) + +## Rider reformat on save + + +1. Open Settings -> Tools -> File Watchers +1. Press The “Plus Sign” to Add a Custom watcher +1. Set the name to i.e. “dotnet format on save” +1. FileType: C# +1. Scope: Open Files +1. Program: Write dotnet-format +1. Arguments: $SolutionPath$ -verbosity diagnostic --include $FileRelativePath$ +1. (Optionally) Append --fix-style warning to fix any style issues automatically on save. +1. (Optionally) Append --fix-analyzers warning to fix any analyzer warnings on save. +1. Disable all advanced option checkboxes. +1. All other values were left default + +These instructions originally authored by [Nils Henrik Hals](https://strepto.github.io/Pause/blog/dotnet-format-rider/). From e62744ea6d314e7a7e26a271a094ec8f6121b7a9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 28 Sep 2021 12:19:09 +0000 Subject: [PATCH 1679/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210928.2 Microsoft.NETCore.Compilers From Version 4.0.0-5.21476.2 -> To Version 4.0.0-5.21478.2 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index de81d167bbe6..17016ca4cf5d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 171c2f20ea4d586cf4f101f30ee41f625e01455e + fb1d57aa6e3456e97c955e029d6f65f0dff1cc8e https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 637cbcefb7dd..04ef806714fe 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21476.2 + 4.0.0-5.21478.2 2.0.0-beta1.21473.1 0.3.0-alpha.21473.1 From 50a38be7e4119ccd20cd8a23c03c158d79c454d6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 29 Sep 2021 12:18:58 +0000 Subject: [PATCH 1680/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210928.20 Microsoft.NETCore.Compilers From Version 4.0.0-5.21478.2 -> To Version 4.0.0-5.21478.20 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 17016ca4cf5d..a1294fccfef0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - fb1d57aa6e3456e97c955e029d6f65f0dff1cc8e + 99e24c209e8a1436439fc8a0326cca7260e3878f https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 04ef806714fe..52c0c1d17cb7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21478.2 + 4.0.0-5.21478.20 2.0.0-beta1.21473.1 0.3.0-alpha.21473.1 From 6545bfe679ca9f8a679faa03bc6a60f5083ce8ac Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 30 Sep 2021 12:20:24 +0000 Subject: [PATCH 1681/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210929.8 Microsoft.NETCore.Compilers From Version 4.0.0-5.21478.2 -> To Version 4.0.0-5.21479.8 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a1294fccfef0..7bd40af3d26a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 99e24c209e8a1436439fc8a0326cca7260e3878f + 6e8bb6f10f79579866458d30abcb764d7da9df85 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 52c0c1d17cb7..62dea3f4c030 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21478.20 + 4.0.0-5.21479.8 2.0.0-beta1.21473.1 0.3.0-alpha.21473.1 From c9d108a11021bcb82fdb8be8310bee8ee07a45f7 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 30 Sep 2021 14:13:47 -0700 Subject: [PATCH 1682/2702] Move to 1ES pools --- azure-pipelines-official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index ae521b72c8d3..e05e3f2176b5 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -21,7 +21,7 @@ stages: - job: OfficialBuild displayName: Official Build pool: - name: VSEngSS-MicroBuild2019 + name: VSEngSS-MicroBuild2019-1ES demands: - cmd From cd49c091f4f744f8e7f6fb35ae01045ab3ce2901 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Thu, 30 Sep 2021 22:31:42 -0700 Subject: [PATCH 1683/2702] use discard --- src/Utilities/ProcessRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utilities/ProcessRunner.cs b/src/Utilities/ProcessRunner.cs index da71f85d4956..1c97faeb3b72 100644 --- a/src/Utilities/ProcessRunner.cs +++ b/src/Utilities/ProcessRunner.cs @@ -115,7 +115,7 @@ public static ProcessInfo CreateProcess( }); }; - var registration = cancellationToken.Register(() => + _ = cancellationToken.Register(() => { if (tcs.TrySetCanceled()) { From a659ee1e8087c7770b20b1680cb514ba9eca9835 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Thu, 30 Sep 2021 22:32:50 -0700 Subject: [PATCH 1684/2702] Don't assume null --- src/Analyzers/SolutionCodeFixApplier.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analyzers/SolutionCodeFixApplier.cs b/src/Analyzers/SolutionCodeFixApplier.cs index 4ae797e732ad..747de9df9083 100644 --- a/src/Analyzers/SolutionCodeFixApplier.cs +++ b/src/Analyzers/SolutionCodeFixApplier.cs @@ -90,7 +90,7 @@ public async Task ApplyCodeFixesAsync( } catch (Exception ex) { - logger.LogWarning(Resources.Failed_to_apply_code_fix_0_for_1_2, codeFix?.GetType().Name, diagnosticId, ex.Message); + logger.LogWarning(Resources.Failed_to_apply_code_fix_0_for_1_2, codeFix.GetType().Name, diagnosticId, ex.Message); return solution; } } From ddde99a1ca2c00b1b28787469a0b1166b04a6849 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 1 Oct 2021 12:18:58 +0000 Subject: [PATCH 1685/2702] Update dependencies from https://github.com/dotnet/roslyn build 20210930.15 Microsoft.NETCore.Compilers From Version 4.0.0-5.21479.8 -> To Version 4.0.0-5.21480.15 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7bd40af3d26a..dd0957796fbd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 6e8bb6f10f79579866458d30abcb764d7da9df85 + 87373d4485d499cce22ac69abbbd290da5140757 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 62dea3f4c030..8372975ee938 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21479.8 + 4.0.0-5.21480.15 2.0.0-beta1.21473.1 0.3.0-alpha.21473.1 From 315dfb46e01810c7dd9eeb9aa6f6b96fb307f1fa Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 2 Oct 2021 12:18:59 +0000 Subject: [PATCH 1686/2702] Update dependencies from https://github.com/dotnet/roslyn build 20211001.19 Microsoft.NETCore.Compilers From Version 4.0.0-5.21480.15 -> To Version 4.0.0-5.21501.19 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dd0957796fbd..bbc9c7c12b45 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 87373d4485d499cce22ac69abbbd290da5140757 + 8e1779e16298415843e85029d8b52a1ae9bb4c30 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 8372975ee938..239a16eb077e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21480.15 + 4.0.0-5.21501.19 2.0.0-beta1.21473.1 0.3.0-alpha.21473.1 From d72b050a5520c795fe5104bd55be1e6ff3ddfe78 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 6 Oct 2021 12:23:06 +0000 Subject: [PATCH 1687/2702] Update dependencies from https://github.com/dotnet/roslyn build 20211005.4 Microsoft.NETCore.Compilers From Version 4.0.0-5.21480.15 -> To Version 4.0.0-5.21505.4 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bbc9c7c12b45..aadcfe7641e3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/roslyn - 8e1779e16298415843e85029d8b52a1ae9bb4c30 + ae62c5fdc561eb991cb14d31b3d865fdf6465d94 https://github.com/dotnet/command-line-api diff --git a/eng/Versions.props b/eng/Versions.props index 239a16eb077e..e031efe03bbe 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 4.0.0-5.21501.19 + 4.0.0-5.21505.4 2.0.0-beta1.21473.1 0.3.0-alpha.21473.1 From b722f74f7ef982a364b9af3d0719e81c29b050e5 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 7 Oct 2021 17:00:27 -0700 Subject: [PATCH 1688/2702] Limit reported compiler diagnostics to those that support FixAllScope.Solution --- src/Analyzers/AnalyzerFormatter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Analyzers/AnalyzerFormatter.cs b/src/Analyzers/AnalyzerFormatter.cs index 187b961f9cd0..31a9029bd809 100644 --- a/src/Analyzers/AnalyzerFormatter.cs +++ b/src/Analyzers/AnalyzerFormatter.cs @@ -66,8 +66,9 @@ public async Task FormatAsync( var allFixers = projectAnalyzersAndFixers.Values.SelectMany(analyzersAndFixers => analyzersAndFixers.Fixers).ToImmutableArray(); - // Only include compiler diagnostics if we have a fixer that can fix them. + // Only include compiler diagnostics if we have an associated fixer that supports FixAllScope.Solution var fixableCompilerDiagnostics = allFixers + .Where(codefix => codefix.GetFixAllProvider()?.GetSupportedFixAllScopes()?.Contains(FixAllScope.Solution) == true) .SelectMany(codefix => codefix.FixableDiagnosticIds.Where(id => id.StartsWith("CS") || id.StartsWith("BC"))) .ToImmutableHashSet(); From 980ba16411406a2e6b021dbd8f15142146904be8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 8 Oct 2021 12:35:23 +0000 Subject: [PATCH 1689/2702] Update dependencies from https://github.com/dotnet/arcade build 20211007.3 Microsoft.DotNet.Arcade.Sdk From Version 7.0.0-beta.21474.2 -> To Version 7.0.0-beta.21507.3 --- eng/Version.Details.xml | 4 ++-- eng/common/native/init-compiler.sh | 22 +++++++++++--------- eng/common/templates/steps/send-to-helix.yml | 3 --- global.json | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dd0957796fbd..14be4253ff5f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -15,9 +15,9 @@ - + https://github.com/dotnet/arcade - 3ea0d860c6973f2cbadc9e895c7ec2cbdaec4ad5 + 98bacf3d68679c51adbb7c596a3de16a7f9acacf diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index 1daadf32a524..8c944f30b286 100644 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -3,9 +3,10 @@ # This file detects the C/C++ compiler and exports it to the CC/CXX environment variables # -if [[ "$#" -lt 2 ]]; then +if [[ "$#" -lt 3 ]]; then echo "Usage..." - echo "init-compiler.sh " + echo "init-compiler.sh