Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[automated] Merge branch 'release/8.0.3xx' => 'release/8.0.4xx' #44806

Merged
merged 110 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
2486923
Merge commit '88132ec04fe8cf33d3b34f1daa22c2aa4ec7c8ab'
Aug 6, 2024
c63f681
Merge commit '645be96e62e89fe8e19c7e0197aed7af7ba12fec'
Aug 11, 2024
a448499
Merge commit '7a4ccebb778b59bfd4aa40f457d0b99f951fa481'
Aug 13, 2024
992c265
Merge commit '839e656dcc6bc97ae1b82013d0c9ad586a544ab0'
Aug 14, 2024
f9ad8bf
Merged PR 41536: [internal/release/6.0.1xx] Update dependencies from …
Aug 15, 2024
545b7dd
Merged PR 41772: [internal/release/6.0.1xx] Update dependencies from …
Aug 16, 2024
a9e1ba5
Merged PR 41778: [internal/release/6.0.1xx] Update dependencies from …
Aug 16, 2024
902e4fa
Merged PR 41815: [internal/release/6.0.1xx] Update dependencies from …
Aug 17, 2024
436bce4
Merged PR 41826: [internal/release/6.0.1xx] Update dependencies from …
Aug 17, 2024
be7da2b
Merged PR 41864: [internal/release/6.0.1xx] Update dependencies from …
Aug 19, 2024
828b03c
Merge commit '4d9c8d2735f7dd83ead2da7c4f7541f2c5f7d3fd'
Aug 29, 2024
6b5e21e
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 3, 2024
65957f3
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 5, 2024
cf01aac
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 6, 2024
c1de528
Updated .vsts-ci.yml
marcpopMSFT Sep 9, 2024
1a7cab0
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 9, 2024
2993393
Modify first run tests to all use a different test folder so there's …
marcpopMSFT Sep 9, 2024
371e8dc
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 10, 2024
0a899bb
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 10, 2024
6e8de6c
Merged PR 42559: Merge GH release/6.0.1xx to internal/release/6.0.1xx
marcpopMSFT Sep 10, 2024
13c140c
Swap the order of the commands in case that's affecting the first run…
marcpopMSFT Sep 10, 2024
a238702
Revert "Modify first run tests to all use a different test folder so …
marcpopMSFT Sep 10, 2024
d8add06
Revert "Swap the order of the commands in case that's affecting the f…
marcpopMSFT Sep 10, 2024
0eb1a35
Skip two of the first run tests that aren't correctly resetting the e…
marcpopMSFT Sep 10, 2024
f12afa0
Fix typo
marcpopMSFT Sep 11, 2024
a97a233
Add Dev Device ID
marcpopMSFT Aug 30, 2024
f34a6b4
fix the new deviceid tests Make sure we return an empty string if cac…
marcpopMSFT Sep 4, 2024
8fd78e9
add trailing ;
marcpopMSFT Sep 4, 2024
18e4ae8
Null out the helix access token in the test
marcpopMSFT Sep 11, 2024
8cd5234
try the osx13 queues to see if they work better.
marcpopMSFT Sep 11, 2024
715cbd3
Merged PR 42391: [internal/release/6.0.1xx] Update dependencies from …
Sep 11, 2024
542fac1
Add OSX13 to the test infrastructure
marcpopMSFT Sep 11, 2024
c3eac00
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 11, 2024
1d51dbf
remove system access token as well
marcpopMSFT Sep 12, 2024
dc8224e
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 12, 2024
9c00f7a
Merged PR 42752: [internal/release/6.0.1xx] Update dependencies from …
Sep 12, 2024
95dcc8e
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 12, 2024
b534695
Merged PR 42781: [internal/release/6.0.1xx] Update dependencies from …
Sep 12, 2024
d0f14db
Revert to OSx 12 now that three bad machines are out of rotation
marcpopMSFT Sep 12, 2024
daa0f16
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 12, 2024
fdf329d
Merged PR 42794: [internal/release/6.0.1xx] Update dependencies from …
Sep 13, 2024
1cc7dea
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 13, 2024
e96b946
Merged PR 42792: Fix full framework and disable some tests
marcpopMSFT Sep 13, 2024
040861c
Merged PR 42838: [internal/release/6.0.1xx] Update dependencies from …
Sep 13, 2024
0bc8245
Update dependencies from https://dev.azure.com/dnceng/internal/_git/d…
dotnet-bot Sep 16, 2024
01eda4d
Merged PR 42872: [internal/release/6.0.1xx] Update dependencies from …
Sep 16, 2024
954f381
Merged PR 42877: [internal/release/6.0.1xx] Merge from public
vseanreesermsft Sep 16, 2024
f6397af
Update branding to 6.0.136
vseanreesermsft Oct 1, 2024
b2bf826
add osx14 rid
marcpopMSFT Oct 2, 2024
57d1594
Switch back to macos 13
marcpopMSFT Oct 3, 2024
53b1896
Switch back to macos 13
marcpopMSFT Oct 3, 2024
da41cc8
remove osx14 from the ridlist in the test
marcpopMSFT Oct 3, 2024
9a6ee33
Update branding to 6.0.136 (#43820)
marcpopMSFT Oct 4, 2024
aab610f
Correctly handle different architectures for devdeviceID (#43471)
marcpopMSFT Sep 18, 2024
1080b5b
Merge commit '954f381d16c2d44b573890786ca2d071c217a433' into internal…
vseanreesermsft Oct 8, 2024
3acbe04
Merging internal commits for release/6.0.1xx (#43980)
mmitche Oct 9, 2024
6a9dff5
Merge branch 'release/6.0.4xx' into merge/release/6.0.1xx-to-release/…
marcpopMSFT Oct 9, 2024
52e6013
[automated] Merge branch 'release/6.0.1xx' => 'release/6.0.4xx' (#44022)
marcpopMSFT Oct 10, 2024
72a9fda
Merge branch 'release/8.0.1xx' of https://github.com/dotnet/sdk into …
v-wuzhai Oct 10, 2024
38e6dcd
[automated] Merge branch 'release/6.0.4xx' => 'release/8.0.1xx' (#44046)
v-wuzhai Oct 10, 2024
713b2d9
Update dependencies from https://github.com/dotnet/arcade build 20241…
dotnet-maestro[bot] Oct 10, 2024
d495e12
Update dependencies from https://github.com/dotnet/arcade build 20241…
dotnet-maestro[bot] Oct 10, 2024
cbb6e2e
Update dependencies from https://github.com/dotnet/source-build-exter…
dotnet-maestro[bot] Oct 10, 2024
15936bb
[release/6.0.4xx] Update dependencies from dotnet/arcade (#44074)
marcpopMSFT Oct 10, 2024
1868cec
[release/8.0.1xx] Update dependencies from dotnet/source-build-extern…
nagilson Oct 10, 2024
70bb861
[release/8.0.1xx] Add Dev Device ID (#43357)
marcpopMSFT Oct 10, 2024
ae44730
Update dependencies from https://github.com/dotnet/roslyn build 20241…
dotnet-maestro[bot] Oct 11, 2024
4ddcae0
Update CsWinRT version
manodasanW Oct 11, 2024
260add9
Update dependencies from https://github.com/dotnet/format build 20241…
dotnet-maestro[bot] Oct 11, 2024
c252660
[release/8.0.1xx] Update dependencies from dotnet/arcade (#44061)
nagilson Oct 11, 2024
b9862ec
[release/6.0.4xx] Update dependencies from dotnet/format (#44092)
v-wuzhai Oct 11, 2024
e0c4a75
[release/8.0.1xx] Update dependencies from dotnet/roslyn (#44090)
v-wuzhai Oct 11, 2024
d5a97d5
Merge branch 'release/8.0.1xx' of https://github.com/dotnet/sdk into …
v-wuzhai Oct 11, 2024
9547584
Update dependencies from https://github.com/dotnet/templating build 2…
dotnet-maestro[bot] Oct 11, 2024
939ff4e
Update dependencies from https://github.com/dotnet/templating build 2…
dotnet-maestro[bot] Oct 11, 2024
8ffef01
[automated] Merge branch 'release/6.0.4xx' => 'release/8.0.1xx' (#44081)
v-wuzhai Oct 11, 2024
d9eca48
[release/8.0.1xx] Update dependencies from dotnet/templating (#44095)
nagilson Oct 11, 2024
8c383f3
Update dependencies from https://github.com/dotnet/roslyn build 20241…
dotnet-maestro[bot] Oct 15, 2024
aba2f63
[release/8.0.1xx] Update dependencies from dotnet/roslyn (#44173)
v-wuzhai Oct 15, 2024
061d34f
Update dependencies from https://github.com/dotnet/arcade build 20241…
dotnet-maestro[bot] Oct 16, 2024
643db02
Update dependencies from https://github.com/dotnet/source-build-exter…
dotnet-maestro[bot] Oct 16, 2024
a5a55d8
[release/8.0.1xx] Update dependencies from dotnet/source-build-extern…
v-wuzhai Oct 17, 2024
e322545
[release/8.0.1xx] Update dependencies from dotnet/arcade (#44244)
v-wuzhai Oct 17, 2024
8110ebe
Update dependencies from https://github.com/dotnet/templating build 2…
dotnet-maestro[bot] Oct 17, 2024
0872692
[release/8.0.1xx] Update dependencies from dotnet/templating (#44256)
v-wuzhai Oct 17, 2024
20fd99a
Update dependencies from https://github.com/dotnet/arcade build 20241…
dotnet-maestro[bot] Oct 26, 2024
17d3b31
Update dependencies from https://github.com/dotnet/roslyn build 20241…
dotnet-maestro[bot] Oct 27, 2024
2cf5317
[FIX] tool-install: Use config options
edvilme Oct 28, 2024
f85f664
[FIX] tool-update: Use config options
edvilme Oct 28, 2024
df1c650
[TESTS] tool-install/tool-update: Respect RestoreActionConfig options
edvilme Oct 28, 2024
72cc071
Update branding to 8.0.112
vseanreesermsft Nov 5, 2024
366e0ae
Update branding to 8.0.112 (#44651)
marcpopMSFT Nov 5, 2024
95f4ea0
[FIX] tool-install: Support --ignore-failed-sources flag correctly (#…
marcpopMSFT Nov 5, 2024
8a7483d
[release/8.0.1xx] Update dependencies from dotnet/arcade (#44463)
marcpopMSFT Nov 5, 2024
6d9f55f
[release/8.0.1xx] Update dependencies from dotnet/roslyn (#44473)
marcpopMSFT Nov 5, 2024
31d8a32
Update dependencies from https://github.com/dotnet/templating build 2…
dotnet-maestro[bot] Nov 6, 2024
8dec9ba
[release/8.0.1xx] Update dependencies from dotnet/templating (#44675)
v-wuzhai Nov 6, 2024
6a9874d
Merge branch 'release/8.0.3xx' of https://github.com/dotnet/sdk into …
v-wuzhai Nov 6, 2024
7de92f5
Update dependencies from https://github.com/dotnet/templating build 2…
dotnet-maestro[bot] Nov 7, 2024
75bf2d7
[release/8.0.3xx] Update dependencies from dotnet/templating (#44716)
MiYanni Nov 7, 2024
5d23bb6
Fix merge conflicts/discrepancies
edvilme Nov 8, 2024
fc48812
Fix tests
edvilme Nov 11, 2024
a88089b
Fix tests
edvilme Nov 11, 2024
0dde90b
Fix tests
edvilme Nov 11, 2024
b3ae97e
Fix tests
edvilme Nov 11, 2024
b0968a1
Fix tests
edvilme Nov 11, 2024
7da0b73
[automated] Merge branch 'release/8.0.1xx' => 'release/8.0.3xx' (#44657)
v-wuzhai Nov 12, 2024
1e63b25
Merge branch 'release/8.0.4xx' of https://github.com/dotnet/sdk into …
v-wuzhai Nov 12, 2024
37b15ef
Fix tests
edvilme Nov 12, 2024
cb7b1e9
Merge branch 'release/8.0.4xx' of https://github.com/dotnet/sdk into …
v-wuzhai Nov 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Cli/dotnet/ToolPackage/IToolPackageDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Threading.Tasks;
using Microsoft.DotNet.Cli.NuGetPackageDownloader;
using Microsoft.DotNet.ToolPackage;
using NuGet.Versioning;

Expand All @@ -14,7 +15,8 @@ IToolPackage InstallPackage(PackageLocation packageLocation, PackageId packageId
VersionRange versionRange = null,
string targetFramework = null,
bool isGlobalTool = false,
bool isGlobalToolRollForward = false
bool isGlobalToolRollForward = false,
RestoreActionConfig restoreActionConfig = null
);
}
}
5 changes: 3 additions & 2 deletions src/Cli/dotnet/ToolPackage/ToolPackageDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public IToolPackage InstallPackage(PackageLocation packageLocation, PackageId pa
VersionRange versionRange = null,
string targetFramework = null,
bool isGlobalTool = false,
bool isGlobalToolRollForward = false
bool isGlobalToolRollForward = false,
RestoreActionConfig restoreActionConfig = null
)
{
var packageRootDirectory = _toolPackageStore.GetRootPackageDirectory(packageId);
Expand All @@ -100,7 +101,7 @@ public IToolPackage InstallPackage(PackageLocation packageLocation, PackageId pa

var toolDownloadDir = isGlobalTool ? _globalToolStageDir : _localToolDownloadDir;
var assetFileDirectory = isGlobalTool ? _globalToolStageDir : _localToolAssetDir;
var nugetPackageDownloader = new NuGetPackageDownloader.NuGetPackageDownloader(toolDownloadDir, verboseLogger: nugetLogger, isNuGetTool: true, verbosityOptions: verbosity);
var nugetPackageDownloader = new NuGetPackageDownloader.NuGetPackageDownloader(toolDownloadDir, verboseLogger: nugetLogger, isNuGetTool: true, restoreActionConfig: restoreActionConfig, verbosityOptions: verbosity);

var packageSourceLocation = new PackageSourceLocation(packageLocation.NugetConfig, packageLocation.RootConfigDirectory, null, packageLocation.AdditionalFeeds);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ internal class ToolInstallGlobalOrToolPathCommand : CommandBase
private readonly bool _updateAll;


internal readonly RestoreActionConfig _restoreActionConfig;

public ToolInstallGlobalOrToolPathCommand(
ParseResult parseResult,
PackageId? packageId = null,
Expand Down Expand Up @@ -84,11 +86,11 @@ public ToolInstallGlobalOrToolPathCommand(
var configOption = parseResult.GetValue(ToolInstallCommandParser.ConfigOption);
var sourceOption = parseResult.GetValue(ToolInstallCommandParser.AddSourceOption);
var packageSourceLocation = new PackageSourceLocation(string.IsNullOrEmpty(configOption) ? null : new FilePath(configOption), additionalSourceFeeds: sourceOption);
var restoreAction = new RestoreActionConfig(DisableParallel: parseResult.GetValue(ToolCommandRestorePassThroughOptions.DisableParallelOption),
_restoreActionConfig = new RestoreActionConfig(DisableParallel: parseResult.GetValue(ToolCommandRestorePassThroughOptions.DisableParallelOption),
NoCache: parseResult.GetValue(ToolCommandRestorePassThroughOptions.NoCacheOption),
IgnoreFailedSources: parseResult.GetValue(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption),
Interactive: parseResult.GetValue(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption));
nugetPackageDownloader ??= new NuGetPackageDownloader(tempDir, verboseLogger: new NullLogger(), restoreActionConfig: restoreAction, verbosityOptions: _verbosity);
nugetPackageDownloader ??= new NuGetPackageDownloader(tempDir, verboseLogger: new NullLogger(), restoreActionConfig: _restoreActionConfig, verbosityOptions: _verbosity);
_shellShimTemplateFinder = new ShellShimTemplateFinder(nugetPackageDownloader, tempDir, packageSourceLocation);
_store = store;

Expand Down Expand Up @@ -183,7 +185,8 @@ private int ExecuteInstallCommand(PackageId packageId)
targetFramework: _framework,
verbosity: _verbosity,
isGlobalTool: true,
isGlobalToolRollForward: _allowRollForward
isGlobalToolRollForward: _allowRollForward,
restoreActionConfig: _restoreActionConfig
);

EnsureVersionIsHigher(oldPackageNullable, newInstalledPackage, _allowPackageDowngrade);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.CommandLine;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.NuGetPackageDownloader;
using Microsoft.DotNet.Cli.ToolPackage;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ToolManifest;
Expand Down Expand Up @@ -30,6 +31,8 @@ internal class ToolInstallLocalCommand : CommandBase
private readonly bool _allowRollForward;
private readonly bool _updateAll;

internal readonly RestoreActionConfig _restoreActionConfig;

public ToolInstallLocalCommand(
ParseResult parseResult,
PackageId? packageId = null,
Expand All @@ -54,7 +57,11 @@ public ToolInstallLocalCommand(
new ToolManifestFinder(new DirectoryPath(Directory.GetCurrentDirectory()));
_toolManifestEditor = toolManifestEditor ?? new ToolManifestEditor();
_localToolsResolverCache = localToolsResolverCache ?? new LocalToolsResolverCache();
_toolLocalPackageInstaller = new ToolInstallLocalInstaller(parseResult, toolPackageDownloader);
_restoreActionConfig = new RestoreActionConfig(DisableParallel: parseResult.GetValue(ToolCommandRestorePassThroughOptions.DisableParallelOption),
NoCache: parseResult.GetValue(ToolCommandRestorePassThroughOptions.NoCacheOption),
IgnoreFailedSources: parseResult.GetValue(ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption),
Interactive: parseResult.GetValue(ToolCommandRestorePassThroughOptions.InteractiveRestoreOption));
_toolLocalPackageInstaller = new ToolInstallLocalInstaller(parseResult, toolPackageDownloader, _restoreActionConfig);
_toolPackageDownloader = toolPackageDownloader;
_allowRollForward = parseResult.GetValue(ToolInstallCommandParser.RollForwardOption);
_allowPackageDowngrade = parseResult.GetValue(ToolInstallCommandParser.AllowPackageDowngradeOption);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.CommandLine;
using System.IO;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.NuGetPackageDownloader;
using Microsoft.DotNet.Cli.ToolPackage;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ToolPackage;
Expand All @@ -23,10 +24,12 @@ internal class ToolInstallLocalInstaller
private readonly string _configFilePath;
private readonly string[] _sources;
private readonly VerbosityOptions _verbosity;
private readonly RestoreActionConfig _restoreActionConfig;

public ToolInstallLocalInstaller(
ParseResult parseResult,
IToolPackageDownloader toolPackageDownloader = null)
IToolPackageDownloader toolPackageDownloader = null,
RestoreActionConfig restoreActionConfig = null)
{
_parseResult = parseResult;
_packageVersion = parseResult.GetValue(ToolInstallCommandParser.VersionOption);
Expand All @@ -40,9 +43,9 @@ public ToolInstallLocalInstaller(
= ToolPackageFactory.CreateToolPackageStoresAndDownloader(
additionalRestoreArguments: parseResult.OptionValuesToBeForwarded(ToolInstallCommandParser.GetCommand()));
_toolPackageStore = toolPackageStoresAndDownloader.store;
_toolPackageDownloader = toolPackageDownloader ?? toolPackageStoresAndDownloader.downloader;


_toolPackageDownloader = toolPackageDownloader?? toolPackageStoresAndDownloader.downloader;
_restoreActionConfig = restoreActionConfig;
TargetFrameworkToInstall = BundledTargetFramework.GetTargetFrameworkMoniker();
}

Expand Down Expand Up @@ -74,7 +77,8 @@ public IToolPackage Install(FilePath manifestFile, PackageId packageId)
packageId,
verbosity: _verbosity,
versionRange,
TargetFrameworkToInstall
TargetFrameworkToInstall,
restoreActionConfig: _restoreActionConfig
);

return toolDownloadedPackage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.DotNet.Tools.Tool.Uninstall;
using Microsoft.Extensions.EnvironmentAbstractions;
using Microsoft.DotNet.Cli.ToolPackage;
using Microsoft.DotNet.Cli.NuGetPackageDownloader;
using CreateShellShimRepository = Microsoft.DotNet.Tools.Tool.Install.CreateShellShimRepository;

namespace Microsoft.DotNet.Tools.Tool.Update
Expand All @@ -22,7 +23,7 @@ internal class ToolUpdateGlobalOrToolPathCommand : CommandBase
{
private readonly CreateShellShimRepository _createShellShimRepository;
private readonly CreateToolPackageStoresAndDownloaderAndUninstaller _createToolPackageStoreDownloaderUninstaller;
private readonly ToolInstallGlobalOrToolPathCommand _toolInstallGlobalOrToolPathCommand;
internal readonly ToolInstallGlobalOrToolPathCommand _toolInstallGlobalOrToolPathCommand;

public ToolUpdateGlobalOrToolPathCommand(ParseResult parseResult,
CreateToolPackageStoresAndDownloaderAndUninstaller createToolPackageStoreDownloaderUninstaller = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.CommandLine;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.NuGetPackageDownloader;
using Microsoft.DotNet.Cli.ToolPackage;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ToolManifest;
Expand All @@ -19,7 +20,7 @@ internal class ToolUpdateLocalCommand : CommandBase
private readonly IToolManifestEditor _toolManifestEditor;
private readonly ILocalToolsResolverCache _localToolsResolverCache;
private readonly IToolPackageDownloader _toolPackageDownloader;
private readonly Lazy<ToolInstallLocalCommand> _toolInstallLocalCommand;
internal readonly Lazy<ToolInstallLocalCommand> _toolInstallLocalCommand;
private readonly IReporter _reporter;

public ToolUpdateLocalCommand(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Linq;
using System.Text.Json;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.NuGetPackageDownloader;
using Microsoft.DotNet.Cli.ToolPackage;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ToolPackage;
Expand Down Expand Up @@ -97,7 +98,8 @@ public IToolPackage InstallPackage(PackageLocation packageLocation, PackageId pa
VersionRange versionRange = null,
string targetFramework = null,
bool isGlobalTool = false,
bool isGlobalToolRollForward = false
bool isGlobalToolRollForward = false,
RestoreActionConfig restoreActionConfig = null
)
{
string rollbackDirectory = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,31 @@ public ToolInstallGlobalOrToolPathCommandTests(ITestOutputHelper log): base(log)
_parseResult = Parser.Instance.Parse($"dotnet tool install -g {PackageId}");
}

[Fact]
public void WhenPassingRestoreActionConfigOptions()
{
var parseResult = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --ignore-failed-sources");
var toolInstallCommand = new ToolInstallGlobalOrToolPathCommand(parseResult);
toolInstallCommand._restoreActionConfig.IgnoreFailedSources.Should().BeTrue();
}

[Fact]
public void WhenPassingIgnoreFailedSourcesItShouldNotThrow()
{
_fileSystem.File.WriteAllText(Path.Combine(_temporaryDirectory, "nuget.config"), _nugetConfigWithInvalidSources);
var parseResult = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --ignore-failed-sources");
var toolInstallGlobalOrToolPathCommand = new ToolInstallGlobalOrToolPathCommand(
parseResult,
_packageId,
_createToolPackageStoreDownloaderUninstaller,
_createShellShimRepository,
_environmentPathInstructionMock,
_reporter);

toolInstallGlobalOrToolPathCommand.Execute().Should().Be(0);
_fileSystem.File.Delete(Path.Combine(_temporaryDirectory, "nuget.config"));
}

[Fact]
public void WhenRunWithPackageIdItShouldCreateValidShim()
{
Expand Down Expand Up @@ -914,6 +939,16 @@ public void SetPermission(string path, string chmodArgument)
{
}
}

private string _nugetConfigWithInvalidSources = @"{
<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
<packageSources>
<add key=""nuget"" value=""https://api.nuget.org/v3/index.json"" />
<add key=""invalid_source"" value=""https://api.nuget.org/v3/invalid.json"" />
</packageSources>
</configuration>
}";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,33 @@ public ToolInstallLocalCommandTests(ITestOutputHelper log):base(log)
1);
}

[Fact]
public void WhenPassingRestoreActionConfigOptions()
{
var parseResult = Parser.Instance.Parse($"dotnet tool install {_packageIdA.ToString()} --ignore-failed-sources");
var command = new ToolInstallLocalCommand(parseResult);
command._restoreActionConfig.IgnoreFailedSources.Should().BeTrue();
}

[Fact]
public void WhenPassingIgnoreFailedSourcesItShouldNotThrow()
{
_fileSystem.File.WriteAllText(Path.Combine(_temporaryDirectory, "nuget.config"), _nugetConfigWithInvalidSources);
var parseResult = Parser.Instance.Parse($"dotnet tool install {_packageIdA.ToString()} --ignore-failed-sources");
var installLocalCommand = new ToolInstallLocalCommand(
parseResult,
_packageIdA,
_toolPackageDownloaderMock,
_toolManifestFinder,
_toolManifestEditor,
_localToolsResolverCache,
_reporter);

installLocalCommand.Execute().Should().Be(0);

_fileSystem.File.Delete(Path.Combine(_temporaryDirectory, "nuget.config"));
}

[Fact]
public void WhenRunWithPackageIdItShouldSaveToCacheAndAddToManifestFile()
{
Expand Down Expand Up @@ -485,6 +512,16 @@ out RestoredCommand restoredCommand
""isRoot"":true,
""tools"":{
}
}";

private string _nugetConfigWithInvalidSources = @"{
<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
<packageSources>
<add key=""nuget"" value=""https://api.nuget.org/v3/index.json"" />
<add key=""invalid_source"" value=""https://api.nuget.org/v3/invalid.json"" />
</packageSources>
</configuration>
}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
using Microsoft.DotNet.ShellShim;
using System.CommandLine;
using Parser = Microsoft.DotNet.Cli.Parser;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.Tools.Tool.Uninstall;

namespace Microsoft.DotNet.Tests.Commands.Tool
{
Expand All @@ -29,14 +31,15 @@ public class ToolUpdateGlobalOrToolPathCommandTests
private const string HigherPreviewPackageVersion = "1.0.5-preview3";
private readonly string _shimsDirectory;
private readonly string _toolsDirectory;
private readonly string _tempDirectory;

public ToolUpdateGlobalOrToolPathCommandTests()
{
_reporter = new BufferedReporter();
_fileSystem = new FileSystemMockBuilder().UseCurrentSystemTemporaryDirectory().Build();
var tempDirectory = _fileSystem.Directory.CreateTemporaryDirectory().DirectoryPath;
_shimsDirectory = Path.Combine(tempDirectory, "shims");
_toolsDirectory = Path.Combine(tempDirectory, "tools");
_tempDirectory = _fileSystem.Directory.CreateTemporaryDirectory().DirectoryPath;
_shimsDirectory = Path.Combine(_tempDirectory, "shims");
_toolsDirectory = Path.Combine(_tempDirectory, "tools");
_environmentPathInstructionMock = new EnvironmentPathInstructionMock(_reporter, _shimsDirectory);
_store = new ToolPackageStoreMock(new DirectoryPath(_toolsDirectory), _fileSystem);
_mockFeeds = new List<MockFeed>
Expand Down Expand Up @@ -87,6 +90,25 @@ public ToolUpdateGlobalOrToolPathCommandTests()
};
}

[Fact]
public void WhenPassingRestoreActionConfigOptions()
{
var parseResult = Parser.Instance.Parse($"dotnet tool update -g {_packageId} --ignore-failed-sources");
var toolUpdateCommand = new ToolUpdateGlobalOrToolPathCommand(parseResult);
toolUpdateCommand._toolInstallGlobalOrToolPathCommand._restoreActionConfig.IgnoreFailedSources.Should().BeTrue();
}

[Fact]
public void WhenPassingIgnoreFailedSourcesItShouldNotThrow()
{
_fileSystem.File.WriteAllText(Path.Combine(_tempDirectory, "nuget.config"), _nugetConfigWithInvalidSources);

var command = CreateUpdateCommand($"-g {_packageId} --ignore-failed-sources");

command.Execute().Should().Be(0);
_fileSystem.File.Delete(Path.Combine(_tempDirectory, "nuget.config"));
}

[Fact]
public void GivenANonFeedExistentPackageItErrors()
{
Expand Down Expand Up @@ -456,6 +478,16 @@ private ShellShimRepository GetMockedShellShimRepository()
appHostShellShimMaker: new AppHostShellShimMakerMock(_fileSystem),
filePermissionSetter: new ToolInstallGlobalOrToolPathCommandTests.NoOpFilePermissionSetter());
}

private string _nugetConfigWithInvalidSources = @"{
<?xml version=""1.0"" encoding=""utf-8""?>
<configuration>
<packageSources>
<add key=""nuget"" value=""https://api.nuget.org/v3/index.json"" />
<add key=""invalid_source"" value=""https://api.nuget.org/v3/invalid.json"" />
</packageSources>
</configuration>
}";
}
}

Loading
Loading