Port https://github.com/dotnet/core-setup/pull/159 to CLI
This commit is contained in:
parent
18c8a2724a
commit
dfe99ca45d
2 changed files with 29 additions and 0 deletions
|
@ -10,6 +10,21 @@ param(
|
||||||
[switch]$NoPackage,
|
[switch]$NoPackage,
|
||||||
[switch]$Help)
|
[switch]$Help)
|
||||||
|
|
||||||
|
function RemoveDirectory([string] $path)
|
||||||
|
{
|
||||||
|
if (Test-Path $path)
|
||||||
|
{
|
||||||
|
Remove-Item $path -Recurse -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function CleanNuGet()
|
||||||
|
{
|
||||||
|
RemoveDirectory($env:LocalAppData + "\NuGet\Cache")
|
||||||
|
RemoveDirectory($env:LocalAppData + "\NuGet\v3-cache")
|
||||||
|
RemoveDirectory($env:NUGET_PACKAGES)
|
||||||
|
}
|
||||||
|
|
||||||
if($Help)
|
if($Help)
|
||||||
{
|
{
|
||||||
Write-Host "Usage: .\build.ps1 [-Configuration <CONFIGURATION>] [-NoPackage] [-Help] [-Targets <TARGETS...>]"
|
Write-Host "Usage: .\build.ps1 [-Configuration <CONFIGURATION>] [-NoPackage] [-Help] [-Targets <TARGETS...>]"
|
||||||
|
@ -63,6 +78,12 @@ if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
|
||||||
# Put the stage0 on the path
|
# Put the stage0 on the path
|
||||||
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
|
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
|
||||||
|
|
||||||
|
# Ensure clean package folder and caches
|
||||||
|
CleanNuGet
|
||||||
|
|
||||||
|
# Disable first run since we want to control all package sources
|
||||||
|
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
|
|
||||||
# Restore the build scripts
|
# Restore the build scripts
|
||||||
Write-Host "Restoring Build Script projects..."
|
Write-Host "Restoring Build Script projects..."
|
||||||
pushd "$PSScriptRoot\.."
|
pushd "$PSScriptRoot\.."
|
||||||
|
|
|
@ -101,6 +101,14 @@ then
|
||||||
ulimit -n 1024
|
ulimit -n 1024
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Clean old NuGet packages
|
||||||
|
rm -rf "$HOME/.local/share/NuGet/Cache"
|
||||||
|
rm -rf "$HOME/.local/share/NuGet/v3-cache"
|
||||||
|
rm -rf "$NUGET_PACKAGES"
|
||||||
|
|
||||||
|
# Disable first run since we want to control all package sources
|
||||||
|
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
|
|
||||||
# Restore the build scripts
|
# Restore the build scripts
|
||||||
echo "Restoring Build Script projects..."
|
echo "Restoring Build Script projects..."
|
||||||
(
|
(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue