blob: 2972b6c4b4876f2d1328e5729fa034bdb86cb984 [file] [log] [blame]
<?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="falcon-js" default="jar" basedir=".">
<pathconvert property="basedir1" dirsep="/">
<path location="${basedir}"/>
</pathconvert>
<property name="build.version" value="329449.1"/>
<property name="src" value="${basedir1}/src"/>
<property name="lib" value="${basedir1}/lib"/>
<property name="falcon.basedir" value="${basedir1}/../compiler"/>
<property name="falcon.lib.dir" value="${falcon.basedir}/lib"/>
<property name="falcon.dist.dir" value="${falcon.basedir}/generated/dist"/>
<property name="falcon.src" value="${falcon.basedir}/src"/>
<property name="build.output" value="${basedir1}/build"/>
<property name="build.lib.dir" value="${build.output}/lib"/>
<property name="build.generated.src" value="${build.output}/generatedSrc"/>
<property name="classes.dir" value="${build.output}/classes"/>
<property name="tests.results" value="${build.output}/tests/results"/>
<property name="asc.jar" value="${build.lib.dir}/asc.jar"/>
<property name="mxmlc.jar" value="${build.lib.dir}/mxmlc.jar"/>
<property name="compc.jar" value="${build.lib.dir}/compc.jar"/>
<property name="jsc.jar" value="${build.lib.dir}/jsc.jar"/>
<property name="as3.codegen.generated.src" value="${build.generated.src}/as3.codegen"/>
<property name="as3.codegen.package.dir" value="org/apache/flex/compiler/internal/as/codegen"/>
<property name="falcon.as3.codegen.dir" value="${falcon.basedir}/src/${as3.codegen.package.dir}"/>
<property name="ant.build.javac.target" value="1.6"/>
<property name="ant.build.javac.source" value="1.6"/>
<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="false"/>
<property name="falcon-js-as3.codegen" value="${basedir1}/src/${as3.codegen.package.dir}"/>
<property name="jburg.jar" value="${falcon.lib.dir}/jburg.jar"/>
<property name="antlr" value="${falcon.lib.dir}/antlr.jar"/>
<property name="tests.root" value="${basedir1}/../compiler.tests"/>
<property name="tamarin.dir" value="${tests.root}/resources/tamarin"/>
<property name="manifest.Implementation-Vendor" value="Adobe Systems Incorporated"/>
<property name="manifest.Implementation-Version" value="0.${build.version}"/>
<property name="localizationIntermediates.dir" value="${basedir1}/intermediates/localization"/>
<property name="errorMessagesPath" value="org/apache/flex/compiler/problems"/>
<property name="errorMessagesSrc.dir" value="${basedir1}/localization/src/${errorMessagesPath}"/>
<available property="haveLocalizedErrorMessages.set" file="${errorMessagesSrc.dir}" type="dir"/>
<macrodef name="jburg-js">
<attribute name="spec"/>
<attribute name="output"/>
<sequential>
<dirname property="as3.codegen.emitter.@{spec}.dirname" file="@{spec}"/>
<dirname property="as3.codegen.emitter.@{output}.dirname" file="@{output}"/>
<basename property="as3.codegen.emitter.@{output}.basename" file="@{output}"/>
<mkdir dir="${as3.codegen.emitter.@{output}.dirname}"/>
<java classname="jburg.burg.JBurgMain"
classpath="${classes.dir}"
fork="true"
failonerror="true"
dir="${as3.codegen.emitter.@{spec}.dirname}" >
<arg value="@{spec}"/>
<arg value="-outputdir"/>
<arg value="${as3.codegen.emitter.@{output}.dirname}"/>
<arg value="-outputfile"/>
<arg value="${as3.codegen.emitter.@{output}.basename}"/>
<arg value="-g"/>
<classpath>
<pathelement path="${jburg.jar}"/>
<pathelement path="${antlr}"/>
<pathelement path="${classes.dir}"/>
</classpath>
</java>
</sequential>
</macrodef>
<path id="classpath">
<filelist dir="${build.lib.dir}">
<file name="commons-cli.jar"/>
<file name="commons-io.jar"/>
<file name="guava.jar"/>
</filelist>
<filelist dir="${build.lib.dir}/google/closure-compiler">
<file name="compiler.jar"/>
</filelist>
</path>
<target name="localizeCompilerErrors" if="haveLocalizedErrorMessages.set">
<sequential>
<echo level="info" message="Copying localization files to ${localizationIntermediates.dir}."/>
<mkdir dir="${localizationIntermediates.dir}"/>
<native2ascii encoding="UTF-8" src="${errorMessagesSrc.dir}" dest="${localizationIntermediates.dir}/${errorMessagesPath}" includes="**/*.xlr,**/*.properties"/>
</sequential>
</target>
<target name="createBuildFolders">
<mkdir dir="${classes.dir}"/>
</target>
<target name="copyFiles" depends="createBuildFolders">
<copy todir="${build.lib.dir}">
<filelist dir="${falcon.lib.dir}">
<file name="antlr.jar"/>
<file name="commons-cli.jar"/>
<file name="commons-io.jar"/>
<file name="guava.jar"/>
</filelist>
</copy>
<copy todir="${build.lib.dir}/google/closure-compiler">
<filelist dir="${lib}/google/closure-compiler">
<file name="compiler.jar"/>
</filelist>
</copy>
</target>
<target name="prepare" depends="copyFiles,localizeCompilerErrors">
<echo level="info">${ant.file}</echo>
</target>
<target name="as3.codegen.support.uptodate">
<echo level="info">${ant.file}</echo>
<uptodate property="CmcEmitter.uptodate"
targetfile="${as3.codegen.generated.src}/${as3.codegen.package.dir}/CmcJSEmitter.java">
<srcfiles dir="${falcon-js-as3.codegen}" includes="*.jbg"/>
<srcfiles dir="${falcon.as3.codegen.dir}" includes="*.jbg"/>
</uptodate>
</target>
<target name="as3.codegen.support" depends="as3.codegen.support.uptodate,createBuildFolders">
<javac debug="${javac.debug}" deprecation="${javac.deprecation}"
destdir="${classes.dir}"
classpathref="classpath">
<src path="${falcon.src}"/>
<include name="**/IASNodeAdapter.java"/>
<classpath>
<pathelement path="${jburg.jar}"/>
</classpath>
</javac>
</target>
<target name="as3.codegen.emitter" depends="as3.codegen.support" unless="CmcEmitter.uptodate">
<jburg-js spec="${falcon-js-as3.codegen}/cmc-js.jbg"
output="${as3.codegen.generated.src}/${as3.codegen.package.dir}/CmcJSEmitter.java"/>
</target>
<target name="compile" depends="prebuild,prepare,as3.codegen.emitter" description="compile">
<javac debug="${javac.debug}" deprecation="${javac.deprecation}"
includes="**/*.java"
excludes=""
destdir="${classes.dir}"
classpathref="classpath">
<src path="${src}"/>
<src path="${as3.codegen.generated.src}"/>
<classpath>
<pathelement path="${falcon.basedir}/generated/classes"/>
</classpath>
</javac>
</target>
<target name="prebuild">
<mkdir dir="${lib}" />
<mkdir dir="${lib}/google" />
<mkdir dir="${lib}/google/closure-compiler" />
<ant antfile="${basedir}/downloads.xml" dir="${basedir}"/>
</target>
<target name="jar" depends="compile">
<property name="jar.classpath" value="antlr.jar commons-cli.jar commons-io.jar org.apache.felix.framework-3.0.2.jar guava.jar google/closure-compiler/compiler.jar ../../lib/compiler.jar"/>
<echo message="Building ${jsc.jar}"/>
<jar file="${jsc.jar}" basedir="${classes.dir}"
includes="**/*.properties,org/apache/**/*"
excludes="**/JSDriver*,**/IASNodeAdapter*,org/apache/flex/compiler/internal/parsing/abc/*" >
<manifest>
<attribute name="Sealed" value="false"/>
<attribute name="Implementation-Title" value="JSC Command Line Compiler"/>
<attribute name="Implementation-Vendor" value="${manifest.Implementation-Vendor}"/>
<attribute name="Implementation-Version" value="${manifest.Implementation-Version}"/>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</jar>
<echo message="Building ${mxmlc.jar}"/>
<jar file="${mxmlc.jar}" >
<manifest>
<attribute name="Sealed" value="${manifest.sealed}"/>
<attribute name="Implementation-Title" value="MXMLJSC Command Line Compiler"/>
<attribute name="Implementation-Vendor" value="${manifest.Implementation-Vendor}"/>
<attribute name="Implementation-Version" value="${manifest.Implementation-Version}"/>
<attribute name="Main-Class" value="org.apache.flex.compiler.clients.MXMLJSC"/>
<attribute name="Class-Path" value="jsc.jar"/>
</manifest>
</jar>
<echo message="Building ${compc.jar}"/>
<jar file="${compc.jar}" >
<manifest>
<attribute name="Sealed" value="${manifest.sealed}"/>
<attribute name="Implementation-Title" value="COMPJSC Command Line Compiler"/>
<attribute name="Implementation-Vendor" value="${manifest.Implementation-Vendor}"/>
<attribute name="Implementation-Version" value="${manifest.Implementation-Version}"/>
<attribute name="Main-Class" value="org.apache.flex.compiler.clients.COMPJSC"/>
<attribute name="Class-Path" value="jsc.jar"/>
</manifest>
</jar>
<echo message="Copying jars to ${lib}"/>
<copy todir="${lib}">
<filelist dir="${build.lib.dir}">
<file name="mxmlc.jar"/>
<file name="compc.jar"/>
<file name="jsc.jar"/>
</filelist>
</copy>
</target>
<target name="super-clean" depends="thirdparty-clean,clean" description="Cleans everything including thirdparty downloads."/>
<target name="thirdparty-clean" description="Removes all thirdparty downloads.">
<delete failonerror="false" quiet="true" includeemptydirs="true">
<fileset dir="${lib}" />
</delete>
<ant antfile="${basedir}/downloads.xml" dir="${basedir}" target="clean"/>
</target>
<!-- clean -->
<target name="clean" >
<echo message="${build.output}: cleaning..."/>
<delete failonerror="false" quiet="true" includeemptydirs="true" dir="${build.output}/classes"/>
<delete failonerror="false" quiet="true" includeemptydirs="true" dir="${build.output}/generatedSrc"/>
<delete failonerror="false" quiet="true" includeemptydirs="true" dir="${build.output}/lib"/>
<delete failonerror="false" quiet="true" includeemptydirs="true" dir="${localizationIntermediates.dir}"/>
</target>
<target name="eclipse" depends="as3.codegen.emitter"/>
</project>