Bug 32609: (follow-up) enhance Makefile.PL

This patch adds a new target to the Makefile which gets
called as the first step of the "all" target. This means
that CSS and JS files get compiled every time "make" is
called.

(Note: Since the "install" target depends on "all", it will
 be re-run at install time.)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
David Cook 2023-01-31 02:31:37 +00:00 committed by Tomas Cohen Arazi
parent 6cf1a2654c
commit 550bb87ecb
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 37 additions and 5 deletions

View File

@ -663,6 +663,26 @@ display_configuration(\%config, $target_directories);
my $file_map = {};
get_file_map($target_map, $dirtree, $file_map);
#NOTE: List files generated by build-resources.PL, so that they're copied into blib for installation
#INTRANET_TMPL_DIR
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/calendar.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/calendar.css';
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/holds.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/holds.css';
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/installer.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/installer.css';
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/mainpage.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/mainpage.css';
$file_map->{'koha-tmpl/intranet-tmpl/prog/css/staff-global.css'} = 'blib/INTRANET_TMPL_DIR/prog/css/staff-global.css';
$file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/main.js'} = 'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/main.js';
$file_map->{'koha-tmpl/intranet-tmpl/prog/js/vue/dist/main.js.LICENSE.txt'} = 'blib/INTRANET_TMPL_DIR/prog/js/vue/dist/main.js.LICENSE.txt';
#OPAC_TMPL_DIR
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/opac.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/opac.css';
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/opac-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/opac-rtl.css';
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/print.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/print.css';
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/print-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/print-rtl.css';
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/sco.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/sco.css';
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/sco-rtl.css'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/sco-rtl.css';
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/maps/opac-rtl.css.map'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/maps/opac-rtl.css.map';
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/maps/print-rtl.css.map'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/maps/print-rtl.css.map';
$file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/maps/sco-rtl.css.map'} = 'blib/OPAC_TMPL_DIR/bootstrap/css/maps/sco-rtl.css.map';
my $pl_files = {
'rewrite-config.PL' => [
'blib/KOHA_CONF_DIR/koha-conf.xml',
@ -675,9 +695,6 @@ my $pl_files = {
'fix-perl-path.PL' => [ # this script ensures the correct shebang line for the platform installed on...
'blib'
],
'build-resources.PL' => [
'blib'
],
};
push @{ $pl_files->{'rewrite-config.PL'} }, (
@ -1799,6 +1816,18 @@ sub postamble {
return "$env\n";
}
sub top_targets {
my $inherited = shift->SUPER::top_targets(@_);
my $compile_step;
$compile_step .= "all :: compile_css_js\n";
$compile_step .= "\t" . '$(NOECHO) $(NOOP)' . "\n";
$compile_step .= "\n";
$compile_step .= "compile_css_js:\n";
$compile_step .= "\t" . '$(PERLRUN) build-resources.PL' . "\n";
my $top_targets = $compile_step . "\n" . $inherited;
return $top_targets;
}
sub _build_perl5lib_string {
my ($args) = @_;
my %unique_map = ();

View File

@ -32,7 +32,10 @@ This helper script ensures that src JS and SCSS files are compiled for packaging
=cut
my $command = "yarn build:prod";
system($command);
my $install_command = "yarn install";
system($install_command);
my $build_command = "yarn build:prod";
system($build_command);
1;