Search code examples
flashapache-flexactionscript-3configurationmxmlc

What tokens are available (by default) for use in the mxmlc config file?


The flex compiler (mxmlc) allows the use of token substitution in the compiler config xml file, as referenced in the documentation.

From the linked documentation it is clear that you can specify your own tokens for substitution on the commandline, but there are also some default/magic tokens available that Adobe has put in place...

For example, the snippet below is reduced from an Adobe example on how to fiddle with the framework RSL sourcing:

<runtime-shared-library-path> 
    <path-element>libs/framework.swc</path-element> 
    <rsl-url>${hosted.rsl.url}/flex/${build.number}/framework_${build.number}.swz</rsl-url> 
    <policy-file-url>${hosted.rsl.url}/crossdomain.xml</policy-file-url> 
</runtime-shared-library-path>

I have highlighted two tokens in use there, namely hosted.rsl.url and build.number. These work "magically" without specifying them on the commandline.

Here is another example that vaguely shows the existence of a ${flexlib} token.

Unfortunately, aside from those limited examples I can't find a whisper of documentation on what tokens are available... Is the list of tokens documented somewhere that I can't find? If not, does anyone know what the available tokens are so that this SO question can be the documentation?


Note: Since I referenced build.number, I might as well also note that build.number doesn't seem to work quite like Adobe seems to think it does since for me it simply gives me the build number, not the whole string. ie: For flex 4.5.0.20967, ${build.number} just gives me 20967 which is not much help). I had a web link where someone was complaining about the changing implementation of these tokens, but I can't find it anymore.


Solution

  • You'll find them in the build files - do a search for build.xml in both your sdk directory and if you have it (and since it's open source you can get your free copy from adobe http://opensource.adobe.com/wiki/display/flexsdk/Get+Source+Code ) for build.xml files.

    In them you'll see where they're actually defined. You'll need to go through the different builds for different parts of the framework. For example, you can see the following in the first few lines :

    (notice the build.number is specified like you were curious about among others)

    <project name="sdk" default="main" basedir=".">
    
    <property name="FLEX_HOME" location="${basedir}"/>
    
        <!-- Required for OSX 10.6 / Snow Leopard Performance -->
    <condition property="local.d32" value="-d32" >
        <and>
            <equals arg1="${sun.arch.data.model}" arg2="64"/>
            <equals arg1="${os.arch}" arg2="x86_64"/>
                <os family="mac"/>
        </and>
    </condition>
    
    <property file="${FLEX_HOME}/local.properties"/>
    <property file="${FLEX_HOME}/build.properties"/>
    <property environment="env"/>
    <property name="debug" value="true"/>
    <property name="strict" value="true"/>
    <property name="javac.src" value="1.5"/>
    <property name="build.number" value="0"/>
    <property name="target.player" value="10"/>
    

    Happy hunting! (and remember you can add your own too!)

    :)