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

Make FSharp.Build build netstandard2.0 #10626

Merged
merged 8 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ try {

Push-Location $RepoRoot

Get-ChildItem ENV: | Sort-Object Name
Write-Host ""

if ($ci) {
Prepare-TempDir
EnablePreviewSdks
Expand Down
2 changes: 1 addition & 1 deletion proto.proj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<Projects Include="src\fsharp\FSharp.Build\FSharp.Build.fsproj">
<AdditionalProperties Condition="'$(OS)' == 'Unix'">TargetFramework=netcoreapp3.1</AdditionalProperties>
<AdditionalProperties>TargetFramework=netstandard2.0</AdditionalProperties>
</Projects>
<Projects Include="src\fsharp\fsc\fsc.fsproj">
<AdditionalProperties Condition="'$(OS)' == 'Unix'">TargetFramework=netcoreapp3.1</AdditionalProperties>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this now be moved to the upper property group unconditionally?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, this is proto.proj, was this intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<_Line>
<![CDATA[
folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp\%(_XlfLanguages.Identity)"
file source="$(ArtifactsBinDir)FSharp.Build\$(Configuration)\$(TargetFramework)\%(_XlfLanguages.Identity)\FSharp.Build.resources.dll"
file source="$(ArtifactsBinDir)FSharp.Build\$(Configuration)\netstandard2.0\%(_XlfLanguages.Identity)\FSharp.Build.resources.dll"
file source="$(ArtifactsBinDir)FSharp.Compiler.Interactive.Settings\$(Configuration)\$(TargetFramework)\%(_XlfLanguages.Identity)\FSharp.Compiler.Interactive.Settings.resources.dll"
file source="$(ArtifactsBinDir)FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\%(_XlfLanguages.Identity)\FSharp.Compiler.Private.resources.dll"
file source="$(ArtifactsBinDir)FSharp.Core\$(Configuration)\netstandard2.0\%(_XlfLanguages.Identity)\FSharp.Core.resources.dll"
Expand Down Expand Up @@ -91,26 +91,26 @@ folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp"
file source="$(BinariesFolder)\FSharp.Compiler.Interactive.Settings\$(Configuration)\$(TargetFramework)\FSharp.Compiler.Interactive.Settings.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\FSharp.Compiler.Private.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Buffers.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Collections.Immutable.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Memory.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Numerics.Vectors.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Reflection.Metadata.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Resources.Extensions.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Runtime.CompilerServices.Unsafe.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\System.Threading.Tasks.Dataflow.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\Microsoft.Build.Framework.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\Microsoft.Build.Tasks.Core.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Private\$(Configuration)\$(TargetFramework)\Microsoft.Build.Utilities.Core.dll"
file source="$(BinariesFolder)\FSharp.Compiler.Server.Shared\$(Configuration)\$(TargetFramework)\FSharp.Compiler.Server.Shared.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)\FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.xml"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\FSharp.Build.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)\Microsoft.DotNet.DependencyManager\$(Configuration)\net472\Microsoft.DotNet.DependencyManager.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Framework.dll"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Tasks.Core.dll"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Build.Utilities.Core.dll"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.Portable.FSharp.Targets"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\System.Collections.Immutable.dll"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.FSharp.NetSdk.props"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.FSharp.NetSdk.targets"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.FSharp.Overrides.NetSdk.targets"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\$(TargetFramework)\Microsoft.FSharp.Targets"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\netstandard2.0\FSharp.Build.dll" vs.file.ngen=no vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\netstandard2.0\Microsoft.Portable.FSharp.Targets"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\netstandard2.0\Microsoft.FSharp.NetSdk.props"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\netstandard2.0\Microsoft.FSharp.NetSdk.targets"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\netstandard2.0\Microsoft.FSharp.Overrides.NetSdk.targets"
file source="$(BinariesFolder)\FSharp.Build\$(Configuration)\netstandard2.0\Microsoft.FSharp.Targets"
file source="$(BinariesFolder)\Microsoft.DotNet.DependencyManager\$(Configuration)\net472\Microsoft.DotNet.DependencyManager.dll" vs.file.ngen=no vs.file.ngenArchitecture=All vs.file.ngenPriority=2

@(_BuiltSwrLines)
]]>
Expand Down
7 changes: 4 additions & 3 deletions src/fsharp/FSharp.Build/FSharp.Build.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks Condition="'$(ProtoTargetFramework)' != ''">$(ProtoTargetFramework)</TargetFrameworks>
<TargetFrameworks Condition="'$(ProtoTargetFramework)' == ''">net472;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.1</TargetFrameworks>
<TargetFramework Condition="'$(Configuration)' != 'Proto'">netstandard2.0</TargetFramework>
<TargetFrameworks Condition="'$(Configuration)' == 'Proto'">netstandard2.0</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be collapsed into a single <TargetFramework>netstandard2.0</TargetFramework>.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brettfo , yeah ... no. We publish and publish requires either a single tfm or a specified framework, I couldn't figure out how to specify a framework on the unix build.
A single tfm in the product build fails with missing tfms. I wasted days trying to figure out something that would actually work. But we can get together and you can experience the frustration of it if you would like,

<AssemblyName>FSharp.Build</AssemblyName>
<NoWarn>$(NoWarn);45;55;62;75;1204</NoWarn>
<AllowCrossTargeting>true</AllowCrossTargeting>
<OtherFlags>$(OtherFlags) --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
<NGenBinary>true</NGenBinary>
<DefineConstants>$(DefineConstants);LOCALIZATION_FSBUILD</DefineConstants>
<NoWarn>NU1701;FS0075</NoWarn>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<AdditionalProperties>TargetFramework=netcoreapp3.1</AdditionalProperties>
</ProjectReference>
<ProjectReference Include="..\FSharp.Build\FSharp.Build.fsproj">
<AdditionalProperties>TargetFramework=netcoreapp3.1</AdditionalProperties>
<AdditionalProperties>TargetFramework=netstandard2.0</AdditionalProperties>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the TFM of FSharp.Build is only netstandard2.0, this shouldn't be necessary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you would think .... however ... the proto project is a bit wierder than it looks, like above we can get together and you can experience the wierdness if you like.

</ProjectReference>
<ProjectReference Include="..\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj">
<AdditionalProperties>TargetFramework=netstandard2.0</AdditionalProperties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<file src="FSharp.Core\$Configuration$\netstandard2.0\FSharp.Core.dll" target="lib\netcoreapp3.1" />
<file src="FSharp.Core\$Configuration$\netstandard2.0\FSharp.Core.xml" target="lib\netcoreapp3.1" />
<file src="FSharp.Compiler.Private\$Configuration$\netstandard2.0\FSharp.Compiler.Private.dll" target="lib\netcoreapp3.1" />
<file src="FSharp.Build\$Configuration$\netcoreapp3.1\FSharp.Build.dll" target="lib\netcoreapp3.1" />
<file src="FSharp.Build\$Configuration$\netstandard2.0\FSharp.Build.dll" target="lib\netcoreapp3.1" />
<file src="FSharp.DependencyManager.Nuget\$configuration$\netstandard2.0\FSharp.DependencyManager.Nuget.dll"
target="lib\netcoreapp3.1" />
<file src="Microsoft.DotNet.DependencyManager\$configuration$\netstandard2.0\Microsoft.DotNet.DependencyManager.dll"
Expand All @@ -61,19 +61,19 @@

<!-- additional files -->
<file src="fsc\$Configuration$\netcoreapp3.1\default.win32manifest" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netcoreapp3.1\Microsoft.FSharp.Targets" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netcoreapp3.1\Microsoft.Portable.FSharp.Targets" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netcoreapp3.1\Microsoft.FSharp.NetSdk.props" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netcoreapp3.1\Microsoft.FSharp.NetSdk.targets" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netcoreapp3.1\Microsoft.FSharp.Overrides.NetSdk.targets" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netstandard2.0\Microsoft.FSharp.Targets" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netstandard2.0\Microsoft.Portable.FSharp.Targets" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netstandard2.0\Microsoft.FSharp.NetSdk.props" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netstandard2.0\Microsoft.FSharp.NetSdk.targets" target="contentFiles\any\any" />
<file src="FSharp.Build\$Configuration$\netstandard2.0\Microsoft.FSharp.Overrides.NetSdk.targets" target="contentFiles\any\any" />

<!-- resources -->
<file src="FSharp.Core\$Configuration$\netstandard2.0\**\FSharp.Core.resources.dll" target="lib\netcoreapp3.1" />
<file src="FSharp.Compiler.Private\$Configuration$\netstandard2.0\**\FSharp.Compiler.Private.resources.dll"
target="lib\netcoreapp3.1" />
<file src="FSharp.Compiler.Interactive.Settings\$Configuration$\netstandard2.0\**\FSharp.Compiler.Interactive.Settings.resources.dll"
target="lib\netcoreapp3.1" />
<file src="FSharp.Build\$Configuration$\netcoreapp3.1\**\FSharp.Build.resources.dll" target="lib\netcoreapp3.1" />
<file src="FSharp.Build\$Configuration$\netstandard2.0\**\FSharp.Build.resources.dll" target="lib\netcoreapp3.1" />
<file src="FSharp.DependencyManager.Nuget\$configuration$\netstandard2.0\**\FSharp.DependencyManager.Nuget.resources.dll"
target="lib\netcoreapp3.1" />
<file src="Microsoft.DotNet.DependencyManager\$Configuration$\netstandard2.0\**\Microsoft.DotNet.DependencyManager.resources.dll"
Expand Down
6 changes: 2 additions & 4 deletions tests/FSharp.Test.Utilities/TestFramework.fs
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,16 @@ let requireFile dir path =

let config configurationName envVars =
let SCRIPT_ROOT = __SOURCE_DIRECTORY__
let fsharpCoreArchitecture = "netstandard2.0"
let fsharpBuildArchitecture = "netstandard2.0"
#if NET472
let fscArchitecture = "net472"
let fsiArchitecture = "net472"
let fsharpCoreArchitecture = "netstandard2.0"
let fsharpBuildArchitecture = "net472"
let fsharpCompilerInteractiveSettingsArchitecture = "net472"
let peverifyArchitecture = "net472"
#else
let fscArchitecture = "netcoreapp3.1"
let fsiArchitecture = "netcoreapp3.1"
let fsharpCoreArchitecture = "netstandard2.0"
let fsharpBuildArchitecture = "netcoreapp3.1"
let fsharpCompilerInteractiveSettingsArchitecture = "netstandard2.0"
let peverifyArchitecture = "netcoreapp3.1"
#endif
Expand Down
2 changes: 1 addition & 1 deletion tests/fsharp/SDKTests/tests/Test.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">.NETFramework</TargetFrameworkIdentifier>

<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<TargetsDirectory>$(MSBuildThisFileDirectory)..\..\..\..\artifacts\bin\FSharp.Build\$(Configuration)\net472</TargetsDirectory>
<TargetsDirectory>$(MSBuildThisFileDirectory)..\..\..\..\artifacts\bin\FSharp.Build\$(Configuration)\netstandard2.0</TargetsDirectory>

<!-- these properties don't really matter, but they're necessary to make MSBuild happy -->
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
Expand Down
2 changes: 1 addition & 1 deletion tests/fsharp/tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ module CoreTests =
[<Test>]
let ``SDKTests`` () =
let cfg = testConfig' "SDKTests"
exec cfg cfg.DotNetExe ("msbuild " + Path.Combine(cfg.Directory, "AllSdkTargetsTests.proj"))
exec cfg cfg.DotNetExe ("msbuild " + Path.Combine(cfg.Directory, "AllSdkTargetsTests.proj") + " /p:Configuration=" + cfg.BUILD_CONFIG)

#if !NETCOREAPP
[<Test>]
Expand Down