1 #!/bin/bash 2 3 set -e 4 5 # CD to the top android directory 6 D=`dirname "$0"` 7 cd "$D/../../../" 8 9 function die() { 10 echo "Error: $*" 11 exit 1 12 } 13 14 # computes relative ".." paths from $1 to here (in /android) 15 function back() { 16 echo $1 | sed 's@[^/]*@..@g' 17 } 18 19 HOST=`uname` 20 if [ "${HOST:0:6}" == "CYGWIN" ]; then 21 # We can't use symlinks under Cygwin 22 function cpdir() { # $1=dest $2=source 23 echo "rsync $2 => $1" 24 rsync -avW --delete-after $2 $1 25 } 26 27 else 28 # For all other systems which support symlinks 29 function cpdir() { # $1=dest $2=source 30 ln -svf `back $1`/$2 $1 31 } 32 fi 33 34 BASE="sdk/eclipse/plugins/com.android.ide.eclipse.tests" 35 DEST=$BASE 36 BACK=`back $DEST` 37 38 LIBS="easymock" 39 40 echo "make java libs ..." 41 make -j3 showcommands $LIBS || die "ADT: Fail to build one of $LIBS." 42 43 echo "Copying java libs to $DEST" 44 45 HOST=`uname` 46 if [ "$HOST" == "Linux" ]; then 47 for LIB in $LIBS; do 48 ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/" 49 done 50 ln -svf $BACK/out/host/linux-x86/framework/kxml2-2.3.0.jar "$DEST/" 51 52 elif [ "$HOST" == "Darwin" ]; then 53 for LIB in $LIBS; do 54 ln -svf $BACK/out/host/darwin-x86/framework/$LIB.jar "$DEST/" 55 done 56 ln -svf $BACK/out/host/darwin-x86/framework/kxml2-2.3.0.jar "$DEST/" 57 58 elif [ "${HOST:0:6}" == "CYGWIN" ]; then 59 for LIB in $LIBS; do 60 cp -vf out/host/windows-x86/framework/$LIB.jar "$DEST/" 61 done 62 if [ ! -f "$DEST/kxml2-2.3.0.jar" ]; then 63 cp -v "prebuilt/common/kxml2/kxml2-2.3.0.jar" "$DEST/" 64 fi 65 66 chmod -v a+rx "$DEST"/*.jar 67 else 68 echo "Unsupported platform ($HOST). Nothing done." 69 fi 70 71 # Cleanup old obsolete symlink 72 73 function clean() { 74 if [[ -e "$1" || -L "$1" ]]; then 75 rm -rfv "$1" 76 fi 77 } 78 79 DEST=$BASE/unittests/com/android 80 clean $DEST/sdkuilib 81 clean $DEST/ddmlib 82 clean $DEST/sdklib 83 84 DEST=$BASE/unittests/com/android/layoutlib 85 clean $DEST/bridge 86 clean $DEST/testdata 87 88