Merge pull request #6573 from eerhardt/FixUpdateDependencies

Fix update dependencies
This commit is contained in:
Eric Erhardt 2017-05-11 16:02:48 -05:00 committed by GitHub
commit 7f50f322d5
11 changed files with 24 additions and 106 deletions

View file

@ -28,7 +28,7 @@
<!-- infrastructure and test only dependencies -->
<PropertyGroup>
<VersionToolsVersion>1.0.27-prerelease-01402-01</VersionToolsVersion>
<VersionToolsVersion>1.0.27-prerelease-01611-04</VersionToolsVersion>
<DotnetDebToolVersion>2.0.0-preview1-001877</DotnetDebToolVersion>
</PropertyGroup>
</Project>

View file

@ -45,8 +45,7 @@
<GenerateMsiVersion CommitCount="$(CommitCount)"
VersionMajor="$(VersionMajor)"
VersionMinor="$(VersionMinor)"
VersionPatch="$(VersionPatch)"
ReleaseSuffix="$(ReleaseSuffix)">
VersionPatch="$(VersionPatch)">
<Output TaskParameter="MsiVersion" PropertyName="MsiVersion" />
</GenerateMsiVersion>

View file

@ -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);
}
}
}
}

View file

@ -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
}
}

View file

@ -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
};

View file

@ -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}";
}
}

View file

@ -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()
{

View file

@ -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();
}
}
}

View file

@ -1,17 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<Import Project="..\..\build\DependencyVersions.props" />
<PropertyGroup>
<Description>Updates the repos dependencies</Description>
<OutputType>Exe</OutputType>
<TargetFramework>$(CliTargetFramework)</TargetFramework>
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.VersionTools" Version="$(VersionToolsVersion)" />
</ItemGroup>

View file

@ -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"

View file

@ -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