diff --git a/.paket/paket.bootstrapper.exe b/.paket/paket.bootstrapper.exe new file mode 100644 index 00000000..3a634974 Binary files /dev/null and b/.paket/paket.bootstrapper.exe differ diff --git a/.paket/paket.targets b/.paket/paket.targets new file mode 100644 index 00000000..0fd370f9 --- /dev/null +++ b/.paket/paket.targets @@ -0,0 +1,41 @@ + + + + + true + + true + $(MSBuildThisFileDirectory) + $(MSBuildThisFileDirectory)..\ + /Library/Frameworks/Mono.framework/Commands/mono + mono + + + + $(PaketToolsPath)paket.exe + $(PaketToolsPath)paket.bootstrapper.exe + "$(PaketExePath)" + $(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" + "$(PaketBootStrapperExePath)" $(PaketBootStrapperCommandArgs) + $(MonoPath) --runtime=v4.0.30319 $(PaketBootStrapperExePath) $(PaketBootStrapperCommandArgs) + + $(MSBuildProjectDirectory)\paket.references + $(MSBuildStartupDirectory)\paket.references + $(MSBuildProjectFullPath).paket.references + $(PaketCommand) restore --references-files "$(PaketReferences)" + $(PaketBootStrapperCommand) + + RestorePackages; $(BuildDependsOn); + + + + + + + + + + + + + diff --git a/.travis.yml b/.travis.yml index f5c27f4e..5152d90c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,9 @@ language: csharp -solution: OpenTK.sln -mono: - - latest - - 3.10.0 - - 3.8.0 +sudo: false # use the new container-based Travis infrastructure -script: - - xbuild /p:Configuration=Release OpenTK.sln \ No newline at end of file +before_install: + - chmod +x build.sh + +script: + - ./build.sh All diff --git a/OpenTK.sln b/OpenTK.sln index 3afccdad..de01d1b1 100644 --- a/OpenTK.sln +++ b/OpenTK.sln @@ -25,6 +25,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Tests", "tests\OpenT EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.API.Desktop", "tests\Test.API.Desktop\Test.API.Desktop.csproj", "{C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{F1A57014-71CE-4032-A652-01B7E35E14DB}" + ProjectSection(SolutionItems) = preProject + paket.dependencies = paket.dependencies + paket.lock = paket.lock + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{5EEEC96B-BD2F-45B0-935D-19E9E6D7D969}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + RELEASE_NOTES.md = RELEASE_NOTES.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md new file mode 100644 index 00000000..5b9f46fb --- /dev/null +++ b/RELEASE_NOTES.md @@ -0,0 +1,4 @@ +### 2.0.0 - alpha + * Moved to new FAKE/Paket based build system + * Removed superfluous release configurations + * Numerous other fixes and enhancements diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..01984685 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,9 @@ +init: + - git config --global core.autocrlf input +build_script: + - cmd: build.cmd +test: off +version: 0.0.1.{build} +artifacts: + - path: bin + name: bin diff --git a/build.cmd b/build.cmd new file mode 100644 index 00000000..79c3cd5c --- /dev/null +++ b/build.cmd @@ -0,0 +1,18 @@ +@echo off +cls + +.paket\paket.bootstrapper.exe +if errorlevel 1 ( + exit /b %errorlevel% +) + +.paket\paket.exe restore +if errorlevel 1 ( + exit /b %errorlevel% +) + +IF NOT EXIST build.fsx ( + .paket\paket.exe update + packages\FAKE\tools\FAKE.exe init.fsx +) +packages\FAKE\tools\FAKE.exe build.fsx %* diff --git a/build.fsx b/build.fsx new file mode 100644 index 00000000..cebcf560 --- /dev/null +++ b/build.fsx @@ -0,0 +1,174 @@ +// -------------------------------------------------------------------------------------- +// FAKE build script +// -------------------------------------------------------------------------------------- + +#r @"packages/FAKE/tools/FakeLib.dll" +open Fake +open Fake.Git +open Fake.AssemblyInfoFile +open Fake.ReleaseNotesHelper +open Fake.UserInputHelper +open Fake.Testing +open System +open System.IO + +// -------------------------------------------------------------------------------------- +// START TODO: Provide project-specific details below +// -------------------------------------------------------------------------------------- + +// Information about the project are used +// - for version and project name in generated AssemblyInfo file +// - by the generated NuGet package +// - to run tests and to publish documentation on GitHub gh-pages +// - for documentation, you also need to edit info in "docs/tools/generate.fsx" + +// The name of the project +// (used by attributes in AssemblyInfo, name of a NuGet package and directory in 'src') +let project = "OpenTK" + +// Short summary of the project +// (used as description in AssemblyInfo and as a short summary for NuGet package) +let summary = "A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL." + +// Longer description of the project +// (used as a description for NuGet package; line breaks are automatically cleaned up) +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." + +// List of author names (for NuGet package) +let authors = [ "Stefanos Apostolopoulos" ] + +// Tags for your project (for NuGet package) +let tags = "OpenTK OpenGL OpenGLES GLES OpenAL C# F# VB .NET Mono Vector Math Game Graphics Sound" + +let copyright = "Copyright (c) 2006 - 2016 Stefanos Apostolopoulos for the Open Toolkit library." + +// File system information +let solutionFile = "OpenTK.sln" + +// Pattern specifying assemblies to be tested using NUnit +let testAssemblies = "tests/**/bin/Release/*Tests*.dll" + +// Git configuration (used for publishing documentation in gh-pages branch) +// The profile where the project is posted +let gitOwner = "opentk" +let gitHome = "https://github.com/" + gitOwner + +// The name of the project on GitHub +let gitName = "opentk" + +// The url for the raw files hosted +let gitRaw = environVarOrDefault "gitRaw" "https://raw.github.com/opentk" + +// -------------------------------------------------------------------------------------- +// END TODO: The rest of the file includes standard build steps +// -------------------------------------------------------------------------------------- + +// Read additional information from the release notes document +let release = LoadReleaseNotes "RELEASE_NOTES.md" + + +// Helper active pattern for project types +let (|Fsproj|Csproj|Vbproj|) (projFileName:string) = + match projFileName with + | f when f.EndsWith "fsproj" -> Fsproj + | f when f.EndsWith "csproj" -> Csproj + | f when f.EndsWith "vbproj" -> Vbproj + | _ -> failwith (sprintf "Project file %s not supported. Unknown project type." projFileName) + +// Generate assembly info files with the right version & up-to-date information +Target "AssemblyInfo" (fun _ -> + let getAssemblyInfoAttributes projectName = + [ Attribute.Title (projectName) + Attribute.Product project + Attribute.Description summary + Attribute.Version release.AssemblyVersion + Attribute.FileVersion release.AssemblyVersion + Attribute.CLSCompliant true + Attribute.Copyright copyright ] + + let getProjectDetails projectPath = + let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath) + ( projectPath, + projectName, + System.IO.Path.GetDirectoryName(projectPath), + (getAssemblyInfoAttributes projectName) + ) + + !! "src/**/*.??proj" + |> Seq.map getProjectDetails + |> Seq.iter (fun (projFileName, projectName, folderName, attributes) -> + match projFileName with + | Fsproj -> CreateFSharpAssemblyInfo (folderName @@ "AssemblyInfo.fs") attributes + | Csproj -> CreateCSharpAssemblyInfo ((folderName @@ "Properties") @@ "AssemblyInfo.cs") attributes + | Vbproj -> CreateVisualBasicAssemblyInfo ((folderName @@ "My Project") @@ "AssemblyInfo.vb") attributes + ) +) + +// Copies binaries from default VS location to expected bin folder +// But keeps a subdirectory structure for each project in the +// src folder to support multiple project outputs +Target "CopyBinaries" (fun _ -> + !! "src/**/*.??proj" + |> Seq.map (fun f -> ((System.IO.Path.GetDirectoryName f) @@ "bin/Release", "bin" @@ (System.IO.Path.GetFileNameWithoutExtension f))) + |> Seq.iter (fun (fromDir, toDir) -> CopyDir toDir fromDir (fun _ -> true)) +) + +// -------------------------------------------------------------------------------------- +// Clean build results + +Target "Clean" (fun _ -> + CleanDirs ["bin"; "temp"] +) + +// -------------------------------------------------------------------------------------- +// Build library & test project + +Target "Build" (fun _ -> + !! solutionFile + |> MSBuildRelease "" "Rebuild" + |> ignore +) + +// -------------------------------------------------------------------------------------- +// Run the unit tests using test runner + +Target "RunTests" (fun _ -> + !! testAssemblies + |> xUnit2 (fun p -> + { p with + ShadowCopy = true + TimeOut = TimeSpan.FromMinutes 2. + XmlOutputPath = Some "TestResults.xml" }) +) + +// -------------------------------------------------------------------------------------- +// Build a NuGet package + +Target "NuGet" (fun _ -> + Paket.Pack(fun p -> + { p with + OutputPath = "bin" + Version = release.NugetVersion + ReleaseNotes = toLines release.Notes}) +) + + +Target "BuildPackage" DoNothing + +// -------------------------------------------------------------------------------------- +// Run all targets by default. Invoke 'build ' to override + +Target "All" DoNothing + +"Clean" + ==> "AssemblyInfo" + ==> "Build" + ==> "CopyBinaries" + ==> "RunTests" + ==> "All" + +"All" + ==> "NuGet" + + +RunTargetOrDefault "All" diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..fe082dd3 --- /dev/null +++ b/build.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +set -eu +set -o pipefail + +cd `dirname $0` + +FSIARGS="" +OS=${OS:-"unknown"} +if [[ "$OS" != "Windows_NT" ]] +then + FSIARGS="--fsiargs -d:MONO" +fi + +function run() { + if [[ "$OS" != "Windows_NT" ]] + then + mono "$@" + else + "$@" + fi +} + +run .paket/paket.bootstrapper.exe + +if [[ "$OS" != "Windows_NT" ]] && + [ ! -e ~/.config/.mono/certs ] +then + mozroots --import --sync --quiet +fi + +run .paket/paket.exe restore + +[ ! -e build.fsx ] && run .paket/paket.exe update +[ ! -e build.fsx ] && run packages/FAKE/tools/FAKE.exe init.fsx +run packages/FAKE/tools/FAKE.exe "$@" $FSIARGS build.fsx + diff --git a/paket.dependencies b/paket.dependencies new file mode 100644 index 00000000..51185557 --- /dev/null +++ b/paket.dependencies @@ -0,0 +1,10 @@ +source https://nuget.org/api/v2 + +#Open packages + +nuget FSharp.Formatting +nuget FsCheck.Xunit +nuget xunit.runner.console +nuget xunit.assert +nuget FAKE +nuget Mono.Cecil \ No newline at end of file diff --git a/paket.lock b/paket.lock new file mode 100644 index 00000000..dcb61fb3 --- /dev/null +++ b/paket.lock @@ -0,0 +1,165 @@ +NUGET + remote: https://www.nuget.org/api/v2 + specs: + FAKE (4.28) + FsCheck (2.4) + FSharp.Core (>= 3.1.2.5) + FsCheck.Xunit (2.4) + FsCheck (>= 2.4) + xunit.extensibility.execution (>= 2.1 < 3.0) + FSharp.Compiler.Service (2.0.0.6) + FSharp.Core (4.0.0.1) + FSharp.Formatting (2.14.4) + FSharp.Compiler.Service (2.0.0.6) + FSharpVSPowerTools.Core (>= 2.3 < 2.4) + FSharpVSPowerTools.Core (2.3) + FSharp.Compiler.Service (>= 2.0.0.3) + Mono.Cecil (0.9.6.1) + System.Collections (4.0.10) - framework: dnxcore50 + System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 + System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 + System.Threading (>= 4.0) - framework: dnxcore50 + System.Diagnostics.Contracts (4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Diagnostics.Debug (4.0.10) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Globalization (4.0.10) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.IO (4.0.10) - framework: dnxcore50 + System.Globalization (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Text.Encoding (>= 4.0) - framework: dnxcore50 + System.Text.Encoding (>= 4.0.10) - framework: dnxcore50 + System.Text.Encoding.Extensions (>= 4.0) - framework: dnxcore50 + System.Threading (>= 4.0) - framework: dnxcore50 + System.Threading.Tasks (>= 4.0) - framework: dnxcore50 + System.Linq (4.0) - framework: dnxcore50 + System.Collections (>= 4.0.10) - framework: dnxcore50 + System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 + System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 + System.Linq.Expressions (4.0.10) - framework: dnxcore50 + System.Collections (>= 4.0) - framework: dnxcore50 + System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 + System.Globalization (>= 4.0) - framework: dnxcore50 + System.IO (>= 4.0) - framework: dnxcore50 + System.Linq (>= 4.0) - framework: dnxcore50 + System.ObjectModel (>= 4.0) - framework: dnxcore50 + System.Reflection (>= 4.0) - framework: dnxcore50 + System.Reflection.Emit (>= 4.0) - framework: dnxcore50 + System.Reflection.Extensions (>= 4.0) - framework: dnxcore50 + System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 + System.Reflection.TypeExtensions (>= 4.0) - framework: dnxcore50 + System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 + System.Threading (>= 4.0) - framework: dnxcore50 + System.ObjectModel (4.0.10) - framework: dnxcore50 + System.Collections (>= 4.0.10) - framework: dnxcore50 + System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 + System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Threading (>= 4.0.10) - framework: dnxcore50 + System.Private.Uri (4.0) - framework: dnxcore50 + System.Reflection (4.0.10) - framework: dnxcore50 + System.IO (>= 4.0) - framework: dnxcore50 + System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Reflection.Emit (4.0) - framework: dnxcore50 + System.IO (>= 4.0) - framework: dnxcore50 + System.Reflection (>= 4.0) - framework: dnxcore50 + System.Reflection.Emit.ILGeneration (>= 4.0) - framework: dnxcore50 + System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Reflection.Emit.ILGeneration (4.0) - framework: dnxcore50 + System.Reflection (>= 4.0) - framework: dnxcore50 + System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Reflection.Extensions (4.0) - framework: dnxcore50 + System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 + System.Reflection (>= 4.0) - framework: dnxcore50 + System.Reflection (>= 4.0.10) - framework: dnxcore50 + System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 + System.Reflection.TypeExtensions (>= 4.0) - framework: dnxcore50 + System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 + System.Reflection.Primitives (4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Threading (>= 4.0) - framework: dnxcore50 + System.Reflection.TypeExtensions (4.0) - framework: dnxcore50 + System.Diagnostics.Contracts (>= 4.0) - framework: dnxcore50 + System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 + System.Linq (>= 4.0) - framework: dnxcore50 + System.Reflection (>= 4.0) - framework: dnxcore50 + System.Reflection (>= 4.0.10) - framework: dnxcore50 + System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 + System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 + System.Resources.ResourceManager (4.0) - framework: dnxcore50 + System.Globalization (>= 4.0) - framework: dnxcore50 + System.Reflection (>= 4.0) - framework: dnxcore50 + System.Reflection (>= 4.0.10) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Runtime (4.0.20) - framework: dnxcore50 + System.Private.Uri (>= 4.0) - framework: dnxcore50 + System.Runtime.Extensions (4.0.10) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Text.Encoding (4.0.10) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Text.Encoding.Extensions (4.0.10) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Text.Encoding (>= 4.0.10) - framework: dnxcore50 + System.Text.RegularExpressions (4.0.10) - framework: dnxcore50 + System.Collections (>= 4.0.10) - framework: dnxcore50 + System.Globalization (>= 4.0.10) - framework: dnxcore50 + System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0.20) - framework: dnxcore50 + System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 + System.Threading (>= 4.0.10) - framework: dnxcore50 + System.Threading (4.0.10) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Threading.Tasks (>= 4.0) - framework: dnxcore50 + System.Threading.Tasks (4.0.10) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + xunit.abstractions (2.0) - framework: >= net45, dnx451, dnxcore50, monoandroid, monotouch, xamarinios, winv4.5, wpv8.0, wpav8.1 + xunit.assert (2.1) + System.Collections (>= 4.0) - framework: dnxcore50 + System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 + System.Globalization (>= 4.0) - framework: dnxcore50 + System.Linq (>= 4.0) - framework: dnxcore50 + System.ObjectModel (>= 4.0) - framework: dnxcore50 + System.Reflection (>= 4.0) - framework: dnxcore50 + System.Reflection.Extensions (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 + System.Text.RegularExpressions (>= 4.0) - framework: dnxcore50 + System.Threading.Tasks (>= 4.0) - framework: dnxcore50 + xunit.extensibility.core (2.1) - framework: >= net45, dnx451, dnxcore50, monoandroid, monotouch, xamarinios, winv4.5, wpv8.0, wpav8.1 + xunit.abstractions (2.0) + xunit.extensibility.execution (2.1) + System.Collections (>= 4.0) - framework: dnxcore50 + System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 + System.Globalization (>= 4.0) - framework: dnxcore50 + System.IO (>= 4.0) - framework: dnxcore50 + System.Linq (>= 4.0) - framework: dnxcore50 + System.Linq.Expressions (>= 4.0) - framework: dnxcore50 + System.Reflection (>= 4.0) - framework: dnxcore50 + System.Reflection.Extensions (>= 4.0) - framework: dnxcore50 + System.Runtime (>= 4.0) - framework: dnxcore50 + System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 + System.Text.Encoding (>= 4.0) - framework: dnxcore50 + System.Threading (>= 4.0) - framework: dnxcore50 + System.Threading.Tasks (>= 4.0) - framework: dnxcore50 + xunit.abstractions (>= 2.0) - framework: dnxcore50 + xunit.extensibility.core (2.1) - framework: >= net45, dnx451, dnxcore50, monoandroid, monotouch, xamarinios, winv4.5, wpv8.0, wpav8.1 + xunit.runner.console (2.1)