Skip to content

Commit d071ddc

Browse files
vzarytovskiimthalmanpsfinaki
authored
WIP: Use Arcade's NetCurrent (dotnet#16682)
* WIP: Use Arcade's NetCurrent * WIP: Use Arcade's NetCurrent * Ordering of property groups * Build scripts? * Typo * Typo2 * Fix nuspec, please * Updates to support VMR build * Only set tfm option if SourceBuildBootstrapTfm is set * Fix ordering, set tfm before we account for building without arcade * Add rest of test projects * typos * Trimming is isolated and can't use global TFM value * Fix arcade interaction with our build props --------- Co-authored-by: Matt Thalman <[email protected]> Co-authored-by: Petr <[email protected]>
1 parent f78cb7b commit d071ddc

File tree

42 files changed

+172
-131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+172
-131
lines changed

Directory.Build.props

+34-9
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<LangVersion Condition="'$(FSharpLangVersion)' != ''">$(FSharpLangVersion)</LangVersion>
55
<RepoRoot Condition="'$(RepoRoot)' == ''">$(MSBuildThisFileDirectory)</RepoRoot>
66
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
7+
<FSharpNetCoreProductDefaultTargetFramework>net8.0</FSharpNetCoreProductDefaultTargetFramework>
78
</PropertyGroup>
89
<!--
910
When developers load the FSharp.Compiler.Service solution we set FSHARPCORE_USE_PACKAGE to true if it hasn't already been set to a value.
10-
This option ensures that building and testing uses the specified FSharp.Core nuget package instead of the local
11-
FSharp.Core project.
12-
We also disable arcade and reset certain artifacts and compiler paths to use default ones
11+
This option ensures that building and testing uses the specified FSharp.Core nuget package instead of the local FSharp.Core project.
12+
We also disable arcade and reset certain artifacts and compiler paths to use default ones.
1313
All settings below can be overriden via CLI switches if needed. -->
1414

1515
<PropertyGroup Condition="'$(SolutionName)' == 'FSharp.Compiler.Service' and '$(BUILDING_USING_DOTNET)' != 'false'">
@@ -21,7 +21,7 @@
2121
<BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
2222
</PropertyGroup>
2323

24-
<Import Project="$(RepoRoot)/Directory.Build.props.user" Condition = "Exists('$(RepoRoot)/Directory.Build.props.user')" />
24+
<Import Project="$(RepoRoot)/Directory.Build.props.user" Condition="Exists('$(RepoRoot)/Directory.Build.props.user')" />
2525

2626
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
2727
<DisableAutoSetFscCompilerPath>false</DisableAutoSetFscCompilerPath>
@@ -30,15 +30,40 @@
3030
<ArtifactsDir>$(MSBuildThisFileDirectory)artifacts/</ArtifactsDir>
3131
<OutputPath>$(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/</OutputPath>
3232
<IntermediateOutputPath>$(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/</IntermediateOutputPath>
33-
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/net8.0/fslex.dll</FsLexPath>
34-
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/net8.0/fsyacc.dll</FsYaccPath>
33+
<!-- Note, that default framework is used here (the one we use for development in the current cycle),
34+
since it's a non-arcade and non-sourcebuild scenario -->
35+
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/fslex.dll</FsLexPath>
36+
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/fsyacc.dll</FsYaccPath>
3537
<DefineConstants>NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants)</DefineConstants>
3638
</PropertyGroup>
39+
<Import Project="$(MSBuildThisFileDirectory)/eng/Versions.props" Condition="'$(DISABLE_ARCADE)' == 'true'" />
3740

38-
<Import Project="$(MSBuildThisFileDirectory)/eng/Versions.props" Condition="'$(DISABLE_ARCADE)' == 'true'"/>
41+
<Import Project="FSharpBuild.Directory.Build.props" Condition=" '$(FSharpTestCompilerVersion)' == '' " />
42+
<!-- To support source-build for the "next" version of .NET without forcing this repo to use it,
43+
we can utilize arcade's $(NetCurrent) property, and set it ourselves in the arcade-less scenarios.
44+
For FCS solution, we set it to one for current dev cycle.
45+
When used with arcade, and inserting/building for net8 branches, it will set it to net8.0, for net9 branches to net9.0 and so on. -->
46+
<Choose>
47+
<!-- Once we move to OOP in VS, and major dependants of FCS will move to netcore (not netstandard),
48+
we should also support $(NetPrevious) for all releases.
49+
This will likely include FCS and FSharp.Core as well as shipped products.
50+
Right now, it only covers products we ship (FSC and FSI), not NuGet packages. -->
51+
<When Condition="'$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' == 'Product'">
52+
<PropertyGroup>
53+
<FSharpNetCoreProductTargetFramework>$(NetCurrent)</FSharpNetCoreProductTargetFramework>
54+
</PropertyGroup>
55+
</When>
56+
<Otherwise>
57+
<PropertyGroup>
58+
<FSharpNetCoreProductTargetFramework>$(FSharpNetCoreProductDefaultTargetFramework)</FSharpNetCoreProductTargetFramework>
59+
</PropertyGroup>
60+
</Otherwise>
61+
</Choose>
3962

40-
<Import Project="FSharpBuild.Directory.Build.props" Condition = " '$(FSharpTestCompilerVersion)' == '' "/>
41-
<Import Project="FSharpTests.Directory.Build.props" Condition = " '$(FSharpTestCompilerVersion)' != '' "/>
63+
<!-- It's important we set TFM before this, since FSharpTests.Directory.Build.props uses it.
64+
TODO(vlza): this build props looks outdated, since we only use $(FSharpTestCompilerVersion) in TP tests or cambridge suite (which we slowly want to migrate to xUnit).
65+
We probably should remove or revisit it. -->
66+
<Import Project="FSharpTests.Directory.Build.props" Condition=" '$(FSharpTestCompilerVersion)' != '' " />
4267

4368
<ItemGroup>
4469
<!-- If there is a README.md next to a project file, include it (for easier access in the IDE) -->

FSharpTests.Directory.Build.props

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@
2222
<FscToolPath>$([System.IO.Path]::GetDirectoryName('$(DOTNET_HOST_PATH)'))</FscToolPath>
2323
<FscToolExe Condition="'$(OS)' != 'Unix'">dotnet.exe</FscToolExe>
2424
<FscToolExe Condition="'$(OS)' == 'Unix'">dotnet</FscToolExe>
25-
<DotnetFscCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\net8.0\fsc.dll</DotnetFscCompilerPath>
25+
<DotnetFscCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(FSharpNetCoreProductTargetFramework)\fsc.dll</DotnetFscCompilerPath>
2626

2727
<FsiToolPath>$([System.IO.Path]::GetDirectoryName('$(DOTNET_HOST_PATH)'))</FsiToolPath>
2828
<FsiToolExe Condition="'$(OS)' != 'Unix'">dotnet.exe</FsiToolExe>
2929
<FsiToolExe Condition="'$(OS)' == 'Unix'">dotnet</FsiToolExe>
30-
<DotnetFsiCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\net8.0\fsi.dll</DotnetFsiCompilerPath>
30+
<DotnetFsiCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsi\$(Configuration)\$(FSharpNetCoreProductTargetFramework)\fsi.dll</DotnetFsiCompilerPath>
3131
</PropertyGroup>
3232

3333
<!-- SDK targets override -->
3434
<PropertyGroup>
3535
<_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'!='Core'">net472</_FSharpBuildTargetFramework>
36-
<_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'=='Core'">net8.0</_FSharpBuildTargetFramework>
36+
<_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'=='Core'">$(FSharpNetCoreProductTargetFramework)</_FSharpBuildTargetFramework>
3737
<_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(_FSharpBuildTargetFramework)</_FSharpBuildBinPath>
3838

3939
<FSharpBuildAssemblyFile>$(_FSharpBuildBinPath)\FSharp.Build.dll</FSharpBuildAssemblyFile>

buildtools/AssemblyCheck/AssemblyCheck.fsproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
66
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
77
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
88
</PropertyGroup>

buildtools/checkpackages/FSharp.Compiler.Service_notshipped.fsproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<Import Project="$(MSBuildProjectDirectory)\..\..\eng\Versions.props" />
4-
4+
55
<PropertyGroup>
6-
<TargetFramework>net8.0</TargetFramework>
6+
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
77
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
88
<CachePath>$(MSBuildProjectDirectory)\..\..\artifacts\tmp\$([System.Guid]::NewGuid())</CachePath>
99
<OutputPath>$(CachePath)\bin</OutputPath>

buildtools/fslex/fslex.fsproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
66
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
77
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
88
<RollForward Condition="'$(BUILDING_USING_DOTNET)' == 'true'">LatestMajor</RollForward>

buildtools/fsyacc/fsyacc.fsproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
66
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
77
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
88
<RollForward Condition="'$(BUILDING_USING_DOTNET)' == 'true'">LatestMajor</RollForward>

0 commit comments

Comments
 (0)