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

Make global.json accept project directories in 'projects' property #2116

Merged
merged 1 commit into from
Jun 24, 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
4 changes: 2 additions & 2 deletions src/Microsoft.Framework.Runtime/ProjectResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ private void Initialize(string projectPath, string rootPath)

// Resolve all of the potential projects
_projects = _searchPaths.Select(path => new DirectoryInfo(path))
.Distinct(new DirectoryInfoFullPathComparator())
.Where(d => d.Exists)
.SelectMany(d => d.EnumerateDirectories())
.SelectMany(d => new[] { d }.Concat(d.EnumerateDirectories()))
.Distinct(new DirectoryInfoFullPathComparator())
.Select(dirInfoToProjectInfo)
.ToLookup(d => d.Name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,36 @@ public void ProjectResolverDoesNotThrowWhenThereAreDuplicatedEntriesInGlobalJson
Assert.NotNull(project);
}
}

[Fact]
public void CanSpecifyProjectDirectoryInGlobalJson()
{
var solutionStructure = @"{
'global.json': '',
'src': {
'ProjectA': {
'project.json': '{}'
}
},
'ProjectB': {
'project.json': '{}'
}
}";

using (var solutionPath = new DisposableDir())
{
DirTree.CreateFromJson(solutionStructure)
.WithFileContents("global.json", @"{
""projects"": [""src"", ""ProjectB""]
}")
.WriteTo(solutionPath);

var resolutionRoot = Path.Combine(solutionPath, "src", "ProjectA");

Project project;
Assert.True(new ProjectResolver(resolutionRoot).TryResolveProject("ProjectB", out project));
Assert.NotNull(project);
}
}
}
}