Cleanup some usages of include_dirs
The include_dirs property causes problems when unbundling as they can
directly reference directories inside the runtime module repositories
which will break the unbundled build as those repositories will not be
present. While these usages do not cause problems as they are
references within the runtime module repository they need removing so
that the build can enforce no usage of runtime module repository paths
in the include_dirs property.
This change:
* Replaces include_dirs with local_include_dirs where possible.
* Uses libnativehelper provided header libs, this is possible as they
have been updated to build against the NDK.
* Adds headers for disassembler, libdexfile
* Makes libart_runtime_headers build against NDK.
Test: m checkbuild
Bug: 134379140
Change-Id: Iaf065caf4b6a2fcf252f6d5da8fff5be97a242ea
diff --git a/compiler/Android.bp b/compiler/Android.bp
index 59875a5..dfd71f1 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -175,9 +175,9 @@
shared_libs: [
"libbase",
],
- include_dirs: ["art/disassembler"],
header_libs: [
"art_cmdlineparser_headers", // For compiler_options.
+ "art_disassembler_headers",
"libnativehelper_header_only",
],
diff --git a/disassembler/Android.bp b/disassembler/Android.bp
index d7fd39b..e77d914 100644
--- a/disassembler/Android.bp
+++ b/disassembler/Android.bp
@@ -53,13 +53,12 @@
//
// FAILED: ninja: out/soong/build.ninja:320768: multiple rules generate out/soong/.intermediates/art/disassembler/libart-disassembler/linux_glibc_x86_64_static/obj/art/disassembler/disassembler_mips.o [-w dupbuild=err]
},
- include_dirs: ["art/runtime"],
-
shared_libs: [
"libbase",
],
header_libs: [
"art_libartbase_headers",
+ "libart_runtime_headers_ndk",
],
export_include_dirs: ["."],
}
@@ -84,3 +83,11 @@
"libvixld",
],
}
+
+cc_library_headers {
+ name: "art_disassembler_headers",
+ host_supported: true,
+ export_include_dirs: [
+ ".",
+ ],
+}
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index c417d5f..4e4c9ac 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -256,6 +256,14 @@
},
}
+// Make dex_instruction_list.h available for tools/jvmti-agents/titrace
+cc_library_headers {
+ name: "libdexfile_all_headers",
+ visibility: ["//art:__subpackages__"],
+ host_supported: true,
+ export_include_dirs: ["."],
+}
+
cc_defaults {
name: "libdexfile_external-defaults",
host_supported: true,
diff --git a/runtime/Android.bp b/runtime/Android.bp
index db4ef02..895e2c6 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -679,9 +679,10 @@
}
cc_library_headers {
- name: "libart_runtime_headers",
+ name: "libart_runtime_headers_ndk",
host_supported: true,
export_include_dirs: ["."],
+ sdk_version: "current",
}
genrule {
diff --git a/test/Android.bp b/test/Android.bp
index 9d22847..91d9393 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -305,7 +305,7 @@
header_libs: [
"libopenjdkjvmti_headers",
],
- include_dirs: ["art/test/ti-agent"],
+ local_include_dirs: ["ti-agent"],
}
art_cc_defaults {
@@ -384,14 +384,13 @@
],
sdk_version: "current",
stl: "c++_static",
- include_dirs: [
+ header_libs: [
+ "jni_headers",
// This is needed to resolve the base/ header file in libdexfile. Unfortunately there are
// many problems with how we export headers that are making doing this the 'right' way
// difficult.
// TODO: move those headers to art/ rather than under runtime.
- "art/runtime",
- // NDK headers aren't available in platform NDK builds.
- "libnativehelper/include_jni",
+ "libart_runtime_headers_ndk",
],
export_include_dirs: ["ti-agent"],
}
diff --git a/tools/jvmti-agents/field-counts/Android.bp b/tools/jvmti-agents/field-counts/Android.bp
index 0dd7509..5541e86 100644
--- a/tools/jvmti-agents/field-counts/Android.bp
+++ b/tools/jvmti-agents/field-counts/Android.bp
@@ -25,14 +25,8 @@
compile_multilib: "both",
header_libs: [
"libopenjdkjvmti_headers",
- // Annoyingly you aren't allowed to include even header-only non-ndk libs into an ndk build.
- // Instead we put the directories this would bring in below in 'include_dirs'
- // "libnativehelper_header_only",
- ],
- include_dirs: [
- // NDK headers aren't available in platform NDK builds.
- "libnativehelper/include_jni",
- "libnativehelper/header_only_include",
+ "libnativehelper_header_only",
+ "jni_headers",
],
multilib: {
lib32: {
diff --git a/tools/jvmti-agents/simple-force-redefine/Android.bp b/tools/jvmti-agents/simple-force-redefine/Android.bp
index 2a739be..7006cd6 100644
--- a/tools/jvmti-agents/simple-force-redefine/Android.bp
+++ b/tools/jvmti-agents/simple-force-redefine/Android.bp
@@ -31,14 +31,8 @@
],
header_libs: [
"libopenjdkjvmti_headers",
- // Annoyingly you aren't allowed to include even header-only non-ndk libs into an ndk build.
- // Instead we put the directories this would bring in below in 'include_dirs'
- // "libnativehelper_header_only",
- ],
- include_dirs: [
- // NDK headers aren't available in platform NDK builds.
- "libnativehelper/include_jni",
- "libnativehelper/header_only_include",
+ "libnativehelper_header_only",
+ "jni_headers",
],
sdk_version: "current",
stl: "libc++_static",
diff --git a/tools/jvmti-agents/titrace/Android.bp b/tools/jvmti-agents/titrace/Android.bp
index 21f266c..cceef89 100644
--- a/tools/jvmti-agents/titrace/Android.bp
+++ b/tools/jvmti-agents/titrace/Android.bp
@@ -40,8 +40,8 @@
},
header_libs: [
"libopenjdkjvmti_headers",
+ "libdexfile_all_headers", // for dex_instruction_list.h only
],
- include_dirs: ["art/libdexfile"], // for dex_instruction_list.h only
multilib: {
lib32: {
suffix: "32",