Something went wrong on our end
-
Brutzman, Don authored
NetBeans 12.5, clean pdu log before tests, updated build, version 29 of SISO enumerations, build tests sat
Brutzman, Don authoredNetBeans 12.5, clean pdu log before tests, updated build, version 29 of SISO enumerations, build tests sat
build.xml 26.69 KiB
<?xml version="1.0" encoding="UTF-8"?>
<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"/>
<property file="nbproject/project.properties"/>
<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)"/>
<!-- ensure backwards compatibility to specified version of Java -->
<property name="java.source" value="1.8"/>
<property name="java.target" value="1.8"/>
<property name="javadoc.additionalparam" value=""/>
<property name="javadoc.author" value="Don Brutzman brutzman@nps.edu"/>
<property name="javadoc.dir" value="${dist.javadoc.dir}"/>
<property name="javadoc.encoding" value="ISO-8859-1"/>
<property name="javadoc.copyright" value="Copyright ©1995-2021 held by the authors, <a href='https://www.www.nps.edu'>Naval Postgraduate School (NPS)</a> under an <a href='../license.html'>open-source license</a> and free for any use. <a href='mailto:brutzman@nps.edu?subject=open-dis7-java%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.source" value="${java.source}"/>
<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"/>
<property name="javadoc.windowtitle" value="open-dis7 Javadoc"/>
<property name="javadoc.doctitle" value="${javadoc.windowtitle}"/>
<!-- build.impl <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> -->
<target description="Build and test the whole project, create distribution jar files." name="all">
<echo message="timestamp ${timestamp}"/>
<fail message="Please build using Ant 1.10.11 or higher.">
<condition>
<not>
<antversion atleast="1.10.11"/><!-- recommend latest 1.10.+ -->
</not>
</condition>
</fail>
<antcall target="clean"/>
<echo message="================"/>
<antcall target="compile"/>
<echo message="================"/>
<antcall target="javadoc.custom"/>
<echo message="================"/>
<echo message="TODO: test suite cleanups, individual programs are runnable OK"/>
<antcall target="test"/>
<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" depends="init" description="clean assets created by this project">
<delete verbose="true" failonerror="false">
<fileset dir="${dist.dir}">
<include name="open-dis7-pdus-classes.jar"/>
<include name="open-dis7-pdus-source.jar"/>
<include name="open-dis7-pdus-javadoc.jar"/>
<include name="open-dis7-full.zip"/>
<include name="open-dis7-full.jar"/>
<!-- do not delete jar files produced by open-dis7-source-generator -->
<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="${dist.javadoc.dir}" description="get rid of all prior files" failonerror="false"/>
<delete verbose="false" includeemptydirs="false" failonerror="false">
<fileset dir="${build.classes.dir}" includes="**/*"/>
</delete>
</target>
<target name="clean.build">
<!-- should be fixed now... <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="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)">
<echo message="view local javadoc in ${dist.javadoc.dir} subdirectory"/>
<nbbrowse file="${dist.javadoc.dir}/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="view.javadoc.online" description="view online package javadoc in web browser (Netbeans only)">
<echo message="view online javadoc in dist/javadoc subdirectory"/>
<nbbrowse url="https://savage.nps.edu/open-dis7-java/javadoc" />
<!-- TODO implementation-independent approach if possible, but note that other Ant approaches usually have to be customized for each OS. -->
</target>
<target name="javadoc.custom" description="Customized javadoc">
<echo message="$javac.classpath=${javac.classpath}"/>
<javadoc destdir="${javadoc.dir}"
author="${javadoc.author}"
bottom="${javadoc.copyright}"
breakiterator="${javadoc.breakiterator}"
classpath="${x3djsail.stylesheets.dir}/${jsai.full.archive.jar.name};${run.test.classpath}"
Encoding="${javadoc.encoding}"
Doctitle="${javadoc.doctitle}"
Header="${javadoc.doctitle}"
maxmemory="4096m"
noindex="${javadoc.noindex}"
nonavbar="${javadoc.nonavbar}"
notree="${javadoc.notree}"
Overview="src/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"/>
<include name="test/**/*.java"/>
<!-- latest enumerations are found in src-generated -->
<exclude name="**/*.html"/>
</fileset>
</javadoc>
<antcall target="view.javadoc.local"/>
</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" depends="compile">
<!-- 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-pdus-classes"/>
<antcall target="jar-pdus-source"/>
<antcall target="jar-pdus-javadoc"/>
<antcall target="jar-full"/>
<!--<antcall target="zip-full"/>-->
</target>
<target name="zip-full" description="full set of everything, pdus and enumerations">
<!-- TODO README -->
<delete file="${dist.dir}/open-dis7-full.zip"/>
<zip destfile="${dist.dir}/open-dis7-full.zip"
update="true"
zip64Mode="always">
<!-- zip64Mode https://stackoverflow.com/questions/39524481/error-creating-jar-archive-contains-more-than-65535-entries/ -->
<!-- https://stackoverflow.com/questions/515428/clean-way-to-combine-multiple-jars-preferably-using-ant -->
<zipfileset src="${dist.dir}/open-dis7-enumerations-classes.jar"/>
<zipfileset src="${dist.dir}/open-dis7-enumerations-javadoc.jar"/>
<zipfileset src="${dist.dir}/open-dis7-enumerations-source.jar"/>
<zipfileset src="${dist.dir}/open-dis7-pdus-classes.jar"/>
<zipfileset src="${dist.dir}/open-dis7-pdus-javadoc.jar"/>
<zipfileset src="${dist.dir}/open-dis7-pdus-source.jar"/>
<!-- <fileset dir="build" defaultexcludes="yes">
<include name="classes/**/*"/>
<exclude name="test/*"/>
</fileset>-->
<fileset dir="${dist.dir}" defaultexcludes="yes">
<exclude name="javadoc/**"/>
</fileset>
<!-- <fileset dir="src" defaultexcludes="yes">
<include name="**/*"/>
<exclude name="test/*"/>
</fileset>
<fileset dir="src-generated" defaultexcludes="yes">
<include name="**/*"/>
<exclude name="test/*"/>
</fileset>-->
<!-- https://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html -->
<!--
<manifest>
<attribute name="description" value="Full set of 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/**">
<attribute name="Sealed" value="true"/>
</section>
</manifest>
-->
</zip>
</target>
<target name="jar-pdus-javadoc" description="full set of javadoc"> <!-- avoid performing multiple times: depends="javadoc" -->
<echo message="(note that generated javadoc subdirectory is found within ${dist.dir} subdirectory)"/>
<delete file="${dist.dir}/open-dis7-pdus-javadoc.jar"/>
<jar destfile="${dist.dir}/open-dis7-pdus-javadoc.jar"
update="true"
zip64Mode="always">
<fileset dir="${dist.javadoc.dir}" defaultexcludes="yes">
<include name="**/*"/>
<exclude name="edu/nps/moves/dis7/entities/**"/>
<exclude name="edu/nps/moves/dis7/enumerations/**"/>
<exclude name="edu/nps/moves/dis7/jammers/**"/>
<exclude name="edu/nps/moves/dis7/objectTypes/**"/>
</fileset>
<!-- 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/**">
<attribute name="Sealed" value="true"/>
</section>
</manifest>
</jar>
</target>
<target name="jar-pdus-source">
<delete file="${dist.dir}/open-dis7-pdus-source.jar"/>
<jar destfile="${dist.dir}/open-dis7-pdus-source.jar"
update="true"
zip64Mode="always">
<fileset dir="src" defaultexcludes="yes">
<include name="**/*.java"/>
<include name="**/*.md"/>
<include name="**/*.txt"/>
<!--<include name="**/*.dislog"/>-->
<exclude name="edu/nps/moves/dis7/utilities/logs/*"/>
</fileset>
<fileset dir="src-generated" defaultexcludes="yes">
<!-- omitting enumerations directories -->
<include name="edu/nps/moves/dis7/pdus/**"/>
</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-full" depends="compile" description="merges all dis7 subpackage assets">
<delete file="${dist.dir}/open-dis7-full.jar" verbose="false"/>
<!-- https://stackoverflow.com/questions/515428/clean-way-to-combine-multiple-jars-preferably-using-ant -->
<jar destfile="${dist.dir}/open-dis7-full.jar"
update="true"
zip64Mode="always">
<zipgroupfileset dir="${dist.dir}">
<include name="open-dis7-*.jar"/>
<!-- TODO consider whether these dependencies are strictly needed -->
<include name="../lib/commons-io-2.6.jar"/>
<include name="../lib/guava-28.0-jre.jar"/>
<include name="../lib/srm-4.4.0.jar"/>
<!--<exclude name="open-dis7-source.jar"/> only about 30MB, keep it for debugging -->
<exclude name="open-dis7-full.jar"/><!-- not self -->
</zipgroupfileset>
<zipgroupfileset dir="lib">
<include name="commons-io-2.6.jar"/>
<include name="guava-28.0-jre.jar"/>
<include name="srm-4.4.0.jar"/>
</zipgroupfileset>
<!-- https://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html -->
<manifest>
<attribute name="description" value="Full set of assets 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>
<section name="edu/nps/moves/spatial">
<attribute name="Sealed" value="true"/>
</section>
</manifest>
</jar>
</target>
<target name="jar-pdus-classes" depends="compile" description="merges all dis7 subpackage classes except for enumerations">
<delete file="${dist.jar}"/>
<jar destfile="${dist.jar}"
update="true"
zip64Mode="always">
<fileset dir="build/classes" defaultexcludes="yes">
<include name="edu/nps/moves/dis7/examples/*"/>
<include name="edu/nps/moves/dis7/pdus/*"/>
<include name="edu/nps/moves/dis7/utilities/*"/>
<include name="edu/nps/moves/dis7/utilities/stream/*"/>
<include name="edu/nps/moves/legacy/math/*"/>
<include name="edu/nps/moves/spatial/*"/>
<exclude name="edu/nps/moves/dis7/entities/*"/>
<exclude name="edu/nps/moves/dis7/enumerations/*"/>
<exclude name="edu/nps/moves/dis7/jammers/*"/>
<exclude name="edu/nps/moves/dis7/objectTypes/*"/>
<exclude name="**/*.txt"/>
<exclude name="**/*.TXT"/>
<exclude name="**/*.*log"/>
</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>
<section name="edu/nps/moves/spatial">
<attribute name="Sealed" value="true"/>
</section>
</manifest>
</jar>
</target>
<!-- special test harness for JUnit5 by Terry Norbraten -->
<!-- https://blogs.apache.org/netbeans/entry/junit-5-apache-ant-and -->
<target depends="compile-test,-pre-test-run,clean.pduLog"
description="Run unit tests."
name="test" >
<java classpath="${run.test.classpath}"
classname="org.junit.platform.console.ConsoleLauncher"
fork="false">
<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.dir}">
<fileset dir="${build.test.results.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${build.test.results.dir}/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="false">
<arg value="--disable-banner"/>
<arg value="--fail-if-no-tests"/>
<arg line="-c=${test.class}"/>
<!--<arg value="-h"/>-->
</java>
<junitreport todir="${build.test.results.dir}">
<fileset dir="${build.test.results.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${build.test.results.dir}/html"/>
</junitreport>
<!--
<echo message="*** ant sleep 2 seconds..."/>
<sleep seconds="2" description="hoping to avoid intermittent test failures due to network timeout"/>
-->
</target>
<target depends="compile-test-single,-pre-test-run-single"
description="Debug single unit test."
name="-debug-start-debuggee-test">
<java classpath="${run.test.classpath}"
classname="org.junit.platform.console.ConsoleLauncher"
fork="false">
<arg value="--disable-banner"/>
<arg value="--fail-if-no-tests"/>
<arg line="-c=${test.class}"/>
<jvmarg value="-Xdebug" />
<jvmarg value="-Xnoagent" />
<jvmarg value="-Djava.compiler=NONE" />
<jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}" />
</java>
<junitreport todir="${build.test.results.dir}">
<fileset dir="${build.test.results.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${build.test.results.dir}/html"/>
</junitreport>
</target>
</project>