开发者

Flash AS3 with HG version number?

开发者 https://www.devze.com 2022-12-07 23:55 出处:网络
I\'m using ant, hg, and the linu开发者_StackOverflowx Flash as3 libraries to compile.I would like to include some sort of version info automatically, for debugging purposes.No matter what you\'re usin

I'm using ant, hg, and the linu开发者_StackOverflowx Flash as3 libraries to compile. I would like to include some sort of version info automatically, for debugging purposes.


No matter what you're using for version control, remember that the key thing here is that you need the commit id before compiling the swf, that's what makes it tricky.

Using HG hooks (or whatever the equivalent from SVN is called in HG) you have to first commit your code, get the commit id, then write that info to one of the .as files and finally call Ant to compile the SWF.

The problem would be if you want to keep that SWF under version control too. Because even if your Ant task could somehow inject the info directly into the SWF, it would appear as modified (it has been updated after the commit).

In JS / HTML / PHP / whatever this is so much simpler because there's no compiling.

I still need to fully figure this one out, I've only partially done it in the past, so I'm all ears for a complete solution.


I am not familiar with ant, but the simplest and most reliable process is to dynamically create a file and put the result of hg id or hg parents somewhere in it.

For example mercurial does this in setup.py, maybe it will help you do a similar thing. version is taken from the result of calling hg id -i -t.

f = open("mercurial/__version__.py", "w")
f.write('# this file is autogenerated by setup.py\n')
f.write('version = "%s"\n' % version)
f.close()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号