-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathgradle.ts
537 lines (532 loc) · 14.5 KB
/
gradle.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
const consoleModeArg: Fig.Arg = {
name: "mode",
default: "auto",
suggestions: [
{
name: "auto",
description:
"Enables color and other rich output in the console output when the build process is attached to a console, or to generate plain text only when not attached to a console",
},
{
name: "plain",
description:
"Disables all color and other rich output in the console output. This is the default when Gradle is not attached to a terminal",
},
{
name: "rich",
description:
"Enables color and other rich output in the console output, regardless of whether the build process is not attached to a console",
},
{
name: "verbose",
description:
"Enables color and other rich output like the rich, but output task names and outcomes at the lifecycle log level, as is done by default in Gradle 3.5 and earlier",
},
],
};
const warningModeArg: Fig.Arg = {
name: "mode",
default: "summary",
suggestions: [
{
name: "all",
description: "Log all warnings",
},
{
name: "fail",
description:
"Log all warnings and fail the build if there are any warnings",
},
{
name: "summary",
description:
"Suppress all warnings and log a summary at the end of the build",
},
{
name: "none",
description:
"Suppress all warnings, including the summary at the end of the build",
},
],
};
const sharedOptions: Fig.Option[] = [
{
name: ["-?", "-h", "--help"],
description: "Shows a help message with all available CLI options",
},
{
name: ["-v", "--version"],
description:
"Prints Gradle, Groovy, Ant, JVM, and operating system version information",
},
{
name: ["-S", "--full-stacktrace"],
description:
"Print out the full (very verbose) stacktrace for any exceptions",
},
{
name: ["-s", "--stacktrace"],
description:
"Print out the stacktrace also for user exceptions (e.g. compile error)",
},
{
name: "--scan",
description:
"Create a build scan with fine-grained information about all aspects of your Gradle build",
},
{
name: "-Dorg.gradle.debug",
description:
"Debug Gradle client (non-Daemon) process. Gradle will wait for you to attach a debugger at localhost:5005 by default",
},
{
name: "-Dorg.gradle.daemon.debug",
description: "Debug Gradle Daemon process",
},
{
name: "--build-cache",
description:
"Toggles the Gradle build cache. Gradle will try to reuse outputs from previous builds. Default is off",
exclusiveOn: ["--no-build-cache"],
},
{
name: "--no-build-cache",
description:
"Toggles the Gradle build cache. Gradle will try to reuse outputs from previous builds. Default is off",
exclusiveOn: ["--build-cache"],
},
{
name: "--configure-on-demand",
description:
"Toggles Configure-on-demand. Only relevant projects are configured in this build run. Default is off",
exclusiveOn: ["--configure-on-demand"],
},
{
name: "--no-configure-on-demand",
description:
"Toggles Configure-on-demand. Only relevant projects are configured in this build run. Default is off",
exclusiveOn: ["--configure-on-demand"],
},
{
name: "--max-workers",
description:
"Sets maximum number of workers that Gradle may use. Default is number of processors",
args: {
name: "number",
},
},
{
name: "--parallel",
description:
"Build projects in parallel. For limitations of this option, see Parallel Project Execution. Default is off",
exclusiveOn: ["--no-parallel"],
},
{
name: "--no-parallel",
description: "Disables --parallel",
exclusiveOn: ["--parallel"],
},
{
name: "--priority",
description:
"Specifies the scheduling priority for the Gradle daemon and all processes launched by it",
args: {
name: "priority",
default: "normal",
suggestions: ["normal", "low"],
},
},
{
name: "--profile",
description:
"Generates a high-level performance report in the $buildDir/reports/profile directory. --scan is preferred",
},
{
name: "--scan",
description: "Generate a build scan with detailed performance diagnostics",
},
{
name: "--watch-fs",
description:
"Toggles watching the file system. When enabled Gradle re-uses information it collects about the file system between builds. Enabled by default on operating systems where Gradle supports this feature",
exclusiveOn: ["--no-watch-fs"],
},
{
name: "--no-watch-fs",
description:
"Toggles watching the file system. When enabled Gradle re-uses information it collects about the file system between builds. Enabled by default on operating systems where Gradle supports this feature",
exclusiveOn: ["--watch-fs"],
},
{
name: "--daemon",
description:
"Use the Gradle Daemon to run the build. Starts the daemon if not running or existing daemon busy. Default is on",
exclusiveOn: ["--no-daemon"],
},
{
name: "--no-daemon",
description: "Disables --daemon",
exclusiveOn: ["--daemon"],
},
{
name: "--foreground",
description: "Starts the Gradle Daemon in a foreground process",
},
{
name: "-Dorg.gradle.daemon.idletimeout",
description:
"Gradle Daemon will stop itself after this number of milliseconds of idle time",
args: {
name: "milliseconds",
default: "10800000",
},
},
{
name: "-Dorg.gradle.logging.level",
description: "Set logging level via Gradle properties",
args: {
name: "level",
suggestions: ["quiet", "warn", "lifecycle", "info", "debug"],
},
},
{
name: ["-q", "--quiet"],
description: "Log errors only",
},
{
name: ["-w", "--warn"],
description: "Set log level to warn",
},
{
name: ["-i", "--info"],
description: "Set log level to info",
},
{
name: ["-d", "--debug"],
description: "Log in debug mode (includes normal stacktrace)",
},
{
name: "-Dorg.gradle.console",
description: "Specify console mode via Gradle properties",
args: consoleModeArg,
},
{
name: "--console",
description: "Specifies which type of console output to generate",
args: consoleModeArg,
},
{
name: "-Dorg.gradle.warning.mode",
description: "Specify warning mode via Gradle properties",
args: warningModeArg,
},
{
name: "--warning-mode",
description: "Specifies how to log warning",
args: warningModeArg,
},
{
name: "--include-build",
description: "Run the build as a composite, including the specified build",
},
{
name: "--offline",
description:
"Specifies that the build should operate without accessing network resources",
},
{
name: "--refresh-dependencies",
description: "Refresh the state of dependencies",
},
{
name: "--dry-run",
description:
"Run Gradle with all task actions disabled. Use this to show which task would have executed",
},
{
name: "--write-locks",
description:
"Indicates that all resolved configurations that are lockable should have their lock state persisted",
},
{
name: "--update-locks",
description:
"Indicates that versions for the specified modules have to be updated in the lock file",
args: {
name: "group:name",
isVariadic: true,
},
},
{
name: "--no-rebuild",
description:
"Do not rebuild project dependencies. Useful for debugging and fine-tuning buildSrc, but can lead to wrong results. Use with caution",
isDangerous: true,
},
{
name: ["-b", "--build-file"],
description:
"Specifies the build file. For example: gradle --build-file=foo.gradle",
args: {
name: "file",
default: "build.gradle",
template: "filepaths",
},
},
{
name: ["-c", "--settings-file"],
description:
"Specifies the settings file. For example: gradle --settings-file=somewhere/else/settings.gradle",
args: {
name: "file",
template: "filepaths",
},
},
{
name: ["-g", "--gradle-user-home"],
description:
"Specifies the Gradle user home directory. The default is the .gradle directory in the user’s home directory",
args: {
name: "directory",
template: "folders",
},
},
{
name: ["-p", "--project-dir"],
description: "Specifies the start directory for Gradle",
args: {
name: "directory",
default: "./",
template: "folders",
},
},
{
name: "--project-cache-dir",
description:
"Specifies the project-specific cache directory. Default value is .gradle in the root project directory",
args: {
name: "directory",
template: "folders",
},
},
{
name: ["-D", "--system-prop"],
description:
"Sets a system property of the JVM, for example -Dmyprop=myvalue",
args: {
name: "system property",
},
},
{
name: ["-I", "--init-script"],
description: "Specifies an initialization script",
},
{
name: ["-P", "--project-prop"],
description:
"Sets a project property of the root project, for example -Pmyprop=myvalue",
args: {
name: "system property",
},
},
{
name: "-Dorg.gradle.jvmargs",
description: "Set JVM arguments",
args: {
name: "arguments",
},
},
{
name: "-Dorg.gradle.java.home",
description: "Set JDK home dir",
args: {
name: "directory",
template: "folders",
},
},
];
const completionSpec: Fig.Spec = {
name: "gradle",
description:
"Gradle is an open-source build automation tool that is designed to be flexible enough to build almost any type of software",
subcommands: [
{
name: "build",
description: "Compute all outputs",
options: sharedOptions,
},
{
name: "run",
description: "Run applications",
options: sharedOptions,
},
{
name: "check",
description: "Run all checks",
options: sharedOptions,
},
{
name: "clean",
description: "Clear the contents of the build directory",
options: sharedOptions,
},
{
name: "projects",
description: "List of all sub-projects",
options: sharedOptions,
},
{
name: "tasks",
description: "List of main tasks of the selected project",
options: [
{
name: "--all",
description:
"By default, this report shows only those tasks which have been assigned to a task group. You can obtain more information in the task listing using the --all option",
},
{
name: "--group",
description:
"If you need to be more precise, you can display only the tasks from a specific group",
args: {
name: "group",
},
},
...sharedOptions,
],
},
{
name: "help",
description: "Display task usage information",
options: [
{
name: "--task",
isRequired: true,
args: {
name: "task",
},
},
...sharedOptions,
],
},
{
name: "dependencies",
description:
"Gives you a list of the dependencies of the selected project, broken down by configuration",
options: sharedOptions,
},
{
name: "buildEnvironment",
description:
"Visualises the buildscript dependencies of the selected project",
options: sharedOptions,
},
{
name: "dependencyInsight",
description:
"Gives you an insight into a particular dependency (or dependencies) that match specified input",
options: sharedOptions,
},
{
name: "properties",
description: "Gives you a list of the properties of the selected project",
options: sharedOptions,
},
{
name: "--status",
description:
"(Standalone command) List running and recently stopped Gradle daemons. Only displays daemons of the same Gradle version",
},
{
name: "--stop",
description:
"(Standalone command) Stop all Gradle Daemons of the same version",
},
{
name: "init",
description: "Create new Gradle builds, with new or existing projects",
options: [
{
name: "--type",
description: "Specify project type",
args: {
name: "type",
default: "basic",
suggestions: ["basic", "java-library", "java-application"],
},
},
...sharedOptions,
],
},
{
name: "wrapper",
description:
"Generates a script, gradlew, that invokes a declared version of Gradle, downloading it beforehand if necessary",
options: [
{
name: "--gradle-version",
description:
"The Gradle version used for downloading and executing the Wrapper",
args: {
name: "version",
},
},
{
name: "--distribution-type",
description: "The Gradle distribution type used for the Wrapper",
args: {
name: "type",
default: "bin",
suggestions: ["bin", "all"],
},
},
{
name: "--gradle-distribution-url",
description: "The full URL pointing to Gradle distribution ZIP file",
args: {
name: "url",
},
},
{
name: "--gradle-distribution-sha256-sum",
description:
"The SHA256 hash sum used for verifying the downloaded Gradle distribution",
args: {
name: "SHA256 hash sum",
},
},
...sharedOptions,
],
},
{
name: "test",
description: "Run a test task",
options: [
{
name: "--continuous",
description:
"Allows you to automatically re-execute the requested tasks when task inputs change",
},
{
name: "--rerun-tasks",
description:
"This will force test and all task dependencies of test to execute",
},
{
name: "--continue",
description:
"Gradle will execute every task to be executed where all of the dependencies for that task completed without failure",
},
...sharedOptions,
],
},
],
options: [...sharedOptions],
// There isn't a generator for gradle tasks (takes too long)
args: {
name: "task name",
isVariadic: true,
isOptional: true,
},
};
export default completionSpec;