blob: 2d3c70763aac2823cbfe19b73361f7dc3642ee22 [file] [log] [blame]
Raphael0e4dd612010-04-16 17:37:25 -07001#!/bin/bash
2
3# Verbose by default. Use -q to make more silent.
4V="-v"
5if [[ "$1" == "-q" ]]; then V=""; shift; fi
6
7TEMP_SDK_DIR=$1
8WIN_OUT_DIR=$2
9TOPDIR=${TOPDIR:-$3}
10
11PLATFORMS=( $TEMP_SDK_DIR/platforms/* )
12if [[ ${#PLATFORMS[@]} != 1 ]]; then
13 echo "Error: Too many platforms found in $TEMP_SDK_DIR"
14 echo "Only one was expected."
15 echo "Instead, found: ${PLATFORMS[@]}"
16 exit 1
17fi
Raphael0e4dd612010-04-16 17:37:25 -070018
19# Package USB Driver
20if [[ -n "$USB_DRIVER_HOOK" ]]; then
21 $USB_DRIVER_HOOK $V $TEMP_SDK_DIR $TOPDIR
22fi
23
24# Remove obsolete stuff from tools & platform
25TOOLS=$TEMP_SDK_DIR/tools
Raphael Mollff779c02010-08-05 13:30:39 -070026PLATFORM_TOOLS=$TEMP_SDK_DIR/platform-tools
Raphael0e4dd612010-04-16 17:37:25 -070027LIB=$TEMP_SDK_DIR/tools/lib
Raphael Moll2f613962010-09-27 16:20:07 -070028rm $V $TOOLS/{android,apkbuilder,ddms,dmtracedump,draw9patch,emulator,etc1tool}
Bill Napier85c3f8e2010-10-10 13:34:38 -070029rm $V $TOOLS/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign,monkeyrunner}
Raphael Mollb04a4f92010-10-23 22:11:37 -070030rm $V $TOOLS/proguard/bin/*.sh
Raphael0e4dd612010-04-16 17:37:25 -070031rm $V $LIB/*/swt.jar
Raphael Moll2f613962010-09-27 16:20:07 -070032rm $V $PLATFORM_TOOLS/{adb,aapt,aidl,dx,dexdump}
Raphael0e4dd612010-04-16 17:37:25 -070033
34# Copy all the new stuff in tools
35# Note: some tools are first copied here and then moved in platforms/<name>/tools/
36cp $V $WIN_OUT_DIR/host/windows-x86/bin/*.{exe,dll} $TOOLS/
37mkdir -pv $LIB/x86
38cp $V ${TOPDIR}prebuilt/windows/swt/swt.jar $LIB/x86/
39mkdir -pv $LIB/x86_64
40cp $V ${TOPDIR}prebuilt/windows-x86_64/swt/swt.jar $LIB/x86_64/
41
Raphael Mollf08d2302010-08-21 18:04:31 -070042# Copy the SDK Manager (aka sdklauncher) to the root of the SDK (it was copied in tools above)
Raphael0e4dd612010-04-16 17:37:25 -070043# and move it also in SDK/tools/lib (so that tools updates can update the root one too)
Raphael Mollf08d2302010-08-21 18:04:31 -070044cp $TOOLS/sdklauncher.exe $TEMP_SDK_DIR/"SDK Manager.exe"
45mv $TOOLS/sdklauncher.exe $LIB/"SDK Manager.exe"
Raphael0e4dd612010-04-16 17:37:25 -070046
47# Copy the emulator NOTICE in the tools dir
48cp $V ${TOPDIR}external/qemu/NOTICE $TOOLS/emulator_NOTICE.txt
49
50# aapt under cygwin needs to have mgwz.dll
51[[ -n $NEED_MGWZ ]] && cp $V $CYG_MGWZ_PATH $TOOLS/
52
53# Update a bunch of bat files
Xavier Ducrohet420b59f2010-08-27 19:30:38 -070054cp $V ${TOPDIR}sdk/files/post_tools_install.bat $LIB/
55cp $V ${TOPDIR}sdk/files/find_java.bat $LIB/
56cp $V ${TOPDIR}sdk/apkbuilder/etc/apkbuilder.bat $TOOLS/
57cp $V ${TOPDIR}sdk/ddms/app/etc/ddms.bat $TOOLS/
58cp $V ${TOPDIR}sdk/traceview/etc/traceview.bat $TOOLS/
59cp $V ${TOPDIR}sdk/hierarchyviewer2/app/etc/hierarchyviewer.bat $TOOLS/
60cp $V ${TOPDIR}sdk/layoutopt/app/etc/layoutopt.bat $TOOLS/
61cp $V ${TOPDIR}sdk/draw9patch/etc/draw9patch.bat $TOOLS/
62cp $V ${TOPDIR}sdk/sdkmanager/app/etc/android.bat $TOOLS/
Bill Napier85c3f8e2010-10-10 13:34:38 -070063cp $V ${TOPDIR}sdk/monkeyrunner/etc/monkeyrunner.bat $TOOLS/
Raphael Mollf4320c62010-10-25 14:41:16 -070064cp $V ${TOPDIR}sdk/files/proguard/bin/*.bat $TOOLS/proguard/bin/
Raphael0e4dd612010-04-16 17:37:25 -070065
66# Put the JetCreator tools, content and docs (not available in the linux SDK)
67JET=$TOOLS/Jet
68JETCREATOR=$JET/JetCreator
69JETDEMOCONTENT=$JET/demo_content
70JETLOGICTEMPLATES=$JET/logic_templates
71JETDOC=$TEMP_SDK_DIR/docs/JetCreator
72
73# need to rm these folders since a Mac SDK will have them and it might create a conflict
74rm -rf $V $JET
75rm -rf $V $JETDOC
76
77# now create fresh folders for JetCreator
78mkdir $V $JET
79mkdir $V $JETDOC
80
81cp -r $V ${TOPDIR}external/sonivox/jet_tools/JetCreator $JETCREATOR/
82cp -r $V ${TOPDIR}external/sonivox/jet_tools/JetCreator_content $JETDEMOCONTENT/
83cp -r $V ${TOPDIR}external/sonivox/jet_tools/logic_templates $JETLOGICTEMPLATES/
84chmod $V -R u+w $JETCREATOR # fixes an issue where Cygwin might copy the above as u+rx only
Raphael Moll2f613962010-09-27 16:20:07 -070085cp $V ${TOPDIR}prebuilt/windows/jetcreator/EASDLL.dll $JETCREATOR/
Raphael0e4dd612010-04-16 17:37:25 -070086
87cp $V ${TOPDIR}external/sonivox/docs/JET_Authoring_Guidelines.html $JETDOC/
88cp -r $V ${TOPDIR}external/sonivox/docs/JET_Authoring_Guidelines_files $JETDOC/
89cp $V ${TOPDIR}external/sonivox/docs/JET_Creator_User_Manual.html $JETDOC/
90cp -r $V ${TOPDIR}external/sonivox/docs/JET_Creator_User_Manual_files $JETDOC/
91
92# Copy or move platform specific tools to the default platform.
93cp $V ${TOPDIR}dalvik/dx/etc/dx.bat $PLATFORM_TOOLS/
Raphael Moll2f613962010-09-27 16:20:07 -070094mv $V $TOOLS/{adb.exe,aapt.exe,aidl.exe,dexdump.exe} $TOOLS/Adb*.dll $PLATFORM_TOOLS/
Raphael0e4dd612010-04-16 17:37:25 -070095
96# When building under cygwin, mgwz.dll must be both in SDK/tools for zipalign
97# and in SDK/platform/XYZ/tools/ for aapt
98[[ -n $NEED_MGWZ ]] && cp $V $TOOLS/mgwz.dll $PLATFORM_TOOLS/
99
100# Fix EOL chars to make window users happy - fix all files at the top level
101# as well as all batch files including those in platforms/<name>/tools/
102find $TEMP_SDK_DIR -maxdepth 1 -name "*.[ht]*" -type f -print0 | xargs -0 unix2dos
103find $TEMP_SDK_DIR -maxdepth 3 -name "*.bat" -type f -print0 | xargs -0 unix2dos
104
105# Just to make it easier on the build servers, we want fastboot and adb (and its DLLs)
106# next to the new SDK, so up one dir.
107for i in fastboot.exe adb.exe AdbWinApi.dll AdbWinUsbApi.dll; do
108 cp -f $V $WIN_OUT_DIR/host/windows-x86/bin/$i $TEMP_SDK_DIR/../$i
109done