Add Android.bp build files and ancillary files.

Adds an Android.bp file capable of building libjdwp.so, libnpt.so, and
libdt_socket.so. Add some ancillary files needed for the build
process.

Test: mma -j40
Test: ./art/tools/run-jdwp-tests.sh                                                                            \
         --mode=host                                                                                           \
         --debug                                                                                               \
         --variant=x64                                                                                         \
         -Xplugin:$ANDROID_HOST_OUT/lib64/libopenjdkjvmtid.so                                                  \
         --jdwp-path $ANDROID_HOST_OUT/lib64/libjdwp.so                                                        \
         --agent-wrapper $ANDROID_HOST_OUT/lib64/libwrapagentproperties.so=$PWD/art/tools/libjdwp-compat.props \
         --expectations $PWD/art/tools/libjdwp_art_failures.txt

Test: adb root && adb remount && adb sync &&                                            \
      adb push $PWD/art/tools/libjdwp-compat.props                                      \
               /data/local/tmp/libjdwp-compat.props &&                                  \
      ./art/tools/run-jdwp-tests.sh                                                     \
         --mode=device                                                                  \
         --debug                                                                        \
         --variant=x64                                                                  \
         -Xplugin:libopenjdkjvmtid.so                                                   \
         --jdwp-path libjdwp.so                                                         \
         --agent-wrapper libwrapagentproperties.so=/data/local/tmp/libjdwp-compat.props \
         --expectations $PWD/art/tools/libjdwp_art_failures.txt

Bug: 62821960
Bug: 68397812

Change-Id: I980ba706f99789d9a5755f539231268d21bb356b
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..34c2d27
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,123 @@
+java_binary_host {
+    name: "jdwpgen",
+    srcs: ["make/src/classes/build/tools/jdwpgen/*.java"],
+    wrapper: "etc/jdwpgen.sh",
+    manifest: "etc/manifest.txt",
+    java_version: "1.8",
+    // This shouldn't be needed: b/68397812
+    compile_multilib: "first",
+}
+
+genrule {
+    name: "jdwp_generated_headers",
+    tools: ["jdwpgen"],
+    cmd: "jdwpgen $(in) -include $(out)",
+    srcs: ["make/data/jdwp/jdwp.spec"],
+    out: ["JDWPCommands.h"],
+}
+
+cc_defaults {
+    name: "upstream-jdwp-defaults",
+    host_supported: true,
+    device_supported: true,
+    cflags: [
+        // Every supported android platform is little-endian.
+        "-D_LITTLE_ENDIAN",
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+    notice: "LICENSE",
+}
+
+cc_library_headers {
+    name: "javavm_headers",
+    export_include_dirs: [
+        "src/share/javavm/export",
+        "src/solaris/javavm/export",
+    ],
+    host_supported: true,
+    device_supported: true,
+}
+
+cc_library_headers {
+    name: "libnpt_headers",
+    export_include_dirs: [
+        "src/share/npt",
+        "src/solaris/npt",
+    ],
+    defaults: ["upstream-jdwp-defaults"],
+}
+
+cc_library {
+    name: "libnpt",
+    srcs: [
+        "src/share/npt/*.c",
+        "src/solaris/npt/*.c",
+    ],
+    header_libs: [
+        "javavm_headers",
+        "libnpt_headers",
+    ],
+    defaults: ["upstream-jdwp-defaults"],
+}
+
+cc_library_headers {
+    name: "libjdwp_headers",
+    export_include_dirs: [
+        "src/share/back",
+        "src/share/back/export",
+        "src/solaris/back",
+    ],
+    generated_headers: ["jdwp_generated_headers"],
+    export_generated_headers: ["jdwp_generated_headers"],
+    defaults: ["upstream-jdwp-defaults"],
+}
+
+cc_library {
+    name: "libjdwp",
+    srcs: [
+        "src/share/back/*.c",
+        "src/solaris/back/*.c",
+    ],
+    cflags: [
+        "-DLINUX",
+        "-DJDWP_LOGGING",
+        "-Wno-switch",
+        "-Wno-logical-op-parentheses",
+        "-Wno-logical-not-parentheses",
+        "-Wno-sometimes-uninitialized",
+        "-Wno-self-assign",
+        "-Wno-unused-variable",
+        "-Wno-unused-function",
+    ],
+    header_libs: [
+        "javavm_headers",
+        "libjdwp_headers",
+        "libnpt_headers",
+    ],
+    required: [
+        "libnpt",
+        "libdt_socket",
+    ],
+    defaults: ["upstream-jdwp-defaults"],
+}
+
+cc_library {
+    name: "libdt_socket",
+    srcs: [
+        "src/share/transport/socket/*.c",
+        "src/solaris/transport/socket/*.c",
+    ],
+    local_include_dirs: [
+        "src/share/transport/socket",
+        "src/solaris/transport/socket",
+    ],
+    header_libs: [
+        "javavm_headers",
+        "libjdwp_headers",
+        "libnpt_headers",
+    ],
+    required: ["libnpt"],
+    defaults: ["upstream-jdwp-defaults"],
+}