pub
pub copied to clipboard
dependency version ranges don't work for github dependencies
Originally opened as dart-lang/sdk#22481
This issue was originally filed by [email protected]
What steps will reproduce the problem?
pubspec.yaml that lists a git dependency with a version range like this fails:
name: wService version: 1.0.3 dependencies: wTransport: git: [email protected]:Workiva/wTransport.git version: "^1.0.0"
with this error:
Working dir: /Volumes/CASE/code/wService/examples/dart /usr/local/Cellar/dart/1.8.5/libexec/bin/pub get Resolving dependencies... Package wTransport has no versions that match >=1.0.0 <2.0.0 derived from:
- wService 1.0.3 depends on version ^1.0.0 Process finished with exit code 1
But if version is specified as ">=1.0.0", it works as expected and installs the 2.0.0 tagged release.
For some reason, Dart doesn't recognize that any of the 1.0.x tagged versions are available for install. Any idea why that would be? Is something beyond a git tag with release notes required for Dart to recognize the version?
What is the expected output? What do you see instead?
expect install of wTransport library at version 1.0.3
What version of the product are you using?
1.8.5
On what operating system?
OSX
What browser (if applicable)?
N/A
<img src="https://avatars.githubusercontent.com/u/2156198?v=3" align="left" width="48" height="48"hspace="10"> Comment by kasperl
Added Area-Pub, Triaged labels.
This comment was originally written by [email protected]
Maybe pub is doing this:
- see that wService depends on wTransport version ^1.0.0 (shorthand for ">=1.0.0 <2.0.0")
- get the latest version of github.com:Workiva/wTransport.git
- see that the latest version in pubspec.yaml is 2.0.0
- fail because 2.0.0 does not satisfy ">=1.0.0 <2.0.0"
I don't see anything in the documentation that leads me to believe pub is looking at git tags
This comment was originally written by [email protected]
You're probably right John, but if it's not actually a bug, then it should be a feature request. Supporting GitHub version ranges should be much simpler than standing up a custom pub server (for private repos) because there's already a GitHub API that provides all the info needed.
<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3
John is right about how this works today. It does seem like it would be cool to support version resolution here, though, using a standard tag format to traverse through possible versions, after trying master first.
In order to avoid backwards incompatibilities, we'd probably need to only do this if a version constraint was present...
<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3
Removed Type-Defect, Priority-Unassigned labels. Added Type-Enhancement, Priority-Low labels.
This comment was originally written by [email protected]
This would be huge for us, completely removing the need for us to internally run a pub server.
<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3
This would be a great way for an external user to dip their toes into pub development :-).
Added PatchesWelcome label.
This comment was originally written by [email protected]
We're willing to take a crack at it. Can you point us in the right direction (where's the code)?
This would be a nice result coming out of the Dart Summit next week :).
<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3
Pub in general is in sdk/lib/_internal/pub in the main Dart repo. Within that directory, the file you'll mostly be working with will be lib/src/source/git.dart, which contains the code for the Git source. Most of the work will be making it support more of the interfaces that are supported by lib/src/source/hosted.dart, such as Source.getVersions().
Once you have it implemented, you'll need to write tests. Check out the existing version-resolution tests in test/get/hosted and test/upgrade/hosted and modify them for the new git behavior in test/get/git and test/upgrade/git.
This comment was originally written by [email protected]
For someone that has never contributed to Dart/Pub, is this the best place to start? https://code.google.com/p/dart/wiki/Contributing
<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3
I believe so.
I have a patch working for this issue here: https://github.com/dart-lang/pub/compare/master...computmaxer:github-version-ranges
However, I need to add/update tests. The README says to use pub run test
, but the project isn't using the test
package so this doesn't work. I can get them to run with pub global run test_runner
but it takes a very long time to even discover all of the tests. Is that the best way to run the tests currently?
@nex3
However, I need to add/update tests. The README says to use
pub run test
, but the project isn't using thetest
package so this doesn't work.
I'm not sure what you mean by that. Pub definitely does use the test
package.
Yes, it looks like this is what I want to support, eventually (TM). /sub