2015-10-15 19:18:45 +00:00
|
|
|
@echo off
|
|
|
|
|
|
|
|
setlocal
|
|
|
|
|
|
|
|
REM This trick gets the absolute path from a relative path
|
|
|
|
pushd %~dp0..
|
|
|
|
set REPOROOT=%CD%
|
|
|
|
popd
|
|
|
|
|
2015-10-16 23:55:47 +00:00
|
|
|
set RID=win7-x64
|
2015-10-21 22:21:14 +00:00
|
|
|
set TFM=dnxcore50
|
2015-10-20 16:05:17 +00:00
|
|
|
set DNX_DIR=%REPOROOT%\artifacts\%RID%\dnx
|
2015-10-16 23:55:47 +00:00
|
|
|
set STAGE1_DIR=%REPOROOT%\artifacts\%RID%\stage1
|
|
|
|
set STAGE2_DIR=%REPOROOT%\artifacts\%RID%\stage2
|
2015-10-21 22:21:14 +00:00
|
|
|
set HOST_DIR=%REPOROOT%\artifacts\%RID%\corehost
|
2015-10-21 22:21:14 +00:00
|
|
|
set START_PATH=%PATH%
|
2015-10-15 19:18:45 +00:00
|
|
|
|
2015-10-21 22:21:14 +00:00
|
|
|
if "%CONFIGURATION%" equ "" set CONFIGURATION=Debug
|
|
|
|
|
2015-10-29 18:04:55 +00:00
|
|
|
call %~dp0dnvm2.cmd upgrade -a dotnet_stage0
|
2015-10-15 19:18:45 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-10-29 18:04:55 +00:00
|
|
|
REM Gross! But CMD has no other way to do this :(
|
2015-10-21 22:21:14 +00:00
|
|
|
where dotnet > "%temp%\dotnet-cli-build-temp.tmp"
|
|
|
|
set /P DOTNET_PATH= < "%temp%\dotnet-cli-build-temp.tmp"
|
|
|
|
pushd "%DOTNET_PATH%\.."
|
2015-10-29 18:04:55 +00:00
|
|
|
set STAGE0_DIR=%CD%
|
|
|
|
set DNX_ROOT=%STAGE0_DIR%\dnx
|
|
|
|
popd
|
2015-10-15 19:18:45 +00:00
|
|
|
|
2015-10-21 22:21:14 +00:00
|
|
|
echo Building corehost
|
|
|
|
set CMAKE_OUTPUT=%~dp0..\src\corehost\cmake
|
|
|
|
if not exist "%CMAKE_OUTPUT%" mkdir "%CMAKE_OUTPUT%"
|
|
|
|
pushd "%CMAKE_OUTPUT%"
|
|
|
|
cmake .. -G "Visual Studio 14 2015 Win64"
|
|
|
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
2015-11-01 04:33:17 +00:00
|
|
|
"%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration="%CONFIGURATION%"
|
2015-10-21 22:21:14 +00:00
|
|
|
|
|
|
|
if exist "%HOST_DIR%" rd /s /q "%HOST_DIR%"
|
|
|
|
mkdir "%HOST_DIR%"
|
|
|
|
copy "%CONFIGURATION%\*" "%HOST_DIR%"
|
|
|
|
|
|
|
|
popd
|
|
|
|
|
|
|
|
if exist "%STAGE1_DIR%" rd /s /q "%STAGE1_DIR%"
|
2015-10-15 19:18:45 +00:00
|
|
|
|
2015-10-29 18:04:55 +00:00
|
|
|
echo Running 'dotnet restore' to restore packages
|
|
|
|
call dotnet restore "%REPOROOT%"
|
2015-10-15 19:18:45 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-10-16 22:41:41 +00:00
|
|
|
echo Building basic dotnet tools using older dotnet SDK version
|
|
|
|
|
2015-10-15 19:18:45 +00:00
|
|
|
echo Building stage1 dotnet.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE1_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Cli"
|
2015-10-15 19:18:45 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
|
|
|
echo Building stage1 dotnet-compile.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE1_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler"
|
2015-10-15 19:18:45 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-10-18 08:17:13 +00:00
|
|
|
echo Building stage1 dotnet-compile-csc.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE1_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler.Csc"
|
2015-10-18 08:17:13 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-10-15 19:18:45 +00:00
|
|
|
echo Building stage1 dotnet-publish.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE1_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish"
|
2015-10-15 19:18:45 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-11-02 00:21:10 +00:00
|
|
|
echo Building stage1 resgen.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE1_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Resgen"
|
2015-10-19 04:07:48 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-11-01 04:57:00 +00:00
|
|
|
echo Building stage1 dotnet-run.exe ...
|
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE1_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Run"
|
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-10-21 22:21:14 +00:00
|
|
|
REM deploy corehost.exe to the output
|
|
|
|
copy "%HOST_DIR%\corehost.exe" "%STAGE1_DIR%"
|
2015-11-01 04:19:15 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-10-21 22:21:14 +00:00
|
|
|
if exist "%HOST_DIR%\corehost.pdb" copy "%HOST_DIR%\corehost.pdb" "%STAGE1_DIR%"
|
2015-11-01 04:19:15 +00:00
|
|
|
if errorlevel 1 goto fail
|
2015-10-21 22:21:14 +00:00
|
|
|
|
2015-10-15 19:18:45 +00:00
|
|
|
echo Re-building dotnet tools with the bootstrapped version
|
|
|
|
REM This should move into a proper build script of some kind once we are bootstrapped
|
2015-10-21 22:21:14 +00:00
|
|
|
set PATH=%STAGE1_DIR%;%START_PATH%
|
2015-10-15 19:18:45 +00:00
|
|
|
|
|
|
|
if exist %STAGE2_DIR% rd /s /q %STAGE2_DIR%
|
|
|
|
|
|
|
|
echo Building stage2 dotnet.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE2_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Cli"
|
2015-10-15 19:18:45 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
|
|
|
echo Building stage2 dotnet-compile.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE2_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler"
|
2015-10-15 19:18:45 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-10-18 08:17:13 +00:00
|
|
|
echo Building stage2 dotnet-compile-csc.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE2_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Compiler.Csc"
|
2015-10-18 08:17:13 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-10-15 19:18:45 +00:00
|
|
|
echo Building stage2 dotnet-publish.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE2_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Publish"
|
2015-10-15 19:18:45 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-11-02 00:21:10 +00:00
|
|
|
echo Building stage2 resgen.exe ...
|
2015-10-21 22:21:14 +00:00
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE2_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Resgen"
|
2015-10-19 04:07:48 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-11-01 04:57:00 +00:00
|
|
|
echo Building stage2 dotnet-run.exe ...
|
|
|
|
dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE2_DIR%" --configuration "%CONFIGURATION%" "%REPOROOT%\src\Microsoft.DotNet.Tools.Run"
|
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
2015-10-21 22:21:14 +00:00
|
|
|
REM deploy corehost.exe to the output
|
2015-11-01 04:19:15 +00:00
|
|
|
copy "%HOST_DIR%\corehost.exe" "%STAGE2_DIR%"
|
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
|
|
|
if exist "%HOST_DIR%\corehost.pdb" copy "%HOST_DIR%\corehost.pdb" "%STAGE2_DIR%"
|
|
|
|
if errorlevel 1 goto fail
|
2015-10-21 22:21:14 +00:00
|
|
|
|
2015-10-28 23:33:36 +00:00
|
|
|
echo Crossgening Roslyn compiler ...
|
2015-11-01 04:19:15 +00:00
|
|
|
call "%~dp0crossgen\crossgen_roslyn.cmd" "%STAGE2_DIR%"
|
2015-10-29 05:42:14 +00:00
|
|
|
if errorlevel 1 goto fail
|
2015-10-28 23:33:36 +00:00
|
|
|
|
2015-10-21 22:21:14 +00:00
|
|
|
REM Copy DNX in to stage2
|
2015-10-21 22:21:14 +00:00
|
|
|
xcopy /s /q "%DNX_ROOT%" "%STAGE2_DIR%\dnx\"
|
2015-10-21 22:21:14 +00:00
|
|
|
|
2015-10-29 18:04:55 +00:00
|
|
|
REM Copy the dotnet-restore script
|
2015-10-21 22:21:14 +00:00
|
|
|
copy "%~dp0dotnet-restore.cmd" "%STAGE2_DIR%\dotnet-restore.cmd"
|
2015-10-21 22:21:14 +00:00
|
|
|
|
2015-10-29 18:04:55 +00:00
|
|
|
REM Smoke-test the output
|
2015-10-21 22:21:14 +00:00
|
|
|
set PATH=%STAGE2_DIR%;%START_PATH%
|
|
|
|
|
|
|
|
del "%REPOROOT%\test\TestApp\project.lock.json"
|
2015-11-02 00:21:10 +00:00
|
|
|
dotnet restore "%REPOROOT%\test\TestApp" --quiet
|
2015-11-01 04:33:17 +00:00
|
|
|
dotnet compile "%REPOROOT%\test\TestApp" --output "%REPOROOT%\artifacts\%RID%\smoketest"
|
2015-10-21 22:21:14 +00:00
|
|
|
|
2015-11-01 04:33:17 +00:00
|
|
|
set CLRHOST_CLR_PATH=%STAGE2_DIR%
|
|
|
|
"%REPOROOT%\artifacts\%RID%\smoketest\TestApp" 2>nul >nul
|
2015-10-21 22:21:14 +00:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
|
|
|
|
REM Check that a compiler error is reported
|
2015-11-01 04:19:15 +00:00
|
|
|
dotnet compile "%REPOROOT%\test\compile\failing\SimpleCompilerError" --framework "%TFM%" >nul 2>nul
|
2015-10-21 22:21:14 +00:00
|
|
|
if %errorlevel% == 0 goto fail
|
|
|
|
|
2015-10-15 19:18:45 +00:00
|
|
|
echo Bootstrapped dotnet to %STAGE2_DIR%
|
|
|
|
|
|
|
|
goto end
|
|
|
|
|
|
|
|
:fail
|
2015-10-21 22:21:14 +00:00
|
|
|
echo Bootstrapping failed
|
2015-10-15 19:18:45 +00:00
|
|
|
exit /B 1
|
|
|
|
|
2015-10-20 16:05:17 +00:00
|
|
|
:end
|
2015-10-21 22:21:14 +00:00
|
|
|
exit /B 0
|