Haxelib install dependencies defined locally in haxelib.json

391 views
Skip to first unread message

Balázs Zubák

unread,
Mar 4, 2016, 6:01:17 AM3/4/16
to Haxe
Hello,

I'm working on a private project (it cannot be registered into github), that has also private git library dependencies.

I've defined all the public (so registered) and private (git) dependencies in the haxelib.json

My question is that, how can i tell haxelib to install the dependencies when i clone my project to my local disk?
For example in npm you say npm install. It reads the package.json and install all the dependencies listed in that file.

How can i make haxelib to read my haxelib.json and install the dependencies from it?

Cheers,
Balazs

Andreas Mokros

unread,
Mar 4, 2016, 7:04:12 AM3/4/16
to haxe...@googlegroups.com
Hi.

On Fri, 4 Mar 2016 03:01:17 -0800 (PST)
Balázs Zubák <zubak....@gmail.com> wrote:
> How can i make haxelib to read my haxelib.json and install the dependencies
> from it?

Unfortunately the doc for haxelib dependencies is missing:
http://lib.haxe.org/documentation/creating-a-haxelib-package/haxelib-json-dependencies.md
although it's linked here:
http://lib.haxe.org/documentation/creating-a-haxelib-package/

Well, I know that public haxelib dependencies get installed automatically, when
the main haxelib is installed. I guess private git dependencies won't.

You could add them with a shell script or add a run helper to your haxelib.
There's also:
haxelib install build.hxml
which installs dependencies from a hxml file.

--
Mockey

Balázs Zubák

unread,
Mar 4, 2016, 7:18:58 AM3/4/16
to Haxe
Actually it installs also the git dependencies, but my problem is that my "main haxelib" is my local development. The questions is that how can I ask haxelib to treat my local folder as a haxe library and install it's subdependencies.

Andreas Mokros

unread,
Mar 4, 2016, 7:30:59 AM3/4/16
to haxe...@googlegroups.com
Hi.

On Fri, 4 Mar 2016 04:18:57 -0800 (PST)
Balázs Zubák <zubak....@gmail.com> wrote:
> Actually it installs also the git dependencies

Oh yeah? You can add the git-repo instead of the version then for dependencies?

> "main haxelib" is my local development. The questions is that how can I ask
> haxelib to treat my local folder as a haxe library and install it's
> subdependencies.

Sorry, I don't quite understand.
haxelib install build.hxml
or
haxelib dev
maybe?
http://lib.haxe.org/documentation/using-haxelib/

--
Mockey

Balázs Zubák

unread,
Mar 4, 2016, 7:35:44 AM3/4/16
to Haxe
Sorry maybe I'm not clear.

So there are two ways to install dependencies:
from build.hxml
and from haxelib.json

I want to go for the second one. I've created the haxelib.json, try to list my dependencies in that.
After i want to ask the haxelib command, to read up the haxelib.json and install the dependencies from that.

I've checked the source of haxelib, it doesn't have this feature with haxelib install command, so maybe it's fully not implemented to install these dependencies?

If this is the situation ,than another question comes up: Is it possible to define git dependency in the build.hxml? 

Andreas Mokros

unread,
Mar 4, 2016, 8:26:29 AM3/4/16
to haxe...@googlegroups.com
Hi.

On Fri, 4 Mar 2016 04:35:43 -0800 (PST)
Balázs Zubák <zubak....@gmail.com> wrote:
> I've checked the source of haxelib, it doesn't have this feature with
> haxelib install command, so maybe it's fully not implemented to install
> these dependencies?

My understanding is that haxelib.json is meant for haxelibs. But it might be a
useful feature to use it like this (similar to npm package.json).

> If this is the situation ,than another question comes up: Is it possible to
> define git dependency in the build.hxml?

I know that you can define a version in build.hxml. git-repo I haven't tried.

--
Mockey

underscorediscovery

unread,
Mar 4, 2016, 11:09:46 PM3/4/16
to Haxe
Haxelib doesn't work like node_modules/npm, it is treated like npm install <lib> and not as a package.json dependency.

Try run haxelib without arguments, and look at the new work in progress option 

newrepo. It's documented in the haxelib readme at the moment among other information regarding project local repos:

https://github.com/HaxeFoundation/haxelib#per-project-setup

There are many discussions on the haxelib github repo 

underscorediscovery

unread,
Mar 4, 2016, 11:19:34 PM3/4/16
to Haxe
Since this isn't actually documented in the readme, only mentioned............ !!

1) make sure your project haxelib.json has dependencies
2) cd <yourproject> (same folder as haxelib.json)
3) haxelib newrepo  (this creates a .haxelib hidden folder)
4) haxelib install <lib> (installs lib into .haxelib)

Instead of installing them manually (it does not currently read them from haxelib json as far as I can tell):
- Mentioned in the readme, You can use haxelib install all 
This requires a hxml in the working directory 
- Or alternative is doing haxelib install <your.hxml> 
Which uses the -lib lines from the hxml to install the dependencies.

I don't know if this installs their dependencies but presumably this is why it is a work in progress.
Feel free to ask those questions on the haxelib repo if they aren't already there.

Balázs Zubák

unread,
Mar 5, 2016, 9:57:13 AM3/5/16
to Haxe
Hey thanks for these infos. I've looked deeply in the sources, and i've found all these things that you mentioned.

I also saw that there is nothing implemented for install git dependencies given in hxml or haxelib.json so i've decided to fork and add this support:

So from new there are 3 new things:
- You can define your git dependency in the build.hxml like this: -lib something:git:https://github.com/grosmar/something.git (this syntax is fully compatbile with the haxe compiler, that will only read that it want to use the git version the library)
- You can define your git dependency in the haxelib.json under dependencies tag like this: "something": "git:https://github.com/grosmar/something.git"
- You can install from haxelib.json too like this: haxelib install <haxelib.json path>

I still need to make the tests but i think it will be really useful.

Sven Bergström

unread,
Mar 5, 2016, 10:17:28 AM3/5/16
to haxe...@googlegroups.com
I think those sound useful as well. I have wanted the direct git dependencies before though I am not sure if they fit the haxelib ideals.

Be sure to run this information on the issues list on haxelib github repo for discussion, as that is where development will/should happen.

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Balázs Zubák

unread,
Mar 6, 2016, 8:00:48 AM3/6/16
to Haxe
Yeah, your right. I've found the related issue and made the comments there:

So let's continue there if you have any suggestions related to this issue.
Reply all
Reply to author
Forward
0 new messages