From a027fb186ae8164c39db697c0688017cc28c93d3 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Wed, 27 Dec 2017 19:48:27 +0100 Subject: [PATCH] Add binding generation step to build script. --- build.fsx | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/build.fsx b/build.fsx index b153c0fb..8d74e701 100644 --- a/build.fsx +++ b/build.fsx @@ -11,6 +11,7 @@ open Fake.UserInputHelper open Fake.Testing open System open System.IO +open System.Diagnostics // -------------------------------------------------------------------------------------- // START TODO: Provide project-specific details below @@ -78,7 +79,10 @@ let (|Fsproj|Csproj|Vbproj|) (projFileName:string) = | _ -> failwith (sprintf "Project file %s not supported. Unknown project type." projFileName) -let activeProjects = +let buildProjects = + !! "src/Generator.*/**.csproj" + +let runtimeProjects = let xamarinFilter f = if isXamarinPlatform then f @@ -89,8 +93,24 @@ let activeProjects = !! "src/**/*.??proj" ++ "tests/**/OpenTK.Tests*.fsproj" + -- "src/Generator.*/**.csproj" |> xamarinFilter +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 <- "src/Generator.Bind/bin/Release/Bind.exe" + bindingProcess.Start() + bindingProcess.WaitForExit() + File.Create(".bindingsGenerated").Close(); + + // Generate assembly info files with the right version & up-to-date information Target "AssemblyInfo" (fun _ -> let getAssemblyInfoAttributes (projectName:string) = @@ -141,10 +161,18 @@ Target "Clean" (fun _ -> CleanDirs ["bin"; "temp"] ) +// -------------------------------------------------------------------------------------- +// Build generator projects, and generate bindings if neccesary +Target "GenerateBindings" (fun _ -> + generateBindings + |> ignore +) + // -------------------------------------------------------------------------------------- // Build library & test project Target "Build" (fun _ -> + generateBindings activeProjects |> MSBuildRelease "" "Build" |> ignore