Repository navigation
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
42 lines (38 loc) · 2.21 KB
/
Copy pathDirectory.Build.props
File metadata and controls
42 lines (38 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<Project>
<PropertyGroup>
<Title>csharp-ls</Title>
<Product>csharp-ls</Product>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<ChangelogFile>$(MSBuildThisFileDirectory)CHANGELOG.md</ChangelogFile>
<!-- Pin to LangVersion 9 to disable the F# 10 type subsumption cache, which causes
sustained ~150% CPU in FSAC/Ionide on this codebase's multi-project solution.
See https://github.com/dotnet/fsharp/issues/19368. -->
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNet.ReproducibleBuilds" PrivateAssets="All"/>
<PackageReference Include="Ionide.KeepAChangelog.Tasks" PrivateAssets="All" />
</ItemGroup>
<!-- Extract the release codename from the CHANGELOG entry matching the current $(Version).
Header format: ## [X.Y.Z] - YYYY-MM-DD / Codename
If the top entry is [Unreleased] (Version falls back to 1.0.0) or has no codename,
ReleaseCodename is empty and InformationalVersion is just the bare version number. -->
<Target Name="SetCodenameFromChangelog"
AfterTargets="SetVersionFromChangelog">
<PropertyGroup>
<_ChangelogText>$([System.IO.File]::ReadAllText('$(ChangelogFile)'))</_ChangelogText>
<!-- Anchor the search to the exact current version so an [Unreleased] top-entry
(which makes Ionide.KeepAChangelog.Tasks fall back to Version=1.0.0) never
accidentally picks up a codename from a different release. -->
<_CodenameMatch>$([System.Text.RegularExpressions.Regex]::Match(
'$(_ChangelogText)',
'##\s+\[$(Version)\][^\n]*/\s*(\w+)'))</_CodenameMatch>
<ReleaseCodename Condition="'$(_CodenameMatch)' != ''">$([System.Text.RegularExpressions.Regex]::Match(
'$(_ChangelogText)',
'##\s+\[$(Version)\][^\n]*/\s*(\w+)').get_Groups().get_Item(1).get_Value())</ReleaseCodename>
<ReleaseCodename Condition="'$(ReleaseCodename)' == ''"></ReleaseCodename>
<InformationalVersion Condition="'$(ReleaseCodename)' != ''">$(Version) ($(ReleaseCodename))</InformationalVersion>
<InformationalVersion Condition="'$(ReleaseCodename)' == ''">$(Version)</InformationalVersion>
</PropertyGroup>
</Target>
</Project>