dev-cleanup.sh 2.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/bin/sh
#
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# dev-cleanup.sh
#
# Remove any intermediate files (e.g. object files) from the development
# directories.
#
David 'Digit' Turner's avatar
David 'Digit' Turner committed
22
. `dirname $0`/prebuilt-common.sh
23 24 25 26 27 28 29 30 31 32 33 34

DIR=$ANDROID_NDK_ROOT

if [ -f $DIR/RELEASE/TXT ]; then
    echo "ERROR: You cannot run this script in a release directory !"
    exit 1
fi
if [ ! -d $DIR/.git ] ; then
    echo "ERROR: You must call this script in a development directory !"
    exit 1
fi

David 'Digit' Turner's avatar
David 'Digit' Turner committed
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

David 'Digit' Turner's avatar
David 'Digit' Turner committed
41 42
# Remove prebuilt binaries
rm -rf $DIR/$STLPORT_SUBDIR/libs
43
rm -rf $DIR/$GABIXX_SUBDIR/libs
44 45 46
for VERSION in $DEFAULT_GCC_VERSION_LIST; do
    rm -rf $DIR/$GNUSTL_SUBDIR/$VERSION
done
47

48 49
rm -f $DIR/ndk-stack*

50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
clean_dir ()
{
    if [ -d "$1" ] ; then
        echo "rm -rf $1"
        rm -rf $1
    fi
}

clean_file ()
{
    if [ -f "$1" ] ; then
        echo "rm -f $1"
        rm -f $1
    fi
}

cleanup_project ()
{
68
    clean_dir  $1/obj
69 70 71 72 73 74 75
    clean_dir  $1/libs
    clean_dir  $1/bin
    clean_dir  $1/gen
    clean_file $1/build.xml
    clean_file $1/local.properties
}

David 'Digit' Turner's avatar
David 'Digit' Turner committed
76 77 78
# Cleanup the tests
DIR=$ANDROID_NDK_ROOT
for PROJECT in $DIR/tests/build/*; do
79 80
    cleanup_project $PROJECT
done
David 'Digit' Turner's avatar
David 'Digit' Turner committed
81
for PROJECT in $DIR/tests/device/*; do
82 83
    cleanup_project $PROJECT
done
David 'Digit' Turner's avatar
David 'Digit' Turner committed
84 85 86 87 88 89 90 91

# Cleanup development/ndk
DIR=`dirname $ANDROID_NDK_ROOT`/development/ndk
if [ ! -d $DIR ] ; then
    echo "WARNING: Development directory missing: $DIR"
    exit 0
fi
for PROJECT in $DIR/samples/*; do
92 93
    cleanup_project $PROJECT
done
David 'Digit' Turner's avatar
David 'Digit' Turner committed
94
for PROJECT in $DIR/platforms/android-*/samples/*; do
95 96
    cleanup_project $PROJECT
done