-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Do not store products in resolved file #2792
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,17 +23,12 @@ public final class PinsStore { | |
/// The pinned state. | ||
public let state: CheckoutState | ||
|
||
/// The product filter applied by the pin. | ||
public let productFilter: ProductFilter | ||
|
||
public init( | ||
packageRef: PackageReference, | ||
state: CheckoutState, | ||
productFilter: ProductFilter | ||
state: CheckoutState | ||
) { | ||
self.packageRef = packageRef | ||
self.state = state | ||
self.productFilter = productFilter | ||
} | ||
} | ||
|
||
|
@@ -88,13 +83,11 @@ public final class PinsStore { | |
/// - state: The state to pin at. | ||
public func pin( | ||
packageRef: PackageReference, | ||
state: CheckoutState, | ||
productFilter: ProductFilter | ||
state: CheckoutState | ||
) { | ||
pinsMap[packageRef.identity] = Pin( | ||
packageRef: packageRef, | ||
state: state, | ||
productFilter: productFilter | ||
state: state | ||
) | ||
} | ||
|
||
|
@@ -117,7 +110,7 @@ public final class PinsStore { | |
public func createConstraints() -> [RepositoryPackageConstraint] { | ||
return pins.map({ pin in | ||
return RepositoryPackageConstraint( | ||
container: pin.packageRef, requirement: pin.state.requirement(), products: pin.productFilter) | ||
container: pin.packageRef, requirement: pin.state.requirement(), products: .everything) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won’t this constraint mean that every pin could potentially want more of its transitive dependencies after it’s loaded than when it was pinned? If a package is resolved was at 1.0.0 for use of product B, then it will be pinned at 1.0.0 with no product information (which ought to be somehow inferable). Upon loading the pins, it will be loaded at 1.0.0 for use of products A and B, and the resolver will go hunting for all of product A’s dependencies. Or is that not what happens? Passing I will try both variants and get back to you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These constraints are no longer actually being used by the resolver, I removed this method in #2793 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I see that now. It makes things much simpler. |
||
}) | ||
} | ||
} | ||
|
@@ -159,16 +152,14 @@ extension PinsStore.Pin: JSONMappable, JSONSerializable, Equatable { | |
let ref = PackageReference(identity: identity, path: url) | ||
self.packageRef = name.flatMap(ref.with(newName:)) ?? ref | ||
self.state = try json.get("state") | ||
self.productFilter = try json.get("products") | ||
} | ||
|
||
/// Convert the pin to JSON. | ||
public func toJSON() -> JSON { | ||
return .init([ | ||
"package": packageRef.name.toJSON(), | ||
"repositoryURL": packageRef.path, | ||
"state": state, | ||
"products": productFilter, | ||
"state": state | ||
]) | ||
} | ||
} |
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.
you can remove this method, it's dead code
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.
Ah right, I'll make a follow up to clean this up.
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.
#2793