Skip to content

Commit b46a7e6

Browse files
committed
updated build script so that dotnet only builds and tests netstandard1.3, some optimizations are in place so we do not build too much (e.g building netstandard to nuget output if we run a regular build), we now call msbuild on the whole solution and rely on outputpath.props to optionally build all the output away from src into build without everything ending up in the same folder
1 parent 9d82a8b commit b46a7e6

36 files changed

+4020
-1830
lines changed

build.bat

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ REM build build [skiptests]
55
REM build release [version] [skiptests]
66
REM build version [version] [skiptests]
77
REM build integrate [elasticsearch_versions] [skiptests]
8+
REM build canary [apikey] [feed] [skiptests]
89

910
REM - elasticsearch_versions can be multiple separated with a semi-colon ';'
1011

@@ -20,7 +21,6 @@ if errorlevel 1 (
2021
SET TARGET="build"
2122
SET VERSION=
2223
SET ESVERSIONS=
23-
SET DNXVERSION="default"
2424
SET SKIPTESTS=0
2525
SET APIKEY=
2626
SET FEED="elasticsearch-net"
@@ -50,8 +50,12 @@ IF /I "%1%"=="integrate" (
5050
)
5151

5252
IF /I "%1%"=="canary" (
53-
IF NOT [%2]==[] (set APIKEY="%2")
54-
IF NOT [%3]==[] (set FEED="%3")
53+
IF NOT [%2]==[] IF NOT "%2"=="skiptests" set APIKEY="%2"
54+
IF NOT [%3]==[] IF NOT "%3"=="skiptests" set FEED="%3"
55+
IF /I "%4"=="skiptests" (set SKIPTESTS=1)
56+
IF /I "%3"=="skiptests" (set SKIPTESTS=1)
57+
IF /I "%2"=="skiptests" (set SKIPTESTS=1)
5558
)
5659

60+
ECHO starting build using target=%TARGET% version=%VERSION% esversions=%ESVERSIONS% skiptests=%SKIPTESTS% apiKey=%APIKEY% feed=%FEED%
5761
"packages\build\FAKE\tools\Fake.exe" "build\\scripts\\Targets.fsx" "target=%TARGET%" "version=%VERSION%" "esversions=%ESVERSIONS%" "skiptests=%SKIPTESTS%" "apiKey=%APIKEY%" "feed=%FEED%"

build/Elasticsearch.Net.nuspec

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@
3030
</dependencies>
3131
</metadata>
3232
<files>
33-
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.dll" target="lib\net45"/>
34-
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.pdb" target="lib\net45"/>
35-
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.pdb.srcsrv" target="lib\net45"/>
36-
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.XML" target="lib\net45"/>
33+
<file src="output\v4.5\Elasticsearch.Net\Elasticsearch.Net.dll" target="lib\net45"/>
34+
<file src="output\v4.5\Elasticsearch.Net\Elasticsearch.Net.pdb" target="lib\net45"/>
35+
<file src="output\v4.5\Elasticsearch.Net\Elasticsearch.Net.pdb.srcsrv" target="lib\net45"/>
36+
<file src="output\v4.5\Elasticsearch.Net\Elasticsearch.Net.XML" target="lib\net45"/>
3737

38-
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.dll" target="lib\net46"/>
39-
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.pdb" target="lib\net46"/>
40-
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.pdb.srcsrv" target="lib\net46"/>
41-
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.XML" target="lib\net46"/>
38+
<file src="output\v4.6\Elasticsearch.Net\Elasticsearch.Net.dll" target="lib\net46"/>
39+
<file src="output\v4.6\Elasticsearch.Net\Elasticsearch.Net.pdb" target="lib\net46"/>
40+
<file src="output\v4.6\Elasticsearch.Net\Elasticsearch.Net.pdb.srcsrv" target="lib\net46"/>
41+
<file src="output\v4.6\Elasticsearch.Net\Elasticsearch.Net.XML" target="lib\net46"/>
4242

43-
<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.dll" target="lib\netstandard1.3"/>
44-
<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.pdb" target="lib\netstandard1.3"/>
45-
<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.pdb.srcsrv" target="lib\netstandard1.3"/>
43+
<file src="output\netstandard1.3\Elasticsearch.Net\Elasticsearch.Net.dll" target="lib\netstandard1.3"/>
44+
<file src="output\netstandard1.3\Elasticsearch.Net\Elasticsearch.Net.pdb" target="lib\netstandard1.3"/>
45+
<file src="output\netstandard1.3\Elasticsearch.Net\Elasticsearch.Net.pdb.srcsrv" target="lib\netstandard1.3"/>
4646
</files>
4747
</package>

build/NEST.nuspec

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@
3535
</dependencies>
3636
</metadata>
3737
<files>
38-
<file src="output\Nest\net45\Nest.dll" target="lib\net45"/>
39-
<file src="output\Nest\net45\Nest.pdb" target="lib\net45"/>
40-
<file src="output\Nest\net45\Nest.pdb.srcsrv" target="lib\net45"/>
41-
<file src="output\Nest\net45\Nest.XML" target="lib\net45"/>
38+
<file src="output\v4.5\Nest\Nest.dll" target="lib\net45"/>
39+
<file src="output\v4.5\Nest\Nest.pdb" target="lib\net45"/>
40+
<file src="output\v4.5\Nest\Nest.pdb.srcsrv" target="lib\net45"/>
41+
<file src="output\v4.5\Nest\Nest.XML" target="lib\net45"/>
4242

43-
<file src="output\Nest\net46\Nest.dll" target="lib\net46"/>
44-
<file src="output\Nest\net46\Nest.pdb" target="lib\net46"/>
45-
<file src="output\Nest\net46\Nest.pdb.srcsrv" target="lib\net46"/>
46-
<file src="output\Nest\net46\Nest.XML" target="lib\net46"/>
43+
<file src="output\v4.6\Nest\Nest.dll" target="lib\net46"/>
44+
<file src="output\v4.6\Nest\Nest.pdb" target="lib\net46"/>
45+
<file src="output\v4.6\Nest\Nest.pdb.srcsrv" target="lib\net46"/>
46+
<file src="output\v4.6\Nest\Nest.XML" target="lib\net46"/>
4747

48-
<file src="output\Nest\netstandard1.3\Nest.dll" target="lib\netstandard1.3"/>
49-
<file src="output\Nest\netstandard1.3\Nest.pdb" target="lib\netstandard1.3"/>
50-
<file src="output\Nest\netstandard1.3\Nest.pdb.srcsrv" target="lib\netstandard1.3"/>
48+
<file src="output\netstandard1.3\Nest\Nest.dll" target="lib\netstandard1.3"/>
49+
<file src="output\netstandard1.3\Nest\Nest.pdb" target="lib\netstandard1.3"/>
50+
<file src="output\netstandard1.3\Nest\Nest.pdb.srcsrv" target="lib\netstandard1.3"/>
5151
</files>
5252
</package>

build/scripts/Building.fsx

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,52 @@
22
#r @"FakeLib.dll"
33

44
#load @"Paths.fsx"
5-
#load @"Projects.fsx"
6-
open System
75

86
open Fake
97

108
open Paths
119
open Projects
12-
13-
let gitLink pdbDir projectName =
14-
let exe = Paths.Tool("gitlink/lib/net45/GitLink.exe")
15-
ExecProcess(fun p ->
16-
p.FileName <- exe
17-
p.Arguments <- sprintf @". -u %s -d %s -include %s" Paths.Repository pdbDir projectName
18-
) (TimeSpan.FromMinutes 5.0) |> ignore
10+
open Tooling;
1911

2012
type Build() =
2113

22-
static let allProjects = DotNetProject.All |> Seq.map(fun p -> p.Name)
14+
static let runningRelease = hasBuildParam "version" || hasBuildParam "apikey" || getBuildParam "target" = "canary" || getBuildParam "target" = "release"
2315

24-
static let compileCore projects =
25-
projects
16+
static let compileCore() =
17+
DotNetProject.AllPublishable
2618
|> Seq.iter(fun p ->
27-
let path = (Paths.Quote (Paths.ProjectJson p))
28-
Tooling.DotNet.Exec Tooling.DotNetRuntime.Core Build.BuildFailure p ["restore"; path; "--verbosity Warning"]
29-
Tooling.DotNet.Exec Tooling.DotNetRuntime.Core Build.BuildFailure p ["build"; path; "--configuration Release"]
30-
)
19+
let path = Paths.ProjectJson p.Name
20+
let o = Paths.ProjectOutputFolder p DotNetFramework.NetStandard1_3
21+
DotNet.Exec ["restore"; path; "--verbosity Warning"]
22+
DotNet.Exec ["build"; path; "--configuration Release"; "-o"; o; "-f"; DotNetFramework.NetStandard1_3.Identifier.MSBuild]
23+
)
3124

32-
static let compileDesktop projects =
33-
projects
34-
|> Seq.iter(fun project ->
35-
Tooling.MsBuild.Exec (Paths.Net45BinFolder project) "Rebuild" Tooling.DotNetFramework.Net45.Identifier [Paths.CsProj(project)]
36-
Tooling.MsBuild.Exec (Paths.Net46BinFolder project) "Rebuild" Tooling.DotNetFramework.Net46.Identifier [Paths.CsProj(project)]
37-
)
25+
static let compileDesktop target =
26+
MsBuild.Build(target, DotNetFramework.Net45.Identifier)
27+
MsBuild.Build(target, DotNetFramework.Net46.Identifier)
3828

39-
static let copyToOutput projects =
40-
projects
29+
static let gitLink() =
30+
DotNetProject.AllPublishable
4131
|> Seq.iter(fun p ->
42-
let projectName = (p |> directoryInfo).Name
43-
let outputFolder = Paths.Output(projectName)
44-
let binFolder = Paths.BinFolder(projectName)
45-
if not isMono then
46-
match projectName with
47-
| "Nest"
48-
| "Elasticsearch.Net" ->
49-
gitLink (Paths.Net45BinFolder projectName) projectName
50-
gitLink (Paths.Net46BinFolder projectName) projectName
51-
gitLink (Paths.NetStandard13BinFolder projectName) projectName
52-
| _ -> ()
53-
CopyDir outputFolder binFolder allFiles
32+
let projectName = (p.Name |> directoryInfo).Name
33+
let link framework =
34+
GitLink.Exec ["."; "-u"; Paths.Repository; "-d"; (Paths.ProjectOutputFolder p framework); "-include"; projectName]
35+
|> ignore
36+
link DotNetFramework.Net45
37+
link DotNetFramework.Net46
38+
link DotNetFramework.NetStandard1_3
5439
)
5540

56-
static member BuildFailure errors =
57-
raise (BuildException("The project build failed.", errors |> List.ofSeq))
41+
static let compile target =
42+
compileDesktop target
43+
//we only need this output when doing a release otherwise depend on test to validate the build
44+
if runningRelease then compileCore()
45+
if not isMono && runningRelease then gitLink()
5846

59-
static member QuickCompile() =
60-
compileDesktop allProjects
61-
compileCore allProjects
47+
static member QuickCompile() = compile "Build"
6248

63-
static member Compile() =
64-
compileDesktop allProjects
65-
compileCore allProjects
66-
copyToOutput allProjects
49+
static member Compile() = compile "Rebuild"
6750

6851
static member Clean() =
6952
CleanDir Paths.BuildOutput
70-
allProjects |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p))
53+
DotNetProject.All |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p.Name))

0 commit comments

Comments
 (0)