gradle / gradle-completion

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

Completion doesn't work for some projects #51

Open pioterj opened 6 years ago

pioterj commented 6 years ago

I installed version 1.3 for bash and it works for the first project I tried it on. After I navigated to another Gradle project the completion doesn't work. For example when I type ./gradlew bu, tab it completes to ./gradlew buildEnvironment despite build task being present.

eriwen commented 6 years ago

@pioterj it sounds like the 2nd project just isn't being detected as a Gradle project. Could you tell me which project is the 2nd one, if possible, and let me know if there's anything else you can provide you think would help me solve this?

pioterj commented 6 years ago

It didn't work for several other projects after I played around with one project. I just realized that it worked for another one as a second (gradle/gradle).

Here's an example of a project where it didn't work: https://github.com/gradle/kotlin-dsl.

eriwen commented 6 years ago

Thanks for the example. I've confirmed that the kotlin dsl project isn't working, and will investigate.

pioterj commented 6 years ago

I'm glad that you could reproduce. Here's another example: https://github.com/ratpack/ratpack.

eriwen commented 6 years ago

Hmm... that's very helpful @pioterj. It's as if we've lost the ability to handle build scripts other than build.gradle.

lenalebt commented 6 years ago

Can confirm and have the very same problem (company-internal project). Do you already have some insights on what might be wrong? I tried to complete gradle build and gradle assemble, both did not work - the first one completed to gradle buildEnvironment.

eriwen commented 6 years ago

There are 2 bugs here that we need to fix to cover missing cases:

Do one of these use cases cover yours @lenalebt?

lenalebt commented 6 years ago

No, we're not using the Kotlin DSL and our build files are named build.gradle. We are, however, including some additional files using apply from (unsure if that can be an issue). But the tasks that are defined in the build.gradle do not show either.

eriwen commented 6 years ago

Thanks for the feedback. The reason none of the tasks are completing is that gradle-completion cannot find where your project $rootDir is.

I am surprised that this wouldn't work for you though. Do you happen to be using bash or zsh @lenalebt?

lenalebt commented 6 years ago

Ah, sorry, same as the thread opener: I'm on bash.

Just to be on the safe side: This should also work if I'm using the gradle-wrapper, correct?

eriwen commented 6 years ago

Ah, sorry too. I should have noticed.

Yes, it should absolutely work with the wrapper.