Skip to content

Commit ce944e6

Browse files
committed
More complete nuget integration
fixes dotnet#204 closes dotnet#205 commit 58daf0401c282958e8ac563afba2abbd7c7464a7 Merge: 9c14a50 c9026a9 Author: latkin <latkin@microsoft.com> Date: Wed Feb 4 12:21:42 2015 -0800 Merge branch 'use-nuget-nunit' of https://github.com/latkin/visualfsharp into latkin-use-nuget-nunit Conflicts: appveyor-build.cmd commit c9026a9 Author: latkin <latkin@microsoft.com> Date: Tue Feb 3 13:12:28 2015 -0800 No need to update the PATH for AppVeyor any more commit ed4a32f Author: latkin <latkin@microsoft.com> Date: Tue Feb 3 13:05:05 2015 -0800 Use nuget-obtained NUnit everywhere, seamlessly Conflicts: tests/RunTests.cmd
1 parent 8d6c67c commit ce944e6

File tree

5 files changed

+32
-45
lines changed

5 files changed

+32
-45
lines changed

appveyor-build.cmd

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,42 @@ if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :eof
2020
%_ngenexe% install Proto\net40\bin\fsc-proto.exe
2121
@if ERRORLEVEL 1 echo Error: NGen of proto failed && goto :eof
2222

23-
%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:Configuration=Release
23+
%_msbuildexe% src/fsharp-library-build.proj /p:Configuration=Release
2424
@if ERRORLEVEL 1 echo Error: library build failed && goto :eof
2525

26-
%_msbuildexe% src/fsharp-compiler-build.proj /p:UseNugetPackages=true /p:Configuration=Release
26+
%_msbuildexe% src/fsharp-compiler-build.proj /p:Configuration=Release
2727
@if ERRORLEVEL 1 echo Error: compiler build failed && goto :eof
2828

2929
REM We don't build new net20 FSharp.Core anymore
30-
REM %_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=net20
30+
REM %_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=net20
3131
REM @if ERRORLEVEL 1 echo Error: library net20 build failed && goto :eof
3232

33-
%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable47 /p:Configuration=Release
33+
%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
3434
@if ERRORLEVEL 1 echo Error: library portable47 build failed && goto :eof
3535

36-
%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable7 /p:Configuration=Release
36+
%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
3737
@if ERRORLEVEL 1 echo Error: library portable7 build failed && goto :eof
3838

3939

40-
%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable78 /p:Configuration=Release
40+
%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable78 /p:Configuration=Release
4141
@if ERRORLEVEL 1 echo Error: library portable78 build failed && goto :eof
4242

43-
%_msbuildexe% src/fsharp-library-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable259 /p:Configuration=Release
43+
%_msbuildexe% src/fsharp-library-build.proj /p:TargetFramework=portable259 /p:Configuration=Release
4444
@if ERRORLEVEL 1 echo Error: library portable259 build failed && goto :eof
4545

4646

4747

4848

49-
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:Configuration=Release
49+
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:Configuration=Release
5050
@if ERRORLEVEL 1 echo Error: library unittests build failed && goto :eof
5151

52-
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable47 /p:Configuration=Release
52+
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable47 /p:Configuration=Release
5353
@if ERRORLEVEL 1 echo Error: library unittests build failed portable47 && goto :eof
5454

55-
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable7 /p:Configuration=Release
55+
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=Release
5656
@if ERRORLEVEL 1 echo Error: library unittests build failed portable7 && goto :eof
5757

58-
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:UseNugetPackages=true /p:TargetFramework=portable78 /p:Configuration=Release
58+
%_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78 /p:Configuration=Release
5959
@if ERRORLEVEL 1 echo Error: library unittests build failed portable78 && goto :eof
6060

6161

@@ -78,11 +78,7 @@ REM Disabled while working out perl problem, see https://github.com/Microsoft/vi
7878
REM call RunTests.cmd release fsharpqa Smoke
7979
REM @if ERRORLEVEL 1 echo Error: 'RunTests.cmd release fsharpqa Smoke' failed && goto :eof
8080

81-
set PATH=%PATH%;%~dp0%packages\NUnit.Runners.2.6.3\tools\
8281
call RunTests.cmd release coreunit
8382
@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunit' failed && goto :eof
8483

8584
popd
86-
87-
88-

src/FSharpSource.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,4 +731,7 @@
731731
<CompileBefore Remove="@(CompileBefore)"/>
732732
</ItemGroup>
733733
</Target>
734+
<Target Name="BeforeBuild" BeforeTargets="Build">
735+
<Exec Command=".\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages" WorkingDirectory="$(FSharpSourcesRoot)\.."/>
736+
</Target>
734737
</Project>

src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
<Optimize>false</Optimize>
2121
<Tailcalls>false</Tailcalls>
2222
<TargetProfile Condition=" '$(TargetFramework)' == 'portable7' or '$(TargetFramework)' == 'portable78' or '$(TargetFramework)' == 'portable259' ">netcore</TargetProfile>
23-
<!-- workaround for msbuild narrowing the assembly search paths when building portable libs -->
24-
<AssemblySearchPaths Condition="$(TargetFramework.Contains('portable'))">
25-
{CandidateAssemblyFiles};
26-
{TargetFrameworkDirectory};
27-
{Registry:Software\Microsoft\.NETFramework,v4.5,AssemblyFoldersEx};
28-
</AssemblySearchPaths>
2923
</PropertyGroup>
3024
<PropertyGroup>
3125
<DefineConstants Condition=" '$(TargetFramework)' == 'sl5' ">$(DefineConstants);SILVERLIGHT</DefineConstants>
@@ -52,6 +46,7 @@
5246
<!-- need full name and SpecificVersion = true in order to convince msbuild to allow this reference when targeting portable47 -->
5347
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" Condition="'$(TargetFramework)' != 'sl5' AND '$(TargetFramework)' != 'sl3-wp'" >
5448
<SpecificVersion>true</SpecificVersion>
49+
<HintPath>$(FSharpSourcesRoot)\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
5550
</Reference>
5651
<Reference Include="NUnitFramework" Condition="'$(TargetFramework)' == 'sl5' OR '$(TargetFramework)' == 'sl3-wp'" />
5752
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj">
@@ -107,10 +102,4 @@
107102
<Compile Include="SurfaceArea.4.0.fs" Condition="'$(TargetFramework)' == 'net40'"/>
108103
</ItemGroup>
109104
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
110-
<Target Name="BeforeResolveReferences" Condition="'$(UseNugetPackages)'=='true'">
111-
<CreateProperty Value="$(ProjectDir)..\..\..\packages\NUnit.2.6.3\lib\;$(AssemblySearchPaths)">
112-
<Output TaskParameter="Value"
113-
PropertyName="AssemblySearchPaths" />
114-
</CreateProperty>
115-
</Target>
116105
</Project>

tests/RunTests.cmd

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ IF NOT DEFINED APPVEYOR_CI (
4343
rem path to fsc.exe which will be used by tests
4444
set FSCBINPATH=%~dp0..\%FLAVOR%\net40\bin
4545

46+
rem path to nunit runners
47+
set NUNITDIR=%~dp0..\packages\NUnit.Runners.2.6.3\tools
48+
if not exist "%NUNITDIR%" (
49+
pushd %~dp0..
50+
.\.nuget\nuget.exe restore packages.config -PackagesDirectory packages
51+
popd
52+
)
53+
4654
rem folder where test logs/results will be dropped
4755
set RESULTSDIR=%~dp0\TestResults
4856
if not exist "%RESULTSDIR%" (mkdir "%RESULTSDIR%")
@@ -178,13 +186,8 @@ set XMLFILE=CoreUnit_%coreunitsuffix%_Xml.xml
178186
set OUTPUTFILE=CoreUnit_%coreunitsuffix%_Output.log
179187
set ERRORFILE=CoreUnit_%coreunitsuffix%_Error.log
180188

181-
where.exe nunit-console.exe > NUL 2> NUL
182-
if errorlevel 1 (
183-
echo Error: nunit-console.exe is not in the PATH
184-
exit /b 1
185-
)
186-
echo nunit-console.exe /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\..\..\%coreunitsuffix%\bin\FSharp.Core.Unittests.dll
187-
nunit-console.exe /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\..\..\%coreunitsuffix%\bin\FSharp.Core.Unittests.dll
189+
echo "%NUNITDIR%\nunit-console.exe" /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\..\..\%coreunitsuffix%\bin\FSharp.Core.Unittests.dll
190+
"%NUNITDIR%\nunit-console.exe" /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\..\..\%coreunitsuffix%\bin\FSharp.Core.Unittests.dll
188191

189192
goto :EOF
190193

@@ -194,16 +197,9 @@ set XMLFILE=IDEUnit_Xml.xml
194197
set OUTPUTFILE=IDEUnit_Output.log
195198
set ERRORFILE=IDEUnit_Error.log
196199

197-
where.exe nunit-console-x86.exe > NUL 2> NUL
198-
if errorlevel 1 (
199-
echo Error: nunit-console-x86.exe is not in the PATH
200-
exit /b 1
201-
)
202-
203-
for /f "tokens=*" %%a in ('where.exe nunit-console-x86.exe') do (set nunitlocation=%%~dpa)
204-
xcopy /y "%nunitlocation%\lib\*.dll" "%FSCBINPATH%"
200+
xcopy /y "%NUNITDIR%\lib\*.dll" "%FSCBINPATH%"
205201

206-
echo nunit-console-x86.exe /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\Unittests.dll
207-
nunit-console-x86.exe /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\Unittests.dll
202+
echo "%NUNITDIR%\nunit-console-x86.exe" /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\Unittests.dll
203+
"%NUNITDIR%\nunit-console-x86.exe" /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\Unittests.dll
208204

209205
goto :EOF

vsintegration/src/unittests/Unittests.fsproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@
112112
<Reference Include="Microsoft.VisualStudio.Designer.Interfaces" />
113113
<Reference Include="Microsoft.VisualStudio.CommonIDE" />
114114
<Reference Include="Microsoft.VisualStudio.VSHelp.dll" />
115-
<Reference Include="nunit.framework.dll" />
115+
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
116+
<SpecificVersion>true</SpecificVersion>
117+
<HintPath>$(FSharpSourcesRoot)\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
118+
</Reference>
116119
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\Fsc\Fsc.fsproj">
117120
<Project>{ffde9e47-9675-4498-b540-69b2583dd600}</Project>
118121
<Name>Fsc</Name>

0 commit comments

Comments
 (0)