File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,41 @@ set -e -u -o pipefail
55: " ${BUILD_DIR:= build_dir} "
66
77main () (
8- if [[ -e dist.ini ]] ; then dzil-build
9- elif [[ -e minil.toml ]] ; then minil-build
8+ if can-run-dzil-build ; then dzil-build
9+ elif can-run- minil-build ; then minil-build
1010 elif [[ -e Build.PL ]]; then build-pl
1111 elif [[ -e Makefile.PL ]]; then std-perl-build
1212 fi
1313)
1414
15+ SUCCESS=0
16+ FAILURE=1
17+
18+ can-run-authoring-tool () {
19+ local file=" $1 "
20+ local tool=" $2 "
21+
22+ # file doesn't exist ? => don't
23+ # is authoring tool available ? => run
24+ # does build file exist ? => don't
25+ # othwerwise run and fail
26+
27+ [[ -e " $file " ]] || return $FAILURE
28+ which " $tool " && return $SUCCESS
29+ [[ -e Build.PL ]] && return $FAILURE
30+ [[ -e Makefile.PL ]] && return $FAILURE
31+
32+ return $SUCCESS
33+ }
34+
35+ can-run-dzil-build () {
36+ can-run-authoring-tool dist.ini dzil
37+ }
38+
39+ can-run-minil-build () {
40+ can-run-authoring-tool minil.toml minil
41+ }
42+
1543dzil-build () (
1644 dzil build --no-tgz --in " $BUILD_DIR "
1745)
You can’t perform that action at this time.
0 commit comments