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,
|
LockFilePackageLibrary package,
|
||||||
LockFileTargetLibrary lockFileLibrary,
|
LockFileTargetLibrary lockFileLibrary,
|
||||||
IEnumerable<LibraryRange> dependencies,
|
IEnumerable<LibraryRange> dependencies,
|
||||||
bool compatible)
|
bool compatible,
|
||||||
|
bool resolved)
|
||||||
: base(
|
: base(
|
||||||
new LibraryIdentity(package.Name, package.Version, LibraryType.Package),
|
new LibraryIdentity(package.Name, package.Version, LibraryType.Package),
|
||||||
"sha512-" + package.Sha512,
|
"sha512-" + package.Sha512,
|
||||||
path,
|
path,
|
||||||
dependencies: dependencies,
|
dependencies: dependencies,
|
||||||
framework: null,
|
framework: null,
|
||||||
resolved: compatible,
|
resolved: resolved,
|
||||||
compatible: compatible)
|
compatible: compatible)
|
||||||
{
|
{
|
||||||
Library = package;
|
Library = package;
|
||||||
|
|
|
@ -274,13 +274,6 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
{
|
{
|
||||||
var library = pair.Value;
|
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
|
// 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
|
// To make them work seamlessly on those platforms, we fill the gap with a reference
|
||||||
// assembly (if available)
|
// assembly (if available)
|
||||||
|
@ -469,6 +462,11 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
|
|
||||||
return combiner.CombinedHash;
|
return combiner.CombinedHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name + " " + LibraryType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,17 +41,22 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
PopulateDependencies(dependencies, targetLibrary, targetFramework);
|
PopulateDependencies(dependencies, targetLibrary, targetFramework);
|
||||||
|
|
||||||
var path = _packagePathResolver.GetInstallPath(package.Name, package.Version);
|
var path = _packagePathResolver.GetInstallPath(package.Name, package.Version);
|
||||||
|
var exists = Directory.Exists(path);
|
||||||
|
|
||||||
|
if (exists)
|
||||||
|
{
|
||||||
// If the package's compile time assemblies is for a portable profile then, read the assembly metadata
|
// 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
|
// and turn System.* references into reference assembly dependencies
|
||||||
PopulateLegacyPortableDependencies(targetFramework, dependencies, path, targetLibrary);
|
PopulateLegacyPortableDependencies(targetFramework, dependencies, path, targetLibrary);
|
||||||
|
}
|
||||||
|
|
||||||
var packageDescription = new PackageDescription(
|
var packageDescription = new PackageDescription(
|
||||||
path,
|
path,
|
||||||
package,
|
package,
|
||||||
targetLibrary,
|
targetLibrary,
|
||||||
dependencies,
|
dependencies,
|
||||||
compatible);
|
compatible,
|
||||||
|
resolved: compatible && exists);
|
||||||
|
|
||||||
return packageDescription;
|
return packageDescription;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
{
|
{
|
||||||
var projectDependency = dependency.Library as ProjectDescription;
|
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;
|
ProjectDependenciesWithSources[projectDependency.Identity.Name] = projectDependency;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Microsoft.DotNet.ProjectModel.Tests
|
||||||
return new PackageDescription(PackagePath,
|
return new PackageDescription(PackagePath,
|
||||||
package ?? new LockFilePackageLibrary(),
|
package ?? new LockFilePackageLibrary(),
|
||||||
target ?? new LockFileTargetLibrary(),
|
target ?? new LockFileTargetLibrary(),
|
||||||
new List<LibraryRange>(), true);
|
new List<LibraryRange>(), compatible: true, resolved: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
Loading…
Reference in a new issue