diff --git a/tools/eclipse/scripts/create_adt_symlinks.sh b/tools/eclipse/scripts/create_adt_symlinks.sh index 49744323a..4bf127175 100755 --- a/tools/eclipse/scripts/create_adt_symlinks.sh +++ b/tools/eclipse/scripts/create_adt_symlinks.sh @@ -1,42 +1,44 @@ #!/bin/bash function die() { - echo "Error: $*" - exit 1 + echo "Error: $*" + exit 1 } set -e # fail early -# This may run either from the //device directory or from the -# eclipse/script directory. Allow for both. -D="device/tools/eclipse/scripts" -[ -d "$D" ] && cd "$D" -[ -d "../$D" ] && cd "../$D" +# CD to the top android directory +D=`dirname "$0"` +cd "$D/../../../../" + +DEST="development/tools/eclipse/plugins/com.android.ide.eclipse.adt" +# computes "../.." from DEST to here (in /android) +BACK=`echo $DEST | sed 's@[^/]*@..@g'` + +LIBS="jarutils androidprefs" + +echo "make java libs ..." +make -j3 showcommands $LIBS || die "Fail to build one of $LIBS." + +echo "Copying java libs to $DEST" -cd ../plugins/com.android.ide.eclipse.adt HOST=`uname` if [ "$HOST" == "Linux" ]; then - ln -svf ../../../../out/host/linux-x86/framework/jarutils.jar . - ln -svf ../../../../out/host/linux-x86/framework/androidprefs.jar . + for LIB in $LIBS; do + ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/" + done + elif [ "$HOST" == "Darwin" ]; then - ln -svf ../../../../out/host/darwin-x86/framework/jarutils.jar . - ln -svf ../../../../out/host/darwin-x86/framework/androidprefs.jar . + for LIB in $LIBS; do + ln -svf $BACK/out/host/darwin-x86/framework/$LIB.jar "$DEST/" + done + elif [ "${HOST:0:6}" == "CYGWIN" ]; then + for LIB in $LIBS; do + cp -vf $BACK/out/host/windows-x86/framework/$LIB.jar "$DEST/" + done - DEVICE_DIR="../../../.." - echo "make java libs ..." - ( cd "$DEVICE_DIR" && - make -j3 showcommands jarutils androidprefs ) || \ - die "Define javac and retry." - - for DIR in "$PWD" ; do - echo "Copying java libs to $DIR" - for JAR in jarutils.jar androidprefs.jar ; do - cp -vf "$DEVICE_DIR/out/host/windows-x86/framework/$JAR" "$DIR" - done - done - - chmod a+rx *.jar + chmod -v a+rx "$DEST"/*.jar else - echo "Unsupported platform ($HOST). Nothing done." + echo "Unsupported platform ($HOST). Nothing done." fi diff --git a/tools/eclipse/scripts/create_all_symlinks.sh b/tools/eclipse/scripts/create_all_symlinks.sh index fc9766f9c..6aec4fa52 100755 --- a/tools/eclipse/scripts/create_all_symlinks.sh +++ b/tools/eclipse/scripts/create_all_symlinks.sh @@ -3,30 +3,29 @@ echo "### $0 executing" function die() { - echo "Error: $*" - exit 1 + echo "Error: $*" + exit 1 } -D="device/tools/eclipse/scripts" -if [ -d "../$D" ]; then - cd "../$D" -else - [ "${PWD: -28}" == "$D" ] || die "Please execute this from the $D directory" -fi +# CD to the top android directory +D=`dirname "$0"` +cd "$D/../../../../" + +DEST="development/tools/eclipse/scripts" set -e # fail early echo ; echo "### ADT ###" ; echo -./create_adt_symlinks.sh "$*" +$DEST/create_adt_symlinks.sh "$*" echo ; echo "### COMMON ###" ; echo -./create_common_symlinks.sh "$*" +$DEST/create_common_symlinks.sh "$*" echo ; echo "### EDITORS ###" ; echo -./create_editors_symlinks.sh "$*" +$DEST/create_editors_symlinks.sh "$*" echo ; echo "### DDMS ###" ; echo -./create_ddms_symlinks.sh "$*" +$DEST/create_ddms_symlinks.sh "$*" echo ; echo "### TEST ###" ; echo -./create_test_symlinks.sh "$*" +$DEST/create_test_symlinks.sh "$*" echo ; echo "### BRIDGE ###" ; echo -./create_bridge_symlinks.sh "$*" +$DEST/create_bridge_symlinks.sh "$*" echo "### $0 done" diff --git a/tools/eclipse/scripts/create_bridge_symlinks.sh b/tools/eclipse/scripts/create_bridge_symlinks.sh index f01a89ed3..550e84fd9 100755 --- a/tools/eclipse/scripts/create_bridge_symlinks.sh +++ b/tools/eclipse/scripts/create_bridge_symlinks.sh @@ -1,47 +1,44 @@ #!/bin/bash function die() { - echo "Error: $*" - exit 1 + echo "Error: $*" + exit 1 } set -e # fail early -# This may run either from the //device directory or from the -# eclipse/script directory. Allow for both. -D="device/tools/eclipse/scripts" -[ -d "$D" ] && cd "$D" -[ -d "../$D" ] && cd "../$D" - -cd ../../layoutlib +# CD to the top android directory +D=`dirname "$0"` +cd "$D/../../../../" HOST=`uname` if [ "$HOST" == "Linux" ]; then - echo # nothing to do + echo # nothing to do + elif [ "$HOST" == "Darwin" ]; then - echo # nothing to do + echo # nothing to do + elif [ "${HOST:0:6}" == "CYGWIN" ]; then - if [ "x$1" == "x" ]; then - echo "Usage: $0 sdk/tools/lib/" - echo "Argument 1 should be the path to the jars you want to copy. " - echo " e.g. android_sdk_windows_NNN/tools/lib/ " - echo "This will be used to update layout.lib after it has been built here." - exit 1 - fi + if [ "x$1" == "x" ]; then + echo "Usage: $0 sdk/tools/lib/" + echo "Argument 1 should be the path to the jars you want to copy. " + echo " e.g. android_sdk_windows_NNN/tools/lib/ " + echo "This will be used to update layout.lib after it has been built here." + exit 1 + fi - DEVICE_DIR="../../" - echo "make java libs ..." - ( cd "$DEVICE_DIR" && - make -j3 showcommands layoutlib ninepatch ) || \ - die "Define javac and retry." + echo "make java libs ..." + LIBS="layoutlib ninepatch" + make -j3 showcommands $LIBS || die "Define javac and retry." - for DIR in "$PWD" "$1" ; do - echo "Copying java libs to $DIR" - for JAR in ninepatch.jar layoutlib.jar ; do - cp -vf "$DEVICE_DIR/out/host/windows-x86/framework/$JAR" "$DIR" - done - done + for DIR in frameworks/base/tools/layoutlib "$1" ; do + echo "Copying java libs to $DIR" + for LIB in $LIBS; do + cp -vf "out/host/windows-x86/framework/$LIB.jar" "$DIR" + done + chmod -v a+rx "$LIB"/*.jar + done else - echo "Unsupported platform ($HOST). Nothing done." + echo "Unsupported platform ($HOST). Nothing done." fi diff --git a/tools/eclipse/scripts/create_common_symlinks.sh b/tools/eclipse/scripts/create_common_symlinks.sh index 7726afc58..a9e8a4348 100755 --- a/tools/eclipse/scripts/create_common_symlinks.sh +++ b/tools/eclipse/scripts/create_common_symlinks.sh @@ -1,42 +1,44 @@ #!/bin/bash function die() { - echo "Error: $*" - exit 1 + echo "Error: $*" + exit 1 } set -e # fail early -# This may run either from the //device directory or from the -# eclipse/script directory. Allow for both. -D="device/tools/eclipse/scripts" -[ -d "$D" ] && cd "$D" -[ -d "../$D" ] && cd "../$D" +# CD to the top android directory +D=`dirname "$0"` +cd "$D/../../../../" + +DEST="development/tools/eclipse/plugins/com.android.ide.eclipse.common" +# computes "../.." from DEST to here (in /android) +BACK=`echo $DEST | sed 's@[^/]*@..@g'` + +LIBS="sdkstats androidprefs" + +echo "make java libs ..." +make -j3 showcommands $LIBS || die "Fail to build one of $LIBS." + +echo "Copying java libs to $DEST" -cd ../plugins/com.android.ide.eclipse.common HOST=`uname` if [ "$HOST" == "Linux" ]; then - ln -svf ../../../../out/host/linux-x86/framework/sdkstats.jar . - ln -svf ../../../../out/host/linux-x86/framework/androidprefs.jar . + for LIB in $LIBS; do + ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/" + done + elif [ "$HOST" == "Darwin" ]; then - ln -svf ../../../../out/host/darwin-x86/framework/sdkstats.jar . - ln -svf ../../../../out/host/darwin-x86/framework/androidprefs.jar . + for LIB in $LIBS; do + ln -svf $BACK/out/host/darwin-x86/framework/$LIB.jar "$DEST/" + done + elif [ "${HOST:0:6}" == "CYGWIN" ]; then + for LIB in $LIBS; do + cp -vf $BACK/out/host/windows-x86/framework/$LIB.jar "$DEST/" + done - DEVICE_DIR="../../../.." - echo "make java libs ..." - ( cd "$DEVICE_DIR" && - make -j3 sdkstats androidprefs ) || \ - die "Define javac and retry." - - for DIR in "$PWD" ; do - echo "Copying java libs to $DIR" - for JAR in sdkstats.jar androidprefs.jar ; do - cp -vf "$DEVICE_DIR/out/host/windows-x86/framework/$JAR" "$DIR" - chmod a+rx "$DIR/$JAR" - done - done - + chmod -v a+rx "$DEST"/*.jar else - echo "Unsupported platform ($HOST). Nothing done." + echo "Unsupported platform ($HOST). Nothing done." fi diff --git a/tools/eclipse/scripts/create_ddms_symlinks.sh b/tools/eclipse/scripts/create_ddms_symlinks.sh index 5b2e45bf8..6c2421612 100755 --- a/tools/eclipse/scripts/create_ddms_symlinks.sh +++ b/tools/eclipse/scripts/create_ddms_symlinks.sh @@ -8,54 +8,43 @@ CMD="ln -svf" DIR="ln -svf" HOST=`uname` if [ "${HOST:0:6}" == "CYGWIN" ]; then - CMD="cp -rvf" - DIR="rsync -avW --delete-after" + CMD="cp -rvf" + DIR="rsync -avW --delete-after" fi -cd ../plugins/com.android.ide.eclipse.ddms -mkdir -p libs -cd libs -$CMD ../../../../../prebuilt/common/jfreechart/jcommon-1.0.12.jar . -$CMD ../../../../../prebuilt/common/jfreechart/jfreechart-1.0.9.jar . -$CMD ../../../../../prebuilt/common/jfreechart/jfreechart-1.0.9-swt.jar . +# CD to the top android directory +D=`dirname "$0"` +cd "$D/../../../../" -cd ../src/com/android -$DIR ../../../../../../ddms/libs/ddmlib/src/com/android/ddmlib . -$DIR ../../../../../../ddms/libs/ddmuilib/src/com/android/ddmuilib . +# computes relative ".." paths from $1 to here (in /android) +function back() { + echo $1 | sed 's@[^/]*@..@g' +} -# goes back to the icons directory -cd ../../../icons/ -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/debug-attach.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/debug-wait.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/debug-error.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/device.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/emulator.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/heap.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/thread.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/empty.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/warning.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/d.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/e.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/i.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/v.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/w.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/add.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/delete.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/edit.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/save.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/push.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/pull.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/clear.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/up.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/down.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/gc.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/halt.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/load.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/importBug.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/play.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/pause.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/forward.png . -$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/backward.png . +BASE="development/tools/eclipse/plugins/com.android.ide.eclipse.ddms" +DEST=$BASE/libs +mkdir -p $D +BACK=`back $DEST` +for i in prebuilt/common/jfreechart/*.jar; do + $CMD $BACK/$i $DEST/ +done +DEST=$BASE/src/com/android +BACK=`back $DEST` +for i in development/tools/ddms/libs/ddmlib/src/com/android/ddmlib \ + development/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib ; do + $DIR $BACK/$i $DEST/ +done + +DEST=$BASE/icons +BACK=`back $DEST` + +for i in debug-attach.png debug-wait.png debug-error.png device.png emulator.png \ + heap.png thread.png empty.png warning.png d.png e.png i.png \ + v.png w.png add.png delete.png edit.png save.png push.png pull.png \ + clear.png up.png down.png gc.png halt.png load.png importBug.png \ + play.png pause.png forward.png backward.png ; do + $CMD $BACK/development/tools/ddms/libs/ddmuilib/src/resources/images/$i $DEST/ +done diff --git a/tools/eclipse/scripts/create_editors_symlinks.sh b/tools/eclipse/scripts/create_editors_symlinks.sh index 2f26ac42d..1a534cb47 100755 --- a/tools/eclipse/scripts/create_editors_symlinks.sh +++ b/tools/eclipse/scripts/create_editors_symlinks.sh @@ -1,39 +1,50 @@ #!/bin/bash function die() { - echo "Error: $*" - exit 1 + echo "Error: $*" + exit 1 } -cd ../plugins/com.android.ide.eclipse.editors +set -e # fail early + +# CD to the top android directory +D=`dirname "$0"` +cd "$D/../../../../" + +DEST="development/tools/eclipse/plugins/com.android.ide.eclipse.editors" +# computes "../.." from DEST to here (in /android) +BACK=`echo $DEST | sed 's@[^/]*@..@g'` + +LIBS="layoutlib_api layoutlib_utils ninepatch" + +echo "make java libs ..." +make -j3 showcommands $LIBS || die "Fail to build one of $LIBS." + +echo "Copying java libs to $DEST" + HOST=`uname` if [ "$HOST" == "Linux" ]; then - ln -svf ../../../../out/host/linux-x86/framework/layoutlib_api.jar . - ln -svf ../../../../out/host/linux-x86/framework/layoutlib_utils.jar . - ln -svf ../../../../out/host/linux-x86/framework/kxml2-2.3.0.jar . - ln -svf ../../../../out/host/linux-x86/framework/ninepatch.jar . + for LIB in $LIBS; do + ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/" + done + ln -svf $BACK/out/host/linux-x86/framework/kxml2-2.3.0.jar "$DEST/" + elif [ "$HOST" == "Darwin" ]; then - ln -svf ../../../../out/host/darwin-x86/framework/layoutlib_api.jar . - ln -svf ../../../../out/host/darwin-x86/framework/layoutlib_utils.jar . - ln -svf ../../../../out/host/darwin-x86/framework/kxml2-2.3.0.jar . - ln -svf ../../../../out/host/darwin-x86/framework/ninepatch.jar . + for LIB in $LIBS; do + ln -svf $BACK/out/host/darwin-x86/framework/$LIB.jar "$DEST/" + done + ln -svf $BACK/out/host/darwin-x86/framework/kxml2-2.3.0.jar "$DEST/" + elif [ "${HOST:0:6}" == "CYGWIN" ]; then - set -e # fail early - DEVICE_DIR="../../../../" - echo "make java libs ..." - ( cd "$DEVICE_DIR" && - make -j3 showcommands layoutlib_api layoutlib_utils ninepatch ) || \ - die "Define javac and 'make layoutlib_api ninepatch' from device." + for LIB in $LIBS; do + cp -vf $BACK/out/host/windows-x86/framework/$LIB.jar "$DEST/" + done - echo "Copying java libs to $PWD" - for JAR in layoutlib_api.jar layoutlib_utils.jar ninepatch.jar ; do - cp -vf "$DEVICE_DIR/out/host/windows-x86/framework/$JAR" . - done - if [ ! -f "./kxml2-2.3.0.jar" ]; then - cp -v $DEVICE_DIR/prebuilt/common/kxml2/kxml2-2.3.0.jar . - chmod -v a+rx *.jar - fi + if [ ! -f "$DEST/kxml2-2.3.0.jar" ]; then + cp -v "prebuilt/common/kxml2/kxml2-2.3.0.jar" "$DEST/" + fi + chmod -v a+rx "$DEST"/*.jar else - echo "Unsupported platform ($HOST). Nothing done." + echo "Unsupported platform ($HOST). Nothing done." fi