Add binding generation step to build script.

This commit is contained in:
Jarl Gullberg 2017-12-27 19:48:27 +01:00
parent a498da9448
commit a027fb186a
No known key found for this signature in database
GPG key ID: 750FF6F6BDA72D23

View file

@ -11,6 +11,7 @@ open Fake.UserInputHelper
open Fake.Testing open Fake.Testing
open System open System
open System.IO open System.IO
open System.Diagnostics
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// START TODO: Provide project-specific details below // 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) | _ -> failwith (sprintf "Project file %s not supported. Unknown project type." projFileName)
let activeProjects = let buildProjects =
!! "src/Generator.*/**.csproj"
let runtimeProjects =
let xamarinFilter f = let xamarinFilter f =
if isXamarinPlatform then if isXamarinPlatform then
f f
@ -89,8 +93,24 @@ let activeProjects =
!! "src/**/*.??proj" !! "src/**/*.??proj"
++ "tests/**/OpenTK.Tests*.fsproj" ++ "tests/**/OpenTK.Tests*.fsproj"
-- "src/Generator.*/**.csproj"
|> xamarinFilter |> 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 // Generate assembly info files with the right version & up-to-date information
Target "AssemblyInfo" (fun _ -> Target "AssemblyInfo" (fun _ ->
let getAssemblyInfoAttributes (projectName:string) = let getAssemblyInfoAttributes (projectName:string) =
@ -141,10 +161,18 @@ Target "Clean" (fun _ ->
CleanDirs ["bin"; "temp"] CleanDirs ["bin"; "temp"]
) )
// --------------------------------------------------------------------------------------
// Build generator projects, and generate bindings if neccesary
Target "GenerateBindings" (fun _ ->
generateBindings
|> ignore
)
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
// Build library & test project // Build library & test project
Target "Build" (fun _ -> Target "Build" (fun _ ->
generateBindings
activeProjects activeProjects
|> MSBuildRelease "" "Build" |> MSBuildRelease "" "Build"
|> ignore |> ignore