| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #----------------------------------------------------------------------------| |
| 3 | # Creates the links to use ddm{ui}lib in the eclipse-ide plugin. |
| Raphael | f1d64e2 | 2009-11-18 11:27:35 -0800 | [diff] [blame] | 4 | # Run this from sdk/eclipse/scripts |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 5 | #----------------------------------------------------------------------------| |
| 6 | |
| 7 | set -e |
| 8 | |
| Raphael Moll | 3b857be | 2010-06-28 17:39:53 -0700 | [diff] [blame] | 9 | function die() { |
| 10 | echo "Error: $*" |
| 11 | exit 1 |
| 12 | } |
| 13 | |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 14 | HOST=`uname` |
| Xavier Ducrohet | e312b28 | 2010-06-22 17:55:45 -0700 | [diff] [blame] | 15 | |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 16 | if [ "${HOST:0:6}" == "CYGWIN" ]; then |
| Xavier Ducrohet | e312b28 | 2010-06-22 17:55:45 -0700 | [diff] [blame] | 17 | PLATFORM="windows-x86" |
| 18 | |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 19 | # 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 | |
| 29 | else |
| Xavier Ducrohet | e312b28 | 2010-06-22 17:55:45 -0700 | [diff] [blame] | 30 | 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 Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 38 | # 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 | } |
| 52 | fi |
| 53 | |
| 54 | # CD to the top android directory |
| 55 | D=`dirname "$0"` |
| Raphael | f1d64e2 | 2009-11-18 11:27:35 -0800 | [diff] [blame] | 56 | cd "$D/../../../" |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 57 | |
| Raphael | f1d64e2 | 2009-11-18 11:27:35 -0800 | [diff] [blame] | 58 | BASE="sdk/eclipse/plugins/com.android.ide.eclipse.ddms" |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 59 | DEST=$BASE/libs |
| Xavier Ducrohet | e312b28 | 2010-06-22 17:55:45 -0700 | [diff] [blame] | 60 | |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 61 | mkdir -p $DEST |
| 62 | for i in prebuilt/common/jfreechart/*.jar; do |
| 63 | cpfile $DEST $i |
| 64 | done |
| 65 | |
| Xavier Ducrohet | e312b28 | 2010-06-22 17:55:45 -0700 | [diff] [blame] | 66 | LIBS="ddmlib ddmuilib" |
| Xavier Ducrohet | 79ce0fe | 2010-06-25 10:38:13 -0700 | [diff] [blame] | 67 | echo "make java libs ..." |
| 68 | make -j3 showcommands $LIBS || die "DDMS: Fail to build one of $LIBS." |
| 69 | |
| Xavier Ducrohet | e312b28 | 2010-06-22 17:55:45 -0700 | [diff] [blame] | 70 | for LIB in $LIBS; do |
| Xavier Ducrohet | 79ce0fe | 2010-06-25 10:38:13 -0700 | [diff] [blame] | 71 | cpfile $DEST out/host/$PLATFORM/framework/$LIB.jar |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 72 | done |
| Raphael Moll | 3b857be | 2010-06-28 17:39:53 -0700 | [diff] [blame] | 73 | |
| 74 | if [ "${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 |
| 84 | fi |