Change --source to --source-feed and make it additional (#8833)

Other than change source to source-feed and make it additional instead of exclusive. I changed source to be multiple. Because restore support multiple source https://github.com/Microsoft/dotnet/issues/361

As for mock. The offline feed and source feed is considered the same, so remove the category of “source”. I renamed source to “AdditionalFeed” because that is more accurate on implementation level.

Note:
NuGet feed don’t have order. Whichever responses the fastest, is the first.
No change on restore.

scripts/cli-test-env.sh change is due to mac 10.13 is finally added to RID graph. And it is “considered” one of the CLI supported RID
This commit is contained in:
William Lee 2018-03-19 22:22:45 -07:00 committed by GitHub
parent 67c4562f43
commit 9cc2b7cd2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 433 additions and 362 deletions

View file

@ -16,7 +16,7 @@ REPO_ROOT="$( cd -P "$( dirname "$SOURCE" )/../" && pwd )"
uname=$(uname) uname=$(uname)
if [ "$(uname)" = "Darwin" ] if [ "$(uname)" = "Darwin" ]
then then
RID=osx.10.13-x64 RID=osx-x64
else else
RID=linux-x64 RID=linux-x64
fi fi

View file

@ -8,11 +8,9 @@ namespace Microsoft.DotNet.ToolPackage
{ {
internal interface IProjectRestorer internal interface IProjectRestorer
{ {
void Restore( void Restore(FilePath project,
FilePath project,
DirectoryPath assetJsonOutput, DirectoryPath assetJsonOutput,
FilePath? nugetConfig = null, FilePath? nugetConfig = null,
string source = null,
string verbosity = null); string verbosity = null);
} }
} }

View file

@ -10,13 +10,12 @@ namespace Microsoft.DotNet.ToolPackage
{ {
internal interface IToolPackageInstaller internal interface IToolPackageInstaller
{ {
IToolPackage InstallPackage( IToolPackage InstallPackage(PackageId packageId,
PackageId packageId,
VersionRange versionRange = null, VersionRange versionRange = null,
string targetFramework = null, string targetFramework = null,
FilePath? nugetConfig = null, FilePath? nugetConfig = null,
DirectoryPath? rootConfigDirectory = null, DirectoryPath? rootConfigDirectory = null,
string source = null, string[] additionalFeeds = null,
string verbosity = null); string verbosity = null);
} }
} }

View file

@ -30,13 +30,12 @@ namespace Microsoft.DotNet.ToolPackage
_offlineFeed = offlineFeed ?? new DirectoryPath(new CliFolderPathCalculator().CliFallbackFolderPath); _offlineFeed = offlineFeed ?? new DirectoryPath(new CliFolderPathCalculator().CliFallbackFolderPath);
} }
public IToolPackage InstallPackage( public IToolPackage InstallPackage(PackageId packageId,
PackageId packageId,
VersionRange versionRange = null, VersionRange versionRange = null,
string targetFramework = null, string targetFramework = null,
FilePath? nugetConfig = null, FilePath? nugetConfig = null,
DirectoryPath? rootConfigDirectory = null, DirectoryPath? rootConfigDirectory = null,
string source = null, string[] additionalFeeds = null,
string verbosity = null) string verbosity = null)
{ {
var packageRootDirectory = _store.GetRootPackageDirectory(packageId); var packageRootDirectory = _store.GetRootPackageDirectory(packageId);
@ -55,7 +54,8 @@ namespace Microsoft.DotNet.ToolPackage
versionRange: versionRange, versionRange: versionRange,
targetFramework: targetFramework ?? BundledTargetFramework.GetTargetFrameworkMoniker(), targetFramework: targetFramework ?? BundledTargetFramework.GetTargetFrameworkMoniker(),
restoreDirectory: stageDirectory, restoreDirectory: stageDirectory,
rootConfigDirectory: rootConfigDirectory); rootConfigDirectory: rootConfigDirectory,
additionalFeeds: additionalFeeds);
try try
{ {
@ -63,8 +63,7 @@ namespace Microsoft.DotNet.ToolPackage
tempProject, tempProject,
stageDirectory, stageDirectory,
nugetConfig, nugetConfig,
source, verbosity: verbosity);
verbosity);
} }
finally finally
{ {
@ -113,12 +112,12 @@ namespace Microsoft.DotNet.ToolPackage
}); });
} }
private FilePath CreateTempProject( private FilePath CreateTempProject(PackageId packageId,
PackageId packageId,
VersionRange versionRange, VersionRange versionRange,
string targetFramework, string targetFramework,
DirectoryPath restoreDirectory, DirectoryPath restoreDirectory,
DirectoryPath? rootConfigDirectory) DirectoryPath? rootConfigDirectory,
string[] additionalFeeds)
{ {
var tempProject = _tempProject ?? new DirectoryPath(Path.GetTempPath()) var tempProject = _tempProject ?? new DirectoryPath(Path.GetTempPath())
.WithSubDirectories(Path.GetRandomFileName()) .WithSubDirectories(Path.GetRandomFileName())
@ -141,8 +140,7 @@ namespace Microsoft.DotNet.ToolPackage
new XElement("RestoreRootConfigDirectory", rootConfigDirectory?.Value ?? Directory.GetCurrentDirectory()), // config file probing start directory new XElement("RestoreRootConfigDirectory", rootConfigDirectory?.Value ?? Directory.GetCurrentDirectory()), // config file probing start directory
new XElement("DisableImplicitFrameworkReferences", "true"), // no Microsoft.NETCore.App in tool folder new XElement("DisableImplicitFrameworkReferences", "true"), // no Microsoft.NETCore.App in tool folder
new XElement("RestoreFallbackFolders", "clear"), // do not use fallbackfolder, tool package need to be copied to tool folder new XElement("RestoreFallbackFolders", "clear"), // do not use fallbackfolder, tool package need to be copied to tool folder
new XElement("RestoreAdditionalProjectSources", // use fallbackfolder as feed to enable offline new XElement("RestoreAdditionalProjectSources", JoinSourceAndOfflineCache(additionalFeeds)),
Directory.Exists(_offlineFeed.Value) ? _offlineFeed.Value : string.Empty),
new XElement("RestoreAdditionalProjectFallbackFolders", string.Empty), // block other new XElement("RestoreAdditionalProjectFallbackFolders", string.Empty), // block other
new XElement("RestoreAdditionalProjectFallbackFoldersExcludes", string.Empty), // block other new XElement("RestoreAdditionalProjectFallbackFoldersExcludes", string.Empty), // block other
new XElement("DisableImplicitNuGetFallbackFolder", "true")), // disable SDK side implicit NuGetFallbackFolder new XElement("DisableImplicitNuGetFallbackFolder", "true")), // disable SDK side implicit NuGetFallbackFolder
@ -157,5 +155,22 @@ namespace Microsoft.DotNet.ToolPackage
File.WriteAllText(tempProject.Value, tempProjectContent.ToString()); File.WriteAllText(tempProject.Value, tempProjectContent.ToString());
return tempProject; return tempProject;
} }
private string JoinSourceAndOfflineCache(string[] additionalFeeds)
{
var feeds = new List<string>();
if (additionalFeeds != null)
{
feeds.AddRange(additionalFeeds);
}
// use fallbackfolder as feed to enable offline
if (Directory.Exists(_offlineFeed.Value))
{
feeds.Add(_offlineFeed.ToXmlEncodeString());
}
return string.Join(";", feeds);
}
} }
} }

View file

@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool
private readonly string _packageVersion; private readonly string _packageVersion;
private readonly string _configFilePath; private readonly string _configFilePath;
private readonly string _framework; private readonly string _framework;
private readonly string _source; private readonly string[] _source;
private readonly bool _global; private readonly bool _global;
private readonly string _verbosity; private readonly string _verbosity;
private readonly string _toolPath; private readonly string _toolPath;
@ -55,7 +55,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool
_packageVersion = appliedCommand.ValueOrDefault<string>("version"); _packageVersion = appliedCommand.ValueOrDefault<string>("version");
_configFilePath = appliedCommand.ValueOrDefault<string>("configfile"); _configFilePath = appliedCommand.ValueOrDefault<string>("configfile");
_framework = appliedCommand.ValueOrDefault<string>("framework"); _framework = appliedCommand.ValueOrDefault<string>("framework");
_source = appliedCommand.ValueOrDefault<string>("source"); _source = appliedCommand.ValueOrDefault<string[]>("source-feed");
_global = appliedCommand.ValueOrDefault<bool>("global"); _global = appliedCommand.ValueOrDefault<bool>("global");
_verbosity = appliedCommand.SingleArgumentOrDefault("verbosity"); _verbosity = appliedCommand.SingleArgumentOrDefault("verbosity");
_toolPath = appliedCommand.SingleArgumentOrDefault("tool-path"); _toolPath = appliedCommand.SingleArgumentOrDefault("tool-path");
@ -137,7 +137,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool
versionRange: versionRange, versionRange: versionRange,
targetFramework: _framework, targetFramework: _framework,
nugetConfig: configFile, nugetConfig: configFile,
source: _source, additionalFeeds: _source,
verbosity: _verbosity); verbosity: _verbosity);
foreach (var command in package.Commands) foreach (var command in package.Commands)

View file

@ -32,10 +32,10 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.ConfigFileOptionDescription, LocalizableStrings.ConfigFileOptionDescription,
Accept.ExactlyOneArgument()), Accept.ExactlyOneArgument()),
Create.Option( Create.Option(
"--source", "--source-feed",
LocalizableStrings.SourceOptionDescription, LocalizableStrings.SourceFeedOptionDescription,
Accept.ExactlyOneArgument() Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.SourceOptionName)), .With(name: LocalizableStrings.SourceFeedOptionName)),
Create.Option( Create.Option(
"-f|--framework", "-f|--framework",
LocalizableStrings.FrameworkOptionDescription, LocalizableStrings.FrameworkOptionDescription,

View file

@ -129,11 +129,11 @@
<data name="VersionOptionDescription" xml:space="preserve"> <data name="VersionOptionDescription" xml:space="preserve">
<value>Version of the tool package in NuGet.</value> <value>Version of the tool package in NuGet.</value>
</data> </data>
<data name="SourceOptionDescription" xml:space="preserve"> <data name="SourceFeedOptionDescription" xml:space="preserve">
<value>Specifies a NuGet package source to use during installation.</value> <value>Adds an additional NuGet package source to use during installation.</value>
</data> </data>
<data name="SourceOptionName" xml:space="preserve"> <data name="SourceFeedOptionName" xml:space="preserve">
<value>SOURCE</value> <value>SOURCE_FEED</value>
</data> </data>
<data name="CommandDescription" xml:space="preserve"> <data name="CommandDescription" xml:space="preserve">
<value>Installs a tool for use on the command line.</value> <value>Installs a tool for use on the command line.</value>

View file

@ -26,11 +26,9 @@ namespace Microsoft.DotNet.Tools.Install.Tool
_forceOutputRedirection = reporter != null; _forceOutputRedirection = reporter != null;
} }
public void Restore( public void Restore(FilePath project,
FilePath project,
DirectoryPath assetJsonOutput, DirectoryPath assetJsonOutput,
FilePath? nugetConfig = null, FilePath? nugetConfig = null,
string source = null,
string verbosity = null) string verbosity = null)
{ {
var argsToPassToRestore = new List<string>(); var argsToPassToRestore = new List<string>();
@ -42,12 +40,6 @@ namespace Microsoft.DotNet.Tools.Install.Tool
argsToPassToRestore.Add(nugetConfig.Value.Value); argsToPassToRestore.Add(nugetConfig.Value.Value);
} }
if (source != null)
{
argsToPassToRestore.Add("--source");
argsToPassToRestore.Add(source);
}
argsToPassToRestore.AddRange(new List<string> argsToPassToRestore.AddRange(new List<string>
{ {
"--runtime", "--runtime",

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="cs" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="cs" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">Určuje zdroj balíčku NuGet, který se použije při instalaci.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ Instalace byla úspěšná. Pokud nejsou další pokyny, můžete přímo do já
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="de" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="de" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">Gibt eine NuGet-Paketquelle für die Installation an.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ Die Installation war erfolgreich. Sofern keine weiteren Anweisungen vorliegen, k
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="es" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="es" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">Especifica el origen de un paquete NuGet para usarlo durante la instalación.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">ORIGEN</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ La instalación se completó correctamente. Si no hay más instrucciones, puede
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="fr" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="fr" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">Spécifie un package NuGet source à utiliser durant l'installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ L'installation a réussi. En l'absence d'instructions supplémentaires, vous pou
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="it" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="it" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">Consente di specificare un'origine pacchetto NuGet da usare durante l'installazione.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">ORIGINE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ L'installazione è riuscita. Se non ci sono altre istruzioni, è possibile digit
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ja" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="ja" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">インストール中に使用する NuGet パッケージを指定します。</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ko" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="ko" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">설치 중 사용할 NuGet 패키지 소스를 지정합니다.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="pl" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="pl" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">Określa źródło pakietu NuGet do użycia podczas instalacji.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">ŹRÓDŁO</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ Instalacja powiodła się. Jeśli nie ma dodatkowych instrukcji, możesz wpisać
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="pt-BR" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="pt-BR" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">Especifica uma origem do pacote NuGet a ser usada durante a instalação.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">ORIGEM</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ A instalação foi bem-sucedida. Se não houver outras instruções, digite o se
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ru" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="ru" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">Задает источник пакета NuGet, используемый во время установки.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="tr" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="tr" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">Yükleme sırasında kullanılacak bir NuGet paket kaynağı belirtir.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ Yükleme başarılı oldu. Daha fazla yönerge yoksa, çağırmak için şu komu
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="zh-Hans" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="zh-Hans" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">指定安装期间使用的 NuGet 包源。</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -2,16 +2,6 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="zh-Hant" original="../LocalizableStrings.resx"> <file datatype="xml" source-language="en" target-language="zh-Hant" original="../LocalizableStrings.resx">
<body> <body>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during installation.</source>
<target state="translated">指定於安裝期間要使用的 NuGet 套件來源。</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="translated">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="InstallationSucceeded"> <trans-unit id="InstallationSucceeded">
<source>If there were no additional instructions, you can type the following command to invoke the tool: {0} <source>If there were no additional instructions, you can type the following command to invoke the tool: {0}
Tool '{1}' (version '{2}') was successfully installed.</source> Tool '{1}' (version '{2}') was successfully installed.</source>
@ -119,6 +109,16 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
<target state="new">Location of shim to access tool</target> <target state="new">Location of shim to access tool</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during installation.</source>
<target state="new">Adds an additional NuGet package source to use during installation.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -129,11 +129,11 @@
<data name="VersionOptionDescription" xml:space="preserve"> <data name="VersionOptionDescription" xml:space="preserve">
<value>Version of the tool package in NuGet.</value> <value>Version of the tool package in NuGet.</value>
</data> </data>
<data name="SourceOptionDescription" xml:space="preserve"> <data name="SourceFeedOptionDescription" xml:space="preserve">
<value>Specifies a NuGet package source to use during update.</value> <value>Adds an additional NuGet package source to use during update.</value>
</data> </data>
<data name="SourceOptionName" xml:space="preserve"> <data name="SourceFeedOptionName" xml:space="preserve">
<value>SOURCE</value> <value>SOURCE_FEED</value>
</data> </data>
<data name="CommandDescription" xml:space="preserve"> <data name="CommandDescription" xml:space="preserve">
<value>Updates a tool to the latest stable version for use.</value> <value>Updates a tool to the latest stable version for use.</value>

View file

@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Tools.Update.Tool
private readonly PackageId _packageId; private readonly PackageId _packageId;
private readonly string _configFilePath; private readonly string _configFilePath;
private readonly string _framework; private readonly string _framework;
private readonly string _source; private readonly string[] _additionalFeeds;
private readonly bool _global; private readonly bool _global;
private readonly string _verbosity; private readonly string _verbosity;
private readonly string _toolPath; private readonly string _toolPath;
@ -52,7 +52,7 @@ namespace Microsoft.DotNet.Tools.Update.Tool
_packageId = new PackageId(appliedCommand.Arguments.Single()); _packageId = new PackageId(appliedCommand.Arguments.Single());
_configFilePath = appliedCommand.ValueOrDefault<string>("configfile"); _configFilePath = appliedCommand.ValueOrDefault<string>("configfile");
_framework = appliedCommand.ValueOrDefault<string>("framework"); _framework = appliedCommand.ValueOrDefault<string>("framework");
_source = appliedCommand.ValueOrDefault<string>("source"); _additionalFeeds = appliedCommand.ValueOrDefault<string[]>("source-feed");
_global = appliedCommand.ValueOrDefault<bool>("global"); _global = appliedCommand.ValueOrDefault<bool>("global");
_verbosity = appliedCommand.SingleArgumentOrDefault("verbosity"); _verbosity = appliedCommand.SingleArgumentOrDefault("verbosity");
_toolPath = appliedCommand.SingleArgumentOrDefault("tool-path"); _toolPath = appliedCommand.SingleArgumentOrDefault("tool-path");
@ -136,7 +136,7 @@ namespace Microsoft.DotNet.Tools.Update.Tool
packageId: _packageId, packageId: _packageId,
targetFramework: _framework, targetFramework: _framework,
nugetConfig: configFile, nugetConfig: configFile,
source: _source, additionalFeeds: _additionalFeeds,
verbosity: _verbosity); verbosity: _verbosity);
foreach (CommandSettings command in newInstalledPackage.Commands) foreach (CommandSettings command in newInstalledPackage.Commands)

View file

@ -28,10 +28,10 @@ namespace Microsoft.DotNet.Cli
LocalizableStrings.ConfigFileOptionDescription, LocalizableStrings.ConfigFileOptionDescription,
Accept.ExactlyOneArgument()), Accept.ExactlyOneArgument()),
Create.Option( Create.Option(
"--source", "--source-feed",
LocalizableStrings.SourceOptionDescription, LocalizableStrings.SourceFeedOptionDescription,
Accept.ExactlyOneArgument() Accept.OneOrMoreArguments()
.With(name: LocalizableStrings.SourceOptionName)), .With(name: LocalizableStrings.SourceFeedOptionName)),
Create.Option( Create.Option(
"-f|--framework", "-f|--framework",
LocalizableStrings.FrameworkOptionDescription, LocalizableStrings.FrameworkOptionDescription,

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -22,16 +22,6 @@
<target state="new">Version of the tool package in NuGet.</target> <target state="new">Version of the tool package in NuGet.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceOptionDescription">
<source>Specifies a NuGet package source to use during update.</source>
<target state="new">Specifies a NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceOptionName">
<source>SOURCE</source>
<target state="new">SOURCE</target>
<note />
</trans-unit>
<trans-unit id="CommandDescription"> <trans-unit id="CommandDescription">
<source>Updates a tool to the latest stable version for use.</source> <source>Updates a tool to the latest stable version for use.</source>
<target state="new">Updates a tool to the latest stable version for use.</target> <target state="new">Updates a tool to the latest stable version for use.</target>
@ -102,6 +92,16 @@
<target state="new">Tool '{0}' failed to update due to the following:</target> <target state="new">Tool '{0}' failed to update due to the following:</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="SourceFeedOptionDescription">
<source>Adds an additional NuGet package source to use during update.</source>
<target state="new">Adds an additional NuGet package source to use during update.</target>
<note />
</trans-unit>
<trans-unit id="SourceFeedOptionName">
<source>SOURCE_FEED</source>
<target state="new">SOURCE_FEED</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -46,7 +46,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
[Theory] [Theory]
[InlineData(false)] [InlineData(false)]
[InlineData(true)] [InlineData(true)]
public void GivenOfflineFeedInstallSuceeds(bool testMockBehaviorIsInSync) public void GivenOfflineFeedInstallSucceeds(bool testMockBehaviorIsInSync)
{ {
var (store, installer, reporter, fileSystem) = Setup( var (store, installer, reporter, fileSystem) = Setup(
useMock: testMockBehaviorIsInSync, useMock: testMockBehaviorIsInSync,
@ -63,6 +63,30 @@ namespace Microsoft.DotNet.ToolPackage.Tests
package.Uninstall(); package.Uninstall();
} }
[Theory]
[InlineData(false)]
[InlineData(true)]
public void GivenAEmptySourceAndOfflineFeedInstallSucceeds(bool testMockBehaviorIsInSync)
{
var emptySource = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(emptySource);
var (store, installer, reporter, fileSystem) = Setup(
useMock: testMockBehaviorIsInSync,
offlineFeed: new DirectoryPath(GetTestLocalFeedPath()),
feeds: GetOfflineMockFeed());
var package = installer.InstallPackage(
packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework,
additionalFeeds: new[] {emptySource});
AssertPackageInstall(reporter, fileSystem, package, store);
package.Uninstall();
}
[Theory] [Theory]
[InlineData(false)] [InlineData(false)]
[InlineData(true)] [InlineData(true)]
@ -228,7 +252,31 @@ namespace Microsoft.DotNet.ToolPackage.Tests
packageId: TestPackageId, packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion), versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework, targetFramework: _testTargetframework,
source: source); additionalFeeds: new[] {source});
AssertPackageInstall(reporter, fileSystem, package, store);
package.Uninstall();
}
[Theory]
[InlineData(false)]
[InlineData(true)]
public void GivenAEmptySourceAndNugetConfigInstallSucceeds(bool testMockBehaviorIsInSync)
{
var nugetConfigPath = WriteNugetConfigFileToPointToTheFeed();
var emptySource = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(emptySource);
var (store, installer, reporter, fileSystem) = Setup(
useMock: testMockBehaviorIsInSync,
feeds: GetMockFeedsForSource(emptySource));
var package = installer.InstallPackage(
packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework,
nugetConfig: nugetConfigPath, additionalFeeds: new[] {emptySource});
AssertPackageInstall(reporter, fileSystem, package, store); AssertPackageInstall(reporter, fileSystem, package, store);
@ -281,7 +329,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
packageId: TestPackageId, packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion), versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework, targetFramework: _testTargetframework,
source: source); additionalFeeds: new[] {source});
FailedStepAfterSuccessRestore(); FailedStepAfterSuccessRestore();
t.Complete(); t.Complete();
@ -313,7 +361,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
packageId: TestPackageId, packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion), versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework, targetFramework: _testTargetframework,
source: source); additionalFeeds: new[] {source});
first.ShouldNotThrow(); first.ShouldNotThrow();
@ -321,7 +369,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
packageId: TestPackageId, packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion), versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework, targetFramework: _testTargetframework,
source: source); additionalFeeds: new[] {source});
t.Complete(); t.Complete();
} }
@ -352,7 +400,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
packageId: TestPackageId, packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion), versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework, targetFramework: _testTargetframework,
source: source); additionalFeeds: new[] {source});
AssertPackageInstall(reporter, fileSystem, package, store); AssertPackageInstall(reporter, fileSystem, package, store);
@ -360,7 +408,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
packageId: TestPackageId, packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion), versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework, targetFramework: _testTargetframework,
source: source); additionalFeeds: new[] {source});
reporter.Lines.Should().BeEmpty(); reporter.Lines.Should().BeEmpty();
@ -401,7 +449,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
packageId: TestPackageId, packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion), versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework, targetFramework: _testTargetframework,
source: source); additionalFeeds: new[] {source});
AssertPackageInstall(reporter, fileSystem, package, store); AssertPackageInstall(reporter, fileSystem, package, store);
@ -425,7 +473,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
packageId: TestPackageId, packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion), versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework, targetFramework: _testTargetframework,
source: source); additionalFeeds: new[] {source});
AssertPackageInstall(reporter, fileSystem, package, store); AssertPackageInstall(reporter, fileSystem, package, store);
@ -458,7 +506,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
packageId: TestPackageId, packageId: TestPackageId,
versionRange: VersionRange.Parse(TestPackageVersion), versionRange: VersionRange.Parse(TestPackageVersion),
targetFramework: _testTargetframework, targetFramework: _testTargetframework,
source: source); additionalFeeds: new[] {source});
AssertPackageInstall(reporter, fileSystem, package, store); AssertPackageInstall(reporter, fileSystem, package, store);
@ -597,7 +645,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
{ {
new MockFeed new MockFeed
{ {
Type = MockFeedType.Source, Type = MockFeedType.ImplicitAdditionalFeed,
Uri = source, Uri = source,
Packages = new List<MockFeedPackage> Packages = new List<MockFeedPackage>
{ {
@ -617,7 +665,7 @@ namespace Microsoft.DotNet.ToolPackage.Tests
{ {
new MockFeed new MockFeed
{ {
Type = MockFeedType.OfflineFeed, Type = MockFeedType.ImplicitAdditionalFeed,
Uri = GetTestLocalFeedPath(), Uri = GetTestLocalFeedPath(),
Packages = new List<MockFeedPackage> Packages = new List<MockFeedPackage>
{ {

View file

@ -7,7 +7,6 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
{ {
FeedFromLookUpNugetConfig, FeedFromLookUpNugetConfig,
ExplicitNugetConfig, ExplicitNugetConfig,
Source, ImplicitAdditionalFeed
OfflineFeed
} }
} }

View file

@ -56,17 +56,14 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
} }
} }
public void Restore( public void Restore(FilePath project,
FilePath project,
DirectoryPath assetJsonOutput, DirectoryPath assetJsonOutput,
FilePath? nugetConfig = null, FilePath? nugetConfig = null,
string source = null,
string verbosity = null) string verbosity = null)
{ {
string packageId; string packageId;
VersionRange versionRange; VersionRange versionRange;
string targetFramework; string targetFramework;
try try
{ {
// The mock installer wrote a mock project file containing id:version:framework // The mock installer wrote a mock project file containing id:version:framework
@ -94,8 +91,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
var feedPackage = GetPackage( var feedPackage = GetPackage(
packageId, packageId,
versionRange, versionRange,
nugetConfig, nugetConfig);
source);
var packageVersion = feedPackage.Version; var packageVersion = feedPackage.Version;
targetFramework = string.IsNullOrEmpty(targetFramework) ? "targetFramework" : targetFramework; targetFramework = string.IsNullOrEmpty(targetFramework) ? "targetFramework" : targetFramework;
@ -118,49 +114,38 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
private MockFeedPackage GetPackage( private MockFeedPackage GetPackage(
string packageId, string packageId,
VersionRange versionRange = null, VersionRange versionRange = null,
FilePath? nugetConfig = null, FilePath? nugetConfig = null)
string source = null)
{ {
var allPackages = _feeds var allPackages = _feeds
.Where(f => { .Where(f =>
{
if (nugetConfig != null) if (nugetConfig != null)
{ {
return f.Type == MockFeedType.ExplicitNugetConfig && f.Uri == nugetConfig.Value.Value; return ExcludeOtherFeeds(nugetConfig, f);
}
if (source != null)
{
return f.Type == MockFeedType.Source && f.Uri == source;
} }
return true; return true;
}) })
.SelectMany(f => f.Packages) .SelectMany(f => f.Packages)
.Where(f => f.PackageId == packageId); .Where(f => f.PackageId == packageId);
var bestVersion = versionRange.FindBestMatch(allPackages.Select(p => NuGetVersion.Parse(p.Version))); var bestVersion = versionRange.FindBestMatch(allPackages.Select(p => NuGetVersion.Parse(p.Version)));
var package = allPackages.Where(p => NuGetVersion.Parse(p.Version).Equals(bestVersion)).FirstOrDefault(); var package = allPackages.Where(p => NuGetVersion.Parse(p.Version).Equals(bestVersion)).FirstOrDefault();
if (package == null) if (package == null)
{ {
if (_reporter != null) _reporter?.WriteLine($"Error: failed to restore package {packageId}.");
{
_reporter.WriteLine($"Error: failed to restore package {packageId}.");
}
throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed); throw new ToolPackageException(LocalizableStrings.ToolInstallationRestoreFailed);
} }
return package; return package;
} }
private static bool MatchPackage(MockFeedPackage p, string packageId, VersionRange versionRange) private static bool ExcludeOtherFeeds(FilePath? nugetConfig, MockFeed f)
{ {
if (string.Compare(p.PackageId, packageId, StringComparison.CurrentCultureIgnoreCase) != 0) return f.Type == MockFeedType.ImplicitAdditionalFeed
{ || (f.Type == MockFeedType.ExplicitNugetConfig && f.Uri == nugetConfig.Value.Value);
return false;
}
return versionRange == null ||
versionRange.FindBestMatch(new[] { NuGetVersion.Parse(p.Version) }) != null;
} }
} }
} }

View file

@ -35,13 +35,12 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
_installCallback = installCallback; _installCallback = installCallback;
} }
public IToolPackage InstallPackage( public IToolPackage InstallPackage(PackageId packageId,
PackageId packageId,
VersionRange versionRange = null, VersionRange versionRange = null,
string targetFramework = null, string targetFramework = null,
FilePath? nugetConfig = null, FilePath? nugetConfig = null,
DirectoryPath? rootConfigDirectory = null, DirectoryPath? rootConfigDirectory = null,
string source = null, string[] additionalFeeds = null,
string verbosity = null) string verbosity = null)
{ {
var packageRootDirectory = _store.GetRootPackageDirectory(packageId); var packageRootDirectory = _store.GetRootPackageDirectory(packageId);
@ -65,7 +64,6 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
tempProject, tempProject,
stageDirectory, stageDirectory,
nugetConfig, nugetConfig,
source,
verbosity); verbosity);
if (_installCallback != null) if (_installCallback != null)

View file

@ -81,17 +81,17 @@ namespace Microsoft.DotNet.Tests.Commands
public void WhenRunWithPackageIdWithSourceItShouldCreateValidShim() public void WhenRunWithPackageIdWithSourceItShouldCreateValidShim()
{ {
const string sourcePath = "http://mysouce.com"; const string sourcePath = "http://mysouce.com";
ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId} --source {sourcePath}"); ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId} --source-feed {sourcePath}");
AppliedOption appliedCommand = result["dotnet"]["install"]["tool"]; AppliedOption appliedCommand = result["dotnet"]["install"]["tool"];
ParseResult parseResult = ParseResult parseResult =
Parser.Instance.ParseFrom("dotnet install", new[] { "tool", PackageId, "--source", sourcePath }); Parser.Instance.ParseFrom("dotnet install", new[] { "tool", PackageId, "--source-feed", sourcePath });
var toolToolPackageInstaller = CreateToolPackageInstaller( var toolToolPackageInstaller = CreateToolPackageInstaller(
feeds: new MockFeed[] { feeds: new MockFeed[] {
new MockFeed new MockFeed
{ {
Type = MockFeedType.Source, Type = MockFeedType.ImplicitAdditionalFeed,
Uri = sourcePath, Uri = sourcePath,
Packages = new List<MockFeedPackage> Packages = new List<MockFeedPackage>
{ {

View file

@ -54,10 +54,29 @@ namespace Microsoft.DotNet.Tests.ParserTests
{ {
const string expectedSourceValue = "TestSourceValue"; const string expectedSourceValue = "TestSourceValue";
var result = Parser.Instance.Parse($"dotnet install tool -g --source {expectedSourceValue} console.test.app"); var result =
Parser.Instance.Parse($"dotnet install tool -g --source-feed {expectedSourceValue} console.test.app");
var appliedOptions = result["dotnet"]["install"]["tool"]; var appliedOptions = result["dotnet"]["install"]["tool"];
appliedOptions.ValueOrDefault<string>("source").Should().Be(expectedSourceValue); appliedOptions.ValueOrDefault<string[]>("source-feed").First().Should().Be(expectedSourceValue);
}
[Fact]
public void InstallToolParserCanParseMultipleSourceOption()
{
const string expectedSourceValue1 = "TestSourceValue1";
const string expectedSourceValue2 = "TestSourceValue2";
var result =
Parser.Instance.Parse(
$"dotnet install tool -g " +
$"--source-feed {expectedSourceValue1} " +
$"--source-feed {expectedSourceValue2} console.test.app");
var appliedOptions = result["dotnet"]["install"]["tool"];
appliedOptions.ValueOrDefault<string[]>("source-feed")[0].Should().Be(expectedSourceValue1);
appliedOptions.ValueOrDefault<string[]>("source-feed")[1].Should().Be(expectedSourceValue2);
} }
[Fact] [Fact]

View file

@ -62,10 +62,28 @@ namespace Microsoft.DotNet.Tests.ParserTests
const string expectedSourceValue = "TestSourceValue"; const string expectedSourceValue = "TestSourceValue";
var result = var result =
Parser.Instance.Parse($"dotnet update tool -g --source {expectedSourceValue} console.test.app"); Parser.Instance.Parse($"dotnet update tool -g --source-feed {expectedSourceValue} console.test.app");
var appliedOptions = result["dotnet"]["update"]["tool"]; var appliedOptions = result["dotnet"]["update"]["tool"];
appliedOptions.ValueOrDefault<string>("source").Should().Be(expectedSourceValue); appliedOptions.ValueOrDefault<string[]>("source-feed").First().Should().Be(expectedSourceValue);
}
[Fact]
public void UpdateToolParserCanParseMultipleSourceOption()
{
const string expectedSourceValue1 = "TestSourceValue1";
const string expectedSourceValue2 = "TestSourceValue2";
var result =
Parser.Instance.Parse(
$"dotnet update tool -g " +
$"--source-feed {expectedSourceValue1} " +
$"--source-feed {expectedSourceValue2} console.test.app");
var appliedOptions = result["dotnet"]["update"]["tool"];
appliedOptions.ValueOrDefault<string[]>("source-feed")[0].Should().Be(expectedSourceValue1);
appliedOptions.ValueOrDefault<string[]>("source-feed")[1].Should().Be(expectedSourceValue2);
} }
[Fact] [Fact]