Skip to content

Commit d496a61

Browse files
committed
Lazy download of jetbrains profiler and nuget exe
Jetbrains only needed when running the benchmark targets and nuget only because we manually pack (other "Nuget" build deps are downloaded uses paket)
1 parent 5a60159 commit d496a61

File tree

5 files changed

+50
-46
lines changed

5 files changed

+50
-46
lines changed

build.bat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ if errorlevel 1 (
1717
exit /b %errorlevel%
1818
)
1919

20-
21-
2220
SET TARGET="build"
2321
SET VERSION=
2422
SET ESVERSIONS=
@@ -27,7 +25,10 @@ SET SKIPTESTS=0
2725
SET APIKEY=
2826

2927

30-
IF /I "%1"=="skiptests" (set SKIPTESTS="1")
28+
IF /I "%1"=="skiptests" (
29+
set SKIPTESTS="1"
30+
SHIFT
31+
)
3132

3233
IF NOT [%1]==[] (set TARGET="%1")
3334

build/scripts/Building.fsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ open Fake
77
open Paths
88
open Projects
99

10-
let gitLink pdbDir =
10+
let gitLink pdbDir projectName =
1111
let exe = Paths.Tool("gitlink/lib/net45/GitLink.exe")
1212
ExecProcess(fun p ->
1313
p.FileName <- exe
14-
p.Arguments <- sprintf @". -u %s -d %s" Paths.Repository pdbDir
14+
p.Arguments <- sprintf @". -u %s -d %s -include %s" Paths.Repository pdbDir projectName
1515
) (TimeSpan.FromMinutes 5.0) |> ignore
1616

1717
type Build() =
@@ -28,8 +28,8 @@ type Build() =
2828
projects
2929
|> Seq.iter(fun project ->
3030
let path = (Paths.Quote project)
31-
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["restore"; path]
32-
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["build"; path; "--configuration Release --quiet";]
31+
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["restore"; path; "--quiet"]
32+
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["build"; path; "--configuration Release --quiet"]
3333
)
3434

3535
static member BuildFailure errors =
@@ -44,8 +44,8 @@ type Build() =
4444

4545
//eventhough this says desktop it still builds all the tfm's it just hints wich installed dnx version to use
4646
let path = (Paths.Quote project)
47-
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["restore"; path]
48-
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["build"; path; "--configuration Release";]
47+
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["restore"; path; "--quiet"]
48+
Tooling.Dnu.Exec Tooling.DotNetRuntime.Desktop Build.BuildFailure project ["build"; path; "--configuration Release --quiet"]
4949
)
5050

5151
projects
@@ -57,8 +57,8 @@ type Build() =
5757
match projectName with
5858
| "Nest"
5959
| "Elasticsearch.Net" ->
60-
gitLink(Paths.Net45BinFolder projectName)
61-
gitLink(Paths.DotNet51BinFolder projectName)
60+
gitLink (Paths.Net45BinFolder projectName) projectName
61+
gitLink (Paths.DotNet51BinFolder projectName) projectName
6262
| _ -> ()
6363
CopyDir outputFolder binFolder allFiles
6464
)

build/scripts/Paths.fsx

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -119,42 +119,45 @@ module Tooling =
119119
member this.Path = Paths.Tool(path)
120120
member this.Exec arguments = exec this.Path arguments
121121

122-
let private dotTraceCommandLineTools = "JetBrains.dotTrace.CommandLineTools.10.0.20151114.191633"
123-
let private buildToolsDirectory = Paths.Build("tools")
124-
let private dotTraceDirectory = sprintf "%s/%s" buildToolsDirectory dotTraceCommandLineTools
125-
126-
if (Directory.Exists(dotTraceDirectory) = false)
127-
then
128-
trace (sprintf "No JetBrains DotTrace tooling found in %s. Downloading now" buildToolsDirectory)
129-
let url = sprintf "https://d1opms6zj7jotq.cloudfront.net/resharper/%s.zip" dotTraceCommandLineTools
130-
let zipFile = sprintf "%s/%s.zip" buildToolsDirectory dotTraceCommandLineTools
131-
use webClient = new WebClient()
132-
webClient.DownloadFile(url, zipFile)
133-
System.IO.Compression.ZipFile.ExtractToDirectory(zipFile, dotTraceDirectory)
134-
File.Delete zipFile
135-
trace "JetBrains DotTrace tooling downloaded"
136-
137-
let NugetFile = "build/tools/nuget/nuget.exe"
138-
if (File.Exists(NugetFile) = false)
139-
then
140-
trace "Nuget not found %s. Downloading now"
141-
let url = "http://nuget.org/nuget.exe"
142-
Directory.CreateDirectory("build/tools/nuget") |> ignore
143-
use webClient = new WebClient()
144-
webClient.DownloadFile(url, NugetFile)
145-
trace "nuget downloaded"
146-
147-
type ProfilerTooling(path) =
122+
let NugetFile = fun _ ->
123+
let targetLocation = "build/tools/nuget/nuget.exe"
124+
if (not (File.Exists targetLocation))
125+
then
126+
trace "Nuget not found %s. Downloading now"
127+
let url = "http://nuget.org/nuget.exe"
128+
Directory.CreateDirectory("build/tools/nuget") |> ignore
129+
use webClient = new WebClient()
130+
webClient.DownloadFile(url, targetLocation)
131+
trace "nuget downloaded"
132+
targetLocation
133+
134+
type ProfilerTooling(path) =
135+
let dotTraceCommandLineTools = "JetBrains.dotTrace.CommandLineTools.10.0.20151114.191633"
136+
let buildToolsDirectory = Paths.Build("tools")
137+
let dotTraceDirectory = sprintf "%s/%s" buildToolsDirectory dotTraceCommandLineTools
138+
member this.Bootstrap = fun _ ->
139+
if (not (Directory.Exists dotTraceDirectory)) then
140+
trace (sprintf "No JetBrains DotTrace tooling found in %s. Downloading now" buildToolsDirectory)
141+
let url = sprintf "https://d1opms6zj7jotq.cloudfront.net/resharper/%s.zip" dotTraceCommandLineTools
142+
let zipFile = sprintf "%s/%s.zip" buildToolsDirectory dotTraceCommandLineTools
143+
use webClient = new WebClient()
144+
webClient.DownloadFile(url, zipFile)
145+
System.IO.Compression.ZipFile.ExtractToDirectory(zipFile, dotTraceDirectory)
146+
File.Delete zipFile
147+
trace "JetBrains DotTrace tooling downloaded"
148+
148149
member this.Path = sprintf "%s/%s" dotTraceDirectory path
149-
member this.Exec arguments = exec this.Path arguments
150+
member this.Exec arguments =
151+
this.Bootstrap()
152+
exec this.Path arguments
150153

151154
let GitLink = new NugetTooling("GitLink", "gitlink/lib/net45/gitlink.exe")
152155
let Node = new NugetTooling("node.js", "Node.js/node.exe")
153156
let private npmCli = "Npm/node_modules/npm/cli.js"
154157
let Npm = new NugetTooling("npm", npmCli)
155158
let XUnit = new NugetTooling("xunit.runner.console", "xunit.runner.console/tools/xunit.console.exe")
156159
let DotTraceProfiler = new ProfilerTooling("ConsoleProfiler.exe")
157-
let DotTraceReporter = new ProfilerTooling("Reporter.exe")
160+
let DotTraceReporter = new ProfilerTooling("Reporter.exe")
158161
let DotTraceSnapshotStats = new ProfilerTooling("SnapshotStat.exe")
159162

160163
//only used to boostrap fake itself

build/scripts/Releasing.fsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ type Release() =
100100
ZipHelper.Unzip unzippedDir package
101101

102102
// rename NEST package id
103-
if (projectName.Equals("Nest", StringComparison.InvariantCultureIgnoreCase) = true)
103+
if (projectName.Equals("Nest", StringComparison.InvariantCultureIgnoreCase))
104104
then
105105
let nuspec = sprintf "%s/Nest.nuspec" unzippedDir
106106
FileHelper.RegexReplaceInFileWithEncoding
@@ -138,7 +138,7 @@ type Release() =
138138
static member PublishCanaryBuild accessKey =
139139
!! "build/output/_packages/*-ci*.nupkg"
140140
|> Seq.iter(fun f ->
141-
let success = Tooling.execProcess Tooling.NugetFile ["push"; f; accessKey; "-source"; "https://www.myget.org/F/elasticsearch-net/api/v2/package"]
141+
let success = Tooling.execProcess (Tooling.NugetFile()) ["push"; f; accessKey; "-source"; "https://www.myget.org/F/elasticsearch-net/api/v2/package"]
142142
match success with
143143
| 0 -> traceFAKE "publish to myget succeeded" |> ignore
144144
| _ -> failwith "publish to myget failed" |> ignore

paket.dependencies

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ nuget Rx-Main
2727
nuget Rx-PlatformServices
2828

2929
group build
30-
31-
source https://www.nuget.org/api/v2
3230

33-
nuget FAKE
31+
source https://www.nuget.org/api/v2
32+
33+
nuget FAKE
3434
nuget FSharp.Data
35-
nuget GitLink
35+
nuget GitLink prerelease
3636
nuget node.js
37-
nuget npm
37+
nuget npm
3838
nuget xunit.runner.console

0 commit comments

Comments
 (0)