forked from dotnet/templating
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Version.props
104 lines (94 loc) · 4.94 KB
/
Version.props
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<Project ToolsVersion="15.0">
<PropertyGroup Condition=" '$(PackageVersion)' == '' ">
<PackageReleaseVersion>1.0.0</PackageReleaseVersion>
<PackageBuildQuality>$(BUILD_QUALITY)</PackageBuildQuality>
<PackageBuildQuality Condition=" '$(PackageBuildQuality)' == '' ">beta1</PackageBuildQuality>
<PackageVersion>$(PackageReleaseVersion)-$(PackageBuildQuality)</PackageVersion>
<BUILD_NUMBER Condition="'$(BUILD_NUMBER)' == ''">0</BUILD_NUMBER>
<PackageVersion Condition="'$(NO_TIMESTAMP)' != 'true'">$(PackageVersion)-$([System.DateTime]::Now.ToString("yyyyMMdd"))-$(BUILD_NUMBER)</PackageVersion>
</PropertyGroup>
<PropertyGroup>
<Authors>Microsoft</Authors>
<ProjectUrl>https://github.com/dotnet/templating</ProjectUrl>
<LicenseUrl>https://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm</LicenseUrl>
<ImageUrl>http://go.microsoft.com/fwlink/?LinkID=288859</ImageUrl>
<Tags>template</Tags>
<Company>Microsoft</Company>
<Copyright>Copyright © Microsoft Corporation</Copyright>
<ArtifactsFolder>$(MSBuildThisFileDirectory)artifacts\</ArtifactsFolder>
<TemplatesFolder>$(ArtifactsFolder)templates\</TemplatesFolder>
<TemplatesNoTimestampFolder>$(ArtifactsFolder)templates-notimestamp\</TemplatesNoTimestampFolder>
<BuildToolsFolder>$(MSBuildThisFileDirectory).tools\</BuildToolsFolder>
<NuGet>"$(BuildToolsFolder)nuget.exe"</NuGet>
<GenerateAssemblyInfo Condition="'$(BuildingInsideVisualStudio)' != ''">False</GenerateAssemblyInfo>
<GenerateAssemblyFileVersionAttribute>False</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyVersionAttribute>False</GenerateAssemblyVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>False</GenerateAssemblyInformationalVersionAttribute>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<GitInfoFile>$(MSBuildThisFileDirectory)artifacts\GitInfo.cs</GitInfoFile>
<GitInfoProps>$(MSBuildThisFileDirectory)artifacts\GitInfo.props</GitInfoProps>
</PropertyGroup>
<Target Name="CollectGitInfo">
<PropertyGroup>
<GitInfoCommitCount Condition="'$(COMMIT_HASH)' != ''">$(COMMIT_COUNT)</GitInfoCommitCount>
<GitInfoCommitHash Condition="'$(COMMIT_HASH)' != ''">$(COMMIT_HASH)</GitInfoCommitHash>
<GitExitCode>0</GitExitCode>
</PropertyGroup>
<Exec Command="git rev-list --count HEAD" ConsoleToMSBuild="true" Condition="'$(COMMIT_HASH)' == ''" IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitInfoCommitCount" />
<Output TaskParameter="ExitCode" PropertyName="GitExitCode" />
</Exec>
<Exec Command="git rev-parse HEAD" ConsoleToMSBuild="true" Condition="'$(COMMIT_HASH)' == ''" IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitInfoCommitHash" />
<Output TaskParameter="ExitCode" PropertyName="GitExitCode" />
</Exec>
<PropertyGroup Condition="'$(GitExitCode)' != '0'">
<GitInfoCommitCount>0</GitInfoCommitCount>
<GitInfoCommitHash>UNKNOWN</GitInfoCommitHash>
</PropertyGroup>
<PropertyGroup>
<GitCommitInfoContent>
<![CDATA[
[assembly: System.Reflection.AssemblyVersion("$(PackageReleaseVersion)")]
[assembly: System.Reflection.AssemblyFileVersion("$(PackageReleaseVersion)")]
[assembly: System.Reflection.AssemblyInformationalVersion("$(PackageVersion)+$(GitInfoCommitCount).$(GitInfoCommitHash)")]
namespace Microsoft.TemplateEngine
{
internal static class GitInfo
{
public static string CommitCount { get%3B } = "$(GitInfoCommitCount)"%3B
public static string CommitHash { get%3B } = "$(GitInfoCommitHash)"%3B
}
}
]]>
</GitCommitInfoContent>
<GitInfoPropsContent>
<![CDATA[
<Project ToolsVersion="15.0">
<PropertyGroup>
<Version>$(PackageReleaseVersion)</Version>
<FileVersion>$(PackageReleaseVersion)</FileVersion>
<InformationalVersion>$(PackageVersion)+$(GitInfoCommitCount).$(GitInfoCommitHash)</InformationalVersion>
<PackageReleaseNotes>Commit Hash: $(GitInfoCommitHash)</PackageReleaseNotes>
</PropertyGroup>
</Project>
]]>
</GitInfoPropsContent>
</PropertyGroup>
<WriteLinesToFile File="$(GitInfoFile)"
Lines="$(GitCommitInfoContent)"
Overwrite="true" />
<WriteLinesToFile File="$(GitInfoProps)"
Lines="$(GitInfoPropsContent)"
Overwrite="true" />
</Target>
<ItemGroup>
<Compile Include="$(GitInfoFile)" Condition="Exists('$(GitInfoFile)')" Link="%(RecursiveDir)%(Filename)%(Extension)" />
<Compile Include="$(MSBuildThisFileDirectory)src/GitInfo.cs" Condition="!Exists('$(GitInfoFile)')" Link="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<Import Project="$(GitInfoProps)" Condition="Exists('$(GitInfoProps)')" />
</Project>