Home | History | Annotate | Download | only in tools
      1 #!/bin/sh
      2 #
      3 # Copyright (C) 2010 The Android Open Source Project
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License");
      6 # you may not use this file except in compliance with the License.
      7 # You may obtain a copy of the License at
      8 #
      9 #      http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS,
     13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 # See the License for the specific language governing permissions and
     15 # limitations under the License.
     16 #
     17 # dev-cleanup.sh
     18 #
     19 # Remove any intermediate files (e.g. object files) from the development
     20 # directories.
     21 #
     22 . `dirname $0`/prebuilt-common.sh
     23 
     24 DIR=$ANDROID_NDK_ROOT
     25 
     26 if [ -f $DIR/RELEASE/TXT ]; then
     27     echo "ERROR: You cannot run this script in a release directory !"
     28     exit 1
     29 fi
     30 if [ ! -d $DIR/.git ] ; then
     31     echo "ERROR: You must call this script in a development directory !"
     32     exit 1
     33 fi
     34 
     35 # Remove generated directories
     36 rm -rf $DIR/platforms
     37 rm -rf $DIR/toolchains/*/prebuilt
     38 rm -rf $DIR/samples
     39 rm -rf $DIR/prebuilt
     40 
     41 # Remove prebuilt binaries
     42 rm -rf $DIR/$STLPORT_SUBDIR/libs
     43 rm -rf $DIR/$GNUSTL_SUBDIR/include
     44 rm -rf $DIR/$GNUSTL_SUBDIR/libs
     45 rm -rf $DIR/$GABIXX_SUBDIR/libs
     46 
     47 rm -f $DIR/ndk-stack*
     48 
     49 clean_dir ()
     50 {
     51     if [ -d "$1" ] ; then
     52         echo "rm -rf $1"
     53         rm -rf $1
     54     fi
     55 }
     56 
     57 clean_file ()
     58 {
     59     if [ -f "$1" ] ; then
     60         echo "rm -f $1"
     61         rm -f $1
     62     fi
     63 }
     64 
     65 cleanup_project ()
     66 {
     67     clean_dir  $1/obj
     68     clean_dir  $1/libs
     69     clean_dir  $1/bin
     70     clean_dir  $1/gen
     71     clean_file $1/build.xml
     72     clean_file $1/local.properties
     73 }
     74 
     75 # Cleanup the tests
     76 DIR=$ANDROID_NDK_ROOT
     77 for PROJECT in $DIR/tests/build/*; do
     78     cleanup_project $PROJECT
     79 done
     80 for PROJECT in $DIR/tests/device/*; do
     81     cleanup_project $PROJECT
     82 done
     83 
     84 # Cleanup development/ndk
     85 DIR=`dirname $ANDROID_NDK_ROOT`/development/ndk
     86 if [ ! -d $DIR ] ; then
     87     echo "WARNING: Development directory missing: $DIR"
     88     exit 0
     89 fi
     90 for PROJECT in $DIR/samples/*; do
     91     cleanup_project $PROJECT
     92 done
     93 for PROJECT in $DIR/platforms/android-*/samples/*; do
     94     cleanup_project $PROJECT
     95 done
     96