加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex Ant脚本模板

发布时间:2020-12-15 04:42:40 所属栏目:百科 来源:网络整理
导读:什么是?Flex Ant Tasks? Ant (Another Neat Tool) 是一种脚本编写工具,可以使用它为项目创建自动化构建流程。它起初是为 Java 项目创建的。它使用基于 XML 的语法列出脚本文件中的目标和依赖性,并用命令行调用脚本。 以下是示例任务的简要列表,您可以在



什么是?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 path
FLEX_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 folder
SRC_DIR =${basedir}/src

# points to the project's libs directory
LIBS_DIR =${basedir}/libs

# this is the folder we want to publish the swf to
DEPLOY_DIR = ${basedir}/DEPLOY

# defines the Flex framework files location
FLEX_FRAMEWORK = ${FLEX_HOME}/frameworks/libs

# this property defines the doc directory,which will store your created ASDocs later in the article
DOC_DIR =${basedir}/DOC

# defines the title for your ASDoc pages
DOC_TITLE ="Your doc title"

# defines the footer for your ASDoc pages
DOC_FOOTER = "Copyright 2010 My Company"

# points to your asdoc.exe for ASDoc creation later
asdoc.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 "compile flex ant tasks project" depends="init,compile flex project,build doc,copyRSLs,wrapper,createSWC" />	
	
	<!-- delete and recreate the DEPLOY and DOC dirs -->
	"init">
		delete dir="${DEPLOY_DIR}" />
		mkdir />	
		
		"${DOC_DIR}" />
	</target>

	<!-- ASDoc creation -->
	"build doc" exec executable="${asdoc.exe}" failonerror="true">
			arg line='-doc-sources ${SRC_DIR}' />
			'-external-library-path ${LIBS_DIR}' '-warn-level-not-supported=false''-main-title ${DOC_TITLE}' '-window-title ${DOC_TITLE}' '-footer ${DOC_FOOTER}' '-output ${DOC_DIR}' exec>
	>
	
	<!-- Build and output the Main.swf-->
	"compile flex project" mxmlc "${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>
			
			runtime-shared-library-path
				"${FLEX_FRAMEWORK}/framework.swc">
				url rsl-url="framework_4.1.0.16076.swf"/>
				"framework_4.1.0.16076.swz"runtime-shared-library-path>			
			
		mxmlc<!-- HTML Wrapper -->
	"wrapper">
        html-wrapper 
            title="Flex Ant Tasks Part II"
            "flext_ant_pt_II_tasks.html"
            height="500"
            width=bgcolor="#000000"
            application="Main"
            swf=version-major="9"
            minor="0"
            revision=history="true"
            "${DEPLOY_DIR}"<!-- create SWC -->
	"createSWC"compc 
	        "${DEPLOY_DIR}/MyComps.swc"
	        include-classes="com.pxldesigns.flexTasks.LabelBuilder""${SRC_DIR}"compc<!-- copy only the Flex Framework files into the DEPLOY_DIR to use for RSLs --> 	
	"copyRSLs"copy todir="${DEPLOY_DIR}" "${FLEX_HOME}/frameworks/rsls/framework_4.1.0.16076.swf""${FLEX_HOME}/frameworks/rsls/framework_4.1.0.16076.swz"/>		
	>	
project>

?

注:

1. flexTasks.jar文件在不同的SDK下是不同的,确保工程libs目录下的与{SDK}antlib下的相同。

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读