blob: 9383271ae209053ed49a76acdabb5bc8b8bfddfc [file] [log] [blame]
#!/bin/bash
set noglob
OUTFILE=packages.properties
TMPFILE=/tmp/gwt-javadoc-packages$$
# Regex patterns to exclude from the list of packages
EXCLUSIONS="\
^com\.example\.|\
^com\.google\.gwt\.dev(\.|$)|\
^com\.google\.gwt\.emul\.|\
^com\.google\.gwt\.examples(\.|$)|\
^com\.google\.gwt\.i18n\.server(\.|$)|\
^com\.google\.gwt\.i18n\.tools|\
^com\.google\.gwt\.lang|\
^com\.google\.gwt\.junit(\.|$)|\
^com\.google\.gwt\.resources\.css(\.|$)|\
^com\.google\.gwt\.resources\.rg(\.|$)|\
^com\.google\.gwt\.rpc\.client\.ast(\.|$)|\
^com\.google\.gwt\.soyc(\.|$)|\
^com\.google\.gwt\.validation(.|$)|\
^com\.google\.gwt\.user\.client\.rpc\.core\.|\
^javax\.|\
^junit\.|\
^org\.|\
\.impl(\.|$)|\
\.rebind(\.|$)"
# Generate the packages.properties file
# Changes to LANG_PKGS and USER_CLASSES go here
# Note that line continuation backslashes must be escaped
cat > ${OUTFILE} <<EOF
# THIS FILE IS AUTOMATICALLY GENERATED
#
# This file contains all of the user javadoc packages
#
# JRE emulation packages
LANG_PKGS=\\
java.lang;\\
java.lang.annotation;\\
java.io;\\
java.sql;\\
java.util
# The last package should not have a trailing semicolon
# Individual classes to include when we don't want to include an entire package
USER_CLASSES=\\
\${gwt.root}/user/src/com/google/gwt/junit/tools/GWTTestSuite.java:\\
\${gwt.root}/user/src/com/google/gwt/i18n/rebind/LocaleUtils.java:\\
\${gwt.root}/user/src/com/google/gwt/i18n/server/GwtLocaleFactoryImpl.java:\\
\${gwt.root}/user/src/com/google/gwt/i18n/server/GwtLocaleImpl.java
# Packages to include
USER_PKGS=\\
EOF
rm -f ${TMPFILE}
# Create a list of all packages with at least one Java source file
# List all source files
for dir in ../user/src ../user/javadoc ../user/super ../dev/core/src ../dev/core/super
do
(cd ${dir}; find . -name '*.java') >> ${TMPFILE}
done
cat ${TMPFILE} | \
# Remove source file names
sed 's@/[-A-Za-z0-9_]*\.java$@@'| \
# Removce initial './'
sed s@^\./@@ | \
# Remove .../super/ and .../translatable prefixes
sed s@^.*/super/@@ | \
sed s@^.*/translatable/@@ | \
# Change slashes to dots
sed s@/@.@g | \
# Remove excluded patters
egrep -v ${EXCLUSIONS} > ${TMPFILE}-2
mv ${TMPFILE}-2 ${TMPFILE}
# Re-add whitelisted packages that would otherwise be excluded
echo com.google.gwt.i18n.rebind.format >> ${TMPFILE}
echo com.google.gwt.i18n.rebind.keygen >> ${TMPFILE}
echo com.google.gwt.junit.client >> ${TMPFILE}
# Sort, uniqify, and add ';\' to each line except the last
cat ${TMPFILE} | \
sort | \
uniq | \
sed '$q;s@$@;\\@' >> ${OUTFILE}
echo '# The last package should not have a trailing semicolon' >> ${OUTFILE}
# Clean up
rm -f ${TMPFILE}