Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main to release/dev17.13 #18154

Open
wants to merge 3 commits into
base: release/dev17.13
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/9.0.200.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* Added project property ParallelCompilation which turns on graph based type checking, parallel ILXGen and parallel optimization. By default on for users of langversion=preview ([PR #17948](https://github.com/dotnet/fsharp/pull/17948))
* Adding warning when consuming generic method returning T|null for types not supporting nullness (structs,anons,tuples) ([PR #18057](https://github.com/dotnet/fsharp/pull/18057))
* Sink: report SynPat.ArrayOrList type ([PR #18127](https://github.com/dotnet/fsharp/pull/18127))
* Show the default value of compiler options ([PR #18054](https://github.com/dotnet/fsharp/pull/18054))

### Changed

Expand Down
50 changes: 28 additions & 22 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,16 @@ function VerifyAssemblyVersionsAndSymbols() {
}
}

function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [string]$testadapterpath, [boolean] $asBackgroundJob = $false) {
function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [string]$testadapterpath, [boolean] $asBackgroundJob = $false, [string] $settings = "") {
$dotnetPath = InitializeDotNetCli
$dotnetExe = Join-Path $dotnetPath "dotnet.exe"
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($testProject)
$testLogPath = "$ArtifactsDir\TestResults\$configuration\${projectName}_$targetFramework.xml"
# {assembly} and {framework} will expand respectively. See https://github.com/spekt/testlogger/wiki/Logger-Configuration#logfilepath
# This is useful to deconflict log filenames when there are many test assemblies, e.g. when testing a whole solution.
$testLogPath = "$ArtifactsDir\TestResults\$configuration\{assembly}_{framework}.xml"
$testBinLogPath = "$LogDir\${projectName}_$targetFramework.binlog"
$args = "test $testProject -c $configuration -f $targetFramework -v n --test-adapter-path $testadapterpath --logger ""xunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath"
$args += " --blame --results-directory $ArtifactsDir\TestResults\$configuration -p:vstestusemsbuildoutput=false"
$args += " --blame --blame-hang-timeout 5minutes --results-directory $ArtifactsDir\TestResults\$configuration -p:vstestusemsbuildoutput=true"

if (-not $noVisualStudio -or $norestore) {
$args += " --no-restore"
Expand All @@ -379,17 +381,20 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
$args += " --no-build"
}

$args += " $settings"

if ($asBackgroundJob) {
Write-Host
Write-Host("Starting on the background: $args")
Write-Host("------------------------------------")
$bgJob = Start-Job -ScriptBlock {
& $using:dotnetExe test $using:testProject -c $using:configuration -f $using:targetFramework -v n --test-adapter-path $using:testadapterpath --logger "xunit;LogFilePath=$using:testLogPath" /bl:$using:testBinLogPath --blame --results-directory $using:ArtifactsDir\TestResults\$using:configuration
Start-Job -ScriptBlock {
$argArray = $using:args -Split " "
& $using:dotnetExe $argArray
if ($LASTEXITCODE -ne 0) {
throw "Command failed to execute with exit code $($LASTEXITCODE): $using:dotnetExe $using:args"
}
}
return $bgJob
} else{
} else {
Write-Host("$args")
Exec-Console $dotnetExe $args
}
Expand Down Expand Up @@ -595,21 +600,20 @@ try {
$script:BuildCategory = "Test"
$script:BuildMessage = "Failure running tests"

if ($testCoreClr) {
$bgJob = TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true

TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"
function Receive($job) {
while($job.HasMoreData) {
Receive-Job $job | Write-Host
Start-Sleep -Seconds 1
}
Receive-Job $job -Wait -ErrorAction Stop
}

# Collect output from background jobs
Wait-job $bgJob | out-null
Receive-Job $bgJob -ErrorAction Stop
if ($testCoreClr) {
$cpuLimit = if ($ci) { "-m:2 -- xUnit.MaxParallelThreads=0.25x" } else { "" }
TestUsingMSBuild -testProject "$RepoRoot\FSharp.sln" -targetFramework $script:coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\" -settings $cpuLimit
}

if ($testDesktop) {
if ($testDesktop -and $ci) {
$bgJob = TestUsingMSBuild -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\" -asBackgroundJob $true

TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
Expand All @@ -618,9 +622,11 @@ try {
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\"
TestUsingMSBuild -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"

# Collect output from background jobs
Wait-job $bgJob | out-null
Receive-Job $bgJob -ErrorAction Stop
Receive -job $bgJob
}

if ($testDesktop -and -not $ci ) {
TestUsingMSBuild -testProject "$RepoRoot\FSharp.sln" -targetFramework $script:desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.ComponentTests\"
}

if ($testFSharpQA) {
Expand Down
3 changes: 2 additions & 1 deletion eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ function Test() {
projectname=$(basename -- "$testproject")
projectname="${projectname%.*}"
testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml"
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"xunit;LogFilePath=$testlogpath\" --blame --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false"
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"xunit;LogFilePath=$testlogpath\" --blame-hang-timeout 5minutes --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false"
args+=" -- xUnit.MaxParallelThreads=3"
"$DOTNET_INSTALL_DIR/dotnet" $args || exit $?
}

Expand Down
78 changes: 60 additions & 18 deletions src/Compiler/Driver/CompilerOptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,8 @@ let setSignatureFile tcConfigB s =
let setAllSignatureFiles tcConfigB () =
tcConfigB.printAllSignatureFiles <- true

let formatOptionSwitch (value: bool) = if value then "on" else "off"

// option tags
let tagString = "<string>"
let tagExe = "exe"
Expand Down Expand Up @@ -806,7 +808,7 @@ let errorsAndWarningsFlags (tcConfigB: TcConfigBuilder) =
GlobalWarnAsError = switch <> OptionSwitch.Off
}),
None,
Some(FSComp.SR.optsWarnaserrorPM ())
Some(FSComp.SR.optsWarnaserrorPM (formatOptionSwitch tcConfigB.diagnosticsOptions.GlobalWarnAsError))
)

CompilerOption(
Expand Down Expand Up @@ -870,15 +872,15 @@ let errorsAndWarningsFlags (tcConfigB: TcConfigBuilder) =
tagNone,
OptionSwitch(fun switch -> tcConfigB.checkNullness <- switch = OptionSwitch.On),
None,
Some(FSComp.SR.optsCheckNulls ())
Some(FSComp.SR.optsCheckNulls (formatOptionSwitch tcConfigB.checkNullness))
)

CompilerOption(
"consolecolors",
tagNone,
OptionSwitch(fun switch -> enableConsoleColoring <- switch = OptionSwitch.On),
None,
Some(FSComp.SR.optsConsoleColors ())
Some(FSComp.SR.optsConsoleColors (formatOptionSwitch enableConsoleColoring))
)
]

Expand All @@ -904,15 +906,15 @@ let outputFileFlagsFsc (tcConfigB: TcConfigBuilder) =
tagNone,
OptionSwitch(fun s -> tcConfigB.delaysign <- (s = OptionSwitch.On)),
None,
Some(FSComp.SR.optsDelaySign ())
Some(FSComp.SR.optsDelaySign (formatOptionSwitch tcConfigB.delaysign))
)

CompilerOption(
"publicsign",
tagNone,
OptionSwitch(fun s -> tcConfigB.publicsign <- (s = OptionSwitch.On)),
None,
Some(FSComp.SR.optsPublicSign ())
Some(FSComp.SR.optsPublicSign (formatOptionSwitch tcConfigB.publicsign))
)

CompilerOption("doc", tagFile, OptionString(fun s -> tcConfigB.xmlDocOutputFile <- Some s), None, Some(FSComp.SR.optsWriteXml ()))
Expand Down Expand Up @@ -944,7 +946,7 @@ let outputFileFlagsFsc (tcConfigB: TcConfigBuilder) =
tagNone,
OptionSwitch(fun switch -> tcConfigB.compressMetadata <- switch = OptionSwitch.On),
None,
Some(FSComp.SR.optsCompressMetadata ())
Some(FSComp.SR.optsCompressMetadata (formatOptionSwitch tcConfigB.compressMetadata))
)

CompilerOption(
Expand Down Expand Up @@ -975,7 +977,13 @@ let outputFileFlagsFsc (tcConfigB: TcConfigBuilder) =
Some(FSComp.SR.optsNoCopyFsharpCore ())
)

CompilerOption("refonly", tagNone, OptionSwitch(SetReferenceAssemblyOnlySwitch tcConfigB), None, Some(FSComp.SR.optsRefOnly ()))
CompilerOption(
"refonly",
tagNone,
OptionSwitch(SetReferenceAssemblyOnlySwitch tcConfigB),
None,
Some(FSComp.SR.optsRefOnly (formatOptionSwitch (tcConfigB.emitMetadataAssembly <> MetadataAssemblyGeneration.None)))
)

CompilerOption("refout", tagFile, OptionString(SetReferenceAssemblyOutSwitch tcConfigB), None, Some(FSComp.SR.optsRefOut ()))
]
Expand Down Expand Up @@ -1023,7 +1031,13 @@ let resourcesFlagsFsc (tcConfigB: TcConfigBuilder) =
let codeGenerationFlags isFsi (tcConfigB: TcConfigBuilder) =
let debug =
[
CompilerOption("debug", tagNone, OptionSwitch(SetDebugSwitch tcConfigB None), None, Some(FSComp.SR.optsDebugPM ()))
CompilerOption(
"debug",
tagNone,
OptionSwitch(SetDebugSwitch tcConfigB None),
None,
Some(FSComp.SR.optsDebugPM (formatOptionSwitch tcConfigB.debuginfo))
)

CompilerOption(
"debug",
Expand All @@ -1036,7 +1050,13 @@ let codeGenerationFlags isFsi (tcConfigB: TcConfigBuilder) =

let embed =
[
CompilerOption("embed", tagNone, OptionSwitch(SetEmbedAllSourceSwitch tcConfigB), None, Some(FSComp.SR.optsEmbedAllSource ()))
CompilerOption(
"embed",
tagNone,
OptionSwitch(SetEmbedAllSourceSwitch tcConfigB),
None,
Some(FSComp.SR.optsEmbedAllSource (formatOptionSwitch tcConfigB.embedAllSource))
)

CompilerOption("embed", tagFileList, OptionStringList tcConfigB.AddEmbeddedSourceFile, None, Some(FSComp.SR.optsEmbedSource ()))

Expand All @@ -1045,19 +1065,37 @@ let codeGenerationFlags isFsi (tcConfigB: TcConfigBuilder) =

let codegen =
[
CompilerOption("optimize", tagNone, OptionSwitch(SetOptimizeSwitch tcConfigB), None, Some(FSComp.SR.optsOptimize ()))
CompilerOption(
"optimize",
tagNone,
OptionSwitch(SetOptimizeSwitch tcConfigB),
None,
Some(FSComp.SR.optsOptimize (formatOptionSwitch (tcConfigB.optSettings <> OptimizationSettings.Defaults)))
)

CompilerOption("tailcalls", tagNone, OptionSwitch(SetTailcallSwitch tcConfigB), None, Some(FSComp.SR.optsTailcalls ()))
CompilerOption(
"tailcalls",
tagNone,
OptionSwitch(SetTailcallSwitch tcConfigB),
None,
Some(FSComp.SR.optsTailcalls (formatOptionSwitch tcConfigB.emitTailcalls))
)

CompilerOption(
"deterministic",
tagNone,
OptionSwitch(SetDeterministicSwitch tcConfigB),
None,
Some(FSComp.SR.optsDeterministic ())
Some(FSComp.SR.optsDeterministic (formatOptionSwitch tcConfigB.deterministic))
)

CompilerOption("realsig", tagNone, OptionSwitch(SetRealsig tcConfigB), None, Some(FSComp.SR.optsRealsig ()))
CompilerOption(
"realsig",
tagNone,
OptionSwitch(SetRealsig tcConfigB),
None,
Some(FSComp.SR.optsRealsig (formatOptionSwitch tcConfigB.realsig))
)

CompilerOption("pathmap", tagPathMap, OptionStringList(AddPathMapping tcConfigB), None, Some(FSComp.SR.optsPathMap ()))

Expand All @@ -1066,7 +1104,11 @@ let codeGenerationFlags isFsi (tcConfigB: TcConfigBuilder) =
tagNone,
OptionSwitch(crossOptimizeSwitch tcConfigB),
None,
Some(FSComp.SR.optsCrossoptimize ())
Some(
FSComp.SR.optsCrossoptimize (
formatOptionSwitch (Option.defaultValue false tcConfigB.optSettings.crossAssemblyOptimizationUser)
)
)
)

CompilerOption(
Expand Down Expand Up @@ -1144,7 +1186,7 @@ let languageFlags tcConfigB =
tagNone,
OptionSwitch(fun switch -> tcConfigB.checkOverflow <- (switch = OptionSwitch.On)),
None,
Some(FSComp.SR.optsChecked ())
Some(FSComp.SR.optsChecked (formatOptionSwitch tcConfigB.checkOverflow))
)

CompilerOption("define", tagString, OptionString(defineSymbol tcConfigB), None, Some(FSComp.SR.optsDefine ()))
Expand All @@ -1156,7 +1198,7 @@ let languageFlags tcConfigB =
tagNone,
OptionSwitch(fun switch -> tcConfigB.strictIndentation <- Some(switch = OptionSwitch.On)),
None,
Some(FSComp.SR.optsStrictIndentation ())
Some(FSComp.SR.optsStrictIndentation (formatOptionSwitch (Option.defaultValue false tcConfigB.strictIndentation)))
)
]

Expand Down Expand Up @@ -1328,7 +1370,7 @@ let advancedFlagsFsc tcConfigB =
tagNone,
OptionSwitch(useHighEntropyVASwitch tcConfigB),
None,
Some(FSComp.SR.optsUseHighEntropyVA ())
Some(FSComp.SR.optsUseHighEntropyVA (formatOptionSwitch tcConfigB.useHighEntropyVA))
)

CompilerOption(
Expand All @@ -1344,7 +1386,7 @@ let advancedFlagsFsc tcConfigB =
tagNone,
OptionSwitch(fun switch -> tcConfigB.emitDebugInfoInQuotations <- switch = OptionSwitch.On),
None,
Some(FSComp.SR.optsEmitDebugInfoInQuotations ())
Some(FSComp.SR.optsEmitDebugInfoInQuotations (formatOptionSwitch tcConfigB.emitDebugInfoInQuotations))
)
]

Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/Driver/CompilerOptions.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ val ignoreFailureOnMono1_1_16: (unit -> unit) -> unit

val mutable enableConsoleColoring: bool

val formatOptionSwitch: bool -> string

val DoWithColor: ConsoleColor -> (unit -> 'T) -> 'T

val DoWithDiagnosticColor: FSharpDiagnosticSeverity -> (unit -> 'T) -> 'T
Expand Down
Loading
Loading