Added initial parts of build framework

This commit is contained in:
varon 2016-07-17 23:12:35 +02:00
parent a582c96003
commit 7ca257f4b7
11 changed files with 476 additions and 7 deletions

Binary file not shown.

41
.paket/paket.targets Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">true</RestorePackages>
<!-- Download Paket.exe if it does not already exist -->
<DownloadPaket Condition=" '$(DownloadPaket)' == '' ">true</DownloadPaket>
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
</PropertyGroup>
<PropertyGroup>
<!-- Paket command -->
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)" $(PaketBootStrapperCommandArgs)</PaketBootStrapperCommand>
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 $(PaketBootStrapperExePath) $(PaketBootStrapperCommandArgs)</PaketBootStrapperCommand>
<!-- Commands -->
<PaketReferences Condition="!Exists('$(MSBuildProjectFullPath).paket.references')">$(MSBuildProjectDirectory)\paket.references</PaketReferences>
<PaketReferences Condition="!Exists('$(PaketReferences)')">$(MSBuildStartupDirectory)\paket.references</PaketReferences>
<PaketReferences Condition="Exists('$(MSBuildProjectFullPath).paket.references')">$(MSBuildProjectFullPath).paket.references</PaketReferences>
<RestoreCommand>$(PaketCommand) restore --references-files "$(PaketReferences)"</RestoreCommand>
<DownloadPaketCommand>$(PaketBootStrapperCommand)</DownloadPaketCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">RestorePackages; $(BuildDependsOn);</BuildDependsOn>
</PropertyGroup>
<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate paket.exe -->
<Error Condition="'$(DownloadPaket)' != 'true' AND !Exists('$(PaketExePath)')" Text="Unable to locate '$(PaketExePath)'" />
<MsBuild Targets="DownloadPaket" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadPaket=$(DownloadPaket)" />
</Target>
<Target Name="DownloadPaket">
<Exec Command="$(DownloadPaketCommand)" IgnoreStandardErrorWarningFormat="true" Condition=" '$(DownloadPaket)' == 'true' AND !Exists('$(PaketExePath)')" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(PaketRootPath)" Condition="Exists('$(PaketReferences)')" ContinueOnError="true" />
</Target>
</Project>

View File

@ -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
before_install:
- chmod +x build.sh
script:
- ./build.sh All

View File

@ -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

4
RELEASE_NOTES.md Normal file
View File

@ -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

9
appveyor.yml Normal file
View File

@ -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

18
build.cmd Normal file
View File

@ -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 %*

174
build.fsx Normal file
View File

@ -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 <stapostol@gmail.com> 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 <Target>' to override
Target "All" DoNothing
"Clean"
==> "AssemblyInfo"
==> "Build"
==> "CopyBinaries"
==> "RunTests"
==> "All"
"All"
==> "NuGet"
RunTargetOrDefault "All"

37
build.sh Normal file
View File

@ -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

10
paket.dependencies Normal file
View File

@ -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

165
paket.lock Normal file
View File

@ -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)