Move methods back to client code
This commit is contained in:
parent
b2aae7546a
commit
698c82915e
4 changed files with 19 additions and 35 deletions
|
@ -161,8 +161,12 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
builder.AddNativeLibraryGroup(new LibraryAssetGroup(PopulateAssets(library, library.NativeLibraries)));
|
||||
builder.AddRuntimeAssemblyGroup(new LibraryAssetGroup(PopulateAssets(library, library.RuntimeAssemblies)));
|
||||
builder.WithCompilationAssemblies(PopulateAssets(library, library.CompileTimeAssemblies));
|
||||
builder.WithSourceReferences(GetSharedSources(library));
|
||||
builder.WithAnalyzerReference(GetAnalyzerReferences(library));
|
||||
|
||||
if (library.Identity.Type.Equals(LibraryType.Package))
|
||||
{
|
||||
builder.WithSourceReferences(GetSharedSources((PackageDescription) library));
|
||||
builder.WithAnalyzerReference(GetAnalyzerReferences((PackageDescription) library));
|
||||
}
|
||||
|
||||
if (library.ContentFiles.Any())
|
||||
{
|
||||
|
@ -340,14 +344,23 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
|||
return builder.Build();
|
||||
}
|
||||
|
||||
private IEnumerable<LibraryAsset> GetSharedSources(TargetLibraryWithAssets library)
|
||||
private IEnumerable<LibraryAsset> GetSharedSources(PackageDescription package)
|
||||
{
|
||||
return library.GetSharedSources().Select(path => LibraryAsset.CreateFromRelativePath(library.Path, path));
|
||||
return package
|
||||
.PackageLibrary
|
||||
.Files
|
||||
.Where(path => path.StartsWith("shared" + Path.DirectorySeparatorChar))
|
||||
.Select(path => LibraryAsset.CreateFromRelativePath(package.Path, path));
|
||||
}
|
||||
|
||||
private IEnumerable<AnalyzerReference> GetAnalyzerReferences(TargetLibraryWithAssets package)
|
||||
private IEnumerable<AnalyzerReference> GetAnalyzerReferences(PackageDescription package)
|
||||
{
|
||||
var analyzers = package.GetAnalyzerReferences();
|
||||
var analyzers = package
|
||||
.PackageLibrary
|
||||
.Files
|
||||
.Where(path => path.StartsWith("analyzers" + Path.DirectorySeparatorChar) &&
|
||||
path.EndsWith(".dll"));
|
||||
|
||||
|
||||
var analyzerRefs = new List<AnalyzerReference>();
|
||||
// See https://docs.nuget.org/create/analyzers-conventions for the analyzer
|
||||
|
|
|
@ -39,15 +39,5 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
public LockFileProjectLibrary ProjectLibrary { get; }
|
||||
|
||||
public Project ProjectFile { get; }
|
||||
|
||||
public override IEnumerable<string> GetSharedSources()
|
||||
{
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetAnalyzerReferences()
|
||||
{
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,20 +42,5 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
{
|
||||
return items.Where(a => !PackageDependencyProvider.IsPlaceholderFile(a));
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetSharedSources()
|
||||
{
|
||||
return PackageLibrary
|
||||
.Files
|
||||
.Where(path => path.StartsWith("shared" + System.IO.Path.DirectorySeparatorChar));
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetAnalyzerReferences()
|
||||
{
|
||||
return PackageLibrary
|
||||
.Files
|
||||
.Where(path => path.StartsWith("analyzers" + System.IO.Path.DirectorySeparatorChar) &&
|
||||
path.EndsWith(".dll"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,5 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
public virtual IEnumerable<LockFileContentFile> ContentFiles => TargetLibrary.ContentFiles;
|
||||
|
||||
public virtual IEnumerable<LockFileRuntimeTarget> RuntimeTargets => TargetLibrary.RuntimeTargets;
|
||||
|
||||
public abstract IEnumerable<string> GetSharedSources();
|
||||
|
||||
public abstract IEnumerable<string> GetAnalyzerReferences();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue