Addressing code review comments.

This commit is contained in:
Livar Cunha 2016-10-05 11:51:59 -07:00
parent facbef52ff
commit 465b32dab4
8 changed files with 28 additions and 15 deletions

View file

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic; using System.Collections.Generic;
using NuGet.ProjectModel; using NuGet.ProjectModel;

View file

@ -54,15 +54,11 @@ namespace Microsoft.DotNet.Cli.CommandResolution
allExclusionList.UnionWith(lockFileTarget.GetPlatformExclusionList(libraryLookup)); allExclusionList.UnionWith(lockFileTarget.GetPlatformExclusionList(libraryLookup));
} }
// TODO: exclude "type: build" dependencies during publish - https://github.com/dotnet/sdk/issues/42
return runtimeLibraries.Filter(allExclusionList).ToArray(); return runtimeLibraries.Filter(allExclusionList).ToArray();
} }
public static IEnumerable<LockFileTargetLibrary> GetCompileLibraries(this LockFileTarget lockFileTarget) public static IEnumerable<LockFileTargetLibrary> GetCompileLibraries(this LockFileTarget lockFileTarget)
{ {
// TODO: exclude "type: build" dependencies during publish - https://github.com/dotnet/sdk/issues/42
return lockFileTarget.Libraries; return lockFileTarget.Libraries;
} }

View file

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -7,18 +10,18 @@ using NuGet.ProjectModel;
namespace Microsoft.DotNet.Cli.CommandResolution namespace Microsoft.DotNet.Cli.CommandResolution
{ {
internal class CSProjProject : IProject internal class MSBuildProject : IProject
{ {
private Project _project; private Project _project;
public CSProjProject(string csProjPath) public MSBuildProject(string msBuildProjectPath)
{ {
var globalProperties = new Dictionary<string, string>() var globalProperties = new Dictionary<string, string>()
{ {
{ "MSBuildExtensionsPath", AppContext.BaseDirectory } { "MSBuildExtensionsPath", AppContext.BaseDirectory }
}; };
_project = new Project(csProjPath, globalProperties, null); _project = new Project(msBuildProjectPath, globalProperties, null);
} }
public LockFile GetLockFile() public LockFile GetLockFile()

View file

@ -10,19 +10,19 @@ namespace Microsoft.DotNet.Cli.CommandResolution
{ {
public IProject GetProject(string projectDirectory) public IProject GetProject(string projectDirectory)
{ {
return GetCsProjProject(projectDirectory) ?? return GetMSBuildProj(projectDirectory) ??
GetProjectJsonProject(projectDirectory); GetProjectJsonProject(projectDirectory);
} }
private IProject GetCsProjProject(string projectDirectory) private IProject GetMSBuildProj(string projectDirectory)
{ {
string csProjPath = GetCSProjPath(projectDirectory); string msBuildProjectPath = GetMSBuildProjPath(projectDirectory);
if(csProjPath == null) if(msBuildProjectPath == null)
{ {
return null; return null;
} }
return new CSProjProject(csProjPath); return new MSBuildProject(msBuildProjectPath);
} }
private IProject GetProjectJsonProject(string projectDirectory) private IProject GetProjectJsonProject(string projectDirectory)
@ -30,7 +30,7 @@ namespace Microsoft.DotNet.Cli.CommandResolution
return new ProjectJsonProject(projectDirectory); return new ProjectJsonProject(projectDirectory);
} }
private string GetCSProjPath(string projectDirectory) private string GetMSBuildProjPath(string projectDirectory)
{ {
string[] projectFiles = Directory.GetFiles(projectDirectory, "*.*proj"); string[] projectFiles = Directory.GetFiles(projectDirectory, "*.*proj");

View file

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;

View file

@ -1,4 +1,7 @@
using System; // Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;

View file

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Cli.CommandResolution namespace Microsoft.DotNet.Cli.CommandResolution

View file

@ -63,7 +63,9 @@ namespace Microsoft.DotNet.Tests.EndToEnd
.WithWorkingDirectory(testInstance.TestRoot) .WithWorkingDirectory(testInstance.TestRoot)
.ExecuteWithCapturedOutput("portable") .ExecuteWithCapturedOutput("portable")
.Should() .Should()
.Pass(); .Pass()
.And
.HaveStdOutContaining("Hello Portable World!");;
} }
} }
} }