Files
narya/tests/bin/check_genservice.sh
T
Jamie Doornbos 61b1f23303 Narya.abc work - refactored GenServiceTask import mechanism in order to generate
clean action script files with no unnecessary imports
* New class ImportSet to facilitate the operations being performed manually
  throughout the code. Also removes the need for rawimports
* Threaded ImportSet through all places where imports and rawimports were used
  and removed magic parameters to control import generation
* Added an ImportSet instance to ServiceListener, this was key to the action 
  script fixes
* Moved all the import tweaking and munging logic into the generate* methods
  and made specific to code being generated (removed overreaching stuff
  from ServiceMethod, this was part of the problem)
* Removed blanket imports from tmpl files
* Removed unused methods
* Fixed tabs from last commit
* Quick and dirty script to check for unused imports


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5041 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-05-06 22:44:36 +00:00

38 lines
602 B
Bash
Executable File

#!/bin/bash
tmp=/tmp/check_genservices_temp
echo "" > $tmp
pushd .. > /dev/null
ant genservice
err=$?
popd > /dev/null
[[ $err -eq 0 ]] || exit $err
count()
{
class=$1
file=$2
perl -e '
$count = 0;
while (<>)
{
++$count if /\b'$class'\b/;
}
print $count
' $file
}
find .. \( -name \*.java -o -name \*.as \) -newer $tmp | while read file; do
egrep ^import $file | sed -e 's/;//' | while read import; do
class=${import##*.}
# echo "Checking $class in $file"
if [ $(count $class $file) -lt 2 ]; then
echo "ERROR: ${import} not used in file $file"
fi
done
done
rm $tmp