blob: 687526172ffdb0b760a20b779be46d906393261f [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
Raphael59b02d02010-10-08 15:41:01 -070026PLATFORM_TOOLS=$TEMP_SDK_DIR/platform-tools
Raphael0e4dd612010-04-16 17:37:25 -070027LIB=$TEMP_SDK_DIR/tools/lib
Xavier Ducrohet76afc002010-09-27 13:58:45 -070028rm $V $TOOLS/{android,apkbuilder,ddms,dmtracedump,draw9patch,emulator,etc1tool}
Raphael0e4dd612010-04-16 17:37:25 -070029rm $V $TOOLS/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign}
30rm $V $LIB/*/swt.jar
Xavier Ducrohet76afc002010-09-27 13:58:45 -070031rm $V $PLATFORM_TOOLS/{adb,aapt,aidl,dx,dexdump}
Raphael0e4dd612010-04-16 17:37:25 -070032
33# Copy all the new stuff in tools
34# Note: some tools are first copied here and then moved in platforms/<name>/tools/
35cp $V $WIN_OUT_DIR/host/windows-x86/bin/*.{exe,dll} $TOOLS/
36mkdir -pv $LIB/x86
37cp $V ${TOPDIR}prebuilt/windows/swt/swt.jar $LIB/x86/
38mkdir -pv $LIB/x86_64
39cp $V ${TOPDIR}prebuilt/windows-x86_64/swt/swt.jar $LIB/x86_64/
40
Raphael59b02d02010-10-08 15:41:01 -070041# Copy the SDK Manager (aka sdklauncher) to the root of the SDK (it was copied in tools above)
Raphael0e4dd612010-04-16 17:37:25 -070042# and move it also in SDK/tools/lib (so that tools updates can update the root one too)
Raphael59b02d02010-10-08 15:41:01 -070043cp $TOOLS/sdklauncher.exe $TEMP_SDK_DIR/"SDK Manager.exe"
44mv $TOOLS/sdklauncher.exe $LIB/"SDK Manager.exe"
Raphael0e4dd612010-04-16 17:37:25 -070045
46# Copy the emulator NOTICE in the tools dir
47cp $V ${TOPDIR}external/qemu/NOTICE $TOOLS/emulator_NOTICE.txt
48
49# aapt under cygwin needs to have mgwz.dll
50[[ -n $NEED_MGWZ ]] && cp $V $CYG_MGWZ_PATH $TOOLS/
51
52# Update a bunch of bat files
Raphael59b02d02010-10-08 15:41:01 -070053cp $V ${TOPDIR}sdk/files/post_tools_install.bat $LIB/
54cp $V ${TOPDIR}sdk/files/find_java.bat $LIB/
55cp $V ${TOPDIR}sdk/apkbuilder/etc/apkbuilder.bat $TOOLS/
56cp $V ${TOPDIR}sdk/ddms/app/etc/ddms.bat $TOOLS/
57cp $V ${TOPDIR}sdk/traceview/etc/traceview.bat $TOOLS/
Raphaelcca5d182010-10-14 11:25:01 -070058if [ -f ${TOPDIR}sdk/hierarchyviewer2/app/etc/hierarchyviewer.bat ]; then
59 cp $V ${TOPDIR}sdk/hierarchyviewer2/app/etc/hierarchyviewer.bat $TOOLS/
60else
61 # That's ok because currently GB uses Tools_r7 but we'll ship Tools_r8 from master-open.
62 echo "WARNING: Ignoring ${TOPDIR}sdk/hierarchyviewer2/app/etc/hierarchyviewer.bat [ok for GB+Tools r8]"
63fi
Raphael59b02d02010-10-08 15:41:01 -070064cp $V ${TOPDIR}sdk/layoutopt/app/etc/layoutopt.bat $TOOLS/
65cp $V ${TOPDIR}sdk/draw9patch/etc/draw9patch.bat $TOOLS/
66cp $V ${TOPDIR}sdk/sdkmanager/app/etc/android.bat $TOOLS/
Raphael0e4dd612010-04-16 17:37:25 -070067
68# Put the JetCreator tools, content and docs (not available in the linux SDK)
69JET=$TOOLS/Jet
70JETCREATOR=$JET/JetCreator
71JETDEMOCONTENT=$JET/demo_content
72JETLOGICTEMPLATES=$JET/logic_templates
73JETDOC=$TEMP_SDK_DIR/docs/JetCreator
74
75# need to rm these folders since a Mac SDK will have them and it might create a conflict
76rm -rf $V $JET
77rm -rf $V $JETDOC
78
79# now create fresh folders for JetCreator
80mkdir $V $JET
81mkdir $V $JETDOC
82
83cp -r $V ${TOPDIR}external/sonivox/jet_tools/JetCreator $JETCREATOR/
84cp -r $V ${TOPDIR}external/sonivox/jet_tools/JetCreator_content $JETDEMOCONTENT/
85cp -r $V ${TOPDIR}external/sonivox/jet_tools/logic_templates $JETLOGICTEMPLATES/
86chmod $V -R u+w $JETCREATOR # fixes an issue where Cygwin might copy the above as u+rx only
Xavier Ducrohet76afc002010-09-27 13:58:45 -070087cp $V ${TOPDIR}prebuilt/windows/jetcreator/EASDLL.dll $JETCREATOR/
Raphael0e4dd612010-04-16 17:37:25 -070088
89cp $V ${TOPDIR}external/sonivox/docs/JET_Authoring_Guidelines.html $JETDOC/
90cp -r $V ${TOPDIR}external/sonivox/docs/JET_Authoring_Guidelines_files $JETDOC/
91cp $V ${TOPDIR}external/sonivox/docs/JET_Creator_User_Manual.html $JETDOC/
92cp -r $V ${TOPDIR}external/sonivox/docs/JET_Creator_User_Manual_files $JETDOC/
93
94# Copy or move platform specific tools to the default platform.
95cp $V ${TOPDIR}dalvik/dx/etc/dx.bat $PLATFORM_TOOLS/
Xavier Ducrohet76afc002010-09-27 13:58:45 -070096mv $V $TOOLS/{adb.exe,aapt.exe,aidl.exe,dexdump.exe} $TOOLS/Adb*.dll $PLATFORM_TOOLS/
Raphael0e4dd612010-04-16 17:37:25 -070097
98# When building under cygwin, mgwz.dll must be both in SDK/tools for zipalign
99# and in SDK/platform/XYZ/tools/ for aapt
100[[ -n $NEED_MGWZ ]] && cp $V $TOOLS/mgwz.dll $PLATFORM_TOOLS/
101
102# Fix EOL chars to make window users happy - fix all files at the top level
103# as well as all batch files including those in platforms/<name>/tools/
104find $TEMP_SDK_DIR -maxdepth 1 -name "*.[ht]*" -type f -print0 | xargs -0 unix2dos
105find $TEMP_SDK_DIR -maxdepth 3 -name "*.bat" -type f -print0 | xargs -0 unix2dos
106
107# Just to make it easier on the build servers, we want fastboot and adb (and its DLLs)
108# next to the new SDK, so up one dir.
109for i in fastboot.exe adb.exe AdbWinApi.dll AdbWinUsbApi.dll; do
110 cp -f $V $WIN_OUT_DIR/host/windows-x86/bin/$i $TEMP_SDK_DIR/../$i
111done