OSDN Git Service

android-2.1_r1 snapshot
[android-x86/sdk.git] / eclipse / scripts / create_adt_symlinks.sh
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"
14 # computes "../.." from DEST to here (in /android)
15 BACK=`echo $DEST | sed 's@[^/]*@..@g'`
16
17 LIBS="sdkstats jarutils androidprefs layoutlib_api layoutlib_utils ninepatch sdklib sdkuilib"
18
19 echo "make java libs ..."
20 make -j3 showcommands $LIBS || die "ADT: Fail to build one of $LIBS."
21
22 echo "Copying java libs to $DEST"
23
24 HOST=`uname`
25 if [ "$HOST" == "Linux" ]; then
26     for LIB in $LIBS; do
27         ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/"
28     done
29     ln -svf $BACK/out/host/linux-x86/framework/kxml2-2.3.0.jar          "$DEST/"
30     ln -svf $BACK/out/host/linux-x86/framework/commons-compress-1.0.jar "$DEST/"
31     ln -svf $BACK/out/host/linux-x86/framework/groovy-all-1.6.5.jar     "$DEST/"
32   
33 elif [ "$HOST" == "Darwin" ]; then
34     for LIB in $LIBS; do
35         ln -svf $BACK/out/host/darwin-x86/framework/$LIB.jar "$DEST/"
36     done
37     ln -svf $BACK/out/host/darwin-x86/framework/kxml2-2.3.0.jar          "$DEST/"
38     ln -svf $BACK/out/host/darwin-x86/framework/commons-compress-1.0.jar "$DEST/"
39     ln -svf $BACK/out/host/darwin-x86/framework/groovy-all-1.6.5.jar     "$DEST/"
40
41 elif [ "${HOST:0:6}" == "CYGWIN" ]; then
42     for LIB in $LIBS; do
43         cp -vf  out/host/windows-x86/framework/$LIB.jar "$DEST/"
44     done
45
46     if [ ! -f "$DEST/kxml2-2.3.0.jar" ]; then
47         cp -v "prebuilt/common/kxml2/kxml2-2.3.0.jar" "$DEST/"
48     fi
49
50     if [ ! -f "$DEST/commons-compress-1.0.jar" ]; then
51         cp -v "prebuilt/common/commons-compress/commons-compress-1.0.jar" "$DEST/"
52     fi
53
54     if [ ! -f "$DEST/groovy-all-1.6.5.jar" ]; then
55         cp -v "prebuilt/common/groovy/groovy-all-1.6.5.jar" "$DEST/"
56     fi
57
58     chmod -v a+rx "$DEST"/*.jar
59 else
60     echo "Unsupported platform ($HOST). Nothing done."
61 fi
62