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
read fsc args from new fsproj #707
Comments
@alfonsogarciacaro , this can be used by |
btw i'll finish to implement this proposed solution soon, so we can see if works ok enough :D |
What is the problem you are trying to solve? Do you want the Compiler Service to expose the commands selected for a compilation or do you want the build to record the build options passed to the compiler? The proposal you make is fine, just add a property to the build task and modify: However, that seems like the wrong way to go if you want to integrate the results in the compiler service APIs. Probably the Compiler Service should instead, use the settings on TcGlobalBuilder or TcGlobal to expose the settings deliberately, not exposing the TcGlobal object of course .... that would be nutso. But the list of referenced assemblies, the optimization options ... the output file ... etc. Anyway ... my 2 cents |
FYI this is exactly what the project cracker tries to do (essentially run the actual compilation in its own process after overriding the compilation step with an empty function). I tried to make that as similar as possible to what VF# did at the time. I am out of the loop with regards to the new fsproj structure and tooling around it, so it may be much easier now. |
@KevinRansom He's trying to replace this method
which is basically the same as converting an |
Update the buildtask and send a pr to visualfsharp tools, with the changes the buildtask already creates a .rsp file, it's really just a case of persisting it somewhere. |
Thanks a lot @KevinRansom for feedback! i'll send a PR asap.
I dont want to change FCS itself (initialized by with fsc args array is perfect ihmo), just projectcracker. AFAIK it's pretty much what the vf# does (AFAIK) in Project.fs
@rneatherway is really similar to old (i am not trying to invent something new, i hope, so is tested), but saving compiler args will make possibile to use these directly, instead of guess from msbuild props/items, like is done here in projectcracker. maybe i miss something, but should at least work like now tested in vscode without requiring a build before opening vscode, for intellisense |
Understood, this sounds good. To have it supported unofficially by VF# team should help to keep it more robust! Should be a great improvement if we can remove the shaky project cracker eventually. |
Ok i am satified by my current design, and already sent pr. I removed usage of msbuild api programmaticailyl (fragile, binding redirect, assembly already loaded. => pain). pratically add a target file, with some targets and execute Added a console app [dotnet-proj-info](ref https://github.com/enricosada/dotnet-proj-info/tree/master/examples) to read fsc args and other info from fsproj/csproj. Can also be modified as lib if needed (please i need feedback about that) So usage is like
will write all fsc args. Example: |
Fantastic work @enricosada, thanks for this! I think it'd be interesting to have this as a library to make it more easily callable from other programs. And maybe also making it asynchronous? It should be clear that this depends on the dotnet sdk being installed in the machine. I guess this will be the case in most situations (with projectcracker there were many problems with Windows machines that didn't have the expected version of VS installed) but some machines may only have the dotnet runtime installed. BTW, as Fable won't be supporting nuget PackageReferences the next version will probably use a custom simplistic resolution, but we'll probably move soon to use this to read all the options in the project. And definitely needed this is needed for the IDEs. |
Closing. Published:
both can read fsc args, any msbuild property, p2p references of a project, with just one msbuild invocation batching requests both require FSharp.NET.Sdk >= 1.0.2 to get fsc args, because i added new properties to msbuild added support to FSAC with ionide/FsAutoComplete#55 to replace projectcracker |
[msbuild] Fix regression in Microsoft.Build.FSharp.targets
This will enable to get fsc arguments from fsproj.
Current status:
FSharp.NET.Sdk
1.0.0 removed the generation ofdotnet-compile-fsc.rsp
response file used by FSAC, projecracker doesnt understnd new fsproj. So FSAC doesnt work (no vscode intellisense)Proposed: No more guessing from projectcracker (fragile) and is similar to what VF# does in VS, just without hosting the fsharp.build.dll.
Atm build (
dotnet build
=dotnet msbuild /t:Build
, so is for all msbuild) is:Build
target ->Compile
target -> CoreCompile target -> Fsc task invocation (task is contained inFSharp.Build.dll
) ->fsc
Build
andCompile
targets are inMicrosoft.NET.Sdk
CoreCompile
target is inFSharp.NET.Sdk
(community)FSharp.Compiler.Tools
package (community)NOTE The
FscTask
contains the logic on how to compose fsc args, but properties are passed byCoreCompile
target.NOTE compiler args may change in future, so workflow should be stable, without guessing version.
My idea is: Run compile, but not invoke fsc, just save compiler args somewhere
Extended is:
Compile
target (so likedotnet msbuild my.fsproj /t:Compile
)_ComputeNonExistentFileProperty
target) to forceCoreCompile
also if already compiledfsc
(like c# does with SkipCompilerExecution propertyFsc
task with composed compiler args, asFscCommandLineArgs
item (like c#/csc does here with CscCommandLineArgsAfter that:
FscCommandLineArgs
item with a tool, but dumb, so simpleFscCommandLineArgs
to a file (passed from a property?), so will be possible to save from command line invocationThe changes needed are minor, just adding optional props, no breaking:
SkipCompilerExecution
toFscTask
. default to false so no issue for old usersFscCommandLineArgs
output items, is ignored if not read, so np for old usersCoreCompile
target to pass these propsCoreCompile
to saveFscCommandLineArgs
to file (discuss)Some notes from my dev notes (is a msbuild response file):
/cc @tpetricek @dsyme @7sharp9 @latkin @vladima FCS team
/cc @rneatherway emacs
/cc @kjnilsson vim
/cc @guillermooo sublime
/cc @KevinRansom @cartermp vs
/cc @nosami @mrward vs on mac
/cc @Krzysztof-Cieslak ionide vscode/atom
/cc @alfonsogarciacaro fable
The text was updated successfully, but these errors were encountered: