forked from swiftlang/swift-package-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Proposed identity improvement improvements #1
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,11 +54,11 @@ private let v1_5Range: VersionSetSpecifier = .range(v1_5..<v2) | |
private let v1to3Range: VersionSetSpecifier = .range(v1..<v3) | ||
private let v2Range: VersionSetSpecifier = .range(v2..<v3) | ||
|
||
let aRef = PackageReference.local(identity: PackageIdentity(name: "a"), path: AbsolutePath("/")) | ||
let bRef = PackageReference.local(identity: PackageIdentity(name: "b"), path: AbsolutePath("/")) | ||
let cRef = PackageReference.local(identity: PackageIdentity(name: "c"), path: AbsolutePath("/")) | ||
let aRef = PackageReference.local(path: .root).with(alternateIdentity: PackageIdentity(name: "a")) | ||
let bRef = PackageReference.local(path: .root).with(alternateIdentity: PackageIdentity(name: "b")) | ||
let cRef = PackageReference.local(path: .root).with(alternateIdentity: PackageIdentity(name: "c")) | ||
|
||
let rootRef = PackageReference.root(identity: PackageIdentity(name: "root"), path: AbsolutePath("/")) | ||
let rootRef = PackageReference.root(path: .root).with(alternateIdentity: PackageIdentity(name: "root")) | ||
let rootNode = DependencyResolutionNode.root(package: rootRef) | ||
let rootCause = try! Incompatibility(Term(rootNode, .exact(v1)), root: rootNode) | ||
let _cause = try! Incompatibility("[email protected]", root: rootNode) | ||
|
@@ -301,7 +301,7 @@ final class PubgrubTests: XCTestCase { | |
|
||
func testUpdatePackageIdentifierAfterResolution() { | ||
let fooURL = "https://example.com/foo" | ||
let fooRef = PackageReference.remote(identity: PackageIdentity(url: fooURL), location: fooURL) | ||
let fooRef = PackageReference.remote(location: fooURL) | ||
let foo = MockContainer(package: fooRef, dependenciesByVersion: [v1: [:]]) | ||
foo.updatedPackage = "bar" | ||
|
||
|
@@ -395,7 +395,7 @@ final class PubgrubTests: XCTestCase { | |
root: rootNode), at: .topLevel) | ||
state2.decide(rootNode, at: v1) | ||
XCTAssertEqual(state2.solution.assignments.count, 1) | ||
try solver2.propagate(state: state2, node: .root(package: .root(identity: PackageIdentity(name: "root"), path: AbsolutePath("/")))) | ||
try solver2.propagate(state: state2, node: .root(package: PackageReference.root(path: .root).with(alternateIdentity: PackageIdentity(name: "root")))) | ||
XCTAssertEqual(state2.solution.assignments.count, 2) | ||
} | ||
|
||
|
@@ -2084,7 +2084,7 @@ class DependencyGraphBuilder { | |
if let reference = self.references[packageName] { | ||
return reference | ||
} | ||
let newReference = PackageReference.remote(identity: PackageIdentity(name: packageName), location: "/\(packageName)") | ||
let newReference = PackageReference.remote(location: "/\(packageName)") | ||
self.references[packageName] = newReference | ||
return newReference | ||
} | ||
|
@@ -2190,7 +2190,7 @@ extension Term: ExpressibleByStringLiteral { | |
} | ||
|
||
let name = components[0] | ||
let packageReference = PackageReference.remote(identity: PackageIdentity(name: name), location: "") | ||
let packageReference = PackageReference.remote(location: "").with(alternateIdentity: PackageIdentity(name: name)) | ||
|
||
guard case let .versionSet(vs) = requirement! else { | ||
fatalError() | ||
|
@@ -2203,12 +2203,12 @@ extension Term: ExpressibleByStringLiteral { | |
|
||
extension PackageReference: ExpressibleByStringLiteral { | ||
public init(stringLiteral value: String) { | ||
let ref = PackageReference.remote(identity: PackageIdentity(name: value), location: "") | ||
let ref = PackageReference.remote(location: "").with(alternateIdentity: PackageIdentity(name: value)) | ||
self = ref | ||
} | ||
|
||
init(_ name: String) { | ||
self = Self.remote(identity: PackageIdentity(name: name), location: "") | ||
self = Self.remote(location: "").with(alternateIdentity: PackageIdentity(name: name)) | ||
} | ||
} | ||
extension Result where Success == [DependencyResolver.Binding] { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
as we make progress on the identity changes my goal is to deprecate the idea of "alternate identity". as far as I can tell, the original goal of the "alternate identity" feature (it had a different name prior to swiftlang#3152) was to support an identity as driven by the name field in the manifest which is something that is too free-form to serve as an identity and we should deprecate. as such, my plan was to keep "alternate identity" for backwards compatibility for a while with a deprecation warning on the name field for manifest with new tools-version and restructure the code so its easy to remove when we are ready.
Uh oh!
There was an error while loading. Please reload this page.
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.
to this end, we may want to consider a
PackageReference.local(identity: PackageIdentity? = nil, path: AbsolutePath)
or something similarThere 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.
Deprecating this would be great — using the name causes so much confusion. I think it would make sense to have
PackageReference.local(identity: PackageIdentity? = nil, path: AbsolutePath)
.