Skip to content
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

Merged
merged 1 commit into from Nov 17, 2016

Conversation

ankitspd
Copy link
Member


$ 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.
Copy link
Contributor

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.

Copy link
Member

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.
Copy link
Contributor

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).

Copy link
Member

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.

Copy link
Member

@ddunbar ddunbar 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 great, thanks!


### Editable Packages

SwiftPM supports editing dependencies, which means moving it into a location under `Packages/` directory.
Copy link
Member

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.

Copy link
Member

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.
Copy link
Member

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.
Copy link
Member

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.
Copy link
Member

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).
Copy link
Member

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.

Copy link
Member Author

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 ?


### 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.
Copy link
Member

Choose a reason for hiding this comment

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

... it can ...

Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

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

swift build (formatting)

Copy link
Member

Choose a reason for hiding this comment

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

"it's" -> "its"

Copy link
Member

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.
Copy link
Member

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).
Copy link
Member

Choose a reason for hiding this comment

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

packages (plural)

Copy link
Member

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.
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

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

in an editable

Copy link
Member

Choose a reason for hiding this comment

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

... to make

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants