Merge pull request #6270 from eerhardt/CacheRename

Rename `cache` to `store`.
This commit is contained in:
Eric Erhardt 2017-04-10 12:15:25 -05:00 committed by GitHub
commit 99f9786ac7
31 changed files with 99 additions and 101 deletions

View file

@ -209,7 +209,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Cli.Sln.In
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Cli.Sln.Internal.Tests", "test\Microsoft.DotNet.Cli.Sln.Internal.Tests\Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj", "{56F1E090-B80F-4BDF-8991-4B0F9B5B8C9A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Cli.Sln.Internal.Tests", "test\Microsoft.DotNet.Cli.Sln.Internal.Tests\Microsoft.DotNet.Cli.Sln.Internal.Tests.csproj", "{56F1E090-B80F-4BDF-8991-4B0F9B5B8C9A}"
EndProject EndProject
Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-cache.Tests", "test\dotnet-cache.Tests\dotnet-cache.Tests.csproj", "{CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}" Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-store.Tests", "test\dotnet-store.Tests\dotnet-store.Tests.csproj", "{CACA427D-5A71-45E6-88DC-3E2DB6C4D52D}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sdk", "sdk", "{3275D006-54C8-4C64-A537-B9941C5D2F0C}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sdk", "sdk", "{3275D006-54C8-4C64-A537-B9941C5D2F0C}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
@ -1600,7 +1600,7 @@ Global
{F2D1A7DA-B3EB-4CA7-BAA9-A18CEC398853} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3} {F2D1A7DA-B3EB-4CA7-BAA9-A18CEC398853} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
{C98C7C2E-2C29-4A40-958C-60561ED77791} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F} {C98C7C2E-2C29-4A40-958C-60561ED77791} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
{56F1E090-B80F-4BDF-8991-4B0F9B5B8C9A} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {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} {3275D006-54C8-4C64-A537-B9941C5D2F0C} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{DE4D1AEB-871B-4E7C-945A-453F9A490C06} = {89905EC4-BC0F-443B-8ADF-691321F10108} {DE4D1AEB-871B-4E7C-945A-453F9A490C06} = {89905EC4-BC0F-443B-8ADF-691321F10108}
{A4C198B4-D46E-4CA8-87DF-B2B206DCCAE6} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7} {A4C198B4-D46E-4CA8-87DF-B2B206DCCAE6} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}

View file

@ -1,5 +1,6 @@
using System; // Copyright (c) .NET Foundation and contributors. All rights reserved.
using System.Collections.Generic; // 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.Add;
using Microsoft.DotNet.Tools.Build; using Microsoft.DotNet.Tools.Build;
using Microsoft.DotNet.Tools.Clean; using Microsoft.DotNet.Tools.Clean;
@ -15,9 +16,10 @@ using Microsoft.DotNet.Tools.Remove;
using Microsoft.DotNet.Tools.Restore; using Microsoft.DotNet.Tools.Restore;
using Microsoft.DotNet.Tools.Run; using Microsoft.DotNet.Tools.Run;
using Microsoft.DotNet.Tools.Sln; using Microsoft.DotNet.Tools.Sln;
using Microsoft.DotNet.Tools.Store;
using Microsoft.DotNet.Tools.Test; using Microsoft.DotNet.Tools.Test;
using Microsoft.DotNet.Tools.VSTest; using Microsoft.DotNet.Tools.VSTest;
using Microsoft.DotNet.Tools.Cache; using System.Collections.Generic;
namespace Microsoft.DotNet.Cli 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 // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-build
DocLink = "https://aka.ms/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 ["clean"] = new BuiltInCommandMetadata
{ {
Command = CleanCommand.Run, Command = CleanCommand.Run,
@ -122,6 +118,12 @@ namespace Microsoft.DotNet.Cli
// aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-sln // aka.ms target: https://docs.microsoft.com/dotnet/articles/core/tools/dotnet-sln
DocLink = "https://aka.ms/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 ["test"] = new BuiltInCommandMetadata
{ {
Command = TestCommand.Run, Command = TestCommand.Run,

View file

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

View file

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

View file

@ -5,8 +5,6 @@ namespace Microsoft.DotNet.Tools.Publish
{ {
internal class LocalizableStrings internal class LocalizableStrings
{ {
public const string AppFullName = ".NET Publisher";
public const string AppDescription = "Publisher for the .NET Platform"; public const string AppDescription = "Publisher for the .NET Platform";
public const string FrameworkOption = "FRAMEWORK"; 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 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."; 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() => public static Command Publish() =>
Create.Command( Create.Command(
"publish", "publish",
LocalizableStrings.AppFullName, LocalizableStrings.AppDescription,
Accept.ZeroOrMoreArguments(), Accept.ZeroOrMoreArguments(),
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
CommonOptions.FrameworkOption(), CommonOptions.FrameworkOption(),
@ -26,10 +26,10 @@ namespace Microsoft.DotNet.Cli
CommonOptions.ConfigurationOption(), CommonOptions.ConfigurationOption(),
CommonOptions.VersionSuffixOption(), CommonOptions.VersionSuffixOption(),
Create.Option( Create.Option(
"--filter", "--target",
LocalizableStrings.FilterProjOptionDescription, LocalizableStrings.TargetOptionDescription,
Accept.OneOrMoreArguments() Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.FilterProjOption) .With(name: LocalizableStrings.TargetOption)
.ForwardAsSingle(o => $"/p:FilterProjectFiles={string.Join("%3B", o.Arguments)}")), .ForwardAsSingle(o => $"/p:FilterProjectFiles={string.Join("%3B", o.Arguments)}")),
Create.Option( Create.Option(
"--self-contained", "--self-contained",

View file

@ -1,21 +1,19 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved. // 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. // 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 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 ProjectManifestDescription = "The XML file that contains the list of packages to be stored.";
public const string ProjectEntryDescription = "The XML file that contains the list of packages to be cached.";
public const string OutputOption = "OUTPUT_DIR"; 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"; 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 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."; 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. // 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. // 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.CommandLine;
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.MSBuild; using Microsoft.DotNet.Tools.MSBuild;
using Microsoft.DotNet.Cli; using System.Collections.Generic;
using System.Diagnostics;
using System;
using System.IO;
using System.Linq;
using Parser = Microsoft.DotNet.Cli.Parser; 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) : 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 msbuildArgs = new List<string>();
var parser = Parser.Instance; var parser = Parser.Instance;
var result = parser.ParseFrom("dotnet cache", args); var result = parser.ParseFrom("dotnet store", args);
result.ShowHelpOrErrorIfAppropriate(); 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"); msbuildArgs.Add("/t:ComposeCache");
@ -44,14 +40,14 @@ namespace Microsoft.DotNet.Tools.Cache
msbuildArgs.AddRange(appliedBuildOptions.Arguments); msbuildArgs.AddRange(appliedBuildOptions.Arguments);
return new CacheCommand(msbuildArgs, msbuildPath); return new StoreCommand(msbuildArgs, msbuildPath);
} }
public static int Run(string[] args) public static int Run(string[] args)
{ {
DebugHelper.HandleDebugSwitch(ref args); DebugHelper.HandleDebugSwitch(ref args);
CacheCommand cmd; StoreCommand cmd;
try try
{ {
cmd = FromArgs(args); cmd = FromArgs(args);

View file

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

View file

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26228.4 VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-add-reference.Tests", "dotnet-add-reference.Tests\dotnet-add-reference.Tests.csproj", "{AB63A3E5-76A3-4EE9-A380-8E0C7B7644DC}" Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-add-reference.Tests", "dotnet-add-reference.Tests\dotnet-add-reference.Tests.csproj", "{AB63A3E5-76A3-4EE9-A380-8E0C7B7644DC}"
EndProject EndProject
@ -72,7 +72,7 @@ Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-sln-remove.Tests", "
EndProject EndProject
Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-add-package.Tests", "dotnet-add-package.Tests\dotnet-add-package.Tests.csproj", "{3501AB72-3E05-45EE-9000-9515F5A139AC}" Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-add-package.Tests", "dotnet-add-package.Tests\dotnet-add-package.Tests.csproj", "{3501AB72-3E05-45EE-9000-9515F5A139AC}"
EndProject EndProject
Project("{13B669BE-BB05-4DDF-9536-439F39A36129}") = "dotnet-cache.Tests", "dotnet-cache.Tests\dotnet-cache.Tests.csproj", "{7CA9ECD0-9284-496B-890F-94B63ECB37EC}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-store.Tests", "dotnet-store.Tests\dotnet-store.Tests.csproj", "{04B21F0F-E645-44E3-868B-3C97E435FB74}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-back-compat.Tests", "dotnet-back-compat.Tests\dotnet-back-compat.Tests.csproj", "{27351B2F-325B-4843-9F4C-BC53FD06A7B5}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-back-compat.Tests", "dotnet-back-compat.Tests\dotnet-back-compat.Tests.csproj", "{27351B2F-325B-4843-9F4C-BC53FD06A7B5}"
EndProject EndProject
@ -470,6 +470,18 @@ Global
{3501AB72-3E05-45EE-9000-9515F5A139AC}.Release|x64.Build.0 = Release|Any CPU {3501AB72-3E05-45EE-9000-9515F5A139AC}.Release|x64.Build.0 = Release|Any CPU
{3501AB72-3E05-45EE-9000-9515F5A139AC}.Release|x86.ActiveCfg = Release|Any CPU {3501AB72-3E05-45EE-9000-9515F5A139AC}.Release|x86.ActiveCfg = Release|Any CPU
{3501AB72-3E05-45EE-9000-9515F5A139AC}.Release|x86.Build.0 = Release|Any CPU {3501AB72-3E05-45EE-9000-9515F5A139AC}.Release|x86.Build.0 = Release|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Debug|x64.ActiveCfg = Debug|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Debug|x64.Build.0 = Debug|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Debug|x86.ActiveCfg = Debug|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Debug|x86.Build.0 = Debug|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Release|Any CPU.Build.0 = Release|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Release|x64.ActiveCfg = Release|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Release|x64.Build.0 = Release|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Release|x86.ActiveCfg = Release|Any CPU
{04B21F0F-E645-44E3-868B-3C97E435FB74}.Release|x86.Build.0 = Release|Any CPU
{7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|Any CPU.Build.0 = Debug|Any CPU {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|x64.ActiveCfg = Debug|Any CPU {7CA9ECD0-9284-496B-890F-94B63ECB37EC}.Debug|x64.ActiveCfg = Debug|Any CPU

View file

@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
private string _framework; private string _framework;
private string _output; private string _output;
private string _runtime; private string _runtime;
private List<string> _profileFilterProject = new List<string>(); private List<string> _targetManifests = new List<string>();
private bool? _selfContained; private bool? _selfContained;
public PublishCommand WithFramework(string framework) public PublishCommand WithFramework(string framework)
@ -38,9 +38,9 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return this; return this;
} }
public PublishCommand WithProfileProject(string profileproj) public PublishCommand WithTargetManifest(string target)
{ {
_profileFilterProject.Add( $" --filter {profileproj}"); _targetManifests.Add( $"--target {target}");
return this; return this;
} }
@ -67,7 +67,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return string.Join(" ", return string.Join(" ",
FrameworkOption, FrameworkOption,
OutputOption, OutputOption,
ProfileProjOption, TargetOption,
RuntimeOption, RuntimeOption,
SelfContainedOption); SelfContainedOption);
} }
@ -78,7 +78,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
private string RuntimeOption => string.IsNullOrEmpty(_runtime) ? "" : $"-r {_runtime}"; private string RuntimeOption => string.IsNullOrEmpty(_runtime) ? "" : $"-r {_runtime}";
private string ProfileProjOption => string.Join(" ", _profileFilterProject); private string TargetOption => string.Join(" ", _targetManifests);
private string SelfContainedOption => _selfContained.HasValue ? $"--self-contained:{_selfContained.Value}" : ""; private string SelfContainedOption => _selfContained.HasValue ? $"--self-contained:{_selfContained.Value}" : "";
} }

View file

@ -7,7 +7,7 @@ using System.Collections.Generic;
namespace Microsoft.DotNet.Tools.Test.Utilities namespace Microsoft.DotNet.Tools.Test.Utilities
{ {
public sealed class CacheCommand : DotnetCommand public sealed class StoreCommand : DotnetCommand
{ {
private List<string> _profileProject = new List<string>(); private List<string> _profileProject = new List<string>();
private string _framework; private string _framework;
@ -16,42 +16,42 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
private string _frameworkVersion; private string _frameworkVersion;
private string _intermediateWorkingDirectory; private string _intermediateWorkingDirectory;
public CacheCommand WithEntries(string profileProject) public StoreCommand WithManifest(string profileProject)
{ {
_profileProject.Add($"--entries {profileProject}"); _profileProject.Add($"--manifest {profileProject}");
return this; return this;
} }
public CacheCommand WithFramework(string framework) public StoreCommand WithFramework(string framework)
{ {
_framework = framework; _framework = framework;
return this; return this;
} }
public CacheCommand WithFramework(NuGetFramework framework) public StoreCommand WithFramework(NuGetFramework framework)
{ {
return WithFramework(framework.GetShortFolderName()); return WithFramework(framework.GetShortFolderName());
} }
public CacheCommand WithOutput(string output) public StoreCommand WithOutput(string output)
{ {
_output = output; _output = output;
return this; return this;
} }
public CacheCommand WithRuntime(string runtime) public StoreCommand WithRuntime(string runtime)
{ {
_runtime = runtime; _runtime = runtime;
return this; return this;
} }
public CacheCommand WithRuntimeFrameworkVersion(string frameworkVersion) public StoreCommand WithRuntimeFrameworkVersion(string frameworkVersion)
{ {
_frameworkVersion = frameworkVersion; _frameworkVersion = frameworkVersion;
return this; return this;
} }
public CacheCommand WithIntermediateWorkingDirectory(string intermediateWorkingDirectory) public StoreCommand WithIntermediateWorkingDirectory(string intermediateWorkingDirectory)
{ {
_intermediateWorkingDirectory = intermediateWorkingDirectory; _intermediateWorkingDirectory = intermediateWorkingDirectory;
return this; return this;
@ -59,13 +59,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
public override CommandResult Execute(string args = "") public override CommandResult Execute(string args = "")
{ {
args = $"cache {BuildArgs()} {args}"; args = $"store {BuildArgs()} {args}";
return base.Execute(args); return base.Execute(args);
} }
public override CommandResult ExecuteWithCapturedOutput(string args = "") public override CommandResult ExecuteWithCapturedOutput(string args = "")
{ {
args = $"cache {BuildArgs()} {args}"; args = $"store {BuildArgs()} {args}";
return base.ExecuteWithCapturedOutput(args); return base.ExecuteWithCapturedOutput(args);
} }

View file

@ -33,7 +33,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[InlineData(new string[] { "-c", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "-c", "<config>" }, "/p:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "--configuration", "<config>" }, "/p:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "/p:VersionSuffix=<versionsuffix>")] [InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "/p:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "--filter", "<filterprojectfiles>" }, "/p:FilterProjectFiles=<filterprojectfiles>")] [InlineData(new string[] { "--target", "<targetfiles>" }, "/p:FilterProjectFiles=<targetfiles>")]
[InlineData(new string[] { "-v", "minimal" }, "/verbosity:minimal")] [InlineData(new string[] { "-v", "minimal" }, "/verbosity:minimal")]
[InlineData(new string[] { "--verbosity", "minimal" }, "/verbosity:minimal")] [InlineData(new string[] { "--verbosity", "minimal" }, "/verbosity:minimal")]
[InlineData(new string[] { "<project>" }, "<project>")] [InlineData(new string[] { "<project>" }, "<project>")]
@ -60,7 +60,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[InlineData(new string[] { "-c", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "-c", "<config>" }, "/p:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "/p:Configuration=<config>")] [InlineData(new string[] { "--configuration", "<config>" }, "/p:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "/p:VersionSuffix=<versionsuffix>")] [InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "/p:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "--filter", "<filterprojectfiles>" }, "/p:FilterProjectFiles=<filterprojectfiles>")] [InlineData(new string[] { "--target", "<targetfiles>" }, "/p:FilterProjectFiles=<targetfiles>")]
[InlineData(new string[] { "-v", "minimal" }, "/verbosity:minimal")] [InlineData(new string[] { "-v", "minimal" }, "/verbosity:minimal")]
[InlineData(new string[] { "--verbosity", "minimal" }, "/verbosity:minimal")] [InlineData(new string[] { "--verbosity", "minimal" }, "/verbosity:minimal")]
public void OptionForwardingIsCorrect(string[] args, string expectedAdditionalArgs) public void OptionForwardingIsCorrect(string[] args, string expectedAdditionalArgs)

View file

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved. // 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. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.DotNet.Tools.Cache; using Microsoft.DotNet.Tools.Store;
using FluentAssertions; using FluentAssertions;
using Xunit; using Xunit;
using System; using System;
@ -10,19 +10,19 @@ using System.IO;
namespace Microsoft.DotNet.Cli.MSBuild.Tests namespace Microsoft.DotNet.Cli.MSBuild.Tests
{ {
public class GivenDotnetCacheInvocation public class GivenDotnetStoreInvocation
{ {
const string ExpectedPrefix = "exec <msbuildpath> /m /v:m /t:ComposeCache <project>"; const string ExpectedPrefix = "exec <msbuildpath> /m /v:m /t:ComposeCache <project>";
static readonly string[] ArgsPrefix = { "-e", "<project>" }; static readonly string[] ArgsPrefix = { "-m", "<project>" };
[Theory] [Theory]
[InlineData("-e")] [InlineData("-m")]
[InlineData("--entries")] [InlineData("--manifest")]
public void ItAddsProjectToMsbuildInvocation(string optionName) public void ItAddsProjectToMsbuildInvocation(string optionName)
{ {
var msbuildPath = "<msbuildpath>"; var msbuildPath = "<msbuildpath>";
string[] args = new string[] { optionName, "<project>" }; string[] args = new string[] { optionName, "<project>" };
CacheCommand.FromArgs(args, msbuildPath) StoreCommand.FromArgs(args, msbuildPath)
.GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix}"); .GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix}");
} }
@ -31,14 +31,14 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[InlineData(new string[] { "--framework", "<tfm>" }, @"/p:TargetFramework=<tfm>")] [InlineData(new string[] { "--framework", "<tfm>" }, @"/p:TargetFramework=<tfm>")]
[InlineData(new string[] { "-r", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "-r", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--runtime", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")] [InlineData(new string[] { "--runtime", "<rid>" }, @"/p:RuntimeIdentifier=<rid>")]
[InlineData(new string[] { "--entries", "one.xml", "--entries", "two.xml", "--entries", "three.xml" }, @"/p:AdditionalProjects=one.xml%3Btwo.xml%3Bthree.xml")] [InlineData(new string[] { "--manifest", "one.xml", "--manifest", "two.xml", "--manifest", "three.xml" }, @"/p:AdditionalProjects=one.xml%3Btwo.xml%3Bthree.xml")]
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs) public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
{ {
args = ArgsPrefix.Concat(args).ToArray(); args = ArgsPrefix.Concat(args).ToArray();
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}"); expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
var msbuildPath = "<msbuildpath>"; var msbuildPath = "<msbuildpath>";
CacheCommand.FromArgs(args, msbuildPath) StoreCommand.FromArgs(args, msbuildPath)
.GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix}{expectedAdditionalArgs}"); .GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix}{expectedAdditionalArgs}");
} }
@ -51,7 +51,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
var args = ArgsPrefix.Concat(new string[] { optionName, path }).ToArray(); var args = ArgsPrefix.Concat(new string[] { optionName, path }).ToArray();
var msbuildPath = "<msbuildpath>"; var msbuildPath = "<msbuildpath>";
CacheCommand.FromArgs(args, msbuildPath) StoreCommand.FromArgs(args, msbuildPath)
.GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix} /p:ComposeDir={Path.GetFullPath(path)}"); .GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix} /p:ComposeDir={Path.GetFullPath(path)}");
} }
} }

View file

@ -1,14 +1,10 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved. // 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. // Licensed under the MIT license. See LICENSE file in the project root for full license information.
using FluentAssertions;
using Microsoft.DotNet.Tools.Test.Utilities;
using System; using System;
using System.IO; using System.IO;
using System.Diagnostics;
using System.Runtime.InteropServices;
using FluentAssertions;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit; using Xunit;
namespace Microsoft.DotNet.Cli.Publish.Tests namespace Microsoft.DotNet.Cli.Publish.Tests
@ -18,6 +14,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
private static string _tfm = "netcoreapp2.0"; private static string _tfm = "netcoreapp2.0";
private static string _frameworkVersion = Microsoft.DotNet.TestFramework.TestAssetInstance.CurrentRuntimeFrameworkVersion; private static string _frameworkVersion = Microsoft.DotNet.TestFramework.TestAssetInstance.CurrentRuntimeFrameworkVersion;
private static string _arch = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant(); private static string _arch = Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.RuntimeArchitecture.ToLowerInvariant();
[Fact] [Fact]
public void ItPublishesARunnablePortableApp() public void ItPublishesARunnablePortableApp()
{ {
@ -41,8 +38,8 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
.Execute() .Execute()
.Should().Pass(); .Should().Pass();
new CacheCommand() new StoreCommand()
.WithEntries(profileProject) .WithManifest(profileProject)
.WithFramework(_tfm) .WithFramework(_tfm)
.WithRuntime(rid) .WithRuntime(rid)
.WithOutput(localAssemblyCache) .WithOutput(localAssemblyCache)
@ -57,7 +54,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand() new PublishCommand()
.WithFramework(_tfm) .WithFramework(_tfm)
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.WithProfileProject(profileFilter) .WithTargetManifest(profileFilter)
.Execute() .Execute()
.Should().Pass(); .Should().Pass();
@ -95,7 +92,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand() new PublishCommand()
.WithFramework(_tfm) .WithFramework(_tfm)
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.WithProfileProject(profileFilter) .WithTargetManifest(profileFilter)
.Execute() .Execute()
.Should().Pass(); .Should().Pass();
@ -137,9 +134,9 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
.Execute() .Execute()
.Should().Pass(); .Should().Pass();
new CacheCommand() new StoreCommand()
.WithEntries(profileProject) .WithManifest(profileProject)
.WithEntries(profileProject1) .WithManifest(profileProject1)
.WithFramework(_tfm) .WithFramework(_tfm)
.WithRuntime(rid) .WithRuntime(rid)
.WithOutput(localAssemblyCache) .WithOutput(localAssemblyCache)
@ -153,8 +150,8 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new PublishCommand() new PublishCommand()
.WithFramework(_tfm) .WithFramework(_tfm)
.WithWorkingDirectory(testProjectDirectory) .WithWorkingDirectory(testProjectDirectory)
.WithProfileProject(profileFilter) .WithTargetManifest(profileFilter)
.WithProfileProject(profileFilter1) .WithTargetManifest(profileFilter1)
.Execute() .Execute()
.Should().Pass(); .Should().Pass();

View file

@ -16,7 +16,6 @@ namespace dotnet.Tests
[InlineData("add package -h")] [InlineData("add package -h")]
[InlineData("add reference -h")] [InlineData("add reference -h")]
[InlineData("build -h")] [InlineData("build -h")]
[InlineData("cache -h")]
[InlineData("clean -h")] [InlineData("clean -h")]
[InlineData("list -h")] [InlineData("list -h")]
[InlineData("migrate -h")] [InlineData("migrate -h")]
@ -32,6 +31,7 @@ namespace dotnet.Tests
[InlineData("sln add -h")] [InlineData("sln add -h")]
[InlineData("sln list -h")] [InlineData("sln list -h")]
[InlineData("sln remove -h")] [InlineData("sln remove -h")]
[InlineData("store -h")]
[InlineData("test -h")] [InlineData("test -h")]
public void TheResponseIsNotAnError(string commandLine) public void TheResponseIsNotAnError(string commandLine)
{ {