Fixed compilation issues with source exports

- Dependencies can have multiple parents. Fix the object model for that.
- Also moved shared file resolution to the right spot
This commit is contained in:
David Fowler 2015-10-16 22:50:44 -07:00
parent 25d9b419bc
commit adaf7f9be4
3 changed files with 9 additions and 10 deletions

View file

@ -51,12 +51,11 @@ namespace Microsoft.Extensions.ProjectModel.Compilation
private IEnumerable<LibraryExport> ExportLibraries(Func<LibraryDescription, bool> condition) private IEnumerable<LibraryExport> ExportLibraries(Func<LibraryDescription, bool> condition)
{ {
var seenMetadataReferences = new HashSet<string>(); var seenMetadataReferences = new HashSet<string>();
var seenRuntimeReferences = new HashSet<string>();
// Iterate over libraries in the library manager // Iterate over libraries in the library manager
foreach (var library in LibraryManager.GetLibraries()) foreach (var library in LibraryManager.GetLibraries())
{ {
if(!condition(library)) if (!condition(library))
{ {
continue; continue;
} }
@ -78,7 +77,7 @@ namespace Microsoft.Extensions.ProjectModel.Compilation
} }
} }
if (library.Parent != null && Equals(library.Parent.Identity, _rootProject.Identity)) if (library.Parents.Contains(_rootProject))
{ {
// Only process source references for direct dependencies // Only process source references for direct dependencies
foreach (var sourceReference in libraryExport.SourceReferences) foreach (var sourceReference in libraryExport.SourceReferences)
@ -153,12 +152,12 @@ namespace Microsoft.Extensions.ProjectModel.Compilation
{ {
compileAssemblies.Add(outputPath); compileAssemblies.Add(outputPath);
} }
}
// Add shared sources // Add shared sources
foreach (var sharedFile in project.Project.Files.SharedFiles) foreach (var sharedFile in project.Project.Files.SharedFiles)
{ {
sourceReferences.Add(sharedFile); sourceReferences.Add(sharedFile);
}
} }
// No support for ref or native in projects, so runtimeAssemblies is just the same as compileAssemblies and nativeLibraries are empty // No support for ref or native in projects, so runtimeAssemblies is just the same as compileAssemblies and nativeLibraries are empty

View file

@ -33,7 +33,7 @@ namespace Microsoft.Extensions.ProjectModel
public LibraryRange RequestedRange { get; } public LibraryRange RequestedRange { get; }
public LibraryIdentity Identity { get; } public LibraryIdentity Identity { get; }
public LibraryDescription Parent { get; set; } public List<LibraryDescription> Parents { get; set; } = new List<LibraryDescription>();
public string Path { get; } public string Path { get; }
public IEnumerable<LibraryRange> Dependencies { get; } public IEnumerable<LibraryRange> Dependencies { get; }
public bool Compatible { get; } public bool Compatible { get; }

View file

@ -157,7 +157,7 @@ namespace Microsoft.Extensions.ProjectModel
} }
} }
dep.Parent = library; dep.Parents.Add(library);
} }
} }
} }