Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
106 lines (92 sloc) 4.32 KB
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2010 David Yeung
~
~ Licensed 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="coffeescript-idea" default="generate-lexer">
<property name="idea.home" value="${basedir}/../idea"/>
<target name="bootstrap">
<exec executable="${basedir}/VERSION-GEN" dir="${basedir}" outputproperty="version"/>
<echo message="${version}"/>
</target>
<taskdef name="javac2" classname="com.intellij.ant.Javac2">
<classpath refid="idea.classpath"/>
</taskdef>
<taskdef name="jflex" classname="JFlex.anttask.JFlexTask">
<classpath location="${idea.home}/tools/lexer/jflex-1.4/lib/JFlex.jar"/>
</taskdef>
<path id="idea.classpath">
<fileset dir="${idea.home}">
<include name="lib/*.jar"/>
<include name="redist/*.jar"/>
</fileset>
<fileset dir="/Applications/IntelliJ IDEA 9.0.3 CE.app/lib/">
<include name="*.jar"/>
</fileset>
</path>
<target name="generate-lexer">
<jflex skeleton="${idea.home}/tools/lexer/idea-flex.skeleton" nobak="true"
file="${basedir}/src/org/coffeescript/lang/lexer/CoffeeScript.flex"
destdir="${basedir}/src/"
charat="true"/>
</target>
<target name="clean">
<delete dir="${basedir}/target"/>
</target>
<target name="init" depends="clean, bootstrap">
<mkdir dir="${basedir}/target/classes"/>
<mkdir dir="${basedir}/target/test-classes"/>
<mkdir dir="${basedir}/target/junit"/>
<mkdir dir="${basedir}/target/test-reports"/>
</target>
<target name="resources" depends="init, generate-lexer">
<copy todir="${basedir}/target/classes">
<fileset dir="${basedir}/resources"/>
<filterchain ><expandproperties/></filterchain>
</copy>
</target>
<target name="compile" depends="resources">
<javac2 srcdir="${basedir}/src" destdir="${basedir}/target/classes" source="1.5" target="1.5">
<classpath refid="idea.classpath"/>
</javac2>
<javac2 srcdir="${basedir}/test" destdir="${basedir}/target/test-classes" source="1.5" target="1.5">
<classpath refid="idea.classpath"/>
<classpath location="${basedir}/target/classes"/>
</javac2>
</target>
<target name="unit-test" depends="compile">
<junit failureproperty="unit-test.fail" forkmode="once" fork="yes" includeantruntime="yes"
tempdir="${basedir}/target/junit" printsummary="yes" showoutput="yes">
<classpath location="${basedir}/target/classes"/>
<classpath location="${basedir}/target/test-classes"/>
<classpath refid="idea.classpath"/>
<formatter type="xml"/>
<batchtest todir="${basedir}/target/test-reports" fork="yes">
<fileset dir="${basedir}/target/test-classes" includes="**/*UnitTest.class"/>
</batchtest>
</junit>
<fail if="unit-test.fail" message="unit tests failed see ${basedir}/target/test-reports"/>
</target>
<target name="jar" depends="unit-test" description="build jar">
<mkdir dir="${basedir}/target/jar"/>
<jar file="${basedir}/target/jar/coffeescript-idea.${version}.jar" compress="true">
<metainf dir="${basedir}" includes="LICENSE,NOTICE"/>
<zipfileset dir="${basedir}/target/classes"/>
</jar>
</target>
<target name="install-in-rubymine-on-mac" description="deploy built jar to existing rubymine 2.0 installation">
<delete dir="${user.home}/Library/Application Support/RubyMine25" includes="coffeescript-idea*.jar"/>
<copy todir="${user.home}/Library/Application Support/RubyMine25"><fileset dir="${basedir}/target/jar" includes="*.jar"/></copy>
</target>
</project>