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
|
# A debhelper build system class for handling grunt based projects.
#
# Copyright: © 2017 Michael Biebl
# License: GPL-2+
package Debian::Debhelper::Buildsystem::grunt;
use strict;
use warnings;
use parent qw(Debian::Debhelper::Buildsystem);
use constant BUILD_CMD => 'grunt';
sub DESCRIPTION {
"grunt (Gruntfile.js / Gruntfile.coffee)"
}
sub new {
my $class=shift;
my $this=$class->SUPER::new(@_);
# If this build system *requires* running the tool in the same directory
# as the source, then use:
# $this->enforce_in_source_building();
# On the other hand, if it must be run in a seperate build dir (a la meson),
# then use:
# $this->prefer_out_of_source_building(@_);
# If neither applies, this sub can simply be removed
return $this;
}
sub check_auto_buildable {
my $this=shift;
my ($step) = @_;
if (-e $this->get_buildpath('Gruntfile.js') ||
-e $this->get_buildpath('Gruntfile.coffee')) {
return 1;
}
return 0;
}
sub build {
my $this=shift;
# Passing default options can be done via something like:
# if ($this->get_parallel() > 0) {
# unshift @_, "-j" . $this->get_parallel();
# }
$this->doit_in_builddir(BUILD_CMD, 'build', @_);
}
sub configure {
# Do nothing
}
sub test {
# Do nothing
}
sub install {
# Do nothing
}
sub clean {
my $this=shift;
# If we are using a separate build dir, then just remove the build directory
if (!$this->rmdir_builddir()) {
# Otherwise, run the tool with "clean"
$this->doit_in_builddir(BUILD_CMD, 'clean', @_);
}
}
1
|