For those that do not know what compc is, it is a flex component compiler, it generates a .swc file that can be used as a library in your Flex application.
I was doing some blog reading today and came across someone talking about ANT and Flex specifically compc. I have had my own issues with the Flex Ant tasks in the past one of them is the way compc makes you list out the files. I thought this was a bit strange that I could not just pass in a path to the source files and have it pick them up. So after some surfing around and thinking I was able to come up with this. It looks at the directory you provide and includes/excludes any files you would like in property. This property is used as an input to the include-classes attribute of the compc command.
1: <target name="_resolve-class-path" depends="clean">
2: <path id="list_1">
3: <fileset dir="${flex-src.dir}">
4: <include name="**/**"/>
5: <exclude name="**/**.bak"/>
6: </fileset>
7: </path>
8: <pathconvert property="project_classes_property" pathsep=" " dirsep="." refid="list_1">
9: <map from="${basedir}\src\" to=""/>
10: <mapper>
11: <chainedmapper>
12: <globmapper from="*.as" to="*"/>
13: </chainedmapper>
14: <chainedmapper>
15: <globmapper from="*.mxml" to="*"/>
16: </chainedmapper>
17: </mapper>
18: </pathconvert>
19: </target>
and my compc looks like this now
<compc output="${basedir}/util.swc" include-classes="${project_classes_property}">
I can not take full credit it for it but thought I would pass it along to others.
No comments:
Post a Comment