Skip to content

Update Assembly/File versioning to incorporate GitCommit. #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Microsoft.AspNet.OutputCache.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Packages", "src\packages\Pa
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{43F85F24-FF0F-4076-845C-863079AF3EC7}"
ProjectSection(SolutionItems) = preProject
docs\OutputCacheModuleAsync.md = docs\OutputCacheModuleAsync.md
docs\CosmosDBTableAsyncOutputCacheProvider.md = docs\CosmosDBTableAsyncOutputCacheProvider.md
docs\OutputCacheModuleAsync.md = docs\OutputCacheModuleAsync.md
Readme.md = Readme.md
docs\SQLAsyncOutputCacheProvider.md = docs\SQLAsyncOutputCacheProvider.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{89D3A859-B18D-4BFE-AA27-83AF9F6C21F3}"
ProjectSection(SolutionItems) = preProject
tools\CosmosDBTableAsyncOutputCacheProvider.settings.targets = tools\CosmosDBTableAsyncOutputCacheProvider.settings.targets
tools\OutputCacheModuleAsync.settings.targets = tools\OutputCacheModuleAsync.settings.targets
tools\SQLAsyncOutputCacheProvider.settings.targets = tools\SQLAsyncOutputCacheProvider.settings.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),Microsoft.AspNet.OutputCache.sln))\tools\MicrosoftAspNetOutputCache.settings.targets" />
<PropertyGroup>
<BuildQuality Condition="'$(BuildQuality)' == ''">rtm</BuildQuality>
<!-- Update version in config.xdt's for major/minor changes. (Don't update for 'release' changes.) -->
<VersionMajor>1</VersionMajor>
<VersionMinor>1</VersionMinor>
<VersionRelease>1</VersionRelease>
Expand Down
1 change: 1 addition & 0 deletions tools/OutputCacheModuleAsync.settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),Microsoft.AspNet.OutputCache.sln))\tools\MicrosoftAspNetOutputCache.settings.targets" />
<PropertyGroup>
<BuildQuality Condition="'$(BuildQuality)' == ''">rtm</BuildQuality>
<!-- Update version in config.xdt's for major/minor changes. (Don't update for 'release' changes.) -->
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionRelease>3</VersionRelease>
Expand Down
1 change: 1 addition & 0 deletions tools/SQLAsyncOutputCacheProvider.settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),Microsoft.AspNet.OutputCache.sln))\tools\MicrosoftAspNetOutputCache.settings.targets" />
<PropertyGroup>
<BuildQuality Condition="'$(BuildQuality)' == ''">rtm</BuildQuality>
<!-- Update version in config.xdt's for major/minor changes. (Don't update for 'release' changes.) -->
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionRelease>1</VersionRelease>
Expand Down
27 changes: 20 additions & 7 deletions tools/version.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Project global versioning targets.
<!-- NOTE: The VersionFileAttribute ItemGroup can be used to add assembly-level attributes to the generated version file, ex:
<VersionFileAttribute Include="[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(&quot;Microsoft.Usage&quot;, &quot;CA2243:AttributeStringLiteralsShouldParseCorrectly&quot;, Justification = &quot;Justification here&quot;)]" />
-->

<PropertyGroup>
<VersionFileGenerationEnabled Condition="'$(VersionFileGenerationEnabled)' == '' AND '$(MSBuildProjectExtension)' == '.csproj'">true</VersionFileGenerationEnabled>
<VersionFileGenerationEnabled Condition="'$(VersionFileGenerationEnabled)' == ''">false</VersionFileGenerationEnabled>
Expand All @@ -19,18 +19,16 @@ Project global versioning targets.
<VersionStartYear Condition="'$(VersionStartYear)' == ''">2023</VersionStartYear>
<VersionMajor Condition="'$(VersionMajor)' == ''">INVALID_VersionMajor</VersionMajor>
<VersionMinor Condition="'$(VersionMinor)' == ''">INVALID_VersionMinor</VersionMinor>
<VersionBuild Condition="'$(VersionBuild)' == '' OR '$(VersionBuild)' == '0'">$([MSBuild]::Add(1, $([MSBuild]::Subtract($([System.DateTime]::Now.Year), $(VersionStartYear)))))$([System.DateTime]::Now.ToString("MMdd"))</VersionBuild>
<VersionRevision Condition="'$(VersionRevision)' == ''">0</VersionRevision>
<VersionRelease Condition="'$(VersionRelease)' == ''">0</VersionRelease>
<VersionRevision Condition="'$(VersionRevision)' == ''">0</VersionRevision>
<VersionBuild Condition="'$(VersionBuild)' == '' OR '$(VersionBuild)' == '0'">$([MSBuild]::Add(1, $([MSBuild]::Subtract($([System.DateTime]::Now.Year), $(VersionStartYear)))))$([System.DateTime]::Now.ToString("MMdd"))</VersionBuild>
</PropertyGroup>

<!-- Comptued parameters -->

<PropertyGroup>
<AssemblyVersion>$(VersionMajor).$(VersionMinor).0.$(VersionRevision)</AssemblyVersion>
<AssemblyFileVersion>$(VersionMajor).$(VersionMinor).$(VersionBuild).$(VersionRevision)</AssemblyFileVersion>
<AssemblyInfoVersion Condition="'$(VersionRelease)' != ''">$(VersionMajor).$(VersionMinor).$(VersionRelease)-$(VersionBuild)</AssemblyInfoVersion>
<AssemblyInfoVersion Condition="'$(AssemblyInfoVersion)' == ''">$(AssemblyFileVersion)</AssemblyInfoVersion>
<AssemblyFileVersion>$(VersionMajor).$(VersionMinor).$(VersionRelease).$(VersionBuild)</AssemblyFileVersion>
<AssemblyVersionFile>$(IntermediateOutputPath)$(MSBuildProjectName).version.cs</AssemblyVersionFile>
</PropertyGroup>

Expand Down Expand Up @@ -68,7 +66,22 @@ Project global versioning targets.
</PropertyGroup>
<Target Name="GenerateVersionFile" DependsOnTargets="$(GenerateVersionFileDependsOn)" />

<Target Name="GenerateVersionFileCore" Condition="'$(ShouldGenerateVersionFile)' == 'true'">
<Target Name="EnsureGitInfo" Condition="'$(GitCommit)' == ''">
<Exec Command="git describe --match= --always --dirty --abbrev=40" ConsoleToMSBuild="true" IgnoreExitCode="false" ContinueOnError="true" >
<Output PropertyName="GitDescribeOutput" TaskParameter="ConsoleOutput" />
<Output PropertyName="GitDescribeExit" TaskParameter="ExitCode" />
</Exec>
<PropertyGroup Condition="'$(GitDescribeExit)' == '0'">
<GitCommit>$(GitDescribeOutput)</GitCommit>
</PropertyGroup>
</Target>

<Target Name="GenerateVersionFileCore" Condition="'$(ShouldGenerateVersionFile)' == 'true'" DependsOnTargets="EnsureGitInfo">
<PropertyGroup>
<AssemblyInfoVersion Condition="'$(GitCommit)' != ''">$(VersionMajor).$(VersionMinor).$(VersionRelease)+$(GitCommit)</AssemblyInfoVersion>
<AssemblyInfoVersion Condition="'$(AssemblyInfoVersion)' == '' AND '$(VersionBuild)' != ''">$(VersionMajor).$(VersionMinor).$(VersionRelease)-$(VersionBuild)</AssemblyInfoVersion>
<AssemblyInfoVersion Condition="'$(AssemblyInfoVersion)' == ''">$(AssemblyFileVersion)</AssemblyInfoVersion>
</PropertyGroup>
<ItemGroup>
<LinesToWrite Include="// $(SourceFileCopyright)" Condition="'$(SourceFileCopyright)' != ''"/>
<LinesToWrite Include="// &lt;auto-generated&gt;" />
Expand Down