[Anjuta-list] Some java crap...
- From: Jens Askengren <jensus linux nu>
- To: anjuta-list lists sourceforge net
- Subject: [Anjuta-list] Some java crap...
- Date: Thu Feb 20 12:27:22 2003
I thought it would be cool to add support for ant based java project in
Anjuta, so I copied the gnome-project-types and did som search and
replace to get java-project-types. But I kind of gave up when I realized
that it would require more work than just rebind the make button to run
ant.
Anyway, attached is a script that does about the same thing as
anjuta-gnome-application-create.py.
- Jens
#!/bin/sh
#
# Create a Ant based java project
# Jens Askengren <jensus linux nu>
#
# Parameters:
#
# name package description location
#
name=$1
package=$2
description=$3
location=$4
usage()
{
echo "Usage `basename $0` <project-name> <package> <description> <location>";
exit 1;
}
fail()
{
echo "ERROR: $*";
exit 1;
}
if [ -z "$location" ]; then
usage;
fi
cd "$location" || fail "The directory $location does not exists";
mkdir src classes docs resources lib jar || fail "Could not create directories";
cat > build.xml << EOM
<?xml version="1.0" encoding="UTF-8"?>
<project name="${name}" default="compile">
<target name="init">
<tstamp/>
<property environment="env"/>
<property name="package.name" value="${package}"/>
<property name="package.version" value="0.1"/>
<property name="package.dist" value="\${package.name}-\${package.version}"/>
<!-- Default to debug. Override with -Ddebug=false -->
<property name="debug" value="true"/>
<!-- create standard directories -->
<mkdir dir="lib"/>
<mkdir dir="jar"/>
<mkdir dir="classes"/>
</target>
<target name="compile" depends="init"
description="Compile sources">
<javac debug="\${debug}"
destdir="classes"
srcdir="src">
<classpath>
<fileset dir=".">
<include name="lib/*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target name="clean"
description="Remove classes and .jar-files">
<delete dir="classes"/>
<delete file="jar/\${package.dist}.jar"/>
</target>
<target name="distclean" depends="clean"
description="Remove classes, .jar-files and editor backup files">
<delete>
<fileset dir="." defaultexcludes="false">
<include name="resources/MANIFEST.MF"/>
<include name="**/*.bak"/>
<include name="**/*~"/>
</fileset>
</delete>
</target>
<target name="buildid" depends="init">
<copy file="resources/MANIFEST.MF.in" toFile="resources/MANIFEST.MF"/>
<replace file="resources/MANIFEST.MF" value="">
<replacefilter token="@name@" value="\${package.name}"/>
<replacefilter token="@version@" value="\${package.version}"/>
<replacefilter token="@build@" value="\${DSTAMP}\${TSTAMP}"/>
</replace>
</target>
<target name="jar" depends="compile,buildid"
description="Create a .jar file containing all compiled .class files">
<delete file="jar/\${package.dist}.jar"/>
<jar jarfile="jar/\${package.dist}.jar"
manifest="resources/MANIFEST.MF">
<fileset dir="classes">
<include name="**/*"/>
</fileset>
</jar>
</target>
<target name="javadoc" depends="init"
description="Create javadoc api documentation">
<mkdir dir="docs"/>
<mkdir dir="docs/javadoc"/>
<javadoc packagenames="\${package.name}.*"
destdir="docs/javadoc" windowtitle="${name}"
doctitle="${name}" docencoding="iso-8859-1">
<sourcepath>
<pathelement path="src"/>
</sourcepath>
</javadoc>
</target>
</project>
EOM
cat > resources/MANIFEST.MF.in << EOM
Manifest-Version: 1.0
Extension-Name: @name@
Implementation-Vendor-Id: @build@
Implementation-Version: @version@
Package: @name@
Version: @version@
Build: @build@
EOM
cat > project.anjuta << EOM
<?xml version="1.0"?>
<project/>
EOM
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]