summaryrefslogtreecommitdiff
path: root/build.xml
blob: 690f1e7a49a956eb588022c89b1002f75c3f3f0c (plain)
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
<project name="clojure" default="all" xmlns:mvn="urn:maven-artifact-ant">

  <description>
    Build with "ant jar" and then start the
    REPL with: "java -cp clojure.jar clojure.main".
    You will need to install the Maven Ant
    Tasks to ${ant.home}/lib in order to execute
    the nightly-build or stable-build targets.
  </description>

  <property name="src" location="src"/>
  <property name="jsrc" location="${src}/jvm"/>
  <property name="cljsrc" location="${src}/clj"/>
  <property name="build" location="classes"/>
  <property name="clojure_jar" location="clojure.jar"/>
  <property name="slim_jar" location="clojure-slim.jar"/>
  <property name="src_jar" location="clojure-sources.jar"/>
  <property name="clojure.assert-if-lazy-seq" value=""/>

  <!-- These make sense for building on tapestry.formos.com -->

  <property name="snapshot.repo.dir" location="/var/www/maven-snapshot-repository"/>
  <property name="stable.repo.dir" location="/var/www/maven-repository"/>

  <target name="init" depends="clean">
    <tstamp/>
    <mkdir dir="${build}"/>
  </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" depends="compile-java"
          description="Compile Clojure sources.">
    <java classname="clojure.lang.Compile"
          classpath="${build}:${cljsrc}">
      <sysproperty key="clojure.compile.path" value="${build}"/>
      <sysproperty key="clojure.assert-if-lazy-seq" value="${clojure.assert-if-lazy-seq}"/>
      <arg value="clojure.core"/>
      <arg value="clojure.main"/>
      <arg value="clojure.set"/>
      <arg value="clojure.xml"/>
      <arg value="clojure.zip"/>
      <arg value="clojure.inspector"/>
    </java>
  </target>

  <target name="clojure" depends="compile-clojure"
          description="Create clojure jar file.">
    <jar jarfile="${clojure_jar}" basedir="${build}">
      <fileset dir="${cljsrc}" includes="**/*.clj"/>
      <manifest>
        <attribute name="Main-Class" value="clojure.main"/>
        <attribute name="Class-Path" value="."/>
      </manifest>
    </jar>
  </target>

  <target name="clojure-slim" depends="compile-java"
          description="Create clojure-slim jar file (omits compiled Clojure code)">
    <jar jarfile="${slim_jar}">
      <fileset dir="${build}" includes="clojure/asm/**"/>
      <fileset dir="${build}" includes="clojure/lang/**"/>
      <fileset dir="${build}" includes="clojure/main.class"/>
      <fileset dir="${cljsrc}" includes="**/*.clj"/>
      <manifest>
        <attribute name="Main-Class" value="clojure.main"/>
        <attribute name="Class-Path" value="."/>
      </manifest>
    </jar>
  </target>

  <target name="clojure-sources" depends="init"
          description="Create a JAR of Java sources.">
    <jar jarfile="${src_jar}" basedir="${jsrc}"/>
  </target>

  <target name="jar" depends="clojure"/>

  <target name="all" depends="clojure,clojure-slim,clojure-sources"/>

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

  <target name="-setup-maven">
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"/>
  </target>

  <macrodef name="deploy">
    <attribute name="target-dir" description="Root of Maven repository"/>
    <sequential>
      <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"/>
      <mvn:deploy file="${clojure_jar}">
        <pom file="pom.xml"/>
        <attach file="${src_jar}" classifier="sources"/>
        <attach file="${slim_jar}" classifier="slim"/>
        <remoteRepository url="file:@{target-dir}"/>
      </mvn:deploy>
    </sequential>
  </macrodef>

  <target name="ci-build" depends="clean,all,-setup-maven"
          description="Continous integration build, installed to local repository.">
    <mvn:install file="${clojure_jar}">
      <pom file="pom.xml"/>
      <attach file="${src_jar}" classifier="sources"/>
      <attach file="${slim_jar}" classifier="slim"/>
    </mvn:install>
  </target>

  <target name="nightly-build" depends="ci-build"
          description="Build and deploy to nightly (snapshot) repository.">
    <deploy target-dir="${snapshot.repo.dir}"/>
  </target>


  <target name="stable-build" depends="ci-build" description="Build and deploy to stable repository.">
    <deploy target-dir="${stable.repo.dir}"/>
  </target>


</project>