-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Adds haxelib libpath
- Closes #407
#408
Conversation
I think you need to bump the version, too. So we can programatically know whether the command is available on the user's system. |
src/haxelib/client/Main.hx
Outdated
@@ -1344,6 +1345,25 @@ class Main { | |||
} | |||
} | |||
|
|||
function pathonly() { |
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.
OK, this is cheating. 😃 In the interest of not duplicating bugs, do you think that we can combine the contents of the two commands (path and pathonly) into one shared routine?
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.
OK @EricBishton @kLabz I didn't want to do it at first, since it'd require a .bind
and would make reading the method harder. But seems other methods also use binds - so I've merged them now.
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.
@EricBishton The PR has now shifted to a separate libpath()
method, which has a different objective than path()
.
@EricBishton bumped to 3.3.1 |
Uhm, I suppose the first question is: what do you mean by the "path" of a library? The location where it's on the file system? Because that's not what the first line of |
Hi @back2dos this PR follows a discussion on gitter, and the intent was stated in #407 : Apologies if not everything has been stated here. You're right that the current usage of In this case it looks like |
So I could re-do this and fix the documentation of |
haxelib pathonly
- Closes #407haxelib libpath
- Closes #407
Ok, sorry for the confusion. May I suggest to give slightly more context next time? In a year even those who followed the gitter discussion will have forgotten it, and then the PR will be as enigmatic to everyone, as it has been to me. As for the rest: as Phillipe stated it's a separate feature. For that reason alone, I'd not interlace it with What I would definitely advise is to make sure the logic is exposed for programmatic use, so that when compiling with |
Yes, well I stated it in the linked issue 😄 @back2dos I've updated the PR now though to be separate from |
src/haxelib/client/Main.hx
Outdated
@@ -1306,7 +1307,7 @@ class Main { | |||
if( p.project == prj ) { | |||
if( p.version == version ) | |||
return; | |||
throw "Library "+prj+" has two version included "+version+" and "+p.version; | |||
throw "Library "+prj+" has two versions included : "+version+" and "+p.version; |
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.
Nice catch for the plural :) There is no space before :
though
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.
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 meant there should not be a space before :
, but as it's written this way all over the project (maybe because haxe has a french history :P), you can just ignore this comment :)
src/haxelib/client/Main.hx
Outdated
var a = args[argcur++].split(":"); | ||
var results = new List(); | ||
checkRec(rep, a[0],a[1],results); | ||
if( !results.isEmpty() ) Sys.println(results.first().dir); |
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 only results.first()
?
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.
Well, I suppose the question is again what exactly you want. Assuming you really want just the one path (and not the dependencies), this is fine. But then looping the args is nonsense. Instead you should make sure there's exactly one argument left and process just that.
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.
results.first()
will give you the library's root directory, which haxelib libpath
should return. Any other paths would be dependency paths, and are discarded by using first()
.
The looping is replicating the behaviour from haxelib path openfl lime
- if you run with haxelib libpath openfl lime
it will return the paths for both libraries.
If you only run it with haxelib libpath openfl
you will only get one path.
Since one path
method works that way, I didn't want to make it confusing by changing the behaviour of the libpath
method. The end-user doesn't have to supply multiple arguments.
@back2dos I want to be very clear on what this command should accomplish : After we run After we run After we run After we run After we run Basically the |
I see. Well then I'd say it mostly looks good. One thing to consider is that swallowing dependencies is maybe not a good idea (or there should be a way to opt out at least), because otherwise the caller may have to replicate that logic too. |
@back2dos I think I know what you mean - I would prefer to not touch any |
Looks like it will do no harm to existing code paths. I'd say it's good to go. |
For the version bump, there is no need to (read: don't) do so in PRs. Imagine there are multiple PRs bumping it, there will be conflicts. Also, since we're following semver, adding new feature means bumping "minor" instead of "bugfix". i.e. It should be 3.4.0. Same for run.n, don't rebuild it in PRs since it will cause merge conflict. Please add some example outputs in the documentation. It is not obvious what the output format will be when querying multiple libraries - paths can be separated by line-breaks, commas, colons (like $PATH) etc. Finally, rebase the changes on top of current development to see if CI passes - I will merge if it does. |
Adds
haxelib libpath
- Closes #407