1 #!/bin/bash 2 function die() { 3 echo "Error: $*" 4 exit 1 5 } 6 7 set -e # fail early 8 9 # CD to the top android directory 10 D=`dirname "$0"` 11 cd "$D/../../../" 12 13 DEST="sdk/eclipse/plugins/com.android.ide.eclipse.adt/libs" 14 # computes "../.." from DEST to here (in /android) 15 BACK=`echo $DEST | sed 's@[^/]*@..@g'` 16 17 mkdir -p $DEST 18 19 LIBS="sdkstats androidprefs common layoutlib_api ide_common rule_api ninepatch sdklib sdkuilib assetstudio" 20 21 echo "make java libs ..." 22 make -j3 showcommands $LIBS || die "ADT: Fail to build one of $LIBS." 23 24 # Add in lint_api and lint_checks: Not build targets but are copy targets 25 LIBS="$LIBS lint_api lint_checks" 26 make -j3 showcommands lint || die "ADT: Fail to build one of $LIBS." 27 28 echo "Copying java libs to $DEST" 29 30 # Prebuilts required by sdklib & co, to be linked/copied in the ADT libs folder 31 PREBUILTS="\ 32 prebuilt/common/kxml2/kxml2-2.3.0.jar \ 33 prebuilt/common/commons-compress/commons-compress-1.0.jar \ 34 prebuilt/common/http-client/httpclient-4.1.1.jar \ 35 prebuilt/common/http-client/httpcore-4.1.jar \ 36 prebuilt/common/http-client/httpmime-4.1.1.jar \ 37 prebuilt/common/http-client/commons-logging-1.1.1.jar \ 38 prebuilt/common/http-client/commons-codec-1.4.jar \ 39 " 40 41 42 HOST=`uname` 43 if [ "$HOST" == "Linux" ]; then 44 for LIB in $LIBS; do 45 ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/" 46 done 47 48 for P in $PREBUILTS; do 49 ln -svf $BACK/$P "$DEST/" 50 done 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 57 for P in $PREBUILTS; do 58 ln -svf $BACK/$P "$DEST/" 59 done 60 61 elif [ "${HOST:0:6}" == "CYGWIN" ]; then 62 for LIB in $LIBS; do 63 cp -vf out/host/windows-x86/framework/$LIB.jar "$DEST/" 64 done 65 66 cp -v $PREBUILTS "$DEST/" 67 chmod -v a+rx "$DEST"/*.jar 68 else 69 echo "Unsupported platform ($HOST). Nothing done." 70 fi 71