1 #!/bin/bash 2 #----------------------------------------------------------------------------| 3 # Creates the links to use ddm{ui}lib in the eclipse-ide plugin. 4 # Run this from sdk/eclipse/scripts 5 #----------------------------------------------------------------------------| 6 7 set -e 8 9 function die() { 10 echo "Error: $*" 11 exit 1 12 } 13 14 HOST=`uname` 15 16 if [ "${HOST:0:6}" == "CYGWIN" ]; then 17 PLATFORM="windows-x86" 18 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 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 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"` 56 cd "$D/../../../" 57 58 BASE="sdk/eclipse/plugins/com.android.ide.eclipse.ddms" 59 DEST=$BASE/libs 60 61 mkdir -p $DEST 62 for i in prebuilt/common/jfreechart/*.jar; do 63 cpfile $DEST $i 64 done 65 66 LIBS="ddmlib ddmuilib" 67 echo "make java libs ..." 68 make -j3 showcommands $LIBS || die "DDMS: Fail to build one of $LIBS." 69 70 for LIB in $LIBS; do 71 cpfile $DEST out/host/$PLATFORM/framework/$LIB.jar 72 done 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 85