Skip to content

Commit

Permalink
Patch repro project response files
Browse files Browse the repository at this point in the history
This replaces references to assemblies under publish1\sdk to point to
the live built ones.

Fixes dotnet#941.
  • Loading branch information
MichalStrehovsky committed Mar 28, 2016
1 parent 332d6cc commit c00e0ec
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build.cmd clean
- Set "desktop" project in solution explorer as your startup project

- Set startup command line to:
`-r:C:\corert\bin\Product\Windows_NT.x64.Debug\System.Private.CoreLib\System.Private.CoreLib.dll @c:\corert\bin\obj\Windows_NT.x64.Debug\ryujit.rsp`
`@c:\corert\bin\obj\Windows_NT.x64.Debug\ryujit.rsp`

- Build & run using **F5**
- This will run the compiler. The output is `c:\corert\src\ILCompiler\repro\obj\Debug\dnxcore50\native\repro.obj` file.
Expand All @@ -48,7 +48,7 @@ build.cmd clean
- Set "desktop" project in solution explorer as your startup project

- Set startup command line to:
`-r:C:\corert\bin\Product\Windows_NT.x64.Debug\System.Private.CoreLib.dll @c:\corert\bin\obj\Windows_NT.x64.Debug\cpp.rsp`
`@c:\corert\bin\obj\Windows_NT.x64.Debug\cpp.rsp`

- `-nolinenumbers` command line option can be used to suppress generation of line number mappings in C++ files - useful for debugging

Expand Down
33 changes: 31 additions & 2 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ if "%__GenRespFiles%"=="1" (
"%__DotNetCliPath%\bin\dotnet.exe" restore --quiet --source "https://dotnet.myget.org/F/dotnet-core" "%__ReproProjectDir%"
call "!VS140COMNTOOLS!\..\..\VC\vcvarsall.bat" %__BuildArch%
"%__DotNetCliPath%\bin\dotnet.exe" build --native --ilcpath "%__BinDir%\packaging\publish1" "%__ReproProjectDir%" -c %__BuildType%
copy /y "%__ReproProjectObjDir%\Debug\dnxcore50\native\dotnet-compile-native-ilc.rsp" "%__ObjDir%\ryujit.rsp"
call :CopyResponseFile "%__ReproProjectObjDir%\Debug\dnxcore50\native\dotnet-compile-native-ilc.rsp" "%__ObjDir%\ryujit.rsp"

rem Workaround for https://github.com/dotnet/cli/issues/1956
rmdir /s /q "%__ReproProjectBinDir%"
Expand All @@ -245,7 +245,7 @@ if "%__GenRespFiles%"=="1" (
set __AdditionalCompilerFlags=--cppcompilerflags /MTd
)
"%__DotNetCliPath%\bin\dotnet.exe" build --native --cpp --ilcpath "%__BinDir%\packaging\publish1" "%__ReproProjectDir%" -c %__BuildType% !__AdditionalCompilerFlags!
copy /y "%__ReproProjectObjDir%\Debug\dnxcore50\native\dotnet-compile-native-ilc.rsp" "%__ObjDir%\cpp.rsp"
call :CopyResponseFile "%__ReproProjectObjDir%\Debug\dnxcore50\native\dotnet-compile-native-ilc.rsp" "%__ObjDir%\cpp.rsp"
)
:AfterVsDevGenerateRespFiles

Expand Down Expand Up @@ -274,3 +274,32 @@ echo Visual Studio version: ^(default: VS2015^).
echo clean: force a clean build ^(default is to perform an incremental build^).
echo skiptests: skip building tests ^(default: tests are built^).
exit /b 1

rem Copies the dotnet generated response file while patching up references
rem to System.Private assemblies to the live built ones.
rem This is to make sure that making changes in a private library doesn't require
rem a full rebuild. It also helps with locating the symbols.
:CopyResponseFile
setlocal
> %~2 (
for /f "tokens=*" %%l in (%~1) do (
set line=%%l
if "!line:publish1\sdk=!"=="!line!" (
echo !line!
) ELSE (
set assemblyPath=!line:~3!
call :ExtractFileName !assemblyPath! assemblyFileName
echo -r:%__BinDir%\!assemblyFileName!\!assemblyFileName!.dll
)
)
)
endlocal
goto:eof

rem Extracts a file name from a full path
rem %1 Full path to the file, %2 Variable to receive the file name
:ExtractFileName
setlocal
for %%i in ("%1") DO set fileName=%%~ni
endlocal & set "%2=%fileName%"
goto:eof

0 comments on commit c00e0ec

Please sign in to comment.