Skeleton of viztool project for visualizing Java classes.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@156 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2001-06-14 01:51:28 +00:00
parent d5612717a2
commit b64ae10266
4 changed files with 201 additions and 0 deletions
+93
View File
@@ -0,0 +1,93 @@
#!/usr/bin/perl -w
#
# $Id: runjava,v 1.1 2001/06/14 01:51:28 mdb Exp $
#
# A script for invoking java. The project root is inferred to be one
# directory above the directory in which this script lives. Based on the
# root, all .jar files in the lib subdirectory are added to the classpath.
# Additionally all shared libraries in lib/$arch, where $arch is generated
# via uname and looks something like i686-Linux, are added to the
# LD_LIBRARY_PATH environment variable. Classes are assumed to live in
# $classdir as defined below.
use strict;
use Getopt::Std;
# this is where our classfiles live (relative to the project root)
my $classdir = "dist/classes";
# parse the arguments
my %opts;
getopts('p:v', \%opts);
my $pid_file = $opts{"p"};
my $verbose = $opts{"v"};
# make sure they specified a classfile
my $usage = "Usage: $0 [-p pid_file] [-v] [-- args to pass to java] class\n";
die $usage unless (@ARGV);
# get the server root by popping the /bin off of our directory
my $location;
chomp($location = `dirname $0`);
my @parts = split(/\//, $location);
pop(@parts);
my $root = join("/", @parts);
# figure out where our JVM lives
my $jhome = $ENV{"JAVA_HOME"};
# make sure JAVA_HOME is set
if (!defined $jhome) {
warn "$0: Error: No JAVA_HOME specified!\n";
warn "\n";
warn "You must set your JAVA_HOME environment variable to the\n";
warn "the absolute path of your JDK installation. For example:\n";
warn "\n";
warn " % JAVA_HOME=/usr/local/jdk1.2\n";
warn " % export JAVA_HOME\n";
die "\n";
}
my $java = "$jhome/bin/java";
my $jlib = "$jhome/lib/classes.zip";
# make sure we can run the jvm
if (! -x $java) {
die "$0: Can't find a java interpreter in '$jhome'.\n";
}
# determine our machine architecture
my $ostype = `uname -s`;
my $machtype = `uname -m`;
chomp($ostype);
chomp($machtype);
my $arch = "$machtype-$ostype";
# add our native libraries to the runtime library path
my $libs = "$root/lib/$arch";
my $libpath = $ENV{"LD_LIBRARY_PATH"};
if (defined $libpath) {
$ENV{"LD_LIBRARY_PATH"} = "$libs:$libpath";
} else {
$ENV{"LD_LIBRARY_PATH"} = $libs;
}
# put everything in our class path
my $classpath = "-classpath $jlib:$root/$classdir";
# any zip or jar files in our lib/ directory get added to the class path
if (opendir(DIR, "$root/lib")) {
my $lib;
foreach $lib (grep { /.(zip|jar)/ && -f "$root/lib/$_" } readdir(DIR)) {
$classpath .= ":$root/lib/$lib";
}
closedir DIR;
}
# log the pid file if requested to do so
print `echo $$ > $pid_file` if (defined $pid_file);
my $cmd = "$java -mx256M $classpath " . join(" ", @ARGV);
print "$cmd\n" if ($verbose);
exec($cmd);
+54
View File
@@ -0,0 +1,54 @@
<!-- build configuration -->
<project name="viztool" default="compile" basedir=".">
<!-- configuration parameters -->
<property name="app.name" value="viztool"/>
<property name="deploy.home" value="dist"/>
<property name="dist.home" value="${deploy.home}"/>
<property name="dist.jar" value="${app.name}.jar"/>
<property name="javadoc.home" value="${deploy.home}/docs"/>
<property name="build.compiler" value="jikes"/>
<property name="java.libraries" value="/usr/share/java"/>
<!-- prepares the application directories -->
<target name="prepare">
<mkdir dir="${deploy.home}"/>
<mkdir dir="${deploy.home}/classes"/>
<mkdir dir="${javadoc.home}"/>
</target>
<!-- cleans out the installed application -->
<target name="clean">
<delete dir="${deploy.home}"/>
</target>
<!-- build the java class files -->
<target name="compile" depends="prepare">
<javac srcdir="src/java" destdir="${deploy.home}/classes"
debug="on" optimize="off" deprecation="off">
<classpath>
<fileset dir="${java.libraries}" includes="**/*.jar"/>
<fileset dir="lib" includes="**/*.jar"/>
<pathelement location="${deploy.home}/classes"/>
</classpath>
</javac>
</target>
<!-- build the javadoc documentation -->
<target name="javadoc" depends="prepare">
<javadoc sourcepath="src/java"
packagenames="com.samskivert.*"
classpath="${deploy.home}/classes"
destdir="${javadoc.home}"/>
</target>
<!-- the default target is to rebuild everything -->
<target name="all" depends="clean,prepare,compile,javadoc"/>
<!-- builds our distribution files (war and jar) -->
<target name="dist" depends="prepare,compile">
<jar jarfile="${dist.home}/${dist.jar}"
basedir="${deploy.home}/classes"/>
</target>
</project>
+16
View File
@@ -0,0 +1,16 @@
Required external libraries
---------------------------
The viztool code requires the following external Java libraries (JAR
files) to be placed here in the lib/ directory or in the shared library
directory specified in the build.xml file (${java.libraries}).
* samskivert library:
http://www.samskivert.com/code/samskivert/
Once the jar files are in place (regardless of what they are named), the
build system will automatically include them in the compile-time
classpath.
--
$Id: README,v 1.1 2001/06/14 01:51:28 mdb Exp $
@@ -0,0 +1,38 @@
//
// $Id: Log.java,v 1.1 2001/06/14 01:51:28 mdb Exp $
package com.samskivert.vistool;
/**
* A placeholder class that contains a reference to the log object used by
* the viztool package.
*/
public class Log
{
public static com.samskivert.util.Log log =
new com.samskivert.util.Log("viztool");
/** Convenience function. */
public static void debug (String message)
{
log.debug(message);
}
/** Convenience function. */
public static void info (String message)
{
log.info(message);
}
/** Convenience function. */
public static void warning (String message)
{
log.warning(message);
}
/** Convenience function. */
public static void logStackTrace (Throwable t)
{
log.logStackTrace(com.samskivert.util.Log.WARNING, t);
}
}