blob: 8791316b576192ed683eb76458b979293115b0bc [file] [log] [blame]
The Android Open Source Project55a2c712009-03-03 19:29:09 -08001#!/bin/bash
2#----------------------------------------------------------------------------|
3# Creates the links to use ddm{ui}lib in the eclipse-ide plugin.
Raphaelf1d64e22009-11-18 11:27:35 -08004# Run this from sdk/eclipse/scripts
The Android Open Source Project55a2c712009-03-03 19:29:09 -08005#----------------------------------------------------------------------------|
6
7set -e
8
Raphael Moll3b857be2010-06-28 17:39:53 -07009function die() {
10 echo "Error: $*"
11 exit 1
12}
13
The Android Open Source Project55a2c712009-03-03 19:29:09 -080014HOST=`uname`
Xavier Ducrohete312b282010-06-22 17:55:45 -070015
The Android Open Source Project55a2c712009-03-03 19:29:09 -080016if [ "${HOST:0:6}" == "CYGWIN" ]; then
Xavier Ducrohete312b282010-06-22 17:55:45 -070017 PLATFORM="windows-x86"
18
The Android Open Source Project55a2c712009-03-03 19:29:09 -080019 # We can't use symlinks under Cygwin
20
21 function cpfile { # $1=dest $2=source
22 cp -fv $2 $1/
23 }
24
25 function cpdir() { # $1=dest $2=source
26 rsync -avW --delete-after $2 $1
27 }
28
29else
Xavier Ducrohete312b282010-06-22 17:55:45 -070030 if [ "$HOST" == "Linux" ]; then
31 PLATFORM="linux-x86"
32 elif [ "$HOST" == "Darwin" ]; then
33 PLATFORM="darwin-x86"
34 else
35 echo "Unsupported platform ($HOST). Nothing done."
36 fi
37
The Android Open Source Project55a2c712009-03-03 19:29:09 -080038 # For all other systems which support symlinks
39
40 # computes the "reverse" path, e.g. "a/b/c" => "../../.."
41 function back() {
42 echo $1 | sed 's@[^/]*@..@g'
43 }
44
45 function cpfile { # $1=dest $2=source
46 ln -svf `back $1`/$2 $1/
47 }
48
49 function cpdir() { # $1=dest $2=source
50 ln -svf `back $1`/$2 $1
51 }
52fi
53
54# CD to the top android directory
55D=`dirname "$0"`
Raphaelf1d64e22009-11-18 11:27:35 -080056cd "$D/../../../"
The Android Open Source Project55a2c712009-03-03 19:29:09 -080057
Raphaelf1d64e22009-11-18 11:27:35 -080058BASE="sdk/eclipse/plugins/com.android.ide.eclipse.ddms"
The Android Open Source Project55a2c712009-03-03 19:29:09 -080059DEST=$BASE/libs
Xavier Ducrohete312b282010-06-22 17:55:45 -070060
The Android Open Source Project55a2c712009-03-03 19:29:09 -080061mkdir -p $DEST
62for i in prebuilt/common/jfreechart/*.jar; do
63 cpfile $DEST $i
64done
65
Xavier Ducrohete312b282010-06-22 17:55:45 -070066LIBS="ddmlib ddmuilib"
Xavier Ducrohet79ce0fe2010-06-25 10:38:13 -070067echo "make java libs ..."
68make -j3 showcommands $LIBS || die "DDMS: Fail to build one of $LIBS."
69
Xavier Ducrohete312b282010-06-22 17:55:45 -070070for LIB in $LIBS; do
Xavier Ducrohet79ce0fe2010-06-25 10:38:13 -070071 cpfile $DEST out/host/$PLATFORM/framework/$LIB.jar
The Android Open Source Project55a2c712009-03-03 19:29:09 -080072done
Raphael Moll3b857be2010-06-28 17:39:53 -070073
74if [ "${HOST:0:6}" == "CYGWIN" ]; then
75 # On Windows we used to make a hard copy of the ddmlib/ddmuilib
76 # under the plugin source tree. Now that we're using external JARs
77 # we need to actually remove these obsolete sources.
78 for i in ddmlib ddmuilib ; do
79 DIR=$BASE/src/com/android/$i
80 if [ -d $DIR ]; then
81 rm -rfv $BASE/src/com/android/$i
82 fi
83 done
84fi