fable-compiler / repl-legacy

http://fable.io/repl
MIT License
14 stars 10 forks source link

Rework the build system #4

Closed MangelMaxime closed 6 years ago

MangelMaxime commented 6 years ago

Ok, so here is my proposition for the build system of this repo.

Requirements

The new build system use yarn instead of npm because it's faster to install the packages. And we now switched Fable repo to yarn again as we know how to use it over the CI servers.

Metadata

First, I took the decision to not force the user to build the metadata each time. Because, they should not change much I created a target Generate.Metadata.

This target will:

Build the repo

When build the Fable.FCS or the application, we first check if FSharp.Compiler.Service_fable and Fable directories exist. After, same process has before.

Then we have this build order:

"Setup"
    ==> "Build.FCS_Fable"
    ==> "Build.Fable"
    ==> "Clean"
    ==> "InstallDotNetCore"
    ==> "Restore"
    ==> "YarnInstall"
    ==> "Build.FCS"
    ==> "Build.App"
    ==> "All"

I also added a target Watch.App but this will trigger almost all the previous target. This is useful, when you first clone the repo for example.

If you are using this repo in dev mode you should keep using yarn start-app, yarn watch-fcs, etc.

Continuous Integration

For the CI, if we start run build.cmd All setup=auto then, the missing directories (FSharp.Compiler.Service_fable, Fable, etc.) will be added without any user interaction.

With all this changes, getting this repo to work should be a lot easier and we also, should be able to support CI. At least, to check if everything is building. Test a the runtime is another thing for another day :D

Also, this also means that for this repo fable and export branches or ncave fork should always be "stable". Which is already more or less the case as we consider them as the "master" branch depending on our need.

Please tell me if you have any question or if I need to adapt something.

When or after merging, this PR we should update the README.md with explanation on how to get started.

PS: I am not sure, but perhaps we can remove some of the metadata references added to the util.js

@ncave I am also having this log in the browser console when running a program:

Cannot find type System.ArgIterator
Cannot find type System.Runtime.CompilerServices.IDispatchConstantAttribute

This is working even with this message but if we can get ride of them would be better IMO.

alfonsogarciacaro commented 6 years ago

Wow, 226 files! I didn't know this repo had so many ;) I gave it a try and it seems to work. I had to make some minor edits to fcs.file and there was also an error from UglifyJS when running the Build.App target, but we can fix that late, so I say: let's merge this! :)

Thanks a lot for the awesome work! :clap: :clap: :heart: :tada:

MangelMaxime commented 6 years ago

We are tracked the metadata2 files and their is a lot. :)

Ah, yes I didn't test the Build.App hihi was only using dev mode.

Nice to have it merge, can now play with it :)