download dnx during the build

This commit is contained in:
Bryan 2015-12-08 18:54:02 -08:00 committed by Bryan Thornbury
parent 16fa836215
commit 1d764f1c64
8 changed files with 31 additions and 34 deletions

View file

@ -6,9 +6,11 @@
$Rid = "win7-x64" $Rid = "win7-x64"
$Tfm = "dnxcore50" $Tfm = "dnxcore50"
$RepoRoot = Convert-Path "$PSScriptRoot\.." $DnxVersion = "1.0.0-rc1-update1"
$RepoRoot = Convert-Path "$PSScriptRoot\.."
$OutputDir = "$RepoRoot\artifacts\$Rid" $OutputDir = "$RepoRoot\artifacts\$Rid"
$DnxDir = "$OutputDir\dnx"
$Stage1Dir = "$OutputDir\stage1" $Stage1Dir = "$OutputDir\stage1"
$Stage2Dir = "$OutputDir\stage2" $Stage2Dir = "$OutputDir\stage2"
$HostDir = "$OutputDir\corehost" $HostDir = "$OutputDir\corehost"

View file

@ -77,16 +77,20 @@ if [ -z "$RID" ]; then
if [ "$UNAME" == "Darwin" ]; then if [ "$UNAME" == "Darwin" ]; then
export OSNAME=osx export OSNAME=osx
export RID=osx.10.10-x64 export RID=osx.10.10-x64
export DNX_FLAVOR="dnx-coreclr-darwin-x64"
elif [ "$UNAME" == "Linux" ]; then elif [ "$UNAME" == "Linux" ]; then
# Detect Distro? # Detect Distro?
export OSNAME=linux export OSNAME=linux
export RID=ubuntu.14.04-x64 export RID=ubuntu.14.04-x64
export DNX_FLAVOR="dnx-coreclr-linux-x64"
else else
error "unknown OS: $UNAME" 1>&2 error "unknown OS: $UNAME" 1>&2
exit 1 exit 1
fi fi
fi fi
export DNX_VERSION="1.0.0-rc1-update1"
export REPOROOT=$(cd $COMMONDIR/.. && pwd) export REPOROOT=$(cd $COMMONDIR/.. && pwd)
export OUTPUT_ROOT=$REPOROOT/artifacts/$RID export OUTPUT_ROOT=$REPOROOT/artifacts/$RID
export DNX_DIR=$OUTPUT_ROOT/dnx export DNX_DIR=$OUTPUT_ROOT/dnx

View file

@ -31,27 +31,26 @@ Download it from https://www.cmake.org
Exit 1 Exit 1
} }
# Put stage 0 on the path # Put stage 0 on the path
$DotNetTools = $env:DOTNET_INSTALL_DIR $DotNetTools = $env:DOTNET_INSTALL_DIR
if (!$DotNetTools) { if (!$DotNetTools) {
$DotNetTools = "$($env:LOCALAPPDATA)\Microsoft\dotnet" $DotNetTools = "$($env:LOCALAPPDATA)\Microsoft\dotnet"
} }
if (Test-Path "$DotNetTools\cli\dotnet.exe") { # Download dnx to copy to stage2
Write-Warning "Your stage0 is using the old layout" if ((Test-Path "$DnxDir")) {
$DnxDir = "$DotNetTools\cli\dnx" Remove-Item -Recurse -Force $DnxDir
$env:PATH = "$DotNetTools\cli;$StartPath"
} elseif (Test-Path "$DotNetTools\cli\bin\dotnet.exe") {
$DnxDir = "$DotNetTools\cli\bin\dnx"
$env:PATH = "$DotNetTools\cli\bin;$StartPath"
} else {
throw "Couldn't find stage0 dotnet tools!"
} }
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 # Restore packages
header "Restoring packages" header "Restoring packages"
dotnet restore "$RepoRoot" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache & "$DnxRoot\dnu" restore "$RepoRoot" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache
if (!$?) { if (!$?) {
Write-Host "Command failed: " dotnet restore "$RepoRoot" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache 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 Exit 1
@ -118,7 +117,7 @@ Download it from https://www.cmake.org
# Copy dnx into stage 2 # Copy dnx into stage 2
cp -rec "$DnxDir\" "$Stage2Dir\bin\dnx\" cp -rec "$DnxRoot\" "$Stage2Dir\bin\dnx\"
# Copy in the dotnet-restore script # Copy in the dotnet-restore script
cp "$PSScriptRoot\dotnet-restore.cmd" "$Stage2Dir\bin\dotnet-restore.cmd" cp "$PSScriptRoot\dotnet-restore.cmd" "$Stage2Dir\bin\dotnet-restore.cmd"

View file

@ -13,7 +13,6 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
REPOROOT="$( cd -P "$DIR/.." && pwd )"
source "$DIR/_common.sh" source "$DIR/_common.sh"
@ -26,7 +25,15 @@ fi
[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug [ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug
REPOROOT="$( cd -P "$DIR/.." && pwd )" # Download DNX to copy into stage2
header "Downloading DNX $DNX_VERSION"
DNX_URL="https://api.nuget.org/packages/$DNX_FLAVOR.$DNX_VERSION.nupkg"
DNX_ROOT="$DNX_DIR/bin"
rm -rf $DNX_DIR
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
@ -39,19 +46,9 @@ 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)"
DNX_ROOT="$PREFIX/share/dotnet/cli/bin/dnx"
if [ ! -d "$DNX_ROOT" ]; then
echo "warning: your stage0 is using the old layout" 1>&2
DNX_ROOT="$PREFIX/share/dotnet/cli/dnx"
fi
if [ ! -d "$DNX_ROOT" ] || [ ! -e "$DNX_ROOT/dnx" ]; then
echo "error: could not find DNX in $DNX_ROOT" 1>&2
exit 1
fi
header "Restoring packages" header "Restoring packages"
dotnet restore "$REPOROOT" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache $DNX_ROOT/dnu restore "$REPOROOT" --quiet --runtime "osx.10.10-x64" --runtime "ubuntu.14.04-x64" --runtime "win7-x64" --no-cache
header "Building corehost" header "Building corehost"

View file

@ -9,7 +9,7 @@ set BIN_DIR=%CD%\bin
popd popd
REM Replace with a robust method for finding the right crossgen.exe REM Replace with a robust method for finding the right crossgen.exe
set CROSSGEN_UTIL=%UserProfile%\.dnx\packages\runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR\1.0.1-beta-23504\tools\crossgen.exe set CROSSGEN_UTIL=%UserProfile%\.dnx\packages\runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR\1.0.1-rc2-23608\tools\crossgen.exe
REM Crossgen currently requires itself to be next to mscorlib REM Crossgen currently requires itself to be next to mscorlib
copy %CROSSGEN_UTIL% /Y %BIN_DIR% > nul copy %CROSSGEN_UTIL% /Y %BIN_DIR% > nul

View file

@ -22,7 +22,7 @@ if [ -z "$RID" ]; then
fi fi
# Replace with a robust method for finding the right crossgen.exe # Replace with a robust method for finding the right crossgen.exe
CROSSGEN_UTIL=~/.dnx/packages/runtime.$RID.Microsoft.NETCore.Runtime.CoreCLR/1.0.1-beta-23504/tools/crossgen CROSSGEN_UTIL=~/.dnx/packages/runtime.$RID.Microsoft.NETCore.Runtime.CoreCLR/1.0.1-rc2-23608/tools/crossgen
cd $BIN_DIR cd $BIN_DIR

View file

@ -6,7 +6,7 @@ REM Licensed under the MIT license. See LICENSE file in the project root for ful
SETLOCAL SETLOCAL
SET ERRORLEVEL= SET ERRORLEVEL=
"%~dp0dnx\dnx" "%~dp0dnx\Microsoft.Dnx.Tooling\Microsoft.Dnx.Tooling.dll" restore %* "%~dp0dnx\dnx" "%~dp0dnx\lib\Microsoft.Dnx.Tooling\Microsoft.Dnx.Tooling.dll" restore %*
exit /b %ERRORLEVEL% exit /b %ERRORLEVEL%
ENDLOCAL ENDLOCAL

View file

@ -7,11 +7,6 @@
"dependencies": { "dependencies": {
"NETStandard.Library": "1.0.0-rc2-23608", "NETStandard.Library": "1.0.0-rc2-23608",
"System.Linq": "4.0.1-rc2-23608", "System.Linq": "4.0.1-rc2-23608",
"Microsoft.DotNet.ILCompiler": "1.0.2-*",
"Microsoft.DotNet.ObjectWriter": "1.0.2-*",
"Microsoft.DotNet.RyuJit": "1.0.0-*",
"Microsoft.DotNet.Compiler.Common": "1.0.0-*",
"Microsoft.DotNet.Cli.Utils": { "Microsoft.DotNet.Cli.Utils": {
"type": "build", "type": "build",