Finish ComponentID reset
This commit is contained in:
parent
38ff5b6af1
commit
8b9a67d117
2 changed files with 12 additions and 6 deletions
|
@ -29,6 +29,8 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
[Output]
|
[Output]
|
||||||
public string BundledTemplateMajorMinorVersion { get; set; }
|
public string BundledTemplateMajorMinorVersion { get; set; }
|
||||||
|
|
||||||
|
private const int _patchVersionResetOffset = 1;
|
||||||
|
|
||||||
public override bool Execute()
|
public override bool Execute()
|
||||||
{
|
{
|
||||||
var result = Calculate(AspNetCorePackageVersionTemplate, GitCommitCount, VersionSuffix);
|
var result = Calculate(AspNetCorePackageVersionTemplate, GitCommitCount, VersionSuffix);
|
||||||
|
@ -47,8 +49,11 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
var aspNetCoreTemplate = NuGetVersion.Parse(aspNetCorePackageVersionTemplate);
|
var aspNetCoreTemplate = NuGetVersion.Parse(aspNetCorePackageVersionTemplate);
|
||||||
|
|
||||||
|
// due to historical bug https://github.com/dotnet/core-sdk/issues/6243
|
||||||
|
// we need to increase patch version by one in order to "reset" existing install ComponentId
|
||||||
|
// more in the above bug's detail
|
||||||
var baseMajorMinorPatch = new NuGetVersion(aspNetCoreTemplate.Major, aspNetCoreTemplate.Minor,
|
var baseMajorMinorPatch = new NuGetVersion(aspNetCoreTemplate.Major, aspNetCoreTemplate.Minor,
|
||||||
aspNetCoreTemplate.Patch);
|
aspNetCoreTemplate.Patch + _patchVersionResetOffset);
|
||||||
|
|
||||||
string bundledTemplateInstallPath = aspNetCoreTemplate.IsPrerelease
|
string bundledTemplateInstallPath = aspNetCoreTemplate.IsPrerelease
|
||||||
? $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}-{versionSuffix}"
|
? $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}-{versionSuffix}"
|
||||||
|
|
|
@ -4,14 +4,15 @@ using Microsoft.DotNet.Cli.Build;
|
||||||
|
|
||||||
namespace EndToEnd
|
namespace EndToEnd
|
||||||
{
|
{
|
||||||
public class CalculateTemplateVerionsTests
|
public class CalculateTemplateVersionsTests
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ItCanCalculateTemplateVersionsInStableBuilds()
|
public void ItCanCalculateTemplateVersionsInStableBuilds()
|
||||||
{
|
{
|
||||||
var result = CalculateTemplateVersions.Calculate("3.1.0", "014885", "dev");
|
var result = CalculateTemplateVersions.Calculate("3.1.0", "014885", "dev");
|
||||||
result.BundledTemplateInstallPath.Should().Be("3.1.0");
|
result.BundledTemplateInstallPath.Should().Be("3.1.1",
|
||||||
result.BundledTemplateMsiVersion.Should().Be("3.1.0.014885");
|
"the patch is 1 higher than aspnetTemplateVersion due to https://github.com/dotnet/core-sdk/issues/6243");
|
||||||
|
result.BundledTemplateMsiVersion.Should().Be("3.1.1.014885");
|
||||||
result.BundledTemplateMajorMinorVersion.Should().Be("3.1");
|
result.BundledTemplateMajorMinorVersion.Should().Be("3.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +20,8 @@ namespace EndToEnd
|
||||||
public void ItCanCalculateTemplateVersionsInNonStableBuilds()
|
public void ItCanCalculateTemplateVersionsInNonStableBuilds()
|
||||||
{
|
{
|
||||||
var result = CalculateTemplateVersions.Calculate("5.0.0-alpha.1.20071.6", "014885", "dev");
|
var result = CalculateTemplateVersions.Calculate("5.0.0-alpha.1.20071.6", "014885", "dev");
|
||||||
result.BundledTemplateInstallPath.Should().Be("5.0.0-dev");
|
result.BundledTemplateInstallPath.Should().Be("5.0.1-dev");
|
||||||
result.BundledTemplateMsiVersion.Should().Be("5.0.0.014885");
|
result.BundledTemplateMsiVersion.Should().Be("5.0.1.014885");
|
||||||
result.BundledTemplateMajorMinorVersion.Should().Be("5.0");
|
result.BundledTemplateMajorMinorVersion.Should().Be("5.0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue