summaryrefslogtreecommitdiffstats
path: root/ci/cargo-out-dir
blob: 2b08d616a99571d7471dc5a1e08b852b49f176fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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