11// --------------------------------------------------------------------------------------
2- // FAKE build script
2+ // FAKE build script
33// --------------------------------------------------------------------------------------
44
55#I " packages/FAKE/tools"
66#r " packages/FAKE/tools/FakeLib.dll"
77open System
8- open Fake
8+ open Fake
99open Fake.Git
1010open Fake.ReleaseNotesHelper
1111open Fake.AssemblyInfoFile
@@ -19,10 +19,10 @@ open Fake.AssemblyInfoFile
1919#load " src/paket.fsx"
2020#load " src/core.fsx"
2121
22- // Translate the type given as #1 using module name #2
22+ // Translate the type given as #1 using module name #2
2323// and save the result to a file specified in #3
24- let atomModules =
25- [ typeof< Core.Core>, " AtomFSharpCore" , " src/core/lib/core.js" ;
24+ let atomModules =
25+ [ typeof< Core.Core>, " AtomFSharpCore" , " src/core/lib/core.js" ;
2626 typeof< Paket.Paket>, " AtomFSharpPaket" , " src/paket/lib/paket.js" ]
2727
2828// --------------------------------------------------------------------------------------
@@ -36,11 +36,11 @@ open System.Reflection
3636open Microsoft.FSharp .Quotations
3737open FunScript.Compiler
3838
39- let translateModules () =
39+ let translateModules () =
4040 for typ, moduleName, fileName in atomModules do
4141
42- // We generate F# quotation that returns all the methods that we want to expose
43- // from the class. This way, we can then wrap it into simple JS code that
42+ // We generate F# quotation that returns all the methods that we want to expose
43+ // from the class. This way, we can then wrap it into simple JS code that
4444 // creates the module. The generated quotation looks something like this:
4545 //
4646 // [| box (fun () -> new WordCount());
@@ -53,11 +53,11 @@ let translateModules() =
5353 /// Creates "(fun p1 .. pn -> <body>)" and "[p1; ..; pn]"
5454 /// (which is used when generating boxed lambdas that pass parameters to the actual function)
5555 let createParameterPassing ( m : MethodBase ) =
56- let paramVars = m.GetParameters() |> Array.mapi ( fun i p -> Var( sprintf " p%d " i, p.ParameterType))
56+ let paramVars = m.GetParameters() |> Array.mapi ( fun i p -> Var( sprintf " p%d " i, p.ParameterType))
5757 let paramArgs = [ for v in paramVars -> Expr.Var( v) ]
5858 let lambdaConstr = paramVars |> Seq.fold ( fun fn var -> fun body -> Expr.Lambda( var, fn body)) id
5959 lambdaConstr, paramArgs
60-
60+
6161 let exportFunctions =
6262 [ for m in meths ->
6363 let tv = new Var( " this" , typ)
@@ -69,15 +69,15 @@ let translateModules() =
6969 ( Expr.Lambda( Var( " ign" , typeof< unit>), Expr.NewObject( typ.GetConstructor [||], [])),
7070 typeof< obj> )
7171
72- let functionArray =
73- Expr.NewArray( typeof< obj>, exportCtor::[ for f in exportFunctions -> Expr.Coerce( f, typeof< obj>)])
72+ let functionArray =
73+ Expr.NewArray( typeof< obj>, exportCtor::[ for f in exportFunctions -> Expr.Coerce( f, typeof< obj>)])
7474
7575 let coreJS = Compiler.Compile( functionArray)
7676
7777 // Now we just wrap the generated JavaScript into 'wrappedFunScript' function
7878 // Then we call the function and create a module export with all the public methods
79- // from the provided type (just by calling one of the functions from the array)
80- let moduleJS =
79+ // from the provided type (just by calling one of the functions from the array)
80+ let moduleJS =
8181 [ yield " var CompositeDisposable = require('atom').CompositeDisposable;"
8282 yield " var child_process = require('child_process');"
8383 yield " window.$ = require('jquery');"
@@ -110,8 +110,8 @@ let typings = __SOURCE_DIRECTORY__ @@ "typings"
110110let typesZip = typings @@ " FunScript.TypeScript" @@ " Types.zip"
111111let noInline = set [ " jquery.d.ts" ; " node.d.ts" ; " atom.d.ts" ]
112112
113- let fsharpBin =
114- [ " /Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.0"
113+ let fsharpBin =
114+ [ " /Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.0"
115115 (* TODO: This needs to list many more locations where fsc.exe can be? *) ]
116116 |> List.tryFind ( fun p -> File.Exists( p @@ " fsc.exe" ))
117117
@@ -122,15 +122,15 @@ Target "GenerateBindings" (fun () ->
122122 CleanDir ( typings @@ " temp" )
123123
124124 // Get all definitions and their dependencies (and source code without <reference> tags)
125- let tsDefinitions =
125+ let tsDefinitions =
126126 let reg = System.Text.RegularExpressions.Regex( " reference.*path=\" ([^\" ]*)\" " ) // "
127127 let defs = Directory.EnumerateFiles( typings, " *.d.ts" , SearchOption.AllDirectories)
128128 [ for def in defs ->
129129 let lines = File.ReadAllLines( def)
130- let deps , lines =
130+ let deps , lines =
131131 [ for line in lines do
132132 let mtch = reg.Match( line)
133- if mtch.Success then
133+ if mtch.Success then
134134 let depName = Path.GetFileName( mtch.Groups.[ 1 ]. Value)
135135 if not ( noInline.Contains depName) then yield true , depName
136136 else yield false , line ] |> List.partition fst
@@ -153,10 +153,12 @@ Target "GenerateBindings" (fun () ->
153153 // Set the FSHARP_BIN variable and run FunScript codegen!
154154 fsharpBin |> Option.iter ( fun fsharpBin ->
155155 System.Environment.SetEnvironmentVariable( " FSHARP_BIN" , fsharpBin))
156- ProcessHelper.StartProcess ( fun p ->
156+
157+ ( TimeSpan.FromMinutes 5.0 )
158+ |> ProcessHelper.ExecProcess ( fun p ->
157159 p.FileName <- typings @@ " FunScript.TypeScript" @@ " FunScript.TypeScript.exe"
158- p.WorkingDirectory <- typings @@ " FunScript.TypeScript"
159- )
160+ p.WorkingDirectory <- typings @@ " FunScript.TypeScript" )
161+ |> ignore
160162)
161163
162164// --------------------------------------------------------------------------------------
0 commit comments