forked from jmcconnell/clojure-ant-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
137 lines (120 loc) · 4.6 KB
/
build.xml
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
135
136
137
<project name="clojure-ant-tasks" default="jar">
<property name="src.dir" location="src/main" />
<property name="classes.dir" location="classes" />
<property name="test.classes.dir" location="${classes.dir}/test" />
<property name="jar.name" value="clojure-ant-tasks.jar" />
<path id="project.classpath">
<pathelement location="${src.dir}" />
<pathelement location="${classes.dir}" />
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
</path>
<path id="test.classpath">
<path refid="project.classpath" />
<pathelement location="${test.classes.dir}" />
<pathelement location="src/test" />
</path>
<target name="clean" description="Remove generated files">
<delete dir="${classes.dir}" />
<delete file="${jar.name}" />
</target>
<!--target name="def-tasks">
<!- - In a real build file using this library, the classnames would not
be in this "bootstrap" package. That is only necessary here to avoid
name conflicts with the classes we're compiling. - ->
<taskdef name="compile-clojure"
classname="com.ubermensch.ant.clojure.bootstrap.CompileTask"
classpath="antlib/clojure-ant-tasks-bootstrap.jar:lib/clojure.jar:lib/clojure-contrib.jar" />
<taskdef name="test-clojure"
classname="com.ubermensch.ant.clojure.bootstrap.TestTask"
classpath="antlib/clojure-ant-tasks-bootstrap.jar:lib/clojure.jar:lib/clojure-contrib.jar" />
</target-->
<!--target name="compile" depends="def-tasks">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}">
<classpath><path refid="project.classpath" /></classpath>
</javac>
<compile-clojure>
<classpath>
<path refid="project.classpath" />
<!- -
<pathelement location="${src.dir}" />
<pathelement location="${classes.dir}" />
<fileset dir="lib">
<include name="**/*.jar" />
</fileset>
- ->
</classpath>
<namespace>com.ubermensch.ant.clojure.namespace</namespace>
<namespace>com.ubermensch.ant.clojure.base-task</namespace>
<namespace>com.ubermensch.ant.clojure</namespace>
</compile-clojure>
</target-->
<target name="compile">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}">
<classpath><path refid="project.classpath" /></classpath>
</javac>
<java classname="clojure.lang.Compile" fork="true"
resultproperty="compile.result">
<classpath>
<path refid="project.classpath" />
<pathelement location="${classes.dir}" />
</classpath>
<sysproperty key="clojure.compile.path" value="${classes.dir}" />
<arg value="com.ubermensch.ant.clojure.namespace" />
<arg value="com.ubermensch.ant.clojure.base-task" />
<arg value="com.ubermensch.ant.clojure.test-task" />
<arg value="com.ubermensch.ant.clojure.compile-task" />
<arg value="com.ubermensch.ant.clojure" />
</java>
<condition property="compile.failure">
<not>
<equals arg1="${compile.result}" arg2="0" />
</not>
</condition>
<fail if="compile.failure" message="compile failed" />
</target>
<target name="test" depends="compile">
<java classname="clojure.main" fork="true" resultproperty="test.result">
<classpath>
<path refid="project.classpath" />
<path refid="test.classpath" />
</classpath>
<arg value="-e" />
<arg value="(require 'com.ubermensch.ant.clojure)
(use 'clojure.test)
(def failed (ref 0)) (declare ^:dynamic orig-report)
(binding [orig-report report
report #(do (if (#{:fail :error} (:type %))
(dosync (commute failed inc)))
(orig-report %))]
(run-all-tests)
(.println System/out)
(System/exit @failed))" />
</java>
<condition property="test.failure">
<not>
<equals arg1="${test.result}" arg2="0" />
</not>
</condition>
<fail if="test.failure" message="test failed" />
</target>
<target name="launch_ng">
<java classname="com.martiansoftware.nailgun.NGServer"
fork="true">
<classpath>
<path refid="test.classpath" />
</classpath>
<arg value="127.0.0.1" />
</java>
</target>
<target name="jar" depends="test">
<jar jarfile="${jar.name}" basedir="${classes.dir}">
<fileset dir="${src.dir}">
<include name="**/*.clj" />
</fileset>
</jar>
</target>
</project>