mirror of https://github.com/apache/lucene.git
make script more robust: classes w/o a constructor arg we're looking for, anonymous classes, better regex for restricting to java files
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@676389 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6c4e116283
commit
7de8ac0a90
|
@ -46,8 +46,11 @@ use File::Find;
|
||||||
my %classes = ();
|
my %classes = ();
|
||||||
while (<STDIN>) {
|
while (<STDIN>) {
|
||||||
chomp;
|
chomp;
|
||||||
|
# skip anonymous classes
|
||||||
|
if (!/\$/) {
|
||||||
$classes{$_} = 1;
|
$classes{$_} = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
find({wanted => \&wanted,
|
find({wanted => \&wanted,
|
||||||
no_chdir => 1,
|
no_chdir => 1,
|
||||||
|
@ -58,7 +61,7 @@ sub wanted {
|
||||||
|
|
||||||
my $file = $File::Find::name;
|
my $file = $File::Find::name;
|
||||||
|
|
||||||
return unless $file =~ m{/([^/]*)\.java};
|
return unless $file =~ m{/([^/]*)\.java$};
|
||||||
my $class = $1;
|
my $class = $1;
|
||||||
|
|
||||||
open(my $f, "<", $file) or die "can't open $file: $!";
|
open(my $f, "<", $file) or die "can't open $file: $!";
|
||||||
|
@ -81,6 +84,8 @@ sub wanted {
|
||||||
# only looking for certain classes
|
# only looking for certain classes
|
||||||
return unless $classes{$fullname};
|
return unless $classes{$fullname};
|
||||||
|
|
||||||
|
print STDERR "$file\n";
|
||||||
|
|
||||||
my @imports = $data =~ m/import\s+.*;/g;
|
my @imports = $data =~ m/import\s+.*;/g;
|
||||||
|
|
||||||
if ($data =~ m{public \s+ ((?:\w+\s+)*) $class \s*\(\s* ([^\)]*) \) }sx) {
|
if ($data =~ m{public \s+ ((?:\w+\s+)*) $class \s*\(\s* ([^\)]*) \) }sx) {
|
||||||
|
@ -100,6 +105,9 @@ sub wanted {
|
||||||
($k, $v)
|
($k, $v)
|
||||||
} split /\s*,\s*/, $argline;
|
} split /\s*,\s*/, $argline;
|
||||||
|
|
||||||
|
# wacky, doesn't use Reader or TokenStream ... skip (maybe a Sink?)
|
||||||
|
return unless defined $mainArgType;
|
||||||
|
|
||||||
my $type = ("Reader" eq $mainArgType) ? "Tokenizer" : "TokenFilter";
|
my $type = ("Reader" eq $mainArgType) ? "Tokenizer" : "TokenFilter";
|
||||||
|
|
||||||
my $facClass = "${class}Factory";
|
my $facClass = "${class}Factory";
|
||||||
|
@ -119,8 +127,8 @@ sub wanted {
|
||||||
}
|
}
|
||||||
if (1 < @orderedArgs) {
|
if (1 < @orderedArgs) {
|
||||||
# we need to init something, stub it out
|
# we need to init something, stub it out
|
||||||
print $o " public abstract void init(SolrConfig solrConfig, Map<String, String> args) {\n";
|
print $o " public abstract void init(Map<String, String> args) {\n";
|
||||||
print $o " super.init(solrConfig, args);\n";
|
print $o " super.init(args);\n";
|
||||||
print $o " // ABSTRACT BECAUSE IT'S A STUB .. FILL IT IN\n";
|
print $o " // ABSTRACT BECAUSE IT'S A STUB .. FILL IT IN\n";
|
||||||
print $o " }\n";
|
print $o " }\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue