_gradle
38766 bytes
1#compdef gradle gradlew gw
2
3__gradle-set-project-root-dir() {
4 local dir=`pwd`
5 project_root_dir=`pwd`
6 while [[ $dir != '/' ]]; do
7 if [[ -f "$dir/settings.gradle" || -f "$dir/settings.gradle.kts" || -f "$dir/gradlew" ]]; then
8 project_root_dir=$dir
9 return 0
10 fi
11 dir="$(dirname "$dir")"
12 done
13 return 1
14}
15
16__gradle-init-cache-dir() {
17 cache_dir="${GRADLE_USER_HOME:-$HOME/.gradle}/completion"
18 mkdir -p $cache_dir
19}
20
21__gradle-set-settings-file() {
22 # In order of precedence: settings.gradle, settings.gradle.kts
23
24 local default_gradle_settings_file="$project_root_dir/settings.gradle"
25 if [[ ! -f $default_gradle_settings_file ]]; then
26 default_gradle_settings_file="$project_root_dir/settings.gradle.kts"
27 fi
28 gradle_settings_file=$default_gradle_settings_file
29}
30
31__gradle-set-build-file() {
32 __gradle-set-settings-file
33 # In order of precedence: rootProject.buildFileName, build.gradle, build.gradle.kts
34
35 local default_gradle_build_file_name="build.gradle"
36 if [[ -r $gradle_settings_file ]]; then
37 local build_file_name=${$(grep "^rootProject\.buildFileName" $gradle_settings_file | \
38 sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p")}
39
40 default_gradle_build_file_name="${build_file_name:-build.gradle}"
41 fi
42
43 gradle_build_file="$project_root_dir/$default_gradle_build_file_name"
44 if [[ ! -f $gradle_build_file ]]; then
45 gradle_build_file="$project_root_dir/build.gradle.kts"
46 fi
47}
48
49__gradle-set-cache-name() {
50 # Cache name is constructed from the absolute path of the build file.
51 cache_name=${${gradle_build_file:a}//[^[:alnum:]]/_}
52}
53
54__gradle-set-files-checksum() {
55 # Cache MD5 sum of all Gradle scripts and modified timestamps
56 if builtin command -v md5 > /dev/null; then
57 gradle_files_checksum=( $(md5 -q -s "$(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null)") )
58 elif builtin command -v md5sum > /dev/null; then
59 gradle_files_checksum=( $(cat "$cache_dir/$cache_name" | xargs ls -o 2>/dev/null | md5sum | awk '{print $1}') )
60 else
61 _message 'Cannot generate completions as neither md5 nor md5sum exist on \$PATH'
62 return 1
63 fi
64}
65
66__gradle-generate-script-cache() {
67 # Invalidate cache after 3 weeks by default
68 local cache_ttl_mins=${$(echo $GRADLE_CACHE_TTL_MINUTES):-30240}
69 local script_exclude_pattern=${$(echo $GRADLE_COMPLETION_EXCLUDE_PATTERN):-"/(.git|build|integTest|samples|templates|smokeTest|testFixtures|out)/"}
70 if [[ ! $(find $cache_dir/$cache_name -mmin -$cache_ttl_mins 2>/dev/null) ]]; then
71 zle -R "Generating Gradle build script cache"
72 # Cache all Gradle scripts
73 local -a gradle_build_scripts
74 gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern") )
75 printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
76 fi
77}
78
79__gradle-generate-tasks-cache() {
80 __gradle-set-files-checksum
81
82 # Use Gradle wrapper when it exists.
83 local gradle_cmd="gradle"
84 if [[ -x "$project_root_dir/gradlew" ]]; then
85 gradle_cmd="$project_root_dir/gradlew"
86 fi
87
88 zle -R "Generating Gradle task cache from $gradle_build_file"
89
90 # Run gradle to retrieve possible tasks and cache.
91 # Reuse Gradle Daemon if IDLE but don't start a new one.
92 local gradle_tasks_output
93 if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
94 gradle_tasks_output="$(cd "$project_root_dir" && "$gradle_cmd" --daemon --no-scan --console=plain -q tasks --all 2>/dev/null)"
95 else
96 gradle_tasks_output="$(cd "$project_root_dir" && "$gradle_cmd" --no-daemon --no-scan --console=plain -q tasks --all 2>/dev/null)"
97 fi
98
99 local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
100 local -a match
101 for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do
102 if [[ $output_line =~ ^([[:alpha:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
103 local task_name="${match[1]}"
104 local task_description="${match[3]}"
105 # Completion for subproject tasks with ':' prefix
106 if [[ $task_name =~ ^([[:alnum:][:punct:]]+):([[:alnum:]]+) ]]; then
107 gradle_all_tasks+="${task_name//:/\\:}:$task_description\n\\:${task_name//:/\\:}:$task_description\n"
108 subproject_tasks+="${match[2]}\n"
109 else
110 gradle_all_tasks+="${task_name//:/\\:}:$task_description\n"
111 root_tasks+="$task_name\n"
112 fi
113 fi
114 done
115
116 # subproject tasks can be referenced implicitly from root project
117 if [[ $GRADLE_COMPLETION_UNQUALIFIED_TASKS == "true" ]]; then
118 local -a implicit_tasks
119 implicit_tasks=( $(comm -23 <(echo $subproject_tasks | sort) <(echo $root_tasks | sort)) )
120 for task in $(printf "%s\n" "${implicit_tasks[@]}"); do
121 gradle_all_tasks+="$task\n"
122 done
123 fi
124
125 echo $gradle_all_tasks >| $cache_dir/$gradle_files_checksum
126 echo $gradle_files_checksum >| $cache_dir/$cache_name.md5
127}
128
129__gradle-completion-init() {
130 local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
131 __gradle-init-cache-dir
132 __gradle-set-project-root-dir
133 __gradle-set-build-file
134 if [[ -f $gradle_build_file ]]; then
135 __gradle-set-cache-name
136 __gradle-generate-script-cache
137 __gradle-set-files-checksum
138 __gradle-generate-tasks-cache
139 fi
140 return 0
141}
142
143__gradle_tasks() {
144 local cache_dir cache_name gradle_build_file gradle_files_checksum project_root_dir
145
146 __gradle-init-cache-dir
147 __gradle-set-project-root-dir
148 __gradle-set-build-file
149 if [[ -f $gradle_build_file ]]; then
150 __gradle-set-cache-name
151 __gradle-generate-script-cache
152 __gradle-set-files-checksum
153
154 # The cache key is md5 sum of all gradle scripts, so it's valid if it exists.
155 if [[ -f $cache_dir/$cache_name.md5 ]]; then
156 local cached_checksum="$(cat $cache_dir/$cache_name.md5)"
157 local -a cached_tasks
158 if [[ -z $cur ]]; then
159 cached_tasks=(${(f)"$(grep -v "^\\\:" $cache_dir/$cached_checksum)"})
160 else
161 cached_tasks=(${(f)"$(grep "^${cur//:/\\\\:}" $cache_dir/$cached_checksum)"})
162 fi
163 _describe 'all tasks' cached_tasks && ret=0
164 else
165 __gradle-generate-tasks-cache
166 fi
167
168 # Regenerate tasks cache in the background
169 if [[ $gradle_files_checksum != "$(cat $cache_dir/$cache_name.md5)" || ! -f $cache_dir/$gradle_files_checksum || $(wc -c < $cache_dir/$gradle_files_checksum) -le 1 ]]; then
170 $(__gradle-generate-tasks-cache &> /dev/null &)
171 fi
172 else
173 _describe 'built-in tasks' '(
174 "buildEnvironment:Displays all buildscript dependencies declared in root project."
175 "components:Displays the components produced by root project."
176 "dependencies:Displays all dependencies declared in root project."
177 "dependencyInsight:Displays the insight into a specific dependency in root project."
178 "dependentComponents:Displays the dependent components of components in root project."
179 "help:Displays a help message."
180 "init:Initializes a new Gradle build."
181 "model:Displays the configuration model of root project."
182 "projects:Displays the sub-projects of root project."
183 "properties:Displays the properties of root project."
184 "tasks:Displays the tasks runnable from root project."
185 "wrapper:Generates Gradle wrapper files."
186 )' && ret=0
187 fi
188}
189
190__gradle_subcommand() {
191 integer ret=1
192
193 case "$words[1]" in
194 (dependencies)
195 _arguments \
196 '--configuration=[The configuration to generate the report for.]:dependency configuration:_gradle_dependency_configurations' && ret=0
197 ;;
198 (dependencyInsight)
199 _arguments \
200 '--all-variants[Show all variants of each dependency]' \
201 '--configuration=[Looks for the dependency in given configuration.]:dependency configuration:_gradle_dependency_configurations' \
202 '--dependency=[Shows the details of given dependency.]' \
203 '--single-path[Show at most one path to each dependency]' && ret=0
204 ;;
205 (help)
206 _arguments \
207 '--task=[The task to show help for.]' && ret=0
208 ;;
209 (init)
210 _arguments \
211 '--comments[Include clarifying comments in files.]' \
212 '--dsl=[Set the build script DSL to be used in generated scripts.]' \
213 '--incubating[Allow the generated build to use new features and APIs.]' \
214 '--insecure-protocol=[How to handle insecure URLs used for Maven Repositories.]' \
215 '--into=[Set the directory where the project is generated.]' \
216 '--java-version=[Provides java version to use in the project.]' \
217 '--overwrite[Allow existing files in the build directory to be overwritten?]' \
218 '--package=[Set the package for source files.]' \
219 '--project-name=[Set the project name.]' \
220 '--split-project[Split functionality across multiple subprojects?]' \
221 '--test-framework=[Set the test framework to be used.]' \
222 '--type=[Set the type of project to generate.]' \
223 '--use-defaults[Use default values for options not configured explicitly]' && ret=0
224 ;;
225 (tasks)
226 _arguments \
227 '--all[Show additional tasks and detail.]' \
228 '--group=[Show tasks for a specific group.]' \
229 '--groups=[Show tasks for specific groups (can be used multiple times to specify multiple groups).]' \
230 '--provenance[Show task provenance information]' \
231 '--types[Show task class types]' && ret=0
232 ;;
233 (test)
234 _arguments -C \
235 '--debug-jvm[Enable debugging for the test process. The process is started suspended and listening on port 5005.]' \
236 '--fail-fast[Stops test execution after the first failed test.]' \
237 '--test-dry-run[Simulate test execution.]' \
238 '--tests=[Sets test class or method name to be included (in addition to the test task filters), '*' is supported.]' \
239 '(-)*:: :->task-or-option' && ret=0
240 ;;
241 (wrapper)
242 _arguments \
243 '--distribution-type=[The type of the Gradle distribution to be used by the wrapper.]:*:distribution type:(bin all)' \
244 '--gradle-distribution-sha256-sum=[The SHA-256 hash sum of the gradle distribution.]' \
245 '--gradle-distribution-url=[The URL to download the Gradle distribution from.]' \
246 '--gradle-version=[The version of the Gradle distribution required by the wrapper. The following labels are allowed: latest, release-candidate, release-milestone, release-nightly, and nightly.]' \
247 '--network-timeout=[Timeout in ms to use when the wrapper is performing network operations.]' \
248 '--retries=[The number of download retries.]' \
249 '--retry-back-off-ms=[The initial back off in milliseconds between retries (doubles on each failure).]' \
250 '--validate-url[Sets task to validate the configured distribution url.]' && ret=0
251 ;;
252 (*)
253 _arguments -C \
254 '-Dcom.gradle.develocity.plugin.version=[Version of the Develocity plugin to auto-apply, must be 4.4.0 or higher if Develocity URL is specified as well.]' \
255 '-Dcom.gradle.develocity.url=[Default URL of the Develocity server to publish Build Scan to. Triggers auto-application of the Develocity plugin if not already applied.]' \
256 '-Dgradle.user.home=[Specifies the Gradle user home directory. Default is ~/.gradle.]:gradle.user.home:_directories' \
257 '-Dorg.gradle.caching.debug=[]' \
258 '-Dorg.gradle.caching=[Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.]:org.gradle.caching:(true false)' \
259 '-Dorg.gradle.configuration-cache.entries-per-key=[]' \
260 '-Dorg.gradle.configuration-cache.fine-grained-property-tracking=[]' \
261 '-Dorg.gradle.configuration-cache.heap-dump-dir=[]:org.gradle.configuration cache.heap dump dir:_directories' \
262 '-Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=[]' \
263 '-Dorg.gradle.configuration-cache.inputs.unsafe.ignore.in-serialization=[]' \
264 '-Dorg.gradle.configuration-cache.integrity-check=[]' \
265 '-Dorg.gradle.configuration-cache.max-problems=[]' \
266 '-Dorg.gradle.configuration-cache.parallel=[]' \
267 '-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn)' \
268 '-Dorg.gradle.configuration-cache.read-only=[]' \
269 '-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]' \
270 '-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
271 '-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]' \
272 '-Dorg.gradle.console.interactive=[]' \
273 '-Dorg.gradle.console.unicode=[Specifies which character types are allowed in the console output. Supported values are 'auto' (default), 'disable', or 'enable'.]' \
274 '-Dorg.gradle.console=[Specifies which type of console output to generate. Supported values are 'plain', 'colored', 'auto' (default), 'rich', or 'verbose'.]:org.gradle.console:(plain auto rich verbose)' \
275 '-Dorg.gradle.continue=[Continues task execution after a task failure.]' \
276 '-Dorg.gradle.continuous.quietperiod=[]' \
277 '-Dorg.gradle.daemon.healthcheckinterval=[]' \
278 '-Dorg.gradle.daemon.idletimeout=[]' \
279 '-Dorg.gradle.daemon.registry.base=[]:org.gradle.daemon.registry.base:_directories' \
280 '-Dorg.gradle.daemon=[Uses the Gradle daemon to run the build. Starts the daemon if it is not running.]' \
281 '-Dorg.gradle.debug.host=[]' \
282 '-Dorg.gradle.debug.port=[]' \
283 '-Dorg.gradle.debug.server=[]' \
284 '-Dorg.gradle.debug.suspend=[]' \
285 '-Dorg.gradle.debug=[]:org.gradle.debug:(true false)' \
286 '-Dorg.gradle.dependency.verification=[Configures the dependency verification mode. Supported values are 'strict', 'lenient', or 'off'.]:org.gradle.dependency.verification:(strict lenient off)' \
287 '-Dorg.gradle.java.home=[]:org.gradle.java.home:_directories' \
288 '-Dorg.gradle.java.installations.auto-detect=[]' \
289 '-Dorg.gradle.java.installations.auto-download=[]' \
290 '-Dorg.gradle.java.installations.fromEnv=[]' \
291 '-Dorg.gradle.java.installations.idea-jdks-directory=[]:org.gradle.java.installations.idea jdks directory:_directories' \
292 '-Dorg.gradle.java.installations.paths=[]:org.gradle.java.installations.paths:_directories' \
293 '-Dorg.gradle.jvmargs=[]' \
294 '-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug)' \
295 '-Dorg.gradle.logging.stacktrace=[]' \
296 '-Dorg.gradle.native=[]' \
297 '-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false)' \
298 '-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low)' \
299 '-Dorg.gradle.problems.report=[Enables the HTML problems report.]' \
300 '-Dorg.gradle.projectcachedir=[Specifies the project-specific cache directory. Default is .gradle in the root project directory.]:org.gradle.projectcachedir:_directories' \
301 '-Dorg.gradle.tooling.parallel=[]' \
302 '-Dorg.gradle.unsafe.isolated-projects.diagnostics=[]' \
303 '-Dorg.gradle.unsafe.isolated-projects=[]' \
304 '-Dorg.gradle.vfs.verbose=[]' \
305 '-Dorg.gradle.vfs.watch=[Enables file system watching. Reuses file system data for subsequent builds.]:org.gradle.vfs.watch:(true false)' \
306 '-Dorg.gradle.warning.mode=[Specifies which mode of warnings to generate. Supported values are 'all', 'fail', 'summary' (default), or 'none'.]' \
307 '-Dorg.gradle.welcome=[]:org.gradle.welcome:(once never)' \
308 '-Dorg.gradle.workers.max=[Configures the maximum number of concurrent workers Gradle is allowed to use.]' \
309 (--no-build-cache)'--build-cache[Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.]' \
310 (--no-configuration-cache)'--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
311 '--configuration-cache-problems[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:configuration cache problems:(fail warn)' \
312 (--no-configure-on-demand)'--configure-on-demand[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. (incubating)]' \
313 '--console[Specifies which type of console output to generate. Supported values are 'plain', 'colored', 'auto' (default), 'rich', or 'verbose'.]:console:(plain auto rich verbose)' \
314 '--console-unicode[Specifies which character types are allowed in the console output. Supported values are 'auto' (default), 'disable', or 'enable'.]' \
315 (--no-continue)'--continue[Continues task execution after a task failure.]' \
316 {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
317 (--no-daemon)'--daemon[Uses the Gradle daemon to run the build. Starts the daemon if it is not running.]' \
318 (--quiet,-q,--warn,-w,--info,-i){-d,--debug}'[Sets log level to debug. Includes the normal stacktrace.]' \
319 {-F,--dependency-verification}'[Configures the dependency verification mode. Supported values are 'strict', 'lenient', or 'off'.]:dependency verification:(strict lenient off)' \
320 '--develocity-plugin-version[Version of the Develocity plugin to auto-apply, must be 4.4.0 or higher if Develocity URL is specified as well.]' \
321 '--develocity-url[Default URL of the Develocity server to publish Build Scan to. Triggers auto-application of the Develocity plugin if not already applied.]' \
322 {-m,--dry-run}'[Runs the build with all task actions disabled.]' \
323 \*{-x,--exclude-task}'[Specifies a task to exclude from execution.]' \
324 '--export-keys[Exports the public keys used for dependency verification.]' \
325 '--foreground[Starts the Gradle daemon in the foreground.]' \
326 (--stacktrace,-s){-S,--full-stacktrace}'[Prints the full (very verbose) stacktrace for all exceptions.]' \
327 {-g,--gradle-user-home}'[Specifies the Gradle user home directory. Default is ~/.gradle.]:gradle user home:_directories' \
328 \*'--include-build[Includes the specified build in the composite.]:include build:_directories' \
329 (--quiet,-q,--warn,-w,--debug,-d){-i,--info}'[Sets the log level to info.]' \
330 \*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle(|.kts)' \
331 '--max-workers[Configures the maximum number of concurrent workers Gradle is allowed to use.]' \
332 (--build-cache)'--no-build-cache[Disables the Gradle build cache.]' \
333 (--configuration-cache)'--no-configuration-cache[Disables the configuration cache.]' \
334 (--configure-on-demand)'--no-configure-on-demand[Disables the use of configuration on demand. (incubating)]' \
335 (--continue)'--no-continue[Stops task execution after a task failure.]' \
336 (--daemon)'--no-daemon[Runs the build without the Gradle daemon. Useful occasionally if you have configured Gradle to always run with the daemon by default.]' \
337 (--parallel)'--no-parallel[Disables parallel project execution.]' \
338 (--problems-report)'--no-problems-report[Disables the HTML problems report. (incubating)]' \
339 {-a,--no-rebuild}'[Disables rebuilding of project dependencies.]' \
340 (--scan)'--no-scan[Disables the creation of a Build Scan.]' \
341 (--watch-fs)'--no-watch-fs[Disables file system watching.]' \
342 '--non-interactive[Do not do interactive prompting. (incubating)]' \
343 '--offline[Runs the build without accessing network resources.]' \
344 (--no-parallel)'--parallel[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
345 '--priority[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]' \
346 (--no-problems-report)'--problems-report[Enables the HTML problems report. (incubating)]' \
347 '--profile[Profiles build execution time. Generates a report in the <build_dir>/reports/profile directory.]' \
348 '--project-cache-dir[Specifies the project-specific cache directory. Default is .gradle in the root project directory.]:project cache dir:_directories' \
349 {-p,--project-dir}'[Specifies the start directory for Gradle. Default is the current directory.]:project dir:_directories' \
350 '--property-upgrade-report[Runs the build with the experimental property upgrade report. (incubating)]' \
351 (--warn,-w,--info,-i,--debug,-d){-q,--quiet}'[Logs errors only.]' \
352 {-U,--refresh-dependencies}'[Refreshes the state of dependencies.]' \
353 '--refresh-keys[Refreshes the public keys used for dependency verification.]' \
354 '--rerun[Causes the task to be re-run even if up-to-date.]' \
355 '--rerun-tasks[Ignores previously cached task results.]' \
356 (--no-scan)'--scan[Generates a Build Scan (powered by Develocity).]' \
357 {-V,--show-version}'[Print version info and continue.]' \
358 (--full-stacktrace,-S){-s,--stacktrace}'[Prints the stacktrace for all exceptions.]' \
359 '--task-graph[Prints the task graph instead of executing tasks.]' \
360 \*'--update-locks[Performs a partial update of the dependency lock. Allows passed-in module notations to change version. (incubating)]' \
361 (--quiet,-q,--info,-i,--debug,-d){-w,--warn}'[Sets the log level to warn.]' \
362 '--warning-mode[Specifies which mode of warnings to generate. Supported values are 'all', 'fail', 'summary' (default), or 'none'.]:warning mode:(all summary none)' \
363 (--no-watch-fs)'--watch-fs[Enables file system watching. Reuses file system data for subsequent builds.]' \
364 '--write-locks[Persists dependency resolution for locked configurations. Ignores existing locking information if it exists.]' \
365 {-M,--write-verification-metadata}'[Generates checksums for dependencies used in the project. Accepts a comma-separated list.]' && ret=0
366 ;;
367 esac
368
369 return ret
370}
371
372(( $+functions[_gradle_dependency_configurations] )) ||
373_gradle_dependency_configurations() {
374 local configurations
375 configurations=(
376 'compileClasspath'
377 'runtimeClasspath'
378 'testCompileClasspath'
379 'testRuntimeClasspath'
380 )
381 _describe -t 'dependency configurations' "dependency configuration" configurations
382}
383
384_gradle() {
385 local cur=${words[CURRENT]}
386 local curcontext="$curcontext" state
387 integer ret=1
388 typeset -A opt_args
389
390 _arguments -C \
391'-Dcom.gradle.develocity.plugin.version=[Version of the Develocity plugin to auto-apply, must be 4.4.0 or higher if Develocity URL is specified as well.]:->argument-expected' \
392 '-Dcom.gradle.develocity.url=[Default URL of the Develocity server to publish Build Scan to. Triggers auto-application of the Develocity plugin if not already applied.]:->argument-expected' \
393 '-Dgradle.user.home=[Specifies the Gradle user home directory. Default is ~/.gradle.]:gradle.user.home:_directories:->argument-expected' \
394 '-Dorg.gradle.caching.debug=[]:->argument-expected' \
395 '-Dorg.gradle.caching=[Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.]:org.gradle.caching:(true false):->argument-expected' \
396 '-Dorg.gradle.configuration-cache.entries-per-key=[]:->argument-expected' \
397 '-Dorg.gradle.configuration-cache.fine-grained-property-tracking=[]:->argument-expected' \
398 '-Dorg.gradle.configuration-cache.heap-dump-dir=[]:org.gradle.configuration cache.heap dump dir:_directories:->argument-expected' \
399 '-Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=[]:->argument-expected' \
400 '-Dorg.gradle.configuration-cache.inputs.unsafe.ignore.in-serialization=[]:->argument-expected' \
401 '-Dorg.gradle.configuration-cache.integrity-check=[]:->argument-expected' \
402 '-Dorg.gradle.configuration-cache.max-problems=[]:->argument-expected' \
403 '-Dorg.gradle.configuration-cache.parallel=[]:->argument-expected' \
404 '-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn):->argument-expected' \
405 '-Dorg.gradle.configuration-cache.read-only=[]:->argument-expected' \
406 '-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]:->argument-expected' \
407 '-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]:->argument-expected' \
408 '-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]:->argument-expected' \
409 '-Dorg.gradle.console.interactive=[]:->argument-expected' \
410 '-Dorg.gradle.console.unicode=[Specifies which character types are allowed in the console output. Supported values are 'auto' (default), 'disable', or 'enable'.]:->argument-expected' \
411 '-Dorg.gradle.console=[Specifies which type of console output to generate. Supported values are 'plain', 'colored', 'auto' (default), 'rich', or 'verbose'.]:org.gradle.console:(plain auto rich verbose):->argument-expected' \
412 '-Dorg.gradle.continue=[Continues task execution after a task failure.]:->argument-expected' \
413 '-Dorg.gradle.continuous.quietperiod=[]:->argument-expected' \
414 '-Dorg.gradle.daemon.healthcheckinterval=[]:->argument-expected' \
415 '-Dorg.gradle.daemon.idletimeout=[]:->argument-expected' \
416 '-Dorg.gradle.daemon.registry.base=[]:org.gradle.daemon.registry.base:_directories:->argument-expected' \
417 '-Dorg.gradle.daemon=[Uses the Gradle daemon to run the build. Starts the daemon if it is not running.]:->argument-expected' \
418 '-Dorg.gradle.debug.host=[]:->argument-expected' \
419 '-Dorg.gradle.debug.port=[]:->argument-expected' \
420 '-Dorg.gradle.debug.server=[]:->argument-expected' \
421 '-Dorg.gradle.debug.suspend=[]:->argument-expected' \
422 '-Dorg.gradle.debug=[]:org.gradle.debug:(true false):->argument-expected' \
423 '-Dorg.gradle.dependency.verification=[Configures the dependency verification mode. Supported values are 'strict', 'lenient', or 'off'.]:org.gradle.dependency.verification:(strict lenient off):->argument-expected' \
424 '-Dorg.gradle.java.home=[]:org.gradle.java.home:_directories:->argument-expected' \
425 '-Dorg.gradle.java.installations.auto-detect=[]:->argument-expected' \
426 '-Dorg.gradle.java.installations.auto-download=[]:->argument-expected' \
427 '-Dorg.gradle.java.installations.fromEnv=[]:->argument-expected' \
428 '-Dorg.gradle.java.installations.idea-jdks-directory=[]:org.gradle.java.installations.idea jdks directory:_directories:->argument-expected' \
429 '-Dorg.gradle.java.installations.paths=[]:org.gradle.java.installations.paths:_directories:->argument-expected' \
430 '-Dorg.gradle.jvmargs=[]:->argument-expected' \
431 '-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug):->argument-expected' \
432 '-Dorg.gradle.logging.stacktrace=[]:->argument-expected' \
433 '-Dorg.gradle.native=[]:->argument-expected' \
434 '-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false):->argument-expected' \
435 '-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low):->argument-expected' \
436 '-Dorg.gradle.problems.report=[Enables the HTML problems report.]:->argument-expected' \
437 '-Dorg.gradle.projectcachedir=[Specifies the project-specific cache directory. Default is .gradle in the root project directory.]:org.gradle.projectcachedir:_directories:->argument-expected' \
438 '-Dorg.gradle.tooling.parallel=[]:->argument-expected' \
439 '-Dorg.gradle.unsafe.isolated-projects.diagnostics=[]:->argument-expected' \
440 '-Dorg.gradle.unsafe.isolated-projects=[]:->argument-expected' \
441 '-Dorg.gradle.vfs.verbose=[]:->argument-expected' \
442 '-Dorg.gradle.vfs.watch=[Enables file system watching. Reuses file system data for subsequent builds.]:org.gradle.vfs.watch:(true false):->argument-expected' \
443 '-Dorg.gradle.warning.mode=[Specifies which mode of warnings to generate. Supported values are 'all', 'fail', 'summary' (default), or 'none'.]:->argument-expected' \
444 '-Dorg.gradle.welcome=[]:org.gradle.welcome:(once never):->argument-expected' \
445 '-Dorg.gradle.workers.max=[Configures the maximum number of concurrent workers Gradle is allowed to use.]:->argument-expected' \
446 (--no-build-cache)'--build-cache[Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.]' \
447 (--no-configuration-cache)'--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
448 '--configuration-cache-problems[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:configuration cache problems:(fail warn):->argument-expected' \
449 (--no-configure-on-demand)'--configure-on-demand[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. (incubating)]' \
450 '--console[Specifies which type of console output to generate. Supported values are 'plain', 'colored', 'auto' (default), 'rich', or 'verbose'.]:console:(plain auto rich verbose):->argument-expected' \
451 '--console-unicode[Specifies which character types are allowed in the console output. Supported values are 'auto' (default), 'disable', or 'enable'.]:->argument-expected' \
452 (--no-continue)'--continue[Continues task execution after a task failure.]' \
453 {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
454 (--no-daemon)'--daemon[Uses the Gradle daemon to run the build. Starts the daemon if it is not running.]' \
455 (--quiet,-q,--warn,-w,--info,-i){-d,--debug}'[Sets log level to debug. Includes the normal stacktrace.]' \
456 {-F,--dependency-verification}'[Configures the dependency verification mode. Supported values are 'strict', 'lenient', or 'off'.]:dependency verification:(strict lenient off):->argument-expected' \
457 '--develocity-plugin-version[Version of the Develocity plugin to auto-apply, must be 4.4.0 or higher if Develocity URL is specified as well.]:->argument-expected' \
458 '--develocity-url[Default URL of the Develocity server to publish Build Scan to. Triggers auto-application of the Develocity plugin if not already applied.]:->argument-expected' \
459 {-m,--dry-run}'[Runs the build with all task actions disabled.]' \
460 \*{-x,--exclude-task}'[Specifies a task to exclude from execution.]' \
461 '--export-keys[Exports the public keys used for dependency verification.]' \
462 '--foreground[Starts the Gradle daemon in the foreground.]' \
463 (--stacktrace,-s){-S,--full-stacktrace}'[Prints the full (very verbose) stacktrace for all exceptions.]' \
464 {-g,--gradle-user-home}'[Specifies the Gradle user home directory. Default is ~/.gradle.]:gradle user home:_directories:->argument-expected' \
465 {-h,--help}'[Shows a help message.]' \
466 \*'--include-build[Includes the specified build in the composite.]:include build:_directories:->argument-expected' \
467 (--quiet,-q,--warn,-w,--debug,-d){-i,--info}'[Sets the log level to info.]' \
468 \*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle(|.kts):->argument-expected' \
469 '--max-workers[Configures the maximum number of concurrent workers Gradle is allowed to use.]:->argument-expected' \
470 (--build-cache)'--no-build-cache[Disables the Gradle build cache.]' \
471 (--configuration-cache)'--no-configuration-cache[Disables the configuration cache.]' \
472 (--configure-on-demand)'--no-configure-on-demand[Disables the use of configuration on demand. (incubating)]' \
473 (--continue)'--no-continue[Stops task execution after a task failure.]' \
474 (--daemon)'--no-daemon[Runs the build without the Gradle daemon. Useful occasionally if you have configured Gradle to always run with the daemon by default.]' \
475 (--parallel)'--no-parallel[Disables parallel project execution.]' \
476 (--problems-report)'--no-problems-report[Disables the HTML problems report. (incubating)]' \
477 {-a,--no-rebuild}'[Disables rebuilding of project dependencies.]' \
478 (--scan)'--no-scan[Disables the creation of a Build Scan.]' \
479 (--watch-fs)'--no-watch-fs[Disables file system watching.]' \
480 '--non-interactive[Do not do interactive prompting. (incubating)]' \
481 '--offline[Runs the build without accessing network resources.]' \
482 (--no-parallel)'--parallel[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
483 '--priority[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:->argument-expected' \
484 (--no-problems-report)'--problems-report[Enables the HTML problems report. (incubating)]' \
485 '--profile[Profiles build execution time. Generates a report in the <build_dir>/reports/profile directory.]' \
486 '--project-cache-dir[Specifies the project-specific cache directory. Default is .gradle in the root project directory.]:project cache dir:_directories:->argument-expected' \
487 {-p,--project-dir}'[Specifies the start directory for Gradle. Default is the current directory.]:project dir:_directories:->argument-expected' \
488 '--property-upgrade-report[Runs the build with the experimental property upgrade report. (incubating)]' \
489 (--warn,-w,--info,-i,--debug,-d){-q,--quiet}'[Logs errors only.]' \
490 {-U,--refresh-dependencies}'[Refreshes the state of dependencies.]' \
491 '--refresh-keys[Refreshes the public keys used for dependency verification.]' \
492 '--rerun[Causes the task to be re-run even if up-to-date.]' \
493 '--rerun-tasks[Ignores previously cached task results.]' \
494 (--no-scan)'--scan[Generates a Build Scan (powered by Develocity).]' \
495 {-V,--show-version}'[Print version info and continue.]' \
496 (--full-stacktrace,-S){-s,--stacktrace}'[Prints the stacktrace for all exceptions.]' \
497 '--status[Shows the status of running and recently stopped Gradle daemons.]' \
498 '--stop[Stops the Gradle daemon if it is running.]' \
499 '--task-graph[Prints the task graph instead of executing tasks.]' \
500 \*'--update-locks[Performs a partial update of the dependency lock. Allows passed-in module notations to change version. (incubating)]' \
501 {-v,--version}'[Print version info and exit.]' \
502 (--quiet,-q,--info,-i,--debug,-d){-w,--warn}'[Sets the log level to warn.]' \
503 '--warning-mode[Specifies which mode of warnings to generate. Supported values are 'all', 'fail', 'summary' (default), or 'none'.]:warning mode:(all summary none):->argument-expected' \
504 (--no-watch-fs)'--watch-fs[Enables file system watching. Reuses file system data for subsequent builds.]' \
505 '--write-locks[Persists dependency resolution for locked configurations. Ignores existing locking information if it exists.]' \
506 {-M,--write-verification-metadata}'[Generates checksums for dependencies used in the project. Accepts a comma-separated list.]:->argument-expected' \
507'(-)*:: :->task-or-option' && ret=0
508
509 if [[ $words[CURRENT] != -* && $state != "argument-expected" ]]; then
510 __gradle_tasks && ret=0
511 else
512 curcontext=${curcontext%:*:*}:gradle-$words[1]:
513 __gradle_subcommand && ret=0
514 fi
515
516 return ret
517}
518
519_gradle "$@"