开发者

Enabling Console output for exec ANT task

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

<macr开发者_如何学Pythonodef 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?


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


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.


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>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜