summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorRaphael <raphael@google.com>2009-05-20 14:38:23 -0700
committerRaphael <raphael@google.com>2009-05-20 22:28:21 -0700
commitd1959dcee1d3fcd4a83908e3333c6388da6d404c (patch)
treedd01cc4a2bcf62da0075a9f8844abe9c309f1c1c /build
parentd7dc91d749b920734c9e9f0a21c7c7e9672ef8b6 (diff)
downloadandroid_development-d1959dcee1d3fcd4a83908e3333c6388da6d404c.tar.gz
android_development-d1959dcee1d3fcd4a83908e3333c6388da6d404c.tar.bz2
android_development-d1959dcee1d3fcd4a83908e3333c6388da6d404c.zip
SDK #1800921: Packages the Windows SDK in a temporary location.
This changes make_windows_sdk so that it packages everything in a temp dir. Once the build & packaging succeeds, the final Zip is copied to the desired location. The temp dir is *not* cleared on zip errors, which helps in diagnosing packaging issues after the fact. This has no impact on the build process itself (i.e. make adb, emulator, etc.) which all happen in $SDK/out anyway. The temp dir can be passed as an argument. If not provided, the default Cygwin $TMP is used. Otherwise /tmp is used. I also added an usage description when parameters are missing.
Diffstat (limited to 'build')
-rwxr-xr-xbuild/tools/make_windows_sdk.sh73
1 files changed, 49 insertions, 24 deletions
diff --git a/build/tools/make_windows_sdk.sh b/build/tools/make_windows_sdk.sh
index de2670549..0ce9caa2d 100755
--- a/build/tools/make_windows_sdk.sh
+++ b/build/tools/make_windows_sdk.sh
@@ -13,8 +13,12 @@ set -e # Fail this script as soon as a command fails -- fail early, fail fast
# will make some rm/mv commands to fail.
FORCE="1"
+PROG_NAME="$0"
SDK_ZIP="$1"
DIST_DIR="$2"
+TEMP_DIR="$3"
+[ -z "$TEMP_DIR" ] && TEMP_DIR=${TMP:-/tmp}
+
function die() {
echo "Error:" $*
@@ -22,9 +26,23 @@ function die() {
exit 1
}
+function usage() {
+ echo "Usage: ${PROG_NAME} linux_or_mac_sdk.zip output_dir [temp_dir]"
+ echo "If temp_dir is not given, \$TMP is used. If that's missing, /tmp is used."
+ status
+ exit 2
+}
+
+function status() {
+ echo "Current values:"
+ echo "- Input SDK: ${SDK_ZIP:-missing}"
+ echo "- Output dir: ${DIST_DIR:-missing}"
+ echo "- Temp dir: ${TEMP_DIR:-missing}"
+}
+
function check() {
- [ -f "$SDK_ZIP" ] || die "Pass the path of an existing Linux/Darwin SDK .zip as first parameter"
- [ -d "$DIST_DIR" ] || die "Pass the output directory as second parameter"
+ [ -f "$SDK_ZIP" ] || usage
+ [ -d "$DIST_DIR" ] || usage
# Use the BUILD_ID as SDK_NUMBER if defined, otherwise try to get it from the
# provided zip filename.
@@ -72,21 +90,22 @@ function package() {
echo
echo "Packaging..."
DEST_NAME="android-sdk_${SDK_NUMBER}_windows"
- DEST="$DIST_DIR/$DEST_NAME"
DEST_NAME_ZIP="${DEST_NAME}.zip"
+ TEMP_SDK_DIR="$TEMP_DIR/$DEST_NAME"
+
# Unzip current linux/mac SDK and rename using the windows name
- if [[ -n "$FORCE" || ! -d "$DEST" ]]; then
- [ -e "$DEST" ] && rm -rfv "$DEST" # cleanup dest first if exists
+ if [[ -n "$FORCE" || ! -d "$TEMP_SDK_DIR" ]]; then
+ [ -e "$TEMP_SDK_DIR" ] && rm -rfv "$TEMP_SDK_DIR" # cleanup dest first if exists
UNZIPPED=`basename "$SDK_ZIP"`
- UNZIPPED="$DIST_DIR/${UNZIPPED/.zip/}"
+ UNZIPPED="$TEMP_DIR/${UNZIPPED/.zip/}"
[ -e "$UNZIPPED" ] && rm -rfv "$UNZIPPED" # cleanup unzip dir (if exists)
- unzip "$SDK_ZIP" -d "$DIST_DIR"
- mv -v "$UNZIPPED" "$DEST"
+ unzip "$SDK_ZIP" -d "$TEMP_DIR"
+ mv -v "$UNZIPPED" "$TEMP_SDK_DIR"
fi
# Assert that the package contains only one platform
- PLATFORMS="$DEST/platforms"
+ PLATFORMS="$TEMP_SDK_DIR/platforms"
THE_PLATFORM=`echo $PLATFORMS/*`
PLATFORM_TOOLS=$THE_PLATFORM/tools
echo "Platform found: " $THE_PLATFORM
@@ -97,23 +116,24 @@ function package() {
# USB Driver for ADB
- mkdir -pv $DEST/usb_driver/x86
- cp -rv development/host/windows/prebuilt/usb/driver/* $DEST/usb_driver/x86/
- mkdir -pv $DEST/usb_driver/amd64
- cp -rv development/host/windows/prebuilt/usb/driver_amd_64/* $DEST/usb_driver/amd64/
+ mkdir -pv $TEMP_SDK_DIR/usb_driver/x86
+ cp -rv development/host/windows/prebuilt/usb/driver/* $TEMP_SDK_DIR/usb_driver/x86/
+ mkdir -pv $TEMP_SDK_DIR/usb_driver/x86_64
+ cp -rv development/host/windows/prebuilt/usb/driver_amd_64/* $TEMP_SDK_DIR/usb_driver/x86_64/
# Remove obsolete stuff from tools & platform
- TOOLS="$DEST/tools"
- LIB="$DEST/tools/lib"
- rm -v "$TOOLS"/{adb,emulator,traceview,draw9patch,hierarchyviewer,apkbuilder,ddms,dmtracedump,hprof-conv,mksdcard,sqlite3,android}
- rm -v --force "$LIB"/*.so "$LIB"/*.jnilib
- rm -v "$PLATFORM_TOOLS"/{aapt,aidl,dx,dexdump}
+ TOOLS="$TEMP_SDK_DIR/tools"
+ LIB="$TEMP_SDK_DIR/tools/lib"
+ rm -v "$TOOLS"/{adb,android,apkbuilder,ddms,dmtracedump,draw9patch,emulator}
+ rm -v "$TOOLS"/{hierarchyviewer,hprof-conv,mksdcard,sqlite3,traceview}
+ rm -vf "$LIB"/*.so "$LIB"/*.jnilib
+ rm -v "$PLATFORM_TOOLS"/{aapt,aidl,dx,dexdump}
# Copy all the new stuff in tools
# Note: some tools are first copied here and then moved in platforms/<name>/tools/
cp -v out/host/windows-x86/bin/*.{exe,dll} "$TOOLS"
- cp -v prebuilt/windows/swt/*.{jar,dll} "$LIB"
+ cp -v prebuilt/windows/swt/*.{jar,dll} "$LIB"
# If you want the emulator NOTICE in the tools dir, uncomment the following line:
# cp -v external/qemu/NOTICE "$TOOLS"/emulator_NOTICE.txt
@@ -134,7 +154,7 @@ function package() {
JETCREATOR="$JET/JetCreator"
JETDEMOCONTENT="$JET/demo_content"
JETLOGICTEMPLATES="$JET/logic_templates"
- JETDOC="$DEST/docs/JetCreator"
+ JETDOC="$TEMP_SDK_DIR/docs/JetCreator"
# need to rm these folders since a Mac SDK will have them and it might create a conflict
rm -rfv "$JET"
@@ -162,14 +182,18 @@ function package() {
# Fix EOL chars to make window users happy - fix all files at the top level only
# as well as all batch files including those in platforms/<name>/tools/
- find "$DIST_DIR" -maxdepth 1 -type f -writable -print0 | xargs -0 unix2dos -D
- find "$DIST_DIR" -maxdepth 3 -name "*.bat" -type f -writable -print0 | xargs -0 unix2dos -D
+ find "$TEMP_SDK_DIR" -maxdepth 1 -type f -writable -print0 | xargs -0 unix2dos -D
+ find "$TEMP_SDK_DIR" -maxdepth 3 -name "*.bat" -type f -writable -print0 | xargs -0 unix2dos -D
- # Done.. Zip it
- pushd "$DIST_DIR" > /dev/null
+ # Done.. Zip it. Clean the temp folder ONLY if the zip worked (to easy debugging)
+ pushd "$TEMP_DIR" > /dev/null
[ -e "$DEST_NAME_ZIP" ] && rm -rfv "$DEST_NAME_ZIP"
zip -9r "$DEST_NAME_ZIP" "$DEST_NAME" && rm -rfv "$DEST_NAME"
popd > /dev/null
+
+ # Now move the final zip from the temp dest to the final dist dir
+ mv -v "$TEMP_DIR/$DEST_NAME_ZIP" "$DIST_DIR/$DEST_NAME_ZIP"
+
echo "Done"
echo
echo "Resulting SDK is in $DIST_DIR/$DEST_NAME_ZIP"
@@ -181,6 +205,7 @@ function package() {
}
check
+status
build
package