Skip to content

Commit

Permalink
Update to .NET 9 rc1 (dotnet#17698)
Browse files Browse the repository at this point in the history
* Update to .NET 9 rc1

* Update to .NET 9 rc1

* Remove some leftovers

* Workaround for msbuild 17.11 issue + realsig off

* Trimming tests

* Trimming tests

* revert realsig
  • Loading branch information
vzarytovskii committed Sep 12, 2024
1 parent 3de720b commit aea757f
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
{
"name": "F#",
"image": "mcr.microsoft.com/dotnet/sdk:9.0.100-preview.7",
"image": "mcr.microsoft.com/dotnet/sdk:9.0.100-rc.1",
"features": {
"ghcr.io/devcontainers/features/common-utils:2.4.6": {},
"ghcr.io/devcontainers/features/common-utils:2.5.1": {},
"ghcr.io/devcontainers/features/git:1.3.2": {},
"ghcr.io/devcontainers/features/github-cli:1.0.13": {},
"ghcr.io/devcontainers/features/dotnet:2.1.2": {}
"ghcr.io/devcontainers/features/dotnet:2.1.3": {}
},
"hostRequirements": {
"cpus": 2,
Expand Down
6 changes: 5 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<DisableAutoSetFscCompilerPath>false</DisableAutoSetFscCompilerPath>
<FSHARPCORE_USE_PACKAGE Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">true</FSHARPCORE_USE_PACKAGE>

<!-- TODO(vlza): This probably should be `true` once fslib with nullness ships, since shipped library is preferred by default when building this solution. -->
<FSHARPCORE_USE_PACKAGE Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">false</FSHARPCORE_USE_PACKAGE>

<DISABLE_ARCADE Condition="'$(DISABLE_ARCADE)' == ''">true</DISABLE_ARCADE>
<ArtifactsDir>$(MSBuildThisFileDirectory)artifacts/</ArtifactsDir>
<OutputPath>$(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/</OutputPath>
Expand All @@ -57,6 +60,7 @@
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fsyacc.dll</FsYaccPath>
<DefineConstants>NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)/eng/Versions.props" Condition="'$(DISABLE_ARCADE)' == 'true'" />

<Import Project="FSharpBuild.Directory.Build.props" Condition=" '$(FSharpTestCompilerVersion)' == '' " />
Expand Down
25 changes: 25 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,29 @@
StopOnFirstFailure="True" />
</Target>

<!-- BEGIN workaround for https://github.com/dotnet/sdk/issues/43339; remove after updated to VS 17.12, future 17.11 patch or when arcade ships the the same workaround -->
<Target Name="WorkaroundDotnetSdk43339" BeforeTargets="ResolvePackageAssets" Condition=" '$(MSBuildRuntimeType)' == 'Full' and $([MSBuild]::VersionLessThan($(MSBuildVersion), 17.12.0))">
<PrimeSystemTextJson804 />
</Target>
<UsingTask
TaskName="PrimeSystemTextJson804"
TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
try
{
System.Reflection.Assembly.LoadFrom(@"$(MicrosoftNETBuildTasksDirectoryRoot)\..\..\..\DotnetTools\dotnet-format\BuildHost-net472\System.Text.Json.dll");
}
catch
{
// Best effort: if something moves in the SDK don't break the build.
}
]]>
</Code>
</Task>
</UsingTask>
<!-- END workaround for https://github.com/dotnet/sdk/issues/43339 -->

</Project>
4 changes: 4 additions & 0 deletions FSharp.Profiles.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<OtherFlags>$(OtherFlags) /langversion:preview</OtherFlags>
</PropertyGroup>

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<CheckNulls>false</CheckNulls>
</PropertyGroup>

<PropertyGroup Condition="'$(CheckNulls)' == 'true'">
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"sdk": {
"version": "9.0.100-preview.7.24407.12",
"version": "9.0.100-rc.1.24452.12",
"allowPrerelease": true
},
"tools": {
"dotnet": "9.0.100-preview.7.24407.12",
"dotnet": "9.0.100-rc.1.24452.12",
"vs": {
"version": "17.8",
"components": [
Expand Down
4 changes: 2 additions & 2 deletions tests/AheadOfTime/Trimming/check.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function CheckTrim($root, $tfm, $outputfile, $expected_len) {
# error NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher.

# Check net7.0 trimmed assemblies
CheckTrim -root "SelfContained_Trimming_Test" -tfm "net9.0" -outputfile "FSharp.Core.dll" -expected_len 287232
CheckTrim -root "SelfContained_Trimming_Test" -tfm "net9.0" -outputfile "FSharp.Core.dll" -expected_len 297984

# Check net8.0 trimmed assemblies
CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 8821248
CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 9148416
6 changes: 3 additions & 3 deletions tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ open System.Collections.Generic
let myDict = ["x",1;"xyz",2] |> dict |> Dictionary
let checkIfPresent (input:ReadOnlySpan<char>) =
let altLookup = myDict.GetAlternateLookup<string,int,ReadOnlySpan<char>>()
let altLookup = myDict.GetAlternateLookup<ReadOnlySpan<char>>()
let present = altLookup.ContainsKey(input)
for c in input do
printf "%c" c
Expand All @@ -134,7 +134,7 @@ let main _args =
|> shouldSucceed
|> verifyOutputContains [|": false";"x: true";"xyz: true"|]
|> verifyIL
["call valuetype [System.Collections]System.Collections.Generic.Dictionary`2/AlternateLookup`1<!!0,!!1,!!2> [System.Collections]System.Collections.Generic.CollectionExtensions::GetAlternateLookup<string,int32,valuetype [runtime]System.ReadOnlySpan`1<char>>(class [System.Collections]System.Collections.Generic.Dictionary`2<!!0,!!1>)"]
["callvirt instance valuetype [System.Collections]System.Collections.Generic.Dictionary`2/AlternateLookup`1<!0,!1,!!0> class [System.Collections]System.Collections.Generic.Dictionary`2<string,int32>::GetAlternateLookup<valuetype [runtime]System.ReadOnlySpan`1<char>>()"]

[<FactForNETCOREAPP>]
let ``Ref structs in generics - GetAlternateLookup`` () =
Expand All @@ -144,7 +144,7 @@ open System.Collections.Generic
let main _args =
let myDict = ["x",1;"y",2] |> dict |> Dictionary
let altLookup = myDict.GetAlternateLookup<string,int,ReadOnlySpan<char>>()
let altLookup = myDict.GetAlternateLookup<ReadOnlySpan<char>>()
altLookup.ContainsKey(ReadOnlySpan([|'x'|]))
"""
|> withLangVersionPreview
Expand Down

0 comments on commit aea757f

Please sign in to comment.