YHaxen is a Haxe project management tool written in Haxe. YHaxen can manage a project's variables, dependency validation, tests, builds, and releases.
Works with:
OS | Haxe | Neko | Haxelib |
---|---|---|---|
Win 8.1 | 3.0.1 -> 3.1.3 | 2.0.0 | 3.1.0-rc.4 |
OSX | 3.0.1 -> 3.1.3 | 2.0.0 | 3.1.0-rc.4 |
Ubuntu 14 | 3.0.1 -> 3.1.3 | 2.0.0 | 3.1.0-rc.4 |
Build with Haxe 3.2.0 is not stable.
Recommended installation from from haxelib:
haxelib install yhaxen
Optionally can be also installed from git:
haxelib git yhaxen git@github.com:jozefchutka/YHaxen.git 0.0.20 src/main/haxe
An yhaxen binary can be build from sources using yhaxen:
haxelib run yhaxen compile -version 123
Optionally can be built from sources using haxe command:
haxe -main yhaxen.Main -neko src/main/haxe/run.n -cp src/main/haxe -lib haxelib_client -D version=123
The main build configuration is defined in a configuration file (default name is yhaxen.json). Each node in configuration file is optional and does not need to be defined unless is meant to be used.
{
"variables": [...],
"dependencies": [...],
"tests": [...],
"builds": [...],
"releases": [...],
}
A config file can be executed using haxelib run yhaxen compile
. See further documentation for more details.
Examples:
yhaxen validate -config src/test/resources/yhaxen.json
yhaxen compile -config "myconfig.json" -logLevel 2 -mode debug
yhaxen release -version 1.2.3 -message "My release message"
yhaxen help
Different kind of variables are available:
${variable:...
)${dependency:...
)${arg:...
)${system:...}
)-mode debug
.Example:
"variables": [
{
"name": "sourceDirectory",
"value": "src/main/haxe"
},
{
"name": "outputDirectory",
"value": "bin/debug",
"modes": ["debug"]
},
{
"name": "outputDirectory",
"value": "bin/release"
},
]
Config variable in use:
${variable:sourceDirectory}
outputs src/main/haxeSingle dependendcy:
${dependency:munit:dir}
c:/haxe/lib/munit/123${dependency:munit:dir:-cp}
-cp c:/haxe/lib/munit/123${dependency:munit:classPath:-cp}
-cp c:/haxe/lib/munit/123/srcScope related dependencies:
${dependency:*:dir}
c:/haxe/lib/munit/123 c:/haxe/lib/mcover/123 ...${dependency:*:dir:-cp}
-cp c:/haxe/lib/munit/123 -cp c:/haxe/lib/mcover/123 ...${dependency:*:classPath:-cp}
-cp c:/haxe/lib/munit/123/src -cp c:/haxe/lib/mcover/123/src ...Other dependency examples:
${dependency:munit:name:-lib}
-lib munit${dependency:munit:nameVersion:-lib}
-lib munit:123${dependency:*:name}
munit mcover ...${dependency:*:nameVersion:-lib}
-lib munit:123 -lib mcover:123 ...Command line arguments haxelib run yhaxen compile version 123
:
${arg:version}
123System variables:
${system:cwd}
i.e. c:/Documents/ProjectA default value can be provided if variable is not available:
${arg:version|variable:version}
if version is not specified via argument, variable will be usedEach phase has a related section (optional) in the config file. If a phase related section is not defined in config file, the phase is skipped. When a specific phase is requested, each preceding phase is invoked as well (e.g. yhaxen release
would run validate, test and compile phase before the actual release).
A specific build in a test or compile phase can be executed by providing a build name (i.e. compile:myBuild
). All builds within a phase can be executed by providing *
as a build name (i.e. test:*
)
Examples:
yhaxen validate
yhaxen test
yhaxen test:*
yhaxen test:testName
yhaxen compile
yhaxen compile:*
yhaxen compile:buildName
yhaxen release -version 0.0.1
yhaxen release -version 0.0.1 -message "Initial release."
yhaxen release -version 0.0.1 -message "Releasing version ${arg:-version}."
Resolve and install dependencies from GIT or Haxelib (see type parameter).
${dependency:munit:dir}
or ${dependency:munit:classPath}
).haxelib set munit 2.1.1
).Example dependency configuration:
"dependencies": [
{
"name": "msignal",
"version": "1.2.2",
"type": "haxelib"
},
{
"name":"munit",
"version":"2.1.1",
"source": "git@github.com:massiveinteractive/MassiveUnit.git",
"type": "git",
"subdirectory": "src",
"scopes": ["test"]
}
]
Test the compiled source code using a unit testing framework.
Sys.command
. See related neko issue.Example:
"tests":
[
{
"name": "test",
"command": "haxelib",
"arguments": ["run", "munit", "test"]
}
]
Compile the source code of the project.
Sys.command
. See related neko issue.Example:
"builds":
[
{
"name": "main",
"command": "haxe",
"arguments":
[
"-main", "Main",
"-js", "${variable:outputDirectory}/main.js",
"-cp", "${variable:sourceDirectory}",
"${dependency:*:classPath:-cp}"
]
}
]
Release versioned project. With git release, all modified files are commited and a tag is created in remote repository.
Example:
"releases":
[
{
"type": "haxelib",
"haxelib": "src/haxelib.json",
"archiveInstructions":
[
{"source": "src/haxelib.json", "target":"haxelib.json"},
{"source": "doc", "target": "doc"},
{"source": "bin/run.n", "target": "run.n"}
]
},
{
"type": "git",
"haxelib": "src/haxelib.json"
}
]