Consistent versioning of native binaries

* Adding an MSBuild target file that generates a header containing file and product versions which will be used in .rc files in native projects across all repos.
  Note that keeping header generation in MSBuild is cleaner than generating it in a .shade file since the entire project is being built within a single build subsystem and therefore you can build the project directly (i.e. just with MSBuild) without having to do it with Sake (if the file did not exist)
* Updating native-compile target in _k-standard-goals.shade to pass version numbers.
This commit is contained in:
moozzyk 2015-04-29 21:29:44 -07:00
parent 9ffb74a4c3
commit 6558f1c281
2 changed files with 31 additions and 2 deletions

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CreateVersionHeader" BeforeTargets="Build">
<PropertyGroup>
<ProductVersion Condition="'$(ProductVersion)' == ''">0.0.0</ProductVersion>
<FileRevision Condition="'$(FileRevision)' == ''">0</FileRevision>
<FullFileVersion>$(ProductVersion).$(FileRevision)</FullFileVersion>
<BuildVersionSuffix Condition="'$(BuildVersion)' != ''">-$(BuildVersion)</BuildVersionSuffix>
</PropertyGroup>
<ItemGroup>
<VersionHeaderContents Include="// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved." />
<VersionHeaderContents Include="// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information." />
<VersionHeaderContents Include="%0a" />
<VersionHeaderContents Include="// This file is auto-generated" />
<VersionHeaderContents Include="%0a" />
<VersionHeaderContents Include="#define FileVersion $(FullFileVersion.Replace('.', ','))" />
<VersionHeaderContents Include="#define FileVersionStr &quot;$(FullFileVersion)\0&quot;" />
<VersionHeaderContents Include="#define ProductVersion $(ProductVersion.Replace('.', ',')),0" />
<VersionHeaderContents Include="#define ProductVersionStr &quot;$(ProductVersion)$(BuildVersionSuffix)\0&quot;" />
</ItemGroup>
<WriteLinesToFile File="version.h" Lines="@(VersionHeaderContents)" OverWrite="true" />
</Target>
</Project>

View File

@ -104,10 +104,16 @@ default Configuration='${E("Configuration")}'
var msbuildPath = Path.Combine(programFilesX86, "MSBuild", msbuildVersions[i], "Bin", "MSBuild.exe");
if (File.Exists(msbuildPath))
{
var commonParameters =
" /p:Configuration=" + Configuration +
" /p:ProductVersion=1.0.0" +
" /p:FileRevision=" + E("DNX_ASSEMBLY_FILE_VERSION") +
" /p:BuildVersion=" + E("DNX_BUILD_VERSION");
foreach (var project in nativeProjects)
{
Exec(msbuildPath, project + " /p:Configuration=" + Configuration + ";Platform=Win32");
Exec(msbuildPath, project + " /p:Configuration=" + Configuration + ";Platform=x64");
Exec(msbuildPath, project + " /p:Configuration=Platform=Win32" + commonParameters);
Exec(msbuildPath, project + " /p:Configuration=Platform=x64" + commonParameters);
}
break;