Skip to content

Commit a2358b1

Browse files
committed
Build now patches assemblies and nuspec files
1 parent 11a3db7 commit a2358b1

File tree

8 files changed

+112
-17
lines changed

8 files changed

+112
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ build/tools/*
4747
!build/*.fsx
4848
!build/*.fsx
4949
!build/*.ps1
50+
!build/*.nuspec
5051

5152
/dep/Newtonsoft.Json.4.0.2
5253
!new_docs/build
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
3+
<metadata>
4+
<id>Elasticsearch.Net.Connection.Thrift</id>
5+
<version>@version@</version>
6+
<title>Elasticsearch.Net.Connection.Thrift - Thrift support for Elasticsearch.Net</title>
7+
<authors>Martijn Laarman and contributors</authors>
8+
<owners>Martijn Laarman</owners>
9+
<iconUrl>http://nest.azurewebsites.net/images/elasticsearch-net-nuget-icon.png</iconUrl>
10+
<licenseUrl>http://mpdreamz.mit-license.org/</licenseUrl>
11+
<projectUrl>https://github.com/Mpdreamz/NEST</projectUrl>
12+
<summary>An IConnection implementation that utilizes Apache Thrift to talk with elasticsearch</summary>
13+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
14+
<description>An IConnection implementation that utilizes Apache Thrift to talk with elasticsearch</description>
15+
<dependencies>
16+
<dependency id="Elasticsearch.Net" version="@version@"/>
17+
<dependency id="NetReflector" />
18+
</dependencies>
19+
<tags>elasticsearch elastic search lucene thrift nest</tags>
20+
</metadata>
21+
<files>
22+
<file src="output\Elasticsearch.Net.Connection.Thrift\Elasticsearch.Net.Connection.Thrift.dll" target="lib"/>
23+
<file src="output\Elasticsearch.Net.Connection.Thrift\Elasticsearch.Net.Connection.Thrift.pdb" target="lib"/>
24+
<file src="output\Elasticsearch.Net.Connection.Thrift\Elasticsearch.Net.Connection.Thrift.XML" target="lib"/>
25+
</files>
26+
</package>

build/Elasticsearch.Net.nuspec

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
3+
<metadata>
4+
<id>Elasticsearch.Net</id>
5+
<version>@version@</version>
6+
<title>Elasticsearch.Net - official low level elasticsearch client</title>
7+
<authors>Martijn Laarman and contributors</authors>
8+
<owners>Martijn Laarman</owners>
9+
<iconUrl>http://nest.azurewebsites.net/images/elasticsearch-net-nuget-icon.png</iconUrl>
10+
<licenseUrl>http://mpdreamz.mit-license.org/</licenseUrl>
11+
<projectUrl>https://github.com/elasticsearch/elasticsearch-net</projectUrl>
12+
<summary>Exposes all the api endpoints but leaves you in control of building the request and response bodies. Comes with built in cluster failover/connection pooling support.
13+
</summary>
14+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
15+
<description>Exposes all the api endpoints but leaves you in control of building the request and response bodies. Comes with built in cluster failover/connection pooling support.
16+
</description>
17+
<tags>elasticsearch elastic search lucene nest</tags>
18+
</metadata>
19+
<files>
20+
<file src="output\Elasticsearch.Net\Elasticsearch.Net.dll" target="lib"/>
21+
<file src="output\Elasticsearch.Net\Elasticsearch.Net.pdb" target="lib"/>
22+
<file src="output\Elasticsearch.Net\Elasticsearch.Net.XML" target="lib"/>
23+
</files>
24+
</package>

build/NEST.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>NEST</id>
5-
<version>0.0.0.1</version>
5+
<version>@version@</version>
66
<title>NEST - Elasticsearch Client</title>
77
<authors>Martijn Laarman and contributors</authors>
88
<owners>Martijn Laarman</owners>
@@ -13,7 +13,7 @@
1313
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1414
<description>Elasticsearch client, strongly typed interface to Elasticsearch. Fluent request builder, mapped responses and powerful query dsl. Uses and exposes Elasticsearch.Net</description>
1515
<dependencies>
16-
<dependency id="Elasticsearch.Net" />
16+
<dependency id="Elasticsearch.Net" version="@version@"/>
1717
<dependency id="Newtonsoft.Json" version="6.0.1" />
1818
</dependencies>
1919
<tags>elasticsearch elastic search lucene nest</tags>

build/build.fsx

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
open Fake
55
open System
66
open InheritDoc
7+
open SemVerHelper
8+
open AssemblyInfoFile
79

810

911
// Properties
@@ -17,7 +19,17 @@ Target "Clean" (fun _ ->
1719
CleanDir buildDir
1820
)
1921

22+
23+
2024
Target "BuildApp" (fun _ ->
25+
let binDirs = !! "src/**/bin/**"
26+
|> Seq.map DirectoryName
27+
|> Seq.distinct
28+
|> Seq.filter (fun f -> (f.EndsWith("Debug") || f.EndsWith("Release")) && not (f.Contains "CodeGeneration"))
29+
30+
CleanDirs binDirs
31+
32+
//Override the prebuild event because it just calls a fake task BuildApp depends on anyways
2133
let msbuildProperties = [
2234
("Configuration","Release");
2335
("PreBuildEvent","ECHO");
@@ -89,20 +101,24 @@ let validateSignedAssembly = fun name ->
89101
| (_, t) -> traceFAKE "%s was not signed with the official token: %s but %s" name oficialToken t
90102

91103
let nugetPack = fun name ->
92-
104+
let fileVersion = (getBuildParamOrDefault "version" "0.1.0")
93105
CreateDir nugetOutDir
94-
106+
let package = (sprintf @"build\%s.nuspec" name)
107+
let packageContents = ReadFileAsString package
108+
let re = @"(?<start>\<version\>|""(Elasticsearch.Net|Nest)"" version="")[^""><]+(?<end>\<\/version\>|"")"
109+
let replacedContents = regex_replace re (sprintf "${start}%s${end}" fileVersion) packageContents
110+
WriteStringToFile false package replacedContents
111+
95112
let dir = sprintf "%s/%s/" buildDir name
96-
let version = "1.0.0-c4"
97113
NuGetPack (fun p ->
98114
{p with
99-
Version = version
115+
Version = fileVersion
100116
WorkingDir = dir
101117
OutputPath = dir
102118
})
103-
(sprintf @"build\%s.nuspec" name)
119+
package
104120

105-
MoveFile nugetOutDir (buildDir + (sprintf "%s/%s.%s.nupkg" name name version))
121+
MoveFile nugetOutDir (buildDir + (sprintf "%s/%s.%s.nupkg" name name fileVersion))
106122

107123
let buildDocs = fun action ->
108124
let node = @"build\tools\Node.js\node.exe"
@@ -115,11 +131,40 @@ let buildDocs = fun action ->
115131
(TimeSpan.FromMinutes (if action = "preview" then 300.0 else 5.0))
116132

117133
Target "Version" (fun _ ->
118-
let v = (getBuildParamOrDefault "version" "0.1.0")
119-
let version = SemVerHelper.parse v
120-
let assemblyVersion = sprintf "%i.%i.0.0" version.Major version.Minor
121-
122-
trace (sprintf "%s %s" v assemblyVersion)
134+
let fileVersion = (getBuildParamOrDefault "version" "0.1.0")
135+
let version = SemVerHelper.parse fileVersion
136+
137+
let suffix = fun (prerelease: PreRelease) -> sprintf "-%s%i" prerelease.Name prerelease.Number.Value
138+
let assemblySuffix = if version.PreRelease.IsSome then suffix version.PreRelease.Value else "";
139+
let assemblyVersion = sprintf "%i.0.0%s" version.Major assemblySuffix
140+
141+
match (assemblySuffix, version.Minor, version.Patch) with
142+
| (s, m, p) when s <> "" && (m <> 0 || p <> 0) -> failwithf "Cannot create prereleases for minor or major builds!"
143+
| ("", _, _) -> traceFAKE "Building fileversion %s for asssembly version %s" fileVersion assemblyVersion
144+
| _ -> traceFAKE "Building prerelease %s for major assembly version %s " fileVersion assemblyVersion
145+
146+
let assemblyDescription = fun (f: string) ->
147+
let name = f
148+
match f.ToLowerInvariant() with
149+
| f when f = "elasticsearch.net" -> "Elasticsearch.Net - oficial low level elasticsearch client"
150+
| f when f = "nest" -> "NEST - oficial high level elasticsearch client"
151+
| f when f = "elasticsearch.net.connection.thrift" -> "Elasticsearc.Net.Connection.Thrift - Add thrift support to elasticsearch."
152+
| _ -> sprintf "%s" name
153+
154+
!! "src/**/AssemblyInfo.cs"
155+
|> Seq.iter(fun f ->
156+
let name = (directoryInfo f).Parent.Parent.Name
157+
CreateCSharpAssemblyInfo f [
158+
Attribute.Title name
159+
Attribute.Copyright (sprintf "Elasticsearch %i" DateTime.UtcNow.Year)
160+
Attribute.Description (assemblyDescription name)
161+
Attribute.Company "Elasticsearch"
162+
Attribute.Configuration "Release"
163+
Attribute.Version assemblyVersion
164+
Attribute.FileVersion fileVersion
165+
Attribute.InformationalVersion fileVersion
166+
]
167+
)
123168
)
124169

125170

@@ -134,7 +179,6 @@ Target "Release" (fun _ ->
134179
validateSignedAssembly("Elasticsearch.Net")
135180
validateSignedAssembly("Elasticsearch.Net.Connection.Thrift")
136181
validateSignedAssembly("Nest")
137-
138182
)
139183

140184
Target "Docs" (fun _ -> buildDocs "build" |> ignore)
@@ -146,6 +190,7 @@ Target "DocsPreview" (fun _ ->
146190
// Dependencies
147191
"Clean"
148192
==> "CreateKeysIfAbsent"
193+
=?> ("Version", hasBuildParam "version")
149194
==> "BuildApp"
150195
==> "Test"
151196
==> "Build"
@@ -154,6 +199,7 @@ Target "DocsPreview" (fun _ ->
154199
==> "Release"
155200

156201
"DocsPreview"
202+
"BuildApp"
157203
"CreateKeysIfAbsent"
158204
"Version"
159205
// start build

src/Connections/Elasticsearch.Net.Connection.Thrift/Elasticsearch.Net.Connection.Thrift.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@
129129
<Compile Include="Transport\TTransportFactory.cs" />
130130
</ItemGroup>
131131
<ItemGroup>
132-
<None Include="keypair.snk" />
133132
<None Include="packages.config" />
134133
</ItemGroup>
135134
<ItemGroup>

src/Elasticsearch.Net/Elasticsearch.Net.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@
106106
<Compile Include="Serialization\Stringifier.cs" />
107107
</ItemGroup>
108108
<ItemGroup>
109-
<None Include="keypair.snk" />
110109
<None Include="packages.config" />
111110
</ItemGroup>
112111
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

src/Nest/ElasticClient-GatewaySnapshot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public IShardsOperationResponse GatewaySnapshot(Func<SnapshotDescriptor, Snapsho
1616
(p, d) => this.RawDispatch.IndicesSnapshotIndexDispatch<ShardsOperationResponse>(p)
1717
);
1818
}
19-
19+
2020
/// <inheritdoc />
2121
public Task<IShardsOperationResponse> GatewaySnapshotAsync(
2222
Func<SnapshotDescriptor, SnapshotDescriptor> snapshotSelector = null)

0 commit comments

Comments
 (0)