First commit.

This commit is contained in:
Christian P. MOMON 2014-11-28 05:05:39 +01:00
commit 1525618f91
16 changed files with 223 additions and 0 deletions

9
.classpath Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/junit-4.11.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
.project Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Buildjar-sandbox</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

BIN
bin/foo/FooTest.class Normal file

Binary file not shown.

BIN
bin/one/Foo.class Normal file

Binary file not shown.

3
build.num Normal file
View file

@ -0,0 +1,3 @@
#Build Number for ANT. Do not edit!
#Wed Jun 26 20:53:14 CEST 2013
build.number=5

3
build.properties Normal file
View file

@ -0,0 +1,3 @@
product.name=example
product.revision.major=0
product.revision.minor=2

5
build.xml Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<project default="dist" name="my_project">
<!-- -->
<import file="buildjar.xml" />
</project>

5
buildandgit.xml Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<project default="buildandgit" name="my_project">
<!-- -->
<import file="buildjar.xml" />
</project>

151
buildjar.xml Normal file
View file

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<project default="dist" name="jarbuild">
<!--ANT 1.7 is required -->
<property name="buildjar.version" value="1.4" />
<property file="build.properties" />
<property name="build.dir" value="${basedir}/build" />
<property name="build.src" value="${basedir}/src" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.javadoc" value="${build.dir}/javadoc" />
<property name="test.src" value="${basedir}/test" />
<property name="test.classes" value="${build.dir}/test-classes" />
<property name="debug" value="on" />
<path id="build.classpath">
<fileset dir="lib" includes="**/*.jar" />
</path>
<path id="test.classpath.compile">
<path refid="build.classpath" />
<pathelement path="${build.classes}" />
</path>
<path id="test.classpath.run">
<path refid="test.classpath.compile" />
<pathelement path="${test.classes}" />
</path>
<!-- ***** Help ***** -->
<target name="help" description="Display detailed usage information">
<echo>Type ant -p</echo>
</target>
<!-- ***** Clean ***** -->
<target name="clean" description="Clean temporary directories">
<delete dir="${build.dir}" />
</target>
<!-- ***** Compile ***** -->
<target name="compile" description="Compile main code">
<mkdir dir="${build.dir}/classes" />
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
<classpath refid="test.classpath.compile" />
</javac>
</target>
<!-- ***** Compile test ***** -->
<target name="compile-test" description="Compile test code">
<mkdir dir="${test.classes}" />
<javac srcdir="${test.src}" destdir="${test.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
<classpath refid="test.classpath.compile" />
</javac>
</target>
<!-- ***** Test ***** -->
<target name="test" description="Run unit tests" depends="clean,compile,compile-test">
<mkdir dir="${build.dir}/test-reports" />
<junit printsummary="yes" haltonfailure="no">
<classpath refid="test.classpath.run" />
<formatter type="plain" usefile="true" />
<batchtest fork="yes" todir="${build.dir}/test-reports/">
<fileset dir="test">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<!-- ***** JavaDoc ***** -->
<target name="javadoc" description="Javadoc construction">
<javadoc sourcepath="${build.src}" destdir="${build.javadoc}">
<classpath>
<fileset dir="lib" includes="**/*.jar" />
</classpath>
</javadoc>
</target>
<!-- ***** Dist ***** -->
<target name="dist" description="Build distribution" depends="clean,compile,javadoc">
<!-- -->
<buildnumber file="build.num" description="Id of the build" />
<!-- AUTOMATIC MANAGEMENT -->
<property name="dist.version" value="${product.revision.major}.${product.revision.minor}.${build.number}" />
<property name="dist.name" value="${product.name}-${dist.version}" />
<property name="dist.dir" value="${basedir}/dist/${dist.name}" />
<!-- -->
<mkdir dir="${dist.dir}" />
<!-- -->
<copy file="LICENSE" todir="${dist.dir}/" overwrite="true" />
<!-- Package main -->
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
<tstamp>
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
<!-- TODAY -->
</tstamp>
<jar destfile="${dist.jar}">
<manifest>
<attribute name="Built-By" value="${user.name} using ant" />
<attribute name="Built-Date" value="${dist.time}" />
</manifest>
<fileset dir="${build.classes}" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</jar>
<!-- Package sources -->
<property name="dist.srczip" value="${dist.dir}/${dist.name}-sources.zip" />
<zip destfile="${dist.srczip}" update="true" preserve0permissions="true">
<fileset dir="${basedir}/src" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</zip>
<!-- Package Javadoc -->
<property name="dist.javadoc.zip" value="${dist.dir}/${dist.name}-javadoc.zip" />
<zip destfile="${dist.javadoc.zip}" update="true" preserve0permissions="true">
<fileset dir="${build.javadoc}" />
<zipfileset dir="${basedir}/" includes="LICENSE" />
</zip>
<!-- Package lib -->
<copy todir="${dist.dir}/lib" overwrite="true">
<fileset dir="lib" excludes="hamcrest-core*,junit*" />
</copy>
</target>
<!-- ***** Dist ***** -->
<target name="buildandgit" depends="dist">
<!-- GIT actions-->
<echo message="Commit build.num"/>
<exec executable="git" outputproperty="git.commit.out" failifexecutionfails="true">
<arg line="commit -m 'Build ${dist.version}' build.num"/>
</exec>
<echo message="${git.commit.out}" />
<echo message="Tag"/>
<exec executable="git" outputproperty="git.tag.out" failifexecutionfails="true">
<arg line="tag -a ${dist.version} -m 'Build ${dist.version}'"/>
</exec>
<echo message="${git.tag.out}" />
<echo message="Push"/>
<exec executable="git" outputproperty="git.push.out" failifexecutionfails="true">
<arg line="push --follow-tags"/>
</exec>
<echo message="${git.push.out}" />
</target>
</project>

3
lib/README Normal file
View file

@ -0,0 +1,3 @@
Description of used libraries:
- hamcrest-core: required by junit
- junit: unit tests API

Binary file not shown.

BIN
lib/hamcrest-core-1.3.jar Normal file

Binary file not shown.

BIN
lib/junit-4.11-sources.jar Normal file

Binary file not shown.

BIN
lib/junit-4.11.jar Normal file

Binary file not shown.

12
src/one/Foo.java Normal file
View file

@ -0,0 +1,12 @@
package one;
public class Foo
{
/**
*
*/
public void sayFoo()
{
System.out.println("Foo.");
}
}

15
test/foo/FooTest.java Normal file
View file

@ -0,0 +1,15 @@
package foo;
import org.junit.Test;
public class FooTest
{
/**
*
*/
@Test
public void test2a()
{
// Foo.
}
}