| Konstantin Lopyrev | 0f31751 | 2010-07-15 18:26:51 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | #----------------------------------------------------------------------------| |
| 3 | # Creates the links to use hierarchyviewer{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.hierarchyviewer" |
| 59 | DEST=$BASE/libs |
| 60 | |
| 61 | mkdir -p $DEST |
| 62 | |
| 63 | LIBS="hierarchyviewerlib hierarchyvieweruilib" |
| 64 | echo "make java libs ..." |
| 65 | make -j3 showcommands $LIBS || die "Hierarchy Viewer: Fail to build one of $LIBS." |
| 66 | |
| 67 | for LIB in $LIBS; do |
| 68 | cpfile $DEST out/host/$PLATFORM/framework/$LIB.jar |
| 69 | done |