-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.fsx
123 lines (91 loc) · 3.94 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#r "packages/FAKE.4.20.0/tools/FakeLib.dll"
open Fake
open Fake.FileSystemHelper
open Fake.NuGetHelper
open System
let inline (/) x y = IO.Path.Combine(x, y)
let mkdir x = (ensureDirectory x); x
let buildDir = "build" |> mkdir
let tempDir = buildDir / "temp" |> mkdir
let pkgDir = buildDir / "nuget" |> mkdir
let msbuildTarget = getBuildParamOrDefault "msbuildTarget" "Build"
let buildMode = getBuildParamOrDefault "buildMode" "Release"
// Add "publishNuGet=true" to command line.
let publishNuGet = Boolean.Parse(getBuildParamOrDefault "publishNuGet" "false")
let coreBuildDir = "Jefferson.Core/bin" / buildMode
let procBuildDir = "Jefferson.FileProcessing/bin" / buildMode
let jefBuildDir = "Jefferson.Build/bin" / buildMode
let coreTestBuildDir = "Jefferson.Tests/bin" / buildMode
let getSemanticVersion (msVersion: Version) = msVersion.Major.ToString() + "." + msVersion.Minor.ToString() + "." + msVersion.Build.ToString()
let nugetVersion (asm) = getBuildParamOrDefault "pkgVersion" (asm |> VersionHelper.GetAssemblyVersion |> getSemanticVersion)
let jeffersonCsproj = !! ("./Jefferson.Core/*.csproj")
let jeffersonProcCsProj = !! ("./Jefferson.FileProcessing/*.csproj")
let jeffersonBuildCsProj = !! ("./Jefferson.Build/*.csproj")
let jeffersonTestCsproj = !! ("./Jefferson.Tests/*.csproj")
let xunitConsole = "packages/xunit.runners.1.9.2/tools/xunit.console.clr4.exe"
trace "Building Jefferson, dumping environment:"
trace (" -- msbuild target: " + msbuildTarget)
trace (" -- msbuild configuration: " + buildMode)
trace (" -- build directory: " + buildDir)
trace (" -- nuget output directory: " + pkgDir)
trace (" -- publish nuget: " + publishNuGet.ToString())
Target "BuildCore" <| fun _ ->
MSBuild null msbuildTarget ["Configuration", buildMode] jeffersonCsproj
|> Log "Build Core Output"
Target "BuildJeffBuild" <| fun _ ->
MSBuild null msbuildTarget ["Configuration", buildMode] jeffersonBuildCsProj
|> Log "Build Jefferson.Build Output"
Target "BuildFileProc" <| fun _ ->
MSBuild null msbuildTarget ["Configuration", buildMode] jeffersonProcCsProj
|> Log "Build Core Output"
Target "BuildTests" <| fun _ ->
MSBuild null msbuildTarget ["Configuration", buildMode] jeffersonTestCsproj
|> Log "Build Tests Output"
Target "Test" <| fun _ ->
!!(coreTestBuildDir / "Jefferson.Tests.dll") |> xUnit (fun p -> {p with OutputDir = coreTestBuildDir })
Target "Nuget" <| fun _ ->
CleanDirs [tempDir]
let libnet45 = tempDir / "lib/net45"
ensureDirectory libnet45
let version = nugetVersion (coreBuildDir / "Jefferson.dll")
// Copy the main core DLL and its PDB.
CopyFile libnet45 (coreBuildDir / "Jefferson.dll")
CopyFile libnet45 (coreBuildDir / "Jefferson.pdb")
CopyFile libnet45 (coreBuildDir / "CodeContracts/Jefferson.Contracts.dll")
CopyFile libnet45 (coreBuildDir / "CodeContracts/Jefferson.Contracts.pdb")
CopyFile libnet45 (procBuildDir / "Jefferson.FileProcessing.dll")
CopyFile libnet45 (procBuildDir / "Jefferson.FileProcessing.pdb")
// Create package.
NuGet (fun pkg ->
{pkg with
ToolPath = ".nuget/nuget.exe"
Authors = ["Marcus van Houdt"]
Project = "Jefferson"
Description = "Jefferson Expression and Template Parser"
OutputPath = pkgDir
Summary = "Provides simple expression and template parsing and compiling"
WorkingDir = tempDir
Version = version
Dependencies = [] // NuGetHelper.getDependencies (libCoreDir / "packages.config")
// AccessKey = getBuildParamOrDefault "nugetkey" ""
Copyright = "© 2014 Marcus van Houdt"
Publish = publishNuGet
}) ".nuget/jefferson.nuspec"
Target "Default" <| (fun _ -> trace "Default Target")
"Default"
==> "BuildCore"
"Default"
==> "BuildFileProc"
"BuildJeffBuild"
==> "BuildCore"
"Default"
==> "BuildTests"
"BuildTests"
==> "Test"
"BuildCore"
==> "NuGet"
"BuildFileProc"
==> "NuGet"
"Test"
==> "NuGet"
RunTargetOrDefault "Default"