Permalink
Browse files

Create Ant-based build system

The build system can clean, compile, run tests, build JAR files for each project, and it can also build the JavaDoc and a ZIP distribution file.
  • Loading branch information...
rhauch committed Oct 16, 2015
1 parent 4758a67 commit 4a44c0005a383f20e411d8949db57dab1552ccf1
Showing with 434 additions and 371 deletions.
  1. +2 −0 COPYRIGHT.txt
  2. +113 −0 build-common.xml
  3. +2 −0 build.properties
  4. +114 −0 build.xml
  5. +37 −0 dependencies.xml
  6. +2 −4 strongback-examples/.classpath
  7. +11 −0 strongback-examples/build.xml
  8. 0 strongback-examples/src/{main/java → }/org/strongback/example/simple/SimpleAutoTankDriveRobot.java
  9. 0 strongback-examples/src/{main/java → }/org/strongback/example/simple/SimpleTankDriveRobot.java
  10. +0 −6 strongback-log-processing/.classpath
  11. +0 −17 strongback-log-processing/.project
  12. +0 −183 strongback-log-processing/src/org/frc4931/utils/LogDecoder.java
  13. +1 −1 strongback-testing/.classpath
  14. +10 −0 strongback-testing/build.xml
  15. +1 −1 strongback-testing/src/org/strongback/command/CommandTester.java
  16. +1 −1 strongback-tests/.classpath
  17. +34 −0 strongback-tests/build.xml
  18. +2 −2 strongback-tests/src/org/strongback/component/{DoubleValueTest.java → AbstractDoubleValueTest.java}
  19. +1 −1 strongback-tests/src/org/strongback/component/AngleSensorTest.java
  20. +1 −1 strongback-tests/src/org/strongback/component/DistanceSensorTest.java
  21. +1 −1 strongback-tests/src/org/strongback/mock/{BasicDoubleMockTest.java → AbstractDoubleMockTest.java}
  22. +1 −1 strongback-tests/src/org/strongback/mock/MockAccelerometerTest.java
  23. +1 −1 strongback-tests/src/org/strongback/mock/MockAngleSensorTest.java
  24. +1 −1 strongback-tests/src/org/strongback/mock/MockCompassTest.java
  25. +1 −1 strongback-tools/.classpath
  26. +4 −0 strongback-tools/build.xml
  27. +42 −43 strongback-tools/src/org/strongback/tools/logdecoder/LogDecoder.java
  28. 0 {IncludeInBuild → }/strongback.properties
  29. +1 −1 strongback/.classpath
  30. +4 −0 strongback/build.xml
  31. +11 −13 strongback/src/org/strongback/Strongback.java
  32. +4 −15 strongback/src/org/strongback/StrongbackRequirementException.java
  33. +2 −2 strongback/src/org/strongback/SwitchReactor.java
  34. +4 −21 strongback/src/org/strongback/annotation/Immutable.java
  35. +4 −21 strongback/src/org/strongback/annotation/NotThreadSafe.java
  36. +4 −21 strongback/src/org/strongback/annotation/ThreadSafe.java
  37. +4 −4 strongback/src/org/strongback/command/CommandGroup.java
  38. +2 −2 strongback/src/org/strongback/command/CommandState.java
  39. +1 −1 strongback/src/org/strongback/components/Counter.java
  40. +0 −2 strongback/src/org/strongback/components/LimitedMotor.java
  41. +7 −0 strongback/src/org/strongback/drive/MecanumDrive.java
  42. +1 −1 strongback/src/org/strongback/function/DoubleBiFunction.java
  43. +1 −1 strongback/src/org/strongback/function/IntBiFunction.java
  44. +1 −1 {IncludeInBuild → templates}/.project
  45. 0 {IncludeInBuild → templates}/Robot.java.template
  46. 0 {IncludeInBuild → templates}/TestRobot.java.template
  47. 0 {ant/project → templates}/build.properties.template
  48. 0 {ant/project → templates}/build.xml.template
  49. 0 {IncludeInBuild → templates}/classpath.template
  50. 0 {IncludeInBuild → templates}/project.template
View
@@ -1,3 +1,5 @@
Copyright 2015, Strongback and individual contributors by the @authors tag.
The following have contributed to the Strongback Java codebase.
Randall Hauch <rhauch@gmail.com>
View
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="build-common" default="test">
<property name="strongback.dir" value=".."/>
<property file="${strongback.dir}/build.properties"/>
<property name="wpilib.dir" value="${user.home}/wpilib"/>
<property name="java.compile.arg" value=""/>
<property name="java.source.version" value="1.8"/>
<property name="java.target.version" value="1.8"/>
<property name="project.build.dir" value="build"/>
<property name="project.source.dir" value="src"/>
<property name="project.output.dir" value="${project.build.dir}/classes"/>
<property name="project.test.source.dir" value="test"/>
<property name="project.test.output.dir" value="${project.build.dir}/test-classes"/>
<property name="project.test.report.dir" value="${project.build.dir}/test-reports"/>
<property name="wpi.libs.dir" value="${wpilib.dir}/java/current/lib"/>
<property name="test.libs.dir" value="${strongback.dir}/libs/test"/>
<property name="compile.libs.dir" value="${strongback.dir}/libs"/>
<property name="project.jar.name" value="${ant.project.name}.jar"/>
<property name="project.source.jar.name" value="${ant.project.name}-sources.jar"/>
<property file="${strongback.dir}/build.properties"/>
<property file="${wpilib.dir}/wpilib.properties"/>
<!-- Define the classpaths -->
<path id="project.dependency.class.path">
</path>
<!-- Define the classpaths -->
<path id="compile.class.path">
<path refid="project.dependency.class.path"/>
<fileset dir="${compile.libs.dir}" includes="**/*.jar" excludes="**/*-sources.jar"/>
<fileset dir="${wpi.libs.dir}" includes="**/*.jar" excludes="**/*-sources.jar"/>
<pathelement path="${classpath}" />
</path>
<path id="test.class.path">
<path refid="compile.class.path"/>
<fileset dir="${test.libs.dir}" includes="**/*.jar" excludes="**/*-sources.jar"/>
</path>
<import file="dependencies.xml"/>
<target name="clean">
<delete dir="${project.build.dir}" />
</target>
<!-- Check if there are any JUnit Tests -->
<target name="if-tests">
<condition property="tests-exists">
<available file="${project.test.source.dir}" type="dir"/>
</condition>
</target>
<target name="compile" description="Compile the code">
<mkdir dir="${project.output.dir}"/>
<javac srcdir="${project.source.dir}"
destdir="${project.output.dir}"
source="${java.source.version}"
target="${java.target.version}"
includeantruntime="false">
<classpath refid="test.class.path" />
<!--compilerarg value="${java.compile.arg}"/-->
</javac>
</target>
<target name="compile-tests" depends="compile, if-tests" if="tests-exists" description="Compile the unit tests">
<mkdir dir="${project.test.output.dir}"/>
<javac srcdir="${project.test.source.dir}"
destdir="${project.test.output.dir}"
source="${java.source.version}"
target="${java.target.version}"
includeantruntime="false">
<classpath refid="test.class.path" />
<classpath>
<pathelement location="${project.test.output.dir}"/>
</classpath>
<!--compilerarg value="${java.compile.arg}"/-->
</javac>
</target>
<!-- Run the JUnit Tests that are in the 'test' directory of this project -->
<target name="test" depends="compile-tests, if-tests" if="tests-exists" description="Run the unit tests">
<!-- Creates the directories used in the tests -->
<mkdir dir="${project.test.output.dir}" />
<mkdir dir="${project.test.report.dir}" />
<junit printsummary="off" showOutput="false" fork="false" haltonfailure="no" failureproperty="test.failed" >
<classpath refid="test.class.path" />
<classpath>
<pathelement location="${project.test.output.dir}"/>
</classpath>
<formatter type="plain" usefile="false" /> <!-- to screen -->
<batchtest todir="${project.test.report.dir}">
<fileset dir="${project.test.source.dir}">
<include name="**/*Test*.java" />
</fileset>
</batchtest>
</junit>
<fail message="Test failure detected, check test results." if="test.failed" />
</target>
<!-- Override the several targets that will need to use the extra library JARs. -->
<target name="jar" depends="compile, test" description="Build and collect the JARs necessary for the robot">
<mkdir dir="${project.build.dir}" />
<jar destfile="${project.build.dir}/${project.jar.name}" basedir="${project.output.dir}" />
<jar destfile="${project.build.dir}/${project.source.jar.name}" basedir="${project.source.dir}" />
</target>
<target name="dist.dependencies">
<antcall target="depend.${ant.project.name}"/>
</target>
</project>
View
@@ -0,0 +1,2 @@
strongback.version=1.0.0.Beta1
wpilib.dir=${user.home}/wpilib
View
114 build.xml
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="strongback" default="dist">
<import file="dependencies.xml"/>
<tstamp>
<format property="current.year" pattern="yyyy" locale="en"/>
<format property="current.date" pattern="yyyy-MM-dd" locale="en"/>
</tstamp>
<property file="build.properties"/>
<property name="wpi.libs.dir" value="${wpilib.dir}/java/current/lib"/>
<property name="build.dir" value="build"/>
<target name="help">
<echo>Building Strongback includes the following Ant targets:</echo>
<echo></echo>
<echo> clean Deletes all files and directories created during previous builds</echo>
<echo> compile Compiles the source code in all projects</echo>
<echo> test Compiles and runs the tests in all projects</echo>
<echo> jar Compiles, runs the tests, and builds JAR files for all projects</echo>
<echo> dist Creates the distribution archive</echo>
<echo></echo>
<echo>Some of these targets depend on other targets. For example, running 'ant test' will</echo>
<echo>automatically include the 'compile' target, so it is equivalent to running 'ant compile test'.</echo>
<echo>Likewise, 'jar' automatically runs 'test', and 'dist' automatically runs 'clean' and 'jar'.</echo>
<echo></echo>
</target>
<target name="clean" description="Deletes build files">
<delete dir="${build.dir}" />
<antcall target="strongback.all">
<param name="dependency.target" value="clean"/>
</antcall>
</target>
<target name="compile" description="Compiles source code">
<antcall target="strongback.all">
<param name="dependency.target" value="compile"/>
</antcall>
</target>
<target name="test" description="Run the tests">
<antcall target="strongback.all">
<param name="dependency.target" value="test"/>
</antcall>
</target>
<target name="jar" description="Creates the JARs">
<antcall target="strongback.all">
<param name="dependency.target" value="jar"/>
</antcall>
</target>
<target name="javadoc">
<mkdir dir="build"/>
<javadoc destdir="build/javadoc"
author="false"
version="true"
use="true"
windowtitle="Strongback Java Library">
<classpath>
<fileset dir="libs" includes="**/*.jar" excludes="**/*-sources.jar"/>
<fileset dir="${wpi.libs.dir}" includes="**/*.jar" excludes="**/*-sources.jar"/>
<pathelement path="${classpath}" />
</classpath>
<sourcefiles>
<fileset dir="strongback/src"/>
<!--fileset dir="strongback-testing/src"/-->
</sourcefiles>
<packageset dir="strongback/src" defaultexcludes="yes">
<include name="org.strongback/**"/>
</packageset>
<doctitle><![CDATA[<h1>Strongback Java Library</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; ${current.year} Strongback and individual contributors. All Rights Reserved.</i>]]></bottom>
<tag name="todo" scope="all" description="To do:"/>
<group title="Strongback" packages="org.strongback"/>
<group title="Components" packages="org.strongback.components*:org.strongback.hardware*"/>
<group title="Drives" packages="org.strongback.drive"/>
<group title="Commands" packages="org.strongback.command*"/>
<group title="" packages="org.strongback.util*:org.strongback.function*:org.strongback.annotation*"/>
<link href="http://docs.oracle.com/javase/8/docs/api/"/>
<link offline="true" href="http://first.wpi.edu/FRC/roborio/release/docs/java/" packagelistLoc="${wpilib.dir}/java/current/javadoc"/>
</javadoc>
</target>
<target name="dist" depends="clean, jar, javadoc" description="Creates the distribution">
<echo>Building Strongback distribution version ${strongback.version}</echo>
<mkdir dir="build"/>
<!-- Update the strongback.properties file -->
<copy file="strongback.properties" tofile="${build.dir}/strongback.properties"/>
<propertyfile file="${build.dir}/strongback.properties">
<entry key="strongback.version" value="${strongback.version}"/>
<entry key="build.date" value="${current.date}"/>
</propertyfile>
<!-- Build the ZIP file -->
<zip destfile="${build.dir}/strongback-${strongback.version}.zip">
<zipfileset dir="strongback-tools/scripts" prefix="strongback/java/bin"/>
<zipfileset dir="strongback/build" includes="*.jar" prefix="strongback/java/lib"/>
<zipfileset dir="libs" includes="*.jar" prefix="strongback/java/lib"/>
<zipfileset dir="strongback-testing/build" includes="*.jar" prefix="strongback/java/lib-tests"/>
<zipfileset dir="libs/test" includes="*.jar" prefix="strongback/java/lib-tests"/>
<zipfileset dir="strongback-tools/build" includes="*.jar" prefix="strongback/java/lib-tools"/>
<zipfileset dir="ant/strongback" includes="**" prefix="strongback/java/ant"/>
<zipfileset dir="templates" includes="**" prefix="strongback/java/templates"/>
<zipfileset dir="build/javadoc" includes="**" prefix="strongback/java/javadoc"/>
<zipfileset dir="build" includes="strongback.properties" prefix="strongback"/>
<zipfileset dir="." includes="COPYRIGHT.txt" prefix="strongback"/>
<zipfileset dir="." includes="LICENSE.txt" prefix="strongback"/>
<zipfileset dir="." includes="README.md" prefix="strongback"/>
</zip>
</target>
</project>
View
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="strongback-project" default="strongback.all">
<dirname property="strongback.basedir" file="${ant.file.dependencies}"/>
<!-- ================================================================== -->
<target name="strongback.all" depends="strongback.core, strongback.tests, strongback.tools, strongback.examples">
</target>
<!-- ================================================================== -->
<target name="strongback.core">
<ant dir="${strongback.basedir}/strongback"
target="${dependency.target}"
inheritAll="false"/>
</target>
<!-- ================================================================== -->
<target name="strongback.testing" depends="strongback.core">
<ant dir="${strongback.basedir}/strongback-testing"
target="${dependency.target}"
inheritAll="false"/>
</target>
<!-- ================================================================== -->
<target name="strongback.tests" depends="strongback.core, strongback.testing">
<ant dir="${strongback.basedir}/strongback-tests"
target="${dependency.target}"
inheritAll="false"/>
</target>
<!-- ================================================================== -->
<target name="strongback.tools">
<ant dir="${strongback.basedir}/strongback-tools"
target="${dependency.target}"
inheritAll="false"/>
</target>
<!-- ================================================================== -->
<target name="strongback.examples">
<ant dir="${strongback.basedir}/strongback-examples"
target="${dependency.target}"
inheritAll="false"/>
</target>
</project>
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="build/main" path="src/main/java"/>
<classpathentry kind="src" output="build/main" path="src/main/resources"/>
<classpathentry kind="src" output="build/test" path="src/test/java"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="wpilib" sourcepath="wpilib.sources"/>
<classpathentry kind="lib" path="/libs/test/fest-assert-1.4.jar" sourcepath="/libs/test/fest-assert-1.4-sources.jar"/>
@@ -11,5 +9,5 @@
<classpathentry kind="lib" path="/libs/test/hamcrest-core-1.3.jar" sourcepath="/libs/test/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="var" path="networktables" sourcepath="networktables.sources"/>
<classpathentry combineaccessrules="false" kind="src" path="/strongback"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="strongback-examples" default="default">
<import file="../build-common.xml"/>
<!-- Define the classpaths with our dependencies -->
<path id="project.dependency.class.path">
<dirset dir="${strongback.dir}/strongback/build/classes"/>
<dirset dir="${strongback.dir}/strongback-testing/build/classes"/>
</path>
</project>

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 4a44c00

Please sign in to comment.