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
|
"preserveCompilationContext": true
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"DependencyContextValidator": "1.0.0-*"
|
"DependencyContextValidator": "1.0.0-*",
|
||||||
|
"System.Diagnostics.Process": {
|
||||||
|
"version": "4.1.0-*",
|
||||||
|
"type": "build"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net451": {}
|
"net46": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ using Microsoft.DotNet.ProjectModel;
|
||||||
using Microsoft.DotNet.ProjectModel.Compilation;
|
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||||
using Microsoft.Extensions.DependencyModel;
|
using Microsoft.Extensions.DependencyModel;
|
||||||
using NuGet.Frameworks;
|
using NuGet.Frameworks;
|
||||||
|
using Microsoft.DotNet.ProjectModel.Graph;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Compiler
|
namespace Microsoft.DotNet.Tools.Compiler
|
||||||
{
|
{
|
||||||
|
@ -125,9 +126,15 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
if (compilationOptions.PreserveCompilationContext == true)
|
if (compilationOptions.PreserveCompilationContext == true)
|
||||||
{
|
{
|
||||||
var allExports = exporter.GetAllExports().ToList();
|
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,
|
var dependencyContext = new DependencyContextBuilder().Build(compilationOptions,
|
||||||
allExports,
|
filteredExports,
|
||||||
allExports,
|
filteredExports,
|
||||||
false, // For now, just assume non-portable mode in the legacy deps file (this is going away soon anyway)
|
false, // For now, just assume non-portable mode in the legacy deps file (this is going away soon anyway)
|
||||||
context.TargetFramework,
|
context.TargetFramework,
|
||||||
context.RuntimeIdentifier ?? string.Empty);
|
context.RuntimeIdentifier ?? string.Empty);
|
||||||
|
|
Loading…
Add table
Reference in a new issue