Archive for haxe

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)

« Newer Posts