Skip to content

Commit

Permalink
#546 Assembly meta data now includes git branch/commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
napernik committed Feb 28, 2018
1 parent 6322367 commit df90bc6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


/.vs
/Composite/bin
/Composite/obj
Expand Down Expand Up @@ -36,3 +36,5 @@
/Packages/
selenium-debug.log
/Website/test/e2e/reports/

GitCommitInfo.cs
20 changes: 18 additions & 2 deletions Composite.Workflows/Composite.Workflows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@
<Compile Include="C1Console\Users\Workflows\ChangeOwnPasswordWorkflow.designer.cs">
<DependentUpon>ChangeOwnPasswordWorkflow.cs</DependentUpon>
</Compile>
<Compile Include="Properties\GitCommitInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="C1Console\Actions\Workflows\EntityTokenLockedWorkflow.layout">
Expand Down Expand Up @@ -1362,11 +1363,26 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Target Name="BeforeBuild">
<PropertyGroup>
<GitBranchFile>$(ProjectDir)git_branch.txt</GitBranchFile>
<GitCommitHashFile>$(ProjectDir)git_commithash.txt</GitCommitHashFile>
</PropertyGroup>
<Exec Command="git -C $(ProjectDir) rev-parse --abbrev-ref HEAD&gt; &quot;$(GitBranchFile)&quot;" />
<Exec Command="git -C $(ProjectDir) rev-parse HEAD&gt; &quot;$(GitCommitHashFile)&quot;" />
<PropertyGroup>
<GitBranch>$([System.IO.File]::ReadAllText("$(GitBranchFile)").Trim())</GitBranch>
<GitCommitHash>$([System.IO.File]::ReadAllText("$(GitCommitHashFile)").Trim())</GitCommitHash>
<AssemblyInformationalVersionAttribute>[assembly: System.Reflection.AssemblyInformationalVersion("$(GitBranch). Commit Hash: $(GitCommitHash)")]</AssemblyInformationalVersionAttribute>
</PropertyGroup>
<WriteLinesToFile File="Properties\GitCommitInfo.cs" Lines="$(AssemblyInformationalVersionAttribute)" Overwrite="true">
</WriteLinesToFile>
<Exec Command="del &quot;$(GitBranchFile)&quot;" />
<Exec Command="del &quot;$(GitCommitHashFile)&quot;" />
</Target>
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "$(ProjectDir)..\bin\"
copy "$(TargetPath)" "$(ProjectDir)..\Website\bin\"</PostBuildEvent>
Expand Down
20 changes: 18 additions & 2 deletions Composite/Composite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
<Compile Include="Plugins\Elements\UrlToEntityToken\WebsiteFileUrlToEntityTokenMapper.cs" />
<Compile Include="Plugins\Elements\UrlToEntityToken\MediaUrlToEntityTokenMapper.cs" />
<Compile Include="Plugins\Functions\WidgetFunctionProviders\StandardWidgetFunctionProvider\String\HierarchicalSelectorWidgetFunction.cs" />
<Compile Include="Properties\GitCommitInfo.cs" />
<Compile Include="Search\Crawling\DataFieldProcessors\DateTimeDataFieldProcessor.cs" />
<Compile Include="Search\Crawling\DataFieldProcessors\FileNameDataFieldProcessor.cs" />
<Compile Include="Search\Crawling\DataFieldProcessors\MimeTypeDataFieldProcessor.cs" />
Expand Down Expand Up @@ -2667,11 +2668,26 @@
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Target Name="BeforeBuild">
<PropertyGroup>
<GitBranchFile>$(ProjectDir)git_branch.txt</GitBranchFile>
<GitCommitHashFile>$(ProjectDir)git_commithash.txt</GitCommitHashFile>
</PropertyGroup>
<Exec Command="git -C $(ProjectDir) rev-parse --abbrev-ref HEAD&gt; &quot;$(GitBranchFile)&quot;" />
<Exec Command="git -C $(ProjectDir) rev-parse HEAD&gt; &quot;$(GitCommitHashFile)&quot;" />
<PropertyGroup>
<GitBranch>$([System.IO.File]::ReadAllText("$(GitBranchFile)").Trim())</GitBranch>
<GitCommitHash>$([System.IO.File]::ReadAllText("$(GitCommitHashFile)").Trim())</GitCommitHash>
<AssemblyInformationalVersionAttribute>[assembly: System.Reflection.AssemblyInformationalVersion("$(GitBranch). Commit Hash: $(GitCommitHash)")]</AssemblyInformationalVersionAttribute>
</PropertyGroup>
<WriteLinesToFile File="Properties\GitCommitInfo.cs" Lines="$(AssemblyInformationalVersionAttribute)" Overwrite="true">
</WriteLinesToFile>
<Exec Command="del &quot;$(GitBranchFile)&quot;" />
<Exec Command="del &quot;$(GitCommitHashFile)&quot;" />
</Target>
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "$(ProjectDir)..\bin\"
copy "$(TargetPath)" "$(ProjectDir)..\Website\bin\"</PostBuildEvent>
Expand Down

0 comments on commit df90bc6

Please sign in to comment.