Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/5.0.1xx-rc2] Use aspnetcore version suffix for template install directory #8625

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/core-sdk-tasks/CalculateTemplateVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ public class CalculateTemplateVersions : Task
[Required]
public string AspNetCorePackageVersionTemplate { get; set; }

[Required]
public string VersionSuffix { get; set; }

[Output]
public string BundledTemplateInstallPath { get; set; }

Expand All @@ -28,7 +25,7 @@ public class CalculateTemplateVersions : Task

public override bool Execute()
{
var result = Calculate(AspNetCorePackageVersionTemplate, VersionSuffix);
var result = Calculate(AspNetCorePackageVersionTemplate);
BundledTemplateInstallPath = result.BundledTemplateInstallPath;
BundledTemplateMajorMinorVersion = result.BundledTemplateMajorMinorVersion;
BundledTemplateMajorMinorPatchVersion = result.BundledTemplateMajorMinorPatchVersion;
Expand All @@ -40,16 +37,14 @@ public static
(string BundledTemplateInstallPath,
string BundledTemplateMajorMinorVersion,
string BundledTemplateMajorMinorPatchVersion)
Calculate(
string aspNetCorePackageVersionTemplate,
string versionSuffix)
Calculate(string aspNetCorePackageVersionTemplate)
{
var aspNetCoreTemplate = NuGetVersion.Parse(aspNetCorePackageVersionTemplate);

NuGetVersion baseMajorMinorPatch = GetBaseMajorMinorPatch(aspNetCoreTemplate);

string bundledTemplateInstallPath = aspNetCoreTemplate.IsPrerelease
? $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}-{versionSuffix}"
? $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}-{aspNetCoreTemplate.Release}"
: $"{baseMajorMinorPatch.Major}.{baseMajorMinorPatch.Minor}.{baseMajorMinorPatch.Patch}";

return (
Expand Down
12 changes: 4 additions & 8 deletions src/redist/targets/BundledTemplates.targets
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CalculateTemplatesVersions" DependsOnTargets="SetupWixProperties">

<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor50Templates)"
VersionSuffix="$(VersionSuffix)">
<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor50Templates)">
<Output TaskParameter="BundledTemplateInstallPath" PropertyName="BundledTemplates50InstallPath" />
<Output TaskParameter="BundledTemplateMajorMinorVersion" PropertyName="BundledTemplates50MajorMinorVersion" />
<Output TaskParameter="BundledTemplateMajorMinorPatchVersion" PropertyName="BundledTemplates50MajorMinorPatchVersion" />
</CalculateTemplateVersions>

<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor31Templates)"
VersionSuffix="$(VersionSuffix)">
<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor31Templates)">
<Output TaskParameter="BundledTemplateInstallPath" PropertyName="BundledTemplates31InstallPath" />
<Output TaskParameter="BundledTemplateMajorMinorVersion" PropertyName="BundledTemplates31MajorMinorVersion" />
<Output TaskParameter="BundledTemplateMajorMinorPatchVersion" PropertyName="BundledTemplates31MajorMinorPatchVersion" />
</CalculateTemplateVersions>

<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor30Templates)"
VersionSuffix="$(VersionSuffix)">
<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor30Templates)">
<Output TaskParameter="BundledTemplateInstallPath" PropertyName="BundledTemplates30InstallPath" />
<Output TaskParameter="BundledTemplateMajorMinorVersion" PropertyName="BundledTemplates30MajorMinorVersion" />
<Output TaskParameter="BundledTemplateMajorMinorPatchVersion" PropertyName="BundledTemplates30MajorMinorPatchVersion" />
</CalculateTemplateVersions>

<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor21Templates)"
VersionSuffix="$(VersionSuffix)">
<CalculateTemplateVersions AspNetCorePackageVersionTemplate="$(AspNetCorePackageVersionFor21Templates)">
<Output TaskParameter="BundledTemplateInstallPath" PropertyName="BundledTemplates21InstallPath" />
<Output TaskParameter="BundledTemplateMajorMinorVersion" PropertyName="BundledTemplates21MajorMinorVersion" />
<Output TaskParameter="BundledTemplateMajorMinorPatchVersion" PropertyName="BundledTemplates21MajorMinorPatchVersion" />
Expand Down
12 changes: 6 additions & 6 deletions test/core-sdk-tasks.Tests/CalculateTemplateVerionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class CalculateTemplateVersionsTests
[Fact]
public void WhenAspNetCoreTemplateMajorVersionLowerthan3ItCanCalculateTemplateVersionsInStableBuilds()
{
var result = CalculateTemplateVersions.Calculate("3.1.0", "dev");
var result = CalculateTemplateVersions.Calculate("3.1.0");

result.Should()
.Be(("3.1.1", "3.1", "3.1.1"),
Expand All @@ -20,16 +20,16 @@ public void WhenAspNetCoreTemplateMajorVersionLowerthan3ItCanCalculateTemplateVe
[Fact]
public void WhenAspNetCoreTemplateMajorVersionLowerthan3ItCanCalculateTemplateVersionsInNonStableBuilds()
{
var result = CalculateTemplateVersions.Calculate("3.0.0-alpha.1.20071.6", "dev");
var result = CalculateTemplateVersions.Calculate("3.0.0-alpha.1.20071.6");

result.Should()
.Be(("3.0.1-dev", "3.0", "3.0.1"));
.Be(("3.0.1-alpha.1.20071.6", "3.0", "3.0.1"));
}

[Fact]
public void WhenAspNetCoreTemplateMajorVersionHigherthan3ItCanCalculateTemplateVersionsInStableBuilds()
{
var result = CalculateTemplateVersions.Calculate("5.1.0", "dev");
var result = CalculateTemplateVersions.Calculate("5.1.0");

result.Should()
.Be(("5.1.0", "5.1", "5.1.0"),
Expand All @@ -40,10 +40,10 @@ public void WhenAspNetCoreTemplateMajorVersionHigherthan3ItCanCalculateTemplateV
[Fact]
public void WhenAspNetCoreTemplateMajorVersionHigherthan3ItCanCalculateTemplateVersionsInNonStableBuilds()
{
var result = CalculateTemplateVersions.Calculate("5.0.0-alpha.1.20071.6", "dev");
var result = CalculateTemplateVersions.Calculate("5.0.0-alpha.1.20071.6");

result.Should()
.Be(("5.0.0-dev", "5.0", "5.0.0"));
.Be(("5.0.0-alpha.1.20071.6", "5.0", "5.0.0"));
}
}
}