Flex AIR ANT 脚本编译

导出Flex工程配置:-dump-config config.xml



build.properties

FLEX_HOME=D:/Program Files (x86)/Adobe/Adobe Flash Builder 4.6/sdks/4.6.0
SRC_DIR=D:/workspace_ant/TestAir/src
LIB_DIRS=D:/workspace_ant/TestAir/libs
DEPLOY_DIR=D:/workspace_ant/TestAir/deployDir
DEBUG = false
OPTIMIZE = true
LOCALE = zh_CN,en_US
AIR_LIBS=D:/Program Files (x86)/Adobe/Adobe Flash Builder 4.6/sdks/4.6.0/frameworks/libs/air
FLEX_LIBS=D:/Program Files (x86)/Adobe/Adobe Flash Builder 4.6/sdks/4.6.0/frameworks/libs
DEPLOY_TEST=D:/workspace_ant/TestAir/Test
DEPLOY_TEST=D:/workspace_ant/TestAir/Test
SDK_VERSION=4.6.0.23201

build.xml

<project name="Flex Ant Tasks Build Script" default="compile">

    <!-- Load the environment-specific properties -->
    <property file="build.properties" />

    <!-- Sets the FlexTasks.jar file that contains the build tasks -->
    <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/> 

    <!-- Start off by recreating the deployment directory -->
    <target name="init">
        <delete dir="${DEPLOY_DIR}" />
        <mkdir dir="${DEPLOY_DIR}" />
    </target>

    <!-- Build and output the main SWF file - repeat this for each SWF in the solution -->
    <target name="compile" depends="init">
        <mxmlc  file="${SRC_DIR}/TestAir.mxml"
                output="${DEPLOY_TEST}/TestAir.swf"
                debug="${DEBUG}"
                optimize="${OPTIMIZE}"
                locale="${LOCALE}"
                configname="air"
				verify-digests="false"
				fork="true"
				static-rsls="false"
				remove-unused-rsls="false"
				accessible="true"
				as3="true"
				strict="true"
				verbose-stacktraces="false">
            <load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>
            <source-path path-element="${SRC_DIR}"/>
			<theme file="${FLEX_HOME}/frameworks/themes/Spark/spark.css" />
            
            <library-path dir="${FLEX_HOME}/frameworks/locale" includes="${LOCALE}" append="true"/>
			<!-- <library-path dir="${LIB_DIRS}" includes="*.swc" append="true"/>
			<library-path dir="${FLEX_HOME}/frameworks/libs" includes="*.swc" append="true"/>
            <library-path dir="${FLEX_HOME}/frameworks/libs/air" includes="*.swc" append="true"/>-->


			<!--  Framework Library  Merge Code -->
			<library-path dir="${AIR_LIBS}" includes="applicationupdater.swc" append="true"/>
			<library-path dir="${AIR_LIBS}" includes="servicemonitor.swc" append="true"/>
			<library-path dir="${AIR_LIBS}" includes="aircore.swc" append="true"/>
			<library-path dir="${AIR_LIBS}" includes="applicationupdater_ui.swc" append="true"/>
			<library-path dir="${FLEX_LIBS}" includes="flash-integration.swc" append="true"/>
			<library-path dir="${FLEX_LIBS}" includes="authoringsupport.swc" append="true"/>
			

			<external-library-path dir="${AIR_LIBS}" includes="airglobal.swc" append="true"/>
			<!--  Framework Library  RSL
			<external-library-path dir="${AIR_LIBS}" includes="airframework.swc" append="true"/>
			<external-library-path dir="${AIR_LIBS}" includes="airspark.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}" includes="advancedgrids.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}" includes="charts.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}" includes="framework.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}" includes="osmf.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}" includes="rpc.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}" includes="spark.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}" includes="spark_dmv.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}" includes="sparkskins.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}" includes="textLayout.swc" append="true"/>
			<external-library-path dir="${FLEX_LIBS}/mx" includes="mx.swc" append="true"/>-->
			

			<!-- Custom Library 
			<external-library-path dir="${LIB_DIRS}" includes="*.swc" append="true"/>-->

			
			
			<!-- Air Framework Library  RSL -->
			<runtime-shared-library-path path-element="${FLEX_LIBS}/osmf.swc">
				<url rsl-url="osmf_1.0.0.16316.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${FLEX_LIBS}/textLayout.swc">
				<url rsl-url="textLayout_2.0.0.232.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${FLEX_LIBS}/framework.swc">
				<url rsl-url="framework_4.6.0.23201.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${FLEX_LIBS}/rpc.swc">
				<url rsl-url="rpc_4.6.0.23201.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${FLEX_LIBS}/mx/mx.swc">
				<url rsl-url="mx_4.6.0.23201.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${FLEX_LIBS}/charts.swc">
				<url rsl-url="charts_4.6.0.23201.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${FLEX_LIBS}/advancedgrids.swc">
				<url rsl-url="advancedgrids_4.6.0.23201.swf"/>
			</runtime-shared-library-path>
			<!-- RSL 还有顺序-->
			<runtime-shared-library-path path-element="${FLEX_LIBS}/spark.swc">
				<url rsl-url="spark_4.6.0.23201.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${AIR_LIBS}/airframework.swc">
				<url rsl-url="airframework.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${AIR_LIBS}/airspark.swc">
				<url rsl-url="airspark.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${FLEX_LIBS}/sparkskins.swc">
				<url rsl-url="sparkskins_4.6.0.23201.swf"/>
			</runtime-shared-library-path>
			<runtime-shared-library-path path-element="${FLEX_LIBS}/spark_dmv.swc">
				<url rsl-url="spark_dmv_4.6.0.23201.swf"/>
			</runtime-shared-library-path>
			
			<!-- Custom Library RSL-->
			<runtime-shared-library-path path-element="${LIB_DIRS}/UILib.swc">
				<url rsl-url="libs/UILib.swf"/>
			</runtime-shared-library-path>

			<runtime-shared-library-settings.force-rsls file="${AIR_LIBS}/airframework.swc"/>
			<runtime-shared-library-settings.force-rsls file="${AIR_LIBS}/airspark.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/textLayout.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/spark.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/sparkskins.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/rpc.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/charts.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/spark_dmv.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/osmf.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/mx/mx.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/advancedgrids.swc"/>
			<runtime-shared-library-settings.force-rsls file="${FLEX_LIBS}/framework.swc.swc"/>
			<runtime-shared-library-settings.force-rsls file="${LIB_DIRS}/UILib.swc"/>

			<!--<runtime-shared-library-settings.application-domain path-element="${AIR_LIBS}/airframework.swc" application-domain-target="default"/>-->
        </mxmlc>
    </target>

    <!-- Now create the AIR package using the ADT utility -->
    <target name="air" description="Create the AIR package" depends="compile">
        <exec executable="${FLEX_HOME}/bin/adt.bat" failonerror="true">
            <arg line="-package" />
            <arg line="-tsa none" />
            <arg line="-storetype pkcs12" />
            <arg line="-keystore ${basedir}/keys/AntExample.p12" />
            <arg line="-storepass password" />
            <arg line="${DEPLOY_DIR}/AntExample.air" />
            <arg line="${SRC_DIR}/AntExample-app.xml" />
            <arg line="-C ${DEPLOY_DIR} AntExample.swf" />
        </exec>
    </target>

</project>


你可能感兴趣的:(Flex AIR ANT 脚本编译)