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
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user