Browse Source

make complete-ant.pl provide all targets as completions

Patch by Christian Schmidt

Fixes bugzilla issues 57542 and 51931
master
Stefan Bodewig 10 years ago
parent
commit
33d20f4365
2 changed files with 14 additions and 4 deletions
  1. +7
    -0
      WHATSNEW
  2. +7
    -4
      src/script/complete-ant-cmd.pl

+ 7
- 0
WHATSNEW View File

@@ -70,6 +70,13 @@ Fixed bugs:
the file.
Bugzilla Report 57533

* complete-ant-cmd.pl would incorrectly suggest words from the build
file description.
Bugzilla Report 51931

* complete-ant-cmd.pl now also completes tasks without a description.
Bugzilla Report 57542

Other changes:
--------------



+ 7
- 4
src/script/complete-ant-cmd.pl View File

@@ -77,16 +77,19 @@ sub getTargets {
}
return () unless (-f $buildFile);

# Run "ant -projecthelp" to list targets. Keep a cache of results in a
# cache-file.
# Run "ant -projecthelp -debug" to list targets (-debug is required to get
# "Other targets", i.e. targets without a description). Keep a cache of
# results in a cache-file.
my $cacheFile = $buildFile;
$cacheFile =~ s|(.*/)?(.*)|${1}.ant-targets-${2}|;
if ((!-e $cacheFile) || (-z $cacheFile) || (-M $buildFile) < (-M $cacheFile)) {
open( CACHE, '>'.$cacheFile ) || die "can\'t write $cacheFile: $!\n";
open( HELP, "$antCmd -projecthelp -f '$buildFile'|" ) || return();
open( HELP, "$antCmd -projecthelp -debug -buildfile '$buildFile'|" ) || return();
my %targets;
while( <HELP> ) {
if (/^\s+(\S+)/) {
# Exclude target names starting with dash, because they cannot be
# specified on the command line.
if (/^\s+\+Target:\s+(?!-)(\S+)/) {
$targets{$1}++;
}
}


Loading…
Cancel
Save