@@ -80,6 +80,10 @@ Target "BuildVersion" (fun _ ->
8080 Shell.Exec( " appveyor" , sprintf " UpdateBuild -Version \" %s \" " buildVersion) |> ignore
8181)
8282
83+ Target " BuildTools" ( fun _ ->
84+ runDotnet __ SOURCE_ DIRECTORY__ " build ../src/buildtools/buildtools.proj -v n -c Proto"
85+ )
86+
8387Target " Build" ( fun _ ->
8488 runDotnet __ SOURCE_ DIRECTORY__ " build ../src/buildtools/buildtools.proj -v n -c Proto"
8589 runDotnet __ SOURCE_ DIRECTORY__ " build FSharp.Compiler.Service.sln -v n -c release"
@@ -98,6 +102,25 @@ Target "NuGet" (fun _ ->
98102 runDotnet __ SOURCE_ DIRECTORY__ " pack FSharp.Compiler.Service.sln -v n -c release"
99103)
100104
105+ Target " CodeGen.Fable" ( fun _ ->
106+ let outDir = __ SOURCE_ DIRECTORY__ + " /fcs-fable/codegen/"
107+
108+ // run FCS codegen (except that fssrgen runs without .resx output to inline it)
109+ runDotnet outDir " run -- ../../../src/fsharp/FSComp.txt FSComp.fs"
110+ runDotnet outDir " run -- ../../../src/fsharp/fsi/FSIstrings.txt FSIstrings.fs"
111+
112+ // Fable-specific (comment the #line directive as it is not supported)
113+ [ " lex.fs" ; " pplex.fs" ; " illex.fs" ; " ilpars.fs" ; " pars.fs" ; " pppars.fs" ]
114+ |> Seq.map ( fun fileName -> outDir + fileName)
115+ |> RegexReplaceInFilesWithEncoding @" (?<!/)# (?=\d)" " //# " Text.Encoding.UTF8
116+
117+ // prevent stack overflows on large files (make lexer rules inline)
118+ let pattern = @" (?<=and )(?!inline )([a-zA-Z]+ )+ *\(lexbuf "
119+ [ " lex.fs" ; " pplex.fs" ; " illex.fs" ]
120+ |> Seq.map ( fun fileName -> outDir + fileName)
121+ |> RegexReplaceInFilesWithEncoding pattern @" inline $0" Text.Encoding.UTF8
122+ )
123+
101124Target " GenerateDocsEn" ( fun _ ->
102125 executeFSIWithArgs " docsrc/tools" " generate.fsx" [] [] |> ignore
103126)
@@ -125,6 +148,10 @@ Target "Release" DoNothing
125148Target " GenerateDocs" DoNothing
126149Target " TestAndNuGet" DoNothing
127150
151+ " Clean"
152+ ==> " BuildTools"
153+ ==> " CodeGen.Fable"
154+
128155" Start"
129156 =?> ( " BuildVersion" , isAppVeyorBuild)
130157 ==> " Restore"
0 commit comments