Skip to content

Commit 2659969

Browse files
committed
Do the right thing when neither --backends nor --gen-moar specified
Suggest using moar backend if moar excutable is found in the path. Complain and die otherwise.
1 parent 12c2370 commit 2659969

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tools/lib/NQP/Config/NQP.pm

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use v5.10.1;
33
use strict;
44
use warnings;
55
use Cwd;
6-
use IPC::Cmd qw<run>;
6+
use IPC::Cmd qw<run can_run>;
77
use NQP::Config qw<cmp_rev slurp system_or_die run_or_die>;
88

99
use base qw<NQP::Config>;
@@ -23,8 +23,19 @@ sub configure_backends {
2323
$self->use_backend($be);
2424
}
2525
}
26-
if ( defined $options->{'gen-moar'} || !$self->active_backends ) {
27-
$self->use_backend('moar');
26+
else {
27+
my $have_gen_moar = defined $options->{'gen-moar'};
28+
if ( $have_gen_moar || can_run('moar') ) {
29+
say "===WARNING!===\n",
30+
" No backends specified on the command line.\n",
31+
" Using 'moar' because we found it in the PATH."
32+
unless $have_gen_moar;
33+
$self->use_backend('moar');
34+
}
35+
else {
36+
$self->sorry( "No backends specified on the command line.\n"
37+
. "Please use --backends or --gen-moar" );
38+
}
2839
}
2940
if ( $self->active_backend('js') and !$self->active_backend('moar') ) {
3041
$self->sorry(
@@ -99,8 +110,9 @@ sub configure_js_backend {
99110

100111
$self->backend_config(
101112
'js',
102-
js_build_dir => $self->nfp( "$config->{base_dir}/gen/js", no_quote => 1 ),
103-
js_blib => "node_modules",
113+
js_build_dir =>
114+
$self->nfp( "$config->{base_dir}/gen/js", no_quote => 1 ),
115+
js_blib => "node_modules",
104116
);
105117
}
106118

0 commit comments

Comments
 (0)