-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
[WIP] support dependencies as git url (including with exact commit hash) #1403
Conversation
Thanks for your pull request and interest in making D better, @timotheecour! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. |
ping @s-ludwig @MartinNowak |
My main concern is mixin the version string with the git repository. Isn't a git repository really more or less the same as a "path" attribute? The version should usually be inferred from the repository in this case (latest version tag, possibly with commit hash and number appended if more commits were made afterwards). A case that I think should also be supported is specifying a URL that does not point to a specific commit, and then support version resolution by actually returning all version tags in the package provider. Another consideration could be to support dropping the schema of the repository URL, so that the best available protocol could be used. But that would just be potentially nice to have. |
@@ -34,6 +34,62 @@ struct PackageDependency { | |||
Dependency spec; | |||
} | |||
|
|||
struct GitDep{ |
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.
Style: Should be fully spelled out (GitDependency
) and before {
there should always be a single space (or a line break in case of functions).
Actually, how about splitting this up into a "repository" part, specified as a separate parameter and without commit hash support, and support for Note: I used |
BTW maybe similar to #1415, |
As far as I know "git+https://..." is also the way you can specify dependencies in Node NPM. |
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.
Have a look at fetchzip.sh
and test_registry.d
for a way on how to add tests for this (or #1415's adaption of this).
+/ | ||
assert(spec[0]==Version.hashPrefix); | ||
import std.regex; | ||
auto m=spec[1..$].matchFirst(`^(.*?)/commit/([a-f0-9]+)$`.regex); |
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 will compile the regex on every execution. While std.regex now comes with a bit of caching, it's still better to do sth. like
static re = `...`.regex;
spec[1..$].matchFirst(re);
@@ -393,6 +459,7 @@ struct Dependency { | |||
A specification is valid if it can match at least one version. | |||
*/ | |||
bool valid() const { | |||
if(isGit) return true; |
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 this can be generalized to isHash
?
URL url = gitDep.toURLZip; | ||
logDiagnostic("Downloading from '%s'", url); | ||
// TODO: foreach(i; 0..3) | ||
download(url, path); |
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.
Might be worthwhile to generalize the retry logic in download
(almost all supplier seem to require this)
I am not sure but I think the archive download only works for github and not for bitbucket. I am sure Bitbucket supports s.th. similar but with another URL? @timotheecour any chance you could continue your work on this topic? |
I've moved on from D to Nim so I don't expect I'll have time to work on this; feel free to take over this PR |
[reviewers: please ignore whitespace issues]
this supports for eg:
this fixes #51 (and is more general since allows that commit to come from a private fork)
also related to #632
it works but I have some question to improve it, please contact me on slack