Created
October 8, 2017 19:03
-
-
Save litichevskiydv/5730376e407c4a11413a7bbd274d1ca6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
Param( | |
[string]$Script = "build.cake", | |
[string]$Target = "Default", | |
[ValidateSet("Release", "Debug")] | |
[string]$Configuration = "Release", | |
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] | |
[string]$Verbosity = "Verbose", | |
[Alias("DryRun","Noop")] | |
[switch]$WhatIf, | |
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] | |
[string[]]$ScriptArgs | |
) | |
Write-Host "Preparing to run build script..." | |
if(!$PSScriptRoot){ | |
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | |
} | |
$TOOLS_DIR = Join-Path $PSScriptRoot "tools" | |
$TEMP_DIR = Join-Path $PSScriptRoot "tmp" | |
$TEMP_PROJECT = Join-Path $TEMP_DIR "tmp.csproj" | |
# Is this a dry run? | |
$UseDryRun = ""; | |
if($WhatIf.IsPresent) { | |
$UseDryRun = "--dryrun" | |
} | |
& dotnet new classlib -o "$TEMP_DIR" --no-restore | |
& dotnet add "$TEMP_PROJECT" package --package-directory "$TOOLS_DIR" Cake.CoreCLR | |
Remove-Item -Recurse -Force "$TEMP_DIR" | |
$CakePath = Get-ChildItem -Filter Cake.dll -Recurse | Sort-Object -Descending | Select-Object -Expand FullName -first 1 | |
Write-Host "Running build script..." | |
& dotnet "$CakePath" $Script --nuget_useinprocessclient=true --target=$Target --configuration=$Configuration --verbosity=$Verbosity $UseDryRun $ScriptArgs | |
exit $LASTEXITCODE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment