@@ -87,6 +87,10 @@ Target "BuildVersion" (fun _ ->
8787 Shell.Exec( " appveyor" , sprintf " UpdateBuild -Version \" %s \" " buildVersion) |> ignore
8888)
8989
90+ Target " BuildTools" ( fun _ ->
91+ runDotnet __ SOURCE_ DIRECTORY__ " build ../src/buildtools/buildtools.proj -v n -c Proto"
92+ )
93+
9094Target " Build" ( fun _ ->
9195 runDotnet __ SOURCE_ DIRECTORY__ " build ../src/buildtools/buildtools.proj -v n -c Proto"
9296 runDotnet __ SOURCE_ DIRECTORY__ " build FSharp.Compiler.Service.sln -v n -c release"
@@ -105,6 +109,25 @@ Target "NuGet" (fun _ ->
105109 runDotnet __ SOURCE_ DIRECTORY__ " pack FSharp.Compiler.Service.sln -v n -c release"
106110)
107111
112+ Target " CodeGen.Fable" ( fun _ ->
113+ let outDir = __ SOURCE_ DIRECTORY__ + " /fcs-fable/codegen/"
114+
115+ // run FCS codegen (except that fssrgen runs without .resx output to inline it)
116+ runDotnet outDir " run -- ../../../src/fsharp/FSComp.txt FSComp.fs"
117+ runDotnet outDir " run -- ../../../src/fsharp/fsi/FSIstrings.txt FSIstrings.fs"
118+
119+ // Fable-specific (comment the #line directive as it is not supported)
120+ [ " lex.fs" ; " pplex.fs" ; " illex.fs" ; " ilpars.fs" ; " pars.fs" ; " pppars.fs" ]
121+ |> Seq.map ( fun fileName -> outDir + fileName)
122+ |> RegexReplaceInFilesWithEncoding @" (?<!/)# (?=\d)" " //# " Text.Encoding.UTF8
123+
124+ // prevent stack overflows on large files (make lexer rules inline)
125+ let pattern = @" (?<=and )(?!inline )([a-zA-Z]+ )+ *\(lexbuf "
126+ [ " lex.fs" ; " pplex.fs" ; " illex.fs" ]
127+ |> Seq.map ( fun fileName -> outDir + fileName)
128+ |> RegexReplaceInFilesWithEncoding pattern @" inline $0" Text.Encoding.UTF8
129+ )
130+
108131Target " GenerateDocsEn" ( fun _ ->
109132 executeFSIWithArgs " docsrc/tools" " generate.fsx" [] [] |> ignore
110133)
@@ -132,6 +155,10 @@ Target "Release" DoNothing
132155Target " GenerateDocs" DoNothing
133156Target " TestAndNuGet" DoNothing
134157
158+ " Clean"
159+ ==> " BuildTools"
160+ ==> " CodeGen.Fable"
161+
135162" Start"
136163 =?> ( " BuildVersion" , isAppVeyorBuild)
137164 ==> " Restore"
0 commit comments