[singlejar] Enable native singlejar on Windows

See #2241

Closes #6608.

PiperOrigin-RevId: 220267534
diff --git a/tools/android/BUILD.tools b/tools/android/BUILD.tools
index 41961f4..427b33e 100644
--- a/tools/android/BUILD.tools
+++ b/tools/android/BUILD.tools
@@ -77,35 +77,6 @@
     visibility = ["//visibility:public"],
 )
 
-java_import(
-    name = "singlejar_deploy",
-    jars = select({
-        "//src/conditions:windows": ["@bazel_tools//tools/jdk:singlejar"],
-        "//conditions:default": [],
-    }),
-    visibility = ["//visibility:private"],
-)
-
-java_binary(
-    name = "singlejar_javabin",
-    main_class = "com.google.devtools.build.singlejar.SingleJar",
-    runtime_deps = select({
-        "//src/conditions:windows": [":singlejar_deploy"],
-        "//conditions:default": [],
-    }),
-    visibility = ["//visibility:private"],
-)
-
-gen_java_lang_extras_jar_cmd = """
-    $(location %s) \
-        --exclude_build_data \
-        --dont_change_compression \
-        --sources  $(location @bazel_tools//tools/jdk:platformclasspath) \
-        --include_prefixes "java/lang/invoke/" \
-        --include_prefixes "java/lang/annotation/" \
-        --output $@
-    """
-
 # javac needs this Jar to compile lambdas, method references, and type annotations.
 # These classes are not part of the android.jar.
 genrule(
@@ -113,15 +84,16 @@
     srcs = [
         "@bazel_tools//tools/jdk:platformclasspath"
     ],
-    tools = select({
-        "//src/conditions:windows": [":singlejar_javabin"],
-        "//conditions:default": ["@bazel_tools//tools/jdk:singlejar"],
-    }),
+    tools = ["@bazel_tools//tools/jdk:singlejar"],
     outs = ["java_lang_extras.jar"],
-    cmd = select({
-        "//src/conditions:windows": gen_java_lang_extras_jar_cmd % ":singlejar_javabin",
-        "//conditions:default": gen_java_lang_extras_jar_cmd % "@bazel_tools//tools/jdk:singlejar",
-    }),
+    cmd = """
+    $(location @bazel_tools//tools/jdk:singlejar) \
+        --exclude_build_data \
+        --dont_change_compression \
+        --sources  $(location @bazel_tools//tools/jdk:platformclasspath) \
+        --include_prefixes "java/lang/invoke/" \
+        --include_prefixes "java/lang/annotation/" \
+        --output $@""",
     visibility = ["//visibility:private"],
 )
 
diff --git a/tools/jdk/BUILD b/tools/jdk/BUILD
index b1a2c21..461ea32 100644
--- a/tools/jdk/BUILD
+++ b/tools/jdk/BUILD
@@ -106,23 +106,11 @@
 filegroup(
     name = "singlejar",
     srcs = select({
-        "//src/conditions:remote": [":singlejar_remote"],
+        "//src/conditions:remote": ["//src/tools/singlejar:singlejar"],
         "//conditions:default": glob(["singlejar/*"]),
     }),
 )
 
-# This is a separate filegroup from :singlejar above since Bazel doesn't
-# support nested selects (we need a logical "remote AND windows" condition).
-filegroup(
-    name = "singlejar_remote",
-    srcs = select({
-        # TODO(jsharpe): Switch to //src/tools/singlejar:singlejar once
-        # native singlejar works on Windows.
-        "//src/conditions:windows": glob(["singlejar/*"]),
-        "//conditions:default": ["//src/tools/singlejar:singlejar"],
-    }),
-)
-
 filegroup(
     name = "genclass",
     srcs = ["//tools/jdk:GenClass_deploy.jar"],