From 928c510c84e642729b46ce253f4853b57475055b Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 11 May 2017 08:59:38 -0500 Subject: [PATCH 1/2] Clean up unused build code. --- build/package/Installer.MSI.targets | 3 +- .../CurrentArchitecture.cs | 53 ------------------- .../Enumerations/BuildArchitecture.cs | 11 ---- .../dotnet-cli-build/GenerateMsiVersion.cs | 7 +-- .../Utils/BuildVersion.cs | 12 ----- .../Utils/Version.cs | 2 - 6 files changed, 2 insertions(+), 86 deletions(-) delete mode 100644 build_projects/Microsoft.DotNet.Cli.Build.Framework/CurrentArchitecture.cs delete mode 100644 build_projects/Microsoft.DotNet.Cli.Build.Framework/Enumerations/BuildArchitecture.cs delete mode 100644 build_projects/shared-build-targets-utils/Utils/BuildVersion.cs diff --git a/build/package/Installer.MSI.targets b/build/package/Installer.MSI.targets index c11174f2d..7154f10d6 100644 --- a/build/package/Installer.MSI.targets +++ b/build/package/Installer.MSI.targets @@ -45,8 +45,7 @@ + VersionPatch="$(VersionPatch)"> diff --git a/build_projects/Microsoft.DotNet.Cli.Build.Framework/CurrentArchitecture.cs b/build_projects/Microsoft.DotNet.Cli.Build.Framework/CurrentArchitecture.cs deleted file mode 100644 index a6b90cc63..000000000 --- a/build_projects/Microsoft.DotNet.Cli.Build.Framework/CurrentArchitecture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// 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 System; -using Microsoft.DotNet.PlatformAbstractions; - -namespace Microsoft.DotNet.Cli.Build.Framework -{ - public static class CurrentArchitecture - { - public static BuildArchitecture Current - { - get - { - return DetermineCurrentArchitecture(); - } - } - - public static bool Isx86 - { - get - { - var archName = RuntimeEnvironment.RuntimeArchitecture; - return string.Equals(archName, "x86", StringComparison.OrdinalIgnoreCase); - } - } - - public static bool Isx64 - { - get - { - var archName = RuntimeEnvironment.RuntimeArchitecture; - return string.Equals(archName, "x64", StringComparison.OrdinalIgnoreCase); - } - } - - private static BuildArchitecture DetermineCurrentArchitecture() - { - if (Isx86) - { - return BuildArchitecture.x86; - } - else if (Isx64) - { - return BuildArchitecture.x64; - } - else - { - return default(BuildArchitecture); - } - } - } -} diff --git a/build_projects/Microsoft.DotNet.Cli.Build.Framework/Enumerations/BuildArchitecture.cs b/build_projects/Microsoft.DotNet.Cli.Build.Framework/Enumerations/BuildArchitecture.cs deleted file mode 100644 index d5d50ee6f..000000000 --- a/build_projects/Microsoft.DotNet.Cli.Build.Framework/Enumerations/BuildArchitecture.cs +++ /dev/null @@ -1,11 +0,0 @@ -// 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. - -namespace Microsoft.DotNet.Cli.Build.Framework -{ - public enum BuildArchitecture - { - x86 = 1, - x64 = 2 - } -} diff --git a/build_projects/dotnet-cli-build/GenerateMsiVersion.cs b/build_projects/dotnet-cli-build/GenerateMsiVersion.cs index 8a4043628..3c03a0a00 100644 --- a/build_projects/dotnet-cli-build/GenerateMsiVersion.cs +++ b/build_projects/dotnet-cli-build/GenerateMsiVersion.cs @@ -3,7 +3,6 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -using System.Runtime.InteropServices; namespace Microsoft.DotNet.Cli.Build { @@ -21,20 +20,16 @@ namespace Microsoft.DotNet.Cli.Build [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() + var buildVersion = new Version() { Major = VersionMajor, Minor = VersionMinor, Patch = VersionPatch, - ReleaseSuffix = ReleaseSuffix, CommitCount = CommitCount }; diff --git a/build_projects/shared-build-targets-utils/Utils/BuildVersion.cs b/build_projects/shared-build-targets-utils/Utils/BuildVersion.cs deleted file mode 100644 index ba43dddcc..000000000 --- a/build_projects/shared-build-targets-utils/Utils/BuildVersion.cs +++ /dev/null @@ -1,12 +0,0 @@ -// 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 System.Collections.Generic; - -namespace Microsoft.DotNet.Cli.Build -{ - public class BuildVersion : Version - { - public string VersionSuffix => $"{ReleaseSuffix}-{CommitCountString}"; - } -} diff --git a/build_projects/shared-build-targets-utils/Utils/Version.cs b/build_projects/shared-build-targets-utils/Utils/Version.cs index cc2ec209b..b7d4e7536 100644 --- a/build_projects/shared-build-targets-utils/Utils/Version.cs +++ b/build_projects/shared-build-targets-utils/Utils/Version.cs @@ -9,8 +9,6 @@ namespace Microsoft.DotNet.Cli.Build public virtual int Minor { get; set; } public virtual int Patch { get; set; } public virtual int CommitCount { get; set; } - public virtual string CommitCountString => CommitCount.ToString("000000"); - public virtual string ReleaseSuffix { get; set; } public string GenerateMsiVersion() { From f82fa91f5812db04aa4a2d0c35ab183f44f5e671 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 11 May 2017 10:15:05 -0500 Subject: [PATCH 2/2] Fix update-dependencies by slimming it way down. It can no longer be dependent on Cli.Utils, since that will affect which version of NuGet gets used. It's better for this small console app to just depend on VersionTools. --- build/DependencyVersions.props | 2 +- build_projects/update-dependencies/Program.cs | 20 +++++++++++++++++-- .../update-dependencies.csproj | 9 ++------- .../update-dependencies.ps1 | 5 ----- .../update-dependencies.sh | 6 +----- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index ea9624f6f..a99e809e8 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -28,7 +28,7 @@ - 1.0.27-prerelease-01402-01 + 1.0.27-prerelease-01611-04 2.0.0-preview1-001877 diff --git a/build_projects/update-dependencies/Program.cs b/build_projects/update-dependencies/Program.cs index 296ad2d0a..e256564d6 100644 --- a/build_projects/update-dependencies/Program.cs +++ b/build_projects/update-dependencies/Program.cs @@ -1,12 +1,12 @@ // 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.DotNet.Cli.Utils; using Microsoft.DotNet.VersionTools; using Microsoft.DotNet.VersionTools.Automation; using Microsoft.DotNet.VersionTools.Dependencies; using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Scripts public static void Main(string[] args) { - DebugHelper.HandleDebugSwitch(ref args); + HandleDebugSwitch(ref args); bool onlyUpdate = args.Length > 0 && string.Equals("--Update", args[0], StringComparison.OrdinalIgnoreCase); @@ -96,5 +96,21 @@ namespace Microsoft.DotNet.Scripts VersionGroupName = "version" }; } + + private static void HandleDebugSwitch(ref string[] args) + { + if (args.Length > 0 && string.Equals("--debug", args[0], StringComparison.OrdinalIgnoreCase)) + { + args = args.Skip(1).ToArray(); + WaitForDebugger(); + } + } + + private static void WaitForDebugger() + { + Console.WriteLine("Waiting for debugger to attach. Press ENTER to continue"); + Console.WriteLine($"Process ID: {Process.GetCurrentProcess().Id}"); + Console.ReadLine(); + } } } diff --git a/build_projects/update-dependencies/update-dependencies.csproj b/build_projects/update-dependencies/update-dependencies.csproj index 3fa31e791..2f82553fe 100644 --- a/build_projects/update-dependencies/update-dependencies.csproj +++ b/build_projects/update-dependencies/update-dependencies.csproj @@ -1,17 +1,12 @@  - + Updates the repos dependencies Exe - $(CliTargetFramework) - false + netcoreapp2.0 - - - - diff --git a/build_projects/update-dependencies/update-dependencies.ps1 b/build_projects/update-dependencies/update-dependencies.ps1 index 5a9760ecb..8eafc53c1 100644 --- a/build_projects/update-dependencies/update-dependencies.ps1 +++ b/build_projects/update-dependencies/update-dependencies.ps1 @@ -42,11 +42,6 @@ if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" } # Put the stage0 on the path $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" -# Generate some props files that are imported by update-dependencies -Write-Host "Generating property files..." -dotnet msbuild $RepoRoot\build.proj /p:Architecture=$Architecture /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles -if($LASTEXITCODE -ne 0) { throw "Failed to generate intermidates" } - # Restore the app Write-Host "Restoring $ProjectPath..." dotnet restore "$ProjectPath" diff --git a/build_projects/update-dependencies/update-dependencies.sh b/build_projects/update-dependencies/update-dependencies.sh index ccfb06831..4781c8453 100755 --- a/build_projects/update-dependencies/update-dependencies.sh +++ b/build_projects/update-dependencies/update-dependencies.sh @@ -42,11 +42,7 @@ fi # Put the stage 0 on the path export PATH=$DOTNET_INSTALL_DIR:$PATH -# Generate some props files that are imported by update-dependencies -echo "Generating property files..." -dotnet msbuild "$REPO_ROOT/build.proj" /p:Architecture=x64 /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles - -echo "Resotring $PROJECT_PATH..." +echo "Restoring $PROJECT_PATH..." dotnet restore "$PROJECT_PATH" if [ $? -ne 0 ]; then