Skip to content

Instantly share code, notes, and snippets.

@mavnn
Created November 24, 2013 20:34
Show Gist options
  • Select an option

  • Save mavnn/7632082 to your computer and use it in GitHub Desktop.

Select an option

Save mavnn/7632082 to your computer and use it in GitHub Desktop.
Sample build.fsx for a vim project - compile, and if it compiles then run the exe and capture the output back into vim.
open System.Diagnostics
let code =
[
"src/Board.fs"
"src/WordSearch.fs"
]
let refs = []
let output = "output/WordSearch.exe"
let build referenceList codefileList output =
let references =
referenceList
|> Seq.map (fun r -> sprintf "-r:%s" r)
|> String.concat " "
let codefiles =
codefileList
|> String.concat " "
let outputfile = sprintf "--out:%s" output
let args =
[ "--nologo"
"--consolecolors"
"--debug"
"--optimize"
"--tailcalls"
references
codefiles
outputfile ] |> String.concat " "
let proc = Process.Start("fsharpc", args)
proc.WaitForExit()
proc.ExitCode
let run () =
let proc = Process.Start("mono", output)
proc.WaitForExit()
proc.ExitCode
match build refs code output with
| 0 ->
printfn "\n\n~~~~~ Compile complete, running output ~~~~~"
run ()
| result -> result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment