Open alcarraz opened 1 year ago
Hi! We're facing the same issue and would like to see this fixed. Do you need any help with your pull request?
Ok, actually, what I found out is that the culprit is this command
$("$gradle_cmd" -b "$gradle_build_file" --daemon --no-scan --console=plain -q tasks --all)
tasks --all
only lists the tasks for sub-projects. If one wants the root project tasks tasks
without --all
args is what you need. However tasks
doesn't list sub-project tasks. What a surprising behaviour! Basically all I did to make it work is concatenated two outputs.
if [[ ! -z "$("$gradle_cmd" --status 2>/dev/null | grep IDLE)" ]]; then
gradle_tasks_output="$("$gradle_cmd" -b "$gradle_build_file" --daemon --no-scan --console=plain -q tasks --all) << $("$gradle_cmd" -b "$gradle_build_file" --daemon --no-scan --console=plain -q tasks)"
else
gradle_tasks_output="$("$gradle_cmd" -b "$gradle_build_file" --no-daemon --no-scan --console=plain -q tasks --all) << $("$gradle_cmd" -b "$gradle_build_file" --no-daemon --no-scan --console=plain -q tasks)"
fi
Thank you, @vvvlasov, I actually made a PR (#138), showing a possible naive solution, but I didn't get any feedback on that. But I'm not sure if this is the same issue.
Hi, this was working wonderfully for me until now, thank you for the great work.
I started a multi project build according to Structuring and Building a Software Component with Gradle and it doesn't have a
build.gradle
in the project root. Thegradle init
command doesn't generate abuild.gradle
in the project root, either.In that case, the
gradle-completion
doesn't find the build file and defaults to assuming it is not an initializedgradle
project, giving only the common options.Maybe it can be assumed that if the settings file is found, the project is initialized, even if the build file is not found? I'm willing to add a PR, or a patch, if I manage to solve this and it works.
I found a workaround for this creating an empty
build.gradle
, but before that, well I'll tell the story because it may be worthy to add a warning or something in theREADME.md
about that.There is also the possibility that the script works, and somehow I did something to break it, in that case, please excuse me and let me know.
To reproduce, try this:
And then try to autocomplete gradle there. It will only show the default tasks.