fix: make :outdated work when runfiles trees are disabled (#1602)

`bazel run @maven//:outdated` failed with "Unable to access jarfile"
under --noenable_runfiles (the default on Windows) because the
generated sh_binary passed cwd-relative rootpaths, which only resolve
inside a materialised runfiles tree. Resolve the arguments with the
Bash runfiles library instead, as :pin already does.

Co-authored-by: Claude <noreply@anthropic.com>
diff --git a/private/outdated.sh b/private/outdated.sh
index 1f56f87..f074182 100644
--- a/private/outdated.sh
+++ b/private/outdated.sh
@@ -1,12 +1,23 @@
 #!/usr/bin/env bash
 
-set -e -o pipefail
+# --- begin runfiles.bash initialization v3 ---
+# Copy-pasted from the Bazel Bash runfiles library v3.
+set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
+source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
+  source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
+  source "$0.runfiles/$f" 2>/dev/null || \
+  source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+  source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+  { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+# --- end runfiles.bash initialization v3 ---
 
-outdated_jar_path=$1
-artifacts_file_path=$2
-boms_file_path=$3
-repositories_file_path=$4
-extra_option_flag=$5
+set -euo pipefail
+
+outdated_jar_path=$(rlocation "$1")
+artifacts_file_path=$(rlocation "$2")
+boms_file_path=$(rlocation "$3")
+repositories_file_path=$(rlocation "$4")
+extra_option_flag=${5:-}
 
 java {proxy_opts} -jar "$outdated_jar_path" \
   --artifacts-file "$artifacts_file_path" \
diff --git a/private/rules/coursier.bzl b/private/rules/coursier.bzl
index 5451e8e..8ba3bee 100644
--- a/private/rules/coursier.bzl
+++ b/private/rules/coursier.bzl
@@ -103,10 +103,13 @@
         "outdated.repositories",
     ],
     args = [
-        "$(location @rules_jvm_external//private/tools/prebuilt:outdated_deploy.jar)",
-        "$(location outdated.artifacts)",
-        "$(location outdated.boms)",
-        "$(location outdated.repositories)",
+        "$(rlocationpath @rules_jvm_external//private/tools/prebuilt:outdated_deploy.jar)",
+        "$(rlocationpath outdated.artifacts)",
+        "$(rlocationpath outdated.boms)",
+        "$(rlocationpath outdated.repositories)",
+    ],
+    deps = [
+        "@bazel_tools//tools/bash/runfiles",
     ],
     visibility = ["//visibility:public"],
 )
diff --git a/tests/bazel_run_tests.sh b/tests/bazel_run_tests.sh
index 9d6fad6..26a624d 100755
--- a/tests/bazel_run_tests.sh
+++ b/tests/bazel_run_tests.sh
@@ -255,6 +255,13 @@
   expect_log "junit:junit \[4.12"
 }
 
+function test_outdated_noenable_runfiles() {
+  bazel run @regression_testing_coursier//:outdated --noenable_runfiles >> "$TEST_LOG" 2>&1
+
+  expect_log "Checking for updates of .* artifacts against the following repositories"
+  expect_log "junit:junit \[4.12"
+}
+
 function test_outdated_with_boms() {
   bazel run @regression_testing_maven//:outdated >> "$TEST_LOG" 2>&1
 
@@ -419,6 +426,7 @@
   "test_duplicate_version_warning_same_version"
   "test_outdated"
   "test_outdated_no_external_runfiles"
+  "test_outdated_noenable_runfiles"
   "test_outdated_with_boms"
   "test_outdated_with_boms_does_not_include_artifacts_without_a_version"
   "test_m2local_testing_found_local_artifact_through_pin_and_build"