-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.fsx
123 lines (101 loc) · 2.78 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
(*
FAKE Build Script
*)
open System
open System.IO
#r @"packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open Fake.ReleaseNotesHelper
(*
Build configuration
*)
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
let projectName = "CNTK.FSharp"
let authors = [ "Mathias Brandewinder" ]
let title = "F# extensions for CNTK"
let summary = "F# extensions to simplify CNTK usage"
let description = "F# extensions to simplify CNTK usage"
let tags = "f#, fsharp, cntk, machine-learning, deep-learning"
let releaseNotes =
LoadReleaseNotes "RELEASE_NOTES.md"
let version = releaseNotes.AssemblyVersion
let project = [ "./CNTK.FSharp/CNTK.FSharp.fsproj" ]
let assemblyInfo = [ "./CNTK.FSharp/AssemblyInfo.fs" ]
// Build output directory
let buildDir = "./build/"
// nuget package output directory
let nugetDir = "./nuget/"
(*
Build target / steps
*)
Target "AssemblyInfo" (fun _ ->
for file in assemblyInfo do
CreateFSharpAssemblyInfo file
[
Attribute.Title title
Attribute.Product projectName
Attribute.Description summary
Attribute.Version version
Attribute.FileVersion version
]
)
Target "RestorePackages" RestorePackages
// Clean contents from the build directory
Target "Clean" (fun _ ->
CleanDir buildDir
)
Target "LocalBuild" (fun _ ->
project
|> MSBuild buildDir "Rebuild" ["Platform", "x64"]
|> Log "Build Output: "
)
Target "ReleaseBuild" (fun _ ->
// Copy the dependency loading script into buildDir
Path.Combine(nugetDir,"Dependencies.fsx")
|> CopyFile buildDir
// Build the project to buildDir
project
|> MSBuildReleaseExt buildDir ["Platform", "x64"] "Rebuild"
|> Log "Build Output: "
)
Target "CreateNuget" (fun _ ->
"./nuget/" + projectName + ".nuspec"
|> NuGet (fun p ->
{ p with
Authors = authors
Project = projectName
Title = title
Summary = summary
Description = description
Version = version
Tags = tags
WorkingDir = buildDir
OutputPath = nugetDir
Dependencies =
[
"CNTK.GPU", "2.5.1"
]
References =
[
"CNTK.FSharp.dll"
]
Files =
[
"CNTK.FSharp.dll", Some "lib/", None
"Dependencies.fsx", Some "scripts/", None
]
})
)
(*
Build step dependencies
*)
"RestorePackages"
==> "Clean"
==> "LocalBuild"
"RestorePackages"
==> "AssemblyInfo"
==> "Clean"
==> "ReleaseBuild"
==> "CreateNuget"
RunTargetOrDefault "LocalBuild"