Skip to content

Commit 178bfcc

Browse files
authored
Create javadoc and preflight targets
javadoc target produces API documentation using javadoc tool. preflight target supports debugging issues regarding Java versions.
2 parents 3a113f3 + 27ff1f1 commit 178bfcc

1 file changed

Lines changed: 43 additions & 2 deletions

File tree

build.xml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99
<property name="build.dir" value="build/classes"/>
1010
<property name="jar.dir" value="build/jar"/>
1111
<property name="dist.dir" value="dist"/>
12+
<property name="docs.dir" value="build/docs"/>
13+
14+
<!-- Javadoc external API links. Uses the JDK running Ant; no hard-coded Java version. -->
15+
<condition property="javadoc.api.url" value="https://docs.oracle.com/javase/8/docs/api/">
16+
<equals arg1="${java.specification.version}" arg2="1.8"/>
17+
</condition>
18+
<condition property="javadoc.api.url" value="https://docs.oracle.com/en/java/javase/${java.specification.version}/docs/api/">
19+
<not>
20+
<equals arg1="${java.specification.version}" arg2="1.8"/>
21+
</not>
22+
</condition>
23+
1224

1325
<condition property="isMac">
1426
<os family="mac"/>
@@ -25,12 +37,20 @@
2537
<isset property="isMac"/>
2638
</condition>
2739

40+
<target name="preflight" description="Print toolchain/OS info">
41+
<echo message="Java: ${java.runtime.name} ${java.runtime.version}"/>
42+
<echo message="Java Vendor: ${java.vendor}"/>
43+
<echo message="Java Home: ${java.home}"/>
44+
<echo message="Java Spec Version: ${java.specification.version}"/>
45+
<echo message="OS: ${os.name} ${os.version} (${os.arch})"/>
46+
</target>
47+
2848
<target name="clean" description="Remove all build and distribution files">
2949
<delete dir="build"/>
3050
<delete dir="${dist.dir}"/>
3151
</target>
3252

33-
<target name="compile" description="Compile Java source code">
53+
<target name="compile" depends="preflight" description="Compile Java source code">
3454
<mkdir dir="${build.dir}"/>
3555
<javac srcdir="${src.dir}"
3656
destdir="${build.dir}"
@@ -52,6 +72,28 @@
5272
<java jar="${jar.dir}/${app.name}.jar" fork="true"/>
5373
</target>
5474

75+
<target name="javadoc" depends="preflight" description="Generate Javadoc (works for unnamed or named packages)">
76+
<mkdir dir="${docs.dir}"/>
77+
<javadoc destdir="${docs.dir}"
78+
source="1.8"
79+
encoding="UTF-8"
80+
use="true"
81+
author="true"
82+
version="true"
83+
failonerror="true">
84+
<fileset dir="${src.dir}" includes="**/*.java"/>
85+
86+
<link href="${javadoc.api.url}"/>
87+
<!-- Uncomment to resolve references in Javadoc comments. -->
88+
<!--
89+
<classpath>
90+
<pathelement path="${build.dir}"/>
91+
<fileset dir="lib" includes="**/*.jar"/>
92+
</classpath>
93+
-->
94+
</javadoc>
95+
</target>
96+
5597
<target name="package" description="Build the native installer for the current OS (DMG or DEB)">
5698
<antcall target="dmg"/>
5799
<antcall target="debian"/>
@@ -68,7 +110,6 @@
68110
<arg value="--type"/><arg value="dmg"/>
69111
<arg value="--icon"/><arg value="${icon.file}"/>
70112
<arg value="--app-version"/><arg value="${app.version}"/>
71-
72113
<arg value="--mac-package-name"/><arg value="${app.name}"/>
73114
<arg value="--mac-package-identifier"/><arg value="com.example.${app.name}"/>
74115
</exec>

0 commit comments

Comments
 (0)