Starlark: implement ctx.resolve_tools

Design: https://docs.google.com/document/d/1xPsvTY-vWav9zX--7ieXjUilcl7M46m-88_oNV0QhEU/edit#

Closes #7139.

PiperOrigin-RevId: 230719385
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java
index 20e04fa..e835f29 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/SkylarkRuleContextApi.java
@@ -1017,4 +1017,27 @@
       Location loc,
       Environment env)
       throws EvalException;
+
+  @SkylarkCallable(
+      name = "resolve_tools",
+      doc =
+          "Returns a tuple <code>(inputs, input_manifests)</code> of the depset of resolved inputs"
+              + " and the runfiles metadata required to run the tools, both of them suitable for"
+              + " passing as the same-named arguments of the <code>ctx.actions.run</code> method."
+              + "<br/><br/>In contrast to <code>ctx.resolve_command</code>, this method does not"
+              + " require that Bash be installed on the machine, so it's suitable for rules built"
+              + " on Windows.",
+      parameters = {
+        @Param(
+            name = "tools",
+            defaultValue = "[]",
+            type = SkylarkList.class,
+            generic1 = TransitiveInfoCollectionApi.class,
+            named = true,
+            positional = false,
+            doc = "List of tools (list of targets)."),
+      },
+      useLocation = false,
+      useEnvironment = false)
+  public Tuple<Object> resolveTools(SkylarkList tools) throws EvalException;
 }