Skip to content

Support for F# source generators #1476

Open
@granicz

Description

@granicz

This ticket is for implementing a basic F# source generator scheme for WebSharper inside wsfsc.exe. The idea is simple: if the file list to be compiled includes non-F# files f_1 ... f_n, we perform the following steps before compilation:

For each filename f_i with file extension ext_i:

  1. We attempt to locate a source generator function GEN, from the first assembly A filtered from the list of assemblies passed on the command line, where A contains a new WebSharper assembly-level attribute, say, [<WebSharper.FSharpSourceGenerator("{ext}">], marking the assembly to contain a source generator for a given {ext} file extension.
  2. We call GEN on f_i to obtain a list of generated filenames fg_1 ... fg_m.
  3. We replace f_i with fg_1 ... fg_m in the file list to be compiled.

Once all f_is are processed, we compute a new list of non-F# files from the updated input file list and repeat the above process (caching the ext->A mapping) until there are no more non-F# files to be compiled.

At this point, we resume normal compilation with the final source file list and all other command line arguments.

Metadata

Metadata

Assignees

Projects

Status

v10.0

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions