Skip to main content
summaryrefslogtreecommitdiffstats
blob: dedf848f94a6c768b28e343883dc535be4d85480 (plain) (blame)
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
178
179
180
181
182
183
184
185
#!/bin/sh

if [ "x"$ANT_HOME = "x" ]; then export ANT_HOME=/opt/apache-ant-1.6; fi
if [ "x"$JAVA_HOME = "x" ]; then export JAVA_HOME=/opt/sun-java2-5.0; fi
export PATH=${PATH}:${ANT_HOME}/bin

# The current direcotry
currentPath=`echo "$PWD/$0" | sed -e 's/\(.*\)\/.*/\1\//' | sed -e 's/^[^\/]*$//g'`

# The eclipse directory
eclipseDir=$1

# The destination directory
destDir=$currentPath/../references/javadoc

mkdir -p $destDir

# The plugin name
pluginName="org.eclipse.jet"

# Don't execute if the destination directory has files
#if [ -d "$destDir" ]; then
#	exit
#fi

function groupPackage
{
	plugin=$1
	hasToken=`grep "@plugin@" $currentPath/javadoc.xml.template`
	if [ "x$hasToken" != "x"  ]; then
		srcDir=$currentPath/../../$plugin/src
		if [ -d "$srcDir" ]; then
			packages=`find $srcDir -type f -name '*.java' -exec grep -e '^package .*;' {} \; | sed -e 's/^package *\(.*\);/\1/' | sed -e 's/[ ]*//g' | sort | uniq | xargs | sed -e 's/ /:/g'`
			packages=`echo $packages | sed -e 's/\//\\\\\\//g' | sed -e 's/\./\\\\\./g' | grep -F --invert-match -e '.internal'
	
			sed -e "s/\@plugin\@/${packages}/g" $currentPath/javadoc.xml.template > $currentPath/javadoc.xml.template.tmp
		fi
	fi
}

groupPackage $pluginName

# The directory of the plugins in the order they were built 
# Original: pluginDirs=`find $eclipseDir/plugins -name @dot -printf '%T@ %p\n' | sort -n | grep org.eclipse.emf.transaction | cut -f2 -d' ' | sed -e 's/\(\/.*\)\/.*/\1/'`
# New (eclipseDir): pluginDirs=`find $eclipseDir/plugins -name 'org.eclipse.emf.transaction*' -maxdepth 1 -type d -printf '%T@ %p\n' | sort -n | cut -f2 -d' '`
# Finds plugins in the Workspace:
pluginDirs=`find $currentPath/../.. -maxdepth 1 -name "${pluginName}*" -type d -printf '%T@ %p\n' | sort -n | cut -f2 -d' '`

### TODO: missing emf/sdo/xsd plugins (?) in $eclipseDir - need to copy them over or reference source (?)
### so that all classes/packages (and thus @links) can be resolved

# All the jars in the plugins directory
classpath=`find $eclipseDir/plugins -name "*.jar" -printf "%p:"`

# Calculates the packagesets and the calls to copyDocFiles
packagesets=""
copydocfiles=""
for pluginDir in $pluginDirs; do
	pluginDir=`echo $pluginDir | sed -e 's/\/runtime$//g'`
	srcDir=$pluginDir/src
	if [ -d "$srcDir" ]; then
		packagesets=$packagesets"<packageset dir=\"$srcDir\"><exclude name=\"$srcDir/**/doc-files/**\"/></packageset>"
		copydocfiles=$copydocfiles"<copyDocFiles pluginDir=\"$pluginDir\"/>"
	fi
done

# Finds the proper org.eclipse.platform.doc.isv jar
docjar=`find $eclipseDir/plugins/ -name "org.eclipse.platform.doc.isv*.jar" -printf "%f"`

if [ -f $currentPath/javadoc.xml.template ]; then
	true;
else
	cp $currentPath/javadoc.xml.template $currentPath/javadoc.xml.template.tmp;
fi

# Replaces the token @packagesets@ in the template by the actual value
packagesets=`echo $packagesets | sed -e 's/\//\\\\\\//g' | sed -e 's/\./\\\\\./g'`
sed -e "s/\@packagesets\@/${packagesets}/g" $currentPath/javadoc.xml.template.tmp > $currentPath/javadoc.xml.template.tmp2
# Replaces the token @copydocfiles@ in the template by the actual value
copydocfiles=`echo $copydocfiles | sed -e 's/\//\\\\\\//g' | sed -e 's/\./\\\\\./g'`
sed -e "s/\@copydocfiles\@/${copydocfiles}/g" $currentPath/javadoc.xml.template.tmp2 > $currentPath/javadoc.xml.template.tmp
# Replaces the token @docjar@ in the template by the actual value
sed -e "s/\@docjar\@/${docjar}/g" $currentPath/javadoc.xml.template.tmp > $currentPath/javadoc.xml.template.tmp2
# Replaces the token @eclipseDir@ in the template by the actual value
eclipseDirEsc=`echo $eclipseDir | sed -e 's/\//\\\\\//g' | sed -e 's/\./\\\\\./g'`
sed -e "s/\@eclipseDir\@/${eclipseDirEsc}/g" $currentPath/javadoc.xml.template.tmp2 > $currentPath/javadoc.xml

# Executes the ant script
ant -f $currentPath/javadoc.xml \
	-DdestDir="$destDir" \
	-Dclasspath="$classpath" \
	-DeclipseDir="$eclipseDir" \
	-Doverview="$currentPath/overview.html"

# Clean up templates
rm -f $currentPath/javadoc.xml.template.tmp $currentPath/javadoc.xml.template.tmp2 $currentPath/javadoc.xml
#!/bin/sh
# The current direcotry
currentPath=`echo "$PWD/$0" | sed -e 's/\(.*\)\/.*/\1\//' | sed -e 's/^[^\/]*$//g'`

# The eclipse directory
eclipseDir=$1

# The destination directory
destDir=$currentPath/../references/javadoc

# The plugin name
pluginName="org.eclipse.jet"

# Don't execute if the destination directory has files
#if [ -d "$destDir" ]; then
#	exit
#fi

function groupPackage
{
	plugin=$1
	hasToken=`grep "@plugin@" $currentPath/javadoc.xml.template`
	if [ "x$hasToken" != "x"  ]; then
		srcDir=$currentPath/../../$plugin/src
		if [ -d "$srcDir" ]; then
			packages=`find $srcDir -type f -name '*.java' -exec grep -e '^package .*;' {} \; | sed -e 's/^package *\(.*\);/\1/' | sed -e 's/[ \n\t\r]*//g' | sort | uniq | xargs | sed -e 's/ /:/g'`
			packages=`echo $packages | sed -e 's/\//\\\\\\//g' | sed -e 's/\./\\\\\./g'`
	
			sed -e "s/\@plugin\@/${packages}/g" $currentPath/javadoc.xml.template > $currentPath/javadoc.xml.template.tmp
		fi
	fi
}

groupPackage $pluginName

# The directory of the plugins in the order they were built 
# Original: pluginDirs=`find $eclipseDir/plugins -name @dot -printf '%T@ %p\n' | sort -n | grep org.eclipse.emf.transaction | cut -f2 -d' ' | sed -e 's/\(\/.*\)\/.*/\1/'`
# New (eclipseDir): pluginDirs=`find $eclipseDir/plugins -name 'org.eclipse.emf.transaction*' -maxdepth 1 -type d -printf '%T@ %p\n' | sort -n | cut -f2 -d' '`
# Finds plugins in the Workspace:
pluginDirs=`find $currentPath/../../plugins -maxdepth 1 -name "${pluginName}*" -type d -printf '%T@ %p\n' | sort -n | cut -f2 -d' '`

### TODO: missing emf/sdo/xsd plugins (?) in $eclipseDir - need to copy them over or reference source (?)
### so that all classes/packages (and thus @links) can be resolved

# All the jars in the plugins directory
classpath=`find $eclipseDir/plugins -name "*.jar" -printf "%p:"`

# Calculates the packagesets and the calls to copyDocFiles
packagesets=""
copydocfiles=""
for pluginDir in $pluginDirs; do
	pluginDir=`echo $pluginDir | sed -e 's/\/runtime$//g'`
	srcDir=$pluginDir/src
	if [ -d "$srcDir" ]; then
		packagesets=$packagesets"<packageset dir=\"$srcDir\"><exclude name=\"$srcDir/**/doc-files/**\"/></packageset>"
		copydocfiles=$copydocfiles"<copyDocFiles pluginDir=\"$pluginDir\"/>"
	fi
done

# Finds the proper org.eclipse.platform.doc.isv jar
docjar=`find $eclipseDir/plugins/ -name "org.eclipse.platform.doc.isv*.jar" -printf "%f"`

if [ -f $currentPath/javadoc.xml.template ]; then
	true;
else
	cp $currentPath/javadoc.xml.template $currentPath/javadoc.xml.template.tmp;
fi

# Replaces the token @packagesets@ in the template by the actual value
packagesets=`echo $packagesets | sed -e 's/\//\\\\\\//g' | sed -e 's/\./\\\\\./g'`
sed -e "s/\@packagesets\@/${packagesets}/g" $currentPath/javadoc.xml.template.tmp > $currentPath/javadoc.xml.template.tmp2
# Replaces the token @copydocfiles@ in the template by the actual value
copydocfiles=`echo $copydocfiles | sed -e 's/\//\\\\\\//g' | sed -e 's/\./\\\\\./g'`
sed -e "s/\@copydocfiles\@/${copydocfiles}/g" $currentPath/javadoc.xml.template.tmp2 > $currentPath/javadoc.xml.template.tmp
# Replaces the token @docjar@ in the template by the actual value
sed -e "s/\@docjar\@/${docjar}/g" $currentPath/javadoc.xml.template.tmp > $currentPath/javadoc.xml.template.tmp2
# Replaces the token @eclipseDir@ in the template by the actual value
eclipseDirEsc=`echo $eclipseDir | sed -e 's/\//\\\\\//g' | sed -e 's/\./\\\\\./g'`
sed -e "s/\@eclipseDir\@/${eclipseDirEsc}/g" $currentPath/javadoc.xml.template.tmp2 > $currentPath/javadoc.xml

# Executes the ant script
ant -f $currentPath/javadoc.xml \
	-DdestDir="$destDir" \
	-Dclasspath="$classpath" \
	-DeclipseDir="$eclipseDir" \
	-Doverview="$currentPath/overview.html"

# Clean up templates
rm -f $currentPath/javadoc.xml.template.tmp $currentPath/javadoc.xml.template.tmp2 $currentPath/javadoc.xml

Back to the top