Make build.cmd and build.sh work

This commit is contained in:
David Fowler 2015-10-18 23:29:51 -07:00
parent f24aeae6b2
commit aaecae7824
4 changed files with 20 additions and 71 deletions

View file

@ -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%

View file

@ -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

View file

@ -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

View file

@ -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