Skip to content

Commit 334cbc3

Browse files
committed
Fable support
1 parent e6d7183 commit 334cbc3

File tree

97 files changed

+4625
-199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+4625
-199
lines changed

fcs/build.fsx

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let dotnetExePath =
3131
if File.Exists(pathToCli) then
3232
pathToCli
3333
else
34-
DotNetCli.InstallDotNetSDK "2.2.105"
34+
DotNetCli.InstallDotNetSDK "2.2.108"
3535

3636
let runDotnet workingDir args =
3737
let result =
@@ -90,6 +90,10 @@ Target "BuildVersion" (fun _ ->
9090
Shell.Exec("appveyor", sprintf "UpdateBuild -Version \"%s\"" buildVersion) |> ignore
9191
)
9292

93+
Target "BuildTools" (fun _ ->
94+
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
95+
)
96+
9397
Target "Build" (fun _ ->
9498
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
9599
let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/netcoreapp2.1/fslex.dll"
@@ -110,6 +114,30 @@ Target "NuGet" (fun _ ->
110114
runDotnet __SOURCE_DIRECTORY__ "pack FSharp.Compiler.Service.sln -v n -c Release"
111115
)
112116

117+
Target "CodeGen.Fable" (fun _ ->
118+
let outDir = __SOURCE_DIRECTORY__ + "/fcs-fable/codegen/"
119+
120+
// build FCS codegen
121+
let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/netcoreapp2.1/fslex.dll"
122+
let fsyaccPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fsyacc/Proto/netcoreapp2.1/fsyacc.dll"
123+
runDotnet outDir (sprintf "build -v n /p:FsLexPath=%s /p:FsYaccPath=%s" fslexPath fsyaccPath)
124+
125+
// run FCS fssrgen (without .resx output, inlining it instead)
126+
runDotnet outDir "run -- ../../../src/fsharp/FSComp.txt FSComp.fs"
127+
runDotnet outDir "run -- ../../../src/fsharp/fsi/FSIstrings.txt FSIstrings.fs"
128+
129+
// Fable-specific (comment the #line directive as it is not supported)
130+
["lex.fs"; "pplex.fs"; "illex.fs"; "ilpars.fs"; "pars.fs"; "pppars.fs"]
131+
|> Seq.map (fun fileName -> outDir + fileName)
132+
|> RegexReplaceInFilesWithEncoding @"(?<!/)# (?=\d)" "//# " Text.Encoding.UTF8
133+
134+
// // prevent stack overflows on large files (make lexer rules inline)
135+
// let pattern = @"(?<=and )(?!inline )([a-zA-Z]+ )+ *lexbuf "
136+
// ["lex.fs"; "pplex.fs"; "illex.fs"]
137+
// |> Seq.map (fun fileName -> outDir + fileName)
138+
// |> RegexReplaceInFilesWithEncoding pattern @"inline $0" Text.Encoding.UTF8
139+
)
140+
113141
Target "GenerateDocsEn" (fun _ ->
114142
executeFSIWithArgs "docsrc/tools" "generate.fsx" [] [] |> ignore
115143
)
@@ -137,6 +165,10 @@ Target "Release" DoNothing
137165
Target "GenerateDocs" DoNothing
138166
Target "TestAndNuGet" DoNothing
139167

168+
"Clean"
169+
==> "BuildTools"
170+
==> "CodeGen.Fable"
171+
140172
"Start"
141173
=?> ("BuildVersion", isAppVeyorBuild)
142174
==> "Restore"

fcs/fcs-fable/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Codegen
2+
codegen/*.fs
3+
codegen/*.fsi

0 commit comments

Comments
 (0)