Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Fix output of "dnu publish --quiet" #1928

Merged
merged 1 commit into from
May 22, 2015
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task<bool> Execute()
LocalPackages = Options.SourcePackages ??
NuGetDependencyResolver.ResolveRepositoryPath(Directory.GetCurrentDirectory());

Options.Reports.Information.WriteLine(string.Format("Adding NuGet package {0} to {1}",
Options.Reports.Quiet.WriteLine(string.Format("Adding NuGet package {0} to {1}",
Options.NuGetPackage.Bold(), LocalPackages.Bold()));

var sw = new Stopwatch();
Expand All @@ -33,10 +33,10 @@ public async Task<bool> Execute()

using (var stream = File.OpenRead(Options.NuGetPackage))
{
await NuGetPackageUtils.InstallFromStream(stream, library, LocalPackages, Reports.Information);
await NuGetPackageUtils.InstallFromStream(stream, library, LocalPackages, Reports.Quiet);
}

Reports.Information.WriteLine(
Reports.Quiet.WriteLine(
"{0}, {1}ms elapsed",
"Add complete".Green().Bold(),
sw.ElapsedMilliseconds);
Expand Down
12 changes: 10 additions & 2 deletions src/Microsoft.Framework.PackageManager/Publish/PublishProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ private bool EmitNupkg(PublishRoot root)
buildOptions.ProjectDir = project.ProjectDirectory;
buildOptions.OutputDir = Path.Combine(project.ProjectDirectory, "bin");
buildOptions.Configurations.Add(root.Configuration);
buildOptions.Reports = root.Reports;
buildOptions.GeneratePackages = true;
buildOptions.Reports = root.Reports.ShallowCopy();

// Mute "dnu pack" completely if it is invoked by "dnu publish --quiet"
buildOptions.Reports.Information = root.Reports.Quiet;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, you'll see
publishmessage_extrabuild


var buildManager = new BuildManager(root.HostServices, buildOptions);
if (!buildManager.Build())
{
Expand Down Expand Up @@ -419,7 +423,11 @@ private bool UpdateLockFile(PublishRoot root)
restoreCommand.CheckHashFile = false;
restoreCommand.RestoreDirectories.Add(restoreDirectory);
restoreCommand.FeedOptions = feedOptions;
restoreCommand.Reports = root.Reports;
restoreCommand.Reports = root.Reports.ShallowCopy();

// Mute "dnu restore" completely if it is invoked by "dnu publish --quiet"
restoreCommand.Reports.Information = root.Reports.Quiet;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, you'll see
publishmessage_extrarestore


tasks[i] = restoreCommand.Execute();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public PublishRoot(Runtime.Project project, string outputPath, IServiceProvider

public bool Emit()
{
Reports.Quiet.WriteLine("Copying to output path {0}", OutputPath);
Reports.Information.WriteLine("Copying to output path {0}", OutputPath);

var mainProject = Projects.Single(project => project.Name == _project.Name);

Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.Framework.PackageManager/Reports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ public class Reports
public IReport Verbose { get; set; }
public IReport Quiet { get; set; }
public IReport Error { get; set; }

public Reports ShallowCopy()
{
return MemberwiseClone() as Reports;
}
}
}