| <?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="compiler.externc.tests" default="main" basedir="."> | |
| <pathconvert property="externc.tests" dirsep="/"> | |
| <path location="${basedir}"/> | |
| </pathconvert> | |
| <property environment="env"/> | |
| <property file="unittest.properties" /> | |
| <property name="test.timeout" value="400000" /> | |
| <property name="maxmem" value="512" /> | |
| <property name="compiler.externc" value="${externc.tests}/../.."/> | |
| <property name="compiler.jx" value="${compiler.externc}/../compiler-jx"/> | |
| <property name="compiler.jx.tests" value="${compiler.jx}/src/test"/> | |
| <target name="download" description="Downloads third-party JARs"> | |
| <ant antfile="${compiler.jx.tests}/downloads.xml" dir="${compiler.jx.tests}"/> | |
| <mkdir dir="${compiler.externc}/target/junit-temp/externs" /> | |
| <unjar src="${compiler.jx}/lib/google/closure-compiler/compiler.jar" | |
| dest="${compiler.externc}/target/junit-temp/externs"> | |
| <patternset> | |
| <include name="externs.zip"/> | |
| </patternset> | |
| </unjar> | |
| <mkdir dir="${compiler.externc}/target/downloads" /> | |
| <unzip src="${compiler.externc}/target/junit-temp/externs/externs.zip" dest="${compiler.externc}/target/downloads" > | |
| <patternset> | |
| <include name="**/*.js"/> | |
| <exclude name="**/es3.js"/> | |
| <exclude name="**/es6.js"/> | |
| <exclude name="**/w3c_css.js"/> | |
| <exclude name="**/gecko_dom.js"/> | |
| <exclude name="**/w3c_dom2.js"/> | |
| <exclude name="**/html5.js"/> | |
| </patternset> | |
| </unzip> | |
| <get src="https://raw.githubusercontent.com/royale-extras/closure-compiler/royale/externs/es3.js" dest="${compiler.externc}/target/downloads/es3.js" ignoreerrors="true" skipexisting="false"/> | |
| <get src="https://raw.githubusercontent.com/royale-extras/closure-compiler/royale/externs/es6.js" dest="${compiler.externc}/target/downloads/es6.js" ignoreerrors="true" skipexisting="false"/> | |
| <get src="https://raw.githubusercontent.com/royale-extras/closure-compiler/royale/externs/browser/w3c_css.js" dest="${compiler.externc}/target/downloads/browser/w3c_css.js" ignoreerrors="true" skipexisting="false"/> | |
| <get src="https://raw.githubusercontent.com/royale-extras/closure-compiler/royale/externs/browser/gecko_dom.js" dest="${compiler.externc}/target/downloads/browser/gecko_dom.js" ignoreerrors="true" skipexisting="false"/> | |
| <get src="https://raw.githubusercontent.com/royale-extras/closure-compiler/royale/externs/browser/w3c_dom2.js" dest="${compiler.externc}/target/downloads/browser/w3c_dom2.js" ignoreerrors="true" skipexisting="false"/> | |
| <get src="https://raw.githubusercontent.com/royale-extras/closure-compiler/royale/externs/browser/html5.js" dest="${compiler.externc}/target/downloads/browser/html5.js" ignoreerrors="true" skipexisting="false"/> | |
| <antcall target="get-from-cache-if-needed" > | |
| <param name="srcFile" value="es3.js" /> | |
| <param name="destFile" value="es3.js" /> | |
| <param name="destDir" value="${basedir}/../../target/downloads" /> | |
| </antcall> | |
| <antcall target="get-from-cache-if-needed" > | |
| <param name="srcFile" value="es6.js" /> | |
| <param name="destFile" value="es6.js" /> | |
| <param name="destDir" value="${basedir}/../../target/downloads" /> | |
| </antcall> | |
| <antcall target="get-from-cache-if-needed" > | |
| <param name="srcFile" value="w3c_composition_event.js" /> | |
| <param name="destFile" value="w3c_composition_event.js" /> | |
| <param name="destDir" value="${basedir}/../../target/downloads/browser" /> | |
| </antcall> | |
| <antcall target="get-from-cache-if-needed" > | |
| <param name="srcFile" value="w3c_css.js" /> | |
| <param name="destFile" value="w3c_css.js" /> | |
| <param name="destDir" value="${basedir}/../../target/downloads/browser" /> | |
| </antcall> | |
| <antcall target="get-from-cache-if-needed" > | |
| <param name="srcFile" value="gecko_dom.js" /> | |
| <param name="destFile" value="gecko_dom.js" /> | |
| <param name="destDir" value="${basedir}/../../target/downloads/browser" /> | |
| </antcall> | |
| <antcall target="get-from-cache-if-needed" > | |
| <param name="srcFile" value="ie_dom.js" /> | |
| <param name="destFile" value="ie_dom.js" /> | |
| <param name="destDir" value="${basedir}/../../target/downloads/browser" /> | |
| </antcall> | |
| <antcall target="get-from-cache-if-needed" > | |
| <param name="srcFile" value="w3c_dom2.js" /> | |
| <param name="destFile" value="w3c_dom2.js" /> | |
| <param name="destDir" value="${basedir}/../../target/downloads/browser" /> | |
| </antcall> | |
| <antcall target="get-from-cache-if-needed" > | |
| <param name="srcFile" value="html5.js" /> | |
| <param name="destFile" value="html5.js" /> | |
| <param name="destDir" value="${basedir}/../../target/downloads/browser" /> | |
| </antcall> | |
| </target> | |
| <target name="compile.unit.tests"> | |
| <delete dir="${compiler.externc}/target/test-classes"/> | |
| <mkdir dir="${compiler.externc}/target/test-classes"/> | |
| <copy todir="${compiler.externc}/target/test-classes"> | |
| <fileset dir="${externc.tests}/resources"> | |
| <include name="**"/> | |
| </fileset> | |
| </copy> | |
| <javac debug="${javac.debug}" deprecation="${javac.deprecation}" | |
| encoding="UTF-8" | |
| destdir="${compiler.externc}/target/test-classes" includeAntRuntime="true"> | |
| <src path="${externc.tests}/java"/> | |
| <compilerarg value="-Xlint:all,-path"/> | |
| <classpath> | |
| <pathelement location="${compiler.externc}/target/test-classes"/> | |
| <pathelement location="${compiler.externc}/../compiler-test-utils/target/classes"/> | |
| <fileset dir="${compiler.jx}/lib" includes="**/*.jar"/> | |
| </classpath> | |
| </javac> | |
| </target> | |
| <target name="typedefs.unit.tests" depends="download, compile.unit.tests"> | |
| <mkdir dir="${externc.tests}/results"/> | |
| <mkdir dir="${compiler.externc}/target/junit-temp"/> | |
| <mkdir dir="${compiler.externc}/target/junit-results"/> | |
| <junit dir="${compiler.externc}" | |
| fork="yes" forkMode="perBatch" maxmemory="${maxmem}m" timeout="${test.timeout}" | |
| printsummary="true" showoutput="true" | |
| haltonerror="true" haltonfailure="true" | |
| failureproperty="tests.unit.failed"> | |
| <jvmarg value="-Duser.language=en"/> | |
| <jvmarg value="-Duser.country=US"/> | |
| <classpath> | |
| <pathelement location="${compiler.externc}/target/classes"/> | |
| <pathelement location="${compiler.externc}/target/test-classes"/> | |
| <pathelement location="${compiler.externc}/../compiler-test-utils/target/classes"/> | |
| <fileset dir="${compiler.jx}/lib" includes="**/*.jar"/> | |
| <fileset dir="${compiler.externc}/../compiler/lib" includes="**/*.jar"/> | |
| </classpath> | |
| <batchtest todir="${compiler.externc}/target/junit-results"> | |
| <fileset dir="${compiler.externc}/target/test-classes"> | |
| <!-- externs tests --> | |
| <include name="**/TestExternES3.class"/> | |
| <include name="**/TestExternJSMissing.class"/> | |
| <include name="**/TestAnnotationEnum.class"/> | |
| <include name="**/TestCollectImports.class"/> | |
| <include name="**/TestConstructor.class"/> | |
| <include name="**/TestPackageNamespace.class"/> | |
| <include name="**/TestReferenceModel.class"/> | |
| <include name="**/TestTypeTypedefs.class"/> | |
| <include name="**/TestTypeInheritance.class"/> | |
| </fileset> | |
| </batchtest> | |
| <formatter type="xml"/> | |
| <assertions> | |
| <enable/> | |
| </assertions> | |
| </junit> | |
| </target> | |
| <target name="typedefs.integration.tests" depends="download, compile.unit.tests"> | |
| <mkdir dir="${externc.tests}/results"/> | |
| <mkdir dir="${compiler.externc}/target/junit-temp"/> | |
| <mkdir dir="${compiler.externc}/target/junit-results"/> | |
| <junit dir="${compiler.externc}" | |
| fork="yes" forkMode="perBatch" maxmemory="${maxmem}m" timeout="${test.timeout}" | |
| printsummary="true" showoutput="true" | |
| haltonerror="true" haltonfailure="true" | |
| failureproperty="tests.unit.failed"> | |
| <jvmarg value="-Duser.language=en"/> | |
| <jvmarg value="-Duser.country=US"/> | |
| <classpath> | |
| <pathelement location="${compiler.externc}/target/classes"/> | |
| <pathelement location="${compiler.externc}/target/test-classes"/> | |
| <pathelement location="${compiler.externc}/../compiler-test-utils/target/classes"/> | |
| <fileset dir="${compiler.jx}/lib" includes="**/*.jar"/> | |
| <fileset dir="${compiler.externc}/../compiler/lib" includes="**/*.jar"/> | |
| </classpath> | |
| <batchtest todir="${compiler.externc}/target/junit-results"> | |
| <fileset dir="${compiler.externc}/target/test-classes"> | |
| <!-- externs tests --> | |
| <include name="**/TestExternJasmine.class"/> | |
| <include name="**/TestExternJQuery.class"/> | |
| <include name="**/TestExternNode.class"/> | |
| </fileset> | |
| </batchtest> | |
| <formatter type="xml"/> | |
| <assertions> | |
| <enable/> | |
| </assertions> | |
| </junit> | |
| </target> | |
| <target name="main" depends="typedefs.unit.tests"/> | |
| <target name="clean"> | |
| <delete dir="${externc.tests}/bin"/> | |
| <delete dir="${externc.tests}/classes"/> | |
| <delete dir="${externc.tests}/results"/> | |
| </target> | |
| <target name="wipe" depends="clean"> | |
| <delete dir="${compiler.externc}/target"/> | |
| </target> | |
| <target name="fail-if-not-found"> | |
| <fail message="${destDir}/${destFile} could not be downloaded or found in cache"> | |
| <condition> | |
| <not> | |
| <available file="${destDir}/${destFile}" /> | |
| </not> | |
| </condition> | |
| </fail> | |
| </target> | |
| <target name="double-check-file" > | |
| <echo>${env.ROYALE_DOWNLOAD_CACHE}</echo> | |
| <condition property="still-no-file" value="true"> | |
| <and> | |
| <not> | |
| <available file="${destDir}/${destFile}" /> | |
| </not> | |
| <isset property="env.ROYALE_DOWNLOAD_CACHE" /> | |
| </and> | |
| </condition> | |
| <echo>Need file: ${still_no_file}</echo> | |
| </target> | |
| <target name="get-from-cache-if-needed" depends="double-check-file" if="still-no-file"> | |
| <copy file="${env.ROYALE_DOWNLOAD_CACHE}/${srcFile}" tofile="${destDir}/${destFile}" /> | |
| </target> | |
| </project> |