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

Attempt to make FCS solution build without arcade and with the SDK specified in global.json #14677

Merged
merged 57 commits into from
Mar 28, 2023

Conversation

vzarytovskii
Copy link
Member

@vzarytovskii vzarytovskii commented Jan 30, 2023

TL;DR: Now it's possible to use dotnet build ./FSharp.Compiler.Service.sln, CI and recommended dev flows will continue using build scripts.

Now, when building with plain dotnet, we

  • Won't include Arcade SDK
  • Won't run Proto build compiler, and will use the one from global.json
  • Will build fslexyacc as part of FCS build.

Warning
Building with dotnet build is enabled when explicitly running it for FSharp.Compiler.Service.sln
OR
Additionally, for advanced contributors only, you can create a file, named Directory.Build.props.user in the repository root, with the following contents

<Project>
    <PropertyGroup>
        <BUILDING_USING_DOTNET>true</BUILDING_USING_DOTNET>
    </PropertyGroup>
</Project>

This will allow building individual projects/solutions using dotnet build.


Note
This does not affect FSharp.sln and VisualFSharp.sln, using FSharp.Compiler.Service.sln is targeted to advanced contributors who make changes to FCS itself.

Warning
Please, keep in mind that mixing building with build scripts and via dotnet cli is not a supported scenario, and may lead to weird build issues.

Warning
Please, also keep in mind that for near future we will still be running official builds using proto compiler, in both our CI and official builds. This means that you may be seeing slightly different results locally and on CI. In case of any problems, it's advised to verify builds locally with build scripts.


If this passes (and overall looks good for @KevinRansom, @auduchinok, @safesparrow and @nojaf), we can further cleanup/change FCS solution to be slimmer/include only relevant tests.

@vzarytovskii vzarytovskii requested a review from a team as a code owner January 30, 2023 16:20
Copy link
Contributor

@0101 0101 left a comment

Choose a reason for hiding this comment

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

Should we update DEVGUIDE with this being available and how to use it?

@nojaf
Copy link
Contributor

nojaf commented Jan 30, 2023

@vzarytovskii could we have --test:ParallelCheckingWithSignatureFilesOn enabled as well while we are targeting the dotnet 7 SDK?

@vzarytovskii
Copy link
Member Author

It seems it passes. Can someone please try it on different OSs? Just dotnet build the FCS solution, try to load it in IDE?

@nojaf
Copy link
Contributor

nojaf commented Jan 30, 2023

@vzarytovskii as mentioned on Slack, I believe the test SDK is missing:

image

I also am not seeing any files in ComponentTests:

image

@vzarytovskii
Copy link
Member Author

@vzarytovskii as mentioned on Slack, I believe the test SDK is missing:

image

I also am not seeing any files in ComponentTests:

image

Thanks, will add it and test in IDEs

@T-Gro
Copy link
Member

T-Gro commented Jan 31, 2023

Regarding which projects to keep:

It should include all projects which are likely to be affected (=> get broken, tests start failing) by a contribution.
So I would say all the test suites exercising the compiler and it's diagnostics should stay.

Otherwise:
Someone gets an CI error, but does not have a natural flow in the IDE for fixing it.

@vzarytovskii
Copy link
Member Author

Regarding which projects to keep:

It should include all projects which are likely to be affected (=> get broken, tests start failing) by a contribution.
So I would say all the test suites exercising the compiler and it's diagnostics should stay.

Otherwise:
Someone gets an CI error, but does not have a natural flow in the IDE for fixing it.

FCS solution is about faster devloop, so if something else besides the compiler lib is broken, one should go the standard buildscripts way.

@T-Gro
Copy link
Member

T-Gro commented Jan 31, 2023

Regarding which projects to keep:
It should include all projects which are likely to be affected (=> get broken, tests start failing) by a contribution.
So I would say all the test suites exercising the compiler and it's diagnostics should stay.
Otherwise:
Someone gets an CI error, but does not have a natural flow in the IDE for fixing it.

FCS solution is about faster devloop, so if something else besides the compiler lib is broken, one should go the standard buildscripts way.

Test projects and even benchmarks are included in that solution as of today anyway.
And if making standard things build & pass is considered part of the dev loop (it should!), closing a solution and opening another one to fix a test does not feel faster.

@nojaf
Copy link
Contributor

nojaf commented Jan 31, 2023

And if making standard things build & pass is considered part of the dev loop (it should!), closing a solution and opening another one to fix a test does not feel faster.

Isn't that always a bit of how it has been? When I change something in the compiler, I for sure don't open FSharp.sln, so when I break a test there, I'll need to open that one anyway. But I would only do that once CI turns red.

I typically never run all the tests, to be honest. I don't have a good experience with it, some tests will fail on my machine while they run fine on the CI. #14637 is a good example of that.

@T-Gro
Copy link
Member

T-Gro commented Jan 31, 2023

I don't run the full suite locally either. It's more about the ability to locate a test (given the name from a failing CI job) and fixing it in editor.
So even if you commit & push to execution on the server, it still saves you from opening another solution (or another editor) for the "find & edit" operation.

@vzarytovskii
Copy link
Member Author

I think FCS lib, tests and benchmarks are fine for now. I may want to figure out a way of debugging tests using vsdbg and netcoredbg.

@safesparrow
Copy link
Contributor

safesparrow commented Jan 31, 2023 via email

@baronfel
Copy link
Member

I'm not sure that FSAC supports solution filters, so that might regress the devcontainers development scenario.

@vzarytovskii
Copy link
Member Author

Slightly related: Can we replace multiple solutions with a single one + solution filters? Those can be built with dotnet just as well. And if solution folders are setup nicely, it's easy to add missing projects. Although need to make it so that no local filter changes end up in git.

Solutions is the official suggestion from engineering system team, so we'll probably be sticking with multiple solutions for now.
Plus, as Chet mentioned - FSAC might not support it.

@vzarytovskii
Copy link
Member Author

One problem left - is that our test framework relies on where test dlls are emitted to, and we don't change it in case if arcade-less build.
WIll look at it later.

Copy link
Member

@auduchinok auduchinok left a comment

Choose a reason for hiding this comment

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

This is a super cool, can't wait to start using these changes! 🎉

Directory.Build.props Outdated Show resolved Hide resolved
@auduchinok
Copy link
Member

auduchinok commented Feb 10, 2023

I've just tried working with this branch, and building FCS is a fantastic experience there: all builds super fast and stable.

I couldn't make any tests work, though, and get this error:

System.TypeInitializationException : The type initializer for '<StartupCode$FSharp-Test-Utilities>.$Utilities' threw an exception.
  ----> System.Exception : Couldn't find "FSharp.Build\Debug\netstandard2.0\FSharp.Build.dll" on the following paths: "C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\..\..\artifacts\bin\FSharp.Build\Debug\netstandard2.0\FSharp.Build.dll", "C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\..\..\artifacts\bin\fsharp.build\debug\netstandard2.0\fsharp.build.dll". Running 'build test' once might solve this issue
   at FSharp.Test.Utilities.TargetFrameworkUtil.get_currentReferences()
   at FSharp.Compiler.Service.Tests.Common.mkStandardProjectReferences() in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 78
   at FSharp.Compiler.Service.Tests.Common.mkProjectCommandLineArgsSilent(String dllName, IEnumerable`1 fileNames) in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 99
   at FSharp.Compiler.Service.Tests.Common.mkProjectCommandLineArgs(String dllName, IEnumerable`1 fileNames) in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 106
   at FSharp.Compiler.Service.Tests.Common.parseSourceCode(String name, String code) in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 195
   at FSharp.Compiler.Service.Tests.Common.getParseResults(String source) in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 347
   at FSharp.Compiler.Service.Tests.SyntaxTreeTests.ModuleOrNamespaceTests.DeclaredNamespace range should start at namespace keyword() in C:\Developer\fsharp-vlad\tests\service\SyntaxTreeTests\ModuleOrNamespaceTests.fs:line 10
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
--Exception
   at TestFramework.requireFile(String dir, String path) in C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\TestFramework.fs:line 295
   at TestFramework.requireArtifact@325.Invoke(String path)
   at TestFramework.config(String configurationName, FSharpMap`2 envVars) in C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\TestFramework.fs:line 335
   at TestFramework.initializeSuite() in C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\TestFramework.fs:line 447
   at <StartupCode$FSharp-Test-Utilities>.$Utilities..cctor() in C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\Utilities.fs:line 130

And if I try to do ./build.cmd -noVisualStudio after building the FCS solution, then there're other errors:

C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\.NETStandard,Version=v2.0.AssemblyAttributes.cs(4,12): error CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFram
eworkAttribute' attribute [C:\Developer\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(13,12): error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute [C:\D
eveloper\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(14,12): error CS0579: Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
 [C:\Developer\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(16,12): error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute [
C:\Developer\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(17,12): error CS0579: Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' at
tribute [C:\Developer\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(18,12): error CS0579: Duplicate 'System.Reflection.AssemblyProductAttribute' attribute [C:\D
eveloper\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(19,12): error CS0579: Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute [C:\Dev
eloper\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(20,12): error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute [C:\D
eveloper\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Users\eugene.auduchinok\.nuget\packages\microsoft.dotnet.xlifftasks\1.0.0-beta.22513.1\build\Microsoft.DotNet.XliffTasks.targets(123,5): error : Two or more source files to be translated in the sam
e project are named FSInteractiveSettings.txt. Give them unique names or set unique XlfTranslatedFilename metadata. [C:\Developer\fsharp-vlad\src\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.I
nteractive.Settings.fsproj::TargetFramework=netstandard2.0]
C:\Users\eugene.auduchinok\.nuget\packages\microsoft.dotnet.xlifftasks\1.0.0-beta.22513.1\build\Microsoft.DotNet.XliffTasks.targets(123,5): error : Two or more source files to be translated in the sam
e project are named FSBuild.txt. Give them unique names or set unique XlfTranslatedFilename metadata. [C:\Developer\fsharp-vlad\src\FSharp.Build\FSharp.Build.fsproj]
C:\Users\eugene.auduchinok\.nuget\packages\microsoft.dotnet.xlifftasks\1.0.0-beta.22513.1\build\Microsoft.DotNet.XliffTasks.targets(123,5): error : Two or more source files to be translated in the sam
e project are named FSDependencyManager.txt. Give them unique names or set unique XlfTranslatedFilename metadata. [C:\Developer\fsharp-vlad\src\FSharp.DependencyManager.Nuget\FSharp.DependencyManager.
Nuget.fsproj::TargetFramework=netstandard2.0]
    0 Warning(s)
    11 Error(s)

@vzarytovskii
Copy link
Member Author

vzarytovskii commented Feb 10, 2023

I've just tried working with this branch, and building FCS is a fantastic experience there: all builds super fast and stable.

I couldn't make any tests work, though, and get this error:

System.TypeInitializationException : The type initializer for '<StartupCode$FSharp-Test-Utilities>.$Utilities' threw an exception.
  ----> System.Exception : Couldn't find "FSharp.Build\Debug\netstandard2.0\FSharp.Build.dll" on the following paths: "C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\..\..\artifacts\bin\FSharp.Build\Debug\netstandard2.0\FSharp.Build.dll", "C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\..\..\artifacts\bin\fsharp.build\debug\netstandard2.0\fsharp.build.dll". Running 'build test' once might solve this issue
   at FSharp.Test.Utilities.TargetFrameworkUtil.get_currentReferences()
   at FSharp.Compiler.Service.Tests.Common.mkStandardProjectReferences() in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 78
   at FSharp.Compiler.Service.Tests.Common.mkProjectCommandLineArgsSilent(String dllName, IEnumerable`1 fileNames) in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 99
   at FSharp.Compiler.Service.Tests.Common.mkProjectCommandLineArgs(String dllName, IEnumerable`1 fileNames) in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 106
   at FSharp.Compiler.Service.Tests.Common.parseSourceCode(String name, String code) in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 195
   at FSharp.Compiler.Service.Tests.Common.getParseResults(String source) in C:\Developer\fsharp-vlad\tests\service\Common.fs:line 347
   at FSharp.Compiler.Service.Tests.SyntaxTreeTests.ModuleOrNamespaceTests.DeclaredNamespace range should start at namespace keyword() in C:\Developer\fsharp-vlad\tests\service\SyntaxTreeTests\ModuleOrNamespaceTests.fs:line 10
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
--Exception
   at TestFramework.requireFile(String dir, String path) in C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\TestFramework.fs:line 295
   at TestFramework.requireArtifact@325.Invoke(String path)
   at TestFramework.config(String configurationName, FSharpMap`2 envVars) in C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\TestFramework.fs:line 335
   at TestFramework.initializeSuite() in C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\TestFramework.fs:line 447
   at <StartupCode$FSharp-Test-Utilities>.$Utilities..cctor() in C:\Developer\fsharp-vlad\tests\FSharp.Test.Utilities\Utilities.fs:line 130

And if I try to do ./build.cmd -noVisualStudio after building the FCS solution, then there're other errors:

C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\.NETStandard,Version=v2.0.AssemblyAttributes.cs(4,12): error CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFram
eworkAttribute' attribute [C:\Developer\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(13,12): error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute [C:\D
eveloper\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(14,12): error CS0579: Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
 [C:\Developer\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(16,12): error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute [
C:\Developer\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(17,12): error CS0579: Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' at
tribute [C:\Developer\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(18,12): error CS0579: Duplicate 'System.Reflection.AssemblyProductAttribute' attribute [C:\D
eveloper\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(19,12): error CS0579: Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute [C:\Dev
eloper\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Developer\fsharp-vlad\artifacts\obj\CSharp_Analysis\Debug\netstandard2.0\CSharp_Analysis.AssemblyInfo.cs(20,12): error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute [C:\D
eveloper\fsharp-vlad\tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj]
C:\Users\eugene.auduchinok\.nuget\packages\microsoft.dotnet.xlifftasks\1.0.0-beta.22513.1\build\Microsoft.DotNet.XliffTasks.targets(123,5): error : Two or more source files to be translated in the sam
e project are named FSInteractiveSettings.txt. Give them unique names or set unique XlfTranslatedFilename metadata. [C:\Developer\fsharp-vlad\src\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.I
nteractive.Settings.fsproj::TargetFramework=netstandard2.0]
C:\Users\eugene.auduchinok\.nuget\packages\microsoft.dotnet.xlifftasks\1.0.0-beta.22513.1\build\Microsoft.DotNet.XliffTasks.targets(123,5): error : Two or more source files to be translated in the sam
e project are named FSBuild.txt. Give them unique names or set unique XlfTranslatedFilename metadata. [C:\Developer\fsharp-vlad\src\FSharp.Build\FSharp.Build.fsproj]
C:\Users\eugene.auduchinok\.nuget\packages\microsoft.dotnet.xlifftasks\1.0.0-beta.22513.1\build\Microsoft.DotNet.XliffTasks.targets(123,5): error : Two or more source files to be translated in the sam
e project are named FSDependencyManager.txt. Give them unique names or set unique XlfTranslatedFilename metadata. [C:\Developer\fsharp-vlad\src\FSharp.DependencyManager.Nuget\FSharp.DependencyManager.
Nuget.fsproj::TargetFramework=netstandard2.0]
    0 Warning(s)
    11 Error(s)

So two issues - test framework relies on artifacts path.
And mixing build scripts with normal build is not supported yet.

Solution to 1st one is to point output to standart path used by arcade. It will likely fix the second one.

@safesparrow
Copy link
Contributor

safesparrow commented Feb 10, 2023

This is promising, I'd love to have a regular dotnet build, which also works exactly the same in the IDE (on main switching between the two always causes recompilation).

In an ideal world I'd like all of these to work the same way, be able to mix them and not have to recompile when making a switch:

  1. Build.cmd -SomeSpecialFlagToUseSdkCompiler
  2. dotnet build FSharp.Compiler.Service.sln
  3. dotnet build src/FSharp.Core/FSharp.Core.fsproj (as far as compiling that single project goes)
  4. Building FSharp.Core.fsproj in Visual Studio or Rider.

but I understand that's out of scope for this particular PR.

Some test results on my box

  1. Regular build of FCS solution works for me:
dotnet build .\FSharp.Compiler.Service.sln
  1. Building with ParallelCheckingWithSignatureFilesOn does not:
dotnet build .\FSharp.Compiler.Service.sln /p:OtherFlags="--test:ParallelCheckingWithSignatureFilesOn"
...
C:\projekty\fsharp\arcade\fsharp\src\FSharp.Core\prim-types.fsi(2704,152): error FS0042: This construct is deprecated: it is only fo
r use in the F# library [C:\projekty\fsharp\arcade\fsharp\src\FSharp.Core\FSharp.Core.fsproj::TargetFramework=netstandard2.0]
    6 Warning(s)
    100 Error(s)

@nojaf
EDIT: I've just realised that this is already enabled via
<OtherFlags>$(OtherFlags) --test:ParallelCheckingWithSignatureFilesOn</OtherFlags>
and I'm just being silly. Why my flag addition caused those particular errors I have no idea.

  1. Building FSharp.Core.fsproj in isolation doesn't work either:
PS C:\projekty\fsharp\arcade\fsharp> dotnet build src/FSharp.Core/FSharp.Core.fsproj
MSBuild version 17.4.1+9a89d02ff for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
FSharpEmbedResXSource: Skipping generation: 'C:\projekty\fsharp\arcade\fsharp\artifacts\obj\FSharp.Core\Debug\netstandard2.1\FSCore.fs' since it is up-to-date.
FSharpEmbedResXSource: Skipping generation: 'C:\projekty\fsharp\arcade\fsharp\artifacts\obj\FSharp.Core\Debug\netstandard2.0\FSCore.fs' since it is up-to-date.
C:\Program Files\dotnet\sdk\7.0.102\FSharp\Microsoft.FSharp.Targets(325,9): error MSB6004: The specified task executable location "C
:\Program Files\dotnet\sdk\7.0.102\FSharp\fsc.exe" is invalid. [C:\projekty\fsharp\arcade\fsharp\src\FSharp.Core\FSharp.Core.fsproj:
:TargetFramework=netstandard2.1]
C:\Program Files\dotnet\sdk\7.0.102\FSharp\Microsoft.FSharp.Targets(325,9): error MSB6004: The specified task executable location "C
:\Program Files\dotnet\sdk\7.0.102\FSharp\fsc.exe" is invalid. [C:\projekty\fsharp\arcade\fsharp\src\FSharp.Core\FSharp.Core.fsproj:
:TargetFramework=netstandard2.0]
 ...
 

(the working directory doesn't matter - same result with cd src/FSharp.Core; dotnet build FSharp.Core.fsproj)

SDKs installed:

PS C:\projekty\fsharp\arcade\fsharp\src\FSharp.Core> dotnet --version
7.0.102
PS C:\projekty\fsharp\arcade\fsharp\src\FSharp.Core> dotnet --list-sdks
6.0.305 [C:\Program Files\dotnet\sdk]
6.0.308 [C:\Program Files\dotnet\sdk]
6.0.405 [C:\Program Files\dotnet\sdk]
7.0.100-rc.2.22477.23 [C:\Program Files\dotnet\sdk]
7.0.100 [C:\Program Files\dotnet\sdk]
7.0.102 [C:\Program Files\dotnet\sdk]

Isn't that always a bit of how it has been? When I change something in the compiler, I for sure don't open FSharp.sln, so when I break a test there, I'll need to open that one anyway. But I would only do that once CI turns red.

@nojaf What solution do you have open in that case? Microsoft.FSharp.Core.sln?

@vzarytovskii
Copy link
Member Author

Building FSharp.Core.fsproj in isolation doesn't work either:

So, arcade is turned off based on the solution name, and won't work with standalone project. You can set an msbduild flag <FSHARPCORE_USE_PACKAGE>false</FSHARPCORE_USE_PACKAGE> and use the FCS solution.

@safesparrow
Copy link
Contributor

So, arcade is turned off based on the solution name, and won't work with standalone project. You can set an msbduild flag <FSHARPCORE_USE_PACKAGE>false</FSHARPCORE_USE_PACKAGE> and use the FCS solution.

I wonder if instead of basing it on the solution name we could base it on an optional user config file which can dictate whether to use Arcade SDK or not.

Even though most of the compiler code lives in FSharp.Compiler.Service, one still needs to build/run fsc to invoke it through the standalone compilation endpoint.

@vzarytovskii
Copy link
Member Author

@nojaf @safesparrow @auduchinok
I've made some changes, could you try this again please?

Keep in mind, that mixing build scripts and normal build of FCS.sln is not supported, due to magic arcade and proto-based build do.

I had to include some more projects to the solution, otherwise, Rider fails to build it.

So, main scenarios targeted by this:

  • do the dotnet build FSharp.Compiler.Service.sln, and then proceed in the editor of choice.
  • do plain build in IDE of choice (Rider or VS).

If you want/need to dedug full scenario (using build scripts), then you should use FSharp.sln.

Everything should work fine. I've only tried running component tests, but not service tests, so there might be some issues with those.

@vzarytovskii
Copy link
Member Author

vzarytovskii commented Mar 20, 2023

Ok, I'm fine with merging it and testing what works/what doesn't. If something goes wrong, it's easy to turn off via user file.

@safesparrow @nojaf @auduchinok wdyt?

@nojaf
Copy link
Contributor

nojaf commented Mar 20, 2023

Tried it just now. This all works very smoothly for me.

I was not able to run:

dotnet publish .\src\fsc\fscProject\fsc.fsproj -c Release -r win-x64 -p:PublishReadyToRun=true -f net7.0 --no-self-contained

Output

dotnet publish .\src\fsc\fscProject\fsc.fsproj -c Release -r win-x64 -p:PublishReadyToRun=true -f net7.0 --no-self-contained
MSBuild version 17.5.0+6f08c67f3 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
FSharp.Core -> C:\Users\nojaf\Projects\fsharp\artifacts\bin\FSharp.Core\Release\netstandard2.0\FSharp.Core.dll
C:\Program Files\dotnet\sdk\7.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1142,5): warning NETSDK117
9: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. [C:\Users\nojaf\Pr
ojects\fsharp\buildtools\fsyacc\fsyacc.fsproj]
C:\Program Files\dotnet\sdk\7.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1142,5): warning NETSDK117
9: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. [C:\Users\nojaf\Pr
ojects\fsharp\buildtools\fslex\fslex.fsproj]
C:\Program Files\dotnet\sdk\7.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1142,5): warning NETSDK117
9: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. [C:\Users\nojaf\Pr
ojects\fsharp\buildtools\AssemblyCheck\AssemblyCheck.fsproj]
FSharp.DependencyManager.Nuget -> C:\Users\nojaf\Projects\fsharp\artifacts\bin\FSharp.DependencyManager.Nuget\Release
\netstandard2.0\FSharp.DependencyManager.Nuget.dll
fsyacc -> C:\Users\nojaf\Projects\fsharp\artifacts\bin\fsyacc\Release\net7.0\win-x64\fsyacc.dll
fslex -> C:\Users\nojaf\Projects\fsharp\artifacts\bin\fslex\Release\net7.0\win-x64\fslex.dll
AssemblyCheck -> C:\Users\nojaf\Projects\fsharp\artifacts\bin\AssemblyCheck\Release\net7.0\win-x64\AssemblyCheck.dll
FSharp.Compiler.Service -> C:\Users\nojaf\Projects\fsharp\artifacts\bin\FSharp.Compiler.Service\Release\netstandard2.
0\FSharp.Compiler.Service.dll
FSharp.Build -> C:\Users\nojaf\Projects\fsharp\artifacts\bin\FSharp.Build\Release\netstandard2.0\FSharp.Build.dll
fsc -> C:\Users\nojaf\Projects\fsharp\artifacts\bin\fsc\Release\net7.0\win-x64\fsc.dll
C:\Program Files\dotnet\sdk\7.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(112,5): err
or NETSDK1152: Found multiple publish output files with the same relative path: C:\Users\nojaf.nuget\packages\fsharp.c
ore\6.0.6\contentFiles\any\netstandard2.1\FSharp.Core.xml, C:\Users\nojaf.nuget\packages\fsharp.core\6.0.6\contentFile
s\any\netstandard2.0\FSharp.Core.xml, C:\Users\nojaf\Projects\fsharp\artifacts\bin\FSharp.Core\Release\netstandard2.0\F
Sharp.Core.xml. [C:\Users\nojaf\Projects\fsharp\src\fsc\fscProject\fsc.fsproj::TargetFramework=net7.0]

When I added the props.user file but we can follow-up on that later.

I'm in favour of merging this and seeing how it goes.

@vzarytovskii vzarytovskii enabled auto-merge (squash) March 20, 2023 19:05
@nojaf
Copy link
Contributor

nojaf commented Mar 21, 2023

Should Directory.Build.props.user be git ignored? I think I'm going to create that file a lot.

Copy link
Contributor

@safesparrow safesparrow left a comment

Choose a reason for hiding this comment

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

I haven't tested the latest version, but I'll depend on @nojaf's judgement. Happy for this to be merged from the user's perspective.

I did not look at the code changes though.

@dawedawe
Copy link
Contributor

dawedawe commented Mar 21, 2023

Works for me with VS and Rider, but not with Ionide/FSAC with the current contents in the .vscode folder.
Moving that out of the way solves it for Ionide/FSAC.
So, I hope it's just a matter of finding the setting in .vscode causing the trouble.

Edit: Seems like it was a lucky shot, I can't reproduce a working Ionide/FSAC anymore. But well, I assume that shouldn't be a blocker here.

@dawedawe
Copy link
Contributor

Setting $env:BUILDING_USING_DOTNET="true" or going with the Directory.Build.props.user file seems to do it for Ionide/FSAC :)

@safesparrow
Copy link
Contributor

Setting $env:BUILDING_USING_DOTNET="true" or going with the Directory.Build.props.user file seems to do it for Ionide/FSAC :)

It might be that Ionide/FSAC do not provide the same MSBuild property pointing to the solution file being open/analysed, thus the auto-enablement of the feature for a certain solution does not get triggered.
You could check that with https://msbuildlog.com/ if Ionide/FSAC provide a way to generate MSBuild binary logs.

Copy link
Member

@auduchinok auduchinok left a comment

Choose a reason for hiding this comment

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

It's super cool to see this going, I'm definitely going to try using this solution!

It should make it much easier to build and test the compiler/service. On the other hand, making it incompatible with the solutions that use the build scripts makes it much harder to debug tests there, and it's often needed when doing some changes that affect VS tests. It's OK if it fix it later, but it still seems to be important to support the scenario where a contributor might want to switch between solutions (i.e. using FCS solution most of the time and only using VisualFSharp.sln when fixing the tests).

Directory.Build.props Show resolved Hide resolved
@vzarytovskii vzarytovskii merged commit ad5b7a7 into dotnet:main Mar 28, 2023
@vzarytovskii vzarytovskii deleted the fcs-no-proto-no-arcade branch March 28, 2023 11:37
@auduchinok
Copy link
Member

🎉

@vzarytovskii
Copy link
Member Author

🎉

Well, first, we need to wait official build to succeed :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

9 participants