Rename cache to store.

Rename `dotnet publish --filter` to `dotnet publish --target`.

Partial fixes for #6243, #6244
This commit is contained in:
Eric Erhardt 2017-04-07 13:11:40 -05:00
parent e1b4556641
commit 07b25e268c
23 changed files with 44 additions and 55 deletions

View file

@ -1574,7 +1574,7 @@ Global
{F2D1A7DA-B3EB-4CA7-BAA9-A18CEC398853} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
{C98C7C2E-2C29-4A40-958C-60561ED77791} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{56F1E090-B80F-4BDF-8991-4B0F9B5B8C9A} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{CACA427D-5A71-45E6-88DC-3E2DB6C4D52D} = {FF498306-2DE2-47F6-8C35-3CF0589CF2B8}
{CACA427D-5A71-45E6-88DC-3E2DB6C4D52D} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{3275D006-54C8-4C64-A537-B9941C5D2F0C} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{DE4D1AEB-871B-4E7C-945A-453F9A490C06} = {89905EC4-BC0F-443B-8ADF-691321F10108}
EndGlobalSection

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
// 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.Tools.Add;
using Microsoft.DotNet.Tools.Build;
using Microsoft.DotNet.Tools.Clean;
@ -15,9 +16,10 @@ using Microsoft.DotNet.Tools.Remove;
using Microsoft.DotNet.Tools.Restore;
using Microsoft.DotNet.Tools.Run;
using Microsoft.DotNet.Tools.Sln;
using Microsoft.DotNet.Tools.Store;
using Microsoft.DotNet.Tools.Test;
using Microsoft.DotNet.Tools.VSTest;
using Microsoft.DotNet.Tools.Cache;
using System.Collections.Generic;
namespace Microsoft.DotNet.Cli
{
@ -37,12 +39,6 @@ namespace Microsoft.DotNet.Cli
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-build
DocLink = "https://aka.ms/dotnet-build"
},
["cache"] = new BuiltInCommandMetadata
{
Command = CacheCommand.Run,
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-cache
DocLink = "https://aka.ms/dotnet-cache"
},
["clean"] = new BuiltInCommandMetadata
{
Command = CleanCommand.Run,
@ -122,6 +118,12 @@ namespace Microsoft.DotNet.Cli
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-sln
DocLink = "https://aka.ms/dotnet-sln"
},
["store"] = new BuiltInCommandMetadata
{
Command = StoreCommand.Run,
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-store
DocLink = "https://aka.ms/dotnet-store"
},
["test"] = new BuiltInCommandMetadata
{
Command = TestCommand.Run,

View file

@ -46,7 +46,7 @@ namespace Microsoft.DotNet.Cli
RemoveCommandParser.Remove(),
ListCommandParser.List(),
NuGetCommandParser.NuGet(),
CacheCommandParser.Cache(),
StoreCommandParser.Store(),
Create.Command("msbuild", ""),
Create.Command("vstest", ""),
CompleteCommandParser.Complete(),

View file

@ -72,11 +72,6 @@ namespace Microsoft.DotNet.Tools.MSBuild
return GetProcessStartInfo().Execute();
}
internal static CommandOption AddVerbosityOption(CommandLineApplication app)
{
return app.Option("-v|--verbosity", LocalizableStrings.VerbosityOptionDescription, CommandOptionType.SingleValue);
}
private static string Escape(string arg) =>
// this is a workaround for https://github.com/Microsoft/msbuild/issues/1622
(arg.StartsWith("/p:RestoreSources=", StringComparison.OrdinalIgnoreCase)) ?

View file

@ -5,8 +5,6 @@ namespace Microsoft.DotNet.Tools.Publish
{
internal class LocalizableStrings
{
public const string AppFullName = ".NET Publisher";
public const string AppDescription = "Publisher for the .NET Platform";
public const string FrameworkOption = "FRAMEWORK";
@ -17,9 +15,9 @@ namespace Microsoft.DotNet.Tools.Publish
public const string OutputOptionDescription = "Output directory in which to place the published artifacts.";
public const string FilterProjOption = "profile.xml";
public const string TargetOption = "target.xml";
public const string FilterProjOptionDescription = "The XML file that contains the list of packages to be excluded from publish step.";
public const string TargetOptionDescription = "The path to a target manifest file that contains the list of packages to be excluded from the publish step.";
public const string SelfContainedOptionDescription = "Publish the .NET Core runtime with your application so the runtime doesn't need to be installed on the target machine. Defaults to 'true' if a runtime identifier is specified.";
}

View file

@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli
public static Command Publish() =>
Create.Command(
"publish",
LocalizableStrings.AppFullName,
LocalizableStrings.AppDescription,
Accept.ZeroOrMoreArguments(),
CommonOptions.HelpOption(),
CommonOptions.FrameworkOption(),
@ -26,10 +26,10 @@ namespace Microsoft.DotNet.Cli
CommonOptions.ConfigurationOption(),
CommonOptions.VersionSuffixOption(),
Create.Option(
"--filter",
LocalizableStrings.FilterProjOptionDescription,
"--target",
LocalizableStrings.TargetOptionDescription,
Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.FilterProjOption)
.With(name: LocalizableStrings.TargetOption)
.ForwardAsSingle(o => $"/p:FilterProjectFiles={string.Join("%3B", o.Arguments)}")),
Create.Option(
"--self-contained",

View file

@ -1,21 +1,19 @@
// 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.Tools.Cache
namespace Microsoft.DotNet.Tools.Store
{
internal class LocalizableStrings
{
public const string AppFullName = ".NET Cache";
public const string AppDescription = "Stores the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework.";
public const string AppDescription = "Caches the specified assemblies for the .NET Platform. By default, these will be optimized for the target runtime and framework.";
public const string ProjectManifest = "PROJECT_MANIFEST";
public const string ProjectEntries = "PROJECT_ENTRIES";
public const string ProjectEntryDescription = "The XML file that contains the list of packages to be cached.";
public const string ProjectManifestDescription = "The XML file that contains the list of packages to be stored.";
public const string OutputOption = "OUTPUT_DIR";
public const string OutputOptionDescription = "Output directory in which to cache the given assemblies.";
public const string OutputOptionDescription = "Output directory in which to store the given assemblies.";
public const string FrameworkVersionOption = "FrameworkVersion";
@ -29,7 +27,7 @@ namespace Microsoft.DotNet.Tools.Cache
public const string PreserveIntermediateWorkingDirOptionDescription = "Preserves the intermediate working directory.";
public const string SpecifyEntries = "Specify at least one entry with --entries.";
public const string SpecifyManifests = "Specify at least one manifest with --manifest.";
public const string IntermediateDirExists = "Intermediate working directory {0} already exists. Remove {0} or specify another directory with -w.";
}

View file

@ -1,41 +1,37 @@
// 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;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.MSBuild;
using Microsoft.DotNet.Cli;
using System.Diagnostics;
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using Parser = Microsoft.DotNet.Cli.Parser;
namespace Microsoft.DotNet.Tools.Cache
namespace Microsoft.DotNet.Tools.Store
{
public partial class CacheCommand : MSBuildForwardingApp
public class StoreCommand : MSBuildForwardingApp
{
private CacheCommand(IEnumerable<string> msbuildArgs, string msbuildPath = null)
private StoreCommand(IEnumerable<string> msbuildArgs, string msbuildPath = null)
: base(msbuildArgs, msbuildPath)
{
}
public static CacheCommand FromArgs(string[] args, string msbuildPath = null)
public static StoreCommand FromArgs(string[] args, string msbuildPath = null)
{
var msbuildArgs = new List<string>();
var parser = Parser.Instance;
var result = parser.ParseFrom("dotnet cache", args);
var result = parser.ParseFrom("dotnet store", args);
result.ShowHelpOrErrorIfAppropriate();
var appliedBuildOptions = result["dotnet"]["cache"];
var appliedBuildOptions = result["dotnet"]["store"];
if (!appliedBuildOptions.HasOption("-e"))
if (!appliedBuildOptions.HasOption("-m"))
{
throw new InvalidOperationException(LocalizableStrings.SpecifyEntries);
throw new GracefulException(LocalizableStrings.SpecifyManifests);
}
msbuildArgs.Add("/t:ComposeCache");
@ -44,14 +40,14 @@ namespace Microsoft.DotNet.Tools.Cache
msbuildArgs.AddRange(appliedBuildOptions.Arguments);
return new CacheCommand(msbuildArgs, msbuildPath);
return new StoreCommand(msbuildArgs, msbuildPath);
}
public static int Run(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
CacheCommand cmd;
StoreCommand cmd;
try
{
cmd = FromArgs(args);

View file

@ -4,23 +4,23 @@
using System.IO;
using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;
using LocalizableStrings = Microsoft.DotNet.Tools.Cache.LocalizableStrings;
using LocalizableStrings = Microsoft.DotNet.Tools.Store.LocalizableStrings;
namespace Microsoft.DotNet.Cli
{
internal static class CacheCommandParser
internal static class StoreCommandParser
{
public static Command Cache() =>
public static Command Store() =>
Create.Command(
"cache",
"store",
LocalizableStrings.AppDescription,
Accept.ZeroOrMoreArguments(),
CommonOptions.HelpOption(),
Create.Option(
"-e|--entries",
LocalizableStrings.ProjectEntryDescription,
"-m|--manifest",
LocalizableStrings.ProjectManifestDescription,
Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.ProjectEntries)
.With(name: LocalizableStrings.ProjectManifest)
.ForwardAsMany(o =>
{
var materializedString = $"{o.Arguments.First()}";