From 83679698f989f763a7d621dfb01ce35d16a72950 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Fri, 3 Jan 2020 13:58:21 -0800 Subject: [PATCH] Updated all MSIs to use the GenerateMsiVersion task and also moved the generation of FullNuGetVersion to a target because it depends on things happening in BeforeCommons.targets of Arcade. --- eng/Versions.props | 1 - .../GenerateMsiVersionFromFullVersion.cs | 38 +++++++++++++++++++ src/redist/targets/BuildCoreSdkTasks.targets | 1 + src/redist/targets/BundledTemplates.targets | 24 ++++++++++-- src/redist/targets/GenerateLayout.targets | 8 ++++ src/redist/targets/GenerateMSIs.targets | 6 ++- 6 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 src/core-sdk-tasks/GenerateMsiVersionFromFullVersion.cs diff --git a/eng/Versions.props b/eng/Versions.props index 0f9add583..957c8a55b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,6 @@ 1 $(VersionMajor).$(VersionMinor) $(MajorMinorVersion).$(VersionSDKMinor) - $(VersionPrefix)-$(PreReleaseVersionLabel)$(PreReleaseVersionIteration)-$(_BuildNumberLabels) diff --git a/src/core-sdk-tasks/GenerateMsiVersionFromFullVersion.cs b/src/core-sdk-tasks/GenerateMsiVersionFromFullVersion.cs new file mode 100644 index 000000000..12e85dd22 --- /dev/null +++ b/src/core-sdk-tasks/GenerateMsiVersionFromFullVersion.cs @@ -0,0 +1,38 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using NuGet.Versioning; + +namespace Microsoft.DotNet.Cli.Build +{ + public class GenerateMsiVersionFromFullVersion : Task + { + [Required] + public int VersionRevision { get; set; } + + [Required] + public string VersionMajorMinorPatch { get; set; } + + [Output] + public string MsiVersion { get; set; } + + public override bool Execute() + { + var parsedVersion = NuGetVersion.Parse(VersionMajorMinorPatch); + + var buildVersion = new Version() + { + Major = parsedVersion.Major, + Minor = parsedVersion.Minor, + Patch = parsedVersion.Patch, + VersionRevision = VersionRevision + }; + + MsiVersion = buildVersion.GenerateMsiVersion(); + + return true; + } + } +} diff --git a/src/redist/targets/BuildCoreSdkTasks.targets b/src/redist/targets/BuildCoreSdkTasks.targets index 7ffb389a9..ba697f3fd 100644 --- a/src/redist/targets/BuildCoreSdkTasks.targets +++ b/src/redist/targets/BuildCoreSdkTasks.targets @@ -26,6 +26,7 @@ + diff --git a/src/redist/targets/BundledTemplates.targets b/src/redist/targets/BundledTemplates.targets index 553bca59c..6c1301348 100644 --- a/src/redist/targets/BundledTemplates.targets +++ b/src/redist/targets/BundledTemplates.targets @@ -4,7 +4,6 @@ $(AspNetCorePackageVersionFor31Templates.IndexOf('-')) $(AspNetCorePackageVersionFor31Templates) $(AspNetCorePackageVersionFor31Templates.Substring(0, $(AspNetCore31VersionPreReleaseSeparator))) - $(AspNetCore31VersionMajorMinorPatchVersion).$(CombinedBuildNumberAndRevision) $(AspNetCore31VersionMajorMinorPatchVersion) $(BundledTemplates31InstallPath)-$(VersionSuffix) $([MSBuild]::Add($(AspNetCore31VersionMajorMinorPatchVersion.IndexOf('.')), 1)) @@ -14,7 +13,6 @@ $(AspNetCorePackageVersionFor30Templates.IndexOf('-')) $(AspNetCorePackageVersionFor30Templates) $(AspNetCorePackageVersionFor30Templates.Substring(0, $(AspNetCore30VersionPreReleaseSeparator))) - $(AspNetCore30VersionMajorMinorPatchVersion).$(CombinedBuildNumberAndRevision) $(AspNetCore30VersionMajorMinorPatchVersion) $(BundledTemplates30InstallPath)-$(VersionSuffix) $([MSBuild]::Add($(AspNetCore30VersionMajorMinorPatchVersion.IndexOf('.')), 1)) @@ -24,7 +22,6 @@ $(AspNetCorePackageVersionFor22Templates.IndexOf('-')) $(AspNetCorePackageVersionFor22Templates) $(AspNetCorePackageVersionFor22Templates.Substring(0, $(AspNetCore22VersionPreReleaseSeparator))) - $(AspNetCore22VersionMajorMinorPatchVersion).$(CombinedBuildNumberAndRevision) $(AspNetCore22VersionMajorMinorPatchVersion) $(BundledTemplates22InstallPath)-$(VersionSuffix) $([MSBuild]::Add($(AspNetCore22VersionMajorMinorPatchVersion.IndexOf('.')), 1)) @@ -34,13 +31,32 @@ $(AspNetCorePackageVersionFor21Templates.IndexOf('-')) $(AspNetCorePackageVersionFor21Templates) $(AspNetCorePackageVersionFor21Templates.Substring(0, $(AspNetCore21VersionPreReleaseSeparator))) - $(AspNetCore21VersionMajorMinorPatchVersion).$(CombinedBuildNumberAndRevision) $(AspNetCore21VersionMajorMinorPatchVersion) $(BundledTemplates21InstallPath)-$(VersionSuffix) $([MSBuild]::Add($(AspNetCore21VersionMajorMinorPatchVersion.IndexOf('.')), 1)) $(AspNetCore21VersionMajorMinorPatchVersion.IndexOf('.', $(Templates21VersionPatchSeparatorIndex))) $(AspNetCore21VersionMajorMinorPatchVersion.Substring(0, $(Templates21VersionPatchSeparatorIndex))) + + + + + + + + + + + + + + + + diff --git a/src/redist/targets/GenerateLayout.targets b/src/redist/targets/GenerateLayout.targets index bf6fd0c5b..7b80e5f9e 100644 --- a/src/redist/targets/GenerateLayout.targets +++ b/src/redist/targets/GenerateLayout.targets @@ -426,6 +426,13 @@ Overwrite="true" /> + + + $(VersionPrefix)-$(PreReleaseVersionLabel).$(PreReleaseVersionIteration) + $(FullNugetVersion).$(VersionSuffixDateStamp).$(VersionSuffixBuildOfTheDay) + + + @@ -481,6 +488,7 @@ DependsOnTargets="DownloadBundledComponents; CleanLayoutPath; LayoutBundledComponents; + GenerateFullNuGetVersion; GenerateVersionFile; GenerateBundledVersions; LayoutRuntimeGraph; diff --git a/src/redist/targets/GenerateMSIs.targets b/src/redist/targets/GenerateMSIs.targets index 3124f7021..92fe716ee 100644 --- a/src/redist/targets/GenerateMSIs.targets +++ b/src/redist/targets/GenerateMSIs.targets @@ -71,7 +71,11 @@ $(_PatchNumber) $(GitCommitCount) - $(VersionPrefix).$(CombinedBuildNumberAndRevision) + + + $(FileVersion) + + $(VersionPrefix).$(CombinedBuildNumberAndRevision)