From 894fec6bc771f613c8d1392677e9cc7fb683a56f Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 31 Jan 2023 02:31:37 +0000 Subject: [PATCH] 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 Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 550bb87ecb619dedb5d42a82cde46506e141c26f) Signed-off-by: Martin Renvoize --- Makefile.PL | 18 +++++++++++++++--- build-resources.PL | 7 +++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 458e7f271c..2a73c527f3 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -679,6 +679,9 @@ $file_map->{'koha-tmpl/opac-tmpl/bootstrap/css/print.css'} = 'blib/OPAC_TMPL_DIR $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' => [ @@ -692,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'} }, ( @@ -1816,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 = (); diff --git a/build-resources.PL b/build-resources.PL index 456161ece7..0d7b515258 100755 --- a/build-resources.PL +++ b/build-resources.PL @@ -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; -- 2.39.5