@@ -53,6 +53,7 @@ param (
5353 [switch ]$testVs ,
5454 [switch ]$testAll ,
5555 [string ]$officialSkipTests = " false" ,
56+ [switch ]$noVisualStudio ,
5657
5758 [parameter (ValueFromRemainingArguments = $true )][string []]$properties )
5859
@@ -96,6 +97,7 @@ function Print-Usage() {
9697 Write-Host " -procdump Monitor test runs with procdump"
9798 Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
9899 Write-Host " -useGlobalNuGetCache Use global NuGet cache."
100+ Write-Host " -noVisualStudio Only build fsc and fsi as .NET Core applications. No Visual Studio required. '-configuration', '-verbosity', '-norestore', '-rebuild' are supported."
99101 Write-Host " "
100102 Write-Host " Command line arguments starting with '/p:' are passed through to MSBuild."
101103}
@@ -145,8 +147,19 @@ function Process-Arguments() {
145147}
146148
147149function Update-Arguments () {
148- if (-Not (Test-Path " $ArtifactsDir \Bootstrap\fsc\fsc.exe" )) {
149- $script :bootstrap = $True
150+ if ($script :noVisualStudio ) {
151+ $script :bootstrapTfm = " netcoreapp2.1"
152+ $script :msbuildEngine = " dotnet"
153+ }
154+
155+ if ($bootstrapTfm -eq " netcoreapp2.1" ) {
156+ if (-Not (Test-Path " $ArtifactsDir \Bootstrap\fsc\fsc.runtimeconfig.json" )) {
157+ $script :bootstrap = $True
158+ }
159+ } else {
160+ if (-Not (Test-Path " $ArtifactsDir \Bootstrap\fsc\fsc.exe" ) -or (Test-Path " $ArtifactsDir \Bootstrap\fsc\fsc.runtimeconfig.json" )) {
161+ $script :bootstrap = $True
162+ }
150163 }
151164}
152165
@@ -228,10 +241,37 @@ function TestUsingNUnit([string] $testProject, [string] $targetFramework) {
228241 $projectName = [System.IO.Path ]::GetFileNameWithoutExtension($testProject )
229242 $testLogPath = " $ArtifactsDir \TestResults\$configuration \${projectName} _$targetFramework .xml"
230243 $testBinLogPath = " $LogDir \${projectName} _$targetFramework .binlog"
231- $args = " test $testProject --no-restore --no-build -c $configuration -f $targetFramework -v n --test-adapter-path . --logger "" nunit;LogFilePath=$testLogPath "" /bl:$testBinLogPath "
244+ $args = " test $testProject -c $configuration -f $targetFramework -v n --test-adapter-path . --logger "" nunit;LogFilePath=$testLogPath "" /bl:$testBinLogPath "
245+
246+ if (-not $noVisualStudio -or $norestore ) {
247+ $args += " --no-restore"
248+ }
249+
250+ if (-not $noVisualStudio ) {
251+ $args += " --no-build"
252+ }
253+
232254 Exec- Console $dotnetExe $args
233255}
234256
257+ function BuildCompiler () {
258+ if ($bootstrapTfm -eq " netcoreapp2.1" ) {
259+ $dotnetPath = InitializeDotNetCli
260+ $dotnetExe = Join-Path $dotnetPath " dotnet.exe"
261+ $fscProject = " $RepoRoot \src\fsharp\fsc\fsc.fsproj"
262+ $fsiProject = " $RepoRoot \src\fsharp\fsi\fsi.fsproj"
263+
264+ $argNoRestore = if ($norestore ) { " --no-restore" } else { " " }
265+ $argNoIncremental = if ($rebuild ) { " --no-incremental" } else { " " }
266+
267+ $args = " build $fscProject -c $configuration -v $verbosity -f netcoreapp2.1" + $argNoRestore + $argNoIncremental
268+ Exec- Console $dotnetExe $args
269+
270+ $args = " build $fsiProject -c $configuration -v $verbosity -f netcoreapp2.1" + $argNoRestore + $argNoIncremental
271+ Exec- Console $dotnetExe $args
272+ }
273+ }
274+
235275function Prepare-TempDir () {
236276 Copy-Item (Join-Path $RepoRoot " tests\Resources\Directory.Build.props" ) $TempDir
237277 Copy-Item (Join-Path $RepoRoot " tests\Resources\Directory.Build.targets" ) $TempDir
@@ -260,7 +300,11 @@ try {
260300 }
261301
262302 if ($restore -or $build -or $rebuild -or $pack -or $sign -or $publish ) {
263- BuildSolution
303+ if ($noVisualStudio ) {
304+ BuildCompiler
305+ } else {
306+ BuildSolution
307+ }
264308 }
265309
266310 if ($build ) {
@@ -270,7 +314,7 @@ try {
270314 $desktopTargetFramework = " net472"
271315 $coreclrTargetFramework = " netcoreapp2.1"
272316
273- if ($testDesktop ) {
317+ if ($testDesktop -and -not $noVisualStudio ) {
274318 TestUsingNUnit - testProject " $RepoRoot \tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" - targetFramework $desktopTargetFramework
275319 TestUsingNUnit - testProject " $RepoRoot \tests\FSharp.Compiler.LanguageServer.UnitTests\FSharp.Compiler.LanguageServer.UnitTests.fsproj" - targetFramework $desktopTargetFramework
276320 TestUsingNUnit - testProject " $RepoRoot \tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" - targetFramework $desktopTargetFramework
@@ -286,7 +330,7 @@ try {
286330 TestUsingNUnit - testProject " $RepoRoot \tests\fsharp\FSharpSuite.Tests.fsproj" - targetFramework $coreclrTargetFramework
287331 }
288332
289- if ($testFSharpQA ) {
333+ if ($testFSharpQA -and -not $noVisualStudio ) {
290334 Push-Location " $RepoRoot \tests\fsharpqa\source"
291335 $resultsRoot = " $ArtifactsDir \TestResults\$configuration "
292336 $resultsLog = " test-net40-fsharpqa-results.log"
@@ -305,21 +349,27 @@ try {
305349 }
306350
307351 if ($testFSharpCore ) {
308- TestUsingNUnit - testProject " $RepoRoot \tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" - targetFramework $desktopTargetFramework
352+ if (-not $noVisualStudio ) {
353+ TestUsingNUnit - testProject " $RepoRoot \tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" - targetFramework $desktopTargetFramework
354+ }
309355 TestUsingNUnit - testProject " $RepoRoot \tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" - targetFramework $coreclrTargetFramework
310356 }
311357
312358 if ($testCompiler ) {
313- TestUsingNUnit - testProject " $RepoRoot \tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" - targetFramework $desktopTargetFramework
359+ if (-not $noVisualStudio ) {
360+ TestUsingNUnit - testProject " $RepoRoot \tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" - targetFramework $desktopTargetFramework
361+ }
314362 TestUsingNUnit - testProject " $RepoRoot \tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" - targetFramework $coreclrTargetFramework
315363 }
316364
317365 if ($testCambridge ) {
318- TestUsingNUnit - testProject " $RepoRoot \tests\fsharp\FSharpSuite.Tests.fsproj" - targetFramework $desktopTargetFramework
366+ if (-not $noVisualStudio ) {
367+ TestUsingNUnit - testProject " $RepoRoot \tests\fsharp\FSharpSuite.Tests.fsproj" - targetFramework $desktopTargetFramework
368+ }
319369 TestUsingNUnit - testProject " $RepoRoot \tests\fsharp\FSharpSuite.Tests.fsproj" - targetFramework $coreclrTargetFramework
320370 }
321371
322- if ($testVs ) {
372+ if ($testVs -and -not $noVisualStudio ) {
323373 TestUsingNUnit - testProject " $RepoRoot \vsintegration\tests\GetTypesVS.UnitTests\GetTypesVS.UnitTests.fsproj" - targetFramework $desktopTargetFramework
324374 TestUsingNUnit - testProject " $RepoRoot \vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" - targetFramework $desktopTargetFramework
325375 }
0 commit comments