forked from RWS/SDL-Studio-Community-Toolkit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.fsx
170 lines (139 loc) · 5.77 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#r @"tools/FAKE.Core/tools/FakeLib.dll"
open Fake
open System
let authors = ["Sdl Community"]
//project details
let projectName = "Sdl Studio Community Toolkit"
let projectDescription="The SDL Studio Community Toolkit is a collection of helper functions. It simplifies and demonstrates common developer tasks building SDL Studio plugins."
let projectSummary = projectDescription
//directories
let buildDir = "./build"
let packagingRoot = "./packaging"
let packagingDir = packagingRoot @@ "studiotoolkit"
let releaseNotes =
ReadFile "ReleaseNotes.md"
|> ReleaseNotesHelper.parseReleaseNotes
let buildMode = getBuildParamOrDefault "buildMode" "Release"
MSBuildDefaults <-{
MSBuildDefaults with
ToolsVersion = Some "14.0"
Verbosity = Some MSBuildVerbosity.Minimal
}
Target "Clean"(fun _ ->
CleanDirs[buildDir;packagingRoot;packagingDir]
)
open Fake.AssemblyInfoFile
Target "AssemblyInfo" (fun _ ->
CreateCSharpAssemblyInfo "./SolutionInfo.cs"
[ Attribute.Product projectName
Attribute.Version releaseNotes.AssemblyVersion
Attribute.FileVersion releaseNotes.AssemblyVersion
Attribute.ComVisible false ]
)
let setParams defaults = {
defaults with
ToolsVersion = Some("14.0")
Targets = ["Build"]
Properties =
[
"Configuration", buildMode
"OutputPath" , "./../build"
]
}
Target "BuildApp" (fun _ ->
build setParams "./SDL Studio Community Toolkit.sln"
|> DoNothing
)
//Publishing is not working from build script because of an issue in FAKE with
//latest nuget versions - https://github.com/fsharp/FAKE/issues/1241
Target "CreateCorePackage" (fun _ ->
let portableDir = packagingDir @@ "lib/net45/"
CleanDirs [portableDir]
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.Core.dll")
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.Core.XML")
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.Core.pdb")
CopyFiles packagingDir ["LICENSE"; "README.md"; "ReleaseNotes.md"]
NuGet (fun p ->
{p with
Authors = authors
Project = "Sdl.Community.Toolkit.Core"
Description = projectDescription
OutputPath = packagingRoot
Summary = projectSummary
WorkingDir = packagingDir
Version = releaseNotes.AssemblyVersion
ReleaseNotes = toLines releaseNotes.Notes
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" }) "Sdl.Community.Toolkit.Core.nuspec"
)
Target "CreateFileTypePackage" (fun _ ->
let portableDir = packagingDir @@ "lib/net45/"
CleanDirs [portableDir]
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.FileType.dll")
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.FileType.XML")
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.FileType.pdb")
CopyFiles packagingDir ["LICENSE"; "README.md"; "ReleaseNotes.md"]
NuGet (fun p ->
{p with
Authors = authors
Project = "Sdl.Community.Toolkit.FileType"
Description = projectDescription
OutputPath = packagingRoot
Summary = projectSummary
WorkingDir = packagingDir
Version = releaseNotes.AssemblyVersion
ReleaseNotes = toLines releaseNotes.Notes
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" }) "Sdl.Community.Toolkit.FileType.nuspec"
)
Target "CreateProjectAutomationPackage" (fun _ ->
let portableDir = packagingDir @@ "lib/net45/"
CleanDirs [portableDir]
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.ProjectAutomation.dll")
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.ProjectAutomation.XML")
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.ProjectAutomation.pdb")
CopyFiles packagingDir ["LICENSE"; "README.md"; "ReleaseNotes.md"]
NuGet (fun p ->
{p with
Authors = authors
Project = "Sdl.Community.Toolkit.ProjectAutomation"
Description = projectDescription
OutputPath = packagingRoot
Summary = projectSummary
WorkingDir = packagingDir
Version = releaseNotes.AssemblyVersion
ReleaseNotes = toLines releaseNotes.Notes
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" }) "Sdl.Community.Toolkit.ProjectAutomation.nuspec"
)
Target "CreateIntegrationPackage" (fun _ ->
let portableDir = packagingDir @@ "lib/net45/"
CleanDirs [portableDir]
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.Integration.dll")
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.Integration.XML")
CopyFile portableDir (buildDir @@ "Sdl.Community.Toolkit.Integration.pdb")
CopyFiles packagingDir ["LICENSE"; "README.md"; "ReleaseNotes.md"]
NuGet (fun p ->
{p with
Authors = authors
Project = "Sdl.Community.Toolkit.Integration"
Description = projectDescription
OutputPath = packagingRoot
Summary = projectSummary
WorkingDir = packagingDir
Version = releaseNotes.AssemblyVersion
ReleaseNotes = toLines releaseNotes.Notes
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey" }) "Sdl.Community.Toolkit.Integration.nuspec"
)
Target "CreatePackages" DoNothing
Target "BuildAndCreatePackages" DoNothing
"CreateCorePackage"
==> "CreateFileTypePackage"
==> "CreateProjectAutomationPackage"
==> "CreateIntegrationPackage"
==>"CreatePackages"
"Clean"
==> "AssemblyInfo"
==> "BuildApp"
RunTargetOrDefault "BuildApp"