Merge pull request #544 from piotrpMSFT/piotrpMSFT/260/offlineBuilds
Offline builds. Fixes #260. On Windows, build.cmd -Offline @brthor is adding a parameter option for Linux/Mac
This commit is contained in:
commit
f17a2dbb93
4 changed files with 76 additions and 54 deletions
10
build.sh
10
build.sh
|
@ -4,7 +4,8 @@
|
||||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
#
|
#
|
||||||
|
|
||||||
# $1 is passed to package to enable deb or pkg packaging
|
# Set OFFLINE environment variable to build offline
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
SOURCE="${BASH_SOURCE[0]}"
|
SOURCE="${BASH_SOURCE[0]}"
|
||||||
|
@ -27,12 +28,19 @@ do
|
||||||
debug)
|
debug)
|
||||||
export CONFIGURATION=Debug
|
export CONFIGURATION=Debug
|
||||||
;;
|
;;
|
||||||
|
offline)
|
||||||
|
export OFFLINE=true
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -z "$CONFIGURATION" ] && CONFIGURATION=Debug
|
[ -z "$CONFIGURATION" ] && CONFIGURATION=Debug
|
||||||
|
|
||||||
|
if [ ! -z "$OFFLINE" ]; then
|
||||||
|
header " - Offline Build - "
|
||||||
|
fi
|
||||||
|
|
||||||
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
# Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot
|
||||||
export DOTNET_INSTALL_DIR=$DIR/.dotnet_stage0/$RID
|
export DOTNET_INSTALL_DIR=$DIR/.dotnet_stage0/$RID
|
||||||
[ -d $DOTNET_INSTALL_DIR ] || mkdir -p $DOTNET_INSTALL_DIR
|
[ -d $DOTNET_INSTALL_DIR ] || mkdir -p $DOTNET_INSTALL_DIR
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
param(
|
param(
|
||||||
[string]$Configuration="Debug")
|
[string]$Configuration="Debug",
|
||||||
|
[switch]$Offline)
|
||||||
|
|
||||||
. "$PSScriptRoot\_common.ps1"
|
. "$PSScriptRoot\_common.ps1"
|
||||||
|
|
||||||
|
@ -35,7 +36,11 @@ if (!$env:DOTNET_BUILD_VERSION) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host -ForegroundColor Green "*** Building dotnet tools version $($env:DOTNET_BUILD_VERSION) - $Configuration ***"
|
Write-Host -ForegroundColor Green "*** Building dotnet tools version $($env:DOTNET_BUILD_VERSION) - $Configuration ***"
|
||||||
& "$PSScriptRoot\compile.ps1" -Configuration:$Configuration
|
if ($Offline)
|
||||||
|
{
|
||||||
|
Write-Host -ForegroundColor Yellow " - Offline Build -"
|
||||||
|
}
|
||||||
|
& "$PSScriptRoot\compile.ps1" -Configuration:$Configuration -Offline:$Offline
|
||||||
if (!$?) {
|
if (!$?) {
|
||||||
Write-Host "Building dotnet tools finished with errors."
|
Write-Host "Building dotnet tools finished with errors."
|
||||||
Exit 1
|
Exit 1
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
#
|
#
|
||||||
|
|
||||||
param([string]$Configuration = "Debug")
|
param([string]$Configuration = "Debug",
|
||||||
|
[switch]$Offline)
|
||||||
|
|
||||||
$ErrorActionPreference="Stop"
|
$ErrorActionPreference="Stop"
|
||||||
|
|
||||||
|
@ -23,40 +24,44 @@ Download it from https://www.cmake.org
|
||||||
"@
|
"@
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install a stage 0
|
if($Offline){
|
||||||
header "Installing dotnet stage 0"
|
Write-Host "Skipping Stage 0, Dnx, and Packages dowlnoad: Offline build"
|
||||||
& "$PSScriptRoot\install.ps1"
|
|
||||||
if (!$?) {
|
|
||||||
Write-Host "Command failed: $PSScriptRoot\install.ps1"
|
|
||||||
Exit 1
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
# Put stage 0 on the path
|
# Install a stage 0
|
||||||
$DotNetTools = $env:DOTNET_INSTALL_DIR
|
header "Installing dotnet stage 0"
|
||||||
if (!$DotNetTools) {
|
& "$PSScriptRoot\install.ps1"
|
||||||
$DotNetTools = "$($env:LOCALAPPDATA)\Microsoft\dotnet"
|
if (!$?) {
|
||||||
|
Write-Host "Command failed: $PSScriptRoot\install.ps1"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Put stage 0 on the path
|
||||||
|
$DotNetTools = $env:DOTNET_INSTALL_DIR
|
||||||
|
if (!$DotNetTools) {
|
||||||
|
$DotNetTools = "$($env:LOCALAPPDATA)\Microsoft\dotnet"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Download dnx to copy to stage2
|
||||||
|
if ((Test-Path "$DnxDir")) {
|
||||||
|
Remove-Item -Recurse -Force $DnxDir
|
||||||
|
}
|
||||||
|
mkdir "$DnxDir" | Out-Null
|
||||||
|
$DnxUrl="https://api.nuget.org/packages/dnx-coreclr-win-x64.$DnxVersion.nupkg"
|
||||||
|
Invoke-WebRequest -UseBasicParsing "$DnxUrl" -OutFile "$DnxDir\dnx.zip"
|
||||||
|
Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null
|
||||||
|
[System.IO.Compression.ZipFile]::ExtractToDirectory("$DnxDir\dnx.zip", "$DnxDir")
|
||||||
|
$DnxRoot = "$DnxDir/bin"
|
||||||
|
|
||||||
|
# Restore packages
|
||||||
|
header "Restoring packages"
|
||||||
|
& "$DnxRoot\dnu" restore "$RepoRoot" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache
|
||||||
|
if (!$?) {
|
||||||
|
Write-Host "Command failed: " dotnet restore "$RepoRoot" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download dnx to copy to stage2
|
|
||||||
if ((Test-Path "$DnxDir")) {
|
|
||||||
Remove-Item -Recurse -Force $DnxDir
|
|
||||||
}
|
|
||||||
mkdir "$DnxDir" | Out-Null
|
|
||||||
$DnxUrl="https://api.nuget.org/packages/dnx-coreclr-win-x64.$DnxVersion.nupkg"
|
|
||||||
Invoke-WebRequest -UseBasicParsing "$DnxUrl" -OutFile "$DnxDir\dnx.zip"
|
|
||||||
Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null
|
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("$DnxDir\dnx.zip", "$DnxDir")
|
|
||||||
$DnxRoot = "$DnxDir/bin"
|
|
||||||
|
|
||||||
# Restore packages
|
|
||||||
header "Restoring packages"
|
|
||||||
& "$DnxRoot\dnu" restore "$RepoRoot" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache
|
|
||||||
if (!$?) {
|
|
||||||
Write-Host "Command failed: " dotnet restore "$RepoRoot" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache
|
|
||||||
Exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
header "Building corehost"
|
header "Building corehost"
|
||||||
pushd "$RepoRoot\src\corehost"
|
pushd "$RepoRoot\src\corehost"
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -25,30 +25,34 @@ fi
|
||||||
|
|
||||||
[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug
|
[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug
|
||||||
|
|
||||||
# Download DNX to copy into stage2
|
if [[ ! -z "$OFFLINE" ]]; then
|
||||||
header "Downloading DNX $DNX_VERSION"
|
header "Skipping Stage 0, Dnx, and Packages download: Offline Build"
|
||||||
DNX_URL="https://api.nuget.org/packages/$DNX_FLAVOR.$DNX_VERSION.nupkg"
|
else
|
||||||
DNX_ROOT="$DNX_DIR/bin"
|
# Download DNX to copy into stage2
|
||||||
rm -rf $DNX_DIR
|
header "Downloading DNX $DNX_VERSION"
|
||||||
mkdir -p $DNX_DIR
|
DNX_URL="https://api.nuget.org/packages/$DNX_FLAVOR.$DNX_VERSION.nupkg"
|
||||||
curl -o $DNX_DIR/dnx.zip $DNX_URL --silent
|
DNX_ROOT="$DNX_DIR/bin"
|
||||||
unzip -qq $DNX_DIR/dnx.zip -d $DNX_DIR
|
rm -rf $DNX_DIR
|
||||||
chmod a+x $DNX_ROOT/dnu $DNX_ROOT/dnx
|
mkdir -p $DNX_DIR
|
||||||
|
curl -o $DNX_DIR/dnx.zip $DNX_URL --silent
|
||||||
|
unzip -qq $DNX_DIR/dnx.zip -d $DNX_DIR
|
||||||
|
chmod a+x $DNX_ROOT/dnu $DNX_ROOT/dnx
|
||||||
|
|
||||||
# Ensure the latest stage0 is installed
|
# Ensure the latest stage0 is installed
|
||||||
$DIR/install.sh
|
$DIR/install.sh
|
||||||
|
|
||||||
# And put the stage0 on the PATH
|
# And put the stage0 on the PATH
|
||||||
export PATH=$REPOROOT/artifacts/$RID/stage0/bin:$PATH
|
export PATH=$REPOROOT/artifacts/$RID/stage0/bin:$PATH
|
||||||
|
|
||||||
# Intentionally clear the DOTNET_TOOLS path, we want to use the default installed version
|
# Intentionally clear the DOTNET_TOOLS path, we want to use the default installed version
|
||||||
unset DOTNET_TOOLS
|
unset DOTNET_TOOLS
|
||||||
|
|
||||||
DOTNET_PATH=$(which dotnet)
|
DOTNET_PATH=$(which dotnet)
|
||||||
PREFIX="$(cd -P "$(dirname "$DOTNET_PATH")/.." && pwd)"
|
PREFIX="$(cd -P "$(dirname "$DOTNET_PATH")/.." && pwd)"
|
||||||
|
|
||||||
header "Restoring packages"
|
header "Restoring packages"
|
||||||
$DNX_ROOT/dnu restore "$REPOROOT" --quiet --runtime "$RID" --no-cache
|
$DNX_ROOT/dnu restore "$REPOROOT" --quiet --runtime "$RID" --no-cache
|
||||||
|
fi
|
||||||
|
|
||||||
header "Building corehost"
|
header "Building corehost"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue