From 33d20f43659475bf234aa1c22ca9bbbd2a3b9d1e Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Sat, 7 Feb 2015 15:26:07 +0100 Subject: [PATCH] make complete-ant.pl provide all targets as completions Patch by Christian Schmidt Fixes bugzilla issues 57542 and 51931 --- WHATSNEW | 7 +++++++ src/script/complete-ant-cmd.pl | 11 +++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index f53145f77..b25e43ac5 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -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: -------------- diff --git a/src/script/complete-ant-cmd.pl b/src/script/complete-ant-cmd.pl index 4dd51a74d..40c5a9ad4 100644 --- a/src/script/complete-ant-cmd.pl +++ b/src/script/complete-ant-cmd.pl @@ -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( ) { - 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}++; } }