summaryrefslogtreecommitdiffstats
path: root/tools/findunused
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:43:58 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-02-10 15:43:58 -0800
commite3c5766074e2d6d1dcd60c4dafabce8a0c20d2b8 (patch)
treee1440f63420acf2b3808f57738bc600b5d710c1e /tools/findunused
parent5a4d0fa291a7269007701282f32cfda55ce39008 (diff)
downloadandroid_development-e3c5766074e2d6d1dcd60c4dafabce8a0c20d2b8.tar.gz
android_development-e3c5766074e2d6d1dcd60c4dafabce8a0c20d2b8.tar.bz2
android_development-e3c5766074e2d6d1dcd60c4dafabce8a0c20d2b8.zip
auto import from //branches/cupcake/...@130745
Diffstat (limited to 'tools/findunused')
-rwxr-xr-xtools/findunused/findunusedresources17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/findunused/findunusedresources b/tools/findunused/findunusedresources
index 963e2f1e6..748139a70 100755
--- a/tools/findunused/findunusedresources
+++ b/tools/findunused/findunusedresources
@@ -25,9 +25,24 @@ fi
for app in $apps
do
+ echo '-----------------------------------------------------------'
if [ -d $app/res ]
then
appname=$(basename $app)
+ resources=
+ for res in $(echo $app/res/*)
+ do
+ resources="$resources $(echo $res | grep -v '\-mcc\|[a-z]*-[a-z][a-z]$\|[a-z]*-[a-z][a-z]-.*')"
+ done
+ sources=$app/src
+ if [ -d $app/tests ]
+ then
+ sources="$sources $app/tests"
+ fi
+ if [ -d $app/samples ]
+ then
+ sources="$sources $app/samples"
+ fi
# find the R.java file that contains all the generated resource identifiers
rDotJava=$(find out/target/common/obj/APPS/${appname}_intermediates/ -name R.java)
@@ -40,7 +55,7 @@ do
# refer to such constants from java by using an underscore instead of a period, we also
# replace all underscores with a pattern that will match periods and underscores.
p=$(echo $i | sed 's/_/[\\._]/g')
- echo $i $(grep -Rw R\\..*\\.$i\\\|@style/$p\\\|@drawable/$p\\\|@anim/$p\\\|@color/$p\\\|@xml/$p\\\|@layout/$p\\\|@menu/$p\\\|@+id/$p\\\|@array/$p\\\|@string/$p $app | wc -l)
+ echo $i $(grep -Rw R\\..*\\.$i\\\|@style/$p\\\|@drawable/$p\\\|@anim/$p\\\|@color/$p\\\|@xml/$p\\\|@layout/$p\\\|@menu/$p\\\|@+id/$p\\\|@array/$p\\\|@string/$p\\\|@dimen/$p $resources $sources $app/AndroidManifest.xml | wc -l)
done | grep " 0$" | {
# this block gets as its input a list of constants which no references were found, one per line
if [ "$showall" == "yes" ]