Revert commit 6d31cb01b80d0560c0c083d40e641816877b3d06.

Commit 6d31cb was an internal reorganization of google repository
that should have resulted in no change. Due to a bug in our export
process it deleted several files in third_party.
diff --git a/third_party/java/android_databinding/BUILD b/third_party/java/android_databinding/BUILD
new file mode 100644
index 0000000..9d66f21
--- /dev/null
+++ b/third_party/java/android_databinding/BUILD
@@ -0,0 +1,32 @@
+# Copyright 2016 The Bazel Authors. All rights reserved.
+#
+# 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.
+
+licenses(["notice"])  # Apache License 2.0
+
+exports_files(["LICENSE"])
+
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+)
+
+# Executable for the databinding resource compiler.
+java_import(
+    name = "exec",
+    jars = ["exec.jar"],
+)
diff --git a/third_party/java/aosp_gradle_core/BUILD b/third_party/java/aosp_gradle_core/BUILD
new file mode 100644
index 0000000..7df881c
--- /dev/null
+++ b/third_party/java/aosp_gradle_core/BUILD
@@ -0,0 +1,20 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])  # Apache 2.0
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+)
+
+filegroup(name = "embedded_aosp_gradle_core")
+
+java_library(
+    name = "aosp_gradle_core",
+    srcs = glob(["java/**/*.java"]),
+    deps = [
+        "//third_party:android_common_25_0_0",
+        "//third_party:asm",
+        "//third_party:guava",
+    ],
+)
diff --git a/third_party/java/apkbuilder/BUILD b/third_party/java/apkbuilder/BUILD
new file mode 100644
index 0000000..3274a12
--- /dev/null
+++ b/third_party/java/apkbuilder/BUILD
@@ -0,0 +1,32 @@
+licenses(["notice"])  # Apache 2.0
+
+filegroup(
+    name = "embedded_tools",
+    srcs = [
+        "BUILD.tools",
+        "apkbuilder_deploy.jar",
+    ],
+    visibility = ["//src:__pkg__"],
+)
+
+# This filegroup is necessary so that Bazel finds an apkbuilder during the
+# bootstrap process when this file is used as
+# @bazel_tools//third_party/java/apkbuilder/BUILD. Otherwise, the bootstrap
+# would fail if an Android SDK was declared in the WORKSPACE file of Bazel.
+filegroup(name = "embedded_apkbuilder")
+
+java_binary(
+    name = "apkbuilder",
+    srcs = glob(["java/**/*.java"]),
+    main_class = "com.android.sdklib.build.ApkBuilderMain",
+    deps = [
+        "//src/java_tools/singlejar:libSingleJar",
+        "//third_party:guava",
+    ],
+)
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+    visibility = ["//third_party:__pkg__"],
+)
diff --git a/third_party/java/apkbuilder/BUILD.tools b/third_party/java/apkbuilder/BUILD.tools
new file mode 100644
index 0000000..580ada4
--- /dev/null
+++ b/third_party/java/apkbuilder/BUILD.tools
@@ -0,0 +1,15 @@
+# The build file for apkbuilder when it's in bazel's embedded tools repo.
+
+licenses(["notice"])  # Apache 2.0
+
+java_binary(
+    name = "embedded_apkbuilder",
+    main_class = "com.android.sdklib.build.ApkBuilderMain",
+    runtime_deps = [":apkbuilder_deploy_jar"],
+    visibility = ["//visibility:public"],
+)
+
+java_import(
+    name = "apkbuilder_deploy_jar",
+    jars = [":apkbuilder_deploy.jar"]
+)
diff --git a/third_party/java/buck-ios-support/BUILD b/third_party/java/buck-ios-support/BUILD
new file mode 100644
index 0000000..fd84b25
--- /dev/null
+++ b/third_party/java/buck-ios-support/BUILD
@@ -0,0 +1,21 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])  # Apache 2.0
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+    visibility = ["//third_party:__pkg__"],
+)
+
+java_library(
+    name = "buck-ios-support",
+    srcs = glob(
+        ["java/**/*.java"],
+    ),
+    deps = [
+        "//third_party:guava",
+        "//third_party:jsr305",
+        "//third_party/java/dd_plist",
+    ],
+)
diff --git a/third_party/java/dd_plist/BUILD b/third_party/java/dd_plist/BUILD
new file mode 100644
index 0000000..ec497c3
--- /dev/null
+++ b/third_party/java/dd_plist/BUILD
@@ -0,0 +1,14 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])  # MIT
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+    visibility = ["//third_party:__pkg__"],
+)
+
+java_library(
+    name = "dd_plist",
+    srcs = glob(["java/**/*.java"]),
+)
diff --git a/third_party/java/j2objc/BUILD b/third_party/java/j2objc/BUILD
new file mode 100644
index 0000000..bb1cd5c
--- /dev/null
+++ b/third_party/java/j2objc/BUILD
@@ -0,0 +1,51 @@
+# Copyright 2015 The Bazel Authors. All rights reserved.
+#
+# 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.
+
+licenses(["notice"])  # Apache License 2.0
+
+exports_files(["LICENSE"])
+
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+    visibility = ["//third_party:__pkg__"],
+)
+
+java_library(
+    name = "annotations",
+    exports = ["@bazel_j2objc//:annotations"],
+)
+
+genrule(
+    name = "jre_emul_jar",
+    srcs = ["@bazel_j2objc//:jre_emul.jar"],
+    outs = ["jre_emul.jar"],
+    cmd = "cp $< $@",
+)
+
+objc_library(
+    name = "jre_emul_lib",
+    sdk_dylibs = [
+        "libicucore",
+        "libz",
+    ],
+    sdk_frameworks = [
+        "Security",
+    ],
+    deps = ["@bazel_j2objc//:jre_emul_archive"],
+)
diff --git a/third_party/java/j2objc/BUILD.remote b/third_party/java/j2objc/BUILD.remote
new file mode 100644
index 0000000..44daaf8
--- /dev/null
+++ b/third_party/java/j2objc/BUILD.remote
@@ -0,0 +1,54 @@
+# Copyright 2015 The Bazel Authors. All rights reserved.
+#
+# 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.
+
+licenses(["notice"])  # Apache License 2.0
+
+exports_files(["LICENSE"])
+
+J2_DIR = "j2objc-1.0.1/"
+
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+genrule(
+    name = "jre_emul_jar",
+    srcs = [J2_DIR + "lib/jre_emul.jar"],
+    outs = ["jre_emul.jar"],
+    cmd = "cp $< $@",
+)
+
+java_import(
+    name = "annotations",
+    jars = [J2_DIR + "lib/j2objc_annotations.jar"],
+)
+
+java_import(
+    name = "j2objc",
+    jars = [J2_DIR + "lib/j2objc.jar"],
+    exports = [":annotations"],
+)
+
+filegroup(
+    name = "jre_emul_headers",
+    #srcs = glob([J2_DIR + "include/IOSClass.h"]),
+    srcs = [J2_DIR + "include/IOSClass.h"],
+)
+
+objc_import(
+    name = "jre_emul_archive",
+    hdrs = glob([J2_DIR + "include/**"]),
+    includes = [J2_DIR + "include"],
+    archives = [J2_DIR + "lib/libjre_emul.a"],
+)
diff --git a/third_party/java/jarjar/BUILD b/third_party/java/jarjar/BUILD
new file mode 100644
index 0000000..8f31f16
--- /dev/null
+++ b/third_party/java/jarjar/BUILD
@@ -0,0 +1,19 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])  # Apache 2.0
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+)
+
+java_import(
+    name = "jarjar",
+    jars = ["jarjar-1.4.jar"],
+)
+
+java_binary(
+    name = "jarjar_bin",
+    main_class = "com.tonicsystems.jarjar.Main",
+    runtime_deps = [":jarjar"],
+)
diff --git a/third_party/java/jdk/README.md b/third_party/java/jdk/README.md
new file mode 100644
index 0000000..96881e6
--- /dev/null
+++ b/third_party/java/jdk/README.md
@@ -0,0 +1,23 @@
+# Java compilers in Bazel
+
+Bazel compiles Java code using a custom builder. This builder is called
+JavaBuilder and its code lies in //src/java_tools/buildjar. To build Java
+code, JavaBuilder use the Java compiler from the JDK. To support
+[ErrorProne](http://errorprone.info) checks, we vendor a custom build
+of the Java compiler code. This is the raw version of the Java compiler
+from [OpenJDK](https://openjdk.java.net) but compiled for a lower
+version of the JRE. Those builds are vendored in
+//third_party/java/jdk/langtools.
+
+Currently Bazel supports running on a JRE 8 only because the default Java
+compiler used (//third_party/java/jdk/langtools/javac-9-dev-r3297-1.jar) is the
+Java compiler of OpenJDK 9 compiled to run on a JRE 8. This cannot
+be built to run on a JRE 7 because of code incompatibility. Bazel's
+JavaBuilder at HEAD cannot be linked with earlier version of the
+Java compiler (it depends on some internals of the Java compiler).
+
+To build a version of Bazel that can run on a JRE 7, we need to rely
+on the version of JavaBuilder provided with Bazel 0.1.0
+(//third_party/java/jdk/javabuilder/JavaBuilder_0.1.0_deploy.jar) which works
+with a Java compiler of OpenJDK 8 compiled to run on a JRE 7
+(//third_party/java/jdk/langtools/javac7.jar).
diff --git a/third_party/java/jdk/javabuilder/BUILD b/third_party/java/jdk/javabuilder/BUILD
new file mode 100644
index 0000000..f670c45
--- /dev/null
+++ b/third_party/java/jdk/javabuilder/BUILD
@@ -0,0 +1,13 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])  # Apache 2.0 license
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+)
+
+filegroup(
+    name = "JavaBuilder_0.1.0",
+    srcs = ["JavaBuilder_0.1.0_deploy.jar"],
+)
diff --git a/third_party/java/jdk/langtools/BUILD b/third_party/java/jdk/langtools/BUILD
new file mode 100644
index 0000000..b529d2a
--- /dev/null
+++ b/third_party/java/jdk/langtools/BUILD
@@ -0,0 +1,49 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["restricted"])  # GNU GPL v2 with Classpath exception
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+)
+
+filegroup(
+    name = "test-srcs",
+    srcs = select({
+        "//tools/jdk:jdk7": [
+            "BUILD",
+            "LICENSE",
+            "javac7.jar",
+            "javac7.srcjar",
+        ],
+        "//conditions:default": [
+            "BUILD",
+            "LICENSE",
+            "javac-9-dev-r3297-1.jar",
+            "javac-9-dev-r3297-1.srcjar",
+        ],
+    }),
+)
+
+java_import(
+    name = "javac",
+    jars = ["javac-9-dev-r3297-1.jar"],
+)
+
+filegroup(
+    name = "javac_jar",
+    srcs = select({
+        "//tools/jdk:jdk7": ["javac7.jar"],
+        "//conditions:default": ["javac-9-dev-r3297-1.jar"],
+    }),
+)
+
+java_import(
+    name = "javac7",
+    jars = ["javac7.jar"],
+)
+
+filegroup(
+    name = "javac7_jar",
+    srcs = ["javac7.jar"],
+)