2015-11-16 11:21:57 -08:00
|
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2016-02-23 02:34:27 -08:00
|
|
|
|
using System.Linq;
|
2015-11-27 16:19:54 -08:00
|
|
|
|
using Microsoft.DotNet.ProjectModel.Graph;
|
2016-02-23 02:34:27 -08:00
|
|
|
|
using Microsoft.DotNet.ProjectModel.Resolution;
|
2015-10-13 14:31:29 -07:00
|
|
|
|
|
2015-11-27 16:19:54 -08:00
|
|
|
|
namespace Microsoft.DotNet.ProjectModel
|
2015-10-13 14:31:29 -07:00
|
|
|
|
{
|
2016-03-23 15:26:36 -07:00
|
|
|
|
public class PackageDescription : TargetLibraryWithAssets
|
2015-10-13 14:31:29 -07:00
|
|
|
|
{
|
|
|
|
|
public PackageDescription(
|
|
|
|
|
string path,
|
2015-10-21 15:21:14 -07:00
|
|
|
|
LockFilePackageLibrary package,
|
|
|
|
|
LockFileTargetLibrary lockFileLibrary,
|
2015-10-13 14:31:29 -07:00
|
|
|
|
IEnumerable<LibraryRange> dependencies,
|
2016-03-04 01:17:37 -08:00
|
|
|
|
bool compatible,
|
|
|
|
|
bool resolved)
|
2015-10-13 14:31:29 -07:00
|
|
|
|
: base(
|
|
|
|
|
new LibraryIdentity(package.Name, package.Version, LibraryType.Package),
|
2015-10-21 15:21:14 -07:00
|
|
|
|
"sha512-" + package.Sha512,
|
2015-10-13 14:31:29 -07:00
|
|
|
|
path,
|
2016-03-23 15:26:36 -07:00
|
|
|
|
lockFileLibrary,
|
|
|
|
|
dependencies,
|
2016-03-04 01:17:37 -08:00
|
|
|
|
resolved: resolved,
|
2016-03-23 15:26:36 -07:00
|
|
|
|
compatible: compatible,
|
|
|
|
|
framework: null)
|
2015-10-13 14:31:29 -07:00
|
|
|
|
{
|
2016-03-23 15:26:36 -07:00
|
|
|
|
PackageLibrary = package;
|
2015-10-13 14:31:29 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-23 15:26:36 -07:00
|
|
|
|
public LockFilePackageLibrary PackageLibrary { get; }
|
2016-02-23 02:34:27 -08:00
|
|
|
|
|
2016-03-23 15:26:36 -07:00
|
|
|
|
public override IEnumerable<LockFileItem> RuntimeAssemblies => FilterPlaceholders(base.RuntimeAssemblies);
|
2016-02-23 02:34:27 -08:00
|
|
|
|
|
2016-03-23 15:26:36 -07:00
|
|
|
|
public override IEnumerable<LockFileItem> CompileTimeAssemblies => FilterPlaceholders(base.CompileTimeAssemblies);
|
2016-02-23 02:34:27 -08:00
|
|
|
|
|
2016-05-03 02:00:12 -07:00
|
|
|
|
public bool HasCompileTimePlaceholder => base.CompileTimeAssemblies.Any() && base.CompileTimeAssemblies.All(a => PackageDependencyProvider.IsPlaceholderFile(a));
|
2016-04-21 09:05:55 -07:00
|
|
|
|
|
2016-03-23 15:26:36 -07:00
|
|
|
|
private static IEnumerable<LockFileItem> FilterPlaceholders(IEnumerable<LockFileItem> items)
|
|
|
|
|
{
|
|
|
|
|
return items.Where(a => !PackageDependencyProvider.IsPlaceholderFile(a));
|
|
|
|
|
}
|
2015-10-13 14:31:29 -07:00
|
|
|
|
}
|
|
|
|
|
}
|