Menu:

Sponsor

Discover Master of Alchemy, our first iPad/iPhone and iPod touch game!

Follow Me

 

Forum's topics

Latest Files

Archives

Top Rated

Categories

Photo Gallery


Alessandro Crugnola on January 31, 2010 in actionscript

Update your app VERSION using ant

This is just a quick tip in case someone needs it. Maybe when you compile your flash application or your swc library you want to automatically update the "VERSION" number too without do it manually every time.
This is the way I do. In the "compile" task I've added a depends link to this ant task:


<target name="update-version">
	<propertyset id="tdate"></propertyset>
	<tstamp>
		<format property="tdate" pattern="yyyyMMdd"/>
	</tstamp>
	<buildnumber file="build.number"/>
	<echo>updating version to current datetime: ${tdate}</echo>
	<replaceregexp byline="true">
		<regexp pattern="public static const BUILD_DATE: String = \'([0-9]+)'"/>
		<substitution expression="public static const BUILD_DATE: String = '${tdate}'"/>
		<fileset dir="src/it/sephiroth/somestuff">
			<include name="Library.as"/>
		</fileset>
	</replaceregexp>
	
	<replaceregexp byline="true">
		<regexp pattern="public static const BUILD_NUMBER: String = \'([0-9\.]+)'"/>
		<substitution expression="public static const BUILD_NUMBER: String = '${build.number}'"/>
		<fileset dir="src/it/sephiroth/somestuff">
			<include name="Library.as"/>
		</fileset>
	</replaceregexp>
</target>

The 2 optional tasks I've used are: BuildNumber task and ReplaceRegExp Task. In this way every time I do an ant compile, it will update my build number and modification date.
What this task does is find this 2 lines in my Library.as file:

public static const BUILD_DATE: String = '20100131';

and

public static const BUILD_NUMBER: String = '5';


then replace the BUILD_DATE const with the current date and the BUILD_NUMBER with an incremental build number. After being executed the first time, ant will also create a new file in your directory called "build.number" with the latest build number int.


 

Bookmark and Share

 

Tags: ant 

 

1 comments
Nice, I was just thinking about it this weekend and wanted to make something like this, saves me some time to do something else! :) I would also like the SVN revision number in, but I might use your 'template' to create a thing like that. (Or do you happen to have something for it already?)


Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Type the characters you see in the picture above.





 

TrackBacks

TrackBack URL for this entry: http://www.sephiroth.it/cgi-bin/mt/mt-tb.cgi/280