Skip to content

Commit

Permalink
Create ant scripts for building and releasing components.
Browse files Browse the repository at this point in the history
  • Loading branch information
scarytom committed Aug 30, 2009
1 parent 8b4d862 commit e629df3
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 1 deletion.
3 changes: 2 additions & 1 deletion BUILDING
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Currently no overall build script. Build individual components a they specify.
Currently no overall build script. Build individual components as they specify.
To build a working swing desktop application, run the release target within the ant build.xml script in the swingclient project.
70 changes: 70 additions & 0 deletions common.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0"?>

<project name="common">

<property file="build.properties"/>
<property name="version" value="0.1"/>

<target name="compile" description="Compile Java source.">
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${src.dir}"
debug="on"
destdir="${build.dir}/classes"
source="1.6" target="1.6">
<classpath refid="compile.classpath"/>
</javac>
<copy toDir="${build.dir}/classes">
<fileset dir="${src.dir}" excludes="**/*.java"/>
</copy>
</target>

<target name="manifest" description="Generate manifest." depends="compile">
<fail unless="module" message="The 'module' property is unset"/>
<mkdir dir="${build.dir}/META-INF"/>
<manifest file="${build.dir}/META-INF/MANIFEST.MF">
<attribute name="Built-By" value="${user.name}"/>
<section name="common">
<attribute name="Specification-Title" value="${ant.project.name}"/>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor" value="netmelody.org"/>
<attribute name="Specification-Description" value="Docnap is a simple Document Management System (DMS) designed for home use"/>
<attribute name="Specification-DocURL" value="http://hg.errant.me.uk/scarytom/docnap/wiki/Home/"/>
<attribute name="Specification-Copyright" value="Copyright (C) 2009 Tom Denley"/>
<attribute name="Specification-License" value="http://www.gnu.org/licenses/gpl-2.0.html"/>
<attribute name="Specification-SymbolicName" value="${module}"/>
</section>
</manifest>
</target>

<target name="test.compile" depends="compile" description="Compile test source.">
<mkdir dir="${build.dir}/test"/>
<javac srcdir="${test.dir}"
debug="on"
destdir="${build.dir}/test"
source="1.6" target="1.6">
<classpath path="${build.dir}/classes"/>
<classpath refid="compile.classpath"/>
</javac>
<copy toDir="${build.dir}/test">
<fileset dir="${test.dir}" excludes="**/*.java"/>
</copy>
</target>

<target name="test" depends="test.compile" description="Execute JUnit tests.">
<java fork="true"
classname="junit.textui.TestRunner"
failonerror="true"
taskname="junit">
<classpath>
<pathelement location="${build.dir}/test"/>
<pathelement location="${build.dir}/classes"/>
<path refid="compile.classpath"/>
</classpath>
<arg value="${test.class}"/>
</java>
</target>

<target name="clean" description="Remove generated files.">
<delete dir="${build.dir}"/>
</target>
</project>
1 change: 1 addition & 0 deletions org.netmelody.docnap.core/BUILDING
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Run the jar target in the build.xml ant script.
4 changes: 4 additions & 0 deletions org.netmelody.docnap.core/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src.dir=src
test.dir=test
build.dir=build
module=org.netmelody.docnap.core
27 changes: 27 additions & 0 deletions org.netmelody.docnap.core/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>

<project name="docnap-core" basedir="." default="jar">

<import file="../common.xml"/>

<path id="compile.classpath">
<fileset dir="vendor/lib" includes="*.jar"/>
<fileset dir="vendor/buildlib" includes="*.jar"/>
</path>

<target name="jar" depends="compile, manifest" description="Build jar.">
<jar destfile="${build.dir}/${ant.project.name}-${version}.jar" manifest="${build.dir}/META-INF/MANIFEST.MF">
<fileset dir="db" includes="**/*.*"/>
<fileset dir="${build.dir}/classes"/>
</jar>
</target>

<target name="dist" depends="clean, jar" description="Build distribution.">
<mkdir dir="${build.dir}/dist"/>
<copy toDir="${build.dir}/dist">
<fileset dir="vendor/lib" includes="*.jar"/>
<fileset dir="${build.dir}" includes="*.jar"/>
</copy>
</target>

</project>
2 changes: 2 additions & 0 deletions org.netmelody.docnap.swingclient/BUILDING
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
To build a full release, run the release target in the build.xml ant script.
This depends on the docnap core being present relative to this project.
4 changes: 4 additions & 0 deletions org.netmelody.docnap.swingclient/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src.dir=src
test.dir=test
build.dir=build
module=org.netmelody.docnap.swingclient
42 changes: 42 additions & 0 deletions org.netmelody.docnap.swingclient/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0"?>

<project name="docnap-swingclient" basedir="." default="jar">

<import file="../common.xml"/>
<property name="core.dir" value="../org.netmelody.docnap.core"/>

<path id="compile.classpath">
<fileset dir="vendor/lib" includes="*.jar"/>
<fileset dir="${core.dir}/${build.dir}/dist" includes="*.jar"/>
</path>

<target name="distcore" description="Build core distribution.">
<ant antfile="${core.dir}/build.xml" target="dist" inheritAll="false"/>
</target>

<target name="jar" depends="distcore, compile, manifest" description="Build jar.">
<jar destfile="${build.dir}/${ant.project.name}-${version}.jar" manifest="${build.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build.dir}/classes"/>
</jar>
</target>

<target name="dist" depends="clean, jar" description="Build distribution.">
<mkdir dir="${build.dir}/dist"/>
<copy toDir="${build.dir}/dist">
<fileset dir="${core.dir}/${build.dir}/dist" includes="*.jar"/>
<fileset dir="vendor/lib" includes="*.jar"/>
<fileset dir="${build.dir}" includes="*.jar"/>
</copy>
</target>

<target name="release" depends="dist" description="Build single release jar with dependencies embedded.">
<mkdir dir="${build.dir}/release"/>
<jar jarfile="${build.dir}/release/${ant.project.name}-standalone-${version}.jar">
<zipgroupfileset dir="${build.dir}/dist" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="org.netmelody.docnap.swingclient.DocnapMain"/>
</manifest>
</jar>
</target>

</project>

0 comments on commit e629df3

Please sign in to comment.