资源描述
FLEX提高编译效率解决方案
25
资料内容仅供参考,如有不当或者侵权,请联系本人改正或者删除。
提高Flex编译效率方案
一.问题描述: 1
二.解决方案: 1
三.编译效率测试 2
四.推荐方案 9
一.问题描述:
编译效率是开发效率中的一个重要环节, 以下几种情况使得FlexBuilder的编译效率低下, 1).开发人员的机器配置太低( 要求2G以上内存) , 2).工程中加载的模块太多甚至模块间有关联, 3).每次修改都自动编译整个项目。除了机器要求之外, 以下分析并提供了四种能够提高编译效率的方式。
二.解决方案:
1. 采用模块化开发, 不开发的就不引用, 这样可大大加快编译速度。开发人员各司其职, 最后发布的时候再统一builder。
2. 把 Build Automatically 选项去掉, 模块编译改用手动 Build, 修改完善之后才进行Build, 该方式为增量编译。
3. 采用fsch + ant编译模块, fsch是一个编译的后台程序, 需要在开发机器上安装, 经过ant执行 build.xml文件来调用fsch服务, build文件中的执行如下:
<target name="buildfcsh">
<fcsh consoleencoding="utf-8">
<arg value="mxmlc"/>
<arg value="${SRC_DIR}/${package}/${file}.mxml" />
<arg value="-output=${DEPLOY_DIR}/${package}/${file}.swf"/>
<arg value="-load-config=${FLEX_HOME}/frameworks/flex-config.xml"/>
<arg value="-source-path=${SRC_DIR}"/>
<arg value="-library-path+=${THIRD_PARTY}/YLZFlex.swc;${THIRD_PARTY}/YLZFlex_core.swc;${THIRD_PARTY}/YLZFlex_report.swc" />
<arg value="-defaults-css-url=${SRC_DIR}/style.css"/>
<arg value="-theme=${FLEX_HOME}/frameworks/themes/Halo/halo.swc" />
</fcsh>
</target>
这种方式产生的模块swf文件较采用FlexBuilder合并代码编译的结果小, 可是ant编译当前无法结合应用程序Main.mxml方式编译, 因此编译结果的模块需要添加样式文件, 如: 。
4. 安装YLZPlugin eclipse插件, 在Flex模块文件上点击右键菜单”编译Flex模块”,这种方式编译简单,编译效率高而且不需要每次要编译一个模块就修改ant文件
三.编译效率测试
以下测试环境:
CPU 2.4GHZ
内存: 2G
开发工具Myeclipse8.5+FlexBuilder
-Xmx768m
-XX:MaxPermSize=256m
-XX:ReservedCodeCacheSize=64m
1. 采用fsch + ant 的方式编译
第一次编译:
Buildfile: E:\workspace\YLZCBP\ant\build-fsch.xml
[echo] E:\workspace\YLZCBP
[echo] C:\Program Files (x86)\Fcsh Server/fcsh.jar
buildfcsh:
[fcsh] Server is not responding. Probably it is stopped. Trying to launch...
[fcsh] Server started
[fcsh] Trying to connect... Attempt 1 of 5
[fcsh] Paused for 2 seconds...
[fcsh] Trying to connect... Attempt 2 of 5
[fcsh] Connection established
[fcsh] Send command: mxmlc E:\workspace\YLZCBP/flex-src//modules/sysmanager/SysorgManager.mxml -output=D:\greensoftware\tomcat5.5.20\webapps\YLZCBP\swf//modules/sysmanager/SysorgManager.swf -load-config=D:\flex\sdks\4.0.0/frameworks/flex-config.xml -source-path=E:\workspace\YLZCBP/flex-src -library-path+=E:\workspace\YLZCBP/flex-lib/YLZFlex.swc;E:\workspace\YLZCBP/flex-lib/YLZFlex_core.swc;E:\workspace\YLZCBP/flex-lib/YLZFlex_report.swc -link-report=E:\workspace\YLZCBP/flex-src/Main_report.xml -theme=D:\flex\sdks\4.0.0/frameworks/themes/Halo/halo.swc
[fcsh] fcsh: Assigned 1 as the compile target id
[fcsh] Loading configuration file D:\flex\sdks\4.0.0\frameworks\flex-config.xml
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\entity\Sysfunction.as(9): col: 21 Warning: variable”TYPE_FOLDER”没有类型声明。
[fcsh] public static var TYPE_FOLDER="0"; //节点
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\entity\Sysfunction.as(10): col: 21 Warning: variable”TYPE_LEAF”没有类型声明。
[fcsh] public static var TYPE_LEAF="1"; //叶子
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\entity\Sysfunction.as(11): col: 21 Warning: variable”TYPE_BUTTON”没有类型声明。
[fcsh] public static var TYPE_BUTTON="2"; //按钮
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\commons\Globals.as(11): col: 21 Warning: variable”SERVICE_CURRENTUSER”没有类型声明。
[fcsh] public static var SERVICE_CURRENTUSER="loadCurrentUser";
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\commons\Globals.as(12): col: 21 Warning: variable”SERVICE_LOGIN”没有类型声明。
[fcsh] public static var SERVICE_LOGIN="syslogin";
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\commons\Globals.as(13): col: 21 Warning: variable”SERVICE_LOGOUT”没有类型声明。
[fcsh] public static var SERVICE_LOGOUT="syslogout";
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\commons\Globals.as(15): col: 21 Warning: variable”SERVICE_MENU”没有类型声明。
[fcsh] public static var SERVICE_MENU="sysfunction";
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\commons\Globals.as(16): col: 21 Warning: variable”SERVICE_SYSCODE”没有类型声明。
[fcsh] public static var SERVICE_SYSCODE="syscode";
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\commons\Globals.as(21): col: 24 Warning: variable”SERVICE_SYSFUNCTIONQUERY”没有类型声明。
[fcsh] public static var SERVICE_SYSFUNCTIONQUERY="sysfunctionquery";
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\commons\Globals.as(23): col: 21 Warning: variable”SERVICE_REPORTS”没有类型声明。
[fcsh] public static var SERVICE_REPORTS="loadStatisticalReports";
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\commons\Globals.as(24): col: 21 Warning: variable”SERVICE_REPORTS_STATISTICAL”没有类型声明。
[fcsh] public static var SERVICE_REPORTS_STATISTICAL="setStatisticalReports";
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\commons\Globals.as(27): col: 21 Warning: variable”SERVICE_LOCALDB”没有类型声明。
[fcsh] public static var SERVICE_LOCALDB="localDBService";
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\SystemUtil.as(26): col: 30 Warning: return value for function”init”没有类型声明。
[fcsh] public static function init(){
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\SystemUtil.as(74): col: 39 Warning: return value for function”reloadSyscode”没有类型声明。
[fcsh] public static function reloadSyscode(){
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\SystemUtil.as(79): col: 11 Warning: variable”datas”没有类型声明。
[fcsh] var datas=res.getArrayDatas();
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\SystemUtil.as(97): col: 8 Warning: variable”params”没有类型声明。
[fcsh] var params = new Object();
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\SystemUtil.as(109): col: 12 Warning: variable”i”没有类型声明。
[fcsh] for(var i=0;i<rows.length;i++){
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\SystemUtil.as(120): col: 52 Warning: return value for function”onLoadFunctionSuccess”没有类型声明。
[fcsh] function onLoadFunctionSuccess(res:ResponseEntity){
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\SystemUtil.as(122): col: 10 Warning: variable”rows”没有类型声明。
[fcsh] var rows=res.datas;
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\SystemUtil.as(151): col: 8 Warning: variable”params”没有类型声明。
[fcsh] var params = new Object();
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\com\ylzinfo\sysmanager\SystemUtil.as(221): col: 50 Warning: return value for function”onLoadReportSuccess”没有类型声明。
[fcsh] function onLoadReportSuccess(res:ResponseEntity){
[fcsh] ^
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(26): Warning: ewZ文_'application' has been deprecated since 4.0. Please use 'FlexGlobals.topLevelApplication'.
[fcsh] var window:SysroleGrantWindow = SysroleGrantWindow(PopUpManager.createPopUp(Application.application as DisplayObject, SysroleGrantWindow , true)) ;
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(28): Warning: return value for function”doCloseWindow”没有类型声明。
[fcsh] function doCloseWindow(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(40): Warning: return value for function”close”没有类型声明。
[fcsh] public function close(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(46): Warning: return value for function”onLoadFunctionSuccess”没有类型声明。
[fcsh] private function onLoadFunctionSuccess(res:ResponseEntity){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(60): Warning: return value for function”initFunctiontree”没有类型声明。
[fcsh] public function initFunctiontree(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(72): Warning: return value for function”init”没有类型声明。
[fcsh] private function init(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(77): Warning: return value for function”onSaveFunctionSuccess”没有类型声明。
[fcsh] private function onSaveFunctionSuccess(res:ResponseEntity){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(80): Warning: return value for function”save”没有类型声明。
[fcsh] private function save(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(86): Warning: variable”i”没有类型声明。
[fcsh] for(var i=0;i<functions.length;i++){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(92): Warning: variable”i”没有类型声明。
[fcsh] for(var i=0;i<partfunctions.length;i++){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysroleGrantWindow.mxml(92): Warning: 变量定义重复。
[fcsh] for(var i=0;i<partfunctions.length;i++){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysorgGrantWindow.mxml(40): Warning: ewZ文_'application' has been deprecated since 4.0. Please use 'FlexGlobals.topLevelApplication'.
[fcsh] var window:SysorgGrantWindow = SysorgGrantWindow(PopUpManager.createPopUp(Application.application as DisplayObject, SysorgGrantWindow , true)) ;
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysorgGrantWindow.mxml(42): Warning: return value for function”doCloseWindow”没有类型声明。
[fcsh] function doCloseWindow(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysorgGrantWindow.mxml(62): Warning: return value for function”grantOrg”没有类型声明。
[fcsh] private function grantOrg(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysorgGrantWindow.mxml(70): Warning: variable”i”没有类型声明。
[fcsh] for(var i=0;i<items.length;i++){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysreportGrantWindow.mxml(34): Warning: return value for function”doCloseWindow”没有类型声明。
[fcsh] function doCloseWindow(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysreportGrantWindow.mxml(46): Warning: return value for function”close”没有类型声明。
[fcsh] public function close(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysreportGrantWindow.mxml(52): Warning: return value for function”onLoadReportSuccess”没有类型声明。
[fcsh] private function onLoadReportSuccess(res:ResponseEntity){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysreportGrantWindow.mxml(66): Warning: return value for function”initReportList”没有类型声明。
[fcsh] public function initReportList(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysreportGrantWindow.mxml(78): Warning: return value for function”init”没有类型声明。
[fcsh] private function init(){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysreportGrantWindow.mxml(83): Warning: return value for function”onSaveReportSuccess”没有类型声明。
[fcsh] private function onSaveReportSuccess(res:ResponseEntity){
[fcsh] E:\workspace\YLZCBP\flex-src\views\SysreportGrantWindow.mxml(86): Warning: return value for function”save”没有类型声明。
[fcsh] private function save(){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(46): Warning: variable”lastRollOverIndex”没有类型声明。
[fcsh] private var lastRollOverIndex;
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(48): Warning: variable”state”没有类型声明。
[fcsh] private var state="default";
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(53): Warning: return value for function”result”没有类型声明。
[fcsh] function result(res:ResponseEntity){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(57): Warning: variable”datas”没有类型声明。
[fcsh] var datas=res.getArrayDatas();
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(120): Warning: return value for function”yesFunction”没有类型声明。
[fcsh] function yesFunction(){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(134): Warning: return value for function”onDeleteSuccess”没有类型声明。
[fcsh] function onDeleteSuccess(res:ResponseEntity){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(157): Warning: return value for function”doReset”没有类型声明。
[fcsh] private function doReset(){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(167): Warning: return value for function”doSave”没有类型声明。
[fcsh] private function doSave(){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(175): Warning: return value for function”onAddSuccess”没有类型声明。
[fcsh] function onAddSuccess(res:ResponseEntity){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(202): Warning: return value for function”onUpdateSuccess”没有类型声明。
[fcsh] function onUpdateSuccess(res:ResponseEntity){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(211): Warning: 变量定义重复。
[fcsh] var rs:RemoteService=new RemoteService("sysorgupdate");
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(225): Warning: return value for function”initContentMenu”没有类型声明。
[fcsh] public function initContentMenu(){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(267): Warning: return value for function”clickGrantorg”没有类型声明。
[fcsh] function clickGrantorg(event:Event){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(275): Warning: return value for function”callback”没有类型声明。
[fcsh] function callback(){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(298): Warning: return value for function”clickGrant”没有类型声明。
[fcsh] function clickGrant(event:Event){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(331): Warning: return value for function”clickReportGrant”没有类型声明。
[fcsh] function clickReportGrant(event:Event){
[fcsh] E:\workspace\YLZCBP\flex-src\modules\sysmanager\SysorgManager.mxml(369): Warning: return value for function”onValidateSuccess”没有类型声明。
[fcsh] functi
展开阅读全文