-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
122 lines (107 loc) · 5.02 KB
/
Copy pathbuild.xml
File metadata and controls
122 lines (107 loc) · 5.02 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Apache Ant build for ResForge (an alternative to the Gradle build).
This mirrors what the Gradle build does, using vendored JUnit 5 jars in lib/
(Ant has no built-in dependency manager). Output goes to build-ant/ so it
never clashes with Gradle's build/.
Common targets:
ant - (default) compile + build the jar, no tests
ant jar - same as the default: build the runnable jar (build-ant/libs/)
ant compile - compile main sources only
ant test - compile and run the JUnit 5 tests
ant build - jar + tests (the full verify)
ant gui - compile and launch the graphical editor
ant run -Dargs="info samples/apple.res" - run the CLI
ant clean - remove build-ant/
Requires JDK 21. If your JAVA_HOME is set, point it at the JDK *root*
(not the \bin sub-directory).
-->
<project name="resforge" default="jar" basedir=".">
<property name="version" value="0.1.0"/>
<property name="main.class" value="resforge.Main"/>
<property name="args" value=""/>
<property name="src.dir" value="src/main/java"/>
<property name="test.src.dir" value="src/test/java"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build-ant"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="test.classes.dir" value="${build.dir}/test-classes"/>
<property name="jar.dir" value="${build.dir}/libs"/>
<property name="test.reports.dir" value="${build.dir}/test-results"/>
<property name="jar.file" value="${jar.dir}/resforge-${version}.jar"/>
<!-- Vendored JUnit 5 jars (copied from the Gradle cache). -->
<path id="junit.classpath">
<fileset dir="${lib.dir}" includes="*.jar"/>
</path>
<!-- Runtime libraries bundled into the app: the JOrbis Ogg-Vorbis decoder. -->
<path id="runtime.libs">
<fileset dir="${lib.dir}" includes="jorbis-*.jar"/>
</path>
<target name="clean" description="Remove the Ant build output">
<delete dir="${build.dir}"/>
</target>
<target name="compile" description="Compile main sources">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}"
includeantruntime="false" release="21" debug="true" encoding="UTF-8">
<classpath refid="runtime.libs"/>
<compilerarg value="-Xlint:none"/>
</javac>
</target>
<target name="jar" depends="compile" description="Build the runnable jar">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.file}">
<fileset dir="${classes.dir}"/>
<!-- Fold the JOrbis decoder classes in so `java -jar` works standalone. -->
<zipgroupfileset dir="${lib.dir}" includes="jorbis-*.jar"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
</target>
<target name="compile-tests" depends="compile" description="Compile test sources">
<mkdir dir="${test.classes.dir}"/>
<javac srcdir="${test.src.dir}" destdir="${test.classes.dir}"
includeantruntime="false" release="21" debug="true" encoding="UTF-8">
<classpath>
<pathelement location="${classes.dir}"/>
<path refid="junit.classpath"/>
</classpath>
</javac>
</target>
<target name="test" depends="compile-tests" description="Run the JUnit 5 tests">
<mkdir dir="${test.reports.dir}"/>
<junitlauncher printSummary="true" haltOnFailure="true">
<classpath>
<pathelement location="${classes.dir}"/>
<pathelement location="${test.classes.dir}"/>
<path refid="junit.classpath"/>
</classpath>
<testclasses outputdir="${test.reports.dir}">
<fileset dir="${test.classes.dir}">
<include name="**/*Test.class"/>
</fileset>
<listener type="legacy-plain" sendSysOut="true"/>
</testclasses>
</junitlauncher>
</target>
<target name="build" depends="jar,test" description="Build the jar and run the tests"/>
<target name="run" depends="compile" description="Run the CLI; pass args with -Dargs="..."">
<java classname="${main.class}" fork="true" failonerror="true">
<classpath>
<pathelement location="${classes.dir}"/>
<path refid="runtime.libs"/>
</classpath>
<arg line="${args}"/>
</java>
</target>
<target name="gui" depends="compile" description="Launch the graphical editor (detached)">
<java classname="${main.class}" fork="true" spawn="true">
<classpath>
<pathelement location="${classes.dir}"/>
<path refid="runtime.libs"/>
</classpath>
</java>
<echo message="Launched the ResForge GUI."/>
</target>
</project>