Skip to content

Commit

Permalink
(build) Updated cake bootstrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm committed Jul 8, 2020
1 parent 0bd6508 commit 1fb08b5
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 24 deletions.
4 changes: 2 additions & 2 deletions build.config
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DOTNET_SDKS=3.0.103,2.1.802
CAKE_VERSION=0.37.0
DOTNET_SDKS=3.1.301,2.1.807
CAKE_VERSION=0.38.4
55 changes: 33 additions & 22 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Definition
$TOOLS_DIR="$SCRIPT_DIR/tools"
$TOOLS_DIR = "$SCRIPT_DIR/tools"
if ($IsMacOS -or $IsLinux) {
$CAKE_EXE="$TOOLS_DIR/dotnet-cake"
} else {
$CAKE_EXE="$TOOLS_DIR/dotnet-cake.exe"
$CAKE_EXE = "$TOOLS_DIR/dotnet-cake"
}
else {
$CAKE_EXE = "$TOOLS_DIR/dotnet-cake.exe"
}

$DOTNET_EXE="$(Get-Command dotnet -ea 0 | select -Expand Source)"
$INSTALL_NETCORE=$false
[string[]]$DOTNET_SDKS=""
[string]$CAKE_VERSION=""
$DOTNET_EXE = "$(Get-Command dotnet -ea 0 | select -Expand Source)"
$INSTALL_NETCORE = $false
[string[]]$DOTNET_SDKS = ""
[string]$CAKE_VERSION = ""
foreach ($line in Get-Content "$SCRIPT_DIR/build.config" -Encoding utf8) {
if ($line -like "CAKE_VERSION=*") {
$CAKE_VERSION=$line.Substring($line.IndexOf('=') + 1)
$CAKE_VERSION = $line.Substring($line.IndexOf('=') + 1)
}
elseif ($line -like "DOTNET_SDKS=*") {
$DOTNET_SDKS=$line.Substring($line.IndexOf('=') + 1) -split ','
$DOTNET_SDKS = $line.Substring($line.IndexOf('=') + 1) -split ','
}
}

Expand All @@ -24,8 +25,14 @@ if ([string]::IsNullOrWhiteSpace($CAKE_VERSION) -or !$DOTNET_SDKS) {
exit 1
}

if (Test-Path "$SCRIPT_DIR/.dotnet") {
$env:PATH = "$SCRIPT_DIR/.dotnet${PathSep}${env:PATH}"
$env:DOTNET_ROOT = "$SCRIPT_DIR/.dotnet"
$DOTNET_EXE = Get-ChildItem -Path "$SCRIPT_DIR/.dotnet/dotnet*" -Exclude "*.ps1" | select -First 1 -Expand FullName
}

if ([string]::IsNullOrWhiteSpace($DOTNET_EXE)) {
$INSTALL_NETCORE=$true
$INSTALL_NETCORE = $true
}
elseif (($DOTNET_SDKS | ? { $_ -ne 'ANY' })) {
foreach ($sdk in $DOTNET_SDKS) {
Expand Down Expand Up @@ -53,7 +60,8 @@ if ($true -eq $INSTALL_NETCORE) {
$ScriptUrl = "https://dot.net/v1/dotnet-install.sh"
$LaunchUrl = "$(Get-Command bash)"
$PathSep = ":"
} else {
}
else {
$ScriptPath = "$SCRIPT_DIR/.dotnet/dotnet-install.ps1"
$ScriptUrl = "https://dot.net/v1/dotnet-install.ps1"
$LaunchUrl = "$ScriptPath"
Expand All @@ -75,11 +83,12 @@ if ($true -eq $INSTALL_NETCORE) {
"$DOTNET_VERSION"
)
}
} else {
}
else {
$arguments = @{
InstallDir = "$SCRIPT_DIR/.dotnet"
NoPath = $true
Version = "$DOTNET_VERSION"
NoPath = $true
Version = "$DOTNET_VERSION"
}
}

Expand All @@ -89,21 +98,23 @@ if ($true -eq $INSTALL_NETCORE) {
$env:PATH = "$SCRIPT_DIR/.dotnet${PathSep}${env:PATH}"
$env:DOTNET_ROOT = "$SCRIPT_DIR/.dotnet"

$DOTNET_EXE = Get-ChildItem -Path "$SCRIPT_DIR/.dotnet" -Filter "dotnet*" | select -First 1 -Expand FullName
$DOTNET_EXE = Get-ChildItem -Path "$SCRIPT_DIR/.dotnet/dotnet*" -Exclude "*.ps1" | select -First 1 -Expand FullName

} elseif (Test-Path "/opt/dotnet/sdk" -ea 0) {
}
elseif (Test-Path "/opt/dotnet/sdk" -ea 0) {
$env:DOTNET_ROOT = "/opt/dotnet/sdk"
}

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
$env:DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER = 0

$CAKE_INSTALLED_VERSION= Get-Command dotnet-cake -ea 0 | % { & $_.Source --version }
$CAKE_INSTALLED_VERSION = Get-Command dotnet-cake -ea 0 | % { & $_.Source --version }

if ($CAKE_INSTALLED_VERSION -eq $CAKE_VERSION) {
$CAKE_EXE = Get-Command dotnet-cake | % Source
} else {
}
else {
$CakePath = "$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION"
$CAKE_EXE = (Get-ChildItem -Path $TOOLS_DIR -Filter "dotnet-cake*" -File -ea 0 | select -First 1 -Expand FullName)

Expand Down
6 changes: 6 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ if [ "$CAKE_VERSION" = "" ] || [ "$DOTNET_SDKS" = "" ]; then
exit 1
fi

if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then
DOTNET_EXE="$SCRIPT_DIR/.dotnet/dotnet"
export PATH="$SCRIPT_DIR/.dotnet:$PATH"
export DOTNET_ROOT="$SCRIPT_DIR/.dotnet"
fi

if [ "$DOTNET_EXE" = "" ]; then
INSTALL_NETCORE=1
elif [ "$DOTNET_SDKS" != "" ]; then
Expand Down

0 comments on commit 1fb08b5

Please sign in to comment.