Mike Chambers

code = joy

Example : Using ANT with COMPC to compile SWCs

with 9 comments

Following up on my previous post on how to use compc to compile SWCs, here is an ANT build file that calls compc to compile a SWC:

<?xml version="1.0" ?>
<project default="main">
	<property name="base" value="../" />
	<property name="componentName" value="MyWindow" />
	<property name="swcFile" value="${componentName}.swc" />
	<property name="manifest" value="${base}manifest.xml" />
	<property name="namespace" value="http://www.adobe.com/2006/foo" />

	<available property="swc.exists" file="${swcFile}"/>
	
	<target name="main" depends="init, compile">
	</target>
	
	<target name="init" if="swc.exists">
		<delete file="${swcFile}" />
	</target>

	<target name="compile" description="Compile SWC.">
		<echo>Building ${swcFile}</echo>
		<exec dir="." executable="cmd" failonerror="true">
		    <arg line="/c compc -namespace ${namespace} ${manifest} 
		        -source-path ${base}
		    	-include-namespaces ${namespace} -include-classes mx.containers.MyWindow
		    	-include-file MyWindow.png ${base}mx/containers/MyWindow.png 
				-output='${swcFile}'"/>
		</exec>        
	</target>
	
</project>

Put this in a file called build.xml, and run ant in the same directory.

Written by mikechambers

May 19th, 2006 at 11:46 am

Posted in General

9 Responses to 'Example : Using ANT with COMPC to compile SWCs'

Subscribe to comments with RSS

  1. Cool thanks! I will try this later!

  2. Cool Mike!

    This kind of info is very needed to many people that wants to start using flex, but don’t want to invest in the IDE or FDS2 at the moment, but sure that, as they’ll introduce the technology in their clients and business, they’ll go to productivity tools.

    Carlos Rovira

    20 May 06 at 9:24 am

  3. Hi,

    Can you please provide ant script for compiling a swf file using COMPC.

    Thanks

    Regards
    Elango

    Elango

    24 May 06 at 5:18 am

  4. Hi,

    by the way, what happens to FlashCommand? Does it also work with Flash8? Because it would be nice to have some ant capability there too.

    Sven Busse

    28 May 06 at 2:36 am

  5. FlashCommand works with Flash 8. I have been using it lately and infact, I found a issue and fixed it.

    I have also added some functionality in FlashCommand, I would release in sometime if Mike gives me permission to release it, since it his code :)

    Mike, this ANT script can be more generic to compile SWC for different class, you just need to use user.properties file or make params more generic.

    -abdul

    Abdul Qabiz

    6 Jun 06 at 9:15 pm

  6. Abdul, which issue did you fix? We’re looking at a massive export of files and wondering if there is going to be a gotcha. Is there a newer version of FlashCommand (newer than .85) somewhere out there?

    Derin Zerr

    14 Sep 06 at 2:43 pm

  7. Is there a chance you could create a test mxml component to go with this? I keep running into errors when I try to get this to work with my component.

    judah

    25 Feb 07 at 5:25 pm

  8. @Judah what errors are you getting? I was able to run what he had fine — the only thing Mike didn’t mention is that you need to add your Flex SDK bin directory to your windows path in Environment Variables.

    Nick

    7 Oct 08 at 9:22 pm

  9. Hi Guys,

    I am getting the below error. Please help

    Error:
    ‘compc’ is not recognized as an internal or external command,

    Below is my build.xml file

    Compiling ${swcFile}

    Vijay

    30 Dec 09 at 2:03 am

Leave a Reply

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: