编译swc文件的Ant脚本

一个简单的例子:

<?xml version="1.0"?>

<project name="" default="main" basedir=".">

	<property name="FLEX_HOME" value="D:/Flash/FlexSDK3" />
	<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />

	<path id="src.files">
		<fileset dir="./src">
			<include name="**/*.as" />
			<exclude name="Main.as" />
			<exclude name="**/*Test.as" />
		</fileset>
	</path>

    <target name="main">
		<echo message="Build Start" />

		<pathconvert property="src.swcFiles" pathsep=" " dirsep="." refid="src.files" >
			<map from="\" to="/" />
			<map from="${basedir}/src/" to="" />
			<mapper>
				<chainedmapper>
					<globmapper from="*.as" to="*" />
				</chainedmapper>
			</mapper>
		</pathconvert>

		<echo message="${src.swcFiles}" />

		<compc output="./dew.swc" include-classes="${src.swcFiles}">
			<external-library-path dir="./lib" append="true">
				<include name="**/*.swc" />
			</external-library-path>
			<source-path path-element="./src" />
		</compc>

	</target>

</project>


关键的地方是用pathconvert对文件名进行了转换~

你可能感兴趣的:(xml,ant,脚本)