-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include PackageSpec in assets (lock) file #1025
Conversation
@@ -20,7 +19,7 @@ public static PackageSpec GetSpec(string projectFilePath, string id, VersionRang | |||
{ | |||
var name = $"{id}-{Guid.NewGuid().ToString()}"; | |||
|
|||
return new PackageSpec(new JObject()) | |||
return new PackageSpec() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
namespace NuGet.LibraryModel | ||
{ | ||
public class ToolDependency | ||
public class ToolDependency : IEquatable<ToolDependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be removed from PackageSpec instead, I must have missed it when removing the rest of the XProj support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided to do this as a separate item:
NuGet/Home#3986
@@ -46,6 +47,7 @@ public class LockFileFormat | |||
private const string ToolsProperty = "tools"; | |||
private const string ProjectFileToolGroupsProperty = "projectFileToolGroups"; | |||
private const string PackageFoldersProperty = "packageFolders"; | |||
private const string PackageSpecProperty = "packageSpec"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have a different name? packageSpec is a bit confusing already, maybe: restoreSpec, project, or projectMetadata, thoughts?
Internally the PackageSpec name makes sense, just not for anyone else viewing this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
project
is best, I think. Good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
This reverts commit 81491a5. # Conflicts: # test/NuGet.Core.FuncTests/NuGet.Commands.FuncTest/compiler/resources/uwpBlankAppV2.json # test/NuGet.Core.Tests/NuGet.ProjectModel.Test/LockFileFormatTests.cs
During the commit step of a restore operation, we write out a
project.lock.json
file or aproject.assets.json
file. I have added a property to this JSON object"packageSpec"
. The value is the input package spec.The .dg file already has serialized
PackageSpec
instances.Notable accomplishments:
PackageSpec
property to the lock file model, serialization, and deserializationEquals
andGetHashCode
implementations toPackageSpec
and all of its child modelsPackageSpec
instances, I did not take theName
andFilePath
properties into account. These are not serialized so I figured anything that did not round trip should not be considered part of the equality logic. Additionally the file path that your read aPackageSpec
from should not matter.EqualityUtility
and hash code helpers toHashCodeCombiner
GetJObject
method toJsonObjectWriter
to avoid unnecessary serializationProperties
property fromPackageSpec
HashCodeCombiner
implementationPackageSpecReferenceDependencyProvider
to cloneLibraryDependency
instances.Completes the second item in NuGet/Home#3891 (comment).
/cc @emgarten @alpaix @dtivel