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

Service process to speed up repeated compilations - F# #1131

Closed
Jand42 opened this issue Jun 8, 2021 · 4 comments
Closed

Service process to speed up repeated compilations - F# #1131

Jand42 opened this issue Jun 8, 2021 · 4 comments

Comments

@Jand42
Copy link
Member

Jand42 commented Jun 8, 2021

First, on the F# side

  • Parametrize compileMain to take a factory function for F# checker from the outside.
  • New project wsfscservice.exe will run next to wsfsc.exe but can serve as a persistent background process, that takes compile arguments through a pipe, runs compileMain itself, returns standard/error outputs and exit code (depends on Compiler refactor - parametrize info/error/warning printers #1130).
  • Build script: add a step before Clean to kill any running wsfscservice from build folder before wiping the build folder.
  • Optional: add new wsconfig.json bool parameter: incrementalBuild. Default true uses wsfscservice, setting it to false runs compileMain directly.
mrtank added a commit to mrtank/core that referenced this issue Jun 9, 2021
Jand42 added a commit that referenced this issue Jun 9, 2021
* Implementing #1130. LoggerBase class for parametrizing output in FSharp compilation.

* cleanups

* remove TODO comment

* Change to checkerFactory (#1131)

* no separate module for LoggerBase

* Add TryGetMetadata on the CSharp branch

* Fix TryGetMetadata not passing. Remove LoggerBase opens.

* Move Compile of CSharp branch into WebSharper.Compiler.CSharp

* small cleanup in main

Co-authored-by: András Jankó <andras.janko@gmail.com>
mrtank added a commit to mrtank/core that referenced this issue Jun 9, 2021
mrtank added a commit to mrtank/core that referenced this issue Jun 10, 2021
mrtank added a commit to mrtank/core that referenced this issue Jun 10, 2021
mrtank added a commit to mrtank/core that referenced this issue Jun 10, 2021
mrtank added a commit to mrtank/core that referenced this issue Jul 5, 2021
    pick 049c840 Implementing dotnet-websharper#1131 's server side
    pick 60153a1 Insert Stopping runnig wsfscservices in the pipeline. Add client for starting the compilation through the service dotnet-websharper#1131
    pick ce27518 Fix release version compiler compile.

    pick 094c8022 Implementing dotnet-websharper#1131 's server side
    pick f0dc2fe8 Insert Stopping runnig wsfscservices in the pipeline. Add client for starting the compilation through the service dotnet-websharper#1131
    pick 3b792d0f publish service, rename project
mrtank added a commit to mrtank/core that referenced this issue Jul 5, 2021
…starting the compilation through the service dotnet-websharper#1131

    pick 049c840 Implementing dotnet-websharper#1131 's server side
    pick 60153a1 Insert Stopping runnig wsfscservices in the pipeline. Add client for starting the compilation through the service dotnet-websharper#1131
    pick ce27518 Fix release version compiler compile.
    pick 7b728f8 publish service, rename project

    pick 094c8022 Implementing dotnet-websharper#1131 's server side
    pick f0dc2fe8 Insert Stopping runnig wsfscservices in the pipeline. Add client for starting the compilation through the service dotnet-websharper#1131
    pick 3b792d0f publish service, rename project
    pick 3ac742ed Add event listeners to Process's Exit and Disposed. Letting client continue on build if any of them happens.
mrtank pushed a commit to mrtank/core that referenced this issue Jul 5, 2021
    pick ce27518 Fix release version compiler compile.
    pick 7b728f8 publish service, rename project
    pick 36dae0b Fix ignore case for standalone checking.
    pick 8336fc7 IndexOf instead of String.Equals ignoring trailing widespaces

    pick f0dc2fe8 Insert Stopping runnig wsfscservices in the pipeline. Add client for starting the compilation through the service dotnet-websharper#1131
    pick 3b792d0f publish service, rename project
    pick 3ac742ed Add event listeners to Process's Exit and Disposed. Letting client continue on build if any of them happens.
    pick 9c7668d3 Add logging. Change wsfscservice_start.cmd to use start instead of dotnet. Try catch around mailboxprocessor's inner loop.
@mrtank
Copy link
Member

mrtank commented Jul 5, 2021

WIG and sitelets+html+bundle operations should not happen in wsfscservice.exe, which need current assembly to be loaded to execute and then that version of the dll is locked in

@mrtank
Copy link
Member

mrtank commented Jul 9, 2021

"Optional: add new wsconfig.json bool parameter: incrementalBuild. Default true uses wsfscservice, setting it to false runs compileMain directly."

This is now the --standalone flag. Default value false uses wsfscservice. Also controllable via the <WebSharperStandalone>True<WebSharperStandalone> project property, or the WebSharperBuildService environment variable = "False". Both of these disable using the wsfscservice.

@Jand42
Copy link
Member Author

Jand42 commented Jul 16, 2021

As part of this, compiler service needs to use an AssemblyLoadContext whenever instantiating types from compiled project or it's dependencies.
These usages are:

  • WS compilation: macros, generators
  • Unpack website resources: only for DownloadResources e292d9a
  • Html offline site: main functionality for instantiating IWebSite/Sitelet object e292d9a
  • Bundling, including webworker bundles: for resource instances 1cf8aae
  • WIG: main functionality, for instantiating Assembly definition

Jand42 added a commit that referenced this issue Jul 16, 2021
@granicz granicz added this to v5.0-preview in Releases Jul 22, 2021
@Jand42
Copy link
Member Author

Jand42 commented Jul 23, 2021

Service is implemented for WebSharper 5.0-preview builds, create new ticket for the ws helper #1166

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

No branches or pull requests

2 participants