If you google for this question, you’ll find a bunch of crap answers about creating tasks and checking the task graph, bullshit.
All you need to do is check if a parameter has been passed to gradle.
Keep it simple and stupid:
(If you’re working with an android project, you can define that variable before the android {
section starts)
Then, if you need to do something different somewhere else down in your script, say, ask for a key alias and key password to sign your release (because they invoked ./gradlew assembleRelease
you do: