-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
94 lines (79 loc) · 3.39 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
<project name="Java preprocessor" default="dist" basedir=".">
<description>
Java preprocessor based on FreeMarker
</description>
<!-- set global properties for this build -->
<property name="src.dir" location="src"/>
<property name="build.dir" location="build"/>
<property name="dist.dir" location="dist"/>
<property name="lib.dir" location="lib"/>
<property name="resources.dir" location="resources"/>
<property name="preprocessed.dir" location="sample/preprocessed"/>
<property name="jar.file" location="jpp.jar"/>
<property name="main-class" value="org.owsiak.preprocessor.JavaPreprocessor"/>
<property name="args" value=""/>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${lib.dir}"/>
<!-- Get all the jars we need -->
<get src="http://repo.maven.apache.org/maven2/org/freemarker/freemarker/2.3.28/freemarker-2.3.28.jar"
dest="${lib.dir}/freemarker-2.3.28.jar" skipexisting="true"/>
<get src="http://repo.maven.apache.org/maven2/commons-cli/commons-cli/1.4/commons-cli-1.4.jar"
dest="${lib.dir}/commons-cli-1.4.jar" skipexisting="true"/>
<get src="http://repo.maven.apache.org/maven2/org/apache/logging/log4j/log4j-core/2.11.1/log4j-core-2.11.1.jar"
dest="${lib.dir}/log4j-core-2.11.1.jar" skipexisting="true"/>
<get src="http://repo.maven.apache.org/maven2/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar"
dest="${lib.dir}/log4j-api-2.11.1.jar" skipexisting="true"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Classpath is used here (for compilation) and later,
when manifest info is created -->
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<!-- Compile the java code from ${src.dir} into ${build.dir} -->
<javac srcdir="${src.dir}"
destdir="${build.dir}"
debug="true"
classpathref="classpath"
includeantruntime="false">
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist.dir}"/>
<manifestclasspath property="lib.list" jarfile="${jar.file}" maxParentLevels="0">
<classpath refid="classpath"/>
</manifestclasspath>
<jar jarfile="${jar.file}" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
<attribute name="Class-Path" value="${lib.list}"/>
</manifest>
<fileset dir="." includes="lib/**"/>
<fileset dir="${resources.dir}" includes="log4j2.xml" />
</jar>
<move file="${jar.file}" todir="${dist.dir}"/>
</target>
<target name="clean"
description="clean up" >
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="clean-all"
description="clean up everything" depends="clean">
<delete dir="${preprocessed.dir}"/>
<delete dir="${lib.dir}"/>
</target>
<target name="run" depends="dist">
<mkdir dir="${preprocessed.dir}"/>
<java jar="${dist.dir}/${jar.file}" fork="true">
<arg line="${args}"/>
</java>
</target>
</project>