-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.fsx
59 lines (44 loc) · 2.5 KB
/
build.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// include Fake libs
#r "packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open Fake.Git
// Directories
let buildDir = "./build"
let srcBuildDir = buildDir + "/src"
let testDir = buildDir + "./test"
let testDataDir = buildDir + "./testData"
let outputDir = buildDir + "/output"
let appProjects = !!"src/**/*.csproj" ++ "src/**/*.fsproj"
let testProjects = !!"test/**/*.csproj" ++ "test/**/*.fsproj"
// version info
let version = "0.0.1"
let stringVersion = Information.getCurrentSHA1 "."
let asmLibDir = "..\\OCA-AsmLib"
(* ------------------- Download AsmLib ----------------*)
Target "EnsureAsmLib" (fun _ ->
if not (directoryExists asmLibDir) then failwith "AsmLib missing")
(* ------------------- Normal targets ----------------*)
Target "Clean" (fun _ -> CleanDirs [ srcBuildDir; testDir; outputDir; testDataDir ])
Target "AssemblyInfo" (fun _ ->
CreateCSharpAssemblyInfo "./src/Properties/AssemblyInfo.cs" [ Attribute.Title "OCA-VirtualMachine"
Attribute.Description("VirtualMachine for OCA - " + stringVersion)
Attribute.Product "OCA-VirtualMachine"
Attribute.Version version
Attribute.FileVersion version
Attribute.InternalsVisibleTo "OCA.VirtualMachine.Test" ])
Target "BuildApp" (fun _ -> MSBuildRelease srcBuildDir "Build" appProjects |> Log "AppBuild-Output: ")
Target "BuildTest" (fun _ -> MSBuildDebug testDir "Build" testProjects |> Log "TestBuild-Output: ")
Target "Test" (fun _ ->
!!(testDir + "/*.dll") |> NUnit(fun p ->
{ p with DisableShadowCopy = true
TimeOut = System.TimeSpan.FromMinutes 5.0
Framework = "4.5"
Domain = NUnitDomainModel.DefaultDomainModel
OutputFile = buildDir + "/TestResults.xml" }))
Target "Deploy" (fun _ -> !!(srcBuildDir + "/**/*.*") -- "*.zip" |> Zip buildDir (outputDir + "/VirtualMachine." + stringVersion + ".zip"))
Target "MainBuild" DoNothing
// Build order
"Clean" ==> "EnsureAsmLib" ==> "AssemblyInfo" ==> "BuildApp" ==> "BuildTest" ==> "Test" ==> "Deploy" ==> "MainBuild"
// start build
RunTargetOrDefault "MainBuild"