【转】加快 FlashBuilder4 的编译速度

原文:http://www.nealmi.com/2011/08/speed-up-flashbuilder-compile/

最近搞一个比较大的Flex分析项目,结果FlashBuilder抗不住了,每次编译都极其慢,然后隔三差五的down掉,于是到处google如何加快速度。

然后发现了:

http://forums.adobe.com/thread/740967

http://bugs.adobe.com/jira/browse/SDK-30367

http://yerii.wordpress.com/2010/12/15/why-has-flex-sdk-4-x-x-become-sluggish-for-some-and-how-you-can-get-it-rolling-again/

正好项目用的是该死的SVN,然后Flex 4 的 OEM编译器还有这个bug,每次编译都去遍历.svn目录。

按照上面yerii博文所述,给出不少解决办法:

  1. Migrate to different version control system, such as Git – not feasible in our case, generally not cool – 使用其他版本管理系统,比如Git,Mercuial等
  2. Use only command-line compiler – it’s speed is not affected. But forget auto-build, background error checks… – 使用命令行编译器
  3. Create mirror directory of your project without the SVN meta data and keep it synchronized – very cumbersome – 通过镜像文件夹分离.svn和源码
  4. Use the HellFire Compiler – solves the problem, but it means additional license cost and also does not work as smoothly as one would wish – 使用RPC编译器 HellFire Compiler
  5. File a bug report at Adobe – and wait forever before they even notice – 给Adobe提bug,然后等下去
  6. Download the Flex SDK source code and repair it by yourself – 下载sdk源码,自己修改。
在项目进行到一半的时候,明显 1,2,3,5的办法都十分不靠谱。于是我试了一下 HellFire Compiler ,  不过最后放弃了,因为:
  • 收钱,59USD
  • 各种其他问题,同样让我崩溃。
于是别无选择,只能选择解决办法6。
最讽刺的是Flex3的编译器没有这个bug,而且Adobe还声称提升25%的编译器性能。。。
解决办法6,同样是博文所述,只需要在 /modules/compiler/src/java/flex2/tools/oem/internal/OEMReport.java 里简单的修改,然后重新编译打包就okay了。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</div>
<div>
<pre>private void storeTimestamps(File path)
    {
        // the fix is here:
        if(path.isHidden())    
                return;
        // end of the fix
        timestamps.put(FileUtil.getCanonicalPath(path), path.lastModified());
        for (File file : path.listFiles())
        {
            if (file.isDirectory())
            {
                storeTimestamps(file);
            }
        }
    }</pre>
</div>
<div>
同样地,博主给出了修改后的jar下载链接,可惜是在墙外的dropbox,所以我提供一个墙内的下载地址,flex-compiler-oem.zip

下载-解压-替换到{flex-sdk-4.x-home}/lib,我换了之后至少flashbuilder不会有事儿没事儿罢*工了,至于编译速度,稍快一点点吧,依然很慢!!!(项目太大了)。

阅读(1641) | 评论(0) | 转发(0) |
原文地址:https://www.cnblogs.com/black/p/5171834.html