What would be the best way of making the code base “portable”? And by portable I mean containing all the dependencies within the directory with the main code base. I want to be able to compile my code without installing/configuring haxelib, just by pointing haxe compiler executable to my hxml file.
Let’s say I have my code in the src directory and I’ve put all the libs in the lib directory.
Right now I’m achieving this simply by adding, for example, -cp lib/format -D format=3.5.0 to my hxml file. It works but I would prefer being able to point haxe to lib directory as the source of “haxelibs” and just refer them in my hxml file as usual e.g. -lib format. I couldn’t find any compiler switches that can do that. Maybe there’s some undocumented (or documented and I just didn’t look in the right place) environment variable that I can set prior to running the compiler to change the haxelib path? Something like HAXELIB_PATH=./lib /path/to/haxe build.hxml would be perfect.
You can have a local haxelib directory if you run:
haxelib newrepo
This creates a hidden local .haxelib folder which will contain all your haxelibs for the project, and haxe will automatically use the libraries there so you can just access it via -lib format as normal.
If you want to keep these library versions tracked in your project via git, you could add them as git submodules. This makes it very easy to reproduce the state between different machines, and keep track of library updates. I wrote a tool which makes it pretty easy to manage libraries like this: GitHub - tobil4sk/haxe-git-submodule-manager: Tool for managing haxe dependencies as git submodules