Skip to content

Commit

Permalink
Item12492: expose test output while running tests Item11851: minor bu…
Browse files Browse the repository at this point in the history
…gfixes

git-svn-id: http://svn.foswiki.org/trunk@16710 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed May 8, 2013
1 parent da8a05d commit 7d42011
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 27 deletions.
8 changes: 6 additions & 2 deletions BuildContrib/create_new_extension.pl
Expand Up @@ -55,7 +55,9 @@
}

unless ( $templateModule && -d $templateModule ) {
usage( error => "Template directory ($templateModule) does not exist" );
usage( error =>
"Template directory (./$templateModule) does not exist; it must be present in the current directory"
);
}

print "Creating $def{MODULE} from templates in $templateModule\n";
Expand Down Expand Up @@ -446,7 +448,9 @@ sub usage {
Usage: $0 <name of new extension> [ existing extension ]
This script will generate a new extension in a directory under the
current directory, suitable for building using the BuildContrib.
current directory, suitable for building using the BuildContrib. It
is normally run at the root of a Foswiki checkout, where existing
extensions are found in subdirectories.
You pass the name of your new extension - which must end in Skin,
JQueryPlugin, Plugin, or Contrib - to the script. For example,
Expand Down
1 change: 1 addition & 0 deletions BuildContrib/data/System/BuildContrib.txt
Expand Up @@ -582,6 +582,7 @@ Another great Foswiki extension from the <a style="text-decoration:none" href="h
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change&nbsp;History: | |
| 1.7.1 (8 May 2013) | Foswikitask:Item12492: expose test output while running tests Foswikitask:Item11851: minor bugfixes |
| 1.7.0 (11 May 2012) | Foswikitask:Item11716: correct paths in generated MANIFEST; Foswikitask:Item11851: internal maintenance |
| 1.6.3 (18 Aug 2011) | Foswikitask:Item11014: Improve error message if installer not run from Foswiki root. |
| 1.6.2 (13 Jul 2011) | Foswikitask:Item10963: Perl cleanup of qw() quoting |
Expand Down
4 changes: 2 additions & 2 deletions BuildContrib/lib/Foswiki/Contrib/Build.pm
Expand Up @@ -395,8 +395,8 @@ sub new {
}
print STDERR <<ERROR;
SVN keword based version string detected. \$Date or \$Rev detected.
SVN revision strings are no longer supported.
\$VERSION string containing \$Date or \$Rev detected.
Keyword-based \$VERSION strings are no longer supported.
Please update to a real Perl version string.
ERROR
Expand Down
4 changes: 2 additions & 2 deletions BuildContrib/lib/Foswiki/Contrib/BuildContrib.pm
@@ -1,8 +1,8 @@
package Foswiki::Contrib::BuildContrib;
use strict;

use version 0.77; our $VERSION = version->declare("v2.0.0");
our $RELEASE = '2.0.0';
use version 0.77; our $VERSION = version->declare("v1.7.1");
our $RELEASE = '8 May 2013';

our $SHORTDESCRIPTION =
'Automates build and packaging process, including installer generation, for extension modules.';
Expand Down
2 changes: 2 additions & 0 deletions BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/POD.pm
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

# Build POD documentation. This target defines =%$POD%= - it
# does not generate any output. The target will be invoked
# automatically if =%$POD%= is used in a .txt file. POD documentation
Expand Down
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

my %minifiers; # functions used to minify

my @compressFilters = (
Expand Down Expand Up @@ -281,7 +283,8 @@ sub _yuiMinify {
my $cmd;

if ( $cmdtype == 2 ) {
$cmd = "java -jar $basedir/tools/yuicompressor.jar --type $type $from";
$cmd =
"java -jar $Foswiki::Contrib::Build::basedir/tools/yuicompressor.jar --type $type $from";
}
else {
$cmd = "yui-compressor --type $type $from";
Expand Down Expand Up @@ -311,7 +314,7 @@ sub _haveYUI {
if ( not $? ) {
$result = 1;
}
elsif ( -e "$basedir/tools/yuicompressor.jar" ) {
elsif ( -e "$Foswiki::Contrib::Build::basedir/tools/yuicompressor.jar" ) {

# Do we have java?
$info = `java -version 2>&1` || '';
Expand Down
Expand Up @@ -15,6 +15,7 @@
#
package Foswiki::Contrib::Build;

use strict;
use B::PerlReq;

=begin TML
Expand Down
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

=begin TML
---++++ target_handsoff_install
Expand Down
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

=begin TML
#HistoryTarget
Expand Down
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

=begin TML
---++++ target_install
Expand Down
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

=begin TML
---++++ target_installer
Expand Down Expand Up @@ -76,7 +78,7 @@ sub target_installer {
# Find the template on @INC
my $template;
foreach my $d (@INC) {
my $dir = `dirname $d`;
my $dir = `dirname "$d"`;
chop($dir);
my $file =
$dir . '/lib/Foswiki/Contrib/BuildContrib/TEMPLATE_installer.pl';
Expand Down
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

my $collector;

=begin TML
Expand All @@ -28,7 +30,8 @@ sub target_manifest {
my $this = shift;

$collector = $this;
my $manifest = findRelative( $buildpldir, 'MANIFEST' );
my $manifest =
findRelative( $Foswiki::Contrib::Build::buildpldir, 'MANIFEST' );
if ( $manifest && -e $manifest ) {
open( F, '<', $manifest )
|| die 'Could not open existing ' . $manifest;
Expand All @@ -38,7 +41,7 @@ sub target_manifest {
close(F);
}
else {
$manifest = $buildpldir . '/MANIFEST';
$manifest = $Foswiki::Contrib::Build::buildpldir . '/MANIFEST';
}
require File::Find;
$collector->{manilist} = ();
Expand Down Expand Up @@ -70,10 +73,10 @@ sub _manicollect {
&& !/\.bak$/
&& !/^$collector->{project}_installer(\.pl)?$/

# Item10188: Ignore build output, but still want data/System/Project.txt
# $basedir in \Q...\E makes it a literal string (ignore regex chars)
# Item10188: Ignore build output, but still want data/System/Project.txt
# $Foswiki::Contrib::Build::basedir in \Q...\E makes it a literal string (ignore regex chars)
&& not $File::Find::name =~
/\Q$basedir\E\W$collector->{project}\.(md5|zip|tgz|txt|sha1)$/
/\Q$Foswiki::Contrib::Build::basedir\E\W$collector->{project}\.(md5|zip|tgz|txt|sha1)$/
)
{
my $n = $File::Find::name;
Expand Down
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

=begin TML
---++++ target_release
Expand Down
19 changes: 12 additions & 7 deletions BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/stage.pm
Expand Up @@ -15,10 +15,9 @@
#
package Foswiki::Contrib::Build;

my @stageFilters = (
{ RE => qr/\.txt$/, filter => 'filter_txt' },
{ RE => qr/\.pm$/, filter => 'filter_pm' },
);
use strict;

our @stageFilters;

=begin TML
Expand All @@ -31,6 +30,9 @@ sub target_stage {
my $this = shift;
my $project = $this->{project};

push( @stageFilters, { RE => qr/\.txt$/, filter => 'filter_txt' } );
push( @stageFilters, { RE => qr/\.pm$/, filter => 'filter_pm' } );

$this->{tmpDir} ||= File::Temp::tempdir( CLEANUP => 1 );
File::Path::mkpath( $this->{tmpDir} );

Expand All @@ -39,6 +41,8 @@ sub target_stage {
foreach my $file ( @{ $this->{files} } ) {
foreach my $filter (@stageFilters) {
if ( $file->{name} =~ /$filter->{RE}/ ) {

#print "FILTER $file->{name} $filter->{RE} $filter->{filter}\n";
my $fn = $filter->{filter};
$this->$fn(
$this->{basedir} . '/' . $file->{name},
Expand All @@ -59,14 +63,15 @@ sub target_stage {
my $libs = join( ':', @INC );
foreach my $module ( @{ $this->{other_modules} } ) {

die "$basedir / $module does not exist, cannot build $module\n"
unless ( -e "$basedir/$module" );
die
"$Foswiki::Contrib::Build::basedir / $module does not exist, cannot build $module\n"
unless ( -e "$Foswiki::Contrib::Build::basedir/$module" );

warn "Installing $module in $this->{tmpDir}\n";

#SMELL: uses legacy TWIKI_ exports
my $cmd =
"export FOSWIKI_HOME=$this->{tmpDir}; export FOSWIKI_LIBS=$libs; export TWIKI_HOME=$this->{tmpDir}; export TWIKI_LIBS=$libs; cd $basedir/$module; perl build.pl handsoff_install";
"export FOSWIKI_HOME=$this->{tmpDir}; export FOSWIKI_LIBS=$libs; export TWIKI_HOME=$this->{tmpDir}; export TWIKI_LIBS=$libs; cd $Foswiki::Contrib::Build::basedir/$module; perl build.pl handsoff_install";

#warn "***** running $cmd \n";
print `$cmd`;
Expand Down
13 changes: 12 additions & 1 deletion BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/test.pm
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

=begin TML
---++++ target_test
Expand Down Expand Up @@ -56,7 +58,16 @@ MESSY
print "Running tests in $tests\n";
$this->pushd($testdir);
$this->{-v} = 1; # to get the command printed
$this->sys_action( 'perl', '-w', @inc, $testrunner, $tests );

# $this->sys_action( 'perl', '-w', @inc, $testrunner, $tests );
# sys_action hides the output, so we use system() instead.
# exec() never returns, but that's OK in this case.
my @cmd = ( 'perl', '-w', @inc, $testrunner, $tests );
if ( $this->{-v} || $this->{-n} ) {
my $cmd = join( ' ', map { /\s/ ? "\"$_\"" : $_ } @cmd );
print "Running: $cmd\n";
}
system(@cmd);
$this->popd();
}

Expand Down
2 changes: 2 additions & 0 deletions BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/tidy.pm
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

my @tidyFilters = ( { RE => qr/\.pl$/ }, { RE => qr/\.pm$/ }, );
my $collector;

Expand Down
22 changes: 17 additions & 5 deletions BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/tracked.pm
Expand Up @@ -15,14 +15,20 @@
#
package Foswiki::Contrib::Build;

sub _filter_tracked_pm {
use strict;

our $DEFAULTCUSTOMERDB = "$ENV{HOME}/customerDB";

sub _tracked_filter_file {
my ( $this, $from, $to ) = @_;
$this->filter_file(
$from, $to,
sub {
my ( $this, $text ) = @_;
$text =~ s/%\$RELEASE%/$this->{RELEASE}/gm;
$text =~ s/%\$TRACKINGCODE%/$this->{TRACKINGCODE}/gm;
if ( $text =~ s/%\$TRACKINGCODE%/$this->{TRACKINGCODE}/gm ) {
print "TRACKINGCODE expanded in $to\n";
}
return $text;
}
);
Expand Down Expand Up @@ -72,10 +78,16 @@ sub target_tracked {
close(F);
}

warn "$customer tracking code $customers{$customer}\n";

push( @stageFilters, { RE => qr/\.pm$/, filter => '_filter_tracked_pm' } );
print STDERR "$customer tracking code $customers{$customer}\n";
$this->{RELEASE} =~ s/%\$TRACKINGCODE%/$this->{TRACKINGCODE}/g;

# Assume that target_stage is going to be run, and push new filters
push( @Foswiki::Contrib::Build::stageFilters,
{ RE => qr/\.pm$/, filter => '_tracked_filter_file' } );
push( @Foswiki::Contrib::Build::stageFilters,
{ RE => qr/\.txt$/, filter => '_tracked_filter_file' } );
push( @Foswiki::Contrib::Build::stageFilters,
{ RE => qr/\.(css|js)$/, filter => '_tracked_filter_file' } );
$this->build('release');
}

Expand Down
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

our @twikiFilters = (
{ RE => qr/\.pm$/, filter => '_twikify_perl' },
{ RE => qr/\.pm$/, filter => '_twikify_txt' },
Expand Down
Expand Up @@ -15,6 +15,8 @@
#
package Foswiki::Contrib::Build;

use strict;

=begin TML
---++++ target_uninstall
Expand Down

0 comments on commit 7d42011

Please sign in to comment.