-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
82 lines (69 loc) · 3.1 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="fibonacci" default="build" basedir=".">
<property environment="env" />
<property name="main-source.dir" value="${basedir}/src/main" />
<property name="target.dir" value="${basedir}/target" />
<property name="target.managed.dir" value="${basedir}/target/${ant.project.name}" />
<!-- Starting with version 0.35.0 Flix generates the jar file into directory 'artifact'. -->
<property name="target.jar" value="${target.managed.dir}/artifact/${ant.project.name}.jar" />
<property name="test-source.dir" value="${basedir}/src/test" />
<property name="test-target.txt" value="${target.managed.dir}/${ant.project.name}.txt" />
<pathconvert property="flix.jar">
<fileset dir="${env.FLIX_HOME}" includes="**/flix.jar" />
</pathconvert>
<target name="-pre-init">
<available file="${target.managed.dir}/build" type="dir" property="build.present" />
<uptodate property="action.notRequired" targetfile="${target.jar}">
<srcfiles dir="${main-source.dir}" includes="**/*.flix"/>
</uptodate>
<uptodate property="test-action.notRequired" targetfile="${test-target.txt}">
<srcfiles dir="${main-source.dir}" includes="**/*.flix"/>
<srcfiles dir="${test-source.dir}" includes="**/*.flix"/>
</uptodate>
</target>
<target name="init" depends="-pre-init" unless="${build.present}">
<mkdir dir="${target.managed.dir}" />
<java fork="true" jar="${flix.jar}" dir="${target.managed.dir}">
<arg value="init" />
</java>
<delete>
<fileset dir="${target.managed.dir}/src" includes="**/*.flix"/>
<fileset dir="${target.managed.dir}/test" includes="**/*.flix"/>
</delete>
<copy todir="${target.managed.dir}/src">
<fileset dir="${main-source.dir}" includes="*.flix" />
</copy>
</target>
<target name="build" depends="init" unless="${action.notRequired}">
<java fork="true" jar="${flix.jar}" dir="${target.managed.dir}">
<arg value="build" />
</java>
<java fork="true" jar="${flix.jar}" dir="${target.managed.dir}">
<arg value="build-jar" />
</java>
</target>
<target name="run" depends="build">
<java fork="true" jar="${target.jar}" >
<!-- <arg value="1" /> -->
<classpath>
<pathelement location="${flix.jar}" />
</classpath>
</java>
</target>
<target name="init-test" depends="init" unless="${test-action.notRequired}">
<copy todir="${target.managed.dir}/test">
<fileset dir="${test-source.dir}" includes="**/*.flix" />
</copy>
</target>
<target name="build-test" depends="init-test, build">
<touch file="${test-target.txt}" />
</target>
<target name="test" depends="build-test">
<java fork="true" jar="${flix.jar}" dir="${target.managed.dir}">
<arg value="test" />
</java>
</target>
<target name="clean">
<delete dir="${target.dir}"/>
</target>
</project>