|
| 1 | +From a863f87ecea0409679839a7e28fe225df4c47948 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Viktor Hofer < [email protected]> |
| 3 | +Date: Tue, 4 Feb 2025 09:49:00 +0100 |
| 4 | +Subject: [PATCH] Revert "update System.CommandLine (#15474)" |
| 5 | + |
| 6 | +This temporarily reverts https://github.com/dotnet/arcade/pull/15474 |
| 7 | +to unblock dependency flow. |
| 8 | + |
| 9 | +--- |
| 10 | + eng/Version.Details.xml | 8 ++--- |
| 11 | + eng/Versions.props | 2 +- |
| 12 | + src/Microsoft.DotNet.MacOsPkg/Program.cs | 30 +++++++++---------- |
| 13 | + .../Program.cs | 12 ++++---- |
| 14 | + 4 files changed, 26 insertions(+), 26 deletions(-) |
| 15 | + |
| 16 | +diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml |
| 17 | +index 89de117bd..3a977442b 100644 |
| 18 | +--- a/eng/Version.Details.xml |
| 19 | ++++ b/eng/Version.Details.xml |
| 20 | +@@ -138,9 +138,9 @@ |
| 21 | + <SourceBuild RepoName="arcade" ManagedOnly="true" /> |
| 22 | + </Dependency> |
| 23 | + <!-- Intermediate is necessary for source build. --> |
| 24 | +- <Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.607201"> |
| 25 | ++ <Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.512601"> |
| 26 | + <Uri>https://github.com/dotnet/command-line-api</Uri> |
| 27 | +- <Sha>060374e56c1b2e741b6525ca8417006efb54fbd7</Sha> |
| 28 | ++ <Sha>5ea97af07263ea3ef68a18557c8aa3f7e3200bda</Sha> |
| 29 | + <SourceBuild RepoName="command-line-api" ManagedOnly="true" /> |
| 30 | + </Dependency> |
| 31 | + <!-- Intermediate is necessary for source build. --> |
| 32 | +@@ -178,9 +178,9 @@ |
| 33 | + <Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-runtime</Uri> |
| 34 | + <Sha>990ebf52fc408ca45929fd176d2740675a67fab8</Sha> |
| 35 | + </Dependency> |
| 36 | +- <Dependency Name="System.CommandLine" Version="2.0.0-beta4.25072.1"> |
| 37 | ++ <Dependency Name="System.CommandLine" Version="2.0.0-beta4.24126.1"> |
| 38 | + <Uri>https://github.com/dotnet/command-line-api</Uri> |
| 39 | +- <Sha>060374e56c1b2e741b6525ca8417006efb54fbd7</Sha> |
| 40 | ++ <Sha>5ea97af07263ea3ef68a18557c8aa3f7e3200bda</Sha> |
| 41 | + </Dependency> |
| 42 | + <!-- Transitive dependency needed for source build. --> |
| 43 | + <Dependency Name="System.Reflection.Metadata" Version="9.0.0-rc.2.24473.5"> |
| 44 | +diff --git a/eng/Versions.props b/eng/Versions.props |
| 45 | +index c31b6a103..24590737d 100644 |
| 46 | +--- a/eng/Versions.props |
| 47 | ++++ b/eng/Versions.props |
| 48 | +@@ -15,7 +15,7 @@ |
| 49 | + <MicrosoftDotNetProductConstructionServiceClientVersion>1.1.0-beta.25081.4</MicrosoftDotNetProductConstructionServiceClientVersion> |
| 50 | + <MicrosoftDotNetMaestroTasksVersion>1.1.0-beta.25081.4</MicrosoftDotNetMaestroTasksVersion> |
| 51 | + <!-- command-line-api --> |
| 52 | +- <SystemCommandLineVersion>2.0.0-beta4.25072.1</SystemCommandLineVersion> |
| 53 | ++ <SystemCommandLineVersion>2.0.0-beta4.24126.1</SystemCommandLineVersion> |
| 54 | + <!-- corefx --> |
| 55 | + <MicrosoftBclHashCodeVersion>1.1.1</MicrosoftBclHashCodeVersion> |
| 56 | + <SystemMemoryVersion Condition="'$(DotNetBuildSourceOnly)' != 'true'">4.5.5</SystemMemoryVersion> |
| 57 | +diff --git a/src/Microsoft.DotNet.MacOsPkg/Program.cs b/src/Microsoft.DotNet.MacOsPkg/Program.cs |
| 58 | +index 3357d4967..90f13e41a 100644 |
| 59 | +--- a/src/Microsoft.DotNet.MacOsPkg/Program.cs |
| 60 | ++++ b/src/Microsoft.DotNet.MacOsPkg/Program.cs |
| 61 | +@@ -26,20 +26,20 @@ public static int Main(string[] args) |
| 62 | + return 1; |
| 63 | + } |
| 64 | + |
| 65 | +- RootCommand rootCommand = Setup(); |
| 66 | +- return new CommandLineConfiguration(rootCommand).Invoke(args); |
| 67 | ++ CliRootCommand rootCommand = Setup(); |
| 68 | ++ return new CliConfiguration(rootCommand).Invoke(args); |
| 69 | + } |
| 70 | + |
| 71 | + /// <summary> |
| 72 | + /// Set up the command line interface and associated actions. |
| 73 | + /// </summary> |
| 74 | + /// <returns>Root cli command</returns> |
| 75 | +- private static RootCommand Setup() |
| 76 | ++ private static CliRootCommand Setup() |
| 77 | + { |
| 78 | +- var rootCommand = new RootCommand(); |
| 79 | +- var unpackSrcArgument = new Argument<string>("src") { Description = "Source path of the .pkg or .app file" }; |
| 80 | +- var unpackDestinationArgument = new Argument<string>("dst") { Description = "Destination path to unpack the file" }; |
| 81 | +- var unpackCommand = new Command("unpack", "Unpack a .pkg or .app file") |
| 82 | ++ var rootCommand = new CliRootCommand(); |
| 83 | ++ var unpackSrcArgument = new CliArgument<string>("src") { Description = "Source path of the .pkg or .app file" }; |
| 84 | ++ var unpackDestinationArgument = new CliArgument<string>("dst") { Description = "Destination path to unpack the file" }; |
| 85 | ++ var unpackCommand = new CliCommand("unpack", "Unpack a .pkg or .app file") |
| 86 | + { |
| 87 | + Arguments = { unpackSrcArgument, unpackDestinationArgument } |
| 88 | + }; |
| 89 | +@@ -48,9 +48,9 @@ private static RootCommand Setup() |
| 90 | + return UnpackCommand(result, unpackSrcArgument, unpackDestinationArgument); |
| 91 | + }); |
| 92 | + |
| 93 | +- var packSrcArgument = new Argument<string>("src") { Description = "Source path to pack." }; |
| 94 | +- var packDstArgument = new Argument<string>("dst") { Description = "Destination path of the .pkg or .app file." }; |
| 95 | +- var packCommand = new Command("pack", "Pack a directory into a .pkg or .app file.") |
| 96 | ++ var packSrcArgument = new CliArgument<string>("src") { Description = "Source path to pack." }; |
| 97 | ++ var packDstArgument = new CliArgument<string>("dst") { Description = "Destination path of the .pkg or .app file." }; |
| 98 | ++ var packCommand = new CliCommand("pack", "Pack a directory into a .pkg or .app file.") |
| 99 | + { |
| 100 | + Arguments = { packSrcArgument, packDstArgument } |
| 101 | + }; |
| 102 | +@@ -59,8 +59,8 @@ private static RootCommand Setup() |
| 103 | + return PackCommand(result, packSrcArgument, packDstArgument); |
| 104 | + }); |
| 105 | + |
| 106 | +- var pkgOrAppArgument = new Argument<string>("src") { Description = "Input pkg or app to verify." }; |
| 107 | +- var verifyCommand = new Command("verify", "Verify that a pkg or app is signed.") |
| 108 | ++ var pkgOrAppArgument = new CliArgument<string>("src") { Description = "Input pkg or app to verify." }; |
| 109 | ++ var verifyCommand = new CliCommand("verify", "Verify that a pkg or app is signed.") |
| 110 | + { |
| 111 | + Arguments = { pkgOrAppArgument } |
| 112 | + }; |
| 113 | +@@ -75,7 +75,7 @@ private static RootCommand Setup() |
| 114 | + return rootCommand; |
| 115 | + } |
| 116 | + |
| 117 | +- private static int VerifyCommand(ParseResult result, Argument<string> pkgOrAppArgument) |
| 118 | ++ private static int VerifyCommand(ParseResult result, CliArgument<string> pkgOrAppArgument) |
| 119 | + { |
| 120 | + var srcPath = result.GetValue(pkgOrAppArgument) ?? throw new Exception("src must be non-empty"); |
| 121 | + try |
| 122 | +@@ -103,7 +103,7 @@ private static int VerifyCommand(ParseResult result, Argument<string> pkgOrAppAr |
| 123 | + return 0; |
| 124 | + } |
| 125 | + |
| 126 | +- private static int PackCommand(ParseResult result, Argument<string> packSrcArgument, Argument<string> packDstArgument) |
| 127 | ++ private static int PackCommand(ParseResult result, CliArgument<string> packSrcArgument, CliArgument<string> packDstArgument) |
| 128 | + { |
| 129 | + var srcPath = result.GetValue(packSrcArgument) ?? throw new Exception("src must be non-empty"); |
| 130 | + var dstPath = result.GetValue(packDstArgument) ?? throw new Exception("dst must be non-empty"); |
| 131 | +@@ -141,7 +141,7 @@ private static int PackCommand(ParseResult result, Argument<string> packSrcArgum |
| 132 | + return 0; |
| 133 | + } |
| 134 | + |
| 135 | +- private static int UnpackCommand(ParseResult result, Argument<string> unpackSrcArgument, Argument<string> unpackDestinationArgument) |
| 136 | ++ private static int UnpackCommand(ParseResult result, CliArgument<string> unpackSrcArgument, CliArgument<string> unpackDestinationArgument) |
| 137 | + { |
| 138 | + var srcPath = result.GetValue(unpackSrcArgument) ?? throw new Exception("src must be non-empty"); |
| 139 | + var dstPath = result.GetValue(unpackDestinationArgument) ?? throw new Exception("dst must be non-empty"); |
| 140 | +diff --git a/src/VersionTools/Microsoft.DotNet.VersionTools.Cli/Program.cs b/src/VersionTools/Microsoft.DotNet.VersionTools.Cli/Program.cs |
| 141 | +index a3051aa11..9cd7897c0 100644 |
| 142 | +--- a/src/VersionTools/Microsoft.DotNet.VersionTools.Cli/Program.cs |
| 143 | ++++ b/src/VersionTools/Microsoft.DotNet.VersionTools.Cli/Program.cs |
| 144 | +@@ -13,31 +13,31 @@ static int Main(string[] args) |
| 145 | + { |
| 146 | + //// Global options |
| 147 | + |
| 148 | +- RootCommand rootCommand = new("Microsoft.DotNet.VersionTools.Cli v" + Environment.Version.ToString(2)) |
| 149 | ++ CliRootCommand rootCommand = new("Microsoft.DotNet.VersionTools.Cli v" + Environment.Version.ToString(2)) |
| 150 | + { |
| 151 | + TreatUnmatchedTokensAsErrors = true |
| 152 | + }; |
| 153 | + |
| 154 | + // Package command |
| 155 | +- Option<string> assetsDirectoryOption = new("--assets-path", "-d") |
| 156 | ++ CliOption<string> assetsDirectoryOption = new("--assets-path", "-d") |
| 157 | + { |
| 158 | + Description = "Path to the directory where the assets are located", |
| 159 | + Required = true |
| 160 | + }; |
| 161 | + |
| 162 | +- Option<string> searchPatternOption = new("--search-pattern", "-s") |
| 163 | ++ CliOption<string> searchPatternOption = new("--search-pattern", "-s") |
| 164 | + { |
| 165 | + Description = "The search string to match against the names of subdirectories in --assets-path. See Directory.GetFiles for details.", |
| 166 | + DefaultValueFactory = _ => "*.nupkg" |
| 167 | + }; |
| 168 | + |
| 169 | +- Option<bool> recursiveOption = new("--recursive", "-r") |
| 170 | ++ CliOption<bool> recursiveOption = new("--recursive", "-r") |
| 171 | + { |
| 172 | + Description = "Search for assets recursively.", |
| 173 | + DefaultValueFactory = _ => true |
| 174 | + }; |
| 175 | + |
| 176 | +- Command trimAssetVersionCommand = new("trim-assets-version", "Trim versions from provided assets. Currently, only NuGet packages are supported."); |
| 177 | ++ CliCommand trimAssetVersionCommand = new("trim-assets-version", "Trim versions from provided assets. Currently, only NuGet packages are supported."); |
| 178 | + trimAssetVersionCommand.Options.Add(assetsDirectoryOption); |
| 179 | + trimAssetVersionCommand.Options.Add(searchPatternOption); |
| 180 | + trimAssetVersionCommand.Options.Add(recursiveOption); |
| 181 | +@@ -59,6 +59,6 @@ static int Main(string[] args) |
| 182 | + }); |
| 183 | + |
| 184 | + rootCommand.Subcommands.Add(trimAssetVersionCommand); |
| 185 | +- return new CommandLineConfiguration(rootCommand).Invoke(args); |
| 186 | ++ return new CliConfiguration(rootCommand).Invoke(args); |
| 187 | + } |
| 188 | + } |
0 commit comments