diff --git a/build.ps1 b/build.ps1 index 8eb37f2de6..2dbd10a150 100755 --- a/build.ps1 +++ b/build.ps1 @@ -1,4 +1,27 @@ +[CmdletBinding()] +Param( + [string]$Target, + [string]$Configuration, + [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] + [string]$Verbosity, + [switch]$ShowDescription, + [Alias("WhatIf", "Noop")] + [switch]$DryRun, + [Parameter(Position = 0, Mandatory = $false, ValueFromRemainingArguments = $true)] + [string[]]$ScriptArgs +) + +# Build Cake arguments +$cakeArguments = ""; +if ($Target) { $cakeArguments += "-target=$Target" } +if ($Configuration) { $cakeArguments += "-configuration=$Configuration" } +if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } +if ($ShowDescription) { $cakeArguments += "-showdescription" } +if ($DryRun) { $cakeArguments += "-dryrun" } +if ($Experimental) { $cakeArguments += "-experimental" } +$cakeArguments += $ScriptArgs + dotnet tool install Cake.Tool --global --version 0.35.0 dotnet cake ./build/build.cake --bootstrap -dotnet cake ./build/build.cake +dotnet cake ./build/build.cake $cakeArguments exit $LASTEXITCODE \ No newline at end of file diff --git a/build.sh b/build.sh index d20a9c12fa..ac6bd877a6 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,17 @@ +echo "Installing Cake.Tool..." dotnet tool install Cake.Tool --global --version 0.35.0 + +# Parse arguments. +CAKE_ARGUMENTS=() +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + --) shift; CAKE_ARGUMENTS+=("$@"); break ;; + *) CAKE_ARGUMENTS+=("$1") ;; + esac + shift +done + +echo "Running build script..." dotnet cake ./build/build.cake --bootstrap -dotnet cake ./build/build.cake \ No newline at end of file +dotnet cake ./build/build.cake "${CAKE_ARGUMENTS[@]}" \ No newline at end of file