blob: 15d94ecb71acb00b6cc9e803d6fb7e8230116b11 (
plain) (
blame)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
package jitterbug::Builder;
use strict;
use warnings;
use YAML qw/LoadFile Dump/;
use JSON;
use File::Path qw/rmtree/;
use Path::Class;
use Getopt::Long qw/:config no_ignore_case/;
use File::Basename;
use Git::Repository;
use jitterbug::Schema;
use Cwd;
#use Data::Dumper;
local $| = 1;
use constant DEBUG => 1;
sub new {
my $self = bless {} => shift;
$self->{'conf'} = LoadFile(shift);
return $self;
}
sub build {
my ($self, $conf) = @_;
my ($builddir, $report_path, $perlbrew);
print "Creating report_path=$report_path\n";
system("mkdir -p $report_path");
die "Couldn't create $builddir !" unless -e $builddir;
my $cwd = getcwd;
chdir $builddir;
if ($perlbrew) {
my $source_perlbrew = "source $ENV{HOME}/perl5/perlbrew/etc/bashrc";
for my $perl ( glob "$ENV{HOME}/perl5/perlbrew/perls/perl-5.*" ) {
my $logfile = "$report_path/$perl.txt";
system("$source_perlbrew && perlbrew switch $perl");
$self->actually_build($logfile);
}
} else {
my $perl = $^V;
my $logfile = "$report_path/$perl.txt";
$self->actually_build($logfile);
}
chdir $cwd;
}
sub actually_build () {
my ($self, $logfile) = @_;
if ( -e 'dist.ini' ) {
print "Found dist.ini, using Dist::Zilla\n";
my $cmd = <<CMD;
dzil authordeps | cpanm
cpanm --installdeps .
HARNESS_VERBOSE=1 dzil test >> $logfile 2>&1
CMD
system $cmd;
} elsif ( -e 'Build.PL' ) {
print "Found Build.PL, using Build.PL\n";
my $cmd = <<CMD;
perl Build.PL
# ./Build installdeps is not available in older Module::Build's
cpanm --installdeps .
HARNESS_VERBOSE=1 ./Build test --verbose >> $logfile 2>&1
CMD
system $cmd;
} elsif ( -e 'Makefile.PL') {
print "Hoping to find Makefile.PL\n";
my $cmd = <<CMD;
perl Makefile.PL
cpanm --installdeps .
make
HARNESS_VERBOSE=1 make test >> $logfile 2>&1
CMD
system($cmd);
} else {
die "Don't know how to build or test this!";
}
}
|