| <?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="opentypejs" default="main" basedir="."> |
| <property name="ROYALE_HOME" location="/RoyaleSDK/RoyaleNightly"/> |
| <!--<property name="ROYALE_HOME" location="{env.ROYALE_HOME}"/>--> |
| |
| <property file="${ROYALE_HOME}/env.properties"/> |
| <property environment="env"/> |
| <property file="${ROYALE_HOME}/build.properties"/> |
| <property name="ROYALE_HOME" value="${ROYALE_HOME}"/> |
| |
| <property name="target.name" value="${ant.project.name}.swc" /> |
| <condition property="ROYALE_SWF_COMPILER_HOME" value="${env.ROYALE_SWF_COMPILER_HOME}"> |
| <and> |
| <not> |
| <isset property="ROYALE_SWF_COMPILER_HOME" /> |
| </not> |
| <available file="${env.ROYALE_SWF_COMPILER_HOME}/lib/compiler-mxmlc.jar" type="file" /> |
| </and> |
| </condition> |
| <condition property="ROYALE_SWF_COMPILER_HOME" value="${ROYALE_HOME}/../royale-compiler/compiler"> |
| <and> |
| <not> |
| <isset property="ROYALE_SWF_COMPILER_HOME" /> |
| </not> |
| <available file="${ROYALE_HOME}/../royale-compiler/compiler/lib/compiler-mxmlc.jar" type="file" /> |
| </and> |
| </condition> |
| <condition property="ROYALE_SWF_COMPILER_HOME" value="${ROYALE_HOME}"> |
| <and> |
| <not> |
| <isset property="ROYALE_SWF_COMPILER_HOME" /> |
| </not> |
| <available file="${ROYALE_HOME}/lib/compiler-mxmlc.jar" type="file" /> |
| </and> |
| </condition> |
| <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> |
| |
| <target name="main" depends="clean,check-compiler,compile,copy" description="Full build of ${ant.project.name}.swc"> |
| </target> |
| |
| <target name="check-js"> |
| <uptodate property="js-not-needed" targetfile="${ROYALE_HOME}/frameworks/js/projects/${ant.project.name}JS/target/${ant.project.name}JS.swc"> |
| <srcfiles dir="${basedir}/src/main/royale" includes="**/**"/> |
| </uptodate> |
| </target> |
| <target name="js-if-needed" depends="check-js" unless="js-not-needed"> |
| <ant dir="${ROYALE_HOME}/frameworks/js/projects/${ant.project.name}JS/" inheritAll="false" /> |
| </target> |
| |
| <target name="check-for-tests" > |
| <condition property="skip-tests" > |
| <not> |
| <available file="${basedir}/src/test/royale/build.xml" /> |
| </not> |
| </condition> |
| </target> |
| |
| <target name="test" depends="check-for-tests" unless="skip-tests"> |
| <ant dir="src/test/royale" /> |
| </target> |
| |
| <target name="clean"> |
| <delete failonerror="false"> |
| <fileset dir="${ROYALE_HOME}/frameworks/libs"> |
| <include name="${target.name}"/> |
| </fileset> |
| </delete> |
| <delete failonerror="false" includeemptydirs="true"> |
| <fileset dir="${basedir}/target"> |
| <include name="**/**"/> |
| </fileset> |
| </delete> |
| <antcall target="clean-tests" /> |
| </target> |
| |
| <target name="clean-tests" depends="check-for-tests" unless="skip-tests"> |
| <ant dir="src/test/royale" target="clean"/> |
| </target> |
| |
| <target name="compile" description="Compiles .as files into .swc"> |
| <echo message="Compiling libs/${ant.project.name}.swc"/> |
| <echo message="ROYALE_HOME: ${ROYALE_HOME}"/> |
| <echo message="ROYALE_SWF_COMPILER_HOME: ${ROYALE_SWF_COMPILER_HOME}"/> |
| <!-- make JS output folder now so include-file doesn't error --> |
| <mkdir dir="${basedir}/target/generated-sources/royale" /> |
| |
| <compc fork="true" |
| output="${basedir}/target/${target.name}"> |
| <jvmarg line="${compc.jvm.args}"/> |
| <load-config filename="${basedir}/src/main/config/compile-as-config.xml" /> |
| <arg value="+playerglobal.version=${playerglobal.version}" /> |
| <arg value="+env.AIR_HOME=${env.AIR_HOME}" /> |
| <arg value="-define=COMPILE::SWF,true" /> |
| <arg value="-define=COMPILE::JS,false" /> |
| </compc> |
| </target> |
| |
| <target name="check-compiler" depends="check-compiler-home"> |
| <path id="lib.path"> |
| <fileset dir="${ROYALE_SWF_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/> |
| </path> |
| <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> |
| </target> |
| <target name="copy"> |
| <copy file="target/opentypejs.swc" todir="../projects/Text/libs"/> |
| </target> |
| |
| <target name="check-compiler-home" unless="ROYALE_SWF_COMPILER_HOME" |
| description="Check ROYALE_SWF_COMPILER_HOME is a directory."> |
| |
| <echo message="ROYALE_SWF_COMPILER_HOME is ${env.ROYALE_SWF_COMPILER_HOME}"/> |
| |
| <available file="${env.ROYALE_SWF_COMPILER_HOME}/lib/compiler-mxmlc.jar" |
| type="file" |
| property="ROYALE_SWF_COMPILER_HOME" |
| value="${env.ROYALE_SWF_COMPILER_HOME}"/> |
| |
| <available file="${ROYALE_HOME}/../royale-compiler/compiler/lib/compiler-mxmlc.jar" |
| type="file" |
| property="ROYALE_SWF_COMPILER_HOME" |
| value="${ROYALE_HOME}/../royale-compiler/compiler"/> |
| |
| <fail message="ROYALE_SWF_COMPILER_HOME must be set to a folder with a lib sub-folder containing compiler-mxmlc.jar such as the compiler folder in royale-compiler repo or a Royale SDK folder" |
| unless="ROYALE_SWF_COMPILER_HOME"/> |
| </target> |
| |
| </project> |