Enabling Console output for exec ANT task

妖精的绣舞 提交于 2019-12-11 01:42:04

问题


Inside eclipse I'm launching an html page with a swf embedded from ANT using the following Macrodef:

<macrodef name="runhtml">
   <attribute name="url" />
   <attribute name="browser" default="${app.browser.firefox}" />
   <sequential>
      <exec
         executable="open"
         vmlauncher="true"
         spawn="false"
         failonerror="true">
         <arg line="-a '@{browser}'" />
         <arg line="@{url}" />
      </exec>
   </sequential>
</macrodef>

Despite the fact that the swf contains traces, I am not getting any output from them in the console. What could be causing this?


回答1:


In order to get traces from Flash you need to run the Flash Debugger (FDB). Luckily it comes with the Flex SDK. (http://www.adobe.com/devnet/flex/flex-sdk-download.html)

This is a sample task that I am using in Ant to launch the Flash Debugger, which in turn will launch your browser because the target is an HTML file. If the target was a SWF file then it would simply run in a standalone FDB window.

  <target name="launch-browser">
    <echo file="${basedir}/build/.fdbinit">run file://${outputdir}/swf/index.html
continue</echo>
    <exec executable="${sdk.flex}bin/fdb" spawn="false" dir="build">
      <arg line="-unit"/>
    </exec>
  </target>

This task will first write a file called .fdbinit which contains the commands that fdb will run when launched. Then it starts fdb with -unit to make sure it stays properly attached to the ant builder (I'm actually not 100% on this but it is required). This will give you the browser, and the traces (also the actual debugger control) in your terminal window.

--

Alternatively, using your original macrodef, if you have the Flash Debug Player installed on your machine ; you can configure your Flash Player to write the traces to a file by editing your mm.cfg file and setting the TraceOutputFileEnable and TraceOutputFileName options.

This file is found in /Library/Application Support/Macromedia on OSX.

Relevant and additional docs for mm.cfg: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fc9.html




回答2:


I've got exactly the same problem. Error messages are echoed to the console but info messages are not. The only solution I have found so far is to add your own echo's to the macrodef.




回答3:


The only way it seems, to also automate it, is to use the .fbinit as describe by Benoit, but putting each command on a different line:

    <echo file="${BUILD.dir}/.fdbinit">run file://${outputdir}/swf/index.html
    continue</echo>


来源:https://stackoverflow.com/questions/2897141/enabling-console-output-for-exec-ant-task

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!