Hello Stephen,

Am 03.12.2008 um 20:35 schrieb Stephen C. Gilardi:
Can we make clojure-contrib/build.xml work such that if you specify a
location for a clojure.jar as a property, it compiles (the stand-alone
compilable parts of ) clojure-contrib into clojure-contrib.jar, but if
you don't specify the location it just jars up the clojure-contrib
sources?

That would be one flexible way to handle needing clojure.jar in order
to compile, but not wanting an absolute dependency.

Alternatively, perhaps clojure/build.xml should build
clojure-contrib.jar if it's told where to find the clojure-contrib
source directory.

Any thoughts?

Hmm.. having clojure/build.xml compile clojure-contrib is somehow
contrary to the "not an absolute dependency" idea.

I think your initial suggestion, is a good idea. I changed the
build.xml file to look for a property called clojure.jar. If it
exists, we use it and compile the libraries. Otherwise - well -
we don't...

Invocation: ant -Dclojure.jar=/path/to/clojure.jar

Sincerely
Meikel

<project name="clojure-contrib" default="jar">

  <description>
    Pack all clojure-contrib sources into a JAR.
  </description>

  <property name="src" location="src"/>
  <property name="build" location="classes"/>

  <available property="hasclojure" file="${clojure.jar}"/>

  <!-- The JAR file to create. -->
  <property name="jarfile" location="clojure-contrib.jar"/>

  <target name="init">
    <tstamp/>
    <mkdir dir="${build}"/>
  </target>

  <target name="clean" description="Remove generated files and directories.">
    <delete file="${jarfile}"/>
    <delete dir="${build}"/>
  </target>

  <target name="compile_clojure" depends="init"
    description="Compile Clojure sources."
    if="hasclojure">
    <java classname="clojure.lang.Compile">
      <classpath>
        <path location="${build}"/>
        <path location="${src}"/>
        <path location="${clojure.jar}"/>
      </classpath>
      <sysproperty key="clojure.compile.path" value="${build}"/>
      <arg value="clojure.contrib.command-line"/>
      <arg value="clojure.contrib.cond"/>
      <arg value="clojure.contrib.def"/>
      <arg value="clojure.contrib.duck-streams"/>
      <arg value="clojure.contrib.except"/>
      <arg value="clojure.contrib.fcase"/>
      <arg value="clojure.contrib.import-static"/>
      <arg value="clojure.contrib.javadoc"/>
      <arg value="clojure.contrib.lazy-seqs"/>
      <arg value="clojure.contrib.memoize"/>
      <arg value="clojure.contrib.mmap"/>
      <arg value="clojure.contrib.ns-utils"/>
      <arg value="clojure.contrib.pred"/>
      <arg value="clojure.contrib.repl-ln"/>
      <arg value="clojure.contrib.seq-utils"/>
      <arg value="clojure.contrib.sql.internal"/>
      <arg value="clojure.contrib.sql"/>
      <arg value="clojure.contrib.str-utils"/>
      <arg value="clojure.contrib.test-is"/>
      <arg value="clojure.contrib.trace"/>
      <arg value="clojure.contrib.zip-filter"/>
    </java>
  </target>

  <target name="jar" description="Create jar file." depends="compile_clojure">
    <jar jarfile="${jarfile}">
      <path location="CPL.txt"/>
      <fileset dir="${src}" includes="**/*.clj"/>
      <fileset dir="${build}" includes="**/*.class"/>
      <manifest>
        <attribute name="Class-Path" value="."/>
      </manifest>
    </jar>
  </target>

</project>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to