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
[Documentation] Add package edit documentation #794
Conversation
ankitspd
commented
Nov 16, 2016
- https://bugs.swift.org/browse/SR-3115
29bd682
to
a5f8faf
Compare
|
||
$ swift package edit Foo --revision 969c6a9 | ||
|
||
This is similar to previous version except that SwiftPM will leave the dependency at a detched HEAD on the specified revision. |
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.
Is it possible to just do swift package edit Foo
to leave it at the currently checked out revision, or does a revision or branch always need to be specified? (it feels like we discussed this when discussing the swift-evolution proposal but I don't remember now where we came down on this)
If one or the other always has to be specified, then perhaps that should be explicitly stated and the rationale given, since it feels very natural to want to just do swift package edit Foo
.
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.
Agree we should clarify this.
$ swift package unedit Foo # --force | ||
|
||
This will remove the edited dependency from Packages/ and put the originally resolved version back. This command will fail if there are uncommited changes or changes which are not | ||
pushed to the remote repository. The `--force` option can be used to forcefully unedit a dependency. |
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 probably clarify that this will discard the edits (assuming that's what it does).
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.
I agree, I would probably explain what unedit
does, then explain what --force
does.
a5f8faf
to
c94c4c5
Compare
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 is great, thanks!
|
||
### Editable Packages | ||
|
||
SwiftPM supports editing dependencies, which means moving it into a location under `Packages/` directory. |
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.
I've tried not to use the "SwiftPM" abbreviation in the docs.
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.
I think this should say more about the why rather than that it moves it into Packages. For example, "support editing dependencies, when your work requires making a change to one of your dependencies (for example, to fix a bug, or add a new API)."
|
||
SwiftPM supports editing dependencies, which means moving it into a location under `Packages/` directory. | ||
|
||
If a such an editable package is present in Packages, then swift build will always use the exact sources in this directory to build, regardless of it's state, git repository status, tags, or the tag desired by dependency resolution. In other words, this will "just build" against the sources that are present. |
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.
Rather than say "present in Packages", I would talk about "packages which are in the editable state".
|
||
$ swift package edit Foo --revision 969c6a9 | ||
|
||
This is similar to previous version except that SwiftPM will leave the dependency at a detched HEAD on the specified revision. |
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.
Agree we should clarify this.
$ swift package unedit Foo # --force | ||
|
||
This will remove the edited dependency from Packages/ and put the originally resolved version back. This command will fail if there are uncommited changes or changes which are not | ||
pushed to the remote repository. The `--force` option can be used to forcefully unedit a dependency. |
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.
I agree, I would probably explain what unedit
does, then explain what --force
does.
This will remove the edited dependency from Packages/ and put the originally resolved version back. This command will fail if there are uncommited changes or changes which are not | ||
pushed to the remote repository. The `--force` option can be used to forcefully unedit a dependency. | ||
|
||
You can read the complete Swift evolution proposal [here](https://github.com/apple/swift-evolution/blob/master/proposals/0082-swiftpm-package-edit.md). |
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.
I'm not sure we should have this. Users should never really need to read this to understand the feature.
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.
I figured it would be good if there is a reference to it, it is not meant to serve as documentation, What if I drop "complete" from the sentence ?
c94c4c5
to
353539f
Compare
|
||
### Editable Packages | ||
|
||
Swift Package Manager supports editing dependencies, when your work requires making a change to one of your dependencies (for example, to fix a bug, or add a new API). The Package Manager moves the dependency into a location under `Packages/` directory where can be edited. |
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.
... it can ...
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.
Package Manager -> package manager
|
||
Swift Package Manager supports editing dependencies, when your work requires making a change to one of your dependencies (for example, to fix a bug, or add a new API). The Package Manager moves the dependency into a location under `Packages/` directory where can be edited. | ||
|
||
For the packages which are in the editable state, swift build will always use the exact sources in this directory to build, regardless of it's state, git repository status, tags, or the tag desired by dependency resolution. In other words, this will "just build" against the sources that are present. |
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.
swift build
(formatting)
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.
"it's" -> "its"
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.
"just build" -> just build (formatting)
|
||
For the packages which are in the editable state, swift build will always use the exact sources in this directory to build, regardless of it's state, git repository status, tags, or the tag desired by dependency resolution. In other words, this will "just build" against the sources that are present. | ||
|
||
When an editable package is present, it will be used to satisfy all instances of that Package in the depencency graph. It is possible to edit all, some, or none of the packages in a dependency graph, without restriction. |
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.
Package -> package
|
||
When an editable package is present, it will be used to satisfy all instances of that Package in the depencency graph. It is possible to edit all, some, or none of the packages in a dependency graph, without restriction. | ||
|
||
Editable package are best used to do experimentation with dependency code or create and submit a patch in the dependency owner's repository (upstream). |
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.
packages (plural)
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.
I would merge this short sentences into at least one less paragraph
|
||
This is similar to previous version except that the Package Manager will leave the dependency at a detched HEAD on the specified revision. | ||
|
||
Note: It is necessary to provide either branch or revision option. The rationale here is that checking out the currently resolved version would leave the repository on a detached HEAD, which is confusing. Explict options makes the action predictable for user. |
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.
either a branch
|
||
Note: It is necessary to provide either branch or revision option. The rationale here is that checking out the currently resolved version would leave the repository on a detached HEAD, which is confusing. Explict options makes the action predictable for user. | ||
|
||
Once a package is in editable state, you can navigate to the directory `Packages/Foo` make changes, build and then push the changes to the upstream repository. |
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.
in an editable
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 make
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.
maybe add "or submit a pull request" or so
353539f
to
3cc466f
Compare
3cc466f
to
315eec6
Compare