improved messages and bug fixes to stub generation

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@724624 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2008-12-09 06:57:24 +00:00
parent d3f89a21ac
commit 4d0a1f76fc
2 changed files with 18 additions and 6 deletions

View File

@ -283,7 +283,7 @@
</linecontainsregexp>
<linecontainsregexp negate="true">
<!-- no way to leverage these in Solr (yet) -->
<regexp pattern="Sink\|Tee"/>
<regexp pattern="Sink|Tee"/>
</linecontainsregexp>
<linecontainsregexp negate="true">
<!-- Solr already has a different impl for this -->

View File

@ -43,6 +43,8 @@ use warnings;
use File::Find;
my $errors = 0;
my %classes = ();
while (<STDIN>) {
chomp;
@ -106,13 +108,21 @@ sub wanted {
} split /\s*,\s*/, $argline;
# wacky, doesn't use Reader or TokenStream ... skip (maybe a Sink?)
return unless defined $mainArgType;
unless (defined $mainArgType) {
warn "$class doesn't have a constructor with a Reader or TokenStream\n";
return;
}
my $type = ("Reader" eq $mainArgType) ? "Tokenizer" : "TokenFilter";
my $facClass = "${class}Factory";
my $facFile = "${facClass}.java";
die "$facFile exists" if -e $facFile;
if (-e $facFile) {
warn "$facFile already exists (maybe the return type isn't specific?)";
$errors++;
return;
}
open my $o, ">", $facFile
or die "can't write to $facFile: $!";
@ -140,15 +150,17 @@ sub wanted {
delete $classes{$fullname}; # we're done with this one
} else {
print STDERR "can't stub $class\n";
print STDERR "can't stub $class (no public constructor?)\n";
$errors++;
}
}
if (keys %classes) {
print STDERR "Can't find java files for...\n";
print STDERR "Can't stub (or find java files) for...\n";
foreach (keys %classes) {
print STDERR "$_\n";
}
exit -1;
$errors++;
}
exit -1 if $errors;