Fix merge issues with templates
This commit is contained in:
parent
03963a5788
commit
c6b041e78c
3 changed files with 32 additions and 37 deletions
|
@ -12,38 +12,37 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
[Required]
|
||||
public string AspNetCorePackageVersionTemplate { get; set; }
|
||||
|
||||
[Required]
|
||||
public string GitCommitCount { get; set; }
|
||||
|
||||
[Required]
|
||||
public string VersionSuffix { get; set; }
|
||||
|
||||
[Output]
|
||||
public string BundledTemplateMSIVersion { get; set; }
|
||||
|
||||
[Output]
|
||||
public string BundledTemplateInstallPath { get; set; }
|
||||
|
||||
[Output]
|
||||
public string BundledTemplateMajorMinorVersion { get; set; }
|
||||
|
||||
[Output]
|
||||
public string BundledTemplateMajorMinorPatchVersion { get; set; }
|
||||
|
||||
private const int _patchVersionResetOffset = 1;
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
var result = Calculate(AspNetCorePackageVersionTemplate, GitCommitCount, VersionSuffix);
|
||||
BundledTemplateMSIVersion = result.BundledTemplateMsiVersion;
|
||||
var result = Calculate(AspNetCorePackageVersionTemplate, VersionSuffix);
|
||||
BundledTemplateInstallPath = result.BundledTemplateInstallPath;
|
||||
BundledTemplateMajorMinorVersion = result.BundledTemplateMajorMinorVersion;
|
||||
BundledTemplateMajorMinorPatchVersion = result.BundledTemplateMajorMinorPatchVersion;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static
|
||||
(string BundledTemplateMsiVersion,
|
||||
string BundledTemplateInstallPath,
|
||||
string BundledTemplateMajorMinorVersion) Calculate(string aspNetCorePackageVersionTemplate,
|
||||
string gitCommitCount, string versionSuffix)
|
||||
(string BundledTemplateInstallPath,
|
||||
string BundledTemplateMajorMinorVersion,
|
||||
string BundledTemplateMajorMinorPatchVersion)
|
||||
Calculate(
|
||||
string aspNetCorePackageVersionTemplate,
|
||||
string versionSuffix)
|
||||
{
|
||||
var aspNetCoreTemplate = NuGetVersion.Parse(aspNetCorePackageVersionTemplate);
|
||||
|
||||
|
@ -54,9 +53,9 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
: $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}";
|
||||
|
||||
return (
|
||||
$"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}.{gitCommitCount}",
|
||||
bundledTemplateInstallPath,
|
||||
$"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}");
|
||||
$"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}",
|
||||
$"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}");
|
||||
}
|
||||
|
||||
private static NuGetVersion GetBaseMajorMinorPatch(NuGetVersion aspNetCoreTemplate)
|
||||
|
|
|
@ -1,43 +1,39 @@
|
|||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="CalculateTemplatesVersions"
|
||||
DependsOnTargets="SetSdkVersionInfo">
|
||||
<Target Name="CalculateTemplatesVersions" DependsOnTargets="SetupWixProperties">
|
||||
|
||||
<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor31Templates)"
|
||||
GitCommitCount="$(GitCommitCount)"
|
||||
VersionSuffix="$(VersionSuffix)">
|
||||
<Output TaskParameter="BundledTemplateMSIVersion" PropertyName="BundledTemplates31MSIVersion" />
|
||||
VersionSuffix="$(VersionSuffix)">
|
||||
<Output TaskParameter="BundledTemplateInstallPath" PropertyName="BundledTemplates31InstallPath" />
|
||||
<Output TaskParameter="BundledTemplateMajorMinorVersion" PropertyName="BundledTemplates31MajorMinorVersion" />
|
||||
<Output TaskParameter="BundledTemplateMajorMinorPatchVersion" PropertyName="BundledTemplates31MajorMinorPatchVersion" />
|
||||
</CalculateTemplateVersions>
|
||||
|
||||
<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor30Templates)"
|
||||
GitCommitCount="$(GitCommitCount)"
|
||||
VersionSuffix="$(VersionSuffix)">
|
||||
<Output TaskParameter="BundledTemplateMSIVersion" PropertyName="BundledTemplates30MSIVersion" />
|
||||
VersionSuffix="$(VersionSuffix)">
|
||||
<Output TaskParameter="BundledTemplateInstallPath" PropertyName="BundledTemplates30InstallPath" />
|
||||
<Output TaskParameter="BundledTemplateMajorMinorVersion" PropertyName="BundledTemplates30MajorMinorVersion" />
|
||||
<Output TaskParameter="BundledTemplateMajorMinorPatchVersion" PropertyName="BundledTemplates30MajorMinorPatchVersion" />
|
||||
</CalculateTemplateVersions>
|
||||
|
||||
<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor21Templates)"
|
||||
GitCommitCount="$(GitCommitCount)"
|
||||
VersionSuffix="$(VersionSuffix)">
|
||||
<Output TaskParameter="BundledTemplateMSIVersion" PropertyName="BundledTemplates21MSIVersion" />
|
||||
VersionSuffix="$(VersionSuffix)">
|
||||
<Output TaskParameter="BundledTemplateInstallPath" PropertyName="BundledTemplates21InstallPath" />
|
||||
<Output TaskParameter="BundledTemplateMajorMinorVersion" PropertyName="BundledTemplates21MajorMinorVersion" />
|
||||
<Output TaskParameter="BundledTemplateMajorMinorPatchVersion" PropertyName="BundledTemplates21MajorMinorPatchVersion" />
|
||||
</CalculateTemplateVersions>
|
||||
|
||||
<GenerateMsiVersionFromFullVersion VersionRevision="$(CombinedBuildNumberAndRevision)"
|
||||
VersionMajorMinorPatch="$(AspNetCore31VersionMajorMinorPatchVersion)">
|
||||
VersionMajorMinorPatch="$(BundledTemplates31MajorMinorPatchVersion)">
|
||||
<Output TaskParameter="MsiVersion" PropertyName="BundledTemplates31MSIVersion" />
|
||||
</GenerateMsiVersionFromFullVersion>
|
||||
|
||||
<GenerateMsiVersionFromFullVersion VersionRevision="$(CombinedBuildNumberAndRevision)"
|
||||
VersionMajorMinorPatch="$(AspNetCore30VersionMajorMinorPatchVersion)">
|
||||
VersionMajorMinorPatch="$(BundledTemplates30MajorMinorPatchVersion)">
|
||||
<Output TaskParameter="MsiVersion" PropertyName="BundledTemplates30MSIVersion" />
|
||||
</GenerateMsiVersionFromFullVersion>
|
||||
|
||||
|
||||
<GenerateMsiVersionFromFullVersion VersionRevision="$(CombinedBuildNumberAndRevision)"
|
||||
VersionMajorMinorPatch="$(AspNetCore21VersionMajorMinorPatchVersion)">
|
||||
VersionMajorMinorPatch="$(BundledTemplates21MajorMinorPatchVersion)">
|
||||
<Output TaskParameter="MsiVersion" PropertyName="BundledTemplates21MSIVersion" />
|
||||
</GenerateMsiVersionFromFullVersion>
|
||||
</Target>
|
||||
|
|
|
@ -9,10 +9,10 @@ namespace EndToEnd
|
|||
[Fact]
|
||||
public void WhenAspNetCoreTemplateMajorVersionLowerthan3ItCanCalculateTemplateVersionsInStableBuilds()
|
||||
{
|
||||
var result = CalculateTemplateVersions.Calculate("3.1.0", "014885", "dev");
|
||||
var result = CalculateTemplateVersions.Calculate("3.1.0", "dev");
|
||||
|
||||
result.Should()
|
||||
.Be(("3.1.1.014885", "3.1.1", "3.1"),
|
||||
.Be(("3.1.1", "3.1", "3.1.1"),
|
||||
"the patch is 1 higher than aspnetTemplateVersion " +
|
||||
"due to https://github.com/dotnet/core-sdk/issues/6243");
|
||||
}
|
||||
|
@ -20,19 +20,19 @@ namespace EndToEnd
|
|||
[Fact]
|
||||
public void WhenAspNetCoreTemplateMajorVersionLowerthan3ItCanCalculateTemplateVersionsInNonStableBuilds()
|
||||
{
|
||||
var result = CalculateTemplateVersions.Calculate("3.0.0-alpha.1.20071.6", "014885", "dev");
|
||||
var result = CalculateTemplateVersions.Calculate("3.0.0-alpha.1.20071.6", "dev");
|
||||
|
||||
result.Should()
|
||||
.Be(("3.0.1.014885", "3.0.1-dev", "3.0"));
|
||||
.Be(("3.0.1-dev", "3.0", "3.0.1"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhenAspNetCoreTemplateMajorVersionHigherthan3ItCanCalculateTemplateVersionsInStableBuilds()
|
||||
{
|
||||
var result = CalculateTemplateVersions.Calculate("5.1.0", "014885", "dev");
|
||||
var result = CalculateTemplateVersions.Calculate("5.1.0", "dev");
|
||||
|
||||
result.Should()
|
||||
.Be(("5.1.0.014885", "5.1.0", "5.1"),
|
||||
.Be(("5.1.0", "5.1", "5.1.0"),
|
||||
"the patch align with AspNetCoreTemplateMajorVersion again, " +
|
||||
"since there is no non-deterministic existing ComponentId under Major version 5.");
|
||||
}
|
||||
|
@ -40,10 +40,10 @@ namespace EndToEnd
|
|||
[Fact]
|
||||
public void WhenAspNetCoreTemplateMajorVersionHigherthan3ItCanCalculateTemplateVersionsInNonStableBuilds()
|
||||
{
|
||||
var result = CalculateTemplateVersions.Calculate("5.0.0-alpha.1.20071.6", "014885", "dev");
|
||||
var result = CalculateTemplateVersions.Calculate("5.0.0-alpha.1.20071.6", "dev");
|
||||
|
||||
result.Should()
|
||||
.Be(("5.0.0.014885", "5.0.0-dev", "5.0"));
|
||||
.Be(("5.0.0-dev", "5.0", "5.0.0"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue