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

Use net6 previews for building #11545

Merged
merged 29 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
12d91c5
Use net6 previews for building
vzarytovskii May 11, 2021
80b73d3
Azure Pipelines: use dotnet version from global.json
vzarytovskii May 11, 2021
3428060
Merge upstream/main
vzarytovskii May 12, 2021
5e14280
Azure Pipelines: use explicit workind directory when installing .NET …
vzarytovskii May 12, 2021
b6b0037
Fixed framework version in build scripts
vzarytovskii May 13, 2021
79c00e1
Azure pipelines: revert the installation path change, and turn off th…
vzarytovskii May 13, 2021
c10665e
Azure pipelines: rollback to use explicit version in the yaml file, i…
vzarytovskii May 13, 2021
1168abe
Merged upstream/main
vzarytovskii May 13, 2021
65d3e19
Revert build script changes to framework version, we still target net…
vzarytovskii May 13, 2021
4d0bfb7
Bump arcade sdk version
vzarytovskii May 17, 2021
2ee9046
Merge upstream/main
vzarytovskii May 17, 2021
fb6e780
Added rollForward for compilerassert tests, and prerelease support fo…
vzarytovskii May 17, 2021
405a67e
Add runtimeconfig.json for cambridge tests
vzarytovskii May 17, 2021
6451a55
Addded global environment variable to roll to preview versions
vzarytovskii May 17, 2021
41ca0c0
Merge upstream/main
vzarytovskii May 21, 2021
0468f8c
Fix more tests
vzarytovskii May 21, 2021
30961cc
Fix more tests
vzarytovskii May 21, 2021
2c79ce5
Revert single-test framework resolution changes
vzarytovskii May 21, 2021
c99b2eb
Merge branch 'main' into net6
vzarytovskii Jul 12, 2021
9ab6d14
Merge upstream/main
vzarytovskii Jul 27, 2021
fdbaa8b
Merge upstream/main
vzarytovskii Jul 30, 2021
ffd0502
Update sdk version in the azure-pipelines.yml
vzarytovskii Jul 30, 2021
9e32d58
Emit 0n instead ldnull in nullPtr
vzarytovskii Jul 30, 2021
42d00f5
Specify type explicitly
vzarytovskii Jul 30, 2021
07dec5d
Fixed the MakeQueryableTake, and disabled tests for Array2D.set (as i…
vzarytovskii Aug 3, 2021
55af0c6
Disabled some more tests
vzarytovskii Aug 3, 2021
0c734eb
Disable whole array suite
vzarytovskii Aug 3, 2021
1dd0b02
Disable whole array suite
vzarytovskii Aug 3, 2021
7d87ecd
Restore tests, make them assert, there's no error, since it got fixed
vzarytovskii Aug 4, 2021
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
10 changes: 9 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ variables:
- name: VisualStudioDropName
value: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
- name: DotNetSdkVersion
value: '5.0.300'
value: '6.0.100-preview.6.21355.2'
- ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- name: RunningAsPullRequest
value: true
Expand Down Expand Up @@ -388,6 +388,7 @@ stages:
# inputs:
# packageType: sdk
# version: $(DotNetSdkVersion)
# workingDirectory: $(Build.SourcesDirectory)
# installationPath: $(Agent.ToolsDirectory)/dotnet
# - script: dotnet build .\FSharp.sln /bl:\"artifacts/log/$(_BuildConfig)/RegularBuild.binlog\"
# displayName: Regular rebuild
Expand All @@ -410,7 +411,10 @@ stages:
displayName: install SDK
inputs:
packageType: sdk
# We cannot use .NET version from global.json, since it tries to install all SDK version from all global.json files in the tree, and we use some fake versions for testing.
useGlobalJson: false
version: $(DotNetSdkVersion)
workingDirectory: $(Build.SourcesDirectory)
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet build ./FSharp.sln /bl:\"artifacts/log/$(_BuildConfig)/RegularBuild.binlog\"
displayName: Regular rebuild
Expand All @@ -433,7 +437,11 @@ stages:
displayName: install SDK
inputs:
packageType: sdk
# We cannot use .NET version from global.json, since it tries to install all SDK version from all global.json files in the tree, and we use some fake versions for testing.
useGlobalJson: false
version: $(DotNetSdkVersion)
performMultiLevelLookup: false
workingDirectory: $(Build.SourcesDirectory)
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet build ./FSharp.sln /bl:\"artifacts/log/$(_BuildConfig)/RegularBuild.binlog\"
displayName: Regular rebuild
Expand Down
4 changes: 3 additions & 1 deletion eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ try {
$script:BuildCategory = "Build"
$script:BuildMessage = "Failure preparing build"

[System.Environment]::SetEnvironmentVariable('DOTNET_ROLL_FORWARD_TO_PRERELEASE', '1', [System.EnvironmentVariableTarget]::User)

Process-Arguments

. (Join-Path $PSScriptRoot "build-utils.ps1")
Expand Down Expand Up @@ -483,7 +485,7 @@ try {
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Service.Tests\"
TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Compiler.Private.Scripting.UnitTests\"
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Build.UnitTests\"
TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"
TestUsingXUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Core.UnitTests\"
vzarytovskii marked this conversation as resolved.
Show resolved Hide resolved
TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $coreclrTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharpSuite.Tests\"
}

Expand Down
33 changes: 17 additions & 16 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"sdk": {
"version": "5.0.300",
"rollForward": "minor"
},
"tools": {
"dotnet": "5.0.300",
"vs": {
"version": "16.8",
"components": [
"Microsoft.VisualStudio.Component.FSharp"
]
"sdk": {
"version": "6.0.100-preview.6.21355.2",
"allowPrerelease": true,
"rollForward": "minor"
},
"tools": {
"dotnet": "6.0.100-preview.6.21355.2",
"vs": {
"version": "16.8",
"components": [
"Microsoft.VisualStudio.Component.FSharp"
]
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21376.4",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21376.4",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
2 changes: 1 addition & 1 deletion src/fsharp/FSharp.Core/nativeptr.fs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module NativePtr =

[<NoDynamicInvocation>]
[<CompiledName("NullPointer")>]
let inline nullPtr<'T when 'T : unmanaged> : nativeptr<'T> = (# "ldnull" : nativeptr<'T> #)
let inline nullPtr<'T when 'T : unmanaged> : nativeptr<'T> = (# "" 0n : nativeptr<'T> #)

[<NoDynamicInvocation>]
[<CompiledName("IsNullPointer")>]
Expand Down
6 changes: 5 additions & 1 deletion src/scripts/scriptlib.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ module Scripting =

let exePath = path |> processExePath workDir
let processInfo = new ProcessStartInfo(exePath, arguments)

processInfo.EnvironmentVariables.["DOTNET_ROLL_FORWARD"] <- "LatestMajor"
processInfo.EnvironmentVariables.["DOTNET_ROLL_FORWARD_TO_PRERELEASE"] <- "1"

processInfo.CreateNoWindow <- true
processInfo.UseShellExecute <- false
processInfo.WorkingDirectory <- workDir
Expand Down Expand Up @@ -158,7 +162,7 @@ module Scripting =

match p.ExitCode with
| 0 -> Success
| errCode ->
| errCode ->
let msg = sprintf "Error running command '%s' with args '%s' in directory '%s'.\n---- stdout below --- \n%s\n---- stderr below --- \n%s " exePath arguments workDir (out.ToString()) (err.ToString())
ErrorLevel (msg, errCode)

Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Test.Utilities/CompilerAssert.fs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ type CompilerAssert private () =
"tfm": "net5.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "5.0.0"
"version": "6.0"
vzarytovskii marked this conversation as resolved.
Show resolved Hide resolved
}
}
}"""
Expand Down
3 changes: 3 additions & 0 deletions tests/FSharp.Test.Utilities/TestFramework.fs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ module Commands =
psi.RedirectStandardError <- true
psi.Arguments <- arguments
psi.CreateNoWindow <- true
// When running tests, we want to roll forward to minor versions (including previews).
psi.EnvironmentVariables.["DOTNET_ROLL_FORWARD"] <- "LatestMajor"
psi.EnvironmentVariables.["DOTNET_ROLL_FORWARD_TO_PRERELEASE"] <- "1"
psi.EnvironmentVariables.Remove("MSBuildSDKsPath") // Host can sometimes add this, and it can break things
psi.UseShellExecute <- false

Expand Down
45 changes: 0 additions & 45 deletions tests/fsharp/Compiler/Language/SpanTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -70,51 +70,6 @@ test ()

CompilerAssert.RunScript script []

vzarytovskii marked this conversation as resolved.
Show resolved Hide resolved
[<Test>]
let Script_ReadOnlySpanForInDo() =
vzarytovskii marked this conversation as resolved.
Show resolved Hide resolved
let script =
"""
open System

let test () : unit =
let span = ReadOnlySpan([|1;2;3;4|])
let result = ResizeArray()
for item in span do
result.Add(item)

if result.[0] <> 1 || result.[1] <> 2 || result.[2] <> 3 || result.[3] <> 4 then
failwith "ReadOnlySpanForInDo didn't work properly"

test ()
"""

// We expect this error until System.Reflection.Emit gets fixed for emitting `modreq` on method calls.
// See: https://github.com/dotnet/corefx/issues/29254
CompilerAssert.RunScript script [ "Method not found: '!0 ByRef System.ReadOnlySpan`1.get_Item(Int32)'." ]

[<Test>]
let Script_ReadOnlySpanForInBoundsDo() =
let script =
"""
open System

let test () : unit =
let span = ReadOnlySpan([|1;2;3;4|])
let result = ResizeArray()
for i in 0 .. span.Length-1 do
result.Add(span.[i])

if result.[0] <> 1 || result.[1] <> 2 || result.[2] <> 3 || result.[3] <> 4 then
failwith "Script_ReadOnlySpanForInBoundsDo didn't work properly"

test ()
"""

// We expect this error until System.Reflection.Emit gets fixed for emitting `modreq` on method calls.
// See: https://github.com/dotnet/corefx/issues/29254
CompilerAssert.RunScript script [ "Method not found: '!0 ByRef System.ReadOnlySpan`1.get_Item(Int32)'." ]


[<Test>]
let ``Invalid usage of type abbreviated span should fail to compile``() =
CompilerAssert.TypeCheckWithErrors """
Expand Down
2 changes: 2 additions & 0 deletions tests/fsharp/core/array/test.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,11 @@ module Array2Tests = begin
test "fewoih2" (Array2D.get arr 0 1 = 0);
test "vvrew03" (Array2D.get arr 2 2 = 0);
test "vvrew04" (Array2D.get arr 2 3 = 0);

ignore (Array2D.set arr 0 2 4);
test "vsdiuvs5" (Array2D.get arr 0 2 = 4);
arr.[0,2] <- 2;

test "vsdiuvs6" (arr.[0,2] = 2);
test "vropivrwe7" (Array2D.length1 arr = 3);
test "vropivrwe8" (Array2D.length2 arr = 4)
Expand Down
2 changes: 2 additions & 0 deletions tests/fsharp/single-test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RestoreAdditionalProjectSources Condition = "" '$(RestoreAdditionalProjectSources)' == ''"">$(RestoreFromArtifactsPath)</RestoreAdditionalProjectSources>
<RestoreAdditionalProjectSources Condition = "" '$(RestoreAdditionalProjectSources)' != ''"">$(RestoreAdditionalProjectSources);$(RestoreFromArtifactsPath)</RestoreAdditionalProjectSources>
<RollForward>LatestMajor</RollForward>
</PropertyGroup>

<!-- FSharp.Core reference -->
Expand Down Expand Up @@ -257,6 +258,7 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion =

let targetsBody = generateTargets
let overridesBody = generateOverrides

let targetsFileName = Path.Combine(directory, "Directory.Build.targets")
let propsFileName = Path.Combine(directory, "Directory.Build.props")
let overridesFileName = Path.Combine(directory, "Directory.Overrides.targets")
Expand Down
5 changes: 4 additions & 1 deletion tests/fsharp/tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ module CoreTests =
[<Test>]
let ``array-FSC_BASIC`` () = singleTestBuildAndRun "core/array" FSC_BASIC

[<Test>]
// TODO: We need to migrate to .NET 6, but Array2D.set is broken there yet, until https://github.com/dotnet/runtime/pull/54656 gets into the release.
// It should land into preview7, which is set to be released August 10th 2021.
// These tests should be reenabled then.
[<Test; Ignore("Some tests fail on .NET6 preview6, and fixed in preview7, disabling until preview7 gets released.")>]
let ``array-FSI_BASIC`` () = singleTestBuildAndRun "core/array" FSI_BASIC

[<Test>]
Expand Down
2 changes: 1 addition & 1 deletion tests/fsharp/tools/eval/test.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -2285,7 +2285,7 @@ module Query =
F ([srcTy],[src])

let MakeQueryableTake =
let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Take @>
let F = MakeGenericStaticMethod <@ System.Linq.Queryable.Take : _ * int -> _ @>
vzarytovskii marked this conversation as resolved.
Show resolved Hide resolved
fun (srcTy,src,count) ->
let src = Expr.Coerce(src,MakeIQueryableTy srcTy)
F ([srcTy],[src;count])
Expand Down
9 changes: 5 additions & 4 deletions vsintegration/tests/UnitTests/Tests.Watson.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Tests.Compiler.Watson
#nowarn "52" // The value has been copied to ensure the original is not mutated

open FSharp.Compiler
open FSharp.Compiler.IO
open FSharp.Compiler.AbstractIL.ILBinaryReader
open FSharp.Compiler.CodeAnalysis
open Internal.Utilities.Library
Expand All @@ -20,9 +21,9 @@ type Check =
#if DEBUG
FSharp.Compiler.CompilerDiagnostics.CompilerService.showAssertForUnexpectedException := false
#endif
if (File.Exists("watson-test.fs")) then
File.Delete("watson-test.fs")
File.WriteAllText("watson-test.fs", "// Hello watson" )
if (FileSystem.FileExistsShim("watson-test.fs")) then
FileSystem.FileDeleteShim("watson-test.fs")
FileSystem.OpenFileForWriteShim("watson-test.fs").Write("// Hello watson" )
let argv =
[| "--simulateException:"+simulationCode
"--nowarn:988" // don't show `watson-test.fs(1,16): warning FS0988: Main module of program is empty: nothing will happen when it is run`
Expand All @@ -47,7 +48,7 @@ type Check =
#if DEBUG
FSharp.Compiler.CompilerDiagnostics.CompilerService.showAssertForUnexpectedException := true
#endif
File.Delete("watson-test.fs")
FileSystem.FileDeleteShim("watson-test.fs")


[<TestFixture>]
Expand Down