-
-
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
support dependencies as git url with exact commit #1765
Conversation
Thanks for your pull request and interest in making D better, @belka-ew! 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. |
@belka-ew great that you are working in this topic. I am not really sure how the exact syntax could look like. Did you considered:
(I am not really an expert on this topic, don't know wheter this git syntax makes sense, but it is somehow consistent to the maven syntax used in Dub) |
Does this work with local git repository paths too? |
@lesderid I am not sure wheter the question was meant for @belka-ew or for me. Yes, the protocol would be git+file (here some details from npm https://docs.npmjs.com/files/package.json#git-urls-as-dependencies) |
Sorry, was meant for @belka-ew |
995ddac
to
fd1ef8d
Compare
This is doable, but I don't like the syntax. Dub already supports objects in version specification for paths npm keeps everything in one string and introduces a magic notation for different elements |
Do you mean a bare git repository locally? The code just does |
The code is using |
@belka-ew thanks for reviving this idea. A few thoughts and queries:
|
fd1ef8d
to
c1ae7b9
Compare
I made the PR work with local paths as well. Now it is really the case, that everything @joseph-wakeling-frequenz, I’m not sure about the tag support. The tags just reference specific commits, so they can be replaced with the hash in 100% of cases. The problem aren’t the tags themselves, but I want really to reuse |
c1ae7b9
to
38fbe4c
Compare
Can I get some official feedback here? What has to be done to get it merged? |
ping |
I don't have time to dive into this, but
@thewilsonator !!!. I'm now going to revert as we have a clear policy that we don't merge things that don't have e.g. tests. |
It is not a PackageSuppliert, git repositories are single packages like paths. Things like |
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 may be a bit late now, but since there's some controversy over the commit, I thought I'd add some detailed feedback.
As an extra stylistic note, there appears to be a bit of a mix-up of tabs and spaces for indentation in this commit. That may be following existing inconsistencies between files, though.
@@ -93,11 +93,28 @@ struct Dependency { | |||
m_path = path; | |||
} | |||
|
|||
this(Repository repository, string spec) { |
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.
Missing docs for this constructor overload.
@@ -111,6 +128,8 @@ struct Dependency { | |||
/// Returns true $(I iff) the version range only matches a specific version. | |||
@property bool isExactVersion() const { return m_versA == m_versB; } | |||
|
|||
@property bool isGit() const { return !repository.empty; } |
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.
Missing docs on this new property.
if (!repository.empty) { | ||
ret ~= "#"; | ||
} | ||
ret ~= versionSpec; |
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.
Not an expert on all the options here, but this formulation looks questionable: is it legit for the git version spec to be followed by extra stuff (which will happen if optional
is true, or if !path.empty
)?
Also, why the #
symbol?
@@ -397,6 +425,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.
I suggest being consistent in usage: this.isGit
(as elsewhere), not just isGit
@@ -706,7 +774,7 @@ struct Version { | |||
Note that branches are always considered pre-release versions. | |||
*/ | |||
@property bool isPreRelease() const { | |||
if (isBranch) return true; | |||
if (isBranch || 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.
Why should isGit
necessarily imply a pre-release? What if the git version spec points to a commit with a release tag?
assert(Version("73535568b79a0b124bc1653002637a830ce0fcb8").isGit); | ||
} | ||
|
||
private bool isHash(string hash) @nogc nothrow pure @safe |
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.
Missing function documentation
@@ -1542,6 +1550,17 @@ final class SelectedVersions { | |||
m_dirty = true; | |||
} | |||
|
|||
void selectVersion(string package_id, Repository repository, string spec) |
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.
missing method documentation
@@ -1604,16 +1623,23 @@ final class SelectedVersions { | |||
|
|||
static Json dependencyToJson(Dependency d) |
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.
missing method docs
@belka-ew I hope I didn't discourage you too much from this. My motivation to revert was solely based on the fact that I think it was merged prematurely (no reviews, no tests). It was not a vote against this feature.
Why not? You can list all tags of a git repository, e.g.
|
Tags aren't very useful since in the most cases they are versions that can be obtained from the registry. The most useful use case is probably branches, if I want to test a library before tagging it and without waiting for a registry update. But also specific commits are possible, and the amount of commits can be huge. |
I think you're missing a convenience use-case here. If I'm specifying the version of a dependency to use, it's much nicer if I can use human semantic versioning, rather than Git's hash-based commit IDs. DUB config files need to be human-readable first. |
Revival of [WIP] Support dependencies as git url (including with exact commit hash).
The PR introduces new version object type. Dependencies example:
Also
~branch
as version works.