-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjcpan
More file actions
executable file
·59 lines (55 loc) · 1.79 KB
/
jcpan
File metadata and controls
executable file
·59 lines (55 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
#
# jcpan - CPAN Client for PerlOnJava (Unix wrapper)
# Runs the standard cpan script with jperl
#
# Supports --jobs N for parallel test execution:
# jcpan --jobs 4 -t Module::Name
#
# Note: standard cpan uses -j for config file loading, so we use --jobs
# to avoid conflicts. All other flags are passed through to cpan.
#
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Parse --jobs option for parallel test jobs (consumed here, not passed to cpan)
ARGS=()
while [[ $# -gt 0 ]]; do
case "$1" in
--jobs)
if [[ -n "$2" && "$2" =~ ^[0-9]+$ ]]; then
export HARNESS_OPTIONS="j${2}"
shift 2
else
echo "Error: --jobs requires a numeric argument" >&2
exit 1
fi
;;
--jobs=*)
val="${1#--jobs=}"
if [[ "$val" =~ ^[0-9]+$ ]]; then
export HARNESS_OPTIONS="j${val}"
else
echo "Error: --jobs requires a numeric argument" >&2
exit 1
fi
shift
;;
*)
ARGS+=("$1")
shift
;;
esac
done
# Find cpan script - check development path first, then installed path
if [ -f "$SCRIPT_DIR/src/main/perl/bin/cpan" ]; then
CPAN_SCRIPT="$SCRIPT_DIR/src/main/perl/bin/cpan"
elif [ -f "$SCRIPT_DIR/bin/cpan" ]; then
CPAN_SCRIPT="$SCRIPT_DIR/bin/cpan"
else
echo "Error: cpan script not found" >&2
exit 1
fi
# Set default per-test timeout (300s) to kill hanging tests
# Tests that produce no output for this duration will be killed
# Override: JPERL_TEST_TIMEOUT=0 (disable) or JPERL_TEST_TIMEOUT=600 (10 min)
export JPERL_TEST_TIMEOUT="${JPERL_TEST_TIMEOUT:-300}"
exec "$SCRIPT_DIR/jperl" "$CPAN_SCRIPT" "${ARGS[@]}"