Skip to content

Commit

Permalink
Adjusted cake
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRappl committed May 19, 2021
1 parent d3ec0ab commit 8136896
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
38 changes: 25 additions & 13 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,53 @@ Param(
)

$PSScriptRoot = split-path -parent $MyInvocation.MyCommand.Definition;
$UseDryRun = "";
$UseMono = "";
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$NUGET_OLD_EXE = Join-Path $TOOLS_DIR "nuget_old.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$NUGET_OLD_URL = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe"

# Should we use experimental build of Roslyn?
$UseExperimental = "";
if($Experimental.IsPresent) {
$UseExperimental = "-experimental"
if ($Experimental.IsPresent) {
$UseExperimental = "--experimental"
}

# Is this a dry run?
$UseDryRun = "";
if($WhatIf.IsPresent) {
$UseDryRun = "-dryrun"
if ($WhatIf.IsPresent) {
$UseDryRun = "--dryrun"
}

# Should we use mono?
$UseMono = "";
if($Mono.IsPresent) {
$UseMono = "-mono"
if ($Mono.IsPresent) {
$UseMono = "--mono"
}

# Try download NuGet.exe if do not exist.
if (!(Test-Path $NUGET_EXE)) {
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
}

# Make sure NuGet exists where we expect it.
# Try download NuGet.exe if do not exist.
if (!(Test-Path $NUGET_OLD_URL)) {
(New-Object System.Net.WebClient).DownloadFile($NUGET_OLD_URL, $NUGET_OLD_EXE)
}

# Make sure NuGet (latest) exists where we expect it.
if (!(Test-Path $NUGET_EXE)) {
Throw "Could not find NuGet.exe"
Throw "Could not find nuget.exe"
}

# Make sure NuGet (v3.5.0) exists where we expect it.
if (!(Test-Path $NUGET_OLD_EXE)) {
Throw "Could not find nuget_old.exe"
}

# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent)
if (-Not $SkipToolPackageRestore.IsPresent)
{
Push-Location
Set-Location $TOOLS_DIR
Expand All @@ -65,5 +77,5 @@ if (!(Test-Path $CAKE_EXE)) {
}

# Start Cake
Invoke-Expression "$CAKE_EXE `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
exit $LASTEXITCODE
Invoke-Expression "$CAKE_EXE `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
exit $LASTEXITCODE
2 changes: 1 addition & 1 deletion build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ fi
if $SHOW_VERSION; then
exec mono $CAKE_EXE -version
else
exec mono $CAKE_EXE $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
exec mono $CAKE_EXE $SCRIPT --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
fi

0 comments on commit 8136896

Please sign in to comment.