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

[SR-666] swiftpm should allow me to depend on latest commit of a branch #5430

Closed
swift-ci opened this issue Feb 3, 2016 · 13 comments
Closed

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Feb 3, 2016

Previous ID SR-666
Radar rdar://problem/29964194
Original Reporter jaybuff (JIRA User)
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 4
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: b10f288e55add23846354603cdc57b6c

is duplicated by:

  • SR-1867 Specify the branch to clone in Package.swift

Issue Description:

I want the ability to depend on the latest version of a particular branch in a repo (master being the most common).

Sometimes upstream library authors might have a fix or a feature in the latest version, but they haven't done a release yet. For development I'd like to try that out before the release is official.

@swift-ci
Copy link
Contributor Author

swift-ci commented Feb 3, 2016

Comment by Kostiantyn Koval (JIRA)

I think this was already discussed somewhere. The main idea is that it's not 100% secure. When you rely on specific version you can guaranty that it will build in future (the code and binary will not change)

If you make a package that depends on other package from master branch, it can build successfully now, but it could fails if new code is pushed to the master.
I think this is main reason why version tag is required (at least when publishing a package).

@mxcl
Copy link
Contributor

mxcl commented Feb 3, 2016

It should only be possible for the root package to depend on HEAD.

@swift-ci
Copy link
Contributor Author

swift-ci commented Feb 3, 2016

Comment by Jay Buffington (JIRA)

I totally agree with kkoval (JIRA User), we shouldn't be able to publish packages that have dependencies on packages that don't explicitly depend on a version (range).

We should still do this to support the dev case, though. like @mxcl said, if you can only do it for the root package, then it will be safe.

@swift-ci
Copy link
Contributor Author

swift-ci commented Feb 4, 2016

Comment by Kostiantyn Koval (JIRA)

Example:

let package = Package(
    name: "Hello",
    dependencies: [
        .Package(url: "ssh://git@example.com/Greeter.git", head: true),
    ]
)

The root package in that case is Hello. It depends on the Greeter from head.
Did I understood it correctly? @mxcl

What happens if I commit this and push package code?
We can disallow using Hello as a dependency like that

let package = Package(
    name: "Answering",
    dependencies: [
      .Package(url: "ssh://git@example.com/Hello.git" version: Version(1,0,0))
    ]
)
//swift build Answering -> Error, can't use "Hello" as a dependency, it's unsafe because ....

But the Hello project itself is now not stable, because it relies on external dependency without specified locked-commit.
And I totally agree that we should have this functionality for development, but I don't want to sacrifice the safety.

@swift-ci
Copy link
Contributor Author

swift-ci commented Mar 10, 2016

Comment by Jay Buffington (JIRA)

How about for now we do something less controversial for now: just allow for depending on a commit sha.

@ddunbar
Copy link
Member

ddunbar commented Jun 20, 2016

This would be nice to get in the 3.0 release timeframe.

@swift-ci
Copy link
Contributor Author

swift-ci commented Jun 22, 2016

Comment by Anindha Parthy (JIRA)

I disagree with kkoval (JIRA User)'s example. If Hello was depending on an unlocked commit, then I wouldn't tag that as 1.0.0.

My use case is that I am using Swift 3.0 and some of dependencies have a branch that is Swift 3.0 compatible. At the moment I check out each of these dependencies, and locally tag the Swift 3.0 branch. I could also fork the dependency and tag that.

My solution would be: .Package(url: "ssh://git@example.com/Hello.git" branch: "swift-3.0")

The sha is also fine, but isn't self documenting.

@swift-ci
Copy link
Contributor Author

swift-ci commented Jun 23, 2016

Comment by Kostiantyn Koval (JIRA)

You can still depend on the head and mark your package with `1.0` tag. The SwiftPM has to handle this situation.
There is a propose for solving this issue
https://github.com/apple/swift-evolution/blob/master/proposals/0082-swiftpm-package-edit.md

@Bouke
Copy link
Contributor

Bouke commented Jun 29, 2016

When working on an app has various dependencies that are being developed as a whole, the whole

@swift-ci
Copy link
Contributor Author

swift-ci commented Jun 29, 2016

Comment by Kostiantyn Koval (JIRA)

Here is a proposal for Editable packages
https://github.com/apple/swift-evolution/blob/master/proposals/0082-swiftpm-package-edit.md

@abertelrud
Copy link
Contributor

abertelrud commented Aug 3, 2016

Time has run out for Swift 3, unfortunately.

@ddunbar
Copy link
Member

ddunbar commented Jan 24, 2017

@aciidb0mb3r
Copy link
Member

aciidb0mb3r commented Feb 28, 2017

Implemented by:
#972
#975
#976
#977
#978
#979
#981

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants