Classdep

Classdep is a quick hack which can probably build moderately optimised if not simplified .jar files for java programs. it is perhaps better described by its readme file:
Classdep v0.1.0: 
---------

Owen Cliffe


17/7/2003

A simple tool for priniting and (possibly) generating jars for reduced
dependecy trees for a given class or classes: 

Requires (to compile at least) 
Gnu Getopt for java (google knows where it is) 
The Kopi java compiler suite v2.2 binary  http://www.at.dms/kopi/

The tool is   (kind of ) self hosting :) : 

"make lib/classdep" should generate a dependency-free jar for the tool
assuming your classpath contains the above and the lib/ directory.


DOCUMENTATION
See: 
java uk.org.zoot.classdep.Main --help for more details
or java -jar classsdep.jar --help if you are that way inclined. 

The tool takes one or more class names as its pricipal arguments. And all
statically dependent classes which are in the CLASSPATH (or --classpath) are
then processed for dependencies. 

Specific classes or packages can be excluded from the dependency graph by
either specifying their qualified slashed names in -x or with a java (yuck)
regexp in -g  if you like that sort of thing. If a dependency is not
found in the classpath it is silently ignored i think. 

The input class names can be in either dotted or or slashed notation (with
no leading slash) and can then; 

Print out a list of class dependencies ( -f "class") including their
locations (-f both) or just their origins in the classpath (-f "file")

Generate a jar file (-j ) 

i.e. 

java uk.org.zoot.classdep.Main -j classdep.jar -r all -c

Other resource dependencies in source jars (like property files, images etc
etc) are all ignored, there is rather stupid option that just pools all of
the resources from all used source jars and puts them in the result (-r all)
i tried doing this automatically by munging strings but unsurprisingly this
rarely works. 

The evil magic parameter (-e) probably causes bad things to happen, it
looks for string literals which might be class names
(i.e. class.forName("x.y.z") and includes them in the search.


BUGS

Lots probably, may not work, iwfm that is about all i can say. 

ACKNOWLEDGEMENTS
This is just a foul hack on some bits of the kopi suite, which while cool has
shown iteself to be completely immune to extension without having to edit
the source with perl. 

It depends on and slightly modifies portions of the Kopi java compiler suite and is distributed under the terms of the GNU GPL v2 if you agree to these terms then you may download the latest (and probably only souce and binary package: classdep-0.1.0.tar.gz
Copyright © 2003 Owen Cliffe