From 0aa963c84ee6e671ee830a693852ff43fe47d042 Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Sat, 30 Dec 2017 18:43:26 +0000 Subject: [PATCH] Fix issues with GenerateBindings target generateBindings was let bound as a value and thus ran at startup before any other target. Changed so all the code for generating the bindings is in the target and the target is added a build dependency. --- build.fsx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/build.fsx b/build.fsx index ee8eb0a..44d90d1 100644 --- a/build.fsx +++ b/build.fsx @@ -99,17 +99,6 @@ let runtimeProjects = let activeProjects = Seq.concat [buildProjects; runtimeProjects] -let generateBindings = - if not (File.Exists(".bindingsGenerated")) then - buildProjects - |> MSBuildRelease "" "Build" - |> ignore - let bindingProcess = new Process() - bindingProcess.StartInfo.FileName <- Path.Combine("src", "Generator.Bind", "bin", "Release", "Bind.exe") - bindingProcess.Start() |> ignore - bindingProcess.WaitForExit() |> ignore - File.Create(".bindingsGenerated").Close() |> ignore - // Generate assembly info files with the right version & up-to-date information Target "AssemblyInfo" (fun _ -> @@ -165,15 +154,23 @@ Target "Clean" (fun _ -> // -------------------------------------------------------------------------------------- // Build generator projects, and generate bindings if neccesary Target "GenerateBindings" (fun _ -> - generateBindings - |> ignore + if not (File.Exists(".bindingsGenerated")) then + buildProjects + |> MSBuildRelease "" "Build" + |> ignore + let bindingProcess = new Process() + bindingProcess.StartInfo.FileName <- Path.Combine("src", "Generator.Bind", "bin", "Release", "Bind.exe") + if bindingProcess.Start() then + bindingProcess.WaitForExit() + File.Create(".bindingsGenerated").Close() + else + failwith "Could not start Bind.exe" ) // -------------------------------------------------------------------------------------- // Build library & test project Target "Build" (fun _ -> - generateBindings activeProjects |> MSBuildRelease "" "Build" |> ignore @@ -221,6 +218,7 @@ Target "All" DoNothing "Clean" ==> "AssemblyInfo" + ==> "GenerateBindings" ==> "Build" ==> "CopyBinaries" ==> "RunTests" -- 2.7.4