Skip to content

Commit ef34109

Browse files
committed
Limit NEST 2.x compatibility to Elasticsearch.Net 2.x versions
Pass next major version and current year as paramaters to nuget pack (cherry picked from commit 6ad251d)
1 parent 6849bde commit ef34109

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

build/Elasticsearch.Net.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<description>Elasticsearch.Net</description>
1414
<summary>Exposes all the elasticsearch API endpoints but leaves you in control of building the request and response bodies. Comes with built in cluster failover/connection pooling support.</summary>
1515
<releaseNotes>See https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
16-
<copyright>2014-2016 Elasticsearch BV</copyright>
16+
<copyright>2014-$year$ Elasticsearch BV</copyright>
1717
<tags>elasticsearch,elastic,search,lucene,nest</tags>
1818
<dependencies>
1919
<group targetFramework=".NETFramework4.5" />

build/NEST.nuspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
<description>Strongly typed interface to Elasticsearch. Fluent and classic object initializer mappings of requests and responses. Uses and exposes Elasticsearch.Net</description>
1414
<summary>Strongly typed interface to Elasticsearch. Fluent and classic object initializer mappings of requests and responses. Uses and exposes Elasticsearch.Net</summary>
1515
<releaseNotes>See https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
16-
<copyright>2014-2016 Elasticsearch BV</copyright>
16+
<copyright>2014-$year$ Elasticsearch BV</copyright>
1717
<tags>elasticsearch,elastic,search,lucene,nest</tags>
1818
<dependencies>
1919
<group targetFramework=".NETFramework4.5">
20-
<dependency id="Elasticsearch.Net" version="[$version$, 3.0.0)" />
20+
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
2121
<dependency id="Newtonsoft.Json" version="[9,10)" />
2222
</group>
2323
<group targetFramework=".NETFramework4.6">
24-
<dependency id="Elasticsearch.Net" version="[$version$, 3.0.0)" />
24+
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
2525
<dependency id="Newtonsoft.Json" version="[9,10)" />
2626
</group>
2727
<group targetFramework=".NETStandard1.3">
2828
<dependency id="NETStandard.Library" version="[1.6.0, )" />
2929
<dependency id="System.Collections.Specialized" version="[4.0.1, )" />
3030
<dependency id="System.Reflection.TypeExtensions" version="[4.1.0, )" />
3131
<dependency id="System.Linq.Queryable" version="[4.0.1, )" />
32-
<dependency id="Elasticsearch.Net" version="[$version$, 3.0.0)" />
32+
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
3333
<dependency id="Newtonsoft.Json" version="[9,10)" />
3434
</group>
3535
</dependencies>

build/scripts/Releasing.fsx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#I @"../../packages/build/FAKE/tools"
2+
#I @"../../packages/SemanticVersioning/lib/net45"
23
#r @"FakeLib.dll"
4+
#r @"SemVer.dll"
35

46
#load @"Projects.fsx"
57
#load @"Paths.fsx"
68
#load @"Tooling.fsx"
79
#load @"Versioning.fsx"
810

9-
open Fake
11+
open System
12+
open System.Text
13+
open Microsoft.FSharp.Quotations
14+
open Microsoft.FSharp.Quotations.Patterns
15+
open Fake
16+
open SemVer
1017

1118
open Paths
1219
open Projects
@@ -23,7 +30,33 @@ module Release =
2330
let nuspec = (sprintf @"build\%s.nuspec" name)
2431
let nugetOutFile = Paths.Output(sprintf "%s.%s.nupkg" name Versioning.FileVersion)
2532

26-
Tooling.Nuget.Exec ["pack"; nuspec; "-version"; Versioning.FileVersion; "-outputdirectory"; Paths.BuildOutput; ] |> ignore
33+
let nextMajorVersion =
34+
let version = new Version(Versioning.FileVersion)
35+
let nextMajor = version.Major + 1
36+
sprintf "%i" nextMajor
37+
38+
let year = sprintf "%i" DateTime.UtcNow.Year
39+
40+
let properties =
41+
let addKeyValue (e:Expr<string>) (builder:StringBuilder) =
42+
// the binding for this tuple looks like key/value should
43+
// be round the other way (but it's correct as is)...
44+
let (value,key) =
45+
match e with
46+
| PropertyGet (eo, pi, li) -> (pi.Name, (pi.GetValue(e) |> string))
47+
| ValueWithName (obj,ty,nm) -> ((obj |> string), nm)
48+
| _ -> failwith (sprintf "%A is not a let-bound value. %A" e (e.GetType()))
49+
builder.AppendFormat("{0}=\"{1}\";", key, value);
50+
new StringBuilder()
51+
|> addKeyValue <@nextMajorVersion@>
52+
|> addKeyValue <@year@>
53+
|> toText
54+
55+
Tooling.Nuget.Exec [ "pack"; nuspec;
56+
"-version"; Versioning.FileVersion;
57+
"-outputdirectory"; Paths.BuildOutput;
58+
"-properties"; properties;
59+
] |> ignore
2760
traceFAKE "%s" Paths.BuildOutput
2861
MoveFile Paths.NugetOutput nugetOutFile
2962
)

0 commit comments

Comments
 (0)