From aaecae782493c2dba19b31dd8aed9117d91ecf03 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Sun, 18 Oct 2015 23:29:51 -0700 Subject: [PATCH] Make build.cmd and build.sh work --- build.cmd | 37 ++++++++++--------------------------- build.sh | 38 +++----------------------------------- scripts/bootstrap | 7 +++++++ scripts/bootstrap.cmd | 9 --------- 4 files changed, 20 insertions(+), 71 deletions(-) diff --git a/build.cmd b/build.cmd index bb8b27608..bb43f50b6 100644 --- a/build.cmd +++ b/build.cmd @@ -1,31 +1,14 @@ @echo off -cd %~dp0 -SETLOCAL -SET NUGET_VERSION=latest -SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe -SET BUILDCMD_KOREBUILD_VERSION="" -SET BUILDCMD_DNX_VERSION="" - -IF EXIST %CACHED_NUGET% goto copynuget -echo Downloading latest version of NuGet.exe... -IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet -@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'" - -:copynuget -IF EXIST .nuget\nuget.exe goto restore -md .nuget -copy %CACHED_NUGET% .nuget\nuget.exe > nul - -:restore -IF EXIST packages\KoreBuild goto run -IF %BUILDCMD_KOREBUILD_VERSION%=="" ( - .nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre -) ELSE ( - .nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre +setlocal EnableDelayedExpansion +where dnvm +if %ERRORLEVEL% neq 0 ( + @powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}" + set PATH=!PATH!;!USERPROFILE!\.dnx\bin + set DNX_HOME=!USERPROFILE!\.dnx + goto continue ) -.nuget\nuget.exe install Sake -ExcludeVersion -Out packages -:run -CALL packages\KoreBuild\build\dnvm use default -runtime CoreCLR -arch x64 -packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %* +:continue +call %~dp0scripts/bootstrap +if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/build.sh b/build.sh index 3b17725fd..c76023c84 100755 --- a/build.sh +++ b/build.sh @@ -1,40 +1,8 @@ #!/usr/bin/env bash -if test `uname` = Darwin; then - cachedir=~/Library/Caches/KBuild -else - if [ -z $XDG_DATA_HOME ]; then - cachedir=$HOME/.local/share - else - cachedir=$XDG_DATA_HOME; - fi -fi -mkdir -p $cachedir -nugetVersion=latest -cachePath=$cachedir/nuget.$nugetVersion.exe - -url=https://dist.nuget.org/win-x86-commandline/$nugetVersion/nuget.exe - -if test ! -f $cachePath; then - wget -O $cachePath $url 2>/dev/null || curl -o $cachePath --location $url /dev/null -fi - -if test ! -e .nuget; then - mkdir .nuget - cp $cachePath .nuget/nuget.exe -fi - -if test ! -d packages/KoreBuild; then - mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre - mono .nuget/nuget.exe install Sake -ExcludeVersion -Out packages -fi - if ! type dnvm > /dev/null 2>&1; then - source packages/KoreBuild/build/dnvm.sh + curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh fi -if ! type dnx > /dev/null 2>&1; then - dnvm upgrade -fi - -mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@" +# bootstrap! +./scripts/bootstrap \ No newline at end of file diff --git a/scripts/bootstrap b/scripts/bootstrap index 69e756273..4558931d6 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -34,6 +34,13 @@ STAGE0_PUBLISH=$REPOROOT/scripts/stage0/dotnet-publish export DOTNET_CLR_HOSTS_PATH=$REPOROOT/ext/CLRHost/$RID export DOTNET_CSC_PATH=$REPOROOT/src/cscthingy/bin/Debug/dnxcore50/publish +echo "Installing and use-ing the latest CoreCLR x64 DNX ..." +call dnvm install latest -u -r coreclr -alias dotnet_bootstrap +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi + +call dnvm use dotnet_bootstrap -r coreclr -arch x64 +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi + type -p dnx >/dev/null if [ ! $? ]; then echo "DNX is required to bootstrap stage1" 1>&2 diff --git a/scripts/bootstrap.cmd b/scripts/bootstrap.cmd index 8bedc0fe6..e7df10dd0 100644 --- a/scripts/bootstrap.cmd +++ b/scripts/bootstrap.cmd @@ -18,10 +18,6 @@ set STAGE2_DIR=%REPOROOT%\artifacts\%RID%\stage2 where dnvm >nul 2>nul if %errorlevel% == 0 goto have_dnvm -REM download dnvm -echo Installing dnvm (DNU is needed to bootstrap currently for package restore) ... -powershell -NoProfile -ExecutionPolicy Unrestricted -Command "&{$Branch='dev';$wc=New-Object System.Net.WebClient;$wc.Proxy=[System.Net.WebRequest]::DefaultWebProxy;$wc.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;Invoke-Expression ($wc.DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}" - :have_dnvm echo Installing and use-ing the latest CoreCLR x64 DNX ... call dnvm install -nonative -u latest -r coreclr -arch x64 -alias dotnet_bootstrap @@ -69,10 +65,6 @@ set PATH=%STAGE1_DIR%;%PATH% if exist %STAGE2_DIR% rd /s /q %STAGE2_DIR% -REM This works around the coreconsole bug where the path to the exe can't be found -pushd -cd %STAGE1_DIR% - echo Building stage2 dotnet.exe ... dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%REPOROOT%\src\Microsoft.DotNet.Cli" if errorlevel 1 goto fail @@ -94,7 +86,6 @@ dotnet publish --framework dnxcore50 --runtime %RID% --output "%STAGE2_DIR%" "%R if errorlevel 1 goto fail echo Bootstrapped dotnet to %STAGE2_DIR% -popd goto end