Skip to content

Commit 9b6de09

Browse files
committed
Sourcelink and include PDBs in nuget packages (#4224)
* Sourcelink and include PDBs in nuget packages This commit reinstates sourcelinking of PDB files and including them in nuget packages. Closes #4095 * Include Repository metadata in packages This commit adds repository metadata in packages, including branch and commit, for SourceLink. (cherry picked from commit 415630a)
1 parent 3bc8754 commit 9b6de09

File tree

7 files changed

+25
-8
lines changed

7 files changed

+25
-8
lines changed

build/Elasticsearch.Net.nuspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<releaseNotes>See https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
1616
<copyright>2014-$year$ Elasticsearch BV</copyright>
1717
<tags>elasticsearch,elastic,search,lucene,nest</tags>
18+
<repository type="git" url="https://github.com/elastic/elasticsearch-net.git" branch="$branch$" commit="$commit$" />
1819
<dependencies>
1920
<group targetFramework="netstandard2.0" />
2021
<group targetFramework="net461" />
@@ -24,9 +25,11 @@
2425
<file src="..\license.txt" target="" />
2526

2627
<file src="output\Elasticsearch.Net\netstandard2.0\Elasticsearch.Net.dll" target="lib\netstandard2.0"/>
28+
<file src="output\Elasticsearch.Net\netstandard2.0\Elasticsearch.Net.pdb" target="lib\netstandard2.0"/>
2729
<file src="output\Elasticsearch.Net\netstandard2.0\Elasticsearch.Net.xml" target="lib\netstandard2.0"/>
2830

2931
<file src="output\Elasticsearch.Net\net461\Elasticsearch.Net.dll" target="lib\net461"/>
32+
<file src="output\Elasticsearch.Net\net461\Elasticsearch.Net.pdb" target="lib\net461"/>
3033
<file src="output\Elasticsearch.Net\net461\Elasticsearch.Net.xml" target="lib\net461"/>
3134
</files>
3235
</package>

build/NEST.JsonNetSerializer.nuspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<releaseNotes>See https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
1616
<copyright>2017-$year$ Elasticsearch BV</copyright>
1717
<tags>elasticsearch,elastic,search,lucene,nest,serializer,json</tags>
18+
<repository type="git" url="https://github.com/elastic/elasticsearch-net.git" branch="$branch$" commit="$commit$" />
1819
<dependencies>
1920
<group targetFramework="net461">
2021
<dependency id="NEST" version="[$version$, $nextMajorVersion$)" />
@@ -30,9 +31,11 @@
3031
<file src="..\license.txt" target="" />
3132

3233
<file src="output\Nest.JsonNetSerializer\net461\Nest.JsonNetSerializer.dll" target="lib\net461"/>
34+
<file src="output\Nest.JsonNetSerializer\net461\Nest.JsonNetSerializer.pdb" target="lib\net461"/>
3335
<file src="output\Nest.JsonNetSerializer\net461\Nest.JsonNetSerializer.xml" target="lib\net461"/>
3436

3537
<file src="output\Nest.JsonNetSerializer\netstandard2.0\Nest.JsonNetSerializer.dll" target="lib\netstandard2.0"/>
38+
<file src="output\Nest.JsonNetSerializer\netstandard2.0\Nest.JsonNetSerializer.pdb" target="lib\netstandard2.0"/>
3639
<file src="output\Nest.JsonNetSerializer\netstandard2.0\Nest.JsonNetSerializer.xml" target="lib\netstandard2.0"/>
3740
</files>
3841
</package>

build/NEST.nuspec

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<summary>Strongly typed interface to Elasticsearch. Fluent and classic object initializer mappings of requests and responses. Uses and exposes Elasticsearch.Net</summary>
1919
<releaseNotes>https://github.com/elastic/elasticsearch-net/releases/tag/$version$</releaseNotes>
2020
<tags>elasticsearch,elastic,search,lucene,nest</tags>
21-
21+
<repository type="git" url="https://github.com/elastic/elasticsearch-net.git" branch="$branch$" commit="$commit$" />
2222
<dependencies>
2323
<group targetFramework="net461">
2424
<dependency id="Elasticsearch.Net" version="[$version$, $nextMajorVersion$)" />
@@ -32,9 +32,11 @@
3232
<file src="..\license.txt" target="" />
3333

3434
<file src="output\Nest\net461\Nest.dll" target="lib\net461"/>
35-
<file src="output\Nest\net461\Nest.XML" target="lib\net461"/>
35+
<file src="output\Nest\net461\Nest.pdb" target="lib\net461"/>
36+
<file src="output\Nest\net461\Nest.xml" target="lib\net461"/>
3637

3738
<file src="output\Nest\netstandard2.0\Nest.dll" target="lib\netstandard2.0"/>
39+
<file src="output\Nest\netstandard2.0\Nest.pdb" target="lib\netstandard2.0"/>
3840
<file src="output\Nest\netstandard2.0\Nest.xml" target="lib\netstandard2.0"/>
3941
</files>
4042
</package>

build/scripts/Commandline.fs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,8 @@ Execution hints can be provided anywhere on the command line
202202
| "diff" :: tail -> { parsed with RemainingArguments = tail }
203203
| ["canary"; ] -> parsed
204204

205-
| ["release"; version] -> { parsed with CommandArguments = SetVersion { Version = version } }
206-
207-
| ["test"; testFilter] -> { parsed with CommandArguments = Test { TestFilter = Some testFilter } }
205+
| ["release"; version] -> { parsed with CommandArguments = SetVersion { Version = version }; DoSourceLink = true }
206+
| ["test"; testFilter] -> { parsed with CommandArguments = Test { TestFilter = Some testFilter } }
208207

209208
| ["benchmark"; IsUrl elasticsearch; username; password] ->
210209
{

build/scripts/Releasing.fs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,23 @@ module Release =
3939

4040
let private currentMajorVersion version = sprintf "%i" <| version.Full.Major
4141
let private nextMajorVersion version = sprintf "%i" <| version.Full.Major + 1u
42+
43+
let private gitInfo args =
44+
let result = Tooling.Git.ReadInWithTimeout "." args (TimeSpan.FromSeconds(10.))
45+
(Seq.head result.Output).Line.Trim()
4246

4347
let private props version =
4448
let currentMajorVersion = currentMajorVersion version
45-
let nextMajorVersion = nextMajorVersion version
49+
let nextMajorVersion = nextMajorVersion version
50+
let branch = gitInfo ["rev-parse"; "--abbrev-ref"; "HEAD"]
51+
let commit = gitInfo ["rev-parse"; "HEAD"]
52+
4653
new StringBuilder()
4754
|> addKeyValue "currentMajorVersion" currentMajorVersion
4855
|> addKeyValue "nextMajorVersion" nextMajorVersion
4956
|> addKeyValue "year" year
57+
|> addKeyValue "branch" branch
58+
|> addKeyValue "commit" commit
5059

5160
let pack file n properties version =
5261
Tooling.Nuget.Exec [ "pack"; file;

build/scripts/Tooling.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ module Tooling =
6161
let nugetFile = Path.GetFullPath "build/scripts/bin/Release/netcoreapp3.0/NuGet.exe"
6262
let Nuget = BuildTooling(None, nugetFile)
6363
let ILRepack = BuildTooling(None, "build/scripts/bin/Release/netcoreapp3.0/ILRepack.exe")
64-
let DotNet = BuildTooling(Some <| TimeSpan.FromMinutes(5.), "dotnet")
64+
let DotNet = BuildTooling(None, "dotnet")
65+
let Git = BuildTooling(None, "git")
6566

6667

src/PublishArtifacts.build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<SourceLink Condition="'$(DoSourceLink)'!=''">$(BaseIntermediateOutputPath)\sl-$(MsBuildProjectName)-$(TargetFramework).json</SourceLink>
2020
<!-- we need to referenced assemblies during the command line build so that ILRepack can pick them up -->
2121
<CopyLocalLockFileAssemblies Condition="'$(TargetFramework)'=='netstandard2.0'">true</CopyLocalLockFileAssemblies>
22-
22+
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
2323
</PropertyGroup>
2424

2525
<Target Name="GenerateSourceLink" BeforeTargets="CoreCompile" Condition="'$(DoSourceLink)'!=''">

0 commit comments

Comments
 (0)