Best way to setup a project to be compatible with Haxelib and Git

157 views
Skip to first unread message

Brenton Thomas

unread,
Feb 13, 2014, 11:13:16 PM2/13/14
to haxe...@googlegroups.com
I have been developing some test code based on the idea of using inkscape as a level editor and it is turning out surprisingly cool.  Draw some layers in inkscape, save it and have the objects appear in Haxe.   The broader target I am aiming for is draw scene in inkscape attach some custom attributes (which is really easy) to define physics attributes and have a Haxe pick it up  separate out objects with physics and construct actors for them giving me a collection of classes I can program around.  It occurred to me that this would be useful for other people - long way off yet, but I would like to move that way.

My problem is that I don't really understand how to make such a thing accessible.  gitHub? Haxelib - probably both. Before I start creating a directory structure on github I would like it to be compatible with haxelib. Is there anything I should think about?

I have been picking through "actuate" in haxelib and comparing it to Joshua's  github "actuate". Is this a good way to do it or is this a way of doing things that was good once upon a time but in hindsight if you could start from scratch a better way exists?

Hugh

unread,
Feb 13, 2014, 11:41:10 PM2/13/14
to haxe...@googlegroups.com

Hi,

The root directory of your haxelib gets added to the classpath when you use "-lib abc" with haxe.  So you should put your classes in the root of the project - probably in a package/directory indicative of your project.

You will also need the "haxelib.json" file in the root directory to be able to submit it to haxelib.

If you have binary components, they will go in the root "ndll/Platform" directory.

If you want to have a script that get run when someone does "haxelib run yourlib", then it should be called "run.n" in your root directory.

The rest is up to you.  It seems that the "project" directory is for source files used to produce the ndlls.


If you use this structure in git, then you can clone the repo and do "haxelib  dev yourlib path/to/clone" and it will be like it's installed.

Hugh

Saar Korren

unread,
Feb 14, 2014, 11:13:14 AM2/14/14
to haxe...@googlegroups.com
I should add that the classpath directory only needs to be the same directory where haxelib.json is, but it doesn't have to be the root of your project. That is, you can put it inside a "src" folder in the repository, and that will contain both your "org" folder and your "haxelib.json" file.

Doing it this way will give you more freedom to add other stuff that are not part of the haxelib distribution package, such as a Readme.md, unit tests, or an ant script for building a distributable zip from the src folder.

Jason O'Neil

unread,
Feb 14, 2014, 7:07:53 PM2/14/14
to haxe...@googlegroups.com
Here is the setup I use, on a library that is so simple as to almost be pointless:

# The overall repo
# The haxelib.json, note the "classPath" setting
# The root source directory
# The only file in this project.  It is in the top level package
# A simple helper script to zip it up and prepare for submission to haxelib
That setup can be used either locally "haxelib dev random /path/to/random/"

Or from git "haxelib git random https://github.com/jasononeil/hxrandom.git"

Or submit to haxelib "./bundle.sh" and then "haxelib submit random.zip"

Hope that helps


On Sat, Feb 15, 2014 at 12:13 AM, Saar Korren <slugf...@gmail.com> wrote:
I should add that the classpath directory only needs to be the same directory where haxelib.json is, but it doesn't have to be the root of your project. That is, you can put it inside a "src" folder in the repository, and that will contain both your "org" folder and your "haxelib.json" file.

Doing it this way will give you more freedom to add other stuff that are not part of the haxelib distribution package, such as a Readme.md, unit tests, or an ant script for building a distributable zip from the src folder.

--
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 the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.

Joshua Granick

unread,
Feb 25, 2014, 4:20:52 PM2/25/14
to haxe...@googlegroups.com
However, this also makes it more complicated to check out your project.

For example:

    haxelib dev actuate actuate

If the root of your repository does not match the root of what you will put on haxelib, then you have to do something like this:

    haxelib dev library library/haxelib

This always messes me up when repositories do this... I try setting "dev" to the root, then I get errors when compiling :)


On Fri, 14 Feb 2014 08:13:14 -0800, Saar Korren <slugf...@gmail.com> wrote:

I should add that the classpath directory only needs to be the same directory where haxelib.json is, but it doesn't have to be the root of your project. That is, you can put it inside a "src" folder in the repository, and that will contain both your "org" folder and your "haxelib.json" file.

Doing it this way will give you more freedom to add other stuff that are not part of the haxelib distribution package, such as a Readme.md, unit tests, or an ant script for building a distributable zip from the src folder.
--
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 the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.



--
Using Opera's mail client: http://www.opera.com/mail/

Jason O'Neil

unread,
Feb 25, 2014, 6:51:13 PM2/25/14
to haxe...@googlegroups.com
Hi Joshua

There are two options for working with this kind of situation, the first:

haxelib git library https://github.com/user/library.git master src/

What you have there is "haxelib git libname clonepath branch subdirectory"

The other option doesn't work unless you run "haxelib selfupgrade", so it might not be suitable for libraries as popular as Actuate / OpenFL until the version included in the download gets updated.  But for the sake of completeness, you add:

classPath: 'src/'

to your haxelib.json file. And then you can run


and it will automatically set the path for "library" to "$haxelib/library/git/src/".

Hope that helps!

Jason
Reply all
Reply to author
Forward
0 new messages