Categories
Haxe

Juggling haxelibs between multiple projects

Once you have more than one project you’re building in Haxe, you tend to run into situations where you use different versions of dependencies.  Often you can get away with using the latest version on every project, but sometimes there are compatibility breaks, and you need different projects to use different versions.

There is a work-in-progress issue for Haxelib to get support for per-project repositories.  Until that is finished, here is what I do:

cd ~/workspace/project1/

mkdir haxelibs

haxelib setup haxelibs

haxelib install all

And then when I switch between projects:

cd ~/workspace/project2/

haxelib setup haxelibs

What this does:

  • Switch to your current project
  • Create a folder to store all of your haxelibs for this project in
  • Set haxelib to use that folder (and when I switch to a different project, I’ll use a different local folder).
  • Install all the dependencies for this project.

Doing this means that each project can have it’s own dependencies, and upgrading a library in one project doesn’t break the compile on another project.

Hopefully that helps someone else, and hopefully the built in support comes soon!

3 replies on “Juggling haxelibs between multiple projects”

Interesting library – does that perform the relevant “haxelib install” for you based on your package.json? That would be pretty fancy.

Long term I’d like to see haxelib evolve to have features like NPM, but based on your hxml files rather than a package.json file…

it does. Each new lib has to be npmified.
I find the workflow really confortable and known from the js community.

grunt-haxe can come in handy in a similar way.

hxml is nice, but should be gruntified | gulpified | broccolified, in this regard. js dev would appreciate.

Leave a Reply

Your email address will not be published. Required fields are marked *