1 // --------------------------------------------------------------------------------------
3 // --------------------------------------------------------------------------------------
5 #r @"packages/FAKE/tools/FakeLib.dll"
8 open Fake.AssemblyInfoFile
9 open Fake.ReleaseNotesHelper
10 open Fake.UserInputHelper
15 // --------------------------------------------------------------------------------------
16 // START TODO: Provide project-specific details below
17 // --------------------------------------------------------------------------------------
19 // Information about the project are used
20 // - for version and project name in generated AssemblyInfo file
21 // - by the generated NuGet package
22 // - to run tests and to publish documentation on GitHub gh-pages
23 // - for documentation, you also need to edit info in "docs/tools/generate.fsx"
25 // The name of the project
26 // (used by attributes in AssemblyInfo, name of a NuGet package and directory in 'src')
27 let project = "OpenTK"
29 // Short summary of the project
30 // (used as description in AssemblyInfo and as a short summary for NuGet package)
31 let summary = "A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL."
33 // Longer description of the project
34 // (used as a description for NuGet package; line breaks are automatically cleaned up)
35 let description = "The Open Toolkit is set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL. It runs on all major platforms and powers hundreds of apps, games and scientific research."
37 // List of author names (for NuGet package)
38 let authors = [ "Stefanos Apostolopoulos" ]
40 // Tags for your project (for NuGet package)
41 let tags = "OpenTK OpenGL OpenGLES GLES OpenAL C# F# VB .NET Mono Vector Math Game Graphics Sound"
43 let copyright = "Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library."
45 // File system information
46 let solutionFile = "OpenTK.sln"
48 // Pattern specifying assemblies to be tested using NUnit
49 let testAssemblies = "tests/**/bin/Release/*Tests*.dll"
51 // Git configuration (used for publishing documentation in gh-pages branch)
52 // The profile where the project is posted
53 let gitOwner = "opentk"
54 let gitHome = "https://github.com/" + gitOwner
56 // The name of the project on GitHub
57 let gitName = "opentk"
59 // The url for the raw files hosted
60 let gitRaw = environVarOrDefault "gitRaw" "https://raw.github.com/opentk"
62 // --------------------------------------------------------------------------------------
63 // END TODO: The rest of the file includes standard build steps
64 // --------------------------------------------------------------------------------------
66 // Read additional information from the release notes document
67 let release = LoadReleaseNotes "RELEASE_NOTES.md"
69 let isXamarinPlatform = false //EnvironmentHelper.isMacOS || Environment.OSVersion.Platform = PlatformID.Win32NT
72 // Helper active pattern for project types
73 let (|Fsproj|Csproj|Vbproj|) (projFileName:string) =
74 match projFileName with
75 | f when f.EndsWith "fsproj" -> Fsproj
76 | f when f.EndsWith "csproj" -> Csproj
77 | f when f.EndsWith "vbproj" -> Vbproj
78 | _ -> failwith (sprintf "Project file %s not supported. Unknown project type." projFileName)
83 if isXamarinPlatform then
87 -- "**/OpenTK.Android.csproj"
88 -- "**/OpenTK.iOS.csproj"
91 ++ "tests/**/OpenTK.Tests*.fsproj"
94 // Generate assembly info files with the right version & up-to-date information
95 Target "AssemblyInfo" (fun _ ->
96 let getAssemblyInfoAttributes (projectName:string) =
98 if projectName.Contains(".iOS") || projectName.Contains(".Android") then
99 projectName.Split('.').[0]
102 [ Attribute.Title (projectName)
103 Attribute.Product project
104 Attribute.Description summary
105 Attribute.Version release.AssemblyVersion
106 Attribute.FileVersion release.AssemblyVersion
107 Attribute.CLSCompliant true
108 Attribute.Copyright copyright
111 let getProjectDetails projectPath =
112 let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath)
115 System.IO.Path.GetDirectoryName(projectPath),
116 (getAssemblyInfoAttributes projectName)
120 |> Seq.map getProjectDetails
121 |> Seq.iter (fun (projFileName, projectName, folderName, attributes) ->
122 match projFileName with
123 | Fsproj -> CreateFSharpAssemblyInfo (folderName @@ "AssemblyInfo.fs") attributes
124 | Csproj -> CreateCSharpAssemblyInfo ((folderName @@ "Properties") @@ "AssemblyInfo.cs") attributes
125 | Vbproj -> CreateVisualBasicAssemblyInfo ((folderName @@ "My Project") @@ "AssemblyInfo.vb") attributes
129 // Copies binaries from default VS location to expected bin folder
130 // But keeps a subdirectory structure for each project in the
131 // src folder to support multiple project outputs
132 Target "CopyBinaries" (fun _ ->
134 |> Seq.map (fun f -> ((System.IO.Path.GetDirectoryName f) @@ "bin/Release", "bin" @@ (System.IO.Path.GetFileNameWithoutExtension f)))
135 |> Seq.iter (fun (fromDir, toDir) -> CopyDir toDir fromDir (fun _ -> true))
138 // --------------------------------------------------------------------------------------
139 // Clean build results
141 Target "Clean" (fun _ ->
142 CleanDirs ["bin"; "temp"]
145 // --------------------------------------------------------------------------------------
146 // Build library & test project
148 Target "Build" (fun _ ->
150 |> MSBuildRelease "" "Build"
154 // --------------------------------------------------------------------------------------
155 // Run the unit tests using test runner
157 Target "RunTests" (fun _ ->
162 TimeOut = TimeSpan.FromMinutes 2.
163 XmlOutputPath = Some "TestResults.xml" })
166 // --------------------------------------------------------------------------------------
167 // Build a NuGet package
169 Target "NuGet" (fun _ ->
171 if isXamarinPlatform then
181 ExcludedTemplates = xamExcludes
182 Version = release.NugetVersion
183 ReleaseNotes = toLines release.Notes})
187 Target "BuildPackage" DoNothing
189 // --------------------------------------------------------------------------------------
190 // Run all targets by default. Invoke 'build <Target>' to override
192 Target "All" DoNothing
205 RunTargetOrDefault "All"