Convert libart-gtest to Android.bp
Change-Id: Ibea17e3e002e6ad3f82158cd3c69d087fa9b15c9
diff --git a/Android.bp b/Android.bp
index f7e909d..e8b608e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -33,6 +33,7 @@
"profman",
"runtime",
"sigchainlib",
+ "test",
"tools/cpp-define-generator",
"tools/dmtracedump",
]
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 12b50b8..b5bbfef 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -417,39 +417,6 @@
ART_TEST_CFLAGS :=
-include $(CLEAR_VARS)
-LOCAL_MODULE := libart-gtest
-LOCAL_MODULE_TAGS := optional
-LOCAL_CPP_EXTENSION := cc
-LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
-LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/cmdline art/compiler
-LOCAL_SHARED_LIBRARIES := libartd libartd-compiler libdl
-LOCAL_WHOLE_STATIC_LIBRARIES += libgtest
-LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
-LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
-$(eval LOCAL_CLANG := $(ART_TARGET_CLANG))
-$(eval $(call set-target-local-cflags-vars,debug))
-LOCAL_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libart-gtest
-LOCAL_MODULE_TAGS := optional
-LOCAL_CPP_EXTENSION := cc
-LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
-LOCAL_ASFLAGS := $(ART_HOST_ASFLAGS)
-LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
-LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/cmdline art/compiler
-LOCAL_SHARED_LIBRARIES := libartd libartd-compiler
-LOCAL_WHOLE_STATIC_LIBRARIES := libgtest
-LOCAL_LDLIBS += -ldl -lpthread
-LOCAL_MULTILIB := both
-LOCAL_CLANG := $(ART_HOST_CLANG)
-LOCAL_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
-LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
-LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
-include $(BUILD_HOST_SHARED_LIBRARY)
-
# Variables holding collections of gtest pre-requisits used to run a number of gtests.
ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
diff --git a/compiler/Android.bp b/compiler/Android.bp
index 595a824..0581418 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -279,3 +279,12 @@
},
shared_libs: ["libartd"],
}
+
+art_cc_library {
+ name: "libart-compiler-gtest",
+ defaults: ["libart-gtest-defaults"],
+ srcs: ["common_compiler_test.cc"],
+ shared_libs: [
+ "libartd-compiler",
+ ],
+}
diff --git a/runtime/Android.bp b/runtime/Android.bp
index eb7b0c8..e4d50ee 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -462,6 +462,15 @@
],
}
+art_cc_library {
+ name: "libart-runtime-gtest",
+ defaults: ["libart-gtest-defaults"],
+ srcs: ["common_runtime_test.cc"],
+ shared_libs: [
+ "libartd",
+ ],
+}
+
subdirs = [
"openjdkjvm",
"openjdkjvmti",
diff --git a/test/Android.bp b/test/Android.bp
new file mode 100644
index 0000000..e2edc18
--- /dev/null
+++ b/test/Android.bp
@@ -0,0 +1,82 @@
+//
+// Copyright (C) 2016 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.
+//
+
+art_cc_defaults {
+ name: "libart-gtest-defaults",
+ host_supported: true,
+ defaults: [
+ "art_defaults",
+ "art_debug_defaults",
+ ],
+ shared_libs: [
+ "libartd",
+ "libartd-compiler",
+ ],
+ static_libs: [
+ "libgtest",
+ ],
+ target: {
+ android32: {
+ cflags: ["-DART_TARGET_NATIVETEST_DIR=/data/nativetest32/art"],
+ },
+ android64: {
+ cflags: ["-DART_TARGET_NATIVETEST_DIR=/data/nativetest64/art"],
+ },
+ android: {
+ cflags: [
+ // gtest issue
+ "-Wno-used-but-marked-unused",
+ "-Wno-deprecated",
+ "-Wno-missing-noreturn",
+ ],
+ },
+ linux: {
+ cflags: [
+ // gtest issue
+ "-Wno-used-but-marked-unused",
+ "-Wno-deprecated",
+ "-Wno-missing-noreturn",
+ ],
+ },
+ },
+}
+
+art_cc_library {
+ name: "libart-gtest",
+ host_supported: true,
+ whole_static_libs: [
+ "libart-compiler-gtest",
+ "libart-runtime-gtest",
+ "libgtest",
+ ],
+ shared_libs: [
+ "libartd",
+ "libartd-compiler",
+ ],
+ target: {
+ android: {
+ shared_libs: [
+ "libdl",
+ ],
+ },
+ host: {
+ host_ldlibs: [
+ "-ldl",
+ "-lpthread",
+ ],
+ },
+ },
+}