Skip to content

Commit

Permalink
Fable support
Browse files Browse the repository at this point in the history
  • Loading branch information
ncave committed Feb 23, 2019
1 parent 9619824 commit 73df5f0
Show file tree
Hide file tree
Showing 95 changed files with 7,892 additions and 3,615 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ artifacts/*.nupkg
*.orig
*.mdf
*.ldf
.paket/paket.exe
fcs/.paket/paket.exe
paket-files
docsrc/tools/FSharp.Formatting.svclog
src/fsharp/FSharp.Compiler.Service/pplex.fs
Expand All @@ -201,6 +201,7 @@ src/fsharp/FSharp.Compiler.Service/pppars.fsi
*.cto
*.vstman
project.lock.json
.vscode

src/fsharp/FSharp.Compiler.Service/FSComp.fs
src/fsharp/FSharp.Compiler.Service/FSComp.resx
Expand Down
27 changes: 27 additions & 0 deletions fcs/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ Target "BuildVersion" (fun _ ->
Shell.Exec("appveyor", sprintf "UpdateBuild -Version \"%s\"" buildVersion) |> ignore
)

Target "BuildTools" (fun _ ->
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
)

Target "Build" (fun _ ->
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
runDotnet __SOURCE_DIRECTORY__ "build FSharp.Compiler.Service.sln -v n -c release"
Expand All @@ -98,6 +102,25 @@ Target "NuGet" (fun _ ->
runDotnet __SOURCE_DIRECTORY__ "pack FSharp.Compiler.Service.sln -v n -c release"
)

Target "CodeGen.Fable" (fun _ ->
let outDir = __SOURCE_DIRECTORY__ + "/fcs-fable/codegen/"

// run FCS codegen (except that fssrgen runs without .resx output to inline it)
runDotnet outDir "run -- ../../../src/fsharp/FSComp.txt FSComp.fs"
runDotnet outDir "run -- ../../../src/fsharp/fsi/FSIstrings.txt FSIstrings.fs"

// Fable-specific (comment the #line directive as it is not supported)
["lex.fs"; "pplex.fs"; "illex.fs"; "ilpars.fs"; "pars.fs"; "pppars.fs"]
|> Seq.map (fun fileName -> outDir + fileName)
|> RegexReplaceInFilesWithEncoding @"(?<!/)# (?=\d)" "//# " Text.Encoding.UTF8

// prevent stack overflows on large files (make lexer rules inline)
let pattern = @"(?<=and )(?!inline )([a-zA-Z]+ )+ *\(lexbuf "
["lex.fs"; "pplex.fs"; "illex.fs"]
|> Seq.map (fun fileName -> outDir + fileName)
|> RegexReplaceInFilesWithEncoding pattern @"inline $0" Text.Encoding.UTF8
)

Target "GenerateDocsEn" (fun _ ->
executeFSIWithArgs "docsrc/tools" "generate.fsx" [] [] |> ignore
)
Expand Down Expand Up @@ -125,6 +148,10 @@ Target "Release" DoNothing
Target "GenerateDocs" DoNothing
Target "TestAndNuGet" DoNothing

"Clean"
==> "BuildTools"
==> "CodeGen.Fable"

"Start"
=?> ("BuildVersion", isAppVeyorBuild)
==> "Restore"
Expand Down
3 changes: 3 additions & 0 deletions fcs/fcs-fable/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Codegen
codegen/*.fs
codegen/*.fsi
Loading

0 comments on commit 73df5f0

Please sign in to comment.