You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Jesse Ward-Karet <jw...@tanium.com> on 2013/09/11 00:11:56 UTC

Building workers with Ant

How do you setup an Ant task to build and embed ActionScript Workers?

When we develop locally, FlexBuilder takes care of building and embedding the worker for us. We just add the base ActionScript file (Worker.as) in the 'ActionScript Workers' section of the project properties and choose the 'embed' option.

Our production build environment uses Ant to build from the command line using mxmlc. Here's an example from our current config:

 <target name="debug"> 
        <mxmlc file="${APP_ROOT}/Main.mxml" output="${OUT_ROOT}/Main.swf" incremental="false" debug="true" fork="true">
            <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/> 
            <source-path path-element="${FLEX_HOME}/frameworks"/> 
            <compiler.source-path path-element="${LIB_ROOT}/src"/> 
            <compiler.source-path path-element="${basedir}/src" />
            <compiler.library-path dir="${basedir}/libs" append="true">
                <include name="*.swc" />
            </compiler.library-path>
            <compiler.library-path dir="${basedir}/libs_ant" append="true">
                <include name="*.swc" />
            </compiler.library-path>
            <includes symbol="mx.managers.systemClasses.MarshallingSupport" />
            <arg line="-swf-version=18" />
            <arg line="-target-player=11.5" />
        </mxmlc> 
</target>


Thanks for any help!
Jesse

Re: Building workers with Ant

Posted by Jesse Ward-Karet <jw...@tanium.com>.
Thanks! I was able to get it working. For others who do this, you need to
make sure you output to the same path specified in the Embed statement in
your Worker.as file. There are other ways to embed a SWF of course, but
this is what we did:

[Embed(source="../workerswfs/workers/MyWorker.swf",
mimeType="application/octet-stream")]

I also had to set -static-link-runtime-shared-libraries=true . I'm hoping
if I play around a bit more I can get rid of that requirement.


On Tue, Sep 10, 2013 at 8:00 PM, Mark Line <ma...@gmail.com> wrote:

> I'm doing by setting a depends on the target:
>
>  <target name="myworkers">
> <echo message="Building XXXX AS3 Workers [DEBUG MODE ${isDebug}]"/>
> <exec executable="${flash.mxmlc}" failonerror="true">
> <arg line="-compiler.conservative" />
> <arg line="-keep-as3-metadata+=Table,Id,Column,NotNull,Type,Default" />
>  <arg line="-source-path '${library.as}'"/>
> <arg line="-load-config '${src.flex.framework}/air-config.xml'"/>
>  <arg line="-target-player=${PLAYER}"/>
> <arg line="-benchmark=true"/>
> <arg line="-debug=${isDebug}"/>
> <arg line="-locale=${LOCALE}"/>
> <arg line="-optimize=${OPTIMIZE}"/>
> <arg line="-strict=${STRICT}"/>
> <arg line="-incremental=${INCREMENTAL}"/>
>
> <arg line="-output
>
> '${svn_checkout_target_imagine_kiosk}/workerswfs/com/xxx/xxxx/xxx/myworker.swf'"/>
> <arg line="'${library.as}/com/xxx/xxxx/xxx/myworker.as'"/>
> </exec>
>  </target>
>
>     <target name="build" depends="myworkers">
> <echo message="Building XXXX Kiosk [DEBUG MODE ${isDebug}]"/>
> <exec executable="${flash.mxmlc}" failonerror="true">
> <arg line="-include-libraries '${library.corelib}'" />
> <arg line="-compiler.conservative" />
> <arg line="-keep-as3-metadata+=Table,Id,Column,NotNull,Type,Default" />
>  <arg line="-source-path '${library.as}'"/>
> <arg line="-source-path '${library.image_uploader}'"/>
> <arg line="-load-config '${src.flex.framework}/air-config.xml'"/>
>  <arg line="-static-link-runtime-shared-libraries=${RSL}" />
> <arg line="-target-player=${PLAYER}"/>
> <arg line="-benchmark=true"/>
> <arg line="-debug=${isDebug}"/>
> <arg line="-locale=${LOCALE}"/>
> <arg line="-optimize=${OPTIMIZE}"/>
> <arg line="-strict=${STRICT}"/>
> <arg line="-incremental=${INCREMENTAL}"/>
> <arg
>
> line="-link-report=${imagine_kiosk.release.build.dir}/${versionNumber}${debugPath}/report.xml"/>
>  <arg line="-output
>
> '${imagine_kiosk.release.build.dir}/${versionNumber}${debugPath}/${APP_NAME}.swf'"/>
> <arg line="'${source}/${APP_NAME}.mxml'" />
> </exec>
>     </target>
>
>
> On 11 September 2013 02:41, Frédéric THOMAS <we...@hotmail.com>
> wrote:
>
> > I didn't try yet but I will have in a bit, because the I'm using workers
> > and
> > others to make the Apache Flex Installer faster, I would be very happy to
> > know if someone had a successful builds with workers using Ant, let us
> know
> > pls.
> >
> > -----Message d'origine-----
> > De : Jesse Ward-Karet [mailto:jwk@tanium.com]
> > Envoyé : mercredi 11 septembre 2013 00:12
> > À : users
> > Objet : Building workers with Ant
> >
> > How do you setup an Ant task to build and embed ActionScript Workers?
> >
> > When we develop locally, FlexBuilder takes care of building and embedding
> > the worker for us. We just add the base ActionScript file (Worker.as) in
> > the
> > 'ActionScript Workers' section of the project properties and choose the
> > 'embed' option.
> >
> > Our production build environment uses Ant to build from the command line
> > using mxmlc. Here's an example from our current config:
> >
> >  <target name="debug">
> >         <mxmlc file="${APP_ROOT}/Main.mxml" output="${OUT_ROOT}/Main.swf"
> > incremental="false" debug="true" fork="true">
> >             <load-config
> > filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
> >             <source-path path-element="${FLEX_HOME}/frameworks"/>
> >             <compiler.source-path path-element="${LIB_ROOT}/src"/>
> >             <compiler.source-path path-element="${basedir}/src" />
> >             <compiler.library-path dir="${basedir}/libs" append="true">
> >                 <include name="*.swc" />
> >             </compiler.library-path>
> >             <compiler.library-path dir="${basedir}/libs_ant"
> append="true">
> >                 <include name="*.swc" />
> >             </compiler.library-path>
> >             <includes
> symbol="mx.managers.systemClasses.MarshallingSupport"
> > />
> >             <arg line="-swf-version=18" />
> >             <arg line="-target-player=11.5" />
> >         </mxmlc>
> > </target>
> >
> >
> > Thanks for any help!
> > Jesse
> >
>

Re: Building workers with Ant

Posted by Mark Line <ma...@gmail.com>.
I'm doing by setting a depends on the target:

 <target name="myworkers">
<echo message="Building XXXX AS3 Workers [DEBUG MODE ${isDebug}]"/>
<exec executable="${flash.mxmlc}" failonerror="true">
<arg line="-compiler.conservative" />
<arg line="-keep-as3-metadata+=Table,Id,Column,NotNull,Type,Default" />
 <arg line="-source-path '${library.as}'"/>
<arg line="-load-config '${src.flex.framework}/air-config.xml'"/>
 <arg line="-target-player=${PLAYER}"/>
<arg line="-benchmark=true"/>
<arg line="-debug=${isDebug}"/>
<arg line="-locale=${LOCALE}"/>
<arg line="-optimize=${OPTIMIZE}"/>
<arg line="-strict=${STRICT}"/>
<arg line="-incremental=${INCREMENTAL}"/>

<arg line="-output
'${svn_checkout_target_imagine_kiosk}/workerswfs/com/xxx/xxxx/xxx/myworker.swf'"/>
<arg line="'${library.as}/com/xxx/xxxx/xxx/myworker.as'"/>
</exec>
 </target>

    <target name="build" depends="myworkers">
<echo message="Building XXXX Kiosk [DEBUG MODE ${isDebug}]"/>
<exec executable="${flash.mxmlc}" failonerror="true">
<arg line="-include-libraries '${library.corelib}'" />
<arg line="-compiler.conservative" />
<arg line="-keep-as3-metadata+=Table,Id,Column,NotNull,Type,Default" />
 <arg line="-source-path '${library.as}'"/>
<arg line="-source-path '${library.image_uploader}'"/>
<arg line="-load-config '${src.flex.framework}/air-config.xml'"/>
 <arg line="-static-link-runtime-shared-libraries=${RSL}" />
<arg line="-target-player=${PLAYER}"/>
<arg line="-benchmark=true"/>
<arg line="-debug=${isDebug}"/>
<arg line="-locale=${LOCALE}"/>
<arg line="-optimize=${OPTIMIZE}"/>
<arg line="-strict=${STRICT}"/>
<arg line="-incremental=${INCREMENTAL}"/>
<arg
line="-link-report=${imagine_kiosk.release.build.dir}/${versionNumber}${debugPath}/report.xml"/>
 <arg line="-output
'${imagine_kiosk.release.build.dir}/${versionNumber}${debugPath}/${APP_NAME}.swf'"/>
<arg line="'${source}/${APP_NAME}.mxml'" />
</exec>
    </target>


On 11 September 2013 02:41, Frédéric THOMAS <we...@hotmail.com> wrote:

> I didn't try yet but I will have in a bit, because the I'm using workers
> and
> others to make the Apache Flex Installer faster, I would be very happy to
> know if someone had a successful builds with workers using Ant, let us know
> pls.
>
> -----Message d'origine-----
> De : Jesse Ward-Karet [mailto:jwk@tanium.com]
> Envoyé : mercredi 11 septembre 2013 00:12
> À : users
> Objet : Building workers with Ant
>
> How do you setup an Ant task to build and embed ActionScript Workers?
>
> When we develop locally, FlexBuilder takes care of building and embedding
> the worker for us. We just add the base ActionScript file (Worker.as) in
> the
> 'ActionScript Workers' section of the project properties and choose the
> 'embed' option.
>
> Our production build environment uses Ant to build from the command line
> using mxmlc. Here's an example from our current config:
>
>  <target name="debug">
>         <mxmlc file="${APP_ROOT}/Main.mxml" output="${OUT_ROOT}/Main.swf"
> incremental="false" debug="true" fork="true">
>             <load-config
> filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
>             <source-path path-element="${FLEX_HOME}/frameworks"/>
>             <compiler.source-path path-element="${LIB_ROOT}/src"/>
>             <compiler.source-path path-element="${basedir}/src" />
>             <compiler.library-path dir="${basedir}/libs" append="true">
>                 <include name="*.swc" />
>             </compiler.library-path>
>             <compiler.library-path dir="${basedir}/libs_ant" append="true">
>                 <include name="*.swc" />
>             </compiler.library-path>
>             <includes symbol="mx.managers.systemClasses.MarshallingSupport"
> />
>             <arg line="-swf-version=18" />
>             <arg line="-target-player=11.5" />
>         </mxmlc>
> </target>
>
>
> Thanks for any help!
> Jesse
>

RE: Building workers with Ant

Posted by Frédéric THOMAS <we...@hotmail.com>.
I didn't try yet but I will have in a bit, because the I'm using workers and
others to make the Apache Flex Installer faster, I would be very happy to
know if someone had a successful builds with workers using Ant, let us know
pls.

-----Message d'origine-----
De : Jesse Ward-Karet [mailto:jwk@tanium.com] 
Envoyé : mercredi 11 septembre 2013 00:12
À : users
Objet : Building workers with Ant

How do you setup an Ant task to build and embed ActionScript Workers?

When we develop locally, FlexBuilder takes care of building and embedding
the worker for us. We just add the base ActionScript file (Worker.as) in the
'ActionScript Workers' section of the project properties and choose the
'embed' option.

Our production build environment uses Ant to build from the command line
using mxmlc. Here's an example from our current config:

 <target name="debug"> 
        <mxmlc file="${APP_ROOT}/Main.mxml" output="${OUT_ROOT}/Main.swf"
incremental="false" debug="true" fork="true">
            <load-config
filename="${FLEX_HOME}/frameworks/flex-config.xml"/> 
            <source-path path-element="${FLEX_HOME}/frameworks"/> 
            <compiler.source-path path-element="${LIB_ROOT}/src"/> 
            <compiler.source-path path-element="${basedir}/src" />
            <compiler.library-path dir="${basedir}/libs" append="true">
                <include name="*.swc" />
            </compiler.library-path>
            <compiler.library-path dir="${basedir}/libs_ant" append="true">
                <include name="*.swc" />
            </compiler.library-path>
            <includes symbol="mx.managers.systemClasses.MarshallingSupport"
/>
            <arg line="-swf-version=18" />
            <arg line="-target-player=11.5" />
        </mxmlc> 
</target>


Thanks for any help!
Jesse