aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/cardbasecli.xml (renamed from build.xml)48
-rw-r--r--build/header1
2 files changed, 33 insertions, 16 deletions
diff --git a/build.xml b/build/cardbasecli.xml
index 9d581a4..a3e09b0 100644
--- a/build.xml
+++ b/build/cardbasecli.xml
@@ -1,19 +1,27 @@
<?xml version="1.0"?>
-<project name="Cardbase" default="main" basedir=".">
+<project name="cardbasecli" default="deploy" basedir="..">
<property name="jar.name" value="cardbase" />
<property name="src.dir" location="src" />
- <property name="build.dir" location="bin" />
+ <property name="bin.dir" location="bin" />
+ <property name="build.dir" location="build" />
<property name="dist.dir" location="dist" />
<property name="lib.dir" value="lib" />
<property name="res.dir" value="res" />
<property name="main-class" value="eu.equalparts.cardbase.standalone.CardbaseCLI" />
+ <!-- Clean up temporary directories -->
+ <target name="clean" description="clean up">
+ <delete dir="${bin.dir}" />
+ <delete dir="${dist.dir}" />
+ </target>
+
+ <!-- Initialise temporary directories -->
<target name="init">
- <mkdir dir="${build.dir}" />
+ <mkdir dir="${bin.dir}" />
</target>
- <!-- external libraries classpath, we don't need sources and javadoc -->
+ <!-- External libraries classpath, we don't need sources and javadoc -->
<path id="classpath">
<fileset dir="${basedir}/">
<include name="${lib.dir}/*.jar" />
@@ -22,17 +30,17 @@
</fileset>
</path>
- <!-- To work with external libraries, need classpath to compile -->
+ <!-- Compile project including external libraries -->
<target name="compile" depends="init" description="compile the source">
- <javac includeantruntime="false" srcdir="${src.dir}" destdir="${build.dir}" classpathref="classpath" />
+ <javac includeantruntime="false" srcdir="${src.dir}" destdir="${bin.dir}" classpathref="classpath" />
</target>
- <!-- jar it, and declares the ext libraries in manifest.mf file -->
- <target name="jar" depends="compile" description="package, output to JAR">
+ <!-- Create the jar and declare the ext libraries in manifest.mf file -->
+ <target name="jar" depends="compile" >
<mkdir dir="${dist.dir}" />
- <jar jarfile="${dist.dir}/${jar.name}.jar" basedir="${build.dir}">
+ <jar jarfile="${dist.dir}/${jar.name}.jar" basedir="${bin.dir}">
<zipgroupfileset dir="${lib.dir}" includes="*.jar" excludes="*sources.jar, *javadoc.jar" />
<fileset dir="${res.dir}" includes="**" excludes="" />
@@ -44,13 +52,21 @@
</jar>
</target>
- <!-- Clean up temporary directories -->
- <target name="clean" description="clean up">
- <delete dir="${build.dir}" />
- <delete dir="${dist.dir}" />
+ <!-- Concatenate a the jar to a pre-set header and chmod 755 it -->
+ <target name="shebang" depends="deploy" >
+ <concat destfile="${dist.dir}/${jar.name}" binary="yes">
+ <fileset dir="${build.dir}" includes="header"/>
+ <fileset dir="${dist.dir}" includes="${jar.name}.jar"/>
+ </concat>
+
+ <chmod file="${dist.dir}/${jar.name}" perm="755"/>
+
</target>
-
- <!-- Default, run this -->
- <target name="main" depends="clean, compile, jar" />
+
+ <!-- Produce a standalone, runnable jar -->
+ <target name="deploy" depends="clean, compile, jar" />
+
+ <!-- Deploy, add header and set permission to run on Linux -->
+ <target name="cli" depends="deploy, shebang" />
</project> \ No newline at end of file
diff --git a/build/header b/build/header
new file mode 100644
index 0000000..fdeaa61
--- /dev/null
+++ b/build/header
@@ -0,0 +1 @@
+#!/usr/bin/java -jar