diff --git a/build/Microsoft.DotNet.Cli.GitCommitInfo.targets b/build/Microsoft.DotNet.Cli.GitCommitInfo.targets index fc50e0b66..60dd42d74 100644 --- a/build/Microsoft.DotNet.Cli.GitCommitInfo.targets +++ b/build/Microsoft.DotNet.Cli.GitCommitInfo.targets @@ -1,34 +1,24 @@ - + + + + + - - - - - - true + Condition=" '$(DefaultCommitCount)' != '$(GitInfoCommitCount)' Or + '$(CommitHash)' != '$(GitInfoCommitHash)' ">true <Project ToolsVersion="15.0"> <PropertyGroup> + <DefaultCommitCount>$(GitInfoCommitCount)</DefaultCommitCount> <CommitHash>$(GitInfoCommitHash)</CommitHash> - <CommitCount>$(GitInfoCommitCount)</CommitCount> - <MsiVersion>$(BuildInfoMsiVersion)</MsiVersion> - <VersionBadgeMoniker>$(BuildInfoVersionBadgeMoniker)</VersionBadgeMoniker> </PropertyGroup> </Project> diff --git a/build/Microsoft.DotNet.Cli.HostInfo.targets b/build/Microsoft.DotNet.Cli.HostInfo.targets index 507c99f17..095ac2c8d 100644 --- a/build/Microsoft.DotNet.Cli.HostInfo.targets +++ b/build/Microsoft.DotNet.Cli.HostInfo.targets @@ -3,7 +3,7 @@ Condition=" !Exists('$(HostInfoProps)') " DependsOnTargets="BuildDotnetCliBuildFramework"> - + diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index 7e4e03b61..19165e0ad 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -16,7 +16,6 @@ - False @@ -49,6 +48,11 @@ $(ReleaseSuffix)-$(CommitCount) $(VersionMajor).$(VersionMinor).$(VersionPatch)-$(VersionSuffix) + $(OSName)_$(Architecture) + Ubuntu_16_04_x64 + Fedora_23_x64 + openSUSE_13_2_x64 + $(BaseOutputDirectory)/$(VersionBadgeMoniker)_$(Configuration)_version_badge.svg $(NugetVersion) diff --git a/build/Microsoft.DotNet.Cli.tasks b/build/Microsoft.DotNet.Cli.tasks index 89c188c72..571ed3322 100644 --- a/build/Microsoft.DotNet.Cli.tasks +++ b/build/Microsoft.DotNet.Cli.tasks @@ -17,10 +17,11 @@ - + + diff --git a/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets b/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets index 365c15b9b..fb733e0ea 100644 --- a/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets +++ b/build/package/Microsoft.DotNet.Cli.Installer.MSI.targets @@ -31,6 +31,14 @@ + + + + diff --git a/build_projects/dotnet-cli-build/GenerateMsiVersion.cs b/build_projects/dotnet-cli-build/GenerateMsiVersion.cs new file mode 100644 index 000000000..8a4043628 --- /dev/null +++ b/build_projects/dotnet-cli-build/GenerateMsiVersion.cs @@ -0,0 +1,46 @@ +// 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 System.Runtime.InteropServices; + +namespace Microsoft.DotNet.Cli.Build +{ + public class GenerateMsiVersion : Task + { + [Required] + public int CommitCount { get; set; } + + [Required] + public int VersionMajor { get; set; } + + [Required] + public int VersionMinor { get; set; } + + [Required] + public int VersionPatch { get; set; } + + [Required] + public string ReleaseSuffix { get; set; } + + [Output] + public string MsiVersion { get; set; } + + public override bool Execute() + { + var buildVersion = new BuildVersion() + { + Major = VersionMajor, + Minor = VersionMinor, + Patch = VersionPatch, + ReleaseSuffix = ReleaseSuffix, + CommitCount = CommitCount + }; + + MsiVersion = buildVersion.GenerateMsiVersion(); + + return true; + } + } +} diff --git a/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs b/build_projects/dotnet-cli-build/GetCommitCount.cs similarity index 50% rename from build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs rename to build_projects/dotnet-cli-build/GetCommitCount.cs index b5704e095..a160792ce 100644 --- a/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs +++ b/build_projects/dotnet-cli-build/GetCommitCount.cs @@ -7,66 +7,11 @@ using System.Runtime.InteropServices; namespace Microsoft.DotNet.Cli.Build { - public class GenerateBuildVersionInfo : ToolTask + public class GetCommitCount : ToolTask { - [Required] - public string RepoRoot { get; set; } - - [Required] - public int VersionMajor { get; set; } - - [Required] - public int VersionMinor { get; set; } - - [Required] - public int VersionPatch { get; set; } - - [Required] - public string ReleaseSuffix { get; set; } - [Output] public string CommitCount { get; set; } - [Output] - public string VersionSuffix { get; set; } - - [Output] - public string SimpleVersion { get; set; } - - [Output] - public string NugetVersion { get; set; } - - [Output] - public string MsiVersion { get; set; } - - [Output] - public string VersionBadgeMoniker { get; set; } - - private int _commitCount; - - public override bool Execute() - { - base.Execute(); - - var buildVersion = new BuildVersion() - { - Major = VersionMajor, - Minor = VersionMinor, - Patch = VersionPatch, - ReleaseSuffix = ReleaseSuffix, - CommitCount = _commitCount - }; - - CommitCount = buildVersion.CommitCountString; - VersionSuffix = buildVersion.VersionSuffix; - SimpleVersion = buildVersion.SimpleVersion; - NugetVersion = buildVersion.NuGetVersion; - MsiVersion = buildVersion.GenerateMsiVersion(); - VersionBadgeMoniker = Monikers.GetBadgeMoniker(); - - return true; - } - protected override string ToolName { get { return "git"; } @@ -91,7 +36,12 @@ namespace Microsoft.DotNet.Cli.Build protected override void LogEventsFromTextOutput(string line, MessageImportance importance) { - _commitCount = int.Parse(line); + var buildVersion = new BuildVersion() + { + CommitCount = int.Parse(line) + }; + + CommitCount = buildVersion.CommitCountString; } } -} \ No newline at end of file +} diff --git a/build_projects/dotnet-cli-build/GetCommitHash.cs b/build_projects/dotnet-cli-build/GetCommitHash.cs index 7e31b45b9..69474f9c1 100644 --- a/build_projects/dotnet-cli-build/GetCommitHash.cs +++ b/build_projects/dotnet-cli-build/GetCommitHash.cs @@ -9,9 +9,6 @@ namespace Microsoft.DotNet.Cli.Build { public class GetCommitHash : ToolTask { - [Required] - public string RepoRoot { get; set; } - [Output] public string CommitHash { get; set; } @@ -42,4 +39,4 @@ namespace Microsoft.DotNet.Cli.Build CommitHash = line; } } -} \ No newline at end of file +} diff --git a/build_projects/dotnet-cli-build/GetCurrentRuntimeInformation.cs b/build_projects/dotnet-cli-build/GetCurrentRuntimeInformation.cs index 76e10d8ab..dbbeaa0de 100644 --- a/build_projects/dotnet-cli-build/GetCurrentRuntimeInformation.cs +++ b/build_projects/dotnet-cli-build/GetCurrentRuntimeInformation.cs @@ -9,8 +9,6 @@ namespace Microsoft.DotNet.Cli.Build { public class GetCurrentRuntimeInformation : Task { - public string OverrideRid { get; set; } - [Output] public string Rid { get; set; } @@ -22,7 +20,7 @@ namespace Microsoft.DotNet.Cli.Build public override bool Execute() { - Rid = string.IsNullOrEmpty(OverrideRid) ? RuntimeEnvironment.GetRuntimeIdentifier() : OverrideRid; + Rid = RuntimeEnvironment.GetRuntimeIdentifier(); Architecture = RuntimeEnvironment.RuntimeArchitecture; OSName = Monikers.GetOSShortName();