#!/bin/bash # Generates eclipse user library files so that you can simpy point # your eclipse classpath to one of these files to be able to brwose # source/docs/etc. # # author conway # since 4/12/2006 scriptName=$0 doAll=0 if [[ $1 == "-all" ]]; then doAll=1 fi oldCwd=`pwd` cd `dirname ${scriptName}` scriptHome=`pwd` cd $oldCwd includeDeps=0 libAll="$scriptHome/all.xml" rm -f $libAll echo -e "\ \n\ \n\ \n\ " >> $libAll genEach() { eachPath=$1 docFile=$2 if [[ ! -f "$docFile" ]]; then echo Skipping $eachPath; continue; fi echo "Generating for $eachPath" libName=${eachPath#$scriptHome/} libName=${libName//\//-} libEach="$scriptHome/$libName.xml" srcFile="$eachPath/src.zip" docPath=`jar -tf $docFile | grep package-list` docPath="/`dirname $docPath`" jarFiles=`ls $eachPath/*.jar` if [[ $includeDeps > 0 ]]; then depJars=`ls $eachPath/deps/*.jar 2> /dev/null` fi libEachContents="" for jarFile in $jarFiles; do libEachContents="$libEachContents\n" done for depFile in $depJars; do libEachContents="$libEachContents\n" done rm -f $libEach echo -e "\ \n\ \n\ \n\ $libEachContents\n\ \n\ \n\ " >> $libEach echo -e "$libEachContents\n" >> $libAll } if (($doAll)); then echo "Generating for all versions" find $scriptHome -name deps -prune -o -name "docs.zip" -print | while read docFile; do eachPath=`dirname $docFile` genEach $eachPath $docFile done else echo "Generating only for head versions" find $scriptHome -type d -a -maxdepth 1 -a -mindepth 1 | grep -v CVS | while read eachPackageDir; do headVer=`ls $eachPackageDir | grep -v CVS | sort -r | head -n 1`; eachPath="$eachPackageDir/$headVer" docFile="$eachPath/docs.zip" genEach $eachPath $docFile done fi echo -e "\ \n\ \n\ " >> $libAll