-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
137 lines (122 loc) · 6.06 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
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="FITA-View" basedir="." default="build">
<tstamp>
<format property="date.version" pattern="yyMMdd" locale="en,GB" />
</tstamp>
<property name="major.version" value="2" />
<property name="minor.version" value="2" />
<property name="spec.version" value="${major.version}.${minor.version}" />
<property name="jar.version" value="${major.version}.${minor.version}.${date.version}" />
<property name="vendor" value="Rafał Kaleta" />
<property name="main.package" value="fitaview" />
<property name="src.dir" value="src/main/java" />
<property name="resources.dir" value="src/main/resources" />
<property name="test.dir" value="src/test/java" />
<property name="test.resources.dir" value="src/test/resources" />
<property name="ant.output.dir" value="antBuild" />
<property name="build.dir" value="${ant.output.dir}/bin" />
<property name="dist.dir" value="${ant.output.dir}/dist" />
<property name="junit.output.dir" value="${ant.output.dir}/junit" />
<property name="junit.result.dir" value="${junit.output.dir}/result" />
<property name="junit.report.dir" value="${junit.output.dir}/report" />
<property name="javadoc.output.dir" value="${ant.output.dir}/docs" />
<property name="jar.file" value="${main.package}-${jar.version}.jar" />
<property name="exec.file" value="fita-view" />
<property name="exec.path" value="${ant.output.dir}/${exec.file}" />
<property name="ivy.lib.dir" value="ivyLib" />
<property name="ivy.install.version" value="2.5.2" />
<path id="project.classpath">
<fileset dir="${ivy.lib.dir}" includes="*.jar" />
<pathelement location="${build.dir}" />
</path>
<target name="download-ivy" unless="offline">
<delete dir="${ivy.lib.dir}" />
<mkdir dir="${ivy.lib.dir}" />
<get
src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.lib.dir}/ivy-${ivy.install.version}.jar" usetimestamp="true" />
</target>
<target name="resolve" depends="download-ivy" description="Resolve dependencies">
<path id="ivy.lib.path">
<fileset dir="${ivy.lib.dir}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"
classpathref="ivy.lib.path" />
<ivy:retrieve />
</target>
<target name="clean" description="Remove additional build files">
<delete dir="${ant.output.dir}" />
</target>
<target name="init">
<mkdir dir="${build.dir}" />
<copy includeemptydirs="false" todir="${build.dir}">
<fileset dir="${resources.dir}" erroronmissingdir="false" />
<fileset dir="${test.resources.dir}" erroronmissingdir="false" />
</copy>
</target>
<target name="compile" depends="init">
<echo level="info" message="Java version is ${ant.java.version}" />
<javac destdir="${build.dir}" includeantruntime="false">
<src path="${src.dir}" />
<src path="${test.dir}" />
<compilerarg line="-Xlint" />
<classpath refid="project.classpath" />
</javac>
</target>
<target name="jar" depends="compile"
description="Compile source files & Create executable jar">
<jar destfile="${dist.dir}/${jar.file}" basedir="${build.dir}" excludes="**/*Test.class">
<zipgroupfileset dir="${ivy.lib.dir}" includes="*.jar" />
<manifest>
<attribute name="Built-By" value="${vendor}" />
<attribute name="Main-Class" value="${main.package}.FITAView" />
<attribute name="Specification-Title" value="Finite and Infinite Tree Automata Viewer" />
<attribute name="Specification-Version" value="${spec.version}" />
<attribute name="Specification-Vendor" value="${vendor}" />
<attribute name="Implementation-Title" value="${main.package}" />
<attribute name="Implementation-Version" value="${jar.version}" />
<attribute name="Implementation-Vendor" value="${vendor}" />
</manifest>
</jar>
</target>
<target name="execfile" depends="jar">
<echo level="info" message="Building file: ${basedir}/${exec.path}" />
<echo file="${exec.path}"
message="#! /bin/sh${line.separator}${line.separator}java -jar $(dirname "$0")/../${dist.dir}/${jar.file} $@" />
<chmod file="${exec.path}" perm="+x" />
</target>
<target name="test" description="Run all tests">
<mkdir dir="${junit.result.dir}" />
<junit fork="yes" printsummary="withOutAndErr" failureproperty="junit.failure"
errorproperty="junit.error">
<formatter type="xml" />
<batchtest todir="${junit.result.dir}">
<fileset dir="${test.dir}" includes="**/*Test.java" />
</batchtest>
<classpath refid="project.classpath" />
<jvmarg line="--add-opens java.base/java.lang=ALL-UNNAMED" />
<jvmarg line="--add-opens java.base/java.util=ALL-UNNAMED" />
<jvmarg line="--add-opens java.desktop/java.awt=ALL-UNNAMED" />
<jvmarg line="--add-opens java.desktop/javax.swing=ALL-UNNAMED" />
</junit>
<mkdir dir="${junit.report.dir}" />
<junitreport todir="${junit.report.dir}">
<fileset dir="${junit.result.dir}" includes="TEST-*.xml" />
<report format="frames" todir="${junit.report.dir}" />
</junitreport>
<fail if="junit.failure" message="JUnit test(s) failed" />
<fail if="junit.error" message="JUnit test(s) threw an error" />
</target>
<target name="docs" description="Generate Javadoc">
<mkdir dir="${javadoc.output.dir}" />
<javadoc sourcepath="${src.dir}" destdir="${javadoc.output.dir}" access="public"
classpathref="project.classpath">
<package name="${main.package}.*" />
<arg value="-Xdoclint:none" />
</javadoc>
</target>
<target name="build" depends="resolve, execfile, test"
description="Resolve dependencies & Compile source files & Create executable jar & Run all tests" />
<target name="rebuild" depends="clean, build"
description="Remove additional build files & Resolve dependencies & Compile source files & Create executable jar & Run all tests" />
</project>