Deprecate most of the targets in the JDK repository

See #5594

PiperOrigin-RevId: 207943203
diff --git a/src/main/tools/jdk.BUILD b/src/main/tools/jdk.BUILD
index 8500c86..ce757ac 100644
--- a/src/main/tools/jdk.BUILD
+++ b/src/main/tools/jdk.BUILD
@@ -1,64 +1,77 @@
 package(default_visibility = ["//visibility:public"])
 
+DEPRECATION_MESSAGE = ("Don't depend on targets in the JDK workspace;" +
+                       " use @bazel_tools//tools/jdk:current_java_runtime instead" +
+                       " (see https://github.com/bazelbuild/bazel/issues/5594)")
+
 filegroup(
     name = "jni_header",
     srcs = ["include/jni.h"],
+    deprecation = DEPRECATION_MESSAGE,
 )
 
 filegroup(
     name = "jni_md_header-darwin",
     srcs = ["include/darwin/jni_md.h"],
+    deprecation = DEPRECATION_MESSAGE,
 )
 
 filegroup(
     name = "jni_md_header-linux",
     srcs = ["include/linux/jni_md.h"],
+    deprecation = DEPRECATION_MESSAGE,
 )
 
 filegroup(
     name = "jni_md_header-freebsd",
     srcs = ["include/freebsd/jni_md.h"],
+    deprecation = DEPRECATION_MESSAGE,
 )
 
 filegroup(
     name = "jni_md_header-windows",
     srcs = ["include/win32/jni_md.h"],
+    deprecation = DEPRECATION_MESSAGE,
 )
 
 filegroup(
     name = "java",
+    deprecation = DEPRECATION_MESSAGE,
     srcs = select({
-       ":windows" : ["bin/java.exe"],
-       "//conditions:default" : ["bin/java"],
+        ":windows": ["bin/java.exe"],
+        "//conditions:default": ["bin/java"],
     }),
     data = [":jdk"],
 )
 
 filegroup(
     name = "jar",
+    deprecation = DEPRECATION_MESSAGE,
     srcs = select({
-       ":windows" : ["bin/jar.exe"],
-       "//conditions:default" : ["bin/jar"],
+        ":windows": ["bin/jar.exe"],
+        "//conditions:default": ["bin/jar"],
     }),
     data = [":jdk"],
 )
 
 filegroup(
+    deprecation = DEPRECATION_MESSAGE,
     name = "javac",
     srcs = select({
-        ":windows" : ["bin/javac.exe"],
-        "//conditions:default" : ["bin/javac"],
+        ":windows": ["bin/javac.exe"],
+        "//conditions:default": ["bin/javac"],
     }),
     data = [":jdk"],
 )
 
-
 filegroup(
+    deprecation = DEPRECATION_MESSAGE,
     name = "xjc",
     srcs = ["bin/xjc"],
 )
 
 filegroup(
+    deprecation = DEPRECATION_MESSAGE,
     name = "wsimport",
     srcs = ["bin/wsimport"],
 )
@@ -73,6 +86,7 @@
 
 # TODO(cushon): this isn't compatible with JDK 9
 filegroup(
+    deprecation = DEPRECATION_MESSAGE,
     name = "bootclasspath",
     srcs = ["jre/lib/%s" % jar for jar in BOOTCLASS_JARS],
 )
@@ -80,11 +94,13 @@
 # TODO(cushon): migrate to extclasspath and delete
 filegroup(
     name = "extdir",
+    deprecation = DEPRECATION_MESSAGE,
     srcs = glob(["jre/lib/ext/*.jar"]),
 )
 
 filegroup(
     name = "extclasspath",
+    deprecation = DEPRECATION_MESSAGE,
     srcs = glob(["jre/lib/ext/*.jar"]),
 )
 
@@ -94,9 +110,10 @@
         # In some configurations, Java browser plugin is considered harmful and
         # common antivirus software blocks access to npjp2.dll interfering with Bazel,
         # so do not include it in JRE on Windows.
-        ":windows" : glob(["jre/bin/**"], exclude = ["jre/bin/plugin2/**"]),
-        "//conditions:default" : glob(["jre/bin/**"])
+        ":windows": glob(["jre/bin/**"], exclude = ["jre/bin/plugin2/**"]),
+        "//conditions:default": glob(["jre/bin/**"]),
     }),
+    deprecation = DEPRECATION_MESSAGE,
 )
 
 filegroup(
@@ -115,6 +132,7 @@
         ":jre-bin",
         ":jre-lib",
     ],
+    deprecation = DEPRECATION_MESSAGE,
 )
 
 filegroup(
@@ -123,7 +141,8 @@
         ["bin/**"],
         # The JDK on Windows sometimes contains a directory called
         # "%systemroot%", which is not a valid label.
-        exclude = ["**/*%*/**"]),
+        exclude = ["**/*%*/**"],
+    ),
 )
 
 filegroup(
@@ -138,7 +157,8 @@
         exclude = [
             "lib/missioncontrol/**",
             "lib/visualvm/**",
-        ]),
+        ],
+    ),
 )
 
 java_runtime(
@@ -154,12 +174,14 @@
 filegroup(
     name = "langtools",
     srcs = ["lib/tools.jar"],
+    deprecation = DEPRECATION_MESSAGE,
 )
 
 java_import(
     name = "langtools-neverlink",
     jars = ["lib/tools.jar"],
     neverlink = 1,
+    deprecation = DEPRECATION_MESSAGE,
 )
 
 config_setting(
@@ -167,4 +189,3 @@
     values = {"cpu": "x64_windows"},
     visibility = ["//visibility:private"],
 )
-