Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit f82fa91

Browse files
committed
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.
1 parent 928c510 commit f82fa91

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

build/DependencyVersions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<!-- infrastructure and test only dependencies -->
3030
<PropertyGroup>
31-
<VersionToolsVersion>1.0.27-prerelease-01402-01</VersionToolsVersion>
31+
<VersionToolsVersion>1.0.27-prerelease-01611-04</VersionToolsVersion>
3232
<DotnetDebToolVersion>2.0.0-preview1-001877</DotnetDebToolVersion>
3333
</PropertyGroup>
3434
</Project>

build_projects/update-dependencies/Program.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Copyright (c) .NET Foundation and contributors. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
using Microsoft.DotNet.Cli.Utils;
54
using Microsoft.DotNet.VersionTools;
65
using Microsoft.DotNet.VersionTools.Automation;
76
using Microsoft.DotNet.VersionTools.Dependencies;
87
using System;
98
using System.Collections.Generic;
9+
using System.Diagnostics;
1010
using System.IO;
1111
using System.Linq;
1212
using System.Text.RegularExpressions;
@@ -19,7 +19,7 @@ public class Program
1919

2020
public static void Main(string[] args)
2121
{
22-
DebugHelper.HandleDebugSwitch(ref args);
22+
HandleDebugSwitch(ref args);
2323

2424
bool onlyUpdate = args.Length > 0 && string.Equals("--Update", args[0], StringComparison.OrdinalIgnoreCase);
2525

@@ -96,5 +96,21 @@ private static IDependencyUpdater CreateRegexUpdater(string repoRelativePath, st
9696
VersionGroupName = "version"
9797
};
9898
}
99+
100+
private static void HandleDebugSwitch(ref string[] args)
101+
{
102+
if (args.Length > 0 && string.Equals("--debug", args[0], StringComparison.OrdinalIgnoreCase))
103+
{
104+
args = args.Skip(1).ToArray();
105+
WaitForDebugger();
106+
}
107+
}
108+
109+
private static void WaitForDebugger()
110+
{
111+
Console.WriteLine("Waiting for debugger to attach. Press ENTER to continue");
112+
Console.WriteLine($"Process ID: {Process.GetCurrentProcess().Id}");
113+
Console.ReadLine();
114+
}
99115
}
100116
}

build_projects/update-dependencies/update-dependencies.csproj

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2-
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
2+
<Import Project="..\..\build\DependencyVersions.props" />
33

44
<PropertyGroup>
55
<Description>Updates the repos dependencies</Description>
66
<OutputType>Exe</OutputType>
7-
<TargetFramework>$(CliTargetFramework)</TargetFramework>
8-
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
7+
<TargetFramework>netcoreapp2.0</TargetFramework>
98
</PropertyGroup>
109

11-
<ItemGroup>
12-
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj" />
13-
</ItemGroup>
14-
1510
<ItemGroup>
1611
<PackageReference Include="Microsoft.DotNet.VersionTools" Version="$(VersionToolsVersion)" />
1712
</ItemGroup>

build_projects/update-dependencies/update-dependencies.ps1

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
4242
# Put the stage0 on the path
4343
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
4444

45-
# Generate some props files that are imported by update-dependencies
46-
Write-Host "Generating property files..."
47-
dotnet msbuild $RepoRoot\build.proj /p:Architecture=$Architecture /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles
48-
if($LASTEXITCODE -ne 0) { throw "Failed to generate intermidates" }
49-
5045
# Restore the app
5146
Write-Host "Restoring $ProjectPath..."
5247
dotnet restore "$ProjectPath"

build_projects/update-dependencies/update-dependencies.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ fi
4242
# Put the stage 0 on the path
4343
export PATH=$DOTNET_INSTALL_DIR:$PATH
4444

45-
# Generate some props files that are imported by update-dependencies
46-
echo "Generating property files..."
47-
dotnet msbuild "$REPO_ROOT/build.proj" /p:Architecture=x64 /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles
48-
49-
echo "Resotring $PROJECT_PATH..."
45+
echo "Restoring $PROJECT_PATH..."
5046
dotnet restore "$PROJECT_PATH"
5147

5248
if [ $? -ne 0 ]; then

0 commit comments

Comments
 (0)