From c481ad9cdc9d01d9cb33b9ddf9b06b862c12adaf Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Tue, 10 Jan 2017 17:31:43 -0600 Subject: [PATCH] Merge all hard-coded versions and version suffixes to be defined in a single spot. --- .../dotnet-dependency-tool-invoker.csproj | 4 +- branchinfo.txt | 9 ---- build/Microsoft.DotNet.Cli.Prepare.targets | 16 +++---- .../Microsoft.DotNet.Cli.Nupkg.targets | 2 +- build/test/TestPackageProjects.targets | 2 +- .../GenerateBuildVersionInfo.cs | 34 +++++--------- .../Utils/BranchInfo.cs | 45 ------------------- .../Utils/BuildVersion.cs | 2 - dir.props | 8 ++++ run-build.ps1 | 8 ---- run-build.sh | 8 ---- .../Microsoft.DotNet.Archive.csproj | 2 +- .../Microsoft.DotNet.Cli.Sln.Internal.csproj | 2 +- .../Microsoft.DotNet.Cli.Utils.csproj | 2 +- .../Microsoft.DotNet.Configurer.csproj | 2 +- ...crosoft.DotNet.ProjectJsonMigration.csproj | 2 +- .../Microsoft.DotNet.TestFramework.csproj | 2 +- src/dotnet/dotnet.csproj | 2 +- src/redist/redist.csproj | 2 +- src/tool_msbuild/tool_msbuild.csproj | 2 +- src/tool_nuget/tool_nuget.csproj | 2 +- src/tool_roslyn/tool_roslyn.csproj | 2 +- 22 files changed, 40 insertions(+), 120 deletions(-) delete mode 100644 branchinfo.txt delete mode 100644 build_projects/shared-build-targets-utils/Utils/BranchInfo.cs diff --git a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj index 4ca756e18..5a02e8d3c 100644 --- a/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj +++ b/TestAssets/TestPackages/dotnet-dependency-tool-invoker/dotnet-dependency-tool-invoker.csproj @@ -1,4 +1,6 @@  + + 1.0.0-rc netcoreapp1.0 @@ -8,7 +10,7 @@ - 1.0.0-preview5-* + $(CliVersionPrefix)-* diff --git a/branchinfo.txt b/branchinfo.txt deleted file mode 100644 index 8fb164f24..000000000 --- a/branchinfo.txt +++ /dev/null @@ -1,9 +0,0 @@ -# This is a file containing environment variables specific to this branch -# Any line that is not blank and does not start with '#' is interpreted as a variable to set -# Each line is expected to be in the format "[Name]=[Value]". -MAJOR_VERSION=2 -MINOR_VERSION=0 -PATCH_VERSION=0 -RELEASE_SUFFIX=alpha -CHANNEL=master -BRANCH_NAME=master diff --git a/build/Microsoft.DotNet.Cli.Prepare.targets b/build/Microsoft.DotNet.Cli.Prepare.targets index b7b34b8a3..4c31151c4 100644 --- a/build/Microsoft.DotNet.Cli.Prepare.targets +++ b/build/Microsoft.DotNet.Cli.Prepare.targets @@ -49,19 +49,17 @@ - - - - + - - - @@ -72,9 +70,7 @@ $(BaseOutputDirectory)/$(VersionBadgeMoniker)_$(Configuration)_version_badge.svg $(NugetVersion) - $(VersionMajor).$(VersionMinor).$(VersionPatch)-preview5-$(CommitCount) - $(VersionMajor).$(VersionMinor).$(VersionPatch)-rc4-$(CommitCount) - $(VersionMajor).$(VersionMinor).1-beta-$(CommitCount) + $(SdkVersion) .zip .tar.gz diff --git a/build/package/Microsoft.DotNet.Cli.Nupkg.targets b/build/package/Microsoft.DotNet.Cli.Nupkg.targets index 623838bed..0464b23a0 100644 --- a/build/package/Microsoft.DotNet.Cli.Nupkg.targets +++ b/build/package/Microsoft.DotNet.Cli.Nupkg.targets @@ -26,7 +26,7 @@ Output="$(NupkgOutputDirectory)" ProjectPath="%(ProjectsToPack.Identity)/%(ProjectsToPack.ProjectName).csproj" ToolPath="$(Stage0Directory)" - VersionSuffix="preview5-$(NupkgVersionSuffix)" + VersionSuffix="$(ReleaseSuffix)-$(NupkgVersionSuffix)" Configuration="$(Configuration)" /> diff --git a/build/test/TestPackageProjects.targets b/build/test/TestPackageProjects.targets index 34f6b4e66..bec592521 100644 --- a/build/test/TestPackageProjects.targets +++ b/build/test/TestPackageProjects.targets @@ -76,7 +76,7 @@ True True $(CliVersionPrefix)- - rc3-$(TestPackageBuildVersionSuffix) + $(ReleaseSuffix)-$(TestPackageBuildVersionSuffix) False netstandard1.5 diff --git a/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs b/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs index 212eabc97..b5704e095 100644 --- a/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs +++ b/build_projects/dotnet-cli-build/GenerateBuildVersionInfo.cs @@ -12,21 +12,21 @@ namespace Microsoft.DotNet.Cli.Build [Required] public string RepoRoot { get; set; } - [Output] + [Required] public int VersionMajor { get; set; } - [Output] + [Required] public int VersionMinor { get; set; } - [Output] + [Required] public int VersionPatch { get; set; } + [Required] + public string ReleaseSuffix { get; set; } + [Output] public string CommitCount { get; set; } - [Output] - public string ReleaseSuffix { get; set; } - [Output] public string VersionSuffix { get; set; } @@ -42,41 +42,27 @@ namespace Microsoft.DotNet.Cli.Build [Output] public string VersionBadgeMoniker { get; set; } - [Output] - public string Channel { get; set; } - - [Output] - public string BranchName { get; set; } - private int _commitCount; public override bool Execute() { base.Execute(); - var branchInfo = new BranchInfo(RepoRoot); - var buildVersion = new BuildVersion() { - Major = int.Parse(branchInfo.Entries["MAJOR_VERSION"]), - Minor = int.Parse(branchInfo.Entries["MINOR_VERSION"]), - Patch = int.Parse(branchInfo.Entries["PATCH_VERSION"]), - ReleaseSuffix = branchInfo.Entries["RELEASE_SUFFIX"], + Major = VersionMajor, + Minor = VersionMinor, + Patch = VersionPatch, + ReleaseSuffix = ReleaseSuffix, CommitCount = _commitCount }; - VersionMajor = buildVersion.Major; - VersionMinor = buildVersion.Minor; - VersionPatch = buildVersion.Patch; CommitCount = buildVersion.CommitCountString; - ReleaseSuffix = buildVersion.ReleaseSuffix; VersionSuffix = buildVersion.VersionSuffix; SimpleVersion = buildVersion.SimpleVersion; NugetVersion = buildVersion.NuGetVersion; MsiVersion = buildVersion.GenerateMsiVersion(); VersionBadgeMoniker = Monikers.GetBadgeMoniker(); - Channel = branchInfo.Entries["CHANNEL"]; - BranchName= branchInfo.Entries["BRANCH_NAME"]; return true; } diff --git a/build_projects/shared-build-targets-utils/Utils/BranchInfo.cs b/build_projects/shared-build-targets-utils/Utils/BranchInfo.cs deleted file mode 100644 index 8f8d11db9..000000000 --- a/build_projects/shared-build-targets-utils/Utils/BranchInfo.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Text; -using Microsoft.DotNet.Cli.Build.Framework; -using Microsoft.WindowsAzure.Storage; -using Microsoft.WindowsAzure.Storage.Blob; - -namespace Microsoft.DotNet.Cli.Build -{ - public class BranchInfo - { - private static readonly string s_branchInfoFileName = "branchinfo.txt"; - - private string _repoRoot; - private string _branchInfoFile; - - public IDictionary Entries { get; set; } - - public BranchInfo(string repoRoot) - { - _repoRoot = repoRoot; - _branchInfoFile = Path.Combine(_repoRoot, s_branchInfoFileName); - - Entries = ReadBranchInfo(_branchInfoFile); - } - - private IDictionary ReadBranchInfo(string path) - { - var lines = File.ReadAllLines(path); - var dict = new Dictionary(); - foreach (var line in lines) - { - if (!line.Trim().StartsWith("#") && !string.IsNullOrWhiteSpace(line)) - { - var splat = line.Split(new[] { '=' }, 2); - dict[splat[0]] = splat[1]; - } - } - return dict; - } - } -} diff --git a/build_projects/shared-build-targets-utils/Utils/BuildVersion.cs b/build_projects/shared-build-targets-utils/Utils/BuildVersion.cs index d3789dfd3..9d056b010 100644 --- a/build_projects/shared-build-targets-utils/Utils/BuildVersion.cs +++ b/build_projects/shared-build-targets-utils/Utils/BuildVersion.cs @@ -7,7 +7,5 @@ namespace Microsoft.DotNet.Cli.Build public string SimpleVersion => $"{Major}.{Minor}.{Patch}.{CommitCountString}"; public string VersionSuffix => $"{ReleaseSuffix}-{CommitCountString}"; public string NuGetVersion => $"{Major}.{Minor}.{Patch}-{VersionSuffix}"; - public string NetCoreAppVersion => $"{Major}.{Minor}.{Patch}-rc3-{CommitCountString}"; - public string ProductionVersion => $"{Major}.{Minor}.{Patch}"; } } diff --git a/dir.props b/dir.props index d0c1fdfa8..c0392bbda 100644 --- a/dir.props +++ b/dir.props @@ -12,5 +12,13 @@ true + 2 + 0 + 0 + alpha + master + master + $(VersionMajor).$(VersionMinor).$(VersionPatch)-$(ReleaseSuffix) + diff --git a/run-build.ps1 b/run-build.ps1 index 3e16346ce..5a1b2843e 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -40,14 +40,6 @@ else $env:DOTNET_BUILD_SKIP_PACKAGING=0 } -# Load Branch Info -cat "$RepoRoot\branchinfo.txt" | ForEach-Object { - if(!$_.StartsWith("#") -and ![String]::IsNullOrWhiteSpace($_)) { - $splat = $_.Split([char[]]@("="), 2) - Set-Content "env:\$($splat[0])" -Value $splat[1] - } -} - # Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot if (!$env:DOTNET_INSTALL_DIR_PJ) { diff --git a/run-build.sh b/run-build.sh index 399099364..256527faa 100755 --- a/run-build.sh +++ b/run-build.sh @@ -120,14 +120,6 @@ done temp="${args[@]}" args=($temp) -# Load Branch Info -while read line; do - if [[ $line != \#* ]]; then - IFS='=' read -ra splat <<< "$line" - export ${splat[0]}="${splat[1]}" - fi -done < "$REPOROOT/branchinfo.txt" - # Use a repo-local install directory (but not the artifacts directory because that gets cleaned a lot [ -z "$DOTNET_INSTALL_DIR_PJ" ] && export DOTNET_INSTALL_DIR_PJ=$REPOROOT/.dotnet_stage0PJ/$ARCHITECTURE [ -d "$DOTNET_INSTALL_DIR_PJ" ] || mkdir -p $DOTNET_INSTALL_DIR_PJ diff --git a/src/Microsoft.DotNet.Archive/Microsoft.DotNet.Archive.csproj b/src/Microsoft.DotNet.Archive/Microsoft.DotNet.Archive.csproj index 90c84d19a..dcb0a221c 100644 --- a/src/Microsoft.DotNet.Archive/Microsoft.DotNet.Archive.csproj +++ b/src/Microsoft.DotNet.Archive/Microsoft.DotNet.Archive.csproj @@ -3,7 +3,7 @@ Archive and compression types. - 1.0.0-preview5 + $(CliVersionPrefix) netstandard1.3 ../../tools/Key.snk true diff --git a/src/Microsoft.DotNet.Cli.Sln.Internal/Microsoft.DotNet.Cli.Sln.Internal.csproj b/src/Microsoft.DotNet.Cli.Sln.Internal/Microsoft.DotNet.Cli.Sln.Internal.csproj index 368c98b3a..215c6a5e5 100644 --- a/src/Microsoft.DotNet.Cli.Sln.Internal/Microsoft.DotNet.Cli.Sln.Internal.csproj +++ b/src/Microsoft.DotNet.Cli.Sln.Internal/Microsoft.DotNet.Cli.Sln.Internal.csproj @@ -3,7 +3,7 @@ SLN file reader/writer - 1.0.0-preview5 + $(CliVersionPrefix) netstandard1.6 portable Microsoft.DotNet.Cli.Sln.Internal diff --git a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj index f6337cf28..ce5308d98 100644 --- a/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj +++ b/src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj @@ -2,7 +2,7 @@ - 1.0.0-preview5 + $(CliVersionPrefix) netstandard1.5;net46 true ../../tools/Key.snk diff --git a/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj b/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj index 27792ffdf..1b39817e3 100644 --- a/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj +++ b/src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj @@ -2,7 +2,7 @@ - 1.0.0-rc3 + $(CliVersionPrefix) netstandard1.5 true ../../tools/Key.snk diff --git a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj index 99d86def9..fc987fa3d 100644 --- a/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj +++ b/src/Microsoft.DotNet.ProjectJsonMigration/Microsoft.DotNet.ProjectJsonMigration.csproj @@ -2,7 +2,7 @@ - 1.0.0-preview5 + $(CliVersionPrefix) netcoreapp1.0 true ../../tools/Key.snk diff --git a/src/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj b/src/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj index 90a401f2a..df14f600d 100644 --- a/src/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj +++ b/src/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj @@ -3,7 +3,7 @@ Microsoft.DotNet.TestFramework Class Library - 1.0.0-preview5 + $(CliVersionPrefix) netstandard1.5;net46 ../../tools/Key.snk true diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index a15a1c99b..cf444ff04 100755 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -2,7 +2,7 @@ - 1.0.0-preview5 + $(CliVersionPrefix) netcoreapp1.0 dotnet Exe diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index 7711edecb..5c0c36e2d 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -2,7 +2,7 @@ - 1.0.0-preview5 + $(CliVersionPrefix) netcoreapp1.0 true $(PackageTargetFallback);dotnet5.4 diff --git a/src/tool_msbuild/tool_msbuild.csproj b/src/tool_msbuild/tool_msbuild.csproj index 06fb5ebb0..40082b920 100644 --- a/src/tool_msbuild/tool_msbuild.csproj +++ b/src/tool_msbuild/tool_msbuild.csproj @@ -2,7 +2,7 @@ - 1.0.0-preview5 + $(CliVersionPrefix) netcoreapp1.0 diff --git a/src/tool_nuget/tool_nuget.csproj b/src/tool_nuget/tool_nuget.csproj index 36c74b48b..ef70fa8e6 100644 --- a/src/tool_nuget/tool_nuget.csproj +++ b/src/tool_nuget/tool_nuget.csproj @@ -2,7 +2,7 @@ - 1.0.0-preview5 + $(CliVersionPrefix) netcoreapp1.0 diff --git a/src/tool_roslyn/tool_roslyn.csproj b/src/tool_roslyn/tool_roslyn.csproj index 9b9965d49..3f52caad6 100644 --- a/src/tool_roslyn/tool_roslyn.csproj +++ b/src/tool_roslyn/tool_roslyn.csproj @@ -3,7 +3,7 @@ - 1.0.0-preview5 + $(CliVersionPrefix) netcoreapp1.0 true