Reputation: 5151
I don't know much about ant and I'm having trouble finding an example where I just copy a swf after it is compiled in flashbuilder. I'm working with a very small swf and I have it set to "build automatically" since the compile time is < .5 sec.
I'd like to shorten the length of my test cycles and I'm hoping to automate moving a file to a folder so I can test the swf in my application. I only need the file moved when built since that folder auto-uploads anything added to it. What's the path of least resistance to this automated copy using ant-build.xml? Is this a simple process or is there a lot of overhead to make this work? (This is a pure actionscript project imported into a larger application, not flex). Is this even possible with pure as?
Upvotes: 1
Views: 779
Reputation: 1614
Since you have a pure AS project, and you're using Flash Builder to build the SWF, all you need to copy the output is a very minimal build.xml, such as:
<?xml version="1.0" encoding="utf-8"?>
<project name="Builder" basedir="." default="build">
<target name="export-debug">
<copy file="bin-debug/MyFlash.swf" todir="C:/my/test/path" />
</target>
<target name="build" depends="export-debug" />
</project>
Change the pathnames as needed and save in the root of your project as build.xml. Now go to Project -> Properties -> Builders -> New..., select "Ant Builder", and Browse Workspace to your build.xml.
Now go to the "Targets" tab and configure both the Manual Build and Auto Build to point to the "export-debug" target.
Now you should have two builders, the built-in compiler, and this Ant target. Whenever the SWF compiles, it will also be copied to the path you specified.
Upvotes: 1
Reputation: 511
This is a very simple build.xml for Ant, which compiles your MXML application and copies the SWF to a specific folder. Put it into your projects' root folder and replace bin-release
with your desired export folder. Also adjust the path to your Flex SDK as well as to flexTasks.jar
and Application.mxml
.
<?xml version="1.0" encoding="utf-8"?>
<project name="Builder" basedir="." default="build">
<target name="init">
<property name="FLEX_HOME" value="C:/Program Files/Adobe/Adobe Flash Builder 4.6/sdks/4.6.0" />
<taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasks.jar" />
</target>
<target name="compile">
<mxmlc file="${basedir}/src/Application.mxml"
output="app.swf"
keep-generated-actionscript="false"
optimize="true">
<source-path path-element="${basedir}/src" />
</mxmlc>
</target>
<target name="export">
<copy file="app.swf" todir="bin-release" />
</target>
<target name="build" depends="init, compile, export" />
You can run this build.xml automatically if you add an Ant builder under Project properties
- Builders
.
Upvotes: 2