Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
tests
  • Loading branch information
KevinRansom committed Feb 10, 2021
commit 320087fc8e425206bf04539ffee1d6793987d9ab
5 changes: 5 additions & 0 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,11 @@ try {
$buildTool = InitializeBuildTool
$toolsetBuildProj = InitializeToolset
TryDownloadDotnetFrameworkSdk

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brettfo , this was the main problem, the ci sets DOTNET_ROOT to a the global location. Here we set it to the local download location first, so that the local and global frameworks are selectable by dotnet.exe

$dotnetPath = InitializeDotNetCli
$env:DOTNET_ROOT="$dotnetPath"
Get-Item -Path Env:

if ($bootstrap) {
$script:BuildMessage = "Failure building bootstrap compiler"
$bootstrapDir = Make-BootstrapBuild
Expand Down
13 changes: 7 additions & 6 deletions src/fsharp/fsc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,13 @@ let main1OfAst
rangeForErrors=range0)

let primaryAssembly =
// temporary workaround until https://github.com/dotnet/fsharp/pull/8043 is merged:
// pick a primary assembly based on the current runtime.
// It's an ugly compromise used to avoid exposing primaryAssembly in the public api for this function.
let isNetCoreAppProcess = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith ".NET Core"
if isNetCoreAppProcess then PrimaryAssembly.System_Runtime
else PrimaryAssembly.Mscorlib
// MsCorlib is a good default for all seasons...
// portable profiles and netstandard rely on System_Runtime but we need to do work to detect that scenario
let includesSystem_Runtime = dllReferences |> Seq.exists(fun f -> Path.GetFileName(f).Equals("system.runtime.dll",StringComparison.InvariantCultureIgnoreCase))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vzarytovskii ,
this is what fixed the il baseline issue. Here we set the primary assembly differently on NET5.0 than netcoreapp3.1.
The change is to set the primary assembly to system_runtime whenever the developer specifies system.runtime.dll is one of the references.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah that makes sense. We were relying on tfm name/description.

if includesSystem_Runtime then
PrimaryAssembly.System_Runtime
else
PrimaryAssembly.Mscorlib

tcConfigB.target <- target
tcConfigB.primaryAssembly <- primaryAssembly
Expand Down
35 changes: 21 additions & 14 deletions tests/FSharp.Test.Utilities/TestFramework.fs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ type TestConfig =
PEVERIFY : string
Directory: string
DotNetExe: string
DotNetMultiLevelLookup: string
DotNetRoot: string
DefaultPlatform: string}

#if NETCOREAPP
Expand Down Expand Up @@ -347,29 +349,34 @@ let config configurationName envVars =
vbc_flags = vbc_flags
Directory=""
DotNetExe = dotNetExe
DotNetMultiLevelLookup = System.Environment.GetEnvironmentVariable "DOTNET_MULTILEVEL_LOOKUP"
DotNetRoot = System.Environment.GetEnvironmentVariable "DOTNET_ROOT"
DefaultPlatform = defaultPlatform }

let logConfig (cfg: TestConfig) =
log "---------------------------------------------------------------"
log "Executables"
log ""
log "CSC =%s" cfg.CSC
log "BUILD_CONFIG =%s" cfg.BUILD_CONFIG
log "csc_flags =%s" cfg.csc_flags
log "FSC =%s" cfg.FSC
log "fsc_flags =%s" cfg.fsc_flags
log "FSCOREDLLPATH =%s" cfg.FSCOREDLLPATH
log "FSI =%s" cfg.FSI
#if !NETCOREAPP
log "FSIANYCPU =%s" cfg.FSIANYCPU
log "CSC = %s" cfg.CSC
log "BUILD_CONFIG = %s" cfg.BUILD_CONFIG
log "csc_flags = %s" cfg.csc_flags
log "FSC = %s" cfg.FSC
log "fsc_flags = %s" cfg.fsc_flags
log "FSCOREDLLPATH = %s" cfg.FSCOREDLLPATH
log "FSI = %s" cfg.FSI
#if NETCOREAPP
log "DotNetExe =%s" cfg.DotNetExe
log "DOTNET_MULTILEVEL_LOOKUP = %s" cfg.DotNetMultiLevelLookup
log "DOTNET_ROOT = %s" cfg.DotNetRoot
#else
log "FSIANYCPU = %s" cfg.FSIANYCPU
#endif
log "FSI_FOR_SCRIPTS =%s" cfg.FSI_FOR_SCRIPTS
log "fsi_flags =%s" cfg.fsi_flags
log "ILDASM =%s" cfg.ILDASM
log "PEVERIFY =%s" cfg.PEVERIFY
log "FSI_FOR_SCRIPTS = %s" cfg.FSI_FOR_SCRIPTS
log "fsi_flags = %s" cfg.fsi_flags
log "ILDASM = %s" cfg.ILDASM
log "PEVERIFY = %s" cfg.PEVERIFY
log "---------------------------------------------------------------"


let checkResult result =
match result with
| CmdResult.ErrorLevel (msg1, err) -> Assert.Fail (sprintf "%s. ERRORLEVEL %d" msg1 err)
Expand Down