-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.fsx
More file actions
142 lines (120 loc) · 4.6 KB
/
build.fsx
File metadata and controls
142 lines (120 loc) · 4.6 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
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
#r @"packages\FAKE\tools\FakeLib.dll"
open System
open System.IO
open Fake
open Fake.ReleaseNotesHelper
open Fake.Testing
let nugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
let authors = ["Christopher Boumenot"]
let project = "Grobid.Models"
let summary = "GROBID Model for Wapiti"
let description = summary
let projectName = "Grobid-IKVM.x64"
let projectDescription = "IKVM port for GROBID on Java"
let projectSummary = """
Java version of GROBID ported to .NET using IKVM. GROBID uses a native
library, Wapiti, for training and labeling.
"""
let tags = ""
let testResultsDir = "./"
let release = parseReleaseNotes (IO.File.ReadAllLines "RELEASE_NOTES.md")
MSBuildDefaults <- {
MSBuildDefaults with
ToolsVersion = Some "14.0"
Verbosity = Some MSBuildVerbosity.Minimal }
let buildMode = getBuildParamOrDefault "buildMode" "Debug"
MSBuildDefaults <- {
MSBuildDefaults with
ToolsVersion = Some("14.0")
Verbosity = Some(Minimal)
Properties =
[
"AllowUnsafeBlocks", "True"
"Configuration", buildMode
"DebugSymbols", "True"
"Platform", "x64"
]
}
let properties =
match buildMode with
| "Release" -> [ "Optimize", "True" ]
| _ -> []
Target "Clean" (fun _ ->
!! "./grobid.sln"
|> MSBuild "" "Clean" properties
|> Log "Target::Clean")
Target "BuildSolution" (fun _ ->
!! "./grobid.sln"
|> MSBuild "" "Build" properties
|> Log "Target::BuildSolution")
Target "UnitTests" (fun _ ->
!! (sprintf "./test/Grobid.Test/bin/%s/**/Grobid*.Test.dll" buildMode)
++ (sprintf "./test/Grobid.PdfToXml.Test/bin/%s/**/Grobid*.Test.dll" buildMode)
|> xUnit2 (fun x -> { x with XmlOutputPath = Some(testResultsDir @@ "xunit2.xml");
HtmlOutputPath = Some(testResultsDir @@ "xunit2.html");
ToolPath = "packages/xunit.runner.console/tools/xunit.console.exe" }))
Target "Zip" (fun _ ->
!! "content/lexicon/**/*" ++ "content/models/**/*"
|> Zip "content" "grobid.zip")
// ==================================================
// NuGet
Target "DownloadNuGet" (fun _ ->
let nugetExe= Path.GetFileName nugetUrl
if not (File.Exists nugetExe) then
CreateDir "./.nuget"
let c = new System.Net.WebClient()
c.DownloadFile(nugetUrl, "./.nuget/" + nugetExe))
let referenceDependencies dependencies =
let packagesDir = __SOURCE_DIRECTORY__ @@ "packages"
[ for dependency in dependencies -> dependency, GetPackageVersion packagesDir dependency ]
// == grobid.X.Y.Z.nupkg
Target "NuGet" (fun _ ->
CreateDir "./publish"
NuGet (fun x ->
{ x with
Authors = authors
Project = projectName
Summary = projectSummary
Description = projectDescription
Version = release.NugetVersion
ReleaseNotes = String.Join(Environment.NewLine, release.Notes)
Tags = tags
OutputPath = "publish"
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey"
Dependencies = referenceDependencies [ "IKVM"; "IKVM.NativeBinaries" ] @ [ "Grobid.Models", "3.3.0" ]
Files = [ (@"..\nuget\build\grobid.x64.props", Some @"build\grobid.x64.props", None)
(@"..\lib\native\x64\libwapiti.dll", Some @"NativeBinaries\x64\lib", None)
(@"..\lib\java\Grobid.Java.dll", Some @"lib\net45", None) ] })
("nuget/" + projectName + ".nuspec"))
// == grobid.models.X.Y.Z.nupkg
Target "NuGet.Models" (fun _ ->
CreateDir "./publish"
NuGet (fun x ->
{ x with
Authors = authors
Project = project
Summary = summary
Description = description
Version = "3.3.0"
ReleaseNotes = String.Join(Environment.NewLine, release.Notes)
Tags = tags
OutputPath = "publish"
AccessKey = getBuildParamOrDefault "nugetkey" ""
Publish = hasBuildParam "nugetkey"
Files = [ (@"..\grobid.zip", Some "content", None) ] })
("nuget/" + project + ".nuspec"))
Target "Default" DoNothing
Target "Release" DoNothing
"Clean"
==> "BuildSolution"
==> "UnitTests"
==> "Default"
"Clean"
==> "BuildSolution"
==> "Zip"
==> "DownloadNuGet"
==> "NuGet"
==> "NuGet.Models"
==> "Release"
RunTargetOrDefault "Default"