forked from jle/mustache.ant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
91 lines (74 loc) · 3.69 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2013 Jonathan Le
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="mustache.ant" basedir="." default="run">
<property name="project.version">1.0.0</property>
<property name="bin.dir" value="target"/>
<property name="src.dir" value="src"/>
<property name="lib.dir" value="lib" />
<property name="build.dir" value="${bin.dir}/classes"/>
<path id="run.path.id">
<path refid="lib.path.id" />
<path location="${build.dir}" />
</path>
<path id="lib.path.id">
<fileset dir="${lib.dir}" />
</path>
<property name="ivy.install.version" value="2.1.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="compile" description="Compiles the Task" depends="resolve">
<mkdir dir="${build.dir}" />
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="lib.path.id" includeAntRuntime="false"/>
</target>
<target name="package" description="JARs the Task" depends="compile">
<ivy:info/>
<property name="out.jar" value="${bin.dir}/${ivy.module}-${ivy.revision}.jar"/>
<jar destfile="${out.jar}" basedir="${build.dir}"/>
</target>
<target name="run" description="Run the Task" depends="package">
<taskdef name="mustache" classname="com.vandalsoftware.MustacheTask"
classpathref="run.path.id"/>
<mustache yml="example.yml" file="example.mustache" tofile="target/example.xml"/>
</target>
<target name="resolve" description="Retrieve dependencies with ivy" depends="init-ivy">
<ivy:retrieve sync="true"/>
</target>
<target name="clean" description="Delete all generated files">
<delete failonerror="false" includeEmptyDirs="true">
<fileset dir="${bin.dir}"/>
<fileset dir="${lib.dir}"/>
</delete>
</target>
</project>