File: prcs-javadoc

package info (click to toggle)
prcs 1.2.15-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,928 kB
  • ctags: 3,129
  • sloc: cpp: 16,742; ansic: 5,725; sh: 2,545; lisp: 1,812; perl: 642; lex: 351; makefile: 165; pascal: 85
file content (177 lines) | stat: -rwxr-xr-x 3,633 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/bin/sh
#
# prcs-javadoc (prcs project list) /destination/path
#
# This program generates javadoc documentation for the latest files in
# a set of PRCS projects. It's a bit rough around the edges, but
# hopefully will prove of use to some people.
#
# (c) 1999
# Rafael Kitover (rkitover@io.com)
# Version 0.2: November 5th, 1999
#
# This program may be distributed under the same terms as PRCS itself.
#

set -e

## configuration

# variables you can set
#
# PRCS_REPOSITORY -- where projects are checked out, see prcs(1)
# JAVA		-- path to java executable
# JAVA_ARGS	-- arguments for java (heap size, etc)
# JAVA_COMPILER -- same as for java, the JIT to use
# JAVADOC	-- class name for javadoc, usually sun.tools.javadoc.Main
# JAVADOC_ARGS	-- arguments to pass to javadoc (see javadoc with no args)
# JAVADOC_IMAGES-- directory where images that are referenced by javadoc
#		   generated html are stored.

# path to your java executable
if [ -z "$JAVA" ]; then
	if [ -n "`which java`" ]; then
		JAVA="java"
	else
		JAVA="/usr/local/java/bin/java"
	fi
fi

# args for the java compiler
# you want a big heap because javadoc uses a tonne of memory
# I use 64megs and the JIT compiler "tya".
if [ -z "$JAVA_ARGS" ]; then JAVA_ARGS="-mx64m -ms64m"; fi

if [ -z "$JAVA_COMPILER" ]; then
	if [ -n "`$JAVA -version 2>&1 | head -1 | grep '1.1.'`" ]; then
		export JAVA_COMPILER=tya	# just guessing here, doesn't matter
	elif [ -n "`$JAVA -version 2>&1 | head -1 | grep '1.2.'`" ]; then
		export JAVA_COMPILER=sunwjit
	fi
else
	export JAVA_COMPILER	# make sure it's available to java
fi

# name of the javadoc package
if [ -z "$JAVADOC" ]; then JAVADOC=sun.tools.javadoc.Main; fi

# javadoc args
# -private will generate private methods and variables too
if [ -z "$JAVADOC_ARGS" ]; then JAVADOC_ARGS="-private"; fi

# directory where javadoc images can be found
if [ -z "$JAVADOC_IMAGES" ]; then JAVADOC_IMAGES=`dirname \`locate method-index.gif | head -1\``; fi

## end configuration

####### functions #######

Die ()
{
	echo $*
	Cleanup
	Usage
}

Usage ()
{
	cat <<- USAGE
		Usage:

		$0: (list of prcs projects) /destination/path
	USAGE

	exit 1
}

Cleanup ()
{
	PROGNAME=`basename ${0}`
	rm -rf /tmp/$PROGNAME.$$
}

#### code ####

# parse params, get $PROJECTS and $DESTDIR

if [ $# -lt 2 ]
then
	Usage
fi

PROJECTS=""

while [ $# -ne 1 ]
do
	PROJECTS="$PROJECTS $1"
	shift
done

DESTDIR=$1

# make working dir, cd to it
PROGNAME=`basename ${0}`
mkdir -p /tmp/$PROGNAME.$$
cd /tmp/$PROGNAME.$$

# checkout projects
mkdir -p $PROJECTS
for i in $PROJECTS
do
	cd $i
	prcs checkout $i || Die "Invalid project."
	cd ..
done

# make sure destination directory exists, or can be created
if [ ! -d $DESTDIR ]
then
	mkdir -p $DESTDIR || Die "Could not create directory: $DESTDIR"
fi

# delete everything there

rm -rf $DESTDIR/* || Die "Could not delete files in $DESTDIR"

# set classpath

for i in `find $PROJECTS -name '*.java' -printf '%h\n' | sort -u`
do
	CLASSPATH=$CLASSPATH:/tmp/$PROGNAME.$$/$i
done

# add current dir as well

CLASSPATH=$CLASSPATH:.

# create a list of packages

PACKAGES=""
for i in `find $PROJECTS -name '*.java' -exec egrep '^( |\t)*package( |\t)+(\.|\w)+( |\t)*;( |\t)*$' {} \; |
		sed -e 's/^ \+//' |
		sort -u |
		sed -e 's/^package\( \|\t\)\+//' -e 's/;//'`
do
	PACKAGES="$PACKAGES $i"
done 


# run javadoc, if is because of the set -e

if
	$JAVA $JAVA_ARGS $JAVADOC $JAVADOC_ARGS -d $DESTDIR $PACKAGES
then
	echo -n	# do nothing
fi

# put in a link to images

ln -s $JAVADOC_IMAGES $DESTDIR/images

# make tree.html the default starting point

ln -s $DESTDIR/tree.html $DESTDIR/index.html

Cleanup

exit 0