Skip to content

Commit

Permalink
updated build script so that dotnet only builds and tests netstandard…
Browse files Browse the repository at this point in the history
…1.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

Conflicts:
	build.bat
	build/scripts/Paths.fsx
	build/scripts/Targets.fsx
	paket.dependencies
	paket.lock
	src/Benchmarking/Benchmarking.csproj
	src/Benchmarking/Properties/AssemblyInfo.cs
	src/CodeGeneration/ApiGenerator/ApiGenerator.csproj
	src/CodeGeneration/ApiGenerator/Properties/AssemblyInfo.cs
	src/CodeGeneration/DocGenerator/DocGenerator.csproj
	src/CodeGeneration/DocGenerator/Properties/AssemblyInfo.cs
	src/Elasticsearch.Net/Properties/AssemblyInfo.cs
	src/Elasticsearch.Net/project.json
	src/Nest/Nest.csproj
	src/Nest/Properties/AssemblyInfo.cs
	src/Nest/project.json
	src/Profiling/Profiling.csproj
	src/Profiling/Properties/AssemblyInfo.cs
	src/Tests/Properties/AssemblyInfo.cs
	src/Tests/Tests.csproj
	src/Tests/project.json
  • Loading branch information
Mpdreamz committed Aug 19, 2016
1 parent 7ed4053 commit 454c7b7
Show file tree
Hide file tree
Showing 29 changed files with 4,486 additions and 1,827 deletions.
12 changes: 8 additions & 4 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ REM build build [skiptests]
REM build release [version] [skiptests]
REM build version [version] [skiptests]
REM build integrate [elasticsearch_versions] [skiptests]
REM build canary [apikey] [feed] [skiptests]

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

Expand All @@ -20,7 +21,6 @@ if errorlevel 1 (
SET TARGET="build"
SET VERSION=
SET ESVERSIONS=
SET DNXVERSION="default"
SET SKIPTESTS=0
SET APIKEY=
SET FEED="elasticsearch-net"
Expand Down Expand Up @@ -50,8 +50,12 @@ IF /I "%1%"=="integrate" (
)

IF /I "%1%"=="canary" (
IF NOT [%2]==[] (set APIKEY="%2")
IF NOT [%3]==[] (set FEED="%3")
IF NOT [%2]==[] IF NOT "%2"=="skiptests" set APIKEY="%2"
IF NOT [%3]==[] IF NOT "%3"=="skiptests" set FEED="%3"
IF /I "%4"=="skiptests" (set SKIPTESTS=1)
IF /I "%3"=="skiptests" (set SKIPTESTS=1)
IF /I "%2"=="skiptests" (set SKIPTESTS=1)
)

"packages\build\FAKE\tools\Fake.exe" "build\\scripts\\Targets.fsx" "target=%TARGET%" "version=%VERSION%" "esversions=%ESVERSIONS%" "skiptests=%SKIPTESTS%" "apiKey=%APIKEY%" "feed=%FEED%"
ECHO starting build using target=%TARGET% version=%VERSION% esversions=%ESVERSIONS% skiptests=%SKIPTESTS% apiKey=%APIKEY% feed=%FEED%
"packages\build\FAKE\tools\Fake.exe" "build\\scripts\\Targets.fsx" "target=%TARGET%" "version=%VERSION%" "esversions=%ESVERSIONS%" "skiptests=%SKIPTESTS%" "apiKey=%APIKEY%" "feed=%FEED%"
22 changes: 11 additions & 11 deletions build/Elasticsearch.Net.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@
</dependencies>
</metadata>
<files>
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.dll" target="lib\net45"/>
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.pdb" target="lib\net45"/>
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.pdb.srcsrv" target="lib\net45"/>
<file src="output\Elasticsearch.Net\net45\Elasticsearch.Net.XML" target="lib\net45"/>
<file src="output\v4.5\Elasticsearch.Net\Elasticsearch.Net.dll" target="lib\net45"/>
<file src="output\v4.5\Elasticsearch.Net\Elasticsearch.Net.pdb" target="lib\net45"/>
<file src="output\v4.5\Elasticsearch.Net\Elasticsearch.Net.pdb.srcsrv" target="lib\net45"/>
<file src="output\v4.5\Elasticsearch.Net\Elasticsearch.Net.XML" target="lib\net45"/>

<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.dll" target="lib\net46"/>
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.pdb" target="lib\net46"/>
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.pdb.srcsrv" target="lib\net46"/>
<file src="output\Elasticsearch.Net\net46\Elasticsearch.Net.XML" target="lib\net46"/>
<file src="output\v4.6\Elasticsearch.Net\Elasticsearch.Net.dll" target="lib\net46"/>
<file src="output\v4.6\Elasticsearch.Net\Elasticsearch.Net.pdb" target="lib\net46"/>
<file src="output\v4.6\Elasticsearch.Net\Elasticsearch.Net.pdb.srcsrv" target="lib\net46"/>
<file src="output\v4.6\Elasticsearch.Net\Elasticsearch.Net.XML" target="lib\net46"/>

<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.dll" target="lib\netstandard1.3"/>
<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.pdb" target="lib\netstandard1.3"/>
<file src="output\Elasticsearch.Net\netstandard1.3\Elasticsearch.Net.pdb.srcsrv" target="lib\netstandard1.3"/>
<file src="output\netstandard1.3\Elasticsearch.Net\Elasticsearch.Net.dll" target="lib\netstandard1.3"/>
<file src="output\netstandard1.3\Elasticsearch.Net\Elasticsearch.Net.pdb" target="lib\netstandard1.3"/>
<file src="output\netstandard1.3\Elasticsearch.Net\Elasticsearch.Net.pdb.srcsrv" target="lib\netstandard1.3"/>
</files>
</package>
22 changes: 11 additions & 11 deletions build/NEST.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@
</dependencies>
</metadata>
<files>
<file src="output\Nest\net45\Nest.dll" target="lib\net45"/>
<file src="output\Nest\net45\Nest.pdb" target="lib\net45"/>
<file src="output\Nest\net45\Nest.pdb.srcsrv" target="lib\net45"/>
<file src="output\Nest\net45\Nest.XML" target="lib\net45"/>
<file src="output\v4.5\Nest\Nest.dll" target="lib\net45"/>
<file src="output\v4.5\Nest\Nest.pdb" target="lib\net45"/>
<file src="output\v4.5\Nest\Nest.pdb.srcsrv" target="lib\net45"/>
<file src="output\v4.5\Nest\Nest.XML" target="lib\net45"/>

<file src="output\Nest\net46\Nest.dll" target="lib\net46"/>
<file src="output\Nest\net46\Nest.pdb" target="lib\net46"/>
<file src="output\Nest\net46\Nest.pdb.srcsrv" target="lib\net46"/>
<file src="output\Nest\net46\Nest.XML" target="lib\net46"/>
<file src="output\v4.6\Nest\Nest.dll" target="lib\net46"/>
<file src="output\v4.6\Nest\Nest.pdb" target="lib\net46"/>
<file src="output\v4.6\Nest\Nest.pdb.srcsrv" target="lib\net46"/>
<file src="output\v4.6\Nest\Nest.XML" target="lib\net46"/>

<file src="output\Nest\netstandard1.3\Nest.dll" target="lib\netstandard1.3"/>
<file src="output\Nest\netstandard1.3\Nest.pdb" target="lib\netstandard1.3"/>
<file src="output\Nest\netstandard1.3\Nest.pdb.srcsrv" target="lib\netstandard1.3"/>
<file src="output\netstandard1.3\Nest\Nest.dll" target="lib\netstandard1.3"/>
<file src="output\netstandard1.3\Nest\Nest.pdb" target="lib\netstandard1.3"/>
<file src="output\netstandard1.3\Nest\Nest.pdb.srcsrv" target="lib\netstandard1.3"/>
</files>
</package>
75 changes: 29 additions & 46 deletions build/scripts/Building.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,52 @@
#r @"FakeLib.dll"

#load @"Paths.fsx"
#load @"Projects.fsx"
open System

open Fake

open Paths
open Projects

let gitLink pdbDir projectName =
let exe = Paths.Tool("gitlink/lib/net45/GitLink.exe")
ExecProcess(fun p ->
p.FileName <- exe
p.Arguments <- sprintf @". -u %s -d %s -include %s" Paths.Repository pdbDir projectName
) (TimeSpan.FromMinutes 5.0) |> ignore
open Tooling;

type Build() =

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

static let compileCore projects =
projects
static let compileCore() =
DotNetProject.AllPublishable
|> Seq.iter(fun p ->
let path = (Paths.Quote (Paths.ProjectJson p))
Tooling.DotNet.Exec Tooling.DotNetRuntime.Core Build.BuildFailure p ["restore"; path; "--verbosity Warning"]
Tooling.DotNet.Exec Tooling.DotNetRuntime.Core Build.BuildFailure p ["build"; path; "--configuration Release"]
)
let path = Paths.ProjectJson p.Name
let o = Paths.ProjectOutputFolder p DotNetFramework.NetStandard1_3
DotNet.Exec ["restore"; path; "--verbosity Warning"]
DotNet.Exec ["build"; path; "--configuration Release"; "-o"; o; "-f"; DotNetFramework.NetStandard1_3.Identifier.MSBuild]
)

static let compileDesktop projects =
projects
|> Seq.iter(fun project ->
Tooling.MsBuild.Exec (Paths.Net45BinFolder project) "Rebuild" Tooling.DotNetFramework.Net45.Identifier [Paths.CsProj(project)]
Tooling.MsBuild.Exec (Paths.Net46BinFolder project) "Rebuild" Tooling.DotNetFramework.Net46.Identifier [Paths.CsProj(project)]
)
static let compileDesktop target =
MsBuild.Build(target, DotNetFramework.Net45.Identifier)
MsBuild.Build(target, DotNetFramework.Net46.Identifier)

static let copyToOutput projects =
projects
static let gitLink() =
DotNetProject.AllPublishable
|> Seq.iter(fun p ->
let projectName = (p |> directoryInfo).Name
let outputFolder = Paths.Output(projectName)
let binFolder = Paths.BinFolder(projectName)
if not isMono then
match projectName with
| "Nest"
| "Elasticsearch.Net" ->
gitLink (Paths.Net45BinFolder projectName) projectName
gitLink (Paths.Net46BinFolder projectName) projectName
gitLink (Paths.NetStandard13BinFolder projectName) projectName
| _ -> ()
CopyDir outputFolder binFolder allFiles
let projectName = (p.Name |> directoryInfo).Name
let link framework =
GitLink.Exec ["."; "-u"; Paths.Repository; "-d"; (Paths.ProjectOutputFolder p framework); "-include"; projectName]
|> ignore
link DotNetFramework.Net45
link DotNetFramework.Net46
link DotNetFramework.NetStandard1_3
)

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

static member QuickCompile() =
compileDesktop allProjects
compileCore allProjects
static member QuickCompile() = compile "Build"

static member Compile() =
compileDesktop allProjects
compileCore allProjects
copyToOutput allProjects
static member Compile() = compile "Rebuild"

static member Clean() =
CleanDir Paths.BuildOutput
allProjects |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p))
DotNetProject.All |> Seq.iter(fun p -> CleanDir(Paths.BinFolder p.Name))
Loading

0 comments on commit 454c7b7

Please sign in to comment.