summaryrefslogtreecommitdiffstats
path: root/ci/cargo-out-dir
diff options
context:
space:
mode:
Diffstat (limited to 'ci/cargo-out-dir')
-rwxr-xr-xci/cargo-out-dir19
1 files changed, 19 insertions, 0 deletions
diff --git a/ci/cargo-out-dir b/ci/cargo-out-dir
new file mode 100755
index 00000000..2b08d616
--- /dev/null
+++ b/ci/cargo-out-dir
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Finds Cargo's `OUT_DIR` directory from the most recent build.
+#
+# This requires one parameter corresponding to the target directory
+# to search for the build output.
+
+if [ $# != 1 ]; then
+ echo "Usage: $(basename "$0") <target-dir>" >&2
+ exit 2
+fi
+
+# This works by finding the most recent stamp file, which is produced by
+# every ripgrep build.
+target_dir="$1"
+find "$target_dir" -name ripgrep-stamp -print0 \
+ | xargs -0 ls -t \
+ | head -n1 \
+ | xargs dirname