-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.fsx
More file actions
103 lines (80 loc) · 2.58 KB
/
build.fsx
File metadata and controls
103 lines (80 loc) · 2.58 KB
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
// include Fake libs
#I @"tools\FAKE\tools\"
#r @"tools\FAKE\tools\FakeLib.dll"
open Fake
open Fake.AssemblyInfoFile
open System.IO
//Project config
let projectName = "MsDyn.Contrib.CloneFieldDefinitions"
let projectDescription = "A XrmToolBox Plugin that helps copying field definitions from an entity to another"
let authors = ["Florian Kroenert"]
// Directories
let buildDir = @".\build\"
let libbuildDir = buildDir + @"lib\"
let testDir = @".\test\"
let deployDir = @".\Publish\"
let libdeployDir = deployDir + @"lib\"
let nugetDir = @".\nuget\"
let packagesDir = @".\packages\"
// version info
let majorversion = 1
let minorversion = 2
let patch = 2
let sha = Git.Information.getCurrentHash()
// Targets
Target "Clean" (fun _ ->
CleanDirs [buildDir; testDir; deployDir; nugetDir]
)
Target "RestorePackages" (fun _ ->
let RestorePackages2() =
!! "./src/**/packages.config"
|> Seq.iter ( RestorePackage (fun p -> {p with Sources = ["http://go.microsoft.com/fwlink/?LinkID=206669"] } ))
()
RestorePackages2()
)
let getVersion() = sprintf "%i.%i.%i" majorversion minorversion patch
Target "AssemblyInfo" (fun _ ->
BulkReplaceAssemblyInfoVersions "src" (fun f ->
{f with
AssemblyVersion = getVersion()
AssemblyInformationalVersion = getVersion()
AssemblyFileVersion = getVersion()})
)
Target "BuildLib" (fun _ ->
!! @"src\lib\**\*.csproj"
|> MSBuildRelease libbuildDir "Build"
|> Log "Build-Output: "
)
Target "Publish" (fun _ ->
CreateDir libdeployDir
!! (libbuildDir @@ @"MsDyn*.dll")
|> CopyTo libdeployDir
)
Target "CreateNuget" (fun _ ->
"MsDyn.Contrib.CloneFieldDefinitions.nuspec"
|> NuGet (fun p ->
{p with
Authors = authors
Project = projectName
Version = getVersion()
NoPackageAnalysis = true
Description = projectDescription
ToolPath = @".\tools\Nuget\Nuget.exe"
OutputPath = nugetDir })
)
Target "PublishNuget" (fun _ ->
let nugetPublishDir = (deployDir + "nuget")
CreateDir nugetPublishDir
!! (nugetDir + "*.nupkg")
|> Copy nugetPublishDir
)
// Dependencies
"Clean"
==> "RestorePackages"
=?> ("AssemblyInfo", not isLocalBuild )
==> "BuildLib"
==> "Publish"
==> "CreateNuget"
==> "PublishNuget"
// start build
RunTargetOrDefault "Publish"