Where's the HXML docs?

2.6k views Asked by At

I've looked all over the Haxe Flash Command-line compiler website but was unable to find any detailed documentation of the HXML files (scroll down to the "Changing SWF properties" section) which describe the compile.

Anybody know of a reference source?


Found HXML:

  • -swf MyApp.swf .... Compile to SWF
  • -main MyAppClass .... Entry-point Class (.AS file)
  • -swf-header 200:300:25:FFFFFF .... Width:Height:FPS:BackColor (of SWF)

Edit: Scroll down for my answer with the complete list of commands.

3

There are 3 answers

2
artificialidiot On BEST ANSWER

Have you tried:

haxe --help

.hxml files are just a convenient way to pass commandline parameters as far as I know.

0
Mihail Ignatiev On

For an advanced usage and some tips here is a great article by Andy Li (https://stackoverflow.com/users/267998/andy-li)

http://blog.onthewings.net/2013/03/04/hxml-tricks-every-haxe-user-should-know/


Commenting a hxml file

Lines starting with hash (#) won't be treated as arguments.

#Yay! Comments!

Run project right after compilation

Use -cmd to run any command line after successful compilation.

#C++
-cpp bin
-main Test
-cmd ./bin/Test

#Flash
-swf Test.swf  
-main Test  
-cmd path/to/FlashDebugger Test.swf

#Neko
-neko Test.n  
-main Test  
-cmd neko Test.n

For Neko target there is special shortcut for building and running -x Test.

Extra arguments

Appending arguments also works, for example if you want to build debug version

haxe project.hxml -debug

Multiple compilations at once

Use --next to separate different target/configuration builds. Use --each to apply arguments to every build within hxml.

#lib will be used in every '--next' build
-lib jQueryExtern  
--each  

#build MainPage
-js script/MainPage.js  
-main MainPage  
--next  

#build ContactPage
-js script/ContactPage.js  
-main ContactPage  

#build AlbumPage
--next  
-js script/AlbumPage.js  
-main AlbumPage

Including hxmls

You can further separate different build configurations by creating an hxml for every configuration.

client.hxml:

-main Client
-js client.js

server.hxml:

-main Server
-neko server.n

all.hxml:

client.hxml
--next
server.hxml

Builds both: haxe all.hxml

0
Robin Rodricks On

Got it! Here's the complete list of HXML / command line Options for the Haxe compiler

  • —cp : add a directory to find source files
  • —js : compile code to JavaScript file
  • —as3 : generate AS3 code into target directory
  • —swf : compile code to Flash SWF file
  • —swf9 : compile code to Flash9 SWF file
  • —swf—version : change the SWF version (6 to 10)
  • —swf—header : define SWF header (width:height:fps:color)
  • —swf—lib : add the SWF library to the compiled SWF
  • —neko : compile code to Neko Binary
  • —php : generate PHP code into target directory
  • —x : shortcut for compiling and executing a neko file
  • —xml : generate XML types description
  • —main : select startup class
  • —lib : use an haxelib library
  • —D : define a conditional compilation flag
  • —resource [@name] : add a named resource file
  • —exclude : don’t generate code for classes listed in this file
  • —v : turn on verbose node
  • —debug : add debug informations to the compiled code
  • —prompt : prompt on error
  • —cmd : run the specified command after successful compilation
  • ——flash—strict : more type strict flash API
  • ——no—traces : don’t compile trace calls in the program
  • ——flash—use—stage : place objects found on the stage of the SWF lib
  • ——neko—source : keep generated neko source
  • ——gen—hx—classes : generate hx headers from SWF9 file
  • ——next : separate several haxe compilations
  • ——display : display code tips
  • ——no—output : compiles but does not generate any file
  • ——times : measure compilation times
  • —-no—inline : disable inlining
  • ——php—front : select the name for the PHP front file
  • ——remap : remap a package to another one
  • —help : Display this list of options
  • ——help : Display this list of options