Merge pull request #1699 from dotnet/davidfowl/error-handling
Tweak error handling a little bit
This commit is contained in:
commit
3ed9361763
5 changed files with 19 additions and 15 deletions
|
@ -16,14 +16,15 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
LockFilePackageLibrary package,
|
||||
LockFileTargetLibrary lockFileLibrary,
|
||||
IEnumerable<LibraryRange> dependencies,
|
||||
bool compatible)
|
||||
bool compatible,
|
||||
bool resolved)
|
||||
: base(
|
||||
new LibraryIdentity(package.Name, package.Version, LibraryType.Package),
|
||||
"sha512-" + package.Sha512,
|
||||
path,
|
||||
dependencies: dependencies,
|
||||
framework: null,
|
||||
resolved: compatible,
|
||||
resolved: resolved,
|
||||
compatible: compatible)
|
||||
{
|
||||
Library = package;
|
||||
|
|
|
@ -274,13 +274,6 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
{
|
||||
var library = pair.Value;
|
||||
|
||||
if (Equals(library.Identity.Type, LibraryType.Package) &&
|
||||
!Directory.Exists(library.Path))
|
||||
{
|
||||
// If the package path doesn't exist then mark this dependency as unresolved
|
||||
library.Resolved = false;
|
||||
}
|
||||
|
||||
// The System.* packages provide placeholders on any non netstandard platform
|
||||
// To make them work seamlessly on those platforms, we fill the gap with a reference
|
||||
// assembly (if available)
|
||||
|
@ -469,6 +462,11 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
|
||||
return combiner.CombinedHash;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name + " " + LibraryType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,17 +41,22 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
|||
PopulateDependencies(dependencies, targetLibrary, targetFramework);
|
||||
|
||||
var path = _packagePathResolver.GetInstallPath(package.Name, package.Version);
|
||||
var exists = Directory.Exists(path);
|
||||
|
||||
// If the package's compile time assemblies is for a portable profile then, read the assembly metadata
|
||||
// and turn System.* references into reference assembly dependencies
|
||||
PopulateLegacyPortableDependencies(targetFramework, dependencies, path, targetLibrary);
|
||||
if (exists)
|
||||
{
|
||||
// If the package's compile time assemblies is for a portable profile then, read the assembly metadata
|
||||
// and turn System.* references into reference assembly dependencies
|
||||
PopulateLegacyPortableDependencies(targetFramework, dependencies, path, targetLibrary);
|
||||
}
|
||||
|
||||
var packageDescription = new PackageDescription(
|
||||
path,
|
||||
package,
|
||||
targetLibrary,
|
||||
dependencies,
|
||||
compatible);
|
||||
compatible,
|
||||
resolved: compatible && exists);
|
||||
|
||||
return packageDescription;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Microsoft.DotNet.Tools.Build
|
|||
{
|
||||
var projectDependency = dependency.Library as ProjectDescription;
|
||||
|
||||
if (projectDependency != null && projectDependency.Project.Files.SourceFiles.Any())
|
||||
if (projectDependency != null && projectDependency.Resolved && projectDependency.Project.Files.SourceFiles.Any())
|
||||
{
|
||||
ProjectDependenciesWithSources[projectDependency.Identity.Name] = projectDependency;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Microsoft.DotNet.ProjectModel.Tests
|
|||
return new PackageDescription(PackagePath,
|
||||
package ?? new LockFilePackageLibrary(),
|
||||
target ?? new LockFileTargetLibrary(),
|
||||
new List<LibraryRange>(), true);
|
||||
new List<LibraryRange>(), compatible: true, resolved: true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Reference in a new issue