Enabling Console output for exec ANT task

2019-07-19 02:21发布

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?

标签: eclipse ant exec
3条回答
做自己的国王
2楼-- · 2019-07-19 03:13

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

查看更多
虎瘦雄心在
3楼-- · 2019-07-19 03:20

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.

查看更多
欢心
4楼-- · 2019-07-19 03:20

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>
查看更多
登录 后发表回答