Invert boolean logic for project refs building

This commit is contained in:
David Fowler 2015-10-18 07:41:59 -07:00
parent ba743b1ae6
commit dc46d3e23e

View file

@ -38,7 +38,7 @@ namespace Microsoft.DotNet.Tools.Compiler
path = Directory.GetCurrentDirectory(); path = Directory.GetCurrentDirectory();
} }
var skipBuildingProjectReferences = noProjectDependencies.HasValue(); var buildProjectReferences = !noProjectDependencies.HasValue();
// Load project contexts for each framework and compile them // Load project contexts for each framework and compile them
bool success = true; bool success = true;
@ -46,14 +46,14 @@ namespace Microsoft.DotNet.Tools.Compiler
{ {
foreach (var context in framework.Values.Select(f => ProjectContext.Create(path, NuGetFramework.Parse(f)))) foreach (var context in framework.Values.Select(f => ProjectContext.Create(path, NuGetFramework.Parse(f))))
{ {
success &= Compile(context, configuration.Value() ?? Constants.DefaultConfiguration, output.Value(), skipBuildingProjectReferences); success &= Compile(context, configuration.Value() ?? Constants.DefaultConfiguration, output.Value(), buildProjectReferences);
} }
} }
else else
{ {
foreach (var context in ProjectContext.CreateContextForEachFramework(path)) foreach (var context in ProjectContext.CreateContextForEachFramework(path))
{ {
success &= Compile(context, configuration.Value() ?? Constants.DefaultConfiguration, output.Value(), skipBuildingProjectReferences); success &= Compile(context, configuration.Value() ?? Constants.DefaultConfiguration, output.Value(), buildProjectReferences);
} }
} }
return success ? 0 : 1; return success ? 0 : 1;
@ -70,7 +70,7 @@ namespace Microsoft.DotNet.Tools.Compiler
} }
} }
private static bool Compile(ProjectContext context, string configuration, string outputPath, bool skipBuildingProjectReferences) private static bool Compile(ProjectContext context, string configuration, string outputPath, bool buildProjectReferences)
{ {
Reporter.Output.WriteLine($"Building {context.RootProject.Identity.Name.Yellow()} for {context.TargetFramework.DotNetFrameworkName.Yellow()}"); Reporter.Output.WriteLine($"Building {context.RootProject.Identity.Name.Yellow()} for {context.TargetFramework.DotNetFrameworkName.Yellow()}");
@ -95,7 +95,7 @@ namespace Microsoft.DotNet.Tools.Compiler
// Gather exports for the project // Gather exports for the project
var dependencies = exporter.GetCompilationDependencies().ToList(); var dependencies = exporter.GetCompilationDependencies().ToList();
if (!skipBuildingProjectReferences) if (buildProjectReferences)
{ {
var projects = new Dictionary<string, ProjectDescription>(); var projects = new Dictionary<string, ProjectDescription>();
@ -125,6 +125,8 @@ namespace Microsoft.DotNet.Tools.Compiler
return false; return false;
} }
} }
projects.Clear();
} }
// Dump dependency data // Dump dependency data