summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-09-02 15:24:25 +0100
committerNicolas Geoffray <ngeoffray@google.com>2014-09-08 15:26:05 +0100
commitf63a0a529ef9d2b819dc1bc7754fcf9e1d60bd74 (patch)
treee9e746230d5474f343c8e9fdf779836b5d309d20 /tools
parent7c7686e62d262f1823876cebb3700e20f967dd56 (diff)
downloadandroid_art-f63a0a529ef9d2b819dc1bc7754fcf9e1d60bd74.tar.gz
android_art-f63a0a529ef9d2b819dc1bc7754fcf9e1d60bd74.tar.bz2
android_art-f63a0a529ef9d2b819dc1bc7754fcf9e1d60bd74.zip
Clean-up and make the art script usable on target.
Also add a phony target to build what's needed to use it. Change-Id: I0bca6b0cbe921653de05fec0ae0cbbff63df580e
Diffstat (limited to 'tools')
-rw-r--r--tools/Android.mk10
-rw-r--r--tools/art63
2 files changed, 43 insertions, 30 deletions
diff --git a/tools/Android.mk b/tools/Android.mk
index d3be17f4d6..9a96f7a6e7 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -27,3 +27,13 @@ $(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/art $(ACP)
@echo "Copy: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-new-target)
$(hide) chmod 755 $@
+
+# Copy the art shell script to the target's bin directory
+include $(CLEAR_VARS)
+LOCAL_MODULE_CLASS := EXECUTABLES
+LOCAL_MODULE := art
+include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/art $(ACP)
+ @echo "Copy: $(PRIVATE_MODULE) ($@)"
+ $(copy-file-to-new-target)
+ $(hide) chmod 755 $@
diff --git a/tools/art b/tools/art
index 85517d3240..1afcc388cb 100644
--- a/tools/art
+++ b/tools/art
@@ -14,27 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-lib=-XXlib:libart.so
-invoke_with=
-
-while true; do
- if [ "$1" = "--invoke-with" ]; then
- shift
- invoke_with="$1"
- shift
- elif [ "$1" = "-d" ]; then
- lib="-XXlib:libartd.so"
- shift
- elif expr "$1" : "--" >/dev/null 2>&1; then
- echo "unknown option: $1" 1>&2
- exit 1
+function follow_links() {
+ if [ z"$BASH_SOURCE" != z ]; then
+ file="$BASH_SOURCE"
else
- break
+ file="$0"
fi
-done
-
-function follow_links() {
- file="$1"
while [ -h "$file" ]; do
# On Mac OS, readlink -f doesn't work.
file="$(readlink "$file")"
@@ -42,13 +27,6 @@ function follow_links() {
echo "$file"
}
-PROG_NAME="$(follow_links "$BASH_SOURCE")"
-PROG_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
-ANDROID_BUILD_TOP="$(cd "${PROG_DIR}/../../../../" ; pwd -P)/"
-ANDROID_HOST_OUT=$PROG_DIR/..
-ANDROID_DATA=$PWD/android-data$$
-DALVIKVM_EXECUTABLE=$ANDROID_HOST_OUT/bin/dalvikvm
-
function find_libdir() {
if [ "$(readlink "$DALVIKVM_EXECUTABLE")" = "dalvikvm64" ]; then
echo "lib64"
@@ -57,14 +35,39 @@ function find_libdir() {
fi
}
-LD_LIBRARY_PATH=$ANDROID_HOST_OUT/"$(find_libdir)"
+PROG_NAME="$(follow_links)"
+PROG_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
+ANDROID_ROOT=$PROG_DIR/..
+ANDROID_DATA=$PWD/android-data$$
+DALVIKVM_EXECUTABLE=$ANDROID_ROOT/bin/dalvikvm
+LIBDIR=$(find_libdir)
+LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBDIR
+
+lib=-XXlib:$ANDROID_ROOT/$LIBDIR/libart.so
+invoke_with=
+
+while true; do
+ if [ "$1" = "--invoke-with" ]; then
+ shift
+ invoke_with="$1"
+ shift
+ elif [ "$1" = "-d" ]; then
+ lib="-XXlib:$LIBDIR/libartd.so"
+ shift
+ elif expr "$1" : "--" >/dev/null 2>&1; then
+ echo "unknown option: $1" 1>&2
+ exit 1
+ else
+ break
+ fi
+done
-mkdir -p $ANDROID_DATA/dalvik-cache/{x86,x86_64}
+mkdir -p $ANDROID_DATA/dalvik-cache/{arm,arm64,x86,x86_64}
ANDROID_DATA=$ANDROID_DATA \
- ANDROID_ROOT=$ANDROID_HOST_OUT \
+ ANDROID_ROOT=$ANDROID_ROOT \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH \
$invoke_with $DALVIKVM_EXECUTABLE $lib \
- -Ximage:$ANDROID_HOST_OUT/framework/core.art \
+ -Ximage:$ANDROID_ROOT/framework/core.art \
"$@"
EXIT_STATUS=$?
rm -rf $ANDROID_DATA