diff --git a/FSharpBuild.Directory.Build.targets b/FSharpBuild.Directory.Build.targets index 3146b39be35..1d3fefdedd2 100644 --- a/FSharpBuild.Directory.Build.targets +++ b/FSharpBuild.Directory.Build.targets @@ -2,6 +2,7 @@ + diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 44458e29582..efc0c86529f 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -273,9 +273,17 @@ function BuildCompiler() { $argNoRestore = if ($norestore) { " --no-restore" } else { "" } $argNoIncremental = if ($rebuild) { " --no-incremental" } else { "" } + if ($binaryLog) { + $logFilePath = Join-Path $LogDir "fscBootstrapLog.binlog" + $args += " /bl:$logFilePath" + } $args = "build $fscProject -c $configuration -v $verbosity -f netcoreapp3.0" + $argNoRestore + $argNoIncremental Exec-Console $dotnetExe $args + if ($binaryLog) { + $logFilePath = Join-Path $LogDir "fsiBootstrapLog.binlog" + $args += " /bl:$logFilePath" + } $args = "build $fsiProject -c $configuration -v $verbosity -f netcoreapp3.0" + $argNoRestore + $argNoIncremental Exec-Console $dotnetExe $args } @@ -286,6 +294,100 @@ function Prepare-TempDir() { Copy-Item (Join-Path $RepoRoot "tests\Resources\Directory.Build.targets") $TempDir } +function DownloadDotnetFrameworkSdk() { + $dlTempPath = [System.IO.Path]::GetTempPath() + $dlRandomFile = [System.IO.Path]::GetRandomFileName() + $net48Dir = Join-Path $dlTempPath $dlRandomFile + Create-Directory $net48Dir + + $net48Exe = Join-Path $net48Dir "ndp48-devpack-enu.exe" + $dlLogFilePath = Join-Path $LogDir "dotnet48.install.log" + Invoke-WebRequest "https://go.microsoft.com/fwlink/?linkid=2088517" -OutFile $net48Exe + + Write-Host "Exec-Console $net48Exe /install /quiet /norestart /log $dlLogFilePath" + Exec-Console $net48Exe "/install /quiet /norestart /log $dlLogFilePath" +} + +function Test-IsAdmin { + ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") +} + +function TryDownloadDotnetFrameworkSdk() { + # If we are not running as admin user, don't bother grabbing ndp sdk -- since we don't need sn.exe + $isAdmin = Test-IsAdmin + Write-Host "TryDownloadDotnetFrameworkSdk -- Test-IsAdmin = '$isAdmin'" + if ($isAdmin -eq $true) + { + # Get program files(x86) location + if (${env:ProgramFiles(x86)} -eq $null) { + $programFiles = $env:ProgramFiles + } + else { + $programFiles = ${env:ProgramFiles(x86)} + } + + # Get windowsSDK location for x86 + $windowsSDK_ExecutablePath_x86 = $env:WindowsSDK_ExecutablePath_x86 + $newWindowsSDK_ExecutablePath_x86 = Join-Path "$programFiles" "Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" + + if ($windowsSDK_ExecutablePath_x86 -eq $null) { + $snPathX86 = Join-Path $newWindowsSDK_ExecutablePath_x86 "sn.exe" + } + else { + $snPathX86 = Join-Path $windowsSDK_ExecutablePath_x86 "sn.exe" + $snPathX86Exists = Test-Path $snPathX86 -PathType Leaf + if ($snPathX86Exists -ne $true) { + $windowsSDK_ExecutablePath_x86 = null + $snPathX86 = Join-Path $newWindowsSDK_ExecutablePath_x86 "sn.exe" + } + } + + $windowsSDK_ExecutablePath_x64 = $env:WindowsSDK_ExecutablePath_x64 + $newWindowsSDK_ExecutablePath_x64 = Join-Path "$programFiles" "Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64" + + if ($windowsSDK_ExecutablePath_x64 -eq $null) { + $snPathX64 = Join-Path $newWindowsSDK_ExecutablePath_x64 "sn.exe" + } + else { + $snPathX64 = Join-Path $windowsSDK_ExecutablePath_x64 "sn.exe" + $snPathX64Exists = Test-Path $snPathX64 -PathType Leaf + if ($snPathX64Exists -ne $true) { + $windowsSDK_ExecutablePath_x86 = null + $snPathX64 = Join-Path $newWindowsSDK_ExecutablePath_x64 "sn.exe" + } + } + + $snPathX86Exists = Test-Path $snPathX86 -PathType Leaf + Write-Host "pre-dl snPathX86Exists : $snPathX86Exists - '$snPathX86'" + if ($snPathX86Exists -ne $true) { + DownloadDotnetFrameworkSdk + } + + $snPathX86Exists = Test-Path $snPathX86 -PathType Leaf + if ($snPathX86Exists -eq $true) { + if ($windowsSDK_ExecutablePath_x86 -ne $newWindowsSDK_ExecutablePath_x86) { + $windowsSDK_ExecutablePath_x86 = $newWindowsSDK_ExecutablePath_x86 + # x86 environment variable + Write-Host "set WindowsSDK_ExecutablePath_x86=$WindowsSDK_ExecutablePath_x86" + [System.Environment]::SetEnvironmentVariable("WindowsSDK_ExecutablePath_x86","$newWindowsSDK_ExecutablePath_x86",[System.EnvironmentVariableTarget]::Machine) + $env:WindowsSDK_ExecutablePath_x86 = $newWindowsSDK_ExecutablePath_x86 + } + } + + # Also update environment variable for x64 + $snPathX64Exists = Test-Path $snPathX64 -PathType Leaf + if ($snPathX64Exists -eq $true) { + if ($windowsSDK_ExecutablePath_x64 -ne $newWindowsSDK_ExecutablePath_x64) { + $windowsSDK_ExecutablePath_x64 = $newWindowsSDK_ExecutablePath_x64 + # x64 environment variable + Write-Host "set WindowsSDK_ExecutablePath_x64=$WindowsSDK_ExecutablePath_x64" + [System.Environment]::SetEnvironmentVariable("WindowsSDK_ExecutablePath_x64","$newWindowsSDK_ExecutablePath_x64",[System.EnvironmentVariableTarget]::Machine) + $env:WindowsSDK_ExecutablePath_x64 = $newWindowsSDK_ExecutablePath_x64 + } + } + } +} + function EnablePreviewSdks() { if (Test-Path variable:global:_MSBuildExe) { return @@ -322,9 +424,11 @@ try { EnablePreviewSdks } + $buildTool = InitializeBuildTool + $toolsetBuildProj = InitializeToolset + TryDownloadDotnetFrameworkSdk if ($bootstrap) { $script:BuildMessage = "Failure building bootstrap compiler" - $toolsetBuildProj = InitializeToolset $bootstrapDir = Make-BootstrapBuild } diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index f708c9f9cea..7f06d7ac4c7 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -245,6 +245,10 @@ function Make-BootstrapBuild() { $argNoIncremental = if ($rebuild) { " --no-incremental" } else { "" } $args = "build $buildToolsProject -c $bootstrapConfiguration -v $verbosity -f netcoreapp3.0" + $argNoRestore + $argNoIncremental + if ($binaryLog) { + $logFilePath = Join-Path $LogDir "toolsBootstrapLog.binlog" + $args += " /bl:$logFilePath" + } Exec-Console $dotnetExe $args Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp3.0" -Destination "$dir\fslex" -Force -Recurse @@ -254,6 +258,10 @@ function Make-BootstrapBuild() { # prepare compiler $protoProject = "$RepoRoot\proto.proj" $args = "build $protoProject -c $bootstrapConfiguration -v $verbosity -f $bootstrapTfm" + $argNoRestore + $argNoIncremental + if ($binaryLog) { + $logFilePath = Join-Path $LogDir "protoBootstrapLog.binlog" + $args += " /bl:$logFilePath" + } Exec-Console $dotnetExe $args Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm" -Destination "$dir\fsc" -Force -Recurse diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 92a053bd16b..3fe7e2a0ef4 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -246,7 +246,6 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = if (Test-Path variable:global:_MSBuildExe) { return $global:_MSBuildExe } - if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { "15.9" } $vsMinVersion = [Version]::new($vsMinVersionStr) @@ -579,6 +578,7 @@ function MSBuild-Core() { } } + Write-Host "$buildTool.Path: $buildTool.Path --- $cmdArgs" $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { diff --git a/eng/targets/NGenBinaries.targets b/eng/targets/NGenBinaries.targets index 6e4ad9799f6..c06944e2700 100644 --- a/eng/targets/NGenBinaries.targets +++ b/eng/targets/NGenBinaries.targets @@ -1,33 +1,70 @@ - - - true - true - false - + + + + + + false + true + + + + + + + true + false + + + AfterTargets="Build" + Condition="'$(OS)' != 'Unix' AND $(TargetFramework.StartsWith('net4')) AND '$(NGenBinary)' == 'true' AND '$(IsAdministrator)' == 'true' AND Exists('$(TargetPath)') "> + - $(windir)\Microsoft.NET\Framework64\v4.0.30319\ngen.exe $(windir)\Microsoft.NET\Framework\v4.0.30319\ngen.exe - $(WindowsSDK_ExecutablePath_x86)sn.exe + $(windir)\Microsoft.NET\Framework64\v4.0.30319\ngen.exe - - + + + + + + + - - - - - \ No newline at end of file + + + + + $(WindowsSDK_ExecutablePath_x86)\sn.exe + $(WindowsSDK_ExecutablePath_x64)\sn.exe + + + + + + + diff --git a/tests/fsharp/regression/5531/compilation.output.test.txt b/tests/fsharp/regression/5531/compilation.output.test.txt index 7c43a910eee..1e22e0e78d5 100644 --- a/tests/fsharp/regression/5531/compilation.output.test.txt +++ b/tests/fsharp/regression/5531/compilation.output.test.txt @@ -1,2 +1,14 @@ +warning FS0082: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. (Code=MSB3270) + +warning FS0082: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. (Code=MSB3270) + +warning FS0082: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Web.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. (Code=MSB3270) + +warning FS0082: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "mscorlib.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. (Code=MSB3270) + +warning FS0082: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Data.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. (Code=MSB3270) + +warning FS0082: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "System.Web.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. (Code=MSB3270) + test.fs(7,17): warning FS0864: This new member hides the abstract member 'abstract member Base.Foo : unit -> unit'. Rename the member or use 'override' instead.