#!/bin/bash # # Utility for creating a src.zip from *all* the Java source files in a JDK workspace. # if [ $# -ne 2 ]; then echo "Usage: $0 " exit 1; fi #set -x archive_dir=$(dirname $2) mkdir -p $archive_dir || { echo "Could not create $archive_dir"; exit 1; } pushd $archive_dir >/dev/null archive=$(/bin/pwd)/$(basename $2) popd >/dev/null if [ -e $archive ]; then echo "Cannot overwrite $archive - please delete it first" exit 1 fi ws=$1 pushd $ws >/dev/null if [ -d j2se ]; then jdk="j2se" elif [ -d jdk ]; then jdk="jdk" else echo "$ws does not appear to be a valid JDK workspace - no 'j2se' or 'jdk' subdirectory" exit 1 fi for classes_dir in $jdk/src/*/classes; do echo "Adding sources from $classes_dir to $archive ..." pushd $classes_dir >/dev/null zip -r -q -u $archive . -i \*.java -x \*SCCS\* popd >/dev/null done popd >/dev/null