Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/Cake.NuGet/Cake.NuGet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</ItemGroup>
<!-- Global packages -->
<ItemGroup>
<PackageReference Include="NuGet.Credentials"/>
<PackageReference Include="NuGet.Frameworks"/>
<PackageReference Include="NuGet.Versioning" />
<PackageReference Include="NuGet.Protocol" />
Expand Down
18 changes: 9 additions & 9 deletions src/Cake.NuGet/Client/NuGetLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@ public NuGetLogger(ICakeLog log)
_log = log ?? throw new ArgumentNullException(nameof(log));
}

public void LogDebug(string data) => _log.Debug(data);
public void LogDebug(string data) => _log.Debug("{0}", data);

public void LogVerbose(string data) => _log.Debug(data);
public void LogVerbose(string data) => _log.Debug("{0}", data);

public void LogInformation(string data) => _log.Debug(data);
public void LogInformation(string data) => _log.Debug("{0}", data);

public void LogMinimal(string data) => _log.Information(data);
public void LogMinimal(string data) => _log.Information("{0}", data);

public void LogWarning(string data) => _log.Warning(data);
public void LogWarning(string data) => _log.Warning("{0}", data);

public void LogError(string data) => _log.Error(data);
public void LogError(string data) => _log.Error("{0}", data);

public void LogInformationSummary(string data) => _log.Information(data);
public void LogInformationSummary(string data) => _log.Information("{0}", data);

public void LogErrorSummary(string data) => _log.Error(data);
public void LogErrorSummary(string data) => _log.Error("{0}", data);

public void Log(LogLevel level, string data) => _log.Write(GetVerbosity(level), GetLogLevel(level), data);
public void Log(LogLevel level, string data) => _log.Write(GetVerbosity(level), GetLogLevel(level), "{0}", data);

public Task LogAsync(LogLevel level, string data)
{
Expand Down
5 changes: 5 additions & 0 deletions src/Cake.NuGet/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public static class NuGet
/// The config key name for overriding the default NuGet config file.
/// </summary>
public const string ConfigFile = "NuGet_ConfigFile";

/// <summary>
/// The config key name for non-interactive mode.
/// </summary>
public const string NonInteractive = "NuGet_NonInteractive";
}

public static class Paths
Expand Down
9 changes: 9 additions & 0 deletions src/Cake.NuGet/Installers/InProcessInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Cake.Core.IO;
using NuGet.Common;
using NuGet.Configuration;
using NuGet.Credentials;
using NuGet.Frameworks;
using NuGet.Packaging;
using NuGet.Packaging.Core;
Expand Down Expand Up @@ -114,6 +115,14 @@ public IReadOnlyCollection<IFile> Install(PackageReference package, PackageType
allRepositories.AddRange(localAndPrimaryRepositories);
allRepositories.AddRange(sourceRepositoryProvider.Repositories);

var nonInteractiveString = _config.GetValue(Constants.NuGet.NonInteractive) ?? bool.TrueString;
if (!bool.TryParse(nonInteractiveString, out bool nonInteractive))
{
// If there is no explicit preference, use non interactive.
nonInteractive = true;
}
DefaultCredentialServiceUtility.SetupDefaultCredentialService(_nugetLogger, nonInteractive);

var packageIdentity = GetPackageId(package, localAndPrimaryRepositories, targetFramework, _sourceCacheContext, _nugetLogger);
if (packageIdentity == null)
{
Expand Down
3 changes: 2 additions & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NuGet.Common" Version="6.14.0" />
<PackageVersion Include="NuGet.Frameworks" Version="6.14.0" />
<PackageVersion Include="NuGet.Credentials" Version="6.14.0" />
<PackageVersion Include="NuGet.Packaging" Version="6.14.0" />
<PackageVersion Include="NuGet.Protocol" Version="6.14.0" />
<PackageVersion Include="NuGet.Resolver" Version="6.14.0" />
Expand Down Expand Up @@ -56,4 +57,4 @@
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
</ItemGroup>

</Project>
</Project>