Created
November 24, 2013 20:34
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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