- allows to create a debian package ( yet unsigned )

- create a jar, gnerate a ant build.xml
- version of jar

Signed-off-by: philippe lhardy <philippe@pavilionartlogiciel>
This commit is contained in:
philippe lhardy
2015-02-16 23:07:20 +01:00
parent e0b2027f70
commit 2a8f80154f
7 changed files with 198 additions and 10 deletions

45
Makefile Normal file
View File

@@ -0,0 +1,45 @@
PROJECT_VERSION=`./debianize.sh getversion`
DISTPREFIX=artloglaby
DISTJAR=$(DISTPREFIX)-$(PROJECT_VERSION).jar
all: build.xml dist/lib/$(DISTJAR)
getname:
@echo dist/lib/$(DISTJAR)
dist:
mkdir -p dist
dist/lib/$(DISTJAR): dist
ant dist
build.xml:
./antify.sh >$@
clean:
rm -f build.xml
rm -f dist/lib/$(DISTPREFIX)*.jar
rm -rf build
cleanall: clean
rm -rf debian
rm -rf deb
debian:
mkdir debian
deb/%:
mkdir -p deb
touch $@
./debianize.sh create $@
debian/compat:
echo "7" >$@
debian/%:
./debianize.sh create $@ >$@
deb: debian debian/rules debian/control debian/compat debian/changelog deb/javadoc deb/jlibs
dpkg-buildpackage -uc -us
.PHONY: clean all cleanall getname deb

12
absant.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
buildscript=$1
if [[ -e $buildscript ]]
then
# protect ${ variables.
sed 's/\${/\\\${/g' build.xml
else
echo "[ERROR] this $0 tool expect an initial argument with buildscript" >&2
fi

50
antify.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/bash
source ./project_params
# TODO reuse internal tsamp ${DSTAMP}
cat <<EOF
<project name="$project_name" default="$project_default" basedir="$project_basedir">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="java"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="\${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from \${src} into \${build} -->
<javac srcdir="\${src}" destdir="\${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="\${dist}/lib"/>
<!-- Put everything in \${build} into the ${project_name}-${project_version}}-${DSTAMP}.jar file -->
<jar jarfile="\${dist}/lib/${project_name}-${project_version}.jar" basedir="\${build}">
<manifest>
<attribute name="Main-Class" value="$project_mainclass"/>
</manifest>
</jar>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the \${build} and \${dist} directory trees -->
<delete dir="\${build}"/>
<delete dir="\${dist}"/>
</target>
</project>
EOF

67
debianize.sh Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/bash
action=$1
file=$2
maintainer="Artlog <pl@artisanlogiciel.net>"
if [[ $action == getversion ]]
then
source ./project_params
echo $project_version
elif [[ $action == create ]]
then
source ./project_params
if [[ $file == debian/control ]]
then
cat <<EOF
Source: ${project_name}-java
Priority: extra
Maintainer: $maintainer
Build-Depends: debhelper (>= 7.0.50~), javahelper (>=0.25)
Build-Depends-Indep: default-jdk, default-jdk-doc, libtrove-java, libtrove-java-doc, ant
Standards-Version: ${project_version}
Section: java
Package: ${project_name}-java
Architecture: all
Depends: \${java:Depends}, \${misc:Depends}
Recommends: \${java:Recommends}
Description: Labyrinth generator
Labyrinth generator
Package: ${project_name}-java-doc
Architecture: all
Depends: \${java:Depends}, \${misc:Depends}
Recommends: \${java:Recommends}
Description: Labyrinth generator (documentation)
Labyrinth generator
EOF
elif [[ $file = debian/changelog ]]
then
cat <<EOF
${project_name}-java (${project_version}) unstable; urgency=low
* Initial debian package
-- ${maintainer} $(LANG=C date -R)
EOF
elif [[ $file = debian/rules ]]
then
cat <<EOF
#!/usr/bin/make -f
JAVA_HOME=/usr/lib/jvm/default-java
%:
dh \$@ --with javahelper
EOF
elif [[ $file = deb/javadoc ]]
then
echo "api /usr/share/doc/${project_name}-java/api" >debian/${project_name}-java-doc.javadoc
elif [[ $file = deb/jlibs ]]
then
echo "dist/lib/${project_name}-${project_version}.jar" >debian/${project_name}-java.jlibs
fi
fi

18
doit.sh
View File

@@ -51,13 +51,22 @@ action=initial
while [[ $action != quit ]] while [[ $action != quit ]]
do do
action=$($DIALOG --menu "Ultra Light IDE" 20 80 8 run "Run it" test "Test it" readme "Read me" code "Code" codebg "Code in background" quit "Quit" 3>&1 1>&2 2>&3) action=$($DIALOG --menu "Ultra Light IDE" 20 80 8 run "Run it" clean "Clean All" ant "Ant build" test "Test it" readme "Read me" code "Code" codebg "Code in background" deb "Debian package" quit "Quit" 3>&1 1>&2 2>&3)
if [[ $action == run ]] if [[ $action == run ]]
then then
echo "run it" echo "run it"
pushd java java -jar $(make getname)
make display elif [[ $action == ant ]]
then
make clean
make
ant compile
elif [[ $action == clean ]]
then
make clean
pushd java
make clean
popd popd
elif [[ $action == test ]] elif [[ $action == test ]]
then then
@@ -65,6 +74,9 @@ do
pushd java pushd java
make display make display
popd popd
elif [[ $action == deb ]]
then
make deb
elif [[ $action =~ code ]] elif [[ $action =~ code ]]
then then
do_code $action do_code $action

View File

@@ -6,13 +6,9 @@ import java.util.LinkedList;
public class Main public class Main
{ {
public WallsProvider generate(int width,int height, int maxdepth, MazeListener listener) public WallsProvider generate(int width,int height, int maxdepth, MazeResolutionListener listener)
{ {
LabyModel model = new LabyModel(width, height,maxdepth, new java.util.Random()); LabyModel model = new LabyModel(width, height,maxdepth, new java.util.Random());
if ( listener != null )
{
model.setListener(listener);
}
model.generateWithEntry(0, 0); model.generateWithEntry(0, 0);
LinkedList<Position> exits = new LinkedList<Position>(); LinkedList<Position> exits = new LinkedList<Position>();
model.addEntryOrExit(-1,0); model.addEntryOrExit(-1,0);
@@ -21,7 +17,7 @@ public class Main
{ {
System.out.println("Check failed"); System.out.println("Check failed");
} }
model.resolve(width-1,height-1); model.resolve(width-1,height-1,listener);
return model; return model;
} }
@@ -38,7 +34,7 @@ public class Main
System.out.println("Check failed"); System.out.println("Check failed");
} }
model.debugOut(); model.debugOut();
model.resolve(width-1,height-1); model.resolve(width-1,height-1,null);
LabyMap labyMap =model.toLabyMap(); LabyMap labyMap =model.toLabyMap();
return labyMap; return labyMap;
} }

6
project_params Normal file
View File

@@ -0,0 +1,6 @@
project_name=artloglaby
project_default=dist
project_basedir=$(pwd)
project_mainpackage=org.artisanlogiciel.games
project_mainclass=$project_mainpackage.Display
project_version=0.0.1