1#!/bin/bash 2function die() { 3 echo "Error: $*" 4 exit 1 5} 6 7set -e # fail early 8 9# CD to the top android directory 10D=`dirname "$0"` 11cd "$D/../../../../" 12 13DEST="development/tools/eclipse/plugins/com.android.ide.eclipse.adt" 14# computes "../.." from DEST to here (in /android) 15BACK=`echo $DEST | sed 's@[^/]*@..@g'` 16 17LIBS="sdkstats jarutils androidprefs layoutlib_api layoutlib_utils ninepatch sdklib sdkuilib" 18 19echo "make java libs ..." 20make -j3 showcommands $LIBS || die "ADT: Fail to build one of $LIBS." 21 22echo "Copying java libs to $DEST" 23 24HOST=`uname` 25if [ "$HOST" == "Linux" ]; then 26 for LIB in $LIBS; do 27 ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/" 28 done 29 ln -svf $BACK/out/host/linux-x86/framework/kxml2-2.3.0.jar "$DEST/" 30 ln -svf $BACK/out/host/linux-x86/framework/commons-compress-1.0.jar "$DEST/" 31 32elif [ "$HOST" == "Darwin" ]; then 33 for LIB in $LIBS; do 34 ln -svf $BACK/out/host/darwin-x86/framework/$LIB.jar "$DEST/" 35 done 36 ln -svf $BACK/out/host/darwin-x86/framework/kxml2-2.3.0.jar "$DEST/" 37 ln -svf $BACK/out/host/darwin-x86/framework/commons-compress-1.0.jar "$DEST/" 38 39elif [ "${HOST:0:6}" == "CYGWIN" ]; then 40 for LIB in $LIBS; do 41 cp -vf out/host/windows-x86/framework/$LIB.jar "$DEST/" 42 done 43 44 if [ ! -f "$DEST/kxml2-2.3.0.jar" ]; then 45 cp -v "prebuilt/common/kxml2/kxml2-2.3.0.jar" "$DEST/" 46 fi 47 48 if [ ! -f "$DEST/commons-compress-1.0.jar" ]; then 49 cp -v "prebuilt/common/commons-compress/commons-compress-1.0.jar" "$DEST/" 50 fi 51 52 chmod -v a+rx "$DEST"/*.jar 53else 54 echo "Unsupported platform ($HOST). Nothing done." 55fi 56 57