-
Notifications
You must be signed in to change notification settings - Fork 153
Description
Curent behaviour:
Currently generating cache uses gradle tasks --all
, which:
- does not return unqualified tasks (tasks that are in subprojects but available without typing subproject name)
- includes hidden tasks
- does not allow to configure visibility of tasks other than setting group to null (but even this one is not supported by
gradle-completion
, because--all
does not care..)
After the command returns a list, additional parsing is done on the script side.
Proposal:
Replace generating cache with configurable gradle task, that creates cache in the final format. Parameters:
protected Set<String> rootGroupsBlacklist = new HashSet<>();
protected Set<String> rootTasksBlacklist = new HashSet<>();
protected Set<String> subprojectsGroupsBlacklist = new HashSet<>();
protected Set<String> subprojectsTasksBlacklist = new HashSet<>();
protected Map<String, String> arbitraryCommands = new HashMap<>();
protected boolean includeUnqualified = true;
protected boolean includeHidden = false;
protected boolean duplicateWithoutLeadingColon = true;
...and also list of Clousures with post processors, to modify the final result easily with project specific stuff (e.g. rules).
It gives a total freedom what should be supported in gradle-completion and what should not.
It would store directly to pointed cache file set a parameter too. Example configuration in build.gradle
:
tasks.register("initCompletionCache", com.sumologic.gradle.completion.InitCacheTask.class) {
doFirst {
setRootGroupsBlacklist(groupsToExcludeForRootConsoleCompletion)
setRootTasksBlacklist(tasksToExcludeForRootTaskReport)
setSubprojectsGroupsBlacklist(groupsToExcludeForSubProjectTaskReport)
setSubprojectsTasksBlacklist(tasksToExcludeForSubProjectTaskReport)
}
}
and invoking:
./gradlew initCompletionCache --shell=bash --completionCachePath="$cache_dir/$cached_checksum" --no-scan
I already implemented it. My plan is, to change gradle-completion
scripts in a way, that if they discover .gradle-completion
dir in a given project, it would source some files, that would override default behaviour. In particular default command, so that it's possible to replace with my custom task for generating report.
What do you think about it? Would you be interested in:
a) such gradle task / plugin to be added to this repository
b) eventually replacing gradle tasks --all
with it
c) more generic scripts that allow overriding default behavious. In particular gradle cmd.
Proposed generating cache is faster comparing to the original one.