diff options
author | Raphael <raphael@google.com> | 2011-11-07 13:39:29 -0800 |
---|---|---|
committer | Raphael <raphael@google.com> | 2011-11-08 14:17:09 -0800 |
commit | e7e9d05b2ab15c427787d0f97ff13e83c9acae70 (patch) | |
tree | a82a88d0cefcfa4631491cc47966cbc6b50acdee /eclipse/scripts | |
parent | 38a09054d6e5bb8b9138ae28ebe113130050a066 (diff) | |
download | sdk-e7e9d05b2ab15c427787d0f97ff13e83c9acae70.zip sdk-e7e9d05b2ab15c427787d0f97ff13e83c9acae70.tar.gz sdk-e7e9d05b2ab15c427787d0f97ff13e83c9acae70.tar.bz2 |
SDK: simplify create_all_symlinks script.
Merge all scripts into a single one so that we have just
one call to make instead of 8 of them.
Edits:
- Disable things that won't build under cygwin
- Added missing lint-api & lint-client.
- Fix missing ddms prebuilts.
Change-Id: I1dd74cc804438c353e8c9dce82c0513a8c04a3da
Diffstat (limited to 'eclipse/scripts')
-rwxr-xr-x | eclipse/scripts/common_setup.sh | 42 | ||||
-rwxr-xr-x | eclipse/scripts/create_adt_symlinks.sh | 70 | ||||
-rwxr-xr-x | eclipse/scripts/create_all_symlinks.sh | 195 | ||||
-rwxr-xr-x | eclipse/scripts/create_bridge_symlinks.sh | 41 | ||||
-rwxr-xr-x | eclipse/scripts/create_ddms_symlinks.sh | 42 | ||||
-rwxr-xr-x | eclipse/scripts/create_gldebugger_symlinks.sh | 26 | ||||
-rwxr-xr-x | eclipse/scripts/create_hierarchyviewer_symlinks.sh | 27 | ||||
-rwxr-xr-x | eclipse/scripts/create_sdkman_symlinks.sh | 16 | ||||
-rwxr-xr-x | eclipse/scripts/create_test_symlinks.sh | 87 | ||||
-rwxr-xr-x | eclipse/scripts/create_traceview_symlinks.sh | 47 |
10 files changed, 173 insertions, 420 deletions
diff --git a/eclipse/scripts/common_setup.sh b/eclipse/scripts/common_setup.sh deleted file mode 100755 index 9b1f03d..0000000 --- a/eclipse/scripts/common_setup.sh +++ /dev/null @@ -1,42 +0,0 @@ -function die() { - echo "Error: $*" - exit 1 -} - -HOST=`uname` - -if [ "${HOST:0:6}" == "CYGWIN" ]; then - PLATFORM="windows-x86" - - # We can't use symlinks under Cygwin - function cpfile { # $1=dest $2=source - cp -fv $2 $1/ - } - - function cpdir() { # $1=dest $2=source - rsync -avW --delete-after $2 $1 - } -else - if [ "$HOST" == "Linux" ]; then - PLATFORM="linux-x86" - elif [ "$HOST" == "Darwin" ]; then - PLATFORM="darwin-x86" - else - echo "Unsupported platform ($HOST). Nothing done." - fi - - # For all other systems which support symlinks - - # computes the "reverse" path, e.g. "a/b/c" => "../../.." - function back() { - echo $1 | sed 's@[^/]*@..@g' - } - - function cpfile { # $1=dest $2=source - ln -svf `back $1`/$2 $1/ - } - - function cpdir() { # $1=dest $2=source - ln -svf `back $1`/$2 $1 - } -fi diff --git a/eclipse/scripts/create_adt_symlinks.sh b/eclipse/scripts/create_adt_symlinks.sh deleted file mode 100755 index 97ed877..0000000 --- a/eclipse/scripts/create_adt_symlinks.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -function die() { - echo "Error: $*" - exit 1 -} - -set -e # fail early - -# CD to the top android directory -D=`dirname "$0"` -cd "$D/../../../" - -DEST="sdk/eclipse/plugins/com.android.ide.eclipse.adt/libs" -# computes "../.." from DEST to here (in /android) -BACK=`echo $DEST | sed 's@[^/]*@..@g'` - -mkdir -p $DEST - -LIBS="sdkstats androidprefs common layoutlib_api ide_common rule_api ninepatch sdklib sdkuilib assetstudio" - -echo "make java libs ..." -make -j3 showcommands $LIBS || die "ADT: Fail to build one of $LIBS." - -# Add in lint_api and lint_checks: Not build targets but are copy targets -LIBS="$LIBS lint_api lint_checks" -make -j3 showcommands lint || die "ADT: Fail to build one of $LIBS." - -echo "Copying java libs to $DEST" - -# Prebuilts required by sdklib & co, to be linked/copied in the ADT libs folder -PREBUILTS="\ - prebuilt/common/kxml2/kxml2-2.3.0.jar \ - prebuilt/common/commons-compress/commons-compress-1.0.jar \ - prebuilt/common/http-client/httpclient-4.1.1.jar \ - prebuilt/common/http-client/httpcore-4.1.jar \ - prebuilt/common/http-client/httpmime-4.1.1.jar \ - prebuilt/common/http-client/commons-logging-1.1.1.jar \ - prebuilt/common/http-client/commons-codec-1.4.jar \ - " - - -HOST=`uname` -if [ "$HOST" == "Linux" ]; then - for LIB in $LIBS; do - ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/" - done - - for P in $PREBUILTS; do - ln -svf $BACK/$P "$DEST/" - done - -elif [ "$HOST" == "Darwin" ]; then - for LIB in $LIBS; do - ln -svf $BACK/out/host/darwin-x86/framework/$LIB.jar "$DEST/" - done - - for P in $PREBUILTS; do - ln -svf $BACK/$P "$DEST/" - done - -elif [ "${HOST:0:6}" == "CYGWIN" ]; then - for LIB in $LIBS; do - cp -vf out/host/windows-x86/framework/$LIB.jar "$DEST/" - done - - cp -v $PREBUILTS "$DEST/" - chmod -v a+rx "$DEST"/*.jar -else - echo "Unsupported platform ($HOST). Nothing done." -fi diff --git a/eclipse/scripts/create_all_symlinks.sh b/eclipse/scripts/create_all_symlinks.sh index 11752d4..ccab342 100755 --- a/eclipse/scripts/create_all_symlinks.sh +++ b/eclipse/scripts/create_all_symlinks.sh @@ -1,35 +1,186 @@ #!/bin/bash -echo "### $0 executing" +echo "## Running $0" +# CD to the top android directory +PROG_DIR=`dirname "$0"` +cd "${PROG_DIR}/../../../" + +HOST=`uname` function die() { - echo "Error: $*" - exit 1 + echo "Error: $*" + exit 1 } -# CD to the top android directory -D=`dirname "$0"` -cd "$D/../../../" +if [ "${HOST:0:6}" == "CYGWIN" ]; then + PLATFORM="windows-x86" + + # We can't use symlinks under Cygwin + function cpfile { # $1=source $2=dest + cp -fv $1 $2/ + } + + function cpdir() { # $1=source $2=dest + rsync -avW --delete-after $1 $2 + } +else + if [ "$HOST" == "Linux" ]; then + PLATFORM="linux-x86" + elif [ "$HOST" == "Darwin" ]; then + PLATFORM="darwin-x86" + else + echo "Unsupported platform ($HOST). Aborting." + exit 1 + fi + + # For all other systems which support symlinks + + # computes the "reverse" path, e.g. "a/b/c" => "../../.." + function back() { + echo $1 | sed 's@[^/]*@..@g' + } + + function cpfile { # $1=source $2=dest + ln -svf `back $2`/$1 $2/ + } + + function cpdir() { # $1=source $2=dest + ln -svf `back $2`/$1 $2 + } +fi DEST="sdk/eclipse/scripts" set -e # fail early -echo ; echo "### ADT ###" ; echo -$DEST/create_adt_symlinks.sh "$*" -echo ; echo "### DDMS ###" ; echo -$DEST/create_ddms_symlinks.sh "$*" -echo ; echo "### TEST ###" ; echo -$DEST/create_test_symlinks.sh "$*" -echo ; echo "### BRIDGE ###" ; echo -$DEST/create_bridge_symlinks.sh "$*" -echo ; echo "### HIERARCHYVIEWER ###" ; echo -$DEST/create_hierarchyviewer_symlinks.sh "$*" -echo ; echo "### TRACEVIEW ###" ; echo -$DEST/create_traceview_symlinks.sh "$*" -echo ; echo "### SDKMANAGER ###" ; echo -$DEST/create_sdkman_symlinks.sh "$*" -echo ; echo "### GL DEBUGGER ###" ; echo -$DEST/create_gldebugger_symlinks.sh "$*" +LIBS="" +CP_FILES="" + +### ADT ### + +ADT_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.adt/libs" +ADT_LIBS="sdkstats androidprefs common layoutlib_api lint_api lint_checks ide_common rule_api ninepatch sdklib sdkuilib assetstudio" +ADT_PREBUILTS="\ + prebuilt/common/kxml2/kxml2-2.3.0.jar \ + prebuilt/common/commons-compress/commons-compress-1.0.jar \ + prebuilt/common/http-client/httpclient-4.1.1.jar \ + prebuilt/common/http-client/httpcore-4.1.jar \ + prebuilt/common/http-client/httpmime-4.1.1.jar \ + prebuilt/common/http-client/commons-logging-1.1.1.jar \ + prebuilt/common/http-client/commons-codec-1.4.jar" + +LIBS="$LIBS $ADT_LIBS" +CP_FILES="$CP_FILES @:$ADT_DEST $ADT_LIBS $ADT_PREBUILTS" + + +### DDMS ### + +DDMS_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.ddms/libs" +DDMS_LIBS="ddmlib ddmuilib swtmenubar" + +DDMS_PREBUILTS="\ + prebuilt/common/jfreechart/jcommon-1.0.12.jar \ + prebuilt/common/jfreechart/jfreechart-1.0.9.jar \ + prebuilt/common/jfreechart/jfreechart-1.0.9-swt.jar" + +LIBS="$LIBS $DDMS_LIBS" +CP_FILES="$CP_FILES @:$DDMS_DEST $DDMS_LIBS $DDMS_PREBUILTS" + + +### TEST ### + +TEST_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.tests" +TEST_LIBS="easymock" +TEST_PREBUILTS="prebuilt/common/kxml2/kxml2-2.3.0.jar" + +LIBS="$LIBS $TEST_LIBS" +CP_FILES="$CP_FILES @:$TEST_DEST $TEST_LIBS $TEST_PREBUILTS" + + +### BRIDGE ### + +if [[ $PLATFORM != "windows-x86" ]]; then + # We can't build enough of the platform on Cygwin to create layoutlib + BRIDGE_LIBS="layoutlib ninepatch" + + LIBS="$LIBS $BRIDGE_LIBS" +fi + + + +### HIERARCHYVIEWER ### + +HV_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/libs" +HV_LIBS="hierarchyviewerlib swtmenubar" + +LIBS="$LIBS $HV_LIBS" +CP_FILES="$CP_FILES @:$HV_DEST $HV_LIBS" + + +### TRACEVIEW ### + +TV_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.traceview/libs" +TV_LIBS="traceview" + +LIBS="$LIBS $TV_LIBS" +CP_FILES="$CP_FILES @:$TV_DEST $TV_LIBS" + + +### SDKMANAGER ### + +SDMAN_LIBS="swtmenubar" + +LIBS="$LIBS $SDKMAN_LIBS" + + +### GL DEBUGGER ### + +if [[ $PLATFORM != "windows-x86" ]]; then + # liblzf doesn't build under cygwin. If necessary, this should be fixed first. + + GLD_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.gldebugger/libs" + GLD_LIBS="host-libprotobuf-java-2.3.0-lite liblzf sdklib" + + LIBS="$LIBS $GLD_LIBS" + CP_FILES="$CP_FILES @:$GLD_DEST $GLD_LIBS" +fi + +# Run make on all libs + +J="4" +[[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ') +[[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l) + +echo "## Building libs: make -j$J $LIBS" +make -j${J} $LIBS + +# Copy resulting files + +DEST="" +for SRC in $CP_FILES; do + if [[ "${SRC:0:2}" == "@:" ]]; then + DEST="${SRC:2}" + mkdir -vp "$DEST" + continue + fi + if [[ ! -f "$SRC" ]]; then + SRC="out/host/$PLATFORM/framework/$SRC.jar" + fi + if [[ -f "$SRC" ]]; then + if [[ ! -d "$DEST" ]]; then + die "Invalid cp_file dest directory: $DEST" + fi + + cpfile "$SRC" "$DEST" + else + die "## Unknown file '$SRC' to copy in '$DEST'" + fi +done + +# OS-specific post operations + +if [ "${HOST:0:6}" == "CYGWIN" ]; then + chmod -v a+rx "$ADT_DEST"/*.jar +fi echo "### $0 done" diff --git a/eclipse/scripts/create_bridge_symlinks.sh b/eclipse/scripts/create_bridge_symlinks.sh deleted file mode 100755 index 05952be..0000000 --- a/eclipse/scripts/create_bridge_symlinks.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -function die() { - echo "Error: $*" - exit 1 -} - -set -e # fail early - -# CD to the top android directory -D=`dirname "$0"` -cd "$D/../../../" - -HOST=`uname` -if [ "$HOST" == "Linux" ]; then - echo # nothing to do - -elif [ "$HOST" == "Darwin" ]; then - echo # nothing to do - -elif [ "${HOST:0:6}" == "CYGWIN" ]; then - if [ "x$1" == "x" ] || [ `basename "$1"` != "layoutlib.jar" ]; then - echo "Usage: $0 [yoursdk/platforms/xxx/data/layoutlib.jar]" - echo "WARNING: Argument 1 should be the SDK path to the layoutlib.jar to update." - fi - - LIBS="layoutlib ninepatch" - echo "Make java libs: $LIBS" - make -j3 showcommands $LIBS || die "Bridge: Failed to build one of $LIBS." - - if [ "x$1" == "x" ] || [ `basename "$1"` != "layoutlib.jar" ]; then - echo "Skip updating layoutlib.jar from an SDK" - else - echo "Updating your SDK in $1" - cp -vf "out/host/windows-x86/framework/layoutlib.jar" "$1" - chmod -v a+rx "$1" - fi - -else - echo "Unsupported platform ($HOST). Nothing done." -fi - diff --git a/eclipse/scripts/create_ddms_symlinks.sh b/eclipse/scripts/create_ddms_symlinks.sh deleted file mode 100755 index a370bc5..0000000 --- a/eclipse/scripts/create_ddms_symlinks.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -#----------------------------------------------------------------------------| -# Creates the links to use ddm{ui}lib in the eclipse-ide plugin. -# Run this from sdk/eclipse/scripts -#----------------------------------------------------------------------------| - -set -e - -D=`dirname "$0"` -source $D/common_setup.sh - -# cd to the top android directory -cd "$D/../../../" - -BASE="sdk/eclipse/plugins/com.android.ide.eclipse.ddms" -DEST=$BASE/libs - -mkdir -p $DEST -for i in prebuilt/common/jfreechart/*.jar; do - cpfile $DEST $i -done - -COPY_LIBS="ddmlib ddmuilib" -ALL_LIBS="$COPY_LIBS swtmenubar" -echo "make java libs ..." -make -j3 showcommands $ALL_LIBS || die "DDMS: Fail to build one of $ALL_LIBS." - -for LIB in $COPY_LIBS; do - cpfile $DEST out/host/$PLATFORM/framework/$LIB.jar -done - -if [ "${HOST:0:6}" == "CYGWIN" ]; then - # On Windows we used to make a hard copy of the ddmlib/ddmuilib - # under the plugin source tree. Now that we're using external JARs - # we need to actually remove these obsolete sources. - for i in ddmlib ddmuilib ; do - DIR=$BASE/src/com/android/$i - if [ -d $DIR ]; then - rm -rfv $BASE/src/com/android/$i - fi - done -fi diff --git a/eclipse/scripts/create_gldebugger_symlinks.sh b/eclipse/scripts/create_gldebugger_symlinks.sh deleted file mode 100755 index e28b5b9..0000000 --- a/eclipse/scripts/create_gldebugger_symlinks.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -#----------------------------------------------------------------------------| -# Creates the links to use gldebugger in the eclipse-ide plugin. -# Run this from sdk/eclipse/scripts -#----------------------------------------------------------------------------| - -set -e - -D=`dirname "$0"` -source $D/common_setup.sh - -# cd to the top android directory -cd "$D/../../../" - -BASE="sdk/eclipse/plugins/com.android.ide.eclipse.gldebugger" -DEST=$BASE/libs - -mkdir -p $DEST - -LIBS="host-libprotobuf-java-2.3.0-lite liblzf sdklib" -echo "make java libs ..." -make -j3 $LIBS || die "GL Debugger: Fail to build one of $LIBS." - -for LIB in $LIBS; do - cpfile $DEST out/host/$PLATFORM/framework/$LIB.jar -done diff --git a/eclipse/scripts/create_hierarchyviewer_symlinks.sh b/eclipse/scripts/create_hierarchyviewer_symlinks.sh deleted file mode 100755 index e4fc281..0000000 --- a/eclipse/scripts/create_hierarchyviewer_symlinks.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -#----------------------------------------------------------------------------| -# Creates the links to use hierarchyviewer{ui}lib in the eclipse-ide plugin. -# Run this from sdk/eclipse/scripts -#----------------------------------------------------------------------------| - -set -e - -D=`dirname "$0"` -source $D/common_setup.sh - -# cd to the top android directory -cd "$D/../../../" - -BASE="sdk/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer" -DEST=$BASE/libs - -mkdir -p $DEST - -COPY_LIBS="hierarchyviewerlib" -ALL_LIBS="$COPY_LIBS swtmenubar" -echo "make java libs ..." -make -j3 showcommands $ALL_LIBS || die "Hierarchy Viewer: Fail to build one of $ALL_LIBS." - -for LIB in $COPY_LIBS; do - cpfile $DEST out/host/$PLATFORM/framework/$LIB.jar -done diff --git a/eclipse/scripts/create_sdkman_symlinks.sh b/eclipse/scripts/create_sdkman_symlinks.sh deleted file mode 100755 index d965195..0000000 --- a/eclipse/scripts/create_sdkman_symlinks.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -function die() { - echo "Error: $*" - exit 1 -} - -set -e # fail early - -# CD to the top android directory -D=`dirname "$0"` -cd "$D/../../../" - -LIBS="swtmenubar" - -echo "SDK Manager: make java libs $LIBS" -make -j3 showcommands $LIBS || die "SDK Manager: Failed to build one of $LIBS." diff --git a/eclipse/scripts/create_test_symlinks.sh b/eclipse/scripts/create_test_symlinks.sh deleted file mode 100755 index eb41f5e..0000000 --- a/eclipse/scripts/create_test_symlinks.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -set -e - -# CD to the top android directory -D=`dirname "$0"` -cd "$D/../../../" - -function die() { - echo "Error: $*" - exit 1 -} - -# computes relative ".." paths from $1 to here (in /android) -function back() { - echo $1 | sed 's@[^/]*@..@g' -} - -HOST=`uname` -if [ "${HOST:0:6}" == "CYGWIN" ]; then - # We can't use symlinks under Cygwin - function cpdir() { # $1=dest $2=source - echo "rsync $2 => $1" - rsync -avW --delete-after $2 $1 - } - -else - # For all other systems which support symlinks - function cpdir() { # $1=dest $2=source - ln -svf `back $1`/$2 $1 - } -fi - -BASE="sdk/eclipse/plugins/com.android.ide.eclipse.tests" -DEST=$BASE -BACK=`back $DEST` - -LIBS="easymock" - -echo "make java libs ..." -make -j3 showcommands $LIBS || die "ADT: Fail to build one of $LIBS." - -echo "Copying java libs to $DEST" - -HOST=`uname` -if [ "$HOST" == "Linux" ]; then - 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 - 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 - for LIB in $LIBS; do - cp -vf out/host/windows-x86/framework/$LIB.jar "$DEST/" - done - 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." -fi - -# Cleanup old obsolete symlink - -function clean() { - if [[ -e "$1" || -L "$1" ]]; then - rm -rfv "$1" - fi -} - -DEST=$BASE/unittests/com/android -clean $DEST/sdkuilib -clean $DEST/ddmlib -clean $DEST/sdklib - -DEST=$BASE/unittests/com/android/layoutlib -clean $DEST/bridge -clean $DEST/testdata - diff --git a/eclipse/scripts/create_traceview_symlinks.sh b/eclipse/scripts/create_traceview_symlinks.sh deleted file mode 100755 index 5a002c3..0000000 --- a/eclipse/scripts/create_traceview_symlinks.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -function die() { - echo "Error: $*" - exit 1 -} - -set -e # fail early - -# CD to the top android directory -D=`dirname "$0"` -cd "$D/../../../" - -DEST="sdk/eclipse/plugins/com.android.ide.eclipse.traceview/libs" -# computes "../.." from DEST to here (in /android) -BACK=`echo $DEST | sed 's@[^/]*@..@g'` - -mkdir -p $DEST - -LIBS="traceview" - -echo "make java libs ..." -make -j3 showcommands $LIBS || die "TRACEVIEW: Fail to build one of $LIBS." - -echo "Copying java libs to $DEST" - - -HOST=`uname` -if [ "$HOST" == "Linux" ]; then - for LIB in $LIBS; do - ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/" - done - -elif [ "$HOST" == "Darwin" ]; then - 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 out/host/windows-x86/framework/$LIB.jar "$DEST/" - done - - chmod -v a+rx "$DEST"/*.jar -else - echo "Unsupported platform ($HOST). Nothing done." -fi - |