@@ -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 let fslexPath = __ SOURCE_ DIRECTORY__ + " /../artifacts/bin/fslex/Proto/netcoreapp2.0/fslex.dll"
@@ -107,6 +111,30 @@ Target "NuGet" (fun _ ->
107111 runDotnet __ SOURCE_ DIRECTORY__ " pack FSharp.Compiler.Service.sln -v n -c Release"
108112)
109113
114+ Target " CodeGen.Fable" ( fun _ ->
115+ let outDir = __ SOURCE_ DIRECTORY__ + " /fcs-fable/codegen/"
116+
117+ // build FCS codegen
118+ let fslexPath = __ SOURCE_ DIRECTORY__ + " /../artifacts/bin/fslex/Proto/netcoreapp2.0/fslex.dll"
119+ let fsyaccPath = __ SOURCE_ DIRECTORY__ + " /../artifacts/bin/fsyacc/Proto/netcoreapp2.0/fsyacc.dll"
120+ runDotnet outDir ( sprintf " build -v n /p:FsLexPath=%s /p:FsYaccPath=%s " fslexPath fsyaccPath)
121+
122+ // run FCS fssrgen (without .resx output, inlining it instead)
123+ runDotnet outDir " run -- ../../../src/fsharp/FSComp.txt FSComp.fs"
124+ runDotnet outDir " run -- ../../../src/fsharp/fsi/FSIstrings.txt FSIstrings.fs"
125+
126+ // Fable-specific (comment the #line directive as it is not supported)
127+ [ " lex.fs" ; " pplex.fs" ; " illex.fs" ; " ilpars.fs" ; " pars.fs" ; " pppars.fs" ]
128+ |> Seq.map ( fun fileName -> outDir + fileName)
129+ |> RegexReplaceInFilesWithEncoding @" (?<!/)# (?=\d)" " //# " Text.Encoding.UTF8
130+
131+ // prevent stack overflows on large files (make lexer rules inline)
132+ let pattern = @" (?<=and )(?!inline )([a-zA-Z]+ )+ *\(lexbuf "
133+ [ " lex.fs" ; " pplex.fs" ; " illex.fs" ]
134+ |> Seq.map ( fun fileName -> outDir + fileName)
135+ |> RegexReplaceInFilesWithEncoding pattern @" inline $0" Text.Encoding.UTF8
136+ )
137+
110138Target " GenerateDocsEn" ( fun _ ->
111139 executeFSIWithArgs " docsrc/tools" " generate.fsx" [] [] |> ignore
112140)
@@ -134,6 +162,10 @@ Target "Release" DoNothing
134162Target " GenerateDocs" DoNothing
135163Target " TestAndNuGet" DoNothing
136164
165+ " Clean"
166+ ==> " BuildTools"
167+ ==> " CodeGen.Fable"
168+
137169" Start"
138170 =?> ( " BuildVersion" , isAppVeyorBuild)
139171 ==> " Restore"
0 commit comments