BenchmarkDotNet/build.ps1

123 строки
4.2 KiB
PowerShell
Исходник Обычный вид История

Cake (C# Make) integration. Migration from custom build scripts. (#475) * First version of new build approach with cakebuild * Remove some unused comments/splitters in cakebuild file * Change filter condition in cakebuild script * Split to fast and slow test categories * ! Disable slow tests for setting purposes. Add travis ci integration. Add cake bootstrapper script for Linux and OS X. * Turn on mono version to latest. Migrate from xbuild to msbuild on Linux / macOS. * Remove appveyor cache. Add condition to run a pack step only on CI * Add empty vbproj and temporary exclude previous one * Add hack to exclude vbproj from build process * Revert "Add empty vbproj and temporary exclude previous one" This reverts commit 9920cc01bf56ab2d066a1738bc03e396c782b435. * Add verbosity and fix syntax * Specify pack's step condition * Enable test run for slow tests. Disable linux on travis build * Only unit tests * SlowTests only on appveyor * Allow SlowTests on windows local build * New approach to remove and restore projects from solution file * Fix cakebuild error * Add linux as build platform * Turn off osx to debug linux * Try to hack msbuild on linux * Disable diagnostic mode and return back osx integration * Fix possible inconsistent state in case of build errors * [Fix] in MemoryDiagnoserTests to split full .net framework and netcoreapp. [Fix] in InProcessTests to avoid unhandled exception on netcoreapp target framework. Simplify buildcake steps. * Add missed namespace * Add required openssl installation step for travis CI * Revert back changes related to affinity's issue * Update build pipeline * Revert back InProcessTest * Prepare to pull request * Get rid of spaces * Ignore Pack step on pull request's build * Ignore Pack step on pull request's build * Preparation to upcoming updates to all Travis CI Ubuntu Trusty 14.04 images * Update version of CakeBuild tool. Introduce a SkipTests flag '--SkipTests=True' Allow to pack artifacts locally '-Target Pack` * Disable version number auto-increment on pull requests. Update fsharp project. * Update CakeBuild to 0.21.1 * Update 'Building' guide (add CakeBuild option)
2017-07-17 23:11:30 +03:00
<#
.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.
.DESCRIPTION
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
and execute your Cake build script with the parameters you provide.
.PARAMETER Target
The build script target to run.
.PARAMETER Configuration
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
.PARAMETER WhatIf
Performs a dry run of the build script.
No tasks will be executed.
.PARAMETER ScriptArgs
Remaining arguments are added here.
.LINK
https://cakebuild.net
Cake (C# Make) integration. Migration from custom build scripts. (#475) * First version of new build approach with cakebuild * Remove some unused comments/splitters in cakebuild file * Change filter condition in cakebuild script * Split to fast and slow test categories * ! Disable slow tests for setting purposes. Add travis ci integration. Add cake bootstrapper script for Linux and OS X. * Turn on mono version to latest. Migrate from xbuild to msbuild on Linux / macOS. * Remove appveyor cache. Add condition to run a pack step only on CI * Add empty vbproj and temporary exclude previous one * Add hack to exclude vbproj from build process * Revert "Add empty vbproj and temporary exclude previous one" This reverts commit 9920cc01bf56ab2d066a1738bc03e396c782b435. * Add verbosity and fix syntax * Specify pack's step condition * Enable test run for slow tests. Disable linux on travis build * Only unit tests * SlowTests only on appveyor * Allow SlowTests on windows local build * New approach to remove and restore projects from solution file * Fix cakebuild error * Add linux as build platform * Turn off osx to debug linux * Try to hack msbuild on linux * Disable diagnostic mode and return back osx integration * Fix possible inconsistent state in case of build errors * [Fix] in MemoryDiagnoserTests to split full .net framework and netcoreapp. [Fix] in InProcessTests to avoid unhandled exception on netcoreapp target framework. Simplify buildcake steps. * Add missed namespace * Add required openssl installation step for travis CI * Revert back changes related to affinity's issue * Update build pipeline * Revert back InProcessTest * Prepare to pull request * Get rid of spaces * Ignore Pack step on pull request's build * Ignore Pack step on pull request's build * Preparation to upcoming updates to all Travis CI Ubuntu Trusty 14.04 images * Update version of CakeBuild tool. Introduce a SkipTests flag '--SkipTests=True' Allow to pack artifacts locally '-Target Pack` * Disable version number auto-increment on pull requests. Update fsharp project. * Update CakeBuild to 0.21.1 * Update 'Building' guide (add CakeBuild option)
2017-07-17 23:11:30 +03:00
#>
[CmdletBinding()]
Param(
[string]$Target = "Default",
[ValidateSet("Release", "Debug")]
[string]$Configuration = "Release",
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
[string]$Verbosity = "Verbose",
[switch]$WhatIf,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)
$CakeVersion = "0.26.1"
$DotNetVersion = "2.1.300";
Cake (C# Make) integration. Migration from custom build scripts. (#475) * First version of new build approach with cakebuild * Remove some unused comments/splitters in cakebuild file * Change filter condition in cakebuild script * Split to fast and slow test categories * ! Disable slow tests for setting purposes. Add travis ci integration. Add cake bootstrapper script for Linux and OS X. * Turn on mono version to latest. Migrate from xbuild to msbuild on Linux / macOS. * Remove appveyor cache. Add condition to run a pack step only on CI * Add empty vbproj and temporary exclude previous one * Add hack to exclude vbproj from build process * Revert "Add empty vbproj and temporary exclude previous one" This reverts commit 9920cc01bf56ab2d066a1738bc03e396c782b435. * Add verbosity and fix syntax * Specify pack's step condition * Enable test run for slow tests. Disable linux on travis build * Only unit tests * SlowTests only on appveyor * Allow SlowTests on windows local build * New approach to remove and restore projects from solution file * Fix cakebuild error * Add linux as build platform * Turn off osx to debug linux * Try to hack msbuild on linux * Disable diagnostic mode and return back osx integration * Fix possible inconsistent state in case of build errors * [Fix] in MemoryDiagnoserTests to split full .net framework and netcoreapp. [Fix] in InProcessTests to avoid unhandled exception on netcoreapp target framework. Simplify buildcake steps. * Add missed namespace * Add required openssl installation step for travis CI * Revert back changes related to affinity's issue * Update build pipeline * Revert back InProcessTest * Prepare to pull request * Get rid of spaces * Ignore Pack step on pull request's build * Ignore Pack step on pull request's build * Preparation to upcoming updates to all Travis CI Ubuntu Trusty 14.04 images * Update version of CakeBuild tool. Introduce a SkipTests flag '--SkipTests=True' Allow to pack artifacts locally '-Target Pack` * Disable version number auto-increment on pull requests. Update fsharp project. * Update CakeBuild to 0.21.1 * Update 'Building' guide (add CakeBuild option)
2017-07-17 23:11:30 +03:00
$DotNetInstallerUri = "https://dot.net/v1/dotnet-install.ps1";
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
# Make sure tools folder exists
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
$ToolPath = Join-Path $PSScriptRoot "tools"
if (!(Test-Path $ToolPath)) {
Write-Verbose "Creating tools directory..."
New-Item -Path $ToolPath -Type directory | out-null
}
###########################################################################
# INSTALL .NET CORE CLI
###########################################################################
Function Remove-PathVariable([string]$VariableToRemove)
{
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($path -ne $null)
{
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
}
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
if ($path -ne $null)
{
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
}
}
# Install .NET Core CLI
$InstallPath = Join-Path $PSScriptRoot ".dotnet"
if (!(Test-Path $InstallPath)) {
mkdir -Force $InstallPath | Out-Null;
Cake (C# Make) integration. Migration from custom build scripts. (#475) * First version of new build approach with cakebuild * Remove some unused comments/splitters in cakebuild file * Change filter condition in cakebuild script * Split to fast and slow test categories * ! Disable slow tests for setting purposes. Add travis ci integration. Add cake bootstrapper script for Linux and OS X. * Turn on mono version to latest. Migrate from xbuild to msbuild on Linux / macOS. * Remove appveyor cache. Add condition to run a pack step only on CI * Add empty vbproj and temporary exclude previous one * Add hack to exclude vbproj from build process * Revert "Add empty vbproj and temporary exclude previous one" This reverts commit 9920cc01bf56ab2d066a1738bc03e396c782b435. * Add verbosity and fix syntax * Specify pack's step condition * Enable test run for slow tests. Disable linux on travis build * Only unit tests * SlowTests only on appveyor * Allow SlowTests on windows local build * New approach to remove and restore projects from solution file * Fix cakebuild error * Add linux as build platform * Turn off osx to debug linux * Try to hack msbuild on linux * Disable diagnostic mode and return back osx integration * Fix possible inconsistent state in case of build errors * [Fix] in MemoryDiagnoserTests to split full .net framework and netcoreapp. [Fix] in InProcessTests to avoid unhandled exception on netcoreapp target framework. Simplify buildcake steps. * Add missed namespace * Add required openssl installation step for travis CI * Revert back changes related to affinity's issue * Update build pipeline * Revert back InProcessTest * Prepare to pull request * Get rid of spaces * Ignore Pack step on pull request's build * Ignore Pack step on pull request's build * Preparation to upcoming updates to all Travis CI Ubuntu Trusty 14.04 images * Update version of CakeBuild tool. Introduce a SkipTests flag '--SkipTests=True' Allow to pack artifacts locally '-Target Pack` * Disable version number auto-increment on pull requests. Update fsharp project. * Update CakeBuild to 0.21.1 * Update 'Building' guide (add CakeBuild option)
2017-07-17 23:11:30 +03:00
}
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1");
& $InstallPath\dotnet-install.ps1 -Version $DotNetVersion -InstallDir $InstallPath
Cake (C# Make) integration. Migration from custom build scripts. (#475) * First version of new build approach with cakebuild * Remove some unused comments/splitters in cakebuild file * Change filter condition in cakebuild script * Split to fast and slow test categories * ! Disable slow tests for setting purposes. Add travis ci integration. Add cake bootstrapper script for Linux and OS X. * Turn on mono version to latest. Migrate from xbuild to msbuild on Linux / macOS. * Remove appveyor cache. Add condition to run a pack step only on CI * Add empty vbproj and temporary exclude previous one * Add hack to exclude vbproj from build process * Revert "Add empty vbproj and temporary exclude previous one" This reverts commit 9920cc01bf56ab2d066a1738bc03e396c782b435. * Add verbosity and fix syntax * Specify pack's step condition * Enable test run for slow tests. Disable linux on travis build * Only unit tests * SlowTests only on appveyor * Allow SlowTests on windows local build * New approach to remove and restore projects from solution file * Fix cakebuild error * Add linux as build platform * Turn off osx to debug linux * Try to hack msbuild on linux * Disable diagnostic mode and return back osx integration * Fix possible inconsistent state in case of build errors * [Fix] in MemoryDiagnoserTests to split full .net framework and netcoreapp. [Fix] in InProcessTests to avoid unhandled exception on netcoreapp target framework. Simplify buildcake steps. * Add missed namespace * Add required openssl installation step for travis CI * Revert back changes related to affinity's issue * Update build pipeline * Revert back InProcessTest * Prepare to pull request * Get rid of spaces * Ignore Pack step on pull request's build * Ignore Pack step on pull request's build * Preparation to upcoming updates to all Travis CI Ubuntu Trusty 14.04 images * Update version of CakeBuild tool. Introduce a SkipTests flag '--SkipTests=True' Allow to pack artifacts locally '-Target Pack` * Disable version number auto-increment on pull requests. Update fsharp project. * Update CakeBuild to 0.21.1 * Update 'Building' guide (add CakeBuild option)
2017-07-17 23:11:30 +03:00
Remove-PathVariable "$InstallPath"
$env:PATH = "$InstallPath;$env:PATH"
Cake (C# Make) integration. Migration from custom build scripts. (#475) * First version of new build approach with cakebuild * Remove some unused comments/splitters in cakebuild file * Change filter condition in cakebuild script * Split to fast and slow test categories * ! Disable slow tests for setting purposes. Add travis ci integration. Add cake bootstrapper script for Linux and OS X. * Turn on mono version to latest. Migrate from xbuild to msbuild on Linux / macOS. * Remove appveyor cache. Add condition to run a pack step only on CI * Add empty vbproj and temporary exclude previous one * Add hack to exclude vbproj from build process * Revert "Add empty vbproj and temporary exclude previous one" This reverts commit 9920cc01bf56ab2d066a1738bc03e396c782b435. * Add verbosity and fix syntax * Specify pack's step condition * Enable test run for slow tests. Disable linux on travis build * Only unit tests * SlowTests only on appveyor * Allow SlowTests on windows local build * New approach to remove and restore projects from solution file * Fix cakebuild error * Add linux as build platform * Turn off osx to debug linux * Try to hack msbuild on linux * Disable diagnostic mode and return back osx integration * Fix possible inconsistent state in case of build errors * [Fix] in MemoryDiagnoserTests to split full .net framework and netcoreapp. [Fix] in InProcessTests to avoid unhandled exception on netcoreapp target framework. Simplify buildcake steps. * Add missed namespace * Add required openssl installation step for travis CI * Revert back changes related to affinity's issue * Update build pipeline * Revert back InProcessTest * Prepare to pull request * Get rid of spaces * Ignore Pack step on pull request's build * Ignore Pack step on pull request's build * Preparation to upcoming updates to all Travis CI Ubuntu Trusty 14.04 images * Update version of CakeBuild tool. Introduce a SkipTests flag '--SkipTests=True' Allow to pack artifacts locally '-Target Pack` * Disable version number auto-increment on pull requests. Update fsharp project. * Update CakeBuild to 0.21.1 * Update 'Building' guide (add CakeBuild option)
2017-07-17 23:11:30 +03:00
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
$env:DOTNET_MULTILEVEL_LOOKUP=0
Cake (C# Make) integration. Migration from custom build scripts. (#475) * First version of new build approach with cakebuild * Remove some unused comments/splitters in cakebuild file * Change filter condition in cakebuild script * Split to fast and slow test categories * ! Disable slow tests for setting purposes. Add travis ci integration. Add cake bootstrapper script for Linux and OS X. * Turn on mono version to latest. Migrate from xbuild to msbuild on Linux / macOS. * Remove appveyor cache. Add condition to run a pack step only on CI * Add empty vbproj and temporary exclude previous one * Add hack to exclude vbproj from build process * Revert "Add empty vbproj and temporary exclude previous one" This reverts commit 9920cc01bf56ab2d066a1738bc03e396c782b435. * Add verbosity and fix syntax * Specify pack's step condition * Enable test run for slow tests. Disable linux on travis build * Only unit tests * SlowTests only on appveyor * Allow SlowTests on windows local build * New approach to remove and restore projects from solution file * Fix cakebuild error * Add linux as build platform * Turn off osx to debug linux * Try to hack msbuild on linux * Disable diagnostic mode and return back osx integration * Fix possible inconsistent state in case of build errors * [Fix] in MemoryDiagnoserTests to split full .net framework and netcoreapp. [Fix] in InProcessTests to avoid unhandled exception on netcoreapp target framework. Simplify buildcake steps. * Add missed namespace * Add required openssl installation step for travis CI * Revert back changes related to affinity's issue * Update build pipeline * Revert back InProcessTest * Prepare to pull request * Get rid of spaces * Ignore Pack step on pull request's build * Ignore Pack step on pull request's build * Preparation to upcoming updates to all Travis CI Ubuntu Trusty 14.04 images * Update version of CakeBuild tool. Introduce a SkipTests flag '--SkipTests=True' Allow to pack artifacts locally '-Target Pack` * Disable version number auto-increment on pull requests. Update fsharp project. * Update CakeBuild to 0.21.1 * Update 'Building' guide (add CakeBuild option)
2017-07-17 23:11:30 +03:00
###########################################################################
# INSTALL NUGET
###########################################################################
# Make sure nuget.exe exists.
$NugetPath = Join-Path $ToolPath "nuget.exe"
if (!(Test-Path $NugetPath)) {
Write-Host "Downloading NuGet.exe..."
(New-Object System.Net.WebClient).DownloadFile($NugetUrl, $NugetPath);
}
###########################################################################
# INSTALL CAKE
###########################################################################
# Make sure Cake has been installed.
$CakePath = Join-Path $ToolPath "Cake.$CakeVersion/Cake.exe"
if (!(Test-Path $CakePath)) {
Write-Host "Installing Cake..."
Invoke-Expression "&`"$NugetPath`" install Cake -Version $CakeVersion -OutputDirectory `"$ToolPath`"" | Out-Null;
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring Cake from NuGet."
Cake (C# Make) integration. Migration from custom build scripts. (#475) * First version of new build approach with cakebuild * Remove some unused comments/splitters in cakebuild file * Change filter condition in cakebuild script * Split to fast and slow test categories * ! Disable slow tests for setting purposes. Add travis ci integration. Add cake bootstrapper script for Linux and OS X. * Turn on mono version to latest. Migrate from xbuild to msbuild on Linux / macOS. * Remove appveyor cache. Add condition to run a pack step only on CI * Add empty vbproj and temporary exclude previous one * Add hack to exclude vbproj from build process * Revert "Add empty vbproj and temporary exclude previous one" This reverts commit 9920cc01bf56ab2d066a1738bc03e396c782b435. * Add verbosity and fix syntax * Specify pack's step condition * Enable test run for slow tests. Disable linux on travis build * Only unit tests * SlowTests only on appveyor * Allow SlowTests on windows local build * New approach to remove and restore projects from solution file * Fix cakebuild error * Add linux as build platform * Turn off osx to debug linux * Try to hack msbuild on linux * Disable diagnostic mode and return back osx integration * Fix possible inconsistent state in case of build errors * [Fix] in MemoryDiagnoserTests to split full .net framework and netcoreapp. [Fix] in InProcessTests to avoid unhandled exception on netcoreapp target framework. Simplify buildcake steps. * Add missed namespace * Add required openssl installation step for travis CI * Revert back changes related to affinity's issue * Update build pipeline * Revert back InProcessTest * Prepare to pull request * Get rid of spaces * Ignore Pack step on pull request's build * Ignore Pack step on pull request's build * Preparation to upcoming updates to all Travis CI Ubuntu Trusty 14.04 images * Update version of CakeBuild tool. Introduce a SkipTests flag '--SkipTests=True' Allow to pack artifacts locally '-Target Pack` * Disable version number auto-increment on pull requests. Update fsharp project. * Update CakeBuild to 0.21.1 * Update 'Building' guide (add CakeBuild option)
2017-07-17 23:11:30 +03:00
}
}
###########################################################################
# RUN BUILD SCRIPT
###########################################################################
# Build the argument list.
$Arguments = @{
target=$Target;
configuration=$Configuration;
verbosity=$Verbosity;
dryrun=$WhatIf;
}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value };
# Start Cake
Write-Host "Running build script..."
Invoke-Expression "& `"$CakePath`" `"build.cake`" $Arguments $ScriptArgs"
exit $LASTEXITCODE