forked from Kevin-Bronsdijk/kraken-net
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.fsx
154 lines (123 loc) · 5.08 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
// --------------------------------------------------------------------------------------
// FAKE build script
// --------------------------------------------------------------------------------------
#r @"tools\FAKE\tools\FakeLib.dll"
#r "System.Management.Automation"
open Fake
open Fake.AssemblyInfoFile
open Fake.Testing
open System.Management.Automation
// --------------------------------------------------------------------------------------
// Information about the project to be used at NuGet and in AssemblyInfo files
// --------------------------------------------------------------------------------------
let nugetProject = "kraken-net"
let project = "Kraken"
let product = "kraken.NET 4.5"
let authors = ["Kraken.io, Kevin Bronsdijk"]
let summary = "The official Kraken.io .Net client"
let version = "0.2.0.0"
let description = "The official kraken-net client interacts with the Kraken.io REST API allowing you to utilize Krakens features using a .NET interface."
let notes = "Added None as a strategy. For more information and documentation, please visit the project site on GitHub."
let nugetVersion = "2.0.0"
let tags = "kraken.io C# API image optimization official"
let gitHome = "https://github.com/kraken-io"
let gitName = "kraken-net"
// --------------------------------------------------------------------------------------
// Build script
// --------------------------------------------------------------------------------------
let buildDir = "./output/"
let buildDirV2 = "./outputV2/"
let packagingOutputPath = "./nuGet/"
let packagingWorkingDir = "./inputNuget/"
let packagingWorkingDirV2 = "./inputNuget/v2/"
let nugetDependencies = getDependencies "./src/kraken-net/packages.config"
// --------------------------------------------------------------------------------------
Target "Clean" (fun _ ->
CleanDir buildDir
CleanDir buildDirV2
)
// --------------------------------------------------------------------------------------
Target "AssemblyInfo" (fun _ ->
let attributes =
[
Attribute.Title project
Attribute.Product product
Attribute.Description summary
Attribute.Version version
Attribute.FileVersion version
Attribute.Copyright "2017"
]
CreateCSharpAssemblyInfo "src/kraken-net/Properties/AssemblyInfo.cs" attributes
)
// --------------------------------------------------------------------------------------
Target "RestorePackages" (fun _ ->
"src/Tests/packages.config"
|> RestorePackage (fun p ->
{ p with
Sources = "https://www.nuget.org/api/v2" :: p.Sources
OutputPath = "src/packages"
Retries = 4 })
)
// --------------------------------------------------------------------------------------
Target "Build" (fun _ ->
!! "src/kraken-net.sln"
|> MSBuildRelease buildDir "Build"
|> Log "AppBuild-Output: "
)
// --------------------------------------------------------------------------------------
Target "BuildV2" (fun _ ->
!! "src/kraken-net-v2.sln"
|> MSBuildRelease buildDirV2 "Build"
|> Log "AppBuild-Output: "
)
// --------------------------------------------------------------------------------------
let nunitRunnerPath = "src/packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe"
Target "TestNunit" (fun _ ->
!! (buildDir + @"\Tests.dll")
|> NUnit3 (fun p ->
{p with
ToolPath = nunitRunnerPath
}))
// --------------------------------------------------------------------------------------
Target "CreatePackage" (fun _ ->
CreateDir packagingWorkingDir
CleanDir packagingWorkingDir
CreateDir packagingWorkingDirV2
CleanDir packagingWorkingDirV2
CopyFile packagingWorkingDir "./output/kraken.dll"
CopyFile packagingWorkingDirV2 "./outputV2/kraken.dll"
CreateDir packagingOutputPath
NuGet (fun p ->
{p with
Authors = authors
Files = [ (@"kraken.dll", Some @"lib/net452", None);
(@"kraken.dll", Some @"lib/net45", None);
(@"v2/kraken.dll", Some @"lib/netstandard1.6", None) ]
Project = nugetProject
Description = description
OutputPath = packagingOutputPath
Summary = summary
WorkingDir = packagingWorkingDir
Version = nugetVersion
ReleaseNotes = notes
Publish = false })
"kraken.nuspec"
)
// --------------------------------------------------------------------------------------
Target "RunSomePowerShell" <| fun _ ->
PowerShell.Create()
.AddScript("(Get-Content 'src/kraken-net-v2/kraken-net-v2.csproj') | Foreach-Object { $_ -replace '1.0.0.1', '" + version + "'} | Set-Content 'src/kraken-net-v2/kraken-net-v2.csproj'")
.Invoke()
|> Seq.iter (printfn "%O")
// --------------------------------------------------------------------------------------
Target "All" DoNothing
"Clean"
==> "RunSomePowerShell"
==> "AssemblyInfo"
==> "RestorePackages"
==> "Build"
==> "BuildV2"
==> "TestNunit"
==> "CreatePackage"
==> "All"
RunTargetOrDefault "All"