Skip to content

Commit

Permalink
created a jar that compiles CoffeeScript using mozilla rhino for coff…
Browse files Browse the repository at this point in the history
…eescript 0.6.1.
  • Loading branch information
yeungda committed May 5, 2010
1 parent 091da10 commit 1dbe0f4
Show file tree
Hide file tree
Showing 25 changed files with 346 additions and 117 deletions.
8 changes: 8 additions & 0 deletions .idea/ant.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/libraries/Rhino.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ 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="JCoffeeScript" default="build">

<target name="build" depends="bootstrap, clean, functional-test"/>

<property name="artifact.name" value="jcoffeescript-0.1"/>
<import file="${basedir}/conf/build/build-bootstrap.xml"/>
<import file="${basedir}/conf/build/build-clean.xml"/>
<import file="${basedir}/conf/build/build-compile.xml"/>
<import file="${basedir}/conf/build/build-test.xml"/>
<import file="${basedir}/conf/build/build-jar.xml"/>

<target name="dependencies">
<path id="compile.classpath">
<fileset dir="${basedir}/lib">
<include name="js.jar"/>
</fileset>
</path>
<path id="test.classpath">
<path refid="compile.classpath"/>
<fileset dir="${basedir}/lib">
<include name="hamcrest-all-1.3RC0.jar"/>
<include name="junit-dep-4.8.2.jar"/>
</fileset>
</path>
</target>

<target name="functional-test" depends="jar">
<java inputstring="a:1" jar="${basedir}/target/dist/${artifact.name}.jar" failonerror="true" fork="true"/>
</target>
</project>
1 change: 0 additions & 1 deletion coffee-script
Submodule coffee-script deleted from 1cddb2
Binary file added conf/build/bootstrap/ant-contrib-1.0b3.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions conf/build/build-bootstrap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<project>

<target name="bootstrap">
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${basedir}/conf/build/bootstrap/ant-contrib-1.0b3.jar"/>
</target>

</project>
9 changes: 9 additions & 0 deletions conf/build/build-clean.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<project>

<target name="clean" description="cleans target folder">
<delete dir="${basedir}/target" includeEmptyDirs="true" failonerror="true" />
</target>

</project>
51 changes: 51 additions & 0 deletions conf/build/build-compile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>

<project>

<taskdef resource="net/sf/antcontrib/antlib.xml"/>

<target name="dependencies">
<fail message="[dependencies] target should be defined outside the scope of build-compile"/>
</target>

<target name="compile" depends="dependencies, compile-all" description="compile all source folders"/>

<target name="compile-all">
<compile-folder folder="main" classpathref="compile.classpath"/>
<compile-folder folder="standalone" classpathref="test.classpath"/>
<compile-folder folder="unit-tests" classpathref="test.classpath"/>
<compile-folder folder="integration-tests" classpathref="test.classpath"/>
</target>

<macrodef name="compile-folder">
<attribute name="folder" />
<attribute name="classpathref" />
<sequential>
<if>
<available file="${basedir}/src/@{folder}/java" type="dir"/>
<then>
<mkdir dir="${basedir}/target/classes/@{folder}"/>
<javac srcdir="${basedir}/src/@{folder}/java" destdir="${basedir}/target/classes/@{folder}" source="1.5" target="1.5" debug="true">
<classpath>
<path refid="@{classpathref}"/>
<pathelement location="${basedir}/target/classes/main" />
</classpath>
</javac>
<copy todir="${basedir}/target/classes/@{folder}">
<fileset dir="${basedir}/src/@{folder}/java" excludes="**/*.java"/>
</copy>
</then>
</if>
<if>
<available file="${basedir}/src/@{folder}/resources" type="dir"/>
<then>
<mkdir dir="${basedir}/target/classes/@{folder}" />
<copy todir="${basedir}/target/classes/@{folder}">
<fileset dir="${basedir}/src/@{folder}/resources" />
</copy>
</then>
</if>
</sequential>
</macrodef>

</project>
15 changes: 15 additions & 0 deletions conf/build/build-jar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>

<project>
<target name="jar" depends="test">
<mkdir dir="${basedir}/target/dist"/>
<pathtofileset name="jars" pathrefid="compile.classpath" dir="${basedir}/lib"/>

<jar destfile="${basedir}/target/dist/${artifact.name}.jar">
<manifest><attribute name="Main-Class" value="org.jcoffeescript.Main"/></manifest>
<zipgroupfileset refid="jars"/>
<metainf dir="${basedir}/.." includes="LICENSE,NOTICE"/>
<zipfileset dir="${basedir}/target/classes/main"/>
</jar>
</target>
</project>
49 changes: 49 additions & 0 deletions conf/build/build-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>

<project>

<target name="compile">
<fail message="[compile] target should be defined outside the scope of build-test"/>
</target>

<target name="test" depends="compile">
<sequential>
<run-test folder="unit-tests" />
<run-test folder="integration-tests" />
<fail if="tests-failed" message="tests failed" />
</sequential>
</target>

<macrodef name="run-test">
<attribute name="folder" />
<sequential>
<if>
<available file="${basedir}/src/@{folder}/java" type="dir"/>
<then>
<delete dir="${basedir}/target/test-reports/@{folder}" includeEmptyDirs="true" failonerror="true" />
<mkdir dir="${basedir}/target/test-reports/@{folder}" />
<mkdir dir="${basedir}/target/test-reports/@{folder}/xml" />
<mkdir dir="${basedir}/target/test-reports/@{folder}/html" />
<junit printsummary="yes" fork="yes" forkmode="once" failureproperty="tests-failed">
<classpath>
<path refid="test.classpath" />
<pathelement location="${basedir}/target/classes/main" />
<pathelement location="${basedir}/target/classes/@{folder}" />
</classpath>
<formatter type="xml" />
<batchtest fork="yes" todir="${basedir}/target/test-reports/@{folder}/xml">
<fileset dir="${basedir}/target/classes/@{folder}" includes="**/*Test.class" />
</batchtest>
</junit>
<junitreport todir="${basedir}/target/test-reports/@{folder}/html">
<fileset dir="${basedir}/target/test-reports/@{folder}/xml">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${basedir}/target/test-reports/@{folder}/html"/>
</junitreport>
</then>
</if>
</sequential>
</macrodef>

</project>
34 changes: 4 additions & 30 deletions coffeescript-rhino.iml → jcoffeescript.iml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/coffee-script/lib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Expand All @@ -18,15 +18,6 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/junit/4.8.2/junit-dep-4.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
Expand All @@ -36,28 +27,11 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Rhino" level="project" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/narwhal/engines/rhino/jars/js.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/narwhal/engines/rhino/jars/jline.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/narwhal/engines/rhino/jars/jna.jar!/" />
<root url="jar://$MODULE_DIR$/lib/junit-dep-4.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
Expand Down
Binary file removed lib/hamcrest-all-1.2.jar
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file removed lib/junit/4.8.2/junit-4.8.2.jar
Binary file not shown.
1 change: 0 additions & 1 deletion narwhal
Submodule narwhal deleted from e88dd6
64 changes: 0 additions & 64 deletions src/main/java/CoffeeScriptRunner.java

This file was deleted.

Loading

0 comments on commit 1dbe0f4

Please sign in to comment.