| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| Siva Velusamy | 6ca42e8 | 2011-12-08 14:25:37 -0800 | [diff] [blame^] | 2 | # This script copies the .jar files that each plugin depends on into the plugins libs folder. |
| 3 | # By default, on Mac & Linux, this script creates symlinks from the libs folder to the jar file. |
| 4 | # Since Windows does not support symlinks, the jar files are copied. |
| 5 | # Use option "-f" to copy files rather than creating symlinks on the Mac/Linux platforms. |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 6 | |
| Raphael | e7e9d05 | 2011-11-07 13:39:29 -0800 | [diff] [blame] | 7 | echo "## Running $0" |
| 8 | # CD to the top android directory |
| 9 | PROG_DIR=`dirname "$0"` |
| 10 | cd "${PROG_DIR}/../../../" |
| 11 | |
| 12 | HOST=`uname` |
| Siva Velusamy | 6ca42e8 | 2011-12-08 14:25:37 -0800 | [diff] [blame^] | 13 | USE_COPY="" # force copy dependent jar files rather than creating symlinks |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 14 | |
| 15 | function die() { |
| Raphael | e7e9d05 | 2011-11-07 13:39:29 -0800 | [diff] [blame] | 16 | echo "Error: $*" |
| 17 | exit 1 |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 18 | } |
| 19 | |
| Siva Velusamy | 6ca42e8 | 2011-12-08 14:25:37 -0800 | [diff] [blame^] | 20 | ## parse arguments |
| 21 | while [ $# -gt 0 ]; do |
| 22 | if [ "$1" == "-f" ]; then |
| 23 | USE_COPY="1" |
| 24 | fi |
| 25 | shift |
| 26 | done |
| Raphael | e7e9d05 | 2011-11-07 13:39:29 -0800 | [diff] [blame] | 27 | |
| Siva Velusamy | 6ca42e8 | 2011-12-08 14:25:37 -0800 | [diff] [blame^] | 28 | if [ "$HOST" == "Linux" ]; then |
| 29 | PLATFORM="linux-x86" |
| 30 | elif [ "$HOST" == "Darwin" ]; then |
| 31 | PLATFORM="darwin-x86" |
| 32 | elif [ "${HOST:0:6}" == "CYGWIN" ]; then |
| 33 | USE_COPY="1" # We can't use symlinks under Cygwin |
| 34 | PLATFORM="windows-x86" |
| 35 | else |
| 36 | echo "Unsupported platform ($HOST). Aborting." |
| 37 | exit 1 |
| 38 | fi |
| 39 | |
| 40 | if [ "$USE_COPY" == "1" ]; then |
| Raphael | e7e9d05 | 2011-11-07 13:39:29 -0800 | [diff] [blame] | 41 | function cpfile { # $1=source $2=dest |
| 42 | cp -fv $1 $2/ |
| 43 | } |
| 44 | |
| 45 | function cpdir() { # $1=source $2=dest |
| 46 | rsync -avW --delete-after $1 $2 |
| 47 | } |
| 48 | else |
| Raphael | e7e9d05 | 2011-11-07 13:39:29 -0800 | [diff] [blame] | 49 | # computes the "reverse" path, e.g. "a/b/c" => "../../.." |
| 50 | function back() { |
| 51 | echo $1 | sed 's@[^/]*@..@g' |
| 52 | } |
| 53 | |
| 54 | function cpfile { # $1=source $2=dest |
| 55 | ln -svf `back $2`/$1 $2/ |
| 56 | } |
| 57 | |
| 58 | function cpdir() { # $1=source $2=dest |
| 59 | ln -svf `back $2`/$1 $2 |
| 60 | } |
| 61 | fi |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 62 | |
| Raphael | f1d64e2 | 2009-11-18 11:27:35 -0800 | [diff] [blame] | 63 | DEST="sdk/eclipse/scripts" |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 64 | |
| 65 | set -e # fail early |
| 66 | |
| Raphael | e7e9d05 | 2011-11-07 13:39:29 -0800 | [diff] [blame] | 67 | LIBS="" |
| 68 | CP_FILES="" |
| 69 | |
| 70 | ### ADT ### |
| 71 | |
| 72 | ADT_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.adt/libs" |
| 73 | ADT_LIBS="sdkstats androidprefs common layoutlib_api lint_api lint_checks ide_common rule_api ninepatch sdklib sdkuilib assetstudio" |
| 74 | ADT_PREBUILTS="\ |
| 75 | prebuilt/common/kxml2/kxml2-2.3.0.jar \ |
| 76 | prebuilt/common/commons-compress/commons-compress-1.0.jar \ |
| 77 | prebuilt/common/http-client/httpclient-4.1.1.jar \ |
| 78 | prebuilt/common/http-client/httpcore-4.1.jar \ |
| 79 | prebuilt/common/http-client/httpmime-4.1.1.jar \ |
| 80 | prebuilt/common/http-client/commons-logging-1.1.1.jar \ |
| 81 | prebuilt/common/http-client/commons-codec-1.4.jar" |
| 82 | |
| 83 | LIBS="$LIBS $ADT_LIBS" |
| 84 | CP_FILES="$CP_FILES @:$ADT_DEST $ADT_LIBS $ADT_PREBUILTS" |
| 85 | |
| 86 | |
| 87 | ### DDMS ### |
| 88 | |
| 89 | DDMS_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.ddms/libs" |
| 90 | DDMS_LIBS="ddmlib ddmuilib swtmenubar" |
| 91 | |
| 92 | DDMS_PREBUILTS="\ |
| 93 | prebuilt/common/jfreechart/jcommon-1.0.12.jar \ |
| 94 | prebuilt/common/jfreechart/jfreechart-1.0.9.jar \ |
| 95 | prebuilt/common/jfreechart/jfreechart-1.0.9-swt.jar" |
| 96 | |
| 97 | LIBS="$LIBS $DDMS_LIBS" |
| 98 | CP_FILES="$CP_FILES @:$DDMS_DEST $DDMS_LIBS $DDMS_PREBUILTS" |
| 99 | |
| 100 | |
| 101 | ### TEST ### |
| 102 | |
| 103 | TEST_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.tests" |
| 104 | TEST_LIBS="easymock" |
| 105 | TEST_PREBUILTS="prebuilt/common/kxml2/kxml2-2.3.0.jar" |
| 106 | |
| 107 | LIBS="$LIBS $TEST_LIBS" |
| 108 | CP_FILES="$CP_FILES @:$TEST_DEST $TEST_LIBS $TEST_PREBUILTS" |
| 109 | |
| 110 | |
| 111 | ### BRIDGE ### |
| 112 | |
| 113 | if [[ $PLATFORM != "windows-x86" ]]; then |
| 114 | # We can't build enough of the platform on Cygwin to create layoutlib |
| 115 | BRIDGE_LIBS="layoutlib ninepatch" |
| 116 | |
| 117 | LIBS="$LIBS $BRIDGE_LIBS" |
| 118 | fi |
| 119 | |
| 120 | |
| 121 | |
| 122 | ### HIERARCHYVIEWER ### |
| 123 | |
| 124 | HV_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/libs" |
| 125 | HV_LIBS="hierarchyviewerlib swtmenubar" |
| 126 | |
| 127 | LIBS="$LIBS $HV_LIBS" |
| 128 | CP_FILES="$CP_FILES @:$HV_DEST $HV_LIBS" |
| 129 | |
| 130 | |
| 131 | ### TRACEVIEW ### |
| 132 | |
| 133 | TV_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.traceview/libs" |
| 134 | TV_LIBS="traceview" |
| 135 | |
| 136 | LIBS="$LIBS $TV_LIBS" |
| 137 | CP_FILES="$CP_FILES @:$TV_DEST $TV_LIBS" |
| 138 | |
| 139 | |
| 140 | ### SDKMANAGER ### |
| 141 | |
| 142 | SDMAN_LIBS="swtmenubar" |
| 143 | |
| 144 | LIBS="$LIBS $SDKMAN_LIBS" |
| 145 | |
| Siva Velusamy | 6ca42e8 | 2011-12-08 14:25:37 -0800 | [diff] [blame^] | 146 | ### MONITOR ### |
| 147 | |
| 148 | MONITOR_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.monitor/libs" |
| 149 | MONITOR_LIBS="sdklib sdkstats androidprefs" |
| 150 | |
| 151 | LIBS="$LIBS $MONITOR_LIBS" |
| 152 | CP_FILES="$CP_FILES @:$MONITOR_DEST $MONITOR_LIBS" |
| Raphael | e7e9d05 | 2011-11-07 13:39:29 -0800 | [diff] [blame] | 153 | |
| 154 | ### GL DEBUGGER ### |
| 155 | |
| 156 | if [[ $PLATFORM != "windows-x86" ]]; then |
| 157 | # liblzf doesn't build under cygwin. If necessary, this should be fixed first. |
| 158 | |
| 159 | GLD_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.gldebugger/libs" |
| Siva Velusamy | c527b7e | 2011-11-13 11:47:12 -0800 | [diff] [blame] | 160 | GLD_LIBS="host-libprotobuf-java-2.3.0-lite liblzf sdklib ddmlib" |
| Raphael | e7e9d05 | 2011-11-07 13:39:29 -0800 | [diff] [blame] | 161 | |
| 162 | LIBS="$LIBS $GLD_LIBS" |
| 163 | CP_FILES="$CP_FILES @:$GLD_DEST $GLD_LIBS" |
| 164 | fi |
| 165 | |
| Raphael | f1c0263 | 2011-11-23 09:09:03 -0800 | [diff] [blame] | 166 | # Make sure we have lunch sdk-<something> |
| 167 | if [[ ! "$TARGET_PRODUCT" ]]; then |
| Siva Velusamy | 6ca42e8 | 2011-12-08 14:25:37 -0800 | [diff] [blame^] | 168 | echo "## TARGET_PRODUCT is not set, running build/envsetup.sh" |
| Raphael | f1c0263 | 2011-11-23 09:09:03 -0800 | [diff] [blame] | 169 | . build/envsetup.sh |
| Siva Velusamy | 6ca42e8 | 2011-12-08 14:25:37 -0800 | [diff] [blame^] | 170 | echo "## lunch sdk-eng" |
| Raphael | f1c0263 | 2011-11-23 09:09:03 -0800 | [diff] [blame] | 171 | lunch sdk-eng |
| 172 | fi |
| 173 | |
| Raphael | e7e9d05 | 2011-11-07 13:39:29 -0800 | [diff] [blame] | 174 | # Run make on all libs |
| 175 | |
| 176 | J="4" |
| 177 | [[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ') |
| 178 | [[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l) |
| 179 | |
| 180 | echo "## Building libs: make -j$J $LIBS" |
| 181 | make -j${J} $LIBS |
| 182 | |
| 183 | # Copy resulting files |
| 184 | |
| 185 | DEST="" |
| 186 | for SRC in $CP_FILES; do |
| 187 | if [[ "${SRC:0:2}" == "@:" ]]; then |
| 188 | DEST="${SRC:2}" |
| 189 | mkdir -vp "$DEST" |
| 190 | continue |
| 191 | fi |
| 192 | if [[ ! -f "$SRC" ]]; then |
| 193 | SRC="out/host/$PLATFORM/framework/$SRC.jar" |
| 194 | fi |
| 195 | if [[ -f "$SRC" ]]; then |
| 196 | if [[ ! -d "$DEST" ]]; then |
| 197 | die "Invalid cp_file dest directory: $DEST" |
| 198 | fi |
| 199 | |
| 200 | cpfile "$SRC" "$DEST" |
| 201 | else |
| 202 | die "## Unknown file '$SRC' to copy in '$DEST'" |
| 203 | fi |
| 204 | done |
| 205 | |
| 206 | # OS-specific post operations |
| 207 | |
| 208 | if [ "${HOST:0:6}" == "CYGWIN" ]; then |
| 209 | chmod -v a+rx "$ADT_DEST"/*.jar |
| 210 | fi |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 211 | |
| 212 | echo "### $0 done" |