summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-02-12 10:22:39 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-02-12 10:22:40 +0000
commit763a08537134c14defe8a591f88846164adef0c9 (patch)
treef2610bda28e12a7783594a54e9363d2d9936179d
parent7655968112fa08844f3a810bd6203fdde4d5f58f (diff)
parent1f5a90f28443886ebefcfbd531b8e41ece298cca (diff)
downloadart-763a08537134c14defe8a591f88846164adef0c9.zip
art-763a08537134c14defe8a591f88846164adef0c9.tar.gz
art-763a08537134c14defe8a591f88846164adef0c9.tar.bz2
Merge "Add a script for running art standalone."
-rw-r--r--Android.mk7
-rw-r--r--runtime/runtime.cc8
-rw-r--r--tools/Android.mk32
-rwxr-xr-xtools/art16
4 files changed, 61 insertions, 2 deletions
diff --git a/Android.mk b/Android.mk
index 62d40bb..8e43879 100644
--- a/Android.mk
+++ b/Android.mk
@@ -92,6 +92,7 @@ include $(art_path)/dex2oat/Android.mk
include $(art_path)/disassembler/Android.mk
include $(art_path)/oatdump/Android.mk
include $(art_path)/dalvikvm/Android.mk
+include $(art_path)/tools/Android.mk
include $(art_build_path)/Android.oat.mk
# ART_HOST_DEPENDENCIES depends on Android.executable.mk above for ART_HOST_EXECUTABLES
@@ -300,6 +301,12 @@ build-art-host: $(ART_HOST_EXECUTABLES) $(ART_HOST_TEST_EXECUTABLES) $(HOS
.PHONY: build-art-target
build-art-target: $(ART_TARGET_EXECUTABLES) $(ART_TARGET_TEST_EXECUTABLES) $(TARGET_CORE_IMG_OUT) $(TARGET_OUT)/lib/libjavacore.so
+.PHONY: art-host
+art-host: $(HOST_OUT_EXECUTABLES)/art $(HOST_OUT)/bin/dalvikvm $(HOST_OUT)/lib/libart.so $(HOST_OUT)/bin/dex2oat $(HOST_OUT_JAVA_LIBRARIES)/core.art $(HOST_OUT)/lib/libjavacore.so
+
+.PHONY: art-host-debug
+art-host-debug: art-host $(HOST_OUT)/lib/libartd.so $(HOST_OUT)/bin/dex2oatd
+
########################################################################
# oatdump targets
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 6ca45e8..d8f9ca3 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -765,6 +765,12 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b
parsed->image_ += GetAndroidRoot();
parsed->image_ += "/framework/boot.art";
}
+ if (!kIsTargetBuild && parsed->host_prefix_.empty()) {
+ const char* build_top = getenv("ANDROID_BUILD_TOP");
+ if (build_top != NULL) {
+ parsed->host_prefix_ = build_top;
+ }
+ }
if (parsed->heap_growth_limit_ == 0) {
parsed->heap_growth_limit_ = parsed->heap_maximum_size_;
}
@@ -834,7 +840,7 @@ jobject CreateSystemClassLoader() {
bool Runtime::Start() {
VLOG(startup) << "Runtime::Start entering";
- CHECK(host_prefix_.empty()) << host_prefix_;
+ CHECK(!kIsTargetBuild || host_prefix_.empty()) << host_prefix_;
// Restore main thread state to kNative as expected by native code.
Thread* self = Thread::Current();
diff --git a/tools/Android.mk b/tools/Android.mk
new file mode 100644
index 0000000..6c385dc
--- /dev/null
+++ b/tools/Android.mk
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+ifeq ($(WITH_HOST_DALVIK),true)
+# Copy the art shell script to the host's bin directory
+include $(CLEAR_VARS)
+LOCAL_IS_HOST_MODULE := true
+LOCAL_MODULE_TAGS := optional
+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 $@
+
+endif
diff --git a/tools/art b/tools/art
index 0a6c941..2e3a46e 100755
--- a/tools/art
+++ b/tools/art
@@ -34,8 +34,22 @@ while true; do
done
unset ANDROID_PRODUCT_OUT # avoid defaulting dex2oat --host-prefix to target output
+
+function follow_links() {
+ file="$1"
+ while [ -h "$file" ]; do
+ # On Mac OS, readlink -f doesn't work.
+ file="$(readlink "$file")"
+ done
+ 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/..
+
mkdir -p /tmp/android-data/dalvik-cache
-cd $ANDROID_BUILD_TOP
ANDROID_DATA=/tmp/android-data \
ANDROID_ROOT=$ANDROID_HOST_OUT \
LD_LIBRARY_PATH=$ANDROID_HOST_OUT/lib \