Skip to content

improve correctness by using identity more broadly throughout the code #3152

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
wants to merge 2 commits into from

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Dec 28, 2020

motivation: improve correctness by using identity more broadly throughout the code

changes:

  • remove name from package-reference, replace with alternate-identity for secondary (manifest driven) identity
  • use identity to lookup managed-dependencies and pins instead of urls
  • adjust tests

❗ this the the first part in a series of PRs, once this is merged and "baked" will continue with the next steps

@tomerd tomerd marked this pull request as draft December 28, 2020 09:04
@tomerd tomerd changed the title improve correctlness by using identity more broadly throughout the code improve correctness by using identity more broadly throughout the code Dec 28, 2020
@tomerd
Copy link
Contributor Author

tomerd commented Dec 28, 2020

@swift-ci please smoke test

@tomerd tomerd self-assigned this Dec 28, 2020
tomerd and others added 2 commits December 28, 2020 14:05
motivation: improve correctlness by using identity more broadly throughout the code

changes:
* remove name from package-reference, replace with alternate-identity for secondary (manifest driven) identity
* use identity to lookup managed-dependencies and pins instead of urls
* refactor pins map serialization
* adjust tests
* rename PackageReference::path to PackageReference::location to make its true meaning clearer
* make PackageReference ctro take kind explicitly instead of defaulting to remote to make code more explicit
* rename PackageContainer::identifer to PackageContainer::pacakge to reflect the correct type
* adjust call-sites and other related code
@tomerd tomerd force-pushed the refactor/identity-1 branch from 72eb799 to 689e70c Compare December 28, 2020 22:11
@tomerd
Copy link
Contributor Author

tomerd commented Dec 28, 2020

@swift-ci please smoke test

@tomerd
Copy link
Contributor Author

tomerd commented Dec 28, 2020

cc @mattt

Copy link
Contributor

@mattt mattt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic. Excellent work, @tomerd! This is something I tried (and failed) to implement a handful of times in the run-up to #3057. (My approach was to convert PackageReference to an enumeration of root / local / remote, but that was too cumbersome in practice; your approach to ease in with static constructors is smart)

For your consideration, I have some follow-up changes here: https://github.com/mattt/swift-package-manager/pull/1/files

My goal here was to eliminate some of the redundancy of initializing PackageIdentity values when creating package references. Not only for the net reduction in code, but to reenforce the relationship of package identity as being derived from the package reference. With this change, a PackageIdentity is only created directly if there isn't already a package reference or if we need to override something (such as for tests or for legacy identity)

@tomerd
Copy link
Contributor Author

tomerd commented Jan 2, 2021

For your consideration, I have some follow-up changes here: https://github.com/mattt/swift-package-manager/pull/1/files

this is great, thanks for putting together. should we wait for this to be merged and you can follow on with a PR? I am also working on the next PR in this series but that work does not conflict with yours

@abertelrud
Copy link
Contributor

This is great! I had left a question in the follow-on PR #3155 about the change to the pins store, which I think is the internal name for the Package.resolved? If so, I wonder if there is something we can do to make the experience better for old toolchains (e.g. 5.4) encountering the new keys. I agree with the change, just thinking about the ergonomics of the change.

@mattt
Copy link
Contributor

mattt commented Jan 5, 2021

should we wait for this to be merged and you can follow on with a PR? I am also working on the next PR in this series but that work does not conflict with yours

@tomerd It's as you like it. I'm happy to submit a follow-up PR if that makes things easier for you.

@tomerd
Copy link
Contributor Author

tomerd commented Jan 5, 2021

@swift-ci please smoke test macOS Platform

@tomerd tomerd added the next waiting for next merge window label Jan 5, 2021
@tomerd tomerd marked this pull request as draft February 1, 2021 22:15
@tomerd
Copy link
Contributor Author

tomerd commented Feb 8, 2021

closing in favor of #3244

@tomerd tomerd closed this Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next waiting for next merge window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants