Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from russcam/master
Add FAKE and Paket for build automation
- Loading branch information
Showing
33 changed files
with
598 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,7 @@ obj/ | |
_ReSharper*/ | ||
[Tt]est[Rr]esult* | ||
Source/BitDiffer.Tests.bin/ | ||
|
||
packages | ||
Build/scripts/.fake | ||
Build/output |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0"?> | ||
<package > | ||
<metadata> | ||
<id>BitDiffer</id> | ||
<version>$version$</version> | ||
<authors>grennis</authors> | ||
<owners>grennis, forloop</owners> | ||
<licenseUrl>https://github.com/grennis/bitdiffer/blob/master/LICENSE</licenseUrl> | ||
<projectUrl>https://github.com/grennis/bitdiffer</projectUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>A GUI and Command Line application to compare versions of .NET assemblies.</description> | ||
<releaseNotes>Initial release</releaseNotes> | ||
<copyright>Copyright 2016</copyright> | ||
<tags>reflection assembly diff diffing</tags> | ||
</metadata> | ||
<files> | ||
<file src="output\v4.6\Aga.Controls\Aga.Controls.dll" target="lib\net46"/> | ||
<file src="output\v4.6\Aga.Controls\Aga.Controls.pdb" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Client\BitDiffer.Client.exe" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Client\BitDiffer.Client.exe.config" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Client\BitDiffer.Client.pdb" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Common\BitDiffer.Common.dll" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Common\BitDiffer.Common.pdb" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Console\BitDiffer.Console.exe" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Console\BitDiffer.Console.exe.config" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Console\BitDiffer.Console.pdb" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Core\BitDiffer.Core.dll" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Core\BitDiffer.Core.pdb" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Extractor\BitDiffer.Extractor.dll" target="lib\net46"/> | ||
<file src="output\v4.6\BitDiffer.Extractor\BitDiffer.Extractor.pdb" target="lib\net46"/> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#I @"../../packages/build/FAKE/tools" | ||
#r @"FakeLib.dll" | ||
|
||
#load @"Projects.fsx" | ||
#load @"Paths.fsx" | ||
#load @"Tooling.fsx" | ||
|
||
open Fake | ||
|
||
open Paths | ||
open Projects | ||
open Tooling | ||
|
||
type Build() = | ||
|
||
static member Compile() = | ||
Tooling.MsBuild.Build("Rebuild", Projects.DotNetFramework.Net46.Identifier) | ||
|
||
static member Clean() = | ||
CleanDir Paths.BuildOutput | ||
Projects.DotNetProject.All |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p.Name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#I @"../../packages/build/FAKE/tools" | ||
#r @"FakeLib.dll" | ||
|
||
#load "Projects.fsx" | ||
|
||
open System | ||
open System.IO | ||
open System.Diagnostics | ||
open System.Net | ||
|
||
open Fake | ||
|
||
open Projects | ||
|
||
[<AutoOpen>] | ||
module Paths = | ||
open Projects | ||
|
||
let Repository = "https://github.com/grennis/bitdiffer" | ||
|
||
let BuildFolder = "Build" | ||
let BuildOutput = sprintf "%s/output" BuildFolder | ||
|
||
let ProjectOutputFolder (project:DotNetProject) (framework:DotNetFramework) = | ||
sprintf "%s/%s/%s" BuildOutput framework.Identifier.MSBuild project.Name | ||
|
||
let Tool tool = sprintf "packages/build/%s" tool | ||
let NugetOutput = sprintf "%s/_packages" BuildOutput | ||
let SourceFolder = "Source" | ||
|
||
let Output(folder) = sprintf "%s/%s" BuildOutput folder | ||
let Source(folder) = sprintf "%s/%s" SourceFolder folder | ||
let Build(folder) = sprintf "%s/%s" BuildFolder folder | ||
|
||
let BinFolder(folder) = | ||
let f = replace @"\" "/" folder | ||
sprintf "%s/%s/bin/Release" SourceFolder f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
[<AutoOpen>] | ||
module Projects = | ||
|
||
let Name = "BitDiffer" | ||
|
||
type DotNetFrameworkIdentifier = { | ||
MSBuild: string; | ||
Nuget: string; | ||
DefineConstants: string; | ||
} | ||
|
||
type DotNetFramework = | ||
| Net46 | ||
static member All = [Net46] | ||
member this.Identifier = | ||
match this with | ||
| Net46 -> { MSBuild = "v4.6"; Nuget = "net46"; DefineConstants = "TRACE;NET46"; } | ||
|
||
type Project = | ||
| AgaControls | ||
| Client | ||
| Common | ||
| Console | ||
| Core | ||
| Extractor | ||
|
||
type PrivateProject = | ||
| Tests | ||
| Reference1 | ||
| Reference2 | ||
| Subject1 | ||
| Subject2 | ||
|
||
type DotNetProject = | ||
| Project of Project | ||
| PrivateProject of PrivateProject | ||
|
||
static member All = | ||
seq [ | ||
Project Project.AgaControls; | ||
Project Project.Client; | ||
Project Project.Common; | ||
Project Project.Console; | ||
Project Project.Core; | ||
Project Project.Extractor; | ||
PrivateProject PrivateProject.Tests; | ||
PrivateProject PrivateProject.Reference1; | ||
PrivateProject PrivateProject.Reference2; | ||
PrivateProject PrivateProject.Subject1; | ||
PrivateProject PrivateProject.Subject2; | ||
] | ||
|
||
member this.Name = | ||
match this with | ||
| Project p -> | ||
match p with | ||
| AgaControls -> "Aga.Controls" | ||
| Client -> "BitDiffer.Client" | ||
| Common -> "BitDiffer.Common" | ||
| Console -> "BitDiffer.Console" | ||
| Core -> "BitDiffer.Core" | ||
| Extractor -> "BitDiffer.Extractor" | ||
| PrivateProject p -> | ||
match p with | ||
| Tests -> "BitDiffer.Tests" | ||
| Reference1 -> "BitDiffer.Tests.Reference1" | ||
| Reference2 -> "BitDiffer.Tests.Reference2" | ||
| Subject1 -> "BitDiffer.Tests.Subject1" | ||
| Subject2 -> "BitDiffer.Tests.Subject2" | ||
|
||
static member TryFindName (name: string) = | ||
DotNetProject.All | ||
|> Seq.map(fun p -> p.Name) | ||
|> Seq.tryFind(fun p -> p.ToLowerInvariant() = name.ToLowerInvariant()) | ||
|
||
type DotNetFrameworkProject = { framework: DotNetFramework; project: DotNetProject } | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#I @"../../packages/build/FAKE/tools" | ||
#r @"FakeLib.dll" | ||
|
||
#load @"Projects.fsx" | ||
#load @"Paths.fsx" | ||
#load @"Tooling.fsx" | ||
#load @"Versioning.fsx" | ||
|
||
open Fake | ||
|
||
open Paths | ||
open Projects | ||
open Versioning | ||
open Tooling | ||
|
||
type Release() = | ||
static member NugetPack() = | ||
CreateDir Paths.NugetOutput | ||
|
||
let nuspec = Paths.Build (sprintf "%s.nuspec" Projects.Name) | ||
let nugetOutFile = Paths.Output(sprintf "%s.%s.nupkg" Projects.Name Versioning.FileVersion) | ||
|
||
Tooling.Nuget.Exec ["pack"; nuspec; "-version"; Versioning.FileVersion; "-outputdirectory"; Paths.BuildOutput; ] |> ignore | ||
traceFAKE "%s" Paths.BuildOutput | ||
MoveFile Paths.NugetOutput nugetOutFile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#r "../../packages/build/FAKE/tools/FakeLib.dll" | ||
|
||
#load @"Projects.fsx" | ||
#load @"Paths.fsx" | ||
#load @"Tooling.fsx" | ||
#load @"Versioning.fsx" | ||
#load @"Releasing.fsx" | ||
#load @"Building.fsx" | ||
#load @"Testing.fsx" | ||
|
||
open Fake | ||
|
||
open Building | ||
open Testing | ||
open Versioning | ||
open Releasing | ||
|
||
Target "Build" <| fun _ -> traceHeader "STARTING BUILD" | ||
|
||
Target "Clean" <| fun _ -> Build.Clean() | ||
|
||
Target "BuildApp" <| fun _ -> Build.Compile() | ||
|
||
Target "Test" <| fun _ -> Tests.RunUnitTests() | ||
|
||
Target "Version" <| fun _ -> Versioning.PatchSolutionInfo() | ||
|
||
Target "Release" <| fun _ -> Release.NugetPack() | ||
|
||
"Clean" | ||
=?> ("Version", hasBuildParam "version") | ||
==> "BuildApp" | ||
=?> ("Test", (not ((getBuildParam "skiptests") = "1"))) | ||
==> "Build" | ||
|
||
"Version" | ||
==> "Release" | ||
|
||
"Build" | ||
==> "Release" | ||
|
||
RunTargetOrDefault "Build" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#I @"../../packages/build/FAKE/tools" | ||
#r @"FakeLib.dll" | ||
|
||
#load @"Projects.fsx" | ||
#load @"Paths.fsx" | ||
#load @"Tooling.fsx" | ||
|
||
open System.IO | ||
open Fake | ||
open Paths | ||
open Projects | ||
open Tooling | ||
|
||
[<AutoOpen>] | ||
module Tests = | ||
let RunUnitTests() = | ||
let testDir = Paths.Output "v4.6/BitDiffer.Tests" | ||
!! (testDir @@ "BitDiffer.Tests.dll") | ||
|> MSTest.MSTest(fun p -> | ||
{ p with | ||
WorkingDir = Path.GetFullPath <| testDir | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#I @"../../packages/build/FAKE/tools" | ||
#r @"FakeLib.dll" | ||
|
||
#load "Projects.fsx" | ||
#load "Paths.fsx" | ||
|
||
open System | ||
open System.IO | ||
open System.Diagnostics | ||
open System.Net | ||
|
||
open Fake | ||
|
||
open Projects | ||
open Paths | ||
|
||
[<AutoOpen>] | ||
module Tooling = | ||
(* helper functions *) | ||
#if mono_posix | ||
#r "Mono.Posix.dll" | ||
open Mono.Unix.Native | ||
let private applyExecutionPermissionUnix path = | ||
let _,stat = Syscall.lstat(path) | ||
Syscall.chmod(path, FilePermissions.S_IXUSR ||| stat.st_mode) |> ignore | ||
#else | ||
let private applyExecutionPermissionUnix path = () | ||
#endif | ||
|
||
let execProcessWithTimeout proc arguments timeout = | ||
let args = arguments |> String.concat " " | ||
ExecProcess (fun info -> | ||
info.FileName <- proc | ||
info.WorkingDirectory <- "." | ||
info.Arguments <- args | ||
) timeout | ||
|
||
let private defaultTimeout = TimeSpan.FromMinutes 15.0 | ||
|
||
let execProcess proc arguments = | ||
let exitCode = execProcessWithTimeout proc arguments defaultTimeout | ||
match exitCode with | ||
| 0 -> exitCode | ||
| _ -> failwithf "Calling %s resulted in unexpected exitCode %i" proc exitCode | ||
|
||
let nugetFile = | ||
let targetLocation = "Build/tools/nuget/nuget.exe" | ||
if (fileExists targetLocation = false) | ||
then | ||
trace (sprintf "Nuget not found at %s. Downloading now" targetLocation) | ||
let url = "http://dist.nuget.org/win-x86-commandline/latest/nuget.exe" | ||
CreateDir "Build/tools/nuget" | ||
use webClient = new WebClient() | ||
webClient.DownloadFile(url, targetLocation) | ||
trace "nuget downloaded" | ||
targetLocation | ||
|
||
type BuildTooling(path) = | ||
member this.Path = path | ||
member this.Exec arguments = execProcess this.Path arguments | ||
|
||
let Nuget = new BuildTooling(nugetFile) | ||
|
||
type MsBuildTooling() = | ||
|
||
member this.Build(target, framework:Projects.DotNetFrameworkIdentifier) = | ||
let solution = sprintf "%s.sln" Projects.Name |> Paths.Source | ||
let outputPath = Paths.BuildOutput |> Path.GetFullPath | ||
let setParams defaults = | ||
{ defaults with | ||
Verbosity = Some Quiet | ||
Targets = [target] | ||
Properties = | ||
[ | ||
"OutputPathBaseDir", outputPath | ||
"Optimize", "True" | ||
"Configuration", "Release" | ||
"TargetFrameworkVersion", framework.MSBuild | ||
"DefineConstants", framework.DefineConstants | ||
] | ||
} | ||
|
||
build setParams solution | ||
|
||
let MsBuild = new MsBuildTooling() |
Oops, something went wrong.