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
myProject.swf

Introduction

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       \
        -Dversion=1.0.0-SNAPSHOT             

The syntax is similar:

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

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:

        myProject/
        |-- 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.zip myProject

You can install them into your local haxe library ala:

% haxelib test myProject.zip

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.

source

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!

Advertisements

3 Comments »

  1. filt3rek said

    Hi,
    Some weeks ago I talked about hxDeploy on haXe ML.
    Maybe if you could include something like that into archetype, it could be useful.
    Take a look here :
    http://filt3r.free.fr/index.php/2008/08/25/63-hxdeploy-haxe-project-template

    Let me know what do you think about,
    Thanks in advance,
    Michel

  2. brianin3d said

    I’ll definately take a look at it. One of the cool things about the maven archetype is that it allows anyone to create a template.

    That approach lends itself to diversity and remove the bottleneck of having a maintainer (to create new archetpyes).

    It might be possible to either extend the archetype functionality to support this or at a minimum enhance the initial artifact with the files and directory structure you use.

    Thanks for touching base.

  3. filt3rek said

    Hi,
    hxDeploy idea is to allow anyone to create his own templates too 🙂
    .hxd and .hxdtpl are simple text files with simple usage.
    Anyway, thank you for your answer 😉

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: