-
Notifications
You must be signed in to change notification settings - Fork 790
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
Improve and dogfood the dotnet core sdk support #2250
Conversation
58cc470
to
7538cd1
Compare
- add helper script to install .NET Core Sdk (only if needed) - build `Fsc.netcore.fspro with `fsc-proto` - publish Fsc using .NET Core Sdk as framework dependent app - create `Microsoft.FSharp.Compiler.Sdk.netcore` package - add build script using `dotnet msbuild` - run when `netcoresdk` arg is passed to build script (`build.cmd`) - add end to end tests to check created package - add examples of .net core sdk projects (lib/console)
7538cd1
to
c2d6d4f
Compare
adding https://gist.github.com/enricosada/539da221ef3d87f0151d395f7889f94c as additional docs about this PR |
I'd like to know from @KevinRansom and @brettfo whether this PR looks vaguely in the right direction. A lot looks right to me but it needs to be analyzed carefully. I spoke with @enricosada and he says it's really important to get the new
|
yes maybe very few - but we already use it in production (with dotnet cli rc4) and it works like a charme |
@enricosada Please put that information in the PR description right at the top. I'll help you edit it into a condensed form. We can then add it to the repo as a document, or put it on http://github.com/fsharp/fsharp.github.io as part of the compiler guide. |
@enricosada I think replacing the "build coreclr" path (rather than adding a new one) would be better - why would we keep the old one active in master? |
No reason at all, is just another pr (i can do that) because i fear big one shot changes.
The csproj VS tooling is out of preview in VS2017 RC3. the sdk itself is really near rtm. For c# guys is better, and they are gonna use that, because msbuild format is easier than project.json (less alien). Also VS2017 already support it, so is not difficult to sell at all.
I can do that, that's what the build script does btw. I just need to change the name, but is not a problem. can be put inside FSharp.Compiler.Tools too (so it support netcore and net40). Working example using dev feed are inside this PR
There are two parts, build script orchestration and project files. Fsc.fsproj is a proj, but build require nuget restore/packaging/signing/runtests. That can be offloaded to .net core sdk. Some deletion will I cannot migrate project files until VS support new fsproj, but we can simplify greatly current script. It's ortogonal to my pr (needed to improve sdk), can be done anyway (just give me a go). I assume i will build the .net core version of components with new fsproj and sdk, so we remove current complexities in old fsproj. To delete:
it's possibile to Old fsproj in parallel to new fsproj. used for .net core. Common properties like defines can be shared using specific .props file (like my pr) Note, the .NET Core SDK can build ALL framework, so .NET Framework, .NET Core, Portalble profiles, etc in same fsproj. is not only for netcore.
like before, it's msbuild so following works:
The same build workflow can be used by developers too
about other required stuff, like signing and vsix creation, can be done like dotnet/cli repository. |
will do, and fix merge conflict |
I think that would be better. Then the PR will act as a definitive guide even if @KevinRansom decides to do things a bit differently in the end. The PR should then contain all the necessary updates to the build and getting started material too (some of which you've written above) Looking at all those commands above there's a lot to learn. TBH I don't even know the difference between (just after I wrote that I realize you said |
As a note, to continue fsproj/sdk work, i'll use We can discuss how to continue this pr to use sdk inside visualfsharp repo later, so is not urgent for fsproj/sdk/netcore like was before ( /cc @cartermp ). More one-shot work for me instead of integrated+scripted+tested inside this repo, but at least i can continue to finalize fsproj 😄 (was that the goal) |
Closing this. Used Will rework this PR to use .net core sdk 1.0 rtm in build to replace |
Noone from Redmond commented on this? Not interested? |
This PR
Microsoft.FSharp.Compiler.Sdk.netcore
for use in .net core sdk fsproj.Additional info, and some context about how the new msbuild/fsproj/sdk work https://gist.github.com/enricosada/539da221ef3d87f0151d395f7889f94c
This direction will eventually lead to the removal of project.json for the Core CLR build, leading to the use of the new
fsproj
msbuild based, with a normal msbuild-based templates for .net core sdk projects** (so exactly likedotnet new -l fsharp -t console
).This gives us the basics we need to polish and finalize support for the new msbuild+fsproj format, and dogfood .the net core sdk fsproj in visualfsharp repo. This will be crucial to ensure the extensibility points in the SDK are adequate for our needs.
Steps in the PR are:
This PR builds and packages just fsc (not fsharp.core or fsharp.compiler) - the other already built assemblies are used as normal
<Reference />
. So this can be run in parallel to the existing build script for .NET Core to use the advanced functionality of .net core sdk (like publish) and the other projectscan be converted in future steps.
The script is added as additional step in
build.cmd
when passing thenetcoresdk
argument. Generated packages are put in the usual$(Configuration)\artifacts
directory.This PR makes no changes to the current build script/code for .NET Core (the
coreclr
) argument, that's why all code is addition, but duplicated code is minimal.Documentation
To use the .net core sdk script: see
./scripts/use_dotnet_core_sdk.README.md
Build script documentation: see comment at end of
./build-using-netcore-sdk.proj
Examples (to easy locally dev VF#): see
examples/dotnetcoresdk/simple/README.md
The
Microsoft.FSharp.Compiler.Sdk.netcore
packageThe
Package
target creates a new packageMicrosoft.FSharp.Compiler.Sdk.netcore
withthese property are used by FscTask inside
FSharp.NET.Sdk
package.build/netcoreapp1.0
is a normal console app published as framework dependent deployment.That mean can be run with
dotnet build/netcoreapp1.0/fsc.dll
like all normal .net core app published withdotnet publish
.TestE2E
How
fsc
is builtThe
src/fsharp/Fsc/Fsc.netcore.fsproj
is added. It's a normal console app fsproj for .NET Core Sdk 1.0.0-preview4.build coreclr
(because use the fsharp.core/fsharp.compiler assemblies already built)cd src/fsharp/Fsc
dotnet restore Fsc.netcore.fsproj --configfile Fsc.netcore.NuGet.Config
(needed until the first package is on nuget.org)dotnet publish Fsc.netcore.fsproj -c Release
NOTE: At the moment the generated fsc.dll doesnt work because is not signed correctly. To workaround this issue for now, the already built
fsc.exe
is copied asfsc.dll
(so thedotnet build
output is overwritten) Runningdotnet msbuild build-using-netcore-sdk.proj /p:Configuration=Release /t:PublishFsc
will generate the fixed published fsc. This will be fixed in a later PR, see TODOExample .NET Core sdk preview4 fsproj
This PR adds an example of a .NET Core Sdk fsproj, see
examples/dotnetcoresdk/simple/README.md
This can compile using both thedotnet path/to/fsc.ll
(netcore) orfsc-proto.exe
(.net full),just set the
FscToolPath
/Exe
as usual.The
Microsoft.FSharp.Compiler.Sdk.netcore
can be overriden by adding asPackageReference
, like in E2E tests.Install script
All the steps are scripted using msbuild (run
dotnet msbuild build-using-netcore-sdk.proj
, see same file for help). Why?./scripts/use_dotnet_core_sdk.README.md
for doc.\scripts\use_dotnet_core_sdk.bat
(or.ps1
). After that the right sdk is inPATH
, so justdotnet --version
PATH
(like in machine wide install) that installation is usedDotnetCoreSdkVersion.txt
it's downlaoded and installedin
.dotnetsdk
directory and added to PATH (like current install script)dotnet --version
Build scripts
The
./build-using-netcore-sdk.proj
and in./build/*
.dotnet msbuild
./build-using-netcore-sdk.proj
and all targets are commented about usageHow is tested
E2E test in isolation, based on fsharp suite.
TestE2E
target) are like the one in fsharp suite (reused lot of code of fsharp suite, same dsl).dotnet run
so is just a normal console app.dotnet vstest
) but not any features of xunit, it's only based on theofficial xunit test template (
dotnet new -t xunittest -l fsharp
)TODO not in this pr (next one)
dotnet publish
.\scripts\use_dotnet_core_sdk.ps1
as shell script.\scripts\use_dotnet_core_sdk.bat.sh
dotnet test
(instead ofdotnet run
), need configuration of logging (trx) for cI, localdevexamples/dotnetcoresdk/simple/Simple.sln
doesnt reference the fsproj/cc people for review
@dsyme the added test suite is like fsharp suite, no nunit magic, and can be fixed easy to be run by fsi
@KevinRansom that's using only released .net core sdk and packages. Add ihmo a good base to use fully the .net core sdk for build. i didnt changed/messed with internal build tools/script, so no regression. The msbuild is inside .net core sdk (dotnet msbuild), like nuget (dotnet nuget), so is using normal tools/commands provided by sdk (and used by normal devs already). workflow is the same basic of developing a .net core app with sdk, i excluded advanced like crossgen (multi framework), pack (packages are generaeted from a prepared directory, easy to check). I think we can use some part of sdk (like publish/pack) to make it easier to create normal netcore apps (fsc) or lib (fsharp.core), without changing a lot the build script/projects.
@cartermp @brettfo this add dogfooding and enable lots of smaller steps, see TODO
@vasily-kirichenko @cloudRoutine @dungpa i hope
./examples
and the easy install script will help to add support for .net core proj to vf# extension (i added you all because you develop the extension). i think lots can be done using https://github.com/dotnet/roslyn-project-system as base (easier maybe than chaning existing) and defining a fsharp capability for languageservice (maybe this require discussion in a new issue)@forki i hope the installs script, build script are ok for contributors (feedback wanted about that), i tried to maximize (in the limits of msbuild) the readability and developer workflow (phases, simple targets, and normal project can be run directly from cli using normal
dotnet commands
, the same run by script)