aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/scripts/create_ddms_symlinks.sh
blob: 48f5c5178c62dc7baeedcd9fe4fa8fb5d40edfb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
#----------------------------------------------------------------------------|
# Creates the links to use ddm{ui}lib in the eclipse-ide plugin.
# Run this from sdk/eclipse/scripts
#----------------------------------------------------------------------------|

set -e

function die() {
    echo "Error: $*"
    exit 1
}

HOST=`uname`

if [ "${HOST:0:6}" == "CYGWIN" ]; then
    PLATFORM="windows-x86"

    # We can't use symlinks under Cygwin

    function cpfile { # $1=dest $2=source
        cp -fv $2 $1/
    }

    function cpdir() { # $1=dest $2=source
        rsync -avW --delete-after $2 $1
    }

else
    if [ "$HOST" == "Linux" ]; then
        PLATFORM="linux-x86"
    elif [ "$HOST" == "Darwin" ]; then
        PLATFORM="darwin-x86"
    else
        echo "Unsupported platform ($HOST). Nothing done."
    fi

    # For all other systems which support symlinks

    # computes the "reverse" path, e.g. "a/b/c" => "../../.."
    function back() {
        echo $1 | sed 's@[^/]*@..@g'
    }

    function cpfile { # $1=dest $2=source
        ln -svf `back $1`/$2 $1/
    }

    function cpdir() { # $1=dest $2=source
        ln -svf `back $1`/$2 $1
    }
fi

# CD to the top android directory
D=`dirname "$0"`
cd "$D/../../../"

BASE="sdk/eclipse/plugins/com.android.ide.eclipse.ddms"
DEST=$BASE/libs

mkdir -p $DEST
for i in prebuilt/common/jfreechart/*.jar; do
  cpfile $DEST $i
done

COPY_LIBS="ddmlib ddmuilib"
ALL_LIBS="$COPY_LIBS swtmenubar"
echo "make java libs ..."
make -j3 showcommands $ALL_LIBS || die "DDMS: Fail to build one of $ALL_LIBS."

for LIB in $COPY_LIBS; do
    cpfile $DEST out/host/$PLATFORM/framework/$LIB.jar
done

if [ "${HOST:0:6}" == "CYGWIN" ]; then
    # On Windows we used to make a hard copy of the ddmlib/ddmuilib
    # under the plugin source tree. Now that we're using external JARs
    # we need to actually remove these obsolete sources.
    for i in ddmlib ddmuilib ; do
        DIR=$BASE/src/com/android/$i
        if [ -d $DIR ]; then
            rm -rfv $BASE/src/com/android/$i
        fi
    done
fi