blob: 2c08f02b6192b9fb9340a82ecf5770a702668123 [file] [log] [blame]
Makoto Onuki91237e92010-02-02 15:06:52 -08001#!/bin/bash
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#
Makoto Onuki217466e2010-02-04 13:09:28 -080018# You can remove exchange by running this script.
Makoto Onuki91237e92010-02-02 15:06:52 -080019#
20
21set -e # fail fast
22
Makoto Onuki91237e92010-02-02 15:06:52 -080023# Step 0. Make sure we're in the right directory, and the user really wants it.
24
25if [[ ! -d src/com/android/email/ ]] ; then
26 echo "Run the script in the root of the email source tree." 1>&2
27 exit 1
28fi
29
30echo ""
31echo -n "Do you wish to remove exchange support from the email app? (y/N):"
32
33read answer
34if [[ "$answer" != y ]] ; then
35 echo "Aborted." 1>&2
36 exit 1
37fi
38
39
40# Step 1. Remove all Exchange related packages.
41
42rm -fr src/com/android/exchange/ \
43 tests/src/com/android/exchange/
44
45
46# Step 2. Remove lines surrounded by START-EXCHANGE and END-EXCHANGE
47
48find . \( -name '*.java' -o -name '*.xml' -o -name 'Android.mk' \) -print0 |
Makoto Onukia8caa2f2011-01-28 13:39:39 -080049 xargs -0 sed -i "" -e '/EXCHANGE-REMOVE-SECTION-START/,/EXCHANGE-REMOVE-SECTION-END/d'
Makoto Onuki91237e92010-02-02 15:06:52 -080050
51
52# Step 3. Remove all imports from com.android.exchange (and its subpackages).
53
54find . -name '*.java' -print0 |
Makoto Onukia8caa2f2011-01-28 13:39:39 -080055 xargs -0 sed -i "" -e '/^import com\.android\.exchange/d'
Makoto Onuki91237e92010-02-02 15:06:52 -080056
57
58echo ""
59echo "Exchange support has been successfully removed."
60
61exit 0