| <?xml version="1.0"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| |
| <project name="build_example" basedir="."> |
| |
| <condition property="ROYALE_COMPILER_HOME" value="${env.ROYALE_COMPILER_HOME}"> |
| <and> |
| <not> |
| <isset property="ROYALE_COMPILER_HOME" /> |
| </not> |
| <available file="${env.ROYALE_COMPILER_HOME}/lib/jsc.jar" type="file" /> |
| </and> |
| </condition> |
| |
| <condition property="ROYALE_COMPILER_HOME" value="${ROYALE_HOME}/js"> |
| <and> |
| <not> |
| <isset property="ROYALE_COMPILER_HOME" /> |
| </not> |
| <available file="${ROYALE_HOME}/js/lib/jsc.jar" type="file" /> |
| </and> |
| </condition> |
| |
| <condition property="ROYALE_COMPILER_HOME" value="${ROYALE_HOME}/../royale-compiler/compiler-jx"> |
| <and> |
| <not> |
| <isset property="ROYALE_COMPILER_HOME" /> |
| </not> |
| <available file="${ROYALE_HOME}/../royale-compiler/compiler-jx/lib/jsc.jar" type="file" /> |
| </and> |
| </condition> |
| |
| <condition property="GOOG_HOME" value="${env.GOOG_HOME}"> |
| <and> |
| <not> |
| <isset property="GOOG_HOME" /> |
| </not> |
| <available file="${env.GOOG_HOME}/closure/goog/base.js" type="file" /> |
| </and> |
| </condition> |
| |
| <condition property="GOOG_HOME" value="${ROYALE_HOME}/js/lib/google/closure-library"> |
| <and> |
| <not> |
| <isset property="GOOG_HOME" /> |
| </not> |
| <available file="${ROYALE_HOME}/js/lib/google/closure-library/closure/goog/base.js" type="file" /> |
| </and> |
| </condition> |
| |
| <condition property="adl" value="adl.exe"> |
| <os family="windows"/> |
| </condition> |
| |
| <condition property="adl" value="adl"> |
| <os family="mac"/> |
| </condition> |
| |
| <condition property="runtime" value="win"> |
| <os family="windows"/> |
| </condition> |
| |
| <condition property="runtime" value="mac"> |
| <os family="mac"/> |
| </condition> |
| |
| <property name="swf.version" value="14" /> |
| |
| <target name="get.browser" > |
| <condition property="browser" value="${env.ProgramFiles}/Mozilla Firefox/firefox.exe"> |
| <and> |
| <os family="windows"/> |
| <available file="${env.ProgramFiles}/Mozilla Firefox/firefox.exe" |
| type="file" /> |
| </and> |
| </condition> |
| <condition property="browser" value="${env.ProgramFiles(x86)}/Mozilla Firefox/firefox.exe"> |
| <and> |
| <os family="windows"/> |
| <available file="${env.ProgramFiles(x86)}/Mozilla Firefox/firefox.exe" |
| type="file" /> |
| </and> |
| </condition> |
| <condition property="browser" value="C:/Program Files/Internet Explorer/iexplore.exe"> |
| <and> |
| <os family="windows"/> |
| <available file="C:/Program Files/Internet Explorer/iexplore.exe" |
| type="file" /> |
| </and> |
| </condition> |
| <condition property="browser" value="/Applications/Firefox.app/Contents/MacOS/Firefox"> |
| <and> |
| <os family="mac"/> |
| <available file="/Applications/Firefox.app/Contents/MacOS/Firefox" |
| type="file" /> |
| </and> |
| </condition> |
| <condition property="browser" value="/Applications/Safari.app/Contents/MacOS/Safari"> |
| <and> |
| <os family="mac"/> |
| <available file="/Applications/Safari.app/Contents/MacOS/Safari" |
| type="file" /> |
| </and> |
| </condition> |
| <fail message="No browser found. See build_example.xml or set -Dbrowser=<path to browser>" |
| unless="browser"/> |
| </target> |
| |
| <path id="lib.path"> |
| <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> |
| <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="jsc.jar"/> |
| </path> |
| |
| |
| <target name="compile" description="Compiles ${example}"> |
| <echo message="Compiling ${example}.swf"/> |
| <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> |
| <echo message="ROYALE_COMPILER_HOME: ${ROYALE_COMPILER_HOME}"/> |
| <echo message="GOOG_HOME: ${GOOG_HOME}"/> |
| <condition property="srcDir" value="${basedir}/src" else="${basedir}/src/main/royale"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| <condition property="destDir" value="${basedir}/bin-debug" else="${basedir}/target/bin-debug"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| <condition property="jsDir" value="${basedir}" else="${basedir}/target/javascript"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| <available file="${srcDir}/../config/compile-app-config.xml" |
| type="file" |
| property="optional_arg" value="-load-config+="${srcDir}/../config/compile-app-config.xml"" /> |
| |
| <condition property="targets" value="SWF,JSRoyale" else="SWF"> |
| <not> |
| <isset property="no.js"/> |
| </not> |
| </condition> |
| |
| <condition property="wrapperTarget" value="build_example.wrapper" else="build_example.skipWrapper"> |
| <not> |
| <isset property="no.wrapper"/> |
| </not> |
| </condition> |
| <!-- Load the <compc> task. We can't do this at the <project> level --> |
| <!-- because targets that run before flexTasks.jar gets built would fail. --> |
| <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> |
| <property name="config_arg" value="royale" /> |
| <property name="file_suffix" value="mxml" /> |
| <property name="optional_arg" value="-define+=CONFIG::dummy,true" /> |
| <property name="debug" value="true" /> |
| <!-- this is a dummy var placeholder in case some example needs to define a theme |
| then they would set theme_arg=-theme=<path to theme> --> |
| <property name="theme_arg" value="-define+=CONFIG::theme,false" /> |
| <mxmlc fork="true" |
| debug="${debug}" |
| configname="${config_arg}" |
| swf-version="${swf.version}" |
| closure-lib="${GOOG_HOME}" |
| file="${srcDir}/${example}.${file_suffix}" |
| output="${destDir}/${example}.swf"> |
| <jvmarg line="${mxmlc.jvm.args}"/> |
| <arg line="${optional_arg}" /> |
| <arg value="${theme_arg}" /> |
| <arg value="-targets=${targets}" /> |
| <arg value="+playerglobal.version=${playerglobal.version}" /> |
| <arg value="-js-output=${jsDir}" /> |
| <!-- |
| <arg value="-js-library-path+=/Users/aharui/git/flex/master/flex-sdk/frameworks/locale/{locale}" /> |
| <arg value="-library-path+=/Users/aharui/git/flex/master/flex-sdk/frameworks/locale/{locale}" /> |
| --> |
| </mxmlc> |
| |
| <antcall target="${wrapperTarget}"> |
| <param name="output" value="${destDir}"/> |
| <param name="templatebase" value="${html_template_base}"/> |
| </antcall> |
| |
| <copy todir="${destDir}"> |
| <fileset dir="${srcDir}"> |
| <include name="**/*.png" /> |
| <include name="**/*.jpg" /> |
| </fileset> |
| </copy> |
| <copy todir="${destDir}/fonts"> |
| <fileset dir="${ROYALE_HOME}/frameworks/fonts"> |
| <include name="**/*.swf" /> |
| </fileset> |
| </copy> |
| |
| <!--<antcall target="build_example.compile-js-release"/>--> |
| <antcall target="build_example.copy-app-xml" /> |
| </target> |
| |
| <target name="compileair" description="Compiles ${example}"> |
| <echo message="Compiling ${example}.swf"/> |
| <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> |
| <condition property="srcDir" value="${basedir}/src" else="${basedir}/src/main/royale"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| <condition property="destDir" value="${basedir}/bin-debug" else="${basedir}/target/bin-debug"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| |
| <!-- Load the <compc> task. We can't do this at the <project> level --> |
| <!-- because targets that run before flexTasks.jar gets built would fail. --> |
| <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> |
| <property name="theme_arg" value="-define=CONFIG::theme,false" /> |
| <mxmlc fork="true" |
| file="${srcDir}/${example}.mxml" |
| output="${destDir}/${example}.swf"> |
| <jvmarg line="${mxmlc.jvm.args}"/> |
| <arg value="+royalelib=${basedir}/frameworks" /> |
| <arg value="+configname=air" /> |
| <arg value="-debug" /> |
| <arg value="${theme_arg}" /> |
| <arg value="-target-player=${playerglobal.version}" /> |
| <arg value="-swf-version=${swfVersion}" /> |
| <arg value="-compiler.mxml.children-as-data" /> |
| <arg value="-compiler.binding-value-change-event=org.apache.royale.events.ValueChangeEvent" /> |
| <arg value="-compiler.binding-value-change-event-kind=org.apache.royale.events.ValueChangeEvent" /> |
| <arg value="-compiler.binding-value-change-event-type=valueChange" /> |
| <arg value="-compiler.binding-event-handler-interface=org.apache.royale.events.IEventDispatcher" /> |
| <arg value="-compiler.binding-event-handler-class=org.apache.royale.events.EventDispatcher" /> |
| <arg value="-compiler.binding-event-handler-event=org.apache.royale.events.Event" /> |
| <arg value="+playerglobal.version=${playerglobal.version}" /> |
| <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" /> |
| <arg value="-closure-lib=${GOOG_HOME}" /> |
| </mxmlc> |
| |
| <copy todir="${destDir}"> |
| <fileset dir="${srcDir}"> |
| <include name="*.png" /> |
| </fileset> |
| </copy> |
| <copy todir="${destDir}"> |
| <fileset dir="${srcDir}"> |
| <include name="*-app.xml" /> |
| </fileset> |
| </copy> |
| </target> |
| |
| <target name="compileas" description="Compiles ${example}"> |
| <echo message="Compiling ${example}.swf"/> |
| <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> |
| <condition property="srcDir" value="${basedir}/src" else="${basedir}/src/main/royale"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| <condition property="destDir" value="${basedir}/bin-debug" else="${basedir}/target/bin-debug"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| <!-- Load the <compc> task. We can't do this at the <project> level --> |
| <!-- because targets that run before flexTasks.jar gets built would fail. --> |
| <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> |
| <property name="theme_arg" value="-define=CONFIG::theme,false" /> |
| <mxmlc fork="true" |
| file="${srcDir}/${example}.as" |
| output="${destDir}/${example}.swf"> |
| <jvmarg line="${mxmlc.jvm.args}"/> |
| <arg value="+royalelib=${basedir}/frameworks" /> |
| <arg value="-debug" /> |
| <arg value="${theme_arg}" /> |
| <arg value="-define=CONFIG::as_only,true" /> |
| <arg value="-define=CONFIG::js_only,false" /> |
| <arg value="-compiler.mxml.children-as-data" /> |
| <arg value="-compiler.binding-value-change-event=org.apache.royale.events.ValueChangeEvent" /> |
| <arg value="-compiler.binding-value-change-event-kind=org.apache.royale.events.ValueChangeEvent" /> |
| <arg value="-compiler.binding-value-change-event-type=valueChange" /> |
| <arg value="-compiler.binding-event-handler-interface=org.apache.royale.events.IEventDispatcher" /> |
| <arg value="-compiler.binding-event-handler-class=org.apache.royale.events.EventDispatcher" /> |
| <arg value="-compiler.binding-event-handler-event=org.apache.royale.events.Event" /> |
| <arg value="+playerglobal.version=${playerglobal.version}" /> |
| <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" /> |
| <arg value="-closure-lib=${GOOG_HOME}" /> |
| </mxmlc> |
| |
| <antcall target="build_example.wrapper"> |
| <param name="output" value="${destDir}"/> |
| <param name="templatebase" value="${html_template_base}"/> |
| </antcall> |
| </target> |
| |
| |
| <target name="compile-js-release" unless="no.js"> |
| <echo message="Compiling ${example}.js"/> |
| <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> |
| <echo message="ROYALE_COMPILER_HOME: ${ROYALE_COMPILER_HOME}"/> |
| <echo message="GOOG_HOME: ${GOOG_HOME}"/> |
| <property name="js.release.target" value="JSRoyale" /> |
| <property name="extlib_arg" value="-define=CONFIG::extlib,false" /> |
| <condition property="srcDir" value="${basedir}/src" else="${basedir}/src/main/royale"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| <condition property="destDir" value="${basedir}" else="${basedir}/target"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| <condition property="jsDir" value="${basedir}" else="${basedir}/target/javascript"> |
| <not> |
| <isset property="maven_compat"/> |
| </not> |
| </condition> |
| <mxmlc fork="true" |
| debug="false" |
| configname="${config_arg}" |
| swf-version="${swf.version}" |
| closure-lib="${GOOG_HOME}" |
| file="${srcDir}/${example}.${file_suffix}"> |
| <jvmarg line="${mxmlc.jvm.args}"/> |
| <arg line="${optional_arg}" /> |
| <arg value="${theme_arg}" /> |
| <arg value="${extlib_arg}" /> |
| <arg value="-define+=COMPILE::SWF,false" /> |
| <arg value="-define+=COMPILE::JS,true" /> |
| <arg value="-targets=${js.release.target}" /> |
| <arg value="+playerglobal.version=${playerglobal.version}" /> |
| <arg value="-js-output=${jsDir}" /> |
| </mxmlc> |
| </target> |
| |
| <target name="check-air"> |
| <condition property="is.air" value="true"> |
| <equals arg1="${config_arg}" arg2="air" /> |
| </condition> |
| </target> |
| |
| <target name="skipWrapper"> |
| <echo>Wrapper build was skipped</echo> |
| </target> |
| |
| <target name="wrapper" depends="check-air" unless="is.air"> |
| <property name="output" value="${basedir}/bin-debug"/> |
| <property name="templatebase" value="${ROYALE_HOME}/templates"/> |
| <echo>creating html-wrapper from ${templatebase}</echo> |
| <html-wrapper |
| height="100%" |
| width="100%" |
| bgcolor="#ffffff" |
| name="${example}" |
| versionmajor="11" |
| versionminor="5" |
| versionrevision="0" |
| templatebase="${templatebase}" |
| output="${output}"/> |
| </target> |
| |
| <target name="copy-app-xml" depends="check-air" if="is.air"> |
| <copy toDir="${basedir}/bin-debug" file="${basedir}/${example}-app.xml" /> |
| <copy toDir="${basedir}/bin-release" file="${basedir}/${example}-app.xml" /> |
| </target> |
| |
| <property name="html_template_base" value="${ROYALE_HOME}/templates" /> |
| <macrodef name="html-wrapper"> |
| <attribute name="width"/> |
| <attribute name="height"/> |
| <attribute name="bgcolor"/> |
| <attribute name="name"/> |
| <attribute name="versionmajor"/> |
| <attribute name="versionminor"/> |
| <attribute name="versionrevision"/> |
| <attribute name="output"/> |
| <attribute name="templatebase" default="${html_template_base}"/> |
| <sequential> |
| <copy toFile="@{output}/@{name}.html" |
| file="@{templatebase}/swfobject/index.template.html" /> |
| <copy toDir="@{output}/history"> |
| <fileset dir="@{templatebase}/swfobject/history"> |
| <include name="**"/> |
| </fileset> |
| </copy> |
| <copy toDir="@{output}"> |
| <fileset dir="@{templatebase}/swfobject"> |
| <include name="*"/> |
| <exclude name="index.template.html"/> |
| </fileset> |
| </copy> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${title}" |
| value="@{name}"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${bgcolor}" |
| value="@{bgcolor}"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${useBrowserHistory}" |
| value="--"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${version_major}" |
| value="@{versionmajor}"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${version_minor}" |
| value="@{versionminor}"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${version_revision}" |
| value="@{versionrevision}"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${expressInstallSwf}" |
| value="expressInstall.swf"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${expressInstallSwf}" |
| value="expressInstall.swf"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${width}" |
| value="@{width}"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${height}" |
| value="@{height}"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${application}" |
| value="@{name}"/> |
| </replace> |
| <replace file="@{output}/@{name}.html"> |
| <replacefilter |
| token="$${swf}" |
| value="@{name}"/> |
| </replace> |
| </sequential> |
| </macrodef> |
| |
| <target name="check-resources" > |
| <available file="${basedir}/src/main/resources" |
| type="dir" |
| property="has-resources"/> |
| </target> |
| |
| <target name="copy-resources" depends="check-resources" if="has-resources"> |
| <copy todir="${basedir}/bin-debug"> |
| <fileset dir="${basedir}/src/main/resources"> |
| <include name="**/*.png" /> |
| <include name="**/*.jpg" /> |
| <include name="**/*.json" /> |
| </fileset> |
| </copy> |
| </target> |
| |
| <target name="copy-js-resources" depends="check-resources" if="has-resources"> |
| <mkdir dir="${basedir}/bin/js-debug/assets" /> |
| <copy todir="${basedir}/bin/js-debug/assets" > |
| <fileset dir="${basedir}/src/main/resources/assets"> |
| <include name="**" /> |
| </fileset> |
| </copy> |
| <mkdir dir="${basedir}/bin/js-release/assets" /> |
| <copy todir="${basedir}/bin/js-release/assets" > |
| <fileset dir="${basedir}/src/main/resources/assets"> |
| <include name="**" /> |
| </fileset> |
| </copy> |
| </target> |
| |
| <target name="run.air"> |
| <property name="profile" value="mobileDevice" /> |
| <property name="screensize" value="640x960:640x960" /> |
| <property name="dpi" value="240" /> |
| <property name="platform" value="AND" /> |
| <exec executable="${AIR_HOME}/bin/${adl}" dir="${basedir}/bin-${which}" failonerror="true"> |
| <arg value="-runtime" /> |
| <arg value="${AIR_HOME}/runtimes/air/${runtime}" /> |
| <arg value="-profile" /> |
| <arg value="${profile}" /> |
| <arg value="-screensize" /> |
| <arg value="${screensize}" /> |
| <arg value="-XscreenDPI" /> |
| <arg value="${dpi}" /> |
| <arg value="-XversionPlatform" /> |
| <arg value="${platform}" /> |
| <arg value="${basedir}/bin-${which}/${example}-app.xml" /> |
| </exec> |
| </target> |
| |
| <target name="run.air.desktop"> |
| <property name="profile" value="extendedDesktop" /> |
| <property name="screensize" value="640x960:640x960" /> |
| <property name="dpi" value="240" /> |
| <property name="platform" value="AND" /> |
| <exec executable="${AIR_HOME}/bin/${adl}" dir="${basedir}/bin-${which}" failonerror="true"> |
| <arg value="-runtime" /> |
| <arg value="${AIR_HOME}/runtimes/air/${runtime}" /> |
| <arg value="-profile" /> |
| <arg value="${profile}" /> |
| <arg value="${basedir}/bin-${which}/${example}-app.xml" /> |
| </exec> |
| </target> |
| |
| <target name="compile.cordova" description="Executes the Cordova build script to run the app on a device." if="has.cordova"> |
| <property name="mobile.platform" value="android" /> |
| <ant antfile="${ROYALE_HOME}/cordova-build.xml" target="main" > |
| <property name="projectdir" value="${basedir}" /> |
| </ant> |
| <ant antfile="${ROYALE_HOME}/cordova-build.xml" target="load-platform.${mobile.platform}" > |
| <property name="projectdir" value="${basedir}" /> |
| </ant> |
| </target> |
| |
| <target name="run.cordova" description="Executes the Cordova build script to run the app on a device." if="has.cordova"> |
| <property name="mobile.platform" value="android" /> |
| <ant antfile="${ROYALE_HOME}/cordova-build.xml" target="run.${mobile.platform}" > |
| <property name="projectdir" value="${basedir}" /> |
| </ant> |
| </target> |
| </project> |