Flex Ant脚本模板
来源:互联网 发布:对胡和温的评价知乎 编辑:程序博客网 时间:2024/05/16 14:05
什么是 Flex Ant Tasks?
Ant (Another Neat Tool) 是一种脚本编写工具,可以使用它为项目创建自动化构建流程。它起初是为 Java 项目创建的。它使用基于 XML 的语法列出脚本文件中的目标和依赖性,并用命令行调用脚本。
以下是示例任务的简要列表,您可以在您的项目中使用此ANT脚本模板实现构建流程自动化:
1. 编译 Flex 应用程序、模块和组件库
2. 使用和部署 RSL
3. 使用 ASDoc 创建项目文档
4. 为项目的输出 SWF 文件创建 HTML 打包程序
Flex Ant Tasks 包括 mxmlc 和 compc 编译器任务,它们扩展了 Java Ant Tasks。因此,您可以根据需要使用 Java Ant Tasks 的任何可用属性。
脚本模板:
build.properties文件:
# change this to your Flex SDK directory pathFLEX_HOME= D:/Program Files/Adobe Flash Builder 4/sdks/4.1.0# this points to your project's src directory# {$basedir} is a default variable that can be used in any Ant script# and it points to the project's root folderSRC_DIR =${basedir}/src# points to the project's libs directoryLIBS_DIR =${basedir}/libs# this is the folder we want to publish the swf toDEPLOY_DIR = ${basedir}/DEPLOY# defines the Flex framework files locationFLEX_FRAMEWORK = ${FLEX_HOME}/frameworks/libs# this property defines the doc directory, which will store your created ASDocs later in the articleDOC_DIR =${basedir}/DOC# defines the title for your ASDoc pagesDOC_TITLE ="Your doc title"# defines the footer for your ASDoc pagesDOC_FOOTER = "Copyright 2010 My Company"# points to your asdoc.exe for ASDoc creation laterasdoc.exe =${FLEX_HOME}/bin/asdoc.exe
注:asdoc.exe在不同操作系统下值不同,在Flash和AIR程序下值也不同
如Windows下的AIR程序时,其值为aasdoc.bat
build.xml文件:
<project name="Flex Ant Tasks Build Script" default="compile flex ant tasks project"> <!-- load previously defined configuration properties file --><property file="build.properties" /><!-- points to our flexTasks.jar we copied to the libs folder to distribute with the project --><taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasks.jar"/> <target name="compile flex ant tasks project" depends="init, compile flex project, build doc, copyRSLs, wrapper, createSWC" /><!-- delete and recreate the DEPLOY and DOC dirs --><target name="init"><delete dir="${DEPLOY_DIR}" /><mkdir dir="${DEPLOY_DIR}" /><delete dir="${DOC_DIR}" /><mkdir dir="${DOC_DIR}" /></target><!-- ASDoc creation --><target name="build doc" depends="init"><exec executable="${asdoc.exe}" failonerror="true"><arg line='-doc-sources ${SRC_DIR}' /><arg line='-external-library-path ${LIBS_DIR}' /><arg line='-warn-level-not-supported=false'/><arg line='-main-title ${DOC_TITLE}' /><arg line='-window-title ${DOC_TITLE}' /><arg line='-footer ${DOC_FOOTER}' /><arg line='-output ${DOC_DIR}' /></exec></target><!-- Build and output the Main.swf--><target name="compile flex project" depends="init"><mxmlc file="${SRC_DIR}/Main.mxml" output="${DEPLOY_DIR}/Main.swf"> <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/> <source-path path-element="${FLEX_HOME}/frameworks"/><compiler.debug>false</compiler.debug><runtime-shared-library-pathpath-element="${FLEX_FRAMEWORK}/framework.swc"><url rsl-url="framework_4.1.0.16076.swf"/><url rsl-url="framework_4.1.0.16076.swz"/></runtime-shared-library-path></mxmlc></target><!-- HTML Wrapper --><target name="wrapper"> <html-wrapper title="Flex Ant Tasks Part II" file="flext_ant_pt_II_tasks.html" height="500" width="500" bgcolor="#000000" application="Main" swf="Main" version-major="9" version-minor="0" version-revision="0" history="true" output="${DEPLOY_DIR}"/></target><!-- create SWC --><target name="createSWC"><compc output="${DEPLOY_DIR}/MyComps.swc" include-classes="com.pxldesigns.flexTasks.LabelBuilder"> <source-path path-element="${SRC_DIR}"/></compc></target><!-- copy only the Flex Framework files into the DEPLOY_DIR to use for RSLs --> <target name="copyRSLs"><copy todir="${DEPLOY_DIR}" file="${FLEX_HOME}/frameworks/rsls/framework_4.1.0.16076.swf"/><copy todir="${DEPLOY_DIR}" file="${FLEX_HOME}/frameworks/rsls/framework_4.1.0.16076.swz"/></target></project>
注:
1. flexTasks.jar文件在不同的SDK下是不同的,确保工程libs目录下的与{SDK}\ant\lib下的相同。
2. CopyRSLs Task在不同的SDK下,其copy的文件是不同的。另外CopyRSLs Task copy的文件应与compile flex project task下的保持一致。
作者:God bless you
出处:http://www.cnblogs.com/god_bless_you/
本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
转载地址:http://www.cnblogs.com/god_bless_you/archive/2010/07/24/1784114.html
- Flex Ant脚本模板
- Flex Ant编译模板
- ant脚本通用模板
- Ant脚本模板,仅供参考
- Flex AIR ANT 脚本编译
- ANT脚本的一个模板
- Flex项目ant编译脚本初探
- Flex项目ant脚本编译示例
- Flex项目ant编译脚本初探
- Ant 编译、打包 build.xml 脚本模板
- Ant的build.xml脚本模板
- 使用 Flex Ant Tasks 构建 Flex 项目-第 I 部分:为 Flex 创建构建脚本
- 编译java web工程的ant脚本模板
- 批量编译Flex应用和模块的ant脚本 batch compile the mutiple flex source files
- Ant模板
- Ant脚本
- ant脚本
- ant脚本
- 结构
- 一个写log的函数 log_func.c .
- VMware安装RedHat Linux 9.0上网详细设置
- MySQL主从复制与读写分离
- 在Windows控制台里画一个时钟
- Flex Ant脚本模板
- 做不成情侣,也别做朋友:陈思念原创伤感日志
- javascript模板添加nodejs支持
- ORA-12516: TNS:listener could not find available handler with matching protocol stack
- CentOS 下安装php zookeeper扩展
- 类型生命周期(一)
- sphinx+mysql+中文分词安装
- linux下安装配置intel的tbb
- 她的爱情故事,你看了会哭嚒