Skip to content

Instantly share code, notes, and snippets.

@jgranick
Created February 8, 2012 01:05
Show Gist options
  • Star 58 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save jgranick/1763850 to your computer and use it in GitHub Desktop.
Save jgranick/1763850 to your computer and use it in GitHub Desktop.
NMML File Specification
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- <meta />
Use meta nodes to set metadata for your application. The description is ignored
on most targets, but is useful for packaging like Chrome Apps or Opera Widgets.
For compatibility with Android and webOS, the package name must include at least
three "sections", and the version should have exactly three "sections"
-->
<meta title="Example Application" description="A really cool application!" package="com.example.myapp" version="1.0.0" company="My Company" />
<!-- <app />
Use app nodes to set the "main" class for your project, and optionally configure
the output file name, path and (if targeting Flash) SWF version.
Use the preloader attribute to specify a custom class name to use as the preloader for your
application. This applies to Flash and HTML5, which require a preloader by default.
-->
<app main="com.example.myapp.MyApp" file="MyProject" path="Export" preloader="CustomPreloaderClass" swf-version="11" />
<!-- <window />
Use window nodes to specify how an application should be run.
Not all of the available options apply to each target. Most of these properties are also
optional.
If you specify a width and height of 0, it will use the full screen size on most platforms.
-->
<window width="0" height="0" background="0xFFFFFF" fps="30" />
<window width="800" height="600" orientation="portrait" fps="60" background="0xFFFFFF" resizable="false" borderless="false" vsync="false" fullscreen="false" antialiasing="4" />
<!-- <source />
Use source nodes to add classpaths for Haxe code
-->
<source path="path/to/my/code" />
<!-- <haxelib />
Use haxelib nodes to include classes or NME extensions from haxelib
The root path of a haxelib is always used as a Haxe classpath. If the
library also includes an "include.nmml" file, it will be read and
processed. This is how NME extensions can their required NMML binaries,
haxelibs, defines or other additional options.
Similar to include nodes, the base path is updated to begin with the
location of the file. If the "include.nmml" file specified a path as
"assets", it would become "path/to/haxelib/assets" when processed.
-->
<haxelib name="actuate" />
<!-- <ndll />
You can include native binaries for HXCPP/NME using ndll nodes.
Specify the name of the library you would like to include, as well as
the haxelib project where it can be found. The command-line tools will
search for an /ndll directory, with binaries for the current target.
For example, a library called "example" may be placed in a directory
structure like this:
./ndll/Android/libexample.so
./ndll/iPhone/libexample.iphoneos.a
./ndll/iPhone/libexample.iphonesim.a
./ndll/Linux/example.ndll
./ndll/Linux64/example.ndll
./ndll/Mac/example.ndll
./ndll/webOS/example.so
./ndll/Windows/example.ndll
If you are specifying a binary through an include file, you do not
need to specify a "haxelib" attribute, as the directory of the include
file will be searched for the NDLL you wish to use.
Otherwise, libraries will be search for in the HXCPP haxelib by
default.
-->
<ndll name="nme" />
<ndll name="sqlite" />
<ndll name="example" haxelib="example" />
<!-- <include />
Use the include node to process additional NMML files.
TYou can target a path which includes an "include.nmml" file, or you
can specify the exact path to an XML/NMML file.
If you are testing an NME extension locally, or do not wish to submit
your extension to haxelib, you can use an include node.
-->
<include path="shared.nmml" />
<include path="path/to/my/extension" />
<!-- <icon />
Use icon nodes to add icons to your project.
If you specify a bitmap icon, you can include multiple icon nodes, each
with a different icon size. Otherwise you can specify an SVG file, and
the command-line tools will attempt to process the SVG and generate
icons for each requested size for the current target.
-->
<icon path="icon.svg" />
<icon path="icon.png" size="32" />
<icon path="icon.png" width="64" height="64" />
<!-- <assets />
Use asset nodes to add resources to your project.
The path attribute can point to either a file or a directory. These files will
be copied (or embedded) in your final project, and can be accessed using the
nme.Assets class.
For example, if you include the following node in your NMML file:
<assets path="images/MyImage.jpg" />
You can access it in your application like this:
var bitmapData = Assets.getBitmapData ("images/MyImage.png");
The target path will mirror the source path by default, but you also can include
a rename attribute, if you wish to use a different target path. The nme.Assets
class will use the *target* path by default, so using the rename attribute will
alter the names you use to reference your files.
If you would prefer to set the ID for your asset file yourself, use a name
attribute. This only applies to asset nodes which point to a file, not a
directory path.
When pointing to a directory, you can use the include or exclude attributes to
specify patterns for including files automatically. Wildcards are supported.
To include all the files under the directory, for example, use an include
value of "*". You can separate multiple patterns using "|" characters.
You can nest assets nodes inside of each other. If you specify a directory in the
top assets node, its path will be appended to the paths you specify in subsequent
nodes.
The type for each file will be determined automatically, based on each file
extension, but you can use the type attribute to set it for the file or directory
yourself. If you are nesting a node inside of another assets node, you can also
use the name of the type as the name of your node.
These are the current types:
binary
font
image
music
sound
template
text
Some targets can only support playing one music file at a time. You should use
"music" for files which are designed to play as background music, and "sound" for
all other audio. "binary" and "text" are generic types which are available as a ByteArray or
String in your application. Most targets can use them interchangeably.
If an asset is specified as "template", it will not be copied/embedded as an ordinary
asset, but instead will be copied to the root directory of your project, so you can
replace any of the template HX, HXML or platform-specific files for the target.
-->
<assets path="assets" include="*" />
<assets path="../../assets" rename="assets" include="*" />
<assets path="assets/images" rename="images" include="*.jpg|*.png" exclude="example.jpg" />
<assets path="assets">
<assets path="images" include="*" type="image" />
<sound path="sound/mySound.wav" name="MySound" />
<music path="sound/BackgroundMusic.mp3" />
</assets>
<!-- <template />
Use template nodes to include "template" type assets.
Using a template node is shorthand for creating an assets node with the type specified
as "template"
These files are copied into the destination directory before compiling your project, so
you can overwrite any of the classes, compile scripts or platform-specific template files
for your project.
Template files are also processed, so you can use the haXe templating system to replace
values. For example, if you set a variable called MY_VALUE, you could place this in your
files by writing ::MY_VALUE:: in the file's text.
-->
<template path="appinfo.json" if="webos" />
<template path="Assets/android/libs" rename="libs" if="android" />
<!-- <library />
Use library nodes to embed SWF assets in your application.
Unlike including a SWF file using an assets node, embedding it as a library will cause
the command-line tools to generate classes for each of the symbols found in the SWF
file. You can use these classes to instantiate the symbols directly.
The "path" attribute should point to the file. The file will be saved in a
"libraries" folder by default, with the name of the original SWF.
For example, if you have a symbol in your SWF file, with "linkage" set to
"com.example.MySquare", you could create copies of this symbol using this code:
import com.example.MySquare;
...
var square = new MySquare ();
You must have "swf" installed through haxelib in order to use this feature.
The library node may also be used in the future if there are other sensible
container formats
-->
<library path="Source/library.swf" />
<!-- <set />
Use set nodes to specify values for use, locally, in the NME command-line tools.
These values are present while processing NMML files, and determining how to build
for a specific platform.
These values will generally *not* apply to the Haxe compiler or C++ compilers, directly.
-->
<set name="fullscreen" />
<set name="DOCS_DIR" value="docs" />
<!-- <unset />
Use unset nodes to remove a value that was previously defined locally.
-->
<unset name="fullscreen" />
<!-- "if"
You can add "if" attributes to practically any node in an NMML file.
Use this in combination with local defines to control the output of your application.
The command-line tools will create defines for the current target, automatically. Use
this if you need to handle platforms differently.
-->
<window width="800" height="600" if="flash" />
<!--- "unless"
Similar to the "if" attribute, you can add "unless" attributes to ignore nodes
unless the specified value has been defined locally.
-->
<window width="800" height="600" unless="fullscreen" />
<!-- <haxeflag />
Use haxeflag nodes to specify additional arguments when running the Haxe compiler.
You can set your additional flag using the name attribute, or optionally you can
also include a value attribute if the flag requires a value.
-->
<haxeflag name="--no-traces" />
<haxeflag name="-swf-lib" value="library.swf" if="flash" />
<!-- <haxedef />
Use haxedef nodes to define values for use in your Haxe code. This is similar to the
set node, but instead of applying to the NME command-line tools, it applies to your
Haxe classes.
You can use these defines to control conditional compilation inside of your code:
#if special
// do something special!
#else
// do something ordinary
#end
This is the same as using a haxeflag node, with "-D" added before the name of your
define.
-->
<haxedef name="special" />
<!-- <setenv />
Use setenv nodes to specify or override values in your system's environment variables.
These values will apply locally to the NME command-line tools and globally when calling
child process, like C++ compilers or other packaging tools.
-->
<setenv name="GLOBAL_DEFINE" />
<setenv name="JAVA_HOME" value="path/to/custom/jdk" if="android" />
<!-- <java />
Use java nodes to include custom Java classes in Android applications.
-->
<java path="path/to/java/classes" />
<!-- <certificate />
Use the certificate node to release-sign Android or BlackBerry applications.
If you do not include the password attribute, you will be prompted for your certificate password
at the command-line.
For Android, the alias will be set to the file name of your certificate by default,
without the extension. If the alias name is different, you can use the alias attribute.
If you have set the password attribute, the alias_password attribute will default to the same
value. Otherwise you can add an alias-password attribute to specify a different value.
BlackBerry does not use the "alias" or "alias-password" attributes.
-->
<certificate path="path/to/certificate.crt" password="1234" alias="my-alias" alias-password="4321" />
<!-- <ios/>
Control iOS-specific values when compiling.
The "deployment" attribute can set the minimum iOS version you wish to target.
The "binaries" attribute can be "armv6", "armv7" or "fat"
The "devices" attribute can specify "ipad", "iphone" or "universal"
If you select a device, it can set the binaries. For example, if you only want to
target the iPad, only armv7 will be required, or if you wish to target both, it will
create a universal binary by default.
-->
<ios deployment="3.2" binaries="fat" devices="universal" />
<!-- <dependency />
Use dependency nodes to specify native frameworks or references that
are required to compile your project
-->
<dependency name="GameKit.framework" if="ios" />
<!-- <path />
Use path nodes to add directories to your system's PATH environment variable.
-->
<path value="path/to/add/to/system/PATH" />
<!-- <error />
Use error nodes to throw your own errors during the build process, if necessary.
-->
<error value="ERROR: Something is wrong" />
<!-- <section />
Use section nodes to group multiple nodes together. This is most useful when
combined with the "if" and "unless" attributes.
-->
<section if="webos">
<assets path="assets/webos" include="*" />
</section>
<!-- Miscellaneous values
The command-line tools currently recognize a few miscellaneous values. You can
modify these values using set nodes.
PRERENDERED_ICON
ANDROID_INSTALL_LOCATION
DOCS_DIR
VSDEBUG
"PRERENDERED_ICON" is used with iOS. You can change this value to specify that
your application icons have been prerendered, so that XCode will not apply the
iOS "gloss" to your icon graphics.
"ANDROID_INSTALL_LOCATION" lets you customize the value specifying where your
application can be installed on Android. The default value requests an install
on the user's SD card.
"DOCS_DIR" lets you customize the output directory when using the "document"
command against your project.
"VSDEBUG" will be used if you compile for Windows using the -vsdebug flag.
Instead of launching normally, the compiled application will be opened with
Visual Studio (using this value for devenv or VCExpress.exe) for debugging.
-->
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment