Use _PatchNumber from arcade instead of commit count. Fixes msi generation and changes VersionPatch to VersionFeature.

This commit is contained in:
Livar Cunha 2019-12-23 15:03:33 -08:00
parent 57dd97f02a
commit 34b644977c
5 changed files with 20 additions and 26 deletions

View file

@ -8,15 +8,14 @@
<VersionMajor>5</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionSDKMinor>1</VersionSDKMinor>
<VersionPatch>00</VersionPatch>
<VersionFeature>00</VersionFeature>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionSDKMinor)$(VersionPatch)</VersionPrefix>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionSDKMinor)$(VersionFeature)</VersionPrefix>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>
<MajorMinorVersion>$(VersionMajor).$(VersionMinor)</MajorMinorVersion>
<CliProductBandVersion>$(MajorMinorVersion).$(VersionSDKMinor)</CliProductBandVersion>
<SDKBundleVersion>$(VersionPrefix).$(_BuildNumberLabels)</SDKBundleVersion>
<FullNugetVersion>$(VersionPrefix)-$(PreReleaseVersionLabel)$(PreReleaseVersionIteration)-$(_BuildNumberLabels)</FullNugetVersion>
</PropertyGroup>

View file

@ -9,7 +9,7 @@ namespace Microsoft.DotNet.Cli.Build
public class GenerateMsiVersion : Task
{
[Required]
public int CommitCount { get; set; }
public int VersionRevision { get; set; }
[Required]
public int VersionMajor { get; set; }
@ -30,7 +30,7 @@ namespace Microsoft.DotNet.Cli.Build
Major = VersionMajor,
Minor = VersionMinor,
Patch = VersionPatch,
CommitCount = CommitCount
VersionRevision = VersionRevision
};
MsiVersion = buildVersion.GenerateMsiVersion();

View file

@ -8,7 +8,7 @@ namespace Microsoft.DotNet.Cli.Build
public virtual int Major { get; set; }
public virtual int Minor { get; set; }
public virtual int Patch { get; set; }
public virtual int CommitCount { get; set; }
public virtual int VersionRevision { get; set; }
public string GenerateMsiVersion()
{
@ -22,11 +22,11 @@ namespace Microsoft.DotNet.Cli.Build
// CLI major -> 6 bits
// CLI minor -> 6 bits
// CLI patch -> 6 bits
// CLI commitcount -> 14 bits
// CLI VersionRevision -> 14 bits
var major = Major << 26;
var minor = Minor << 20;
var patch = Patch << 14;
var msiVersionNumber = major | minor | patch | CommitCount;
var msiVersionNumber = major | minor | patch | VersionRevision;
var msiMajor = (msiVersionNumber >> 24) & 0xFF;
var msiMinor = (msiVersionNumber >> 16) & 0xFF;

View file

@ -1,10 +1,10 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CalculateTemplatesVersions">
<Target Name="CalculateTemplatesVersions" DependsOnTargets="SetupWixProperties">
<PropertyGroup>
<AspNetCore31VersionPreReleaseSeparator>$(AspNetCorePackageVersionFor31Templates.IndexOf('-'))</AspNetCore31VersionPreReleaseSeparator>
<AspNetCore31VersionMajorMinorPatchVersion>$(AspNetCorePackageVersionFor31Templates)</AspNetCore31VersionMajorMinorPatchVersion>
<AspNetCore31VersionMajorMinorPatchVersion Condition=" '$(AspNetCore31VersionPreReleaseSeparator)' != -1 ">$(AspNetCorePackageVersionFor31Templates.Substring(0, $(AspNetCore31VersionPreReleaseSeparator)))</AspNetCore31VersionMajorMinorPatchVersion>
<BundledTemplates31MSIVersion>$(AspNetCore31VersionMajorMinorPatchVersion).$(GitCommitCount)</BundledTemplates31MSIVersion>
<BundledTemplates31MSIVersion>$(AspNetCore31VersionMajorMinorPatchVersion).$(CombinedBuildNumberAndRevision)</BundledTemplates31MSIVersion>
<BundledTemplates31InstallPath>$(AspNetCore31VersionMajorMinorPatchVersion)</BundledTemplates31InstallPath>
<BundledTemplates31InstallPath Condition=" '$(AspNetCore31VersionPreReleaseSeparator)' != -1 ">$(BundledTemplates31InstallPath)-$(VersionSuffix)</BundledTemplates31InstallPath>
<Templates31VersionPatchSeparatorIndex>$([MSBuild]::Add($(AspNetCore31VersionMajorMinorPatchVersion.IndexOf('.')), 1))</Templates31VersionPatchSeparatorIndex>
@ -14,7 +14,7 @@
<AspNetCore30VersionPreReleaseSeparator>$(AspNetCorePackageVersionFor30Templates.IndexOf('-'))</AspNetCore30VersionPreReleaseSeparator>
<AspNetCore30VersionMajorMinorPatchVersion>$(AspNetCorePackageVersionFor30Templates)</AspNetCore30VersionMajorMinorPatchVersion>
<AspNetCore30VersionMajorMinorPatchVersion Condition=" '$(AspNetCore30VersionPreReleaseSeparator)' != -1 ">$(AspNetCorePackageVersionFor30Templates.Substring(0, $(AspNetCore30VersionPreReleaseSeparator)))</AspNetCore30VersionMajorMinorPatchVersion>
<BundledTemplates30MSIVersion>$(AspNetCore30VersionMajorMinorPatchVersion).$(GitCommitCount)</BundledTemplates30MSIVersion>
<BundledTemplates30MSIVersion>$(AspNetCore30VersionMajorMinorPatchVersion).$(CombinedBuildNumberAndRevision)</BundledTemplates30MSIVersion>
<BundledTemplates30InstallPath>$(AspNetCore30VersionMajorMinorPatchVersion)</BundledTemplates30InstallPath>
<BundledTemplates30InstallPath Condition=" '$(AspNetCore30VersionPreReleaseSeparator)' != -1 ">$(BundledTemplates30InstallPath)-$(VersionSuffix)</BundledTemplates30InstallPath>
<Templates30VersionPatchSeparatorIndex>$([MSBuild]::Add($(AspNetCore30VersionMajorMinorPatchVersion.IndexOf('.')), 1))</Templates30VersionPatchSeparatorIndex>
@ -24,7 +24,7 @@
<AspNetCore22VersionPreReleaseSeparator>$(AspNetCorePackageVersionFor22Templates.IndexOf('-'))</AspNetCore22VersionPreReleaseSeparator>
<AspNetCore22VersionMajorMinorPatchVersion>$(AspNetCorePackageVersionFor22Templates)</AspNetCore22VersionMajorMinorPatchVersion>
<AspNetCore22VersionMajorMinorPatchVersion Condition=" '$(AspNetCore22VersionPreReleaseSeparator)' != -1 ">$(AspNetCorePackageVersionFor22Templates.Substring(0, $(AspNetCore22VersionPreReleaseSeparator)))</AspNetCore22VersionMajorMinorPatchVersion>
<BundledTemplates22MSIVersion>$(AspNetCore22VersionMajorMinorPatchVersion).$(GitCommitCount)</BundledTemplates22MSIVersion>
<BundledTemplates22MSIVersion>$(AspNetCore22VersionMajorMinorPatchVersion).$(CombinedBuildNumberAndRevision)</BundledTemplates22MSIVersion>
<BundledTemplates22InstallPath>$(AspNetCore22VersionMajorMinorPatchVersion)</BundledTemplates22InstallPath>
<BundledTemplates22InstallPath Condition=" '$(AspNetCore22VersionPreReleaseSeparator)' != -1 ">$(BundledTemplates22InstallPath)-$(VersionSuffix)</BundledTemplates22InstallPath>
<Templates22VersionPatchSeparatorIndex>$([MSBuild]::Add($(AspNetCore22VersionMajorMinorPatchVersion.IndexOf('.')), 1))</Templates22VersionPatchSeparatorIndex>
@ -34,7 +34,7 @@
<AspNetCore21VersionPreReleaseSeparator>$(AspNetCorePackageVersionFor21Templates.IndexOf('-'))</AspNetCore21VersionPreReleaseSeparator>
<AspNetCore21VersionMajorMinorPatchVersion>$(AspNetCorePackageVersionFor21Templates)</AspNetCore21VersionMajorMinorPatchVersion>
<AspNetCore21VersionMajorMinorPatchVersion Condition=" '$(AspNetCore21VersionPreReleaseSeparator)' != -1 ">$(AspNetCorePackageVersionFor21Templates.Substring(0, $(AspNetCore21VersionPreReleaseSeparator)))</AspNetCore21VersionMajorMinorPatchVersion>
<BundledTemplates21MSIVersion>$(AspNetCore21VersionMajorMinorPatchVersion).$(GitCommitCount)</BundledTemplates21MSIVersion>
<BundledTemplates21MSIVersion>$(AspNetCore21VersionMajorMinorPatchVersion).$(CombinedBuildNumberAndRevision)</BundledTemplates21MSIVersion>
<BundledTemplates21InstallPath>$(AspNetCore21VersionMajorMinorPatchVersion)</BundledTemplates21InstallPath>
<BundledTemplates21InstallPath Condition=" '$(AspNetCore21VersionPreReleaseSeparator)' != -1 ">$(BundledTemplates21InstallPath)-$(VersionSuffix)</BundledTemplates21InstallPath>
<Templates21VersionPatchSeparatorIndex>$([MSBuild]::Add($(AspNetCore21VersionMajorMinorPatchVersion.IndexOf('.')), 1))</Templates21VersionPatchSeparatorIndex>

View file

@ -54,30 +54,25 @@
<SdkLayoutOutputDirectory>$(LayoutDirectory)$(ArtifactNameSdk)</SdkLayoutOutputDirectory>
<MSBuildExtensionsOutputDirectory>$(LayoutDirectory)MSBuildExtensions</MSBuildExtensionsOutputDirectory>-->
</PropertyGroup>
<PropertyGroup>
<!-- This number comes from arcade and combines the date based build number id and the revision (incremental number per day) -->
<CombinedBuildNumberAndRevision>$(_PatchNumber)</CombinedBuildNumberAndRevision>
<SDKBundleVersion>$(VersionPrefix).$(CombinedBuildNumberAndRevision)</SDKBundleVersion>
</PropertyGroup>
</Target>
<Target Name="MsiTargetsSetupInputOutputs"
DependsOnTargets="GenerateLayout;SetupWixProperties">
<Exec Command="git rev-list --count HEAD"
ConsoleToMSBuild="true"
Condition=" '$(GitCommitCount)' == '' ">
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitCount" />
</Exec>
<PropertyGroup>
<GitCommitCount>$(GitCommitCount.PadLeft(6,'0'))</GitCommitCount>
</PropertyGroup>
<!-- Consumed By Publish -->
<ItemGroup>
<GeneratedInstallers Include="$(SdkMSIInstallerFile);$(Templates31MSIInstallerFile);$(Templates30MSIInstallerFile);$(Templates22MSIInstallerFile);$(Templates21MSIInstallerFile);$(CombinedFrameworkSdkHostMSIInstallerFile);$(SdkPlaceholderMSIInstallerFile)" />
</ItemGroup>
<GenerateMsiVersion CommitCount="$(GitCommitCount)"
<GenerateMsiVersion VersionRevision="$(CombinedBuildNumberAndRevision)"
VersionMajor="$(VersionMajor)"
VersionMinor="$(VersionMinor)"
VersionPatch="$(VersionPatch)">
VersionPatch="$(VersionFeature)">
<Output TaskParameter="MsiVersion" PropertyName="MsiVersion" />
</GenerateMsiVersion>