gradle / gradle-completion

Gradle tab completion for bash and zsh
MIT License
1.02k stars 133 forks source link

Support projects without a buildfile in the root #138

Open alcarraz opened 1 year ago

alcarraz commented 1 year ago

Valid multi project builds may not have a build file in the root project, and the current code does not generate autocomplete information for tasks if the build file is not found. It assumes the directory is not an initialized gradle project. See #137.

This PR is a possible solution for this problem, is what I did, so I can use it. It works by not requiring the build file if the settings file is found.

Then, the call to the gradle executable is performed by path, instead of by build file in that case. Is the fix that I found less disruptive, but may not be ideal. It will create the cache as if the build file build.gradle.kts was present. This should not cause any trouble, but it is somehow weird. Another option would be to set the name for the cache directory, based on the project directory path.

Anyway, this PR is here just to illustrate more what was mentioned in issue #137, but I'm willing to perform modifications to make it better if this is considered a valid path.

Issue: #137