Posts Tagged haxelib

haxe archetype

This page is out of date! The current page is over here!

Start new haxe projects fast!

Installation + Quickstart

% sudo haxelib install archetype
% haxelib run archetype create -artifactId=myProject -packageName=us.versus.them -version=1.0
% cd myProject
% haxe compile.hxml 
% ls myProject.swf


This is based on the idea of the maven archetype plugin.

In maven this works something like this:

mvn \
        archetype:create                   \
        -DartifactId=myProject             \
        -DgroupId=myGroup                  \
        -DpackageName=us.versus.them       \

The syntax is similar:

haxelib run                               \
        archetype                         \
        create                            \
        -artifactId=myProject             \
        -packageName=us.versus.them       \

The arguments artifactId and packageName are mandatory.

If version is not set, it will default to 1.0.

In this example, the archetype would create a directory structure like so:

        |-- Main.hx
        |-- Test.hx
        |-- haxelib.xml
        |-- compile.hxml
        |-- test.hxml
        |-- tests
        |   `-- AppTest.hx
        `-- us
            `-- versus
                `-- them
                    `-- myProject
                        `-- App.hx

Despite the name, this is not nearly as flexible as maven’s archetype plugin. In order to add more archetypes, you would actually have to modify the source code for this module.

Maybe someday, it can grow into a real equivalent. For now, it is better than nothing.

Compilation and package

% haxe compile.hxml
% cd .. 
% zip -r myProject

You can install them into your local haxe library ala:

% haxelib test

running testcases

Running unit tests is a little clunky…

% haxe test.hxml && neko test.n

Unfortunately, you have to update Test.hx to add new tests. They can live in the tests subdirectory to keep them separate from the main code.


I put the source such as it is where you can get it and play wif it like it was some sort of ball or barbie!


Comments (3)

pv3d_haxe as a haxelib

At the risk of overstepping, and with hopes the original author won’t become enraged, I published pv3d_haxe as a haxelib:

% haxelib search pv3d_haxe
1 projects found
% sudo haxelib install pv3d_haxe

I have placed the files and on googlepages if you’d rather…

You can try my (horrible) test program like so:

% wget
% unzip
% cd orig_testHaxePv3d
% rm *swf
% haxe TestHaxePv3d.hxml
% ls ${PWD}/*swf

Pull up the .swf file and viola… a really boring solid red cube!

Here are a few more boring things I “fixed”:

/usr/lib/haxe/lib/pv3d_haxe/1,0/org/papervision3d/core/geom/Face3D.hx:220: characters 9-16 : Local variable mapping used without being initialized
/usr/lib/haxe/lib/pv3d_haxe/1,0/org/papervision3d/materials/MaterialsList.hx:185: characters 23-30 : Local variable m used without being initialized
/usr/lib/haxe/lib/pv3d_haxe/1,0/org/papervision3d/objects/Sphere.hx:163: characters 14-18 : Local variable oVtx used without being initialized

I only mention them in passing in case someone takes on this project for real.

Hopefully this will make it a little easier to use original author‘s great work!

Comments (5)