Skip to content

Commit

Permalink
WIP: Use Arcade's NetCurrent (#16682)
Browse files Browse the repository at this point in the history
* 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 <mthalman@microsoft.com>
Co-authored-by: Petr <psfinaki@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 23, 2024
1 parent f78cb7b commit d071ddc
Show file tree
Hide file tree
Showing 42 changed files with 172 additions and 131 deletions.
43 changes: 34 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<LangVersion Condition="'$(FSharpLangVersion)' != ''">$(FSharpLangVersion)</LangVersion>
<RepoRoot Condition="'$(RepoRoot)' == ''">$(MSBuildThisFileDirectory)</RepoRoot>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<FSharpNetCoreProductDefaultTargetFramework>net8.0</FSharpNetCoreProductDefaultTargetFramework>
</PropertyGroup>
<!--
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.
This option ensures that building and testing uses the specified FSharp.Core nuget package instead of the local
FSharp.Core project.
We also disable arcade and reset certain artifacts and compiler paths to use default ones
This option ensures that building and testing uses the specified FSharp.Core nuget package instead of the local FSharp.Core project.
We also disable arcade and reset certain artifacts and compiler paths to use default ones.
All settings below can be overriden via CLI switches if needed. -->

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

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

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
<DisableAutoSetFscCompilerPath>false</DisableAutoSetFscCompilerPath>
Expand All @@ -30,15 +30,40 @@
<ArtifactsDir>$(MSBuildThisFileDirectory)artifacts/</ArtifactsDir>
<OutputPath>$(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/</OutputPath>
<IntermediateOutputPath>$(ArtifactsDir)obj/$(MSBuildProjectName)/$(Configuration)/</IntermediateOutputPath>
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/net8.0/fslex.dll</FsLexPath>
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/net8.0/fsyacc.dll</FsYaccPath>
<!-- Note, that default framework is used here (the one we use for development in the current cycle),
since it's a non-arcade and non-sourcebuild scenario -->
<FsLexPath>$(ArtifactsDir)/bin/fslex/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/fslex.dll</FsLexPath>
<FsYaccPath>$(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/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="$(MSBuildThisFileDirectory)/eng/Versions.props" Condition="'$(DISABLE_ARCADE)' == 'true'"/>
<Import Project="FSharpBuild.Directory.Build.props" Condition=" '$(FSharpTestCompilerVersion)' == '' " />
<!-- To support source-build for the "next" version of .NET without forcing this repo to use it,
we can utilize arcade's $(NetCurrent) property, and set it ourselves in the arcade-less scenarios.
For FCS solution, we set it to one for current dev cycle.
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. -->
<Choose>
<!-- Once we move to OOP in VS, and major dependants of FCS will move to netcore (not netstandard),
we should also support $(NetPrevious) for all releases.
This will likely include FCS and FSharp.Core as well as shipped products.
Right now, it only covers products we ship (FSC and FSI), not NuGet packages. -->
<When Condition="'$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' == 'Product'">
<PropertyGroup>
<FSharpNetCoreProductTargetFramework>$(NetCurrent)</FSharpNetCoreProductTargetFramework>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<FSharpNetCoreProductTargetFramework>$(FSharpNetCoreProductDefaultTargetFramework)</FSharpNetCoreProductTargetFramework>
</PropertyGroup>
</Otherwise>
</Choose>

<Import Project="FSharpBuild.Directory.Build.props" Condition = " '$(FSharpTestCompilerVersion)' == '' "/>
<Import Project="FSharpTests.Directory.Build.props" Condition = " '$(FSharpTestCompilerVersion)' != '' "/>
<!-- It's important we set TFM before this, since FSharpTests.Directory.Build.props uses it.
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).
We probably should remove or revisit it. -->
<Import Project="FSharpTests.Directory.Build.props" Condition=" '$(FSharpTestCompilerVersion)' != '' " />

<ItemGroup>
<!-- If there is a README.md next to a project file, include it (for easier access in the IDE) -->
Expand Down
6 changes: 3 additions & 3 deletions FSharpTests.Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
<FscToolPath>$([System.IO.Path]::GetDirectoryName('$(DOTNET_HOST_PATH)'))</FscToolPath>
<FscToolExe Condition="'$(OS)' != 'Unix'">dotnet.exe</FscToolExe>
<FscToolExe Condition="'$(OS)' == 'Unix'">dotnet</FscToolExe>
<DotnetFscCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\net8.0\fsc.dll</DotnetFscCompilerPath>
<DotnetFscCompilerPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(FSharpNetCoreProductTargetFramework)\fsc.dll</DotnetFscCompilerPath>

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

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

<FSharpBuildAssemblyFile>$(_FSharpBuildBinPath)\FSharp.Build.dll</FSharpBuildAssemblyFile>
Expand Down
2 changes: 1 addition & 1 deletion buildtools/AssemblyCheck/AssemblyCheck.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="$(MSBuildProjectDirectory)\..\..\eng\Versions.props" />

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<CachePath>$(MSBuildProjectDirectory)\..\..\artifacts\tmp\$([System.Guid]::NewGuid())</CachePath>
<OutputPath>$(CachePath)\bin</OutputPath>
Expand Down
2 changes: 1 addition & 1 deletion buildtools/fslex/fslex.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
<RollForward Condition="'$(BUILDING_USING_DOTNET)' == 'true'">LatestMajor</RollForward>
Expand Down
2 changes: 1 addition & 1 deletion buildtools/fsyacc/fsyacc.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
<RollForward Condition="'$(BUILDING_USING_DOTNET)' == 'true'">LatestMajor</RollForward>
Expand Down
Loading

0 comments on commit d071ddc

Please sign in to comment.