diff --git a/.editorconfig b/.editorconfig index 5021a5b28..2e54d0f2d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,5 +14,5 @@ insert_final_newline = true trim_trailing_whitespace = false insert_final_newline = false -[*.{props,targets,csproj}] +[*.{props,targets,csproj,config}] indent_size = 2 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..d61e3350c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: CI +on: + push: + branches: [master, release-*] + tags: + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.[0-9]+-*' + pull_request: + workflow_dispatch: +env: + DOTNET_NOLOGO: true +jobs: + build: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: windows-2019 + name: Windows + - os: ubuntu-20.04 + name: Linux + - os: macos-10.15 + name: macOS + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + - name: Setup .NET SDK + uses: actions/setup-dotnet@v1.8.1 + with: + dotnet-version: 5.0.x + - name: Setup .NET Core 3.1 runtime + uses: actions/setup-dotnet@v1.8.1 + with: + dotnet-version: 3.1.x + - name: Build + run: dotnet build LibGit2Sharp.sln --configuration Release + - name: Upload packages + if: matrix.name == 'Windows' + uses: actions/upload-artifact@v2.2.4 + with: + name: NuGet packages + path: bin/Packages/ + retention-days: 7 + - name: Run net472 tests + if: matrix.name == 'Windows' + run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework net472 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING + - name: Run netcoreapp3.1 tests + run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework netcoreapp3.1 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING + - name: Run net5.0 tests + run: dotnet test LibGit2Sharp.sln --configuration Release --no-restore --framework net5.0 --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 18e8b5c24..000000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: csharp -mono: none - -# Disable Travis-CI -branches: - only: - - NOTTHISONE diff --git a/Directory.Build.props b/Directory.Build.props index 06e7f5642..72eda8864 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,8 +4,12 @@ true $(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\$(Configuration)\ $(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\ - $(MSBuildThisFileDirectory)bin\Packages\$(Configuration)\ + $(MSBuildThisFileDirectory)bin\Packages\ $(DefineConstants);$(ExtraDefine) - + + + true + + diff --git a/Directory.Build.targets b/Directory.Build.targets deleted file mode 100644 index 1ddcba6f4..000000000 --- a/Directory.Build.targets +++ /dev/null @@ -1,8 +0,0 @@ - - - cobertura - [xunit.*]* - - $(OutputPath)/ - - diff --git a/LibGit2Sharp.Tests/BlobFixture.cs b/LibGit2Sharp.Tests/BlobFixture.cs index 7afbe255f..f39429b74 100644 --- a/LibGit2Sharp.Tests/BlobFixture.cs +++ b/LibGit2Sharp.Tests/BlobFixture.cs @@ -43,7 +43,7 @@ public void CanGetBlobAsFilteredText(string autocrlf, string expectedText) } } -#if NETFRAMEWORK || NETCOREAPP2_1 +#if NETFRAMEWORK || NETCOREAPP3_1 //UTF-7 is disabled in .NET 5 [Theory] [InlineData("ascii", 4, "31 32 33 34")] [InlineData("utf-7", 4, "31 32 33 34")] diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index 1810df2ee..24e558461 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -1,7 +1,7 @@  - net472;netcoreapp2.1;net5.0 + net472;netcoreapp3.1;net5.0 @@ -11,8 +11,8 @@ - - + + diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.v2.ncrunchproject b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.v2.ncrunchproject deleted file mode 100644 index e24470157..000000000 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.v2.ncrunchproject +++ /dev/null @@ -1,31 +0,0 @@ - - 1000 - false - true - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - - - LibGit2Sharp.Tests.ShadowCopyFixture.CanProbeForNativeBinariesFromAShadowCopiedAssembly - - - Resources\**;Resources\**.* - \ No newline at end of file diff --git a/LibGit2Sharp.sln.DotSettings b/LibGit2Sharp.sln.DotSettings deleted file mode 100644 index 8bc2282a8..000000000 --- a/LibGit2Sharp.sln.DotSettings +++ /dev/null @@ -1,17 +0,0 @@ - - <?xml version="1.0" encoding="utf-16"?><Profile name="LibGit2Sharp"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode></Profile> - TOGETHER - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - True - False - True - True - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> - True - True - True - diff --git a/LibGit2Sharp.v2.ncrunchsolution b/LibGit2Sharp.v2.ncrunchsolution deleted file mode 100644 index 9420cc077..000000000 --- a/LibGit2Sharp.v2.ncrunchsolution +++ /dev/null @@ -1,13 +0,0 @@ - - 1 - false - true - true - UseDynamicAnalysis - UseStaticAnalysis - UseStaticAnalysis - UseStaticAnalysis - UseStaticAnalysis - - - \ No newline at end of file diff --git a/LibGit2Sharp/CustomDictionary.xml b/LibGit2Sharp/CustomDictionary.xml deleted file mode 100644 index fe603c22b..000000000 --- a/LibGit2Sharp/CustomDictionary.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - git - sha - unstage - unstaged - compat - oid - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index d35369d94..58c759fa5 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -3,7 +3,7 @@ netstandard2.0;netcoreapp2.1 true - LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono. + LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .NET LibGit2Sharp contributors Copyright © LibGit2Sharp contributors libgit2 git @@ -11,21 +11,19 @@ LibGit2Sharp contributors true true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - true - snupkg + embedded true ..\libgit2sharp.snk square-logo.png App_Readme/LICENSE.md + true - - - - - + + + + diff --git a/LibGit2Sharp/LibGit2Sharp.v2.ncrunchproject b/LibGit2Sharp/LibGit2Sharp.v2.ncrunchproject deleted file mode 100644 index cc3cf2122..000000000 --- a/LibGit2Sharp/LibGit2Sharp.v2.ncrunchproject +++ /dev/null @@ -1,25 +0,0 @@ - - 1000 - false - false - false - true - false - false - false - false - false - true - true - false - true - true - true - 60000 - - - - AutoDetect - STA - x86 - \ No newline at end of file diff --git a/LibGit2Sharp/Properties/AssemblyInfo.cs b/LibGit2Sharp/Properties/AssemblyInfo.cs deleted file mode 100644 index ffa977d1d..000000000 --- a/LibGit2Sharp/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: CLSCompliant(true)] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. - -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM - -[assembly: Guid("c6f71967-5be1-49f5-b48e-861bff498ea3")] diff --git a/README.md b/README.md index c67e6ec8e..702d35832 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,45 @@ # LibGit2Sharp -[![master azurepipelines][master-azurepipelines-badge]][master-azurepipelines] -[![master win][master-win-badge]][master-win] -[![master nix][master-nix-badge]][master-nix] -[![coverity][coverity-badge]][coverity-project] +![master CI](https://github.com/libgit2/libgit2sharp/actions/workflows/ci.yml/badge.svg) -[master-azurepipelines-badge]: https://dev.azure.com/libgit2sharp/libgit2sharp/_apis/build/status/libgit2sharp?branchName=master -[master-azurepipelines]: https://dev.azure.com/libgit2sharp/libgit2sharp/_build/latest?definitionId=1 -[master-win-badge]: https://ci.appveyor.com/api/projects/status/8qxcoqdo9kp7x2w9/branch/master?svg=true -[master-win]: https://ci.appveyor.com/project/libgit2/libgit2sharp/branch/master -[master-nix-badge]: https://travis-ci.org/libgit2/libgit2sharp.svg?branch=master -[master-nix]: https://travis-ci.org/libgit2/libgit2sharp/branches - -[coverity-project]: https://scan.coverity.com/projects/2088 -[coverity-badge]: https://scan.coverity.com/projects/2088/badge.svg - -**LibGit2Sharp brings all the might and speed of [libgit2][libgit2], a native Git implementation, to the managed world of .NET and Mono.** - - [libgit2]: http://libgit2.github.com/ - -## Prerequisites - - - **Windows:** .NET 4.6.1+ - - **Linux/Mac OS X:** Mono 5.4+ +**LibGit2Sharp brings all the might and speed of [libgit2](http://libgit2.github.com/), a native Git implementation, to the managed world of .NET** ## Online resources - - [NuGet package][nuget] (Requires NuGet 2.7+) - - [Source code][source] - - [nuget]: http://nuget.org/List/Packages/LibGit2Sharp - [source]: https://github.com/libgit2/libgit2sharp/ +- [NuGet package](http://nuget.org/List/Packages/LibGit2Sharp) +- [Source code](https://github.com/libgit2/libgit2sharp/) ## Troubleshooting and support - - Usage or programming related question? Post it on [StackOverflow][so] using the tag *libgit2sharp* - - Found a bug or missing a feature? Feed the [issue tracker][tracker] - - Announcements and related miscellanea through Twitter ([@libgit2sharp][twitter]) - - [so]: http://stackoverflow.com/questions/tagged/libgit2sharp - [tracker]: https://github.com/libgit2/libgit2sharp/issues - [twitter]: http://twitter.com/libgit2sharp +- Usage or programming related question? Post it on [StackOverflow](http://stackoverflow.com/questions/tagged/libgit2sharp) using the tag *libgit2sharp* +- Found a bug or missing a feature? Feed the [issue tracker](https://github.com/libgit2/libgit2sharp/issues) +- Announcements and related miscellanea through Twitter ([@libgit2sharp](http://twitter.com/libgit2sharp)) ## Quick contributing guide - - Fork and clone locally - - Create a topic specific branch. Add some nice feature. Do not forget the tests ;-) - - Send a Pull Request to spread the fun! - -More thorough information available in the [wiki][wiki]. +- Fork and clone locally +- Create a topic specific branch. Add some nice feature. Do not forget the tests ;-) +- Send a Pull Request to spread the fun! - [wiki]: https://github.com/libgit2/libgit2sharp/wiki +More thorough information is available in the [wiki](https://github.com/libgit2/libgit2sharp/wiki). ## Optimizing unit testing -LibGit2Sharp strives to have comprehensive and robust unit test suite to ensure the quality of the software and to assist new contributors and users who can use the tests as sample to jump start development. There are over one thousand unit-tests for LibGit2Sharp, this number will only grow as functionality is added. -You can do a few things to optimize running unit-tests on Windows: +LibGit2Sharp strives to have a comprehensive and robust unit test suite to ensure the quality of the software and to assist new contributors and users, who can use the tests as examples to jump start development. There are over one thousand unit tests for LibGit2Sharp, and this number will only grow as functionality is added. + +You can do a few things to optimize running unit tests on Windows: 1. Set the `LibGit2TestPath` environment variable to a path in your development environment. - * If the unit-test framework cannot find the specified folder at runtime, it will fall back to the default location. + * If the unit test framework cannot find the specified folder at runtime, it will fall back to the default location. 2. Configure your anti-virus software to ignore the `LibGit2TestPath` path. 3. Install a RAM disk like [IMDisk](http://www.ltr-data.se/opencode.html/#ImDisk) and set `LibGit2TestPath` to use it. - * Use `imdisk.exe -a -s 512M -m X: -p "/fs:fat /q /v:ramdisk /y"` to create a RAM disk. This command requires elevated privileges and can be placed into a scheduled task or run manually before you begin unit-testing. + * Use `imdisk.exe -a -s 512M -m X: -p "/fs:fat /q /v:ramdisk /y"` to create a RAM disk. This command requires elevated privileges and can be placed into a scheduled task or run manually before you begin unit-testing. ## Authors - - **Code:** The LibGit2Sharp [contributors][committers] - - **Logo:** [Jason "blackant" Long][blackant] - - [committers]: https://github.com/libgit2/libgit2sharp/contributors - [blackant]: https://github.com/jasonlong +- **Code:** The LibGit2Sharp [contributors](https://github.com/libgit2/libgit2sharp/contributors) +- **Logo:** [Jason "blackant" Long](https://github.com/jasonlong) ## License -The MIT license (Refer to the [LICENSE.md][license] file) - - [license]: https://github.com/libgit2/libgit2sharp/blob/master/LICENSE.md +The MIT license (Refer to the [LICENSE.md](https://github.com/libgit2/libgit2sharp/blob/master/LICENSE.md) file) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 6eeeedba4..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,4 +0,0 @@ -# Disable AppVeyor -branches: - only: - - NOTTHISONE diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index c25545a56..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,12 +0,0 @@ -trigger: -- master -- maint/* - -variables: - TreatWarningsAsErrors: true - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - BuildConfiguration: Release - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages - -jobs: -- template: azure-pipelines/build.yml diff --git a/azure-pipelines/Set-EnvVars.ps1 b/azure-pipelines/Set-EnvVars.ps1 deleted file mode 100644 index 907659a7b..000000000 --- a/azure-pipelines/Set-EnvVars.ps1 +++ /dev/null @@ -1,79 +0,0 @@ -<# -.SYNOPSIS - Set environment variables in the environment. - Azure Pipeline and CMD environments are considered. -.PARAMETER Variables - A hashtable of variables to be set. -.OUTPUTS - A boolean indicating whether the environment variables can be expected to propagate to the caller's environment. -#> -[CmdletBinding(SupportsShouldProcess=$true)] -Param( - [Parameter(Mandatory=$true, Position=1)] - $Variables, - [string[]]$PrependPath -) - -if ($Variables.Count -eq 0) { - return $true -} - -$cmdInstructions = !$env:TF_BUILD -and !$env:GITHUB_ACTIONS -and $env:PS1UnderCmd -eq '1' -if ($cmdInstructions) { - Write-Warning "Environment variables have been set that will be lost because you're running under cmd.exe" - Write-Host "Environment variables that must be set manually:" -ForegroundColor Blue -} else { - Write-Host "Environment variables set:" -ForegroundColor Blue - $envVars - if ($PrependPath) { - Write-Host "Paths prepended to PATH: $PrependPath" - } -} - -if ($env:TF_BUILD) { - Write-Host "Azure Pipelines detected. Logging commands will be used to propagate environment variables and prepend path." -} - -if ($env:GITHUB_ACTIONS) { - Write-Host "GitHub Actions detected. Logging commands will be used to propagate environment variables and prepend path." -} - -$Variables.GetEnumerator() |% { - Set-Item -Path env:$($_.Key) -Value $_.Value - - # If we're running in a cloud CI, set these environment variables so they propagate. - if ($env:TF_BUILD) { - Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" - } - if ($env:GITHUB_ACTIONS) { - Write-Host "::set-env name=$($_.Key)::$($_.Value)" - } - - if ($cmdInstructions) { - Write-Host "SET $($_.Key)=$($_.Value)" - } -} - -$pathDelimiter = ';' -if ($IsMacOS -or $IsLinux) { - $pathDelimiter = ':' -} - -if ($PrependPath) { - $PrependPath |% { - $newPathValue = "$_$pathDelimiter$env:PATH" - Set-Item -Path env:PATH -Value $newPathValue - if ($cmdInstructions) { - Write-Host "SET PATH=$newPathValue" - } - - if ($env:TF_BUILD) { - Write-Host "##vso[task.prependpath]$_" - } - if ($env:GITHUB_ACTIONS) { - Write-Host "::add-path::$_" - } - } -} - -return !$cmdInstructions diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 deleted file mode 100644 index 6f62be5c3..000000000 --- a/azure-pipelines/artifacts/_all.ps1 +++ /dev/null @@ -1,50 +0,0 @@ -# This script returns all the artifacts that should be collected after a build. -# -# Each powershell artifact is expressed as an object with these properties: -# Source - the full path to the source file -# ArtifactName - the name of the artifact to upload to -# ContainerFolder - the relative path within the artifact in which the file should appear -# -# Each artifact aggregating .ps1 script should return a hashtable: -# Key = path to the directory from which relative paths within the artifact should be calculated -# Value = an array of paths (absolute or relative to the BaseDirectory) to files to include in the artifact. -# FileInfo objects are also allowed. - -$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - -Function EnsureTrailingSlash($path) { - if ($path.length -gt 0 -and !$path.EndsWith('\') -and !$path.EndsWith('/')) { - $path = $path + [IO.Path]::DirectorySeparatorChar - } - - $path.Replace('\', [IO.Path]::DirectorySeparatorChar) -} - -Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% { - $ArtifactName = $_.BaseName - - $fileGroups = & $_ - if (!$fileGroups -or $fileGroups.Count -eq 0) { - Write-Warning "No files found for the `"$ArtifactName`" artifact." - } else { - $fileGroups.GetEnumerator() | % { - $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute) - $_.Value | % { - if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) { - $_ = $_.FullName - } - - $artifact = New-Object -TypeName PSObject - Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName - - $SourceFullPath = New-Object Uri ($BaseDirectory, $_) - Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath - - $RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath)) - Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath) - - Write-Output $artifact - } - } - } -} diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 deleted file mode 100644 index 5bca7c6c1..000000000 --- a/azure-pipelines/artifacts/_pipelines.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -# This script translates all the artifacts described by _all.ps1 -# into commands that instruct Azure Pipelines to actually collect those artifacts. - -param ( - [string]$ArtifactNameSuffix -) - -& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix |% { - Write-Host "##vso[artifact.upload containerfolder=$($_.Name);artifactname=$($_.Name);]$($_.Path)" -} diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 deleted file mode 100644 index a05db5292..000000000 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ /dev/null @@ -1,59 +0,0 @@ -# This script links all the artifacts described by _all.ps1 -# into a staging directory, reading for uploading to a cloud build artifact store. -# It returns a sequence of objects with Name and Path properties. - -param ( - [string]$ArtifactNameSuffix -) - -$RepoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot (Join-Path .. ..))) -if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { - $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY -} else { - $ArtifactStagingFolder = Join-Path $RepoRoot (Join-Path obj _artifacts) - if (Test-Path $ArtifactStagingFolder) { - Remove-Item $ArtifactStagingFolder -Recurse -Force - } -} - -function Create-SymbolicLink { - param ( - $Link, - $Target - ) - - if ($Link -eq $Target) { - return - } - - if (Test-Path $Link) { Remove-Item $Link } - $LinkContainer = Split-Path $Link -Parent - if (!(Test-Path $LinkContainer)) { mkdir $LinkContainer } - Write-Verbose "Linking $Link to $Target" - if ($IsMacOS -or $IsLinux) { - ln $Target $Link | Out-Null - } else { - cmd /c mklink $Link $Target | Out-Null - } -} - -# Stage all artifacts -$Artifacts = & "$PSScriptRoot\_all.ps1" -$Artifacts |% { - $DestinationFolder = (Join-Path (Join-Path $ArtifactStagingFolder "$($_.ArtifactName)$ArtifactNameSuffix") $_.ContainerFolder).TrimEnd('\') - $Name = "$(Split-Path $_.Source -Leaf)" - - #Write-Host "$($_.Source) -> $($_.ArtifactName)\$($_.ContainerFolder)" -ForegroundColor Yellow - - if (-not (Test-Path $DestinationFolder)) { New-Item -ItemType Directory -Path $DestinationFolder | Out-Null } - if (Test-Path -PathType Leaf $_.Source) { # skip folders - Create-SymbolicLink -Link (Join-Path $DestinationFolder $Name) -Target $_.Source - } -} - -$Artifacts |% { "$($_.ArtifactName)$ArtifactNameSuffix" } | Get-Unique |% { - $artifact = New-Object -TypeName PSObject - Add-Member -InputObject $artifact -MemberType NoteProperty -Name Name -Value $_ - Add-Member -InputObject $artifact -MemberType NoteProperty -Name Path -Value (Join-Path $ArtifactStagingFolder $_) - Write-Output $artifact -} diff --git a/azure-pipelines/artifacts/build_logs.ps1 b/azure-pipelines/artifacts/build_logs.ps1 deleted file mode 100644 index b55ba48f3..000000000 --- a/azure-pipelines/artifacts/build_logs.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { - $artifactsRoot = $env:BUILD_ARTIFACTSTAGINGDIRECTORY -} else { - $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - $artifactsRoot = "$RepoRoot\bin" -} - -if (!(Test-Path $artifactsRoot/build_logs)) { return } - -@{ - "$artifactsRoot/build_logs" = (Get-ChildItem -Recurse "$artifactsRoot/build_logs") -} diff --git a/azure-pipelines/artifacts/coverageResults.ps1 b/azure-pipelines/artifacts/coverageResults.ps1 deleted file mode 100644 index 7d1e9a35f..000000000 --- a/azure-pipelines/artifacts/coverageResults.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - -# Prepare code coverage reports for merging on another machine -if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) { - Write-Host "Substituting $env:SYSTEM_DEFAULTWORKINGDIRECTORY with `"{reporoot}`"" - $reports = Get-ChildItem "$RepoRoot/bin/coverage.cobertura.xml" -Recurse - $reports |% { - $content = Get-Content -Path $_ |% { $_ -Replace [regex]::Escape($env:SYSTEM_DEFAULTWORKINGDIRECTORY), "{reporoot}" } - Set-Content -Path $_ -Value $content -Encoding UTF8 - } -} else { - Write-Warning "coverageResults: Azure Pipelines not detected. Machine-neutral token replacement skipped." -} - -if (!((Test-Path $RepoRoot\bin) -and (Test-Path $RepoRoot\obj))) { return } - -@{ - $RepoRoot = ( - @(Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) + - (Get-ChildItem "$RepoRoot\obj\*.cs" -Recurse) - ); -} diff --git a/azure-pipelines/artifacts/deployables.ps1 b/azure-pipelines/artifacts/deployables.ps1 deleted file mode 100644 index 94c48cdd9..000000000 --- a/azure-pipelines/artifacts/deployables.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") -$BuildConfiguration = $env:BUILDCONFIGURATION -if (!$BuildConfiguration) { - $BuildConfiguration = 'Debug' -} - -$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration" - -if (!(Test-Path $PackagesRoot)) { return } - -@{ - "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) -} diff --git a/azure-pipelines/artifacts/projectAssetsJson.ps1 b/azure-pipelines/artifacts/projectAssetsJson.ps1 deleted file mode 100644 index d2e85ffbe..000000000 --- a/azure-pipelines/artifacts/projectAssetsJson.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -$ObjRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\obj") - -if (!(Test-Path $ObjRoot)) { return } - -@{ - "$ObjRoot" = ( - (Get-ChildItem "$ObjRoot\project.assets.json" -Recurse) - ); -} diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml deleted file mode 100644 index a73ccda4c..000000000 --- a/azure-pipelines/build.yml +++ /dev/null @@ -1,50 +0,0 @@ -parameters: - windowsPool: Hosted Windows 2019 with VS2019 - -jobs: -- job: Windows - pool: ${{ parameters.windowsPool }} - steps: - - template: install-dependencies.yml - - template: dotnet.yml - -- job: Linux - pool: - vmImage: Ubuntu 18.04 - steps: - - template: install-dependencies.yml - - template: dotnet.yml - -- job: macOS - pool: - vmImage: macOS-10.15 - steps: - - template: install-dependencies.yml - - template: dotnet.yml - -- job: WrapUp - dependsOn: - - Windows - - Linux - - macOS - pool: - vmImage: Ubuntu 18.04 - condition: succeededOrFailed() - steps: - - template: install-dependencies.yml - parameters: - initArgs: -NoRestore - - template: publish-codecoverage.yml - - template: publish-deployables.yml - -- job: leak_check - pool: - vmImage: Ubuntu 18.04 - steps: - - template: install-dependencies.yml - - task: DotNetCoreCLI@2 - displayName: dotnet test -f netcoreapp2.1 - inputs: - command: test - arguments: --no-restore -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v m /p:ExtraDefine=LEAKS_IDENTIFYING - testRunTitle: netcoreapp2.1-$(Agent.JobName) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml deleted file mode 100644 index 3bc1eaf50..000000000 --- a/azure-pipelines/dotnet.yml +++ /dev/null @@ -1,49 +0,0 @@ -steps: - -- script: dotnet build --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" - displayName: dotnet build - -- script: dotnet pack --no-build -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/pack.binlog" - displayName: dotnet pack - -- task: DotNetCoreCLI@2 - displayName: dotnet test -f net472 (w/ coverage) - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest & TestCategory!=FailsWhileInstrumented" -v n /p:CollectCoverage=true - testRunTitle: net472-$(Agent.JobName) - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - -- task: DotNetCoreCLI@2 - displayName: dotnet test -f net472 (w/o coverage) - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest & TestCategory=FailsWhileInstrumented" -v n - testRunTitle: net472-$(Agent.JobName)-nocoverage - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - -- task: DotNetCoreCLI@2 - displayName: dotnet test -f netcoreapp2.1 - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true - testRunTitle: netcoreapp2.1-$(Agent.JobName) - -- task: DotNetCoreCLI@2 - displayName: dotnet test -f net5.0 - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f net5.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true - testRunTitle: net5.0-$(Agent.JobName) - -- task: PowerShell@2 - inputs: - filePath: azure-pipelines/artifacts/_pipelines.ps1 - arguments: -ArtifactNameSuffix "-$(Agent.JobName)" - displayName: Publish artifacts - condition: succeededOrFailed() - -- bash: bash <(curl -s https://codecov.io/bash) - displayName: Publish code coverage results to codecov.io - timeoutInMinutes: 3 - continueOnError: true diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml deleted file mode 100644 index 5b008c6e8..000000000 --- a/azure-pipelines/install-dependencies.yml +++ /dev/null @@ -1,9 +0,0 @@ -parameters: - initArgs: - -steps: - -- powershell: | - .\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }} -UpgradePrerequisites - dotnet --info - displayName: Install prerequisites diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml deleted file mode 100644 index 59dba9d40..000000000 --- a/azure-pipelines/publish-codecoverage.yml +++ /dev/null @@ -1,31 +0,0 @@ -steps: -- download: current - artifact: coverageResults-Windows - displayName: Download Windows code coverage results - continueOnError: true -- download: current - artifact: coverageResults-Linux - displayName: Download Linux code coverage results - continueOnError: true -- download: current - artifact: coverageResults-macOS - displayName: Download macOS code coverage results - continueOnError: true -- powershell: | - dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 - Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj - Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" - $reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.cobertura.xml" - $reports |% { - $content = Get-Content -Path $_ |% { $_.Replace("{reporoot}", "$(System.DefaultWorkingDirectory)") } - Set-Content -Path $_ -Value $content -Encoding UTF8 - } - $Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_ })) - obj/reportgenerator -reports:"$Inputs" -targetdir:coveragereport -reporttypes:Cobertura - displayName: Merge coverage -- task: PublishCodeCoverageResults@1 - displayName: Publish code coverage results to Azure DevOps - inputs: - codeCoverageTool: cobertura - summaryFileLocation: 'coveragereport/Cobertura.xml' - failIfCoverageEmpty: true diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml deleted file mode 100644 index a89f389fd..000000000 --- a/azure-pipelines/publish-deployables.yml +++ /dev/null @@ -1,14 +0,0 @@ -steps: -- download: current - displayName: Download deployables - artifact: deployables-Windows - -- task: NuGetCommand@2 - displayName: Push packages to CI feed - inputs: - command: push - packagesToPush: $(Pipeline.Workspace)/deployables-Windows/*.nupkg - nuGetFeedType: internal - publishVstsFeed: $(ci_feed) - allowPackageConflicts: true - condition: and(succeeded(), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) diff --git a/azure-pipelines/variables/DotNetSdkVersion.ps1 b/azure-pipelines/variables/DotNetSdkVersion.ps1 deleted file mode 100644 index b213fbc27..000000000 --- a/azure-pipelines/variables/DotNetSdkVersion.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -$globalJson = Get-Content -Path "$PSScriptRoot\..\..\global.json" | ConvertFrom-Json -$globalJson.sdk.version diff --git a/global.json b/global.json deleted file mode 100644 index 459551b1c..000000000 --- a/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sdk": { - "version": "5.0.400" - } -} diff --git a/init.cmd b/init.cmd deleted file mode 100644 index 970285c2f..000000000 --- a/init.cmd +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -SETLOCAL -set PS1UnderCmd=1 -powershell.exe -NoProfile -NoLogo -ExecutionPolicy bypass -Command "try { & '%~dpn0.ps1' %*; exit $LASTEXITCODE } catch { write-host $_; exit 1 }" diff --git a/init.ps1 b/init.ps1 deleted file mode 100644 index 907d85a5c..000000000 --- a/init.ps1 +++ /dev/null @@ -1,66 +0,0 @@ -<# -.SYNOPSIS -Installs dependencies required to build and test the projects in this repository. -.DESCRIPTION -This MAY not require elevation, as the SDK and runtimes are installed to a per-user location, -unless the `-InstallLocality` switch is specified directing to a per-repo or per-machine location. -See detailed help on that switch for more information. -.PARAMETER InstallLocality -A value indicating whether dependencies should be installed locally to the repo or at a per-user location. -Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. -Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. -Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. -When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. -Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. -Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. -.PARAMETER NoPrerequisites -Skips the installation of prerequisite software (e.g. SDKs, tools). -.PARAMETER UpgradePrerequisites -Takes time to install prerequisites even if they are already present in case they need to be upgraded. -No effect if -NoPrerequisites is specified. -.PARAMETER NoRestore -Skips the package restore step. -.PARAMETER AccessToken -An optional access token for authenticating to Azure Artifacts authenticated feeds. -#> -[CmdletBinding(SupportsShouldProcess=$true)] -Param ( - [ValidateSet('repo','user','machine')] - [string]$InstallLocality='user', - [Parameter()] - [switch]$NoPrerequisites, - [Parameter()] - [switch]$UpgradePrerequisites, - [Parameter()] - [switch]$NoRestore, - [Parameter()] - [string]$AccessToken -) - -if (!$NoPrerequisites) { - & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality -} - -# Workaround nuget credential provider bug that causes very unreliable package restores on Azure Pipelines -$env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 -$env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 - -Push-Location $PSScriptRoot -try { - $HeaderColor = 'Green' - - if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) { - Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor - dotnet restore - if ($lastexitcode -ne 0) { - throw "Failure while restoring packages." - } - } -} -catch { - Write-Error $error[0] - exit $lastexitcode -} -finally { - Pop-Location -} diff --git a/nuget.config b/nuget.config index 19d85b78f..35696f810 100644 --- a/nuget.config +++ b/nuget.config @@ -1,6 +1,6 @@  - + diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 deleted file mode 100644 index 10ed02b8b..000000000 --- a/tools/Install-DotNetSdk.ps1 +++ /dev/null @@ -1,160 +0,0 @@ -<# -.SYNOPSIS -Installs the .NET SDK specified in the global.json file at the root of this repository, -along with supporting .NET Core runtimes used for testing. -.DESCRIPTION -This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, -unless `-InstallLocality machine` is specified. -.PARAMETER InstallLocality -A value indicating whether dependencies should be installed locally to the repo or at a per-user location. -Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. -Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. -Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. -When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. -Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. -Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. -#> -[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] -Param ( - [ValidateSet('repo','user','machine')] - [string]$InstallLocality='user' -) - -$DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools" -if (!(Test-Path $DotNetInstallScriptRoot)) { New-Item -ItemType Directory -Path $DotNetInstallScriptRoot | Out-Null } -$DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot - -# Look up actual required .NET Core SDK version from global.json -$sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" - -# Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. -$runtimeVersions = @() -Get-ChildItem "$PSScriptRoot\..\*.*proj" -Recurse |% { - $projXml = [xml](Get-Content -Path $_) - $targetFrameworks = $projXml.Project.PropertyGroup.TargetFramework - if (!$targetFrameworks) { - $targetFrameworks = $projXml.Project.PropertyGroup.TargetFrameworks - if ($targetFrameworks) { - $targetFrameworks = $targetFrameworks -Split ';' - } - } - $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% { - $runtimeVersions += $Matches[1] - } -} - -Function Get-FileFromWeb([Uri]$Uri, $OutDir) { - $OutFile = Join-Path $OutDir $Uri.Segments[-1] - if (!(Test-Path $OutFile)) { - Write-Verbose "Downloading $Uri..." - try { - (New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile) - } finally { - # This try/finally causes the script to abort - } - } - - $OutFile -} - -Function Get-InstallerExe($Version, [switch]$Runtime) { - $sdkOrRuntime = 'Sdk' - if ($Runtime) { $sdkOrRuntime = 'Runtime' } - - # Get the latest/actual version for the specified one - if (([Version]$Version).Build -eq -1) { - $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/latest.version" -UseBasicParsing) - $Version = $versionInfo[-1] - } - - Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/dotnet-$($sdkOrRuntime.ToLowerInvariant())-$Version-win-x64.exe" -OutDir "$DotNetInstallScriptRoot" -} - -Function Install-DotNet($Version, [switch]$Runtime) { - if ($Runtime) { $sdkSubstring = '' } else { $sdkSubstring = 'SDK ' } - Write-Host "Downloading .NET Core $sdkSubstring$Version..." - $Installer = Get-InstallerExe -Version $Version -Runtime:$Runtime - Write-Host "Installing .NET Core $sdkSubstring$Version..." - cmd /c start /wait $Installer /install /quiet - if ($LASTEXITCODE -ne 0) { - throw "Failure to install .NET Core SDK" - } -} - -if ($InstallLocality -eq 'machine') { - if ($IsMacOS -or $IsLinux) { - Write-Error "Installing the .NET Core SDK or runtime at a machine-wide location is only supported by this script on Windows." - exit 1 - } - - if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - Install-DotNet -Version $sdkVersion - } - - $runtimeVersions |% { - if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - Install-DotNet -Version $_ -Runtime - } - } - - return -} - -$switches = @( - '-Architecture','x64' -) -$envVars = @{ - # For locally installed dotnet, skip first time experience which takes a long time - 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' = 'true'; -} - -if ($InstallLocality -eq 'repo') { - $DotNetInstallDir = "$DotNetInstallScriptRoot/.dotnet" -} elseif ($env:AGENT_TOOLSDIRECTORY) { - $DotNetInstallDir = "$env:AGENT_TOOLSDIRECTORY/dotnet" -} else { - $DotNetInstallDir = Join-Path $HOME .dotnet -} - -Write-Host "Installing .NET Core SDK and runtimes to $DotNetInstallDir" -ForegroundColor Blue - -if ($DotNetInstallDir) { - $switches += '-InstallDir',$DotNetInstallDir - $envVars['DOTNET_MULTILEVEL_LOOKUP'] = '0' - $envVars['DOTNET_ROOT'] = $DotNetInstallDir -} - -if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://dot.net/v1/dotnet-install.sh" - $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" -} else { - $DownloadUri = "https://dot.net/v1/dotnet-install.ps1" - $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" -} - -if (-not (Test-Path $DotNetInstallScriptPath)) { - Invoke-WebRequest -Uri $DownloadUri -OutFile $DotNetInstallScriptPath -UseBasicParsing - if ($IsMacOS -or $IsLinux) { - chmod +x $DotNetInstallScriptPath - } -} - -if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" -} else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" -} - -$switches += '-Runtime','dotnet' - -$runtimeVersions | Get-Unique |% { - if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" - } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" - } -} - -if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { - & "$PSScriptRoot/../azure-pipelines/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null -}