Initial push.
diff --git a/scripts/create-art-tests.sh b/scripts/create-art-tests.sh
new file mode 100755
index 0000000..dc6d6d2
--- /dev/null
+++ b/scripts/create-art-tests.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+# Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+function generate_test() {
+  local name=$1
+  local testClassName=$2
+  local testGeneratingToolchain=$3
+  # The bash uppercase substitution ^^ is not supported on the bash version on Mac OS.
+  local testGeneratingToolchainEnum=$(echo $testGeneratingToolchain | tr /a-z/ /A-Z/)
+  local fileName=$4
+  local compilerUnderTest=$5
+  local compilerUnderTestEnum=$(echo ${compilerUnderTest} | tr /a-z/ /A-Z/)
+
+  cat <<EOF > $fileName
+// Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package com.android.tools.r8.art.${testGeneratingToolchain}.${compilerUnderTest};
+
+import static com.android.tools.r8.R8RunArtTestsTest.DexTool.${testGeneratingToolchainEnum};
+
+import com.android.tools.r8.R8RunArtTestsTest;
+import org.junit.Test;
+
+/**
+ * Auto-generated test for the art ${name} test using the ${testGeneratingToolchain} toolchain.
+ *
+ * DO NOT EDIT THIS FILE. EDIT THE HERE DOCUMENT TEMPLATE IN scripts/create-art-tests.sh INSTEAD!
+ */
+public class ${testClassName} extends R8RunArtTestsTest {
+
+    public ${testClassName}() {
+      super("${name}", ${testGeneratingToolchainEnum});
+    }
+
+    @Test
+    public void run${testClassName}() throws Throwable {
+      // For testing with other Art VMs than the default pass the VM version as a argument to
+      // runArtTest, e.g. runArtTest(ToolHelper.ART_4_4_4).
+      runArtTest(CompilerUnderTest.${compilerUnderTestEnum});
+    }
+}
+EOF
+}
+
+TESTDIR="tests/art"
+TOOLCHAINS=("dx" "jack" "none")
+DESTINATIONDIR="build/generated/test/java/com/android/tools/r8/art"
+
+if [ ! -e $TESTDIR ]; then
+  echo "Missing art tests in $TESTDIR."
+  exit
+fi
+
+for TOOLCHAIN in ${TOOLCHAINS[@]}; do
+  for d in $DESTINATIONDIR/$TOOLCHAIN/r8 $DESTINATIONDIR/$TOOLCHAIN/d8; do
+    rm -rf $d
+    mkdir -p $d
+  done
+  # class files are found in the dx directory.
+  if [ "$TOOLCHAIN" == "none" ]; then
+    SOURCEDIR=${TESTDIR}/dx
+  else
+    SOURCEDIR=${TESTDIR}/${TOOLCHAIN}
+  fi
+  for TEST in ${SOURCEDIR}/*; do
+    TESTNAME=$(basename $TEST)
+    TESTCLASSNAME="Art${TESTNAME//-/_}Test"
+    generate_test $TESTNAME $TESTCLASSNAME ${TOOLCHAIN} $DESTINATIONDIR/$TOOLCHAIN/r8/$TESTCLASSNAME.java r8
+    generate_test $TESTNAME $TESTCLASSNAME ${TOOLCHAIN} $DESTINATIONDIR/$TOOLCHAIN/d8/$TESTCLASSNAME.java d8
+  done
+done
diff --git a/scripts/create-jctf-tests.sh b/scripts/create-jctf-tests.sh
new file mode 100755
index 0000000..538f3c3
--- /dev/null
+++ b/scripts/create-jctf-tests.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+function generate_test() {
+  local name=$1
+  local testClassName=$2
+  local fileName=$3
+  local compilerUnderTest=$4
+  local classFile=$5
+  local relativePackage=$6
+  # The bash uppercase substitution ^^ is not supported on the bash version on Mac OS.
+  local compilerUnderTestEnum=$(echo ${compilerUnderTest} | tr /a-z/ /A-Z/)
+
+  PACKAGE_PREFIX="com.google.jctf.test.lib.java."
+
+  if [[ ! $name =~ ^$PACKAGE_PREFIX ]]; then
+    echo "Test full class name expected to start with \"$PACKAGE_PREFIX\" but it's \"$name\"" >&2
+    exit 1
+  fi
+
+  mkdir -p $(dirname $fileName)
+
+  cat <<EOF > $fileName
+// Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package com.android.tools.r8.art.jctf.${compilerUnderTest}.${relativePackage};
+
+import org.junit.Test;
+import com.android.tools.r8.R8RunArtTestsTest;
+
+/**
+ * Auto-generated test for the jctf test:
+ * ${name}
+ *
+ * DO NOT EDIT THIS FILE. EDIT THE HERE DOCUMENT TEMPLATE IN scripts/create-jctf-tests.sh INSTEAD!
+ */
+public class ${testClassName} extends R8RunArtTestsTest {
+
+  public ${testClassName}() {
+    super("${name:${#PACKAGE_PREFIX}}", DexTool.NONE);
+  }
+
+  @Test
+  public void run${testClassName}() throws Exception {
+    // For testing with other Art VMs than the default set the system property 'dex_vm'
+    // to the desired VM string (e.g. '4.4.4', see ToolHelper.DexVm)
+    runJctfTest(CompilerUnderTest.${compilerUnderTestEnum},
+      "$classFile",
+      "$name"
+    );
+  }
+}
+EOF
+}
+
+JCTFROOT="third_party/jctf"
+DESTINATIONDIR="build/generated/test/java/com/android/tools/r8/art"
+
+if [ ! -e $JCTFROOT ]; then
+  echo "Missing jctf tests in $JCTFROOT."
+  exit
+fi
+
+for d in $DESTINATIONDIR/jctf/r8 $DESTINATIONDIR/jctf/d8; do
+  rm -rf $d
+  mkdir -p $d
+done
+
+RELATIVE_TESTDIR="LibTests/src/com/google/jctf/test/lib/java"
+TESTDIR="$JCTFROOT/$RELATIVE_TESTDIR"
+
+COUNT=$(grep -r "@Test" "$TESTDIR" --include=*.java -l | wc -l)
+echo "JCTF: $COUNT files to generate"
+
+grep -r "@Test" "$TESTDIR" --include=*.java -l | while read -r line; do
+  TESTNAME=$(basename $line .java)
+  TESTCLASSNAME="${TESTNAME//-/_}"
+
+  RELATIVE_TEST_PATH=$(expr "$line" : ".*$RELATIVE_TESTDIR/\(.*$\)")
+
+  PACKAGE=$(grep package $line | grep -o -m 1 "com[^;]*")
+  CLASSFILE="$(echo $PACKAGE | tr '.' '/')/$TESTNAME.class"
+  RELATIVE_PACKAGE=$(expr "$PACKAGE" : ".*\.java\.\(.*$\)")
+
+  generate_test $PACKAGE.$TESTNAME $TESTCLASSNAME \
+    "$DESTINATIONDIR/jctf/r8/$RELATIVE_TEST_PATH" r8 \
+    $CLASSFILE $RELATIVE_PACKAGE
+  generate_test $PACKAGE.$TESTNAME $TESTCLASSNAME \
+    "$DESTINATIONDIR/jctf/d8/$RELATIVE_TEST_PATH" d8 \
+    $CLASSFILE $RELATIVE_PACKAGE
+done
+
diff --git a/scripts/d8_for_aosp.sh b/scripts/d8_for_aosp.sh
new file mode 100755
index 0000000..422aa85
--- /dev/null
+++ b/scripts/d8_for_aosp.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+#
+# Replacement for 'dx' script invoked by the AOSP makefiles.
+# This script invokes 'd8' instead while providing the same API.
+#
+# Based on this file:
+#
+#     repo: https://android.googlesource.com/platform/prebuilts/sdk
+#     file: tools/dx
+#     SHA1: 6f6b5641b531f18c8e8d314b4b0560370ffbf1ab
+#
+# or this (identical)
+#
+#     repo: https://android.googlesource.com/platform/dalvik
+#     file: dx/etc/dx
+#     SHA1: 9fa280c2171b3a016d63e80cda7be031519b7ef7
+
+readonly ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
+
+defaultMx="-Xmx1024M"
+
+# The following will extract any initial parameters of the form
+# "-J<stuff>" from the command line and pass them to the Java
+# invocation (instead of to dx). This makes it possible for you to add
+# a command-line parameter such as "-JXmx256M" in your scripts, for
+# example. "java" (with no args) and "java -X" give a summary of
+# available options.
+
+javaOpts=""
+
+while expr "x$1" : 'x-J' >/dev/null; do
+    opt=`expr "x$1" : 'x-J\(.*\)'`
+    javaOpts="${javaOpts} -${opt}"
+    if expr "x${opt}" : "xXmx[0-9]" >/dev/null; then
+        defaultMx="no"
+    fi
+    shift
+done
+
+if [ "${defaultMx}" != "no" ]; then
+    javaOpts="${javaOpts} ${defaultMx}"
+fi
+
+jarpath="$ROOT/build/libs/d8.jar"
+
+exec java $javaOpts -jar "$jarpath" --dex "$@"
+
diff --git a/scripts/run-dex2oat.sh b/scripts/run-dex2oat.sh
new file mode 100755
index 0000000..5a9fd5b
--- /dev/null
+++ b/scripts/run-dex2oat.sh
@@ -0,0 +1,64 @@
+#! /bin/bash
+#
+# Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+set -e
+
+if [ -z "$R8_HOME" ]; then
+  R8_HOME="$(realpath $(dirname ${BASH_SOURCE[0]})/..)"
+fi
+
+TOOLSDIR=$R8_HOME/tools/linux
+
+function usage {
+  echo "Usage: $(basename $0) <dex files>"
+  exit 1
+}
+
+# Process options.
+while [ $# -gt 0 ]; do
+  case $1 in
+    -h)
+      usage
+      ;;
+    *)
+      break
+      ;;
+  esac
+done
+
+if [ $# -eq 0 ]; then
+  usage
+fi
+
+TMPDIR=$(mktemp -d "${TMP:-/tmp/}$(basename $0).XXXXXXXXXXXX")
+OATFILE=$TMPDIR/all.oat
+
+if [ $# -gt 1 ]; then
+  JARFILE="$TMPDIR/all.jar"
+  for f in "$@"; do
+    IR=$(dirname "$f")
+    BASE=$(basename "$f")
+    EXT=$(echo "$BASE" | cut -d '.' -f 2)
+    if [ "$EXT" = "dex" ]; then
+      (cd "$DIR" && zip "$JARFILE" "$BASE")
+    else
+      echo "Warning: ignoring non-dex file argument when dex2oat'ing multiple files."
+    fi
+  done
+else
+  JARFILE="$1"
+fi
+
+LD_LIBRARY_PATH=$TOOLSDIR/art/lib $TOOLSDIR/art/bin/dex2oat \
+  --android-root=$TOOLSDIR/art/product/angler \
+  --runtime-arg -Xnorelocate \
+  --boot-image=$TOOLSDIR/art/product/angler/system/framework/boot.art \
+  --dex-file=$JARFILE \
+  --oat-file=$OATFILE \
+  --instruction-set=arm64 \
+  --compiler-filter=interpret-only
+
+rm -rf $TMPDIR
diff --git a/scripts/test_android_cts.sh b/scripts/test_android_cts.sh
new file mode 100755
index 0000000..49175ec
--- /dev/null
+++ b/scripts/test_android_cts.sh
@@ -0,0 +1,140 @@
+#!/bin/bash
+#
+# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+#
+# Clone and build AOSP, using D8 instead of JACK or DX,
+# then run the Android-CTS on the emulator and compare results
+# to a baseline.
+#
+# This script uses the repo manifest file 'third_party/aosp_manifest.xml'
+# which is a snapshot of the aosp repo set.
+# The manifest file can be updated with the following commands:
+#
+#     cd build/aosp
+#     repo manifest -o ../../third_party/aosp_manifest.xml -r
+#
+# The baseline is the `test_result.xml` file which is created with an AOSP
+# build which uses the default (JACK) toolset.
+#
+# To reproduce the baseline results, follow the instructions in this script,
+# except don't set `ANDROID_COMPILE_WITH_JACK=false` for the `make` command.
+# Also, you don't need to apply either of the patches (PATCH#1 and #2, see
+# below)
+#
+
+set -e
+
+readonly R8_ROOT=$(cd "$(dirname ${BASH_SOURCE[0]})"/..; pwd)
+readonly AOSP_ROOT="$R8_ROOT/build/aosp"
+readonly CTS_BASELINE="$R8_ROOT/third_party/android_cts_baseline/test_result.xml"
+readonly D8_JAR="$R8_ROOT/build/libs/d8.jar"
+readonly J_OPTION="-j8"
+readonly OUT_IMG=out_img # output dir for android image build
+readonly OUT_CTS=out_cts # output dir for CTS build
+
+# Process an Android CTS test_result.xml file for easy comparison with a
+# baseline.
+#
+# The function transforms these lines:
+#
+#     <Test result="pass|fail" name="<name>" />
+#
+# to this:
+#
+#     <module-name>/<testcase-name>/<name> -> PASS|FAIL
+#
+flatten_xml() {
+  local input_file="$1"
+  local module
+  local testcase
+  local testname
+  while IFS='' read -r line || [[ -n "$line" ]]; do
+    if [[ $line =~ \<Module\ name=\"([^\"]*)\" ]]; then
+      module=${BASH_REMATCH[1]}
+    elif [[ $line =~ \<TestCase\ name=\"([^\"]*)\" ]]; then
+      testcase=${BASH_REMATCH[1]}
+    elif [[ $line =~ \<Test\ result=\"pass\"\ name=\"([^\"]*)\" ]]; then
+      echo "$module/$testcase/${BASH_REMATCH[1]} -> PASS"
+    elif [[ $line =~ \<Test\ result=\"fail\"\ name=\"([^\"]*)\" ]]; then
+      echo "$module/$testcase/${BASH_REMATCH[1]} -> FAIL"
+    fi
+  done < "$input_file"
+}
+
+#### MAIN ####
+
+cd "$R8_ROOT"
+tools/gradle.py d8
+
+mkdir -p "$AOSP_ROOT"
+cd "$AOSP_ROOT"
+
+# Two output dirs, one for the android image and one for cts tests. The output
+# is compiled with d8 and jack, respectively.
+mkdir -p "$OUT_IMG" "$OUT_CTS"
+
+# remove dex files older than the current d8 tool
+find "$OUT_IMG" ! -newer "$R8_ROOT/build/libs/d8.jar" -name '*.dex' -exec rm {} \;
+
+# checkout AOSP source
+mkdir -p .repo/manifests
+cp "$R8_ROOT/third_party/aosp_manifest.xml" .repo/manifests
+
+repo init -u "https://android.googlesource.com/platform/manifest" -m aosp_manifest.xml
+repo sync -dq $J_OPTION
+
+# activate $OUT_CTS
+rm -rf out
+ln -s "$OUT_CTS" out
+
+. build/envsetup.sh
+lunch aosp_x86-eng
+make $J_OPTION cts
+
+# activate $OUT_IMG
+rm -rf out
+ln -s "$OUT_IMG" out
+
+. build/envsetup.sh
+lunch aosp_x86-eng
+make $J_OPTION ANDROID_COMPILE_WITH_JACK=false DX_ALT_JAR="$D8_JAR"
+
+# create sdcard image for media tests
+
+mkdir -p "$R8_ROOT/build/tmp"
+sdcard_file="$R8_ROOT/build/tmp/sdcard.img"
+rm -f "$sdcard_file"
+mksdcard 4G "$sdcard_file"
+
+emulator -partition-size 4096 -wipe-data -sdcard "$sdcard_file" &
+emulator_pid=$!
+
+adb wait-for-device
+adb shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'
+
+echo "exit" | \
+  ANDROID_BUILD_TOP= \
+    "$OUT_CTS/host/linux-x86/cts/android-cts/tools/cts-tradefed" run cts
+
+kill $emulator_pid
+rm -f "$sdcard_file"
+
+# find the newest test_result.xml
+
+results_dir="$OUT_CTS/host/linux-x86/cts/android-cts/results"
+timestamp="$(ls --group-directories-first -t "$results_dir" | head -1)"
+results_xml="$results_dir/$timestamp/test_result.xml"
+
+echo "Summary from current test results: $results_xml"
+grep "<Summary " "$results_xml"
+
+echo "Summary from baseline: $CTS_BASELINE"
+grep "<Summary " "$CTS_BASELINE"
+
+echo "Comparing test results to baseline"
+
+diff <(flatten_xml "$results_xml") <(flatten_xml "$CTS_BASELINE")
+exit $? # make it explicit that the result of the diff must be the result of this script
+
diff --git a/scripts/update-host-art.sh b/scripts/update-host-art.sh
new file mode 100755
index 0000000..8bfc753
--- /dev/null
+++ b/scripts/update-host-art.sh
@@ -0,0 +1,143 @@
+#! /bin/bash
+# Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# This script will update the host art VM in tools/linux/art
+
+# Before running this script make sure that you have a full android build
+# and that the host Art version required is build in ~/android/master:
+#
+#  m -j24
+#  m -j24 build-art
+#
+# Maybe also run the Art host tests:
+#
+#  m -j24 test-art-host
+
+set -e
+
+ANDROID_CHECKOUT=~/android/master
+ANDROID_PRODUCT=angler
+ART_DIR=art
+DEST_ROOT=tools/linux
+
+function usage {
+  echo "Usage: $(basename $0)"
+  echo "  [--android-checkout <android repo root>]"
+  echo "  [--art-dir <destination directory>]"
+  echo "  [--android-product <product name>]"
+  echo "  [--destination-dir <destination directory>]"
+  echo ""
+  echo "  --android-checkout specifies the Android repo root"
+  echo "  Defaults to: $ANDROID_CHECKOUT"
+  echo ""
+  echo "  --art-dir specifies the directory name inside the root destination"
+  echo "  directory for the art bundle"
+  echo "  Defaults to: $ART_DIR"
+  echo ""
+  echo "  --android-product specifies the Android product for the framework to include"
+  echo "  Defaults to: $ANDROID_PRODUCT"
+  echo ""
+  echo "  --destination-dir specifies the root destination directory for the art bundle"
+  echo "  Defaults to: $DEST_ROOT"
+  echo ""
+  echo "Update the master version of art from ~/android/master:"
+  echo "  "
+  echo "  $(basename $0)"
+  echo "  "
+  echo "Update a specific version of art:"
+  echo "  "
+  echo "  $(basename $0) --android-checkout ~/android/5.1.1_r19 --art-dir 5.1.1"
+  echo "  "
+  echo "Test the Art bundle in a temporary directory:"
+  echo "  "
+  echo "  $(basename $0) --android-checkout ~/android/5.1.1_r19 --art-dir art-5.1.1 --android-product mako --destination-dir /tmp/art"
+  echo "  "
+  exit 1
+}
+
+# Process options.
+while [ $# -gt 0 ]; do
+  case $1 in
+    --android-checkout)
+      ANDROID_CHECKOUT="$2"
+      shift 2
+      ;;
+    --art-dir)
+      ART_DIR="$2"
+      shift 2
+      ;;
+    --android-product)
+      ANDROID_PRODUCT="$2"
+      shift 2
+      ;;
+    --destination-dir)
+      DEST_ROOT="$2"
+      shift 2
+      ;;
+    --help|-h|-H|-\?)
+      usage
+      ;;
+    *)
+      echo "Unkonwn option $1"
+      echo ""
+      usage
+      ;;
+  esac
+done
+
+ANDROID_HOST_BUILD=$ANDROID_CHECKOUT/out/host/linux-x86
+ANDROID_TARGET_BUILD=$ANDROID_CHECKOUT/out/target
+DEST=$DEST_ROOT/$ART_DIR
+
+# Clean out the previous version of Art
+rm -rf $DEST
+
+# Required binaries and scripts.
+mkdir -p $DEST/bin
+if [ -f $ANDROID_HOST_BUILD/bin/art ]; then
+  cp $ANDROID_HOST_BUILD/bin/art $DEST/bin
+else
+  cp $ANDROID_CHECKOUT/art/tools/art $DEST/bin
+fi
+
+cp $ANDROID_HOST_BUILD/bin/dalvikvm64 $DEST/bin
+cp $ANDROID_HOST_BUILD/bin/dalvikvm32 $DEST/bin
+# Copy the dalvikvm link creating a regular file instead, as download_from_google_stroage.py does
+# not allow tar files with symbolic links (depending on Android/Art version dalvikvm links to
+# dalvikvm32 or dalvikvm64).
+cp $ANDROID_HOST_BUILD/bin/dalvikvm $DEST/bin
+cp $ANDROID_HOST_BUILD/bin/dex2oat $DEST/bin
+cp $ANDROID_HOST_BUILD/bin/patchoat $DEST/bin
+
+# Required framework files.
+mkdir -p $DEST/framework
+cp -R $ANDROID_HOST_BUILD/framework/* $DEST/framework
+
+# Required library files.
+mkdir -p $DEST/lib64
+cp -r $ANDROID_HOST_BUILD/lib64/* $DEST/lib64
+mkdir -p $DEST/lib
+cp -r $ANDROID_HOST_BUILD/lib/* $DEST/lib
+
+# Image files required for dex2oat of actual android apps. We need an actual android product
+# image containing framework classes to verify the code against.
+mkdir -p $DEST/product/$ANDROID_PRODUCT/system/framework
+cp -r $ANDROID_TARGET_BUILD/product/$ANDROID_PRODUCT/system/framework/* $DEST/product/$ANDROID_PRODUCT/system/framework
+
+# Required auxillary files.
+mkdir -p $DEST/usr/icu
+cp -r $ANDROID_HOST_BUILD/usr/icu/* $DEST/usr/icu
+
+# Allow failure for strip commands below.
+set +e
+
+strip $DEST/bin/* 2> /dev/null
+strip $DEST/lib/*
+strip $DEST/lib64/*
+strip $DEST/framework/x86/* 2> /dev/null
+strip $DEST/framework/x86_64/* 2> /dev/null
+
+echo "Now run"
+echo "(cd $DEST_ROOT; upload_to_google_storage.py -a --bucket r8-deps $ART_DIR)"
diff --git a/scripts/update-host-dx.sh b/scripts/update-host-dx.sh
new file mode 100755
index 0000000..6d4a3a8
--- /dev/null
+++ b/scripts/update-host-dx.sh
@@ -0,0 +1,51 @@
+#! /bin/bash
+# Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# This script will update the host dx and dexmerger tools in tools/linux/dx.
+
+# Before running this script make sure the dx and dexmerger versions required are built
+# in ~/android/master (There are probably simpler ways to just build dx and dexmerger):
+#
+#  m -j24 build-art
+#
+# Maybe also run the Art host tests:
+#
+#  mm -j24 art-test-host
+#
+
+ANDROID_CHECKOUT=~/android/master
+ANDROID_HOST_BUILD=$ANDROID_CHECKOUT/out/host/linux-x86
+LINUX_TOOLS=tools/linux
+DX_DIR=dx
+DEST=$LINUX_TOOLS/$DX_DIR
+
+# Clean out the previous version of Art
+rm -rf $DEST
+
+# Required binaries and scripts.
+mkdir -p $DEST/bin
+cp $ANDROID_HOST_BUILD/bin/dx $DEST/bin
+cp $ANDROID_HOST_BUILD/bin/dexmerger $DEST/bin
+
+# Required framework files.
+mkdir -p $DEST/framework
+cp $ANDROID_HOST_BUILD/framework/dx.jar $DEST/framework
+
+# Build the tar to upload to Google Cloud Storage.
+DX_ARCHIVE=$DX_DIR.tar.gz
+pushd $LINUX_TOOLS > /dev/null
+rm -f $DX_ARCHIVE
+rm -f $DX_ARCHIVE.sha1
+tar caf $DX_ARCHIVE $DX_DIR
+popd  > /dev/null
+
+echo "New $LINUX_TOOLS/$DX_ARCHIVE archive created."
+echo ""
+echo "Now run:"
+echo ""
+echo "  cd $LINUX_TOOLS"
+echo "  upload_to_google_storage.py --bucket r8-deps $DX_DIR.tar.gz"
+echo ""
+echo "to upload to Google Cloud Storage"