Merge pull request #3256 from dotnet/pakrym/filter-fullcrl-deps
Filter build dependencies from fullclr embedded deps file
This commit is contained in:
commit
0f573ed04b
2 changed files with 15 additions and 4 deletions
|
@ -5,9 +5,13 @@
|
|||
"preserveCompilationContext": true
|
||||
},
|
||||
"dependencies": {
|
||||
"DependencyContextValidator": "1.0.0-*"
|
||||
"DependencyContextValidator": "1.0.0-*",
|
||||
"System.Diagnostics.Process": {
|
||||
"version": "4.1.0-*",
|
||||
"type": "build"
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {}
|
||||
"net46": {}
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ using Microsoft.DotNet.ProjectModel;
|
|||
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||
using Microsoft.Extensions.DependencyModel;
|
||||
using NuGet.Frameworks;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Compiler
|
||||
{
|
||||
|
@ -125,9 +126,15 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
if (compilationOptions.PreserveCompilationContext == true)
|
||||
{
|
||||
var allExports = exporter.GetAllExports().ToList();
|
||||
var exportsLookup = allExports.ToDictionary(e => e.Library.Identity.Name);
|
||||
var buildExclusionList = context.GetTypeBuildExclusionList(exportsLookup);
|
||||
var filteredExports = allExports
|
||||
.Where(e => e.Library.Identity.Type.Equals(LibraryType.ReferenceAssembly) ||
|
||||
!buildExclusionList.Contains(e.Library.Identity.Name));
|
||||
|
||||
var dependencyContext = new DependencyContextBuilder().Build(compilationOptions,
|
||||
allExports,
|
||||
allExports,
|
||||
filteredExports,
|
||||
filteredExports,
|
||||
false, // For now, just assume non-portable mode in the legacy deps file (this is going away soon anyway)
|
||||
context.TargetFramework,
|
||||
context.RuntimeIdentifier ?? string.Empty);
|
||||
|
|
Loading…
Reference in a new issue