Something went wrong on our end
-
Brutzman, Don authoredBrutzman, Don authored
build.xml 20.07 KiB
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="open-dis7-java" default="default" basedir="." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3">
<description>Builds, tests, and runs the open-dis7-java project.</description>
<import file="nbproject/build-impl.xml"/>
<tstamp>
<format property="timestamp" pattern="d MMMM yyyy HH:mm:ss"/>
</tstamp>
<!-- javadoc manifest properties -->
<property name="manifest.name" value="OpenDIS7 Protocol Data Units (PDUs)"/>
<property name="Built-By" value="https://github.com/open-dis/open-dis7-java"/>
<property name="Specification-Title" value="IEEE Distributed Interactive Simulation (DIS) Protocol"/>
<property name="Specification-Version" value="7"/>
<property name="Specification-Vendor" value="Institute of Electrical and Electronics Engineers (IEEE)"/>
<property name="Implementation-Title" value="edu.nps.moves.dis7"/>
<property name="Implementation-Version" value="${timestamp}"/>
<property name="Implementation-Vendor" value="Naval Postgraduate School (NPS)"/>
<target description="Build and test whole project." name="all">
<echo message="timestamp ${timestamp}"/>
<antcall target="clean"/>
<echo message="================"/>
<antcall target="compile"/>
<echo message="================"/>
<echo message="TODO: test suite cleanups, individual programs are runnable OK"/>
<antcall target="test"/>
<echo message="================"/>
<antcall target="javadoc"/>
<echo message="================"/>
<antcall target="jar"/>
<echo message="build all complete"/>
</target>
<target name="clean-pduLog" description="clean recorded pduLog files">
<delete verbose="true">
<fileset dir="pduLog">
<include name="*.dislog"/>
</fileset>
</delete>
</target>
<target name="clean" description="clean assets created by this project">
<mkdir dir="dist" description="ensure necessary directory present"/>
<delete verbose="true">
<fileset dir="dist">
<include name="open-dis7-pdus-classes.jar"/>
<include name="open-dis7-pdus-source.jar"/>
<include name="open-dis7-pdus-javadoc.jar"/>
<exclude name="open-dis7-enumerations-classes.jar"/>
<exclude name="open-dis7-enumerations-source.jar"/>
<exclude name="open-dis7-enumerations-javadoc.jar"/>
<exclude name="README.md"/>
</fileset>
</delete>
<delete dir="javadoc"/>
<mkdir dir="build/classes" description="ensure necessary directory present"/>
<delete verbose="false" includeemptydirs="false">
<fileset dir="build/classes" includes="**/*"/>
</delete>
</target>
<target name="clean-build">
<echo message="warning: be judicious about clean-build, full recompilation may require multiple compilation loops afterward"/>
<mkdir dir="build" description="ensure necessary directory present"/>
<delete includeemptydirs="true" verbose="false">
<fileset dir="build" includes="**/*"/>
</delete>
</target>
<target name="compile" description="compile all assets">
<echo message="compile src, src-generated"/>
<mkdir dir="build/classes" description="ensure build/classes directory present"/>
<javac destdir="build/classes"
debug="on"
source="1.8"
target="1.8"
includeantruntime="false">
<src>
<pathelement path="src"/>
<pathelement path="src-generated"/>
</src>
<classpath>
<pathelement path="dist/open-dis7-enumerations-classes.jar"/>
<pathelement path="lib/commons-io-2.6.jar"/>
<pathelement path="lib/guava-28.0-jre.jar"/>
</classpath>
<!-- https://ant.apache.org/manual/Tasks/javac.html#bootstrap -->
<!-- https://stackoverflow.com/questions/4134803/ant-passing-compilerarg-into-javac -->
<!-- https://stackoverflow.com/questions/20174355/how-class-loading-is-done-by-using-xbootclasspath-ppath -->
<!-- https://stackoverflow.com/questions/48148607/how-to-add-a-jar-to-the-boot-classpath-in-java-9 -->
<!-- -Xbootclasspath/p became -Xbootclasspath/a in jdk 9 -->
<compilerarg value="-Xbootclasspath/p:${toString:lib.path.ref}"/>
</javac>
</target>
<target name="javadoc">
<javadoc classpath="${build.classes.dir}"
destdir="javadoc"
useexternalfile="yes"
verbose="false">
<!-- useexternalfile="yes" avoids command error: filename or extension is too long -->
<fileset dir="." defaultexcludes="yes">
<include name="src/**/*.java"/>
<include name="src-generated/**/*.java"/>
</fileset>
<classpath>
<pathelement path="lib/commons-io-2.6.jar"/>
<pathelement path="lib/guava-28.0-jre.jar"/>
</classpath>
</javadoc>
</target>
<target name="view.issues.online" description="view online issues in web browser (Netbeans only)">
<echo message="https://github.com/open-dis/open-dis7-java/issues" />
<nbbrowse url="https://github.com/open-dis/open-dis7-java/issues" />
<!-- TODO implementation-independent approach if possible, but note that other Ant approaches usually have to be customized for each OS. -->
</target>
<target name="view.javadoc.local" description="view local package javadoc in web browser (Netbeans only)">
<nbbrowse file="javadoc/index.html" />
<!-- TODO implementation-independent approach if possible, but note that other Ant approaches usually have to be customized for each OS. -->
</target>
<target name="processScenes.javadoc.donotrun"><!-- copied as potential template -->
<property name="javadoc.windowtitle" value="${archive.name} Examples Archive Javadoc using X3DJSAIL, X3D Java Scene Access Interface Library"/>
<property name="javadoc.doctitle" value="${archive.name} Examples Archive Javadoc"/>
<property name="javadoc.additionalparam" value=""/>
<property name="javadoc.author" value="Don Brutzman brutzman@nps.edu"/>
<property name="javadoc.dir" value="javadoc"/>
<property name="javadoc.encoding" value="ISO-8859-1"/>
<property name="javadoc.copyright" value="Copyright ©2005-2020 <a href='https://www.web3d.org'>Web3D Consortium</a> under an <a href='../../../../license.html'>open-source license</a>, free for any use. <a href='mailto:x3d-public@web3D.org,brutzman@nps.edu?subject=X3D%20Examples%20Archive%20X3DJSAIL%20feedback'>Feedback</a> is welcome."/>
<property name="javadoc.noindex" value="false"/>
<property name="javadoc.nonavbar" value="false"/>
<property name="javadoc.notree" value="false"/>
<property name="javadoc.private" value="false"/>
<property name="javadoc.splitindex" value="true"/>
<property name="javadoc.breakiterator" value="true"/>
<property name="javadoc.use" value="true"/><!-- Create class and package usage pages -->
<property name="javadoc.version" value="true"/>
<javadoc destdir="${javadoc.dir}"
author="${javadoc.author}"
bottom="${javadoc.copyright}"
breakiterator="${javadoc.breakiterator}"
classpath="${x3djsail.stylesheets.dir}/${jsai.full.archive.jar.name}"
Encoding="${javadoc.encoding}"
Doctitle="${javadoc.doctitle}"
Header="${javadoc.doctitle}"
maxmemory="4096m"
noindex="${javadoc.noindex}"
nonavbar="${javadoc.nonavbar}"
notree="${javadoc.notree}"
Overview="${javadoc.dir}/overview.html"
Private="${javadoc.private}"
source="${java.source}"
Splitindex="${javadoc.splitindex}"
Use="${javadoc.use}"
useexternalfile="yes"
verbose="true"
version="${javadoc.version}"
Windowtitle="${javadoc.windowtitle}">
<fileset dir="." defaultexcludes="yes">
<include name="src/**/*.java"/>
<include name="src-generated/**/*.java"/>
<!-- latest enumerations are found in src-generated -->
<exclude name="**/*.html"/>
</fileset>
</javadoc>
</target>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="open-dis7-java-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
<!--
TODO Terry please confirm or improve this comment block
JUnit 5 is not perfectly supported in Netbeans 11 at this time. This
technique will enable the "Test Project" choice in the "Run" menu to properly
run junit 5 test. Running in other ways, such as individually, doesn't seem
to work. https://blogs.apache.org/netbeans/entry/junit-5-apache-ant-and
Porting this project over to Maven might do the trick. NB supports right
click, test-single for Maven. TDN 08 JUN 2020.
-->
<target name="jar">
<!-- javadoc manifest properties -->
<echo message="manifest.name = ${manifest.name}"/>
<echo message="Built-By = ${Built-By}"/>
<echo message="Specification-Title = ${Specification-Title}"/>
<echo message="Specification-Version = ${Specification-Version}"/>
<echo message="Specification-Vendor = ${Specification-Vendor}"/>
<echo message="Implementation-Title = ${Implementation-Title}"/>
<echo message="Implementation-Version = ${timestamp}"/>
<echo message="Implementation-Vendor = ${Implementation-Vendor}"/>
<antcall target="jar-classes"/>
<antcall target="jar-source"/>
<antcall target="jar-javadoc"/>
</target>
<target name="jar-javadoc"> <!-- depends="javadoc" -->
<jar destfile="dist/open-dis7-pdus-javadoc.jar"
update="true"
basedir="javadoc">
<!-- https://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html -->
<manifest>
<attribute name="description" value="Javadoc files for ${manifest.name}"/>
<attribute name="Built-By" value="${Built-By}"/>
<attribute name="Specification-Title" value="${Specification-Title}"/>
<attribute name="Specification-Version" value="${Specification-Version}"/>
<attribute name="Specification-Vendor" value="${Specification-Vendor}"/>
<attribute name="Implementation-Title" value="${Implementation-Title}"/>
<attribute name="Implementation-Version" value="${Implementation-Version}"/>
<attribute name="Implementation-Vendor" value="${Implementation-Vendor}"/>
<section name="edu/nps/moves/dis7">
<attribute name="Sealed" value="true"/>
</section>
</manifest>
</jar>
</target>
<target name="jar-source">
<jar destfile="dist/open-dis7-pdus-source.jar"
includes="edu/nps/moves/dis7/**"
excludes=".keep"
update="true"
zip64Mode="always">
<fileset dir="src" defaultexcludes="yes">
<include name="**/*.java"/>
<include name="**/*.md"/>
<include name="**/*.txt"/>
<include name="**/*.dislog"/>
</fileset>
<fileset dir="src-generated">
<include name="**/dis7/*.java"/>
<include name="**/dis7/**/*.java"/>
<!-- avoid duplicating enumerations classes, which are maintained in separate jars -->
<exclude name="**/entities/**/*.java"/>
<exclude name="**/entitytypes/**/*.java"/>
<exclude name="**/enumerations/**/*.java"/>
<exclude name="**/jammers/**/*.java"/>
<exclude name="**/objecttypes/**/*.java"/>
<exclude name="**/*.undef/**/*.java"/>
</fileset>
<!-- https://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html -->
<manifest>
<attribute name="description" value="Java source files for ${manifest.name}"/>
<attribute name="Built-By" value="${Built-By}"/>
<attribute name="Specification-Title" value="${Specification-Title}"/>
<attribute name="Specification-Version" value="${Specification-Version}"/>
<attribute name="Specification-Vendor" value="${Specification-Vendor}"/>
<attribute name="Implementation-Title" value="${Implementation-Title}"/>
<attribute name="Implementation-Version" value="${Implementation-Version}"/>
<attribute name="Implementation-Vendor" value="${Implementation-Vendor}"/>
<section name="edu/nps/moves/dis7">
<attribute name="Sealed" value="true"/>
</section>
</manifest>
</jar>
</target>
<target name="jar-classes">
<jar destfile="dist/open-dis7-pdus-classes.jar"
basedir="."
includes="edu/nps/moves/dis7/**"
excludes=".keep"
update="true"
zip64Mode="always">
<fileset dir="build/classes" defaultexcludes="yes">
<include name="**/dis7*.class"/>
<include name="**/dis7/**/*.class"/>
<!-- avoid duplicating enumerations classes, which are maintained in separate jars -->
<exclude name="**/entities/**/*.class"/>
<exclude name="**/entitytypes/**/*.class"/>
<exclude name="**/enumerations/**/*.class"/>
<exclude name="**/jammers/**/*.class"/>
<exclude name="**/objecttypes/**/*.class"/>
<exclude name="**/objecttypes.undef/**/*"/>
</fileset>
<!-- https://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html -->
<manifest>
<attribute name="description" value="Java class files for ${manifest.name}"/>
<attribute name="Built-By" value="${Built-By}"/>
<attribute name="Specification-Title" value="${Specification-Title}"/>
<attribute name="Specification-Version" value="${Specification-Version}"/>
<attribute name="Specification-Vendor" value="${Specification-Vendor}"/>
<attribute name="Implementation-Title" value="${Implementation-Title}"/>
<attribute name="Implementation-Version" value="${Implementation-Version}"/>
<attribute name="Implementation-Vendor" value="${Implementation-Vendor}"/>
<section name="edu/nps/moves/dis7">
<attribute name="Sealed" value="true"/>
</section>
</manifest>
</jar>
</target>
<!-- special test harness for JUnit5 by Terry Norbraten -->
<target depends="compile-test,-pre-test-run"
description="Run unit tests."
name="test" >
<java classpath="${run.test.classpath}"
classname="org.junit.platform.console.ConsoleLauncher"
fork="true">
<arg value="--disable-banner"/>
<arg value="--fail-if-no-tests"/>
<arg value="--scan-classpath=${build.test.classes.dir}"/>
<arg value="--reports-dir=${build.test.results.dir}"/>
</java>
<junitreport todir="build/test/results">
<fileset dir="build/test/results">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="build/test/results/html"/>
</junitreport>
</target>
<target depends="compile-test-single,-pre-test-run-single"
description="Run single unit test."
name="-do-test-run-single">
<echo message="Testing: ${test.class}"/>
<java classpath="${run.test.classpath}"
classname="org.junit.platform.console.ConsoleLauncher"
fork="true">
<arg value="--disable-banner"/>
<arg value="--fail-if-no-tests"/>
<arg line="-c=${test.class}"/>
<!--<arg value="-h"/>-->
</java>
</target>
</project>