Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 134 lines (120 sloc) 4.848 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
<project name="clojure" default="all">

  <description>
    Build with "ant" and then start the
    REPL with: "java -cp clojure.jar clojure.main".
  </description>

  <property name="src" location="src"/>
  <property name="test" location="test"/>
  <property name="jsrc" location="${src}/jvm"/>
  <property name="cljsrc" location="${src}/clj"/>
  <property name="cljscript" location="${src}/script"/>
  <property name="test-script" location="${cljscript}/run_tests.clj"/>
  <property name="compile-script" location="${cljscript}/bootstrap_compile.clj"/>
  <property name="target" location="target"/>
  <property name="build" location="${target}/classes"/>
  <property name="test-classes" location="${target}/test-classes"/>
  <property name="dist" location="dist"/>

  <!-- Get the version string out of the POM -->
  <xmlproperty file="pom.xml" prefix="pom"/>
  <property name="clojure.version.label" value="${pom.project.version}"/>
  <property name="version.properties" value="${build}/clojure/version.properties"/>

  <property name="clojure_jar" location="clojure-${clojure.version.label}.jar"/>
  <property name="clojure_noversion_jar" location="clojure.jar"/>

  <target name="init" depends="clean">
    <tstamp/>
    <mkdir dir="${build}"/>
    <mkdir dir="${build}/clojure"/>
    <echo file="${version.properties}">version=${clojure.version.label}</echo>
  </target>

  <target name="compile-java" depends="init"
          description="Compile Java sources.">
    <javac srcdir="${jsrc}" destdir="${build}" includeJavaRuntime="yes"
           debug="true" target="1.5"/>
  </target>

  <target name="compile-clojure"
          description="Compile Clojure sources.">
    <java classname="clojure.lang.Compile"
          classpath="${build}:${cljsrc}"
          failonerror="true"
          fork="true">
      <sysproperty key="clojure.compile.path" value="${build}"/>
      <!-- <sysproperty key="clojure.compile.warn-on-reflection" value="true"/> -->
      <arg value="clojure.core"/>
      <arg value="clojure.core.protocols"/>
      <arg value="clojure.main"/>
      <arg value="clojure.set"/>
      <arg value="clojure.xml"/>
      <arg value="clojure.zip"/>
      <arg value="clojure.inspector"/>
      <arg value="clojure.walk"/>
      <arg value="clojure.stacktrace"/>
      <arg value="clojure.template"/>
      <arg value="clojure.test"/>
      <arg value="clojure.test.tap"/>
      <arg value="clojure.test.junit"/>
      <arg value="clojure.pprint"/>
      <arg value="clojure.java.io"/>
      <arg value="clojure.repl"/>
      <arg value="clojure.java.browse"/>
      <arg value="clojure.java.javadoc"/>
      <arg value="clojure.java.shell"/>
      <arg value="clojure.java.browse-ui"/>
      <arg value="clojure.string"/>
      <arg value="clojure.data"/>
      <arg value="clojure.reflect"/>
    </java>
  </target>

  <target name="compile-tests"
          description="Compile the subset of tests that require compilation."
          unless="maven.test.skip">
    <delete dir="${test-classes}"/>
    <mkdir dir="${test-classes}"/>
    <java classname="clojure.lang.Compile"
          classpath="${test-classes}:${test}:${build}:${cljsrc}"
          failonerror="true"
fork="true">
      <sysproperty key="clojure.compile.path" value="${test-classes}"/>
      <arg value="clojure.test-clojure.protocols.examples"/>
      <arg value="clojure.test-clojure.genclass.examples"/>
    </java>
  </target>

  <target name="test"
          description="Run clojure tests without recompiling clojure."
          depends="compile-tests"
          unless="maven.test.skip">
    <java classname="clojure.main" failonerror="true" fork="true">
      <classpath>
        <path location="${test-classes}"/>
        <path location="${test}"/>
        <path location="${build}"/>
<path location="${cljsrc}"/>
      </classpath>
      <arg value="${test-script}"/>
    </java>
  </target>

  <target name="build"
          description="Build Clojure (compilation only, no tests)."
          depends="compile-java, compile-clojure"/>

  <target name="jar" depends="build"
          description="Create clojure jar file.">
    <jar jarfile="${clojure_jar}" basedir="${build}">
      <fileset dir="${cljsrc}">
        <include name="**/*.clj"/>
      </fileset>
      <manifest>
        <attribute name="Main-Class" value="clojure.main"/>
        <attribute name="Class-Path" value="."/>
      </manifest>
    </jar>
    <copy file="${clojure_jar}" tofile="${clojure_noversion_jar}"/>
  </target>
  
  <target name="all" depends="build,test,jar"/>

  <target name="clean"
          description="Remove autogenerated files and directories.">
    <delete dir="${target}"/>
    <delete verbose="true">
      <fileset dir="${basedir}" includes="*.jar"/>
      <fileset dir="${basedir}" includes="*.zip"/>
    </delete>
  </target>

</project>
Something went wrong with that request. Please try again.