tags:

views:

355

answers:

3

I would like to include the compilation date with the version number in my flex/air app.

I do not know how I could get this, or if its even possible. Is there a way?

Thanks.

A: 

To the best of my knowledge, no -- not unless you write it into your app yourself manually at compile-time, or have your build scripts do it automatically somehow. Neither FlexBuilder nor Flash support appending that sort of metadata. At least not yet.

Christian Nunciato
Thanks for the info! I will just not include it, I would rather not rely on my memory to change a string every time I compile lol.
John Isaacks
+1  A: 

We are using Ant for our build system, and it has a capability of updating some property files automatically. We set a date/timestamp to record the time of compilation. It can also recognize a property as a number and increment it each time - we use this as a build number. Our Flex app then just loads this property and displays it as needed.

<target name="update-version-info">
    <property environment="env"/>
    <property file="${file.props.versioninfo}" prefix="old"/>
    <propertyfile file="${file.props.versioninfo}">
        <entry key="system.build.user"        value="${env.USER}"/>
        <entry key="system.build.host"        value="${env.COMPUTERNAME}"/>
        <entry key="system.build.date"        value="${DSTAMP}-${TSTAMP}"/>
        <entry key="system.build.number"      value="${old.system.build.number.next}"/>
        <entry key="system.build.number.next" default="${old.system.build.number.next}" type="int" operation="+"/>
    </propertyfile>
</target>

For extra points, tie the build process back into the source control system and check in the updated property file - this makes it pretty much automatic for us. If you use Ant, this might help you out.

Note that the {DSTAMP} and {TSTAMP} Ant properties are set at Ant invocation with the <tstamp> task.

weiji
A: 

There is a way to do this using only ActionScript which involves loading the source using ByteArray. It's not for the faint of heart but works independently of ANT or other third-party applications: http://www.actionscript.org/forums/showthread.php3?t=239907

Pete