-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
dub.schema.json
433 lines (433 loc) · 20.5 KB
/
dub.schema.json
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
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "dub Package Schema",
"type": "object",
"definitions": {
"packageName": {
"type": "string",
"pattern": "^[-a-z0-9_]+$"
},
"configurationName": {
"type": "string",
"pattern": "^[-a-zA-Z0-9_]+$"
},
"stringArray": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
},
"buildOptions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"debugMode",
"releaseMode",
"coverage",
"debugInfo",
"debugInfoC",
"alwaysStackFrame",
"stackStomping",
"inline",
"noBoundsCheck",
"optimize",
"profile",
"profileGC",
"unittests",
"verbose",
"ignoreUnknownPragmas",
"syntaxOnly",
"warnings",
"warningsAsErrors",
"ignoreDeprecations",
"deprecationWarnings",
"deprecationErrors",
"property",
"betterC"
]
},
"minItems": 1,
"uniqueItems": true,
"description": "List of build option identifiers (corresponding to compiler flags)"
},
"lowBuildSettings": {
"properties": {
"systemDependencies": {
"type": "string",
"description": "A textual description of the required system dependencies (external C libraries) required by the package. This will be visible on the registry and will be displayed in case of linker errors"
},
"buildRequirements": {
"type": "array",
"items": {
"type": "string",
"enum": [
"allowWarnings",
"silenceWarnings",
"disallowDeprecations",
"silenceDeprecations",
"disallowInlining",
"disallowOptimization",
"requireBoundsCheck",
"requireContracts",
"relaxProperties",
"noDefaultFlags"
]
},
"minItems": 1,
"uniqueItems": true,
"description": "List of required settings for the build process"
},
"buildOptions": {
"$ref": "#/definitions/buildOptions"
},
"libs": {
"$ref": "#/definitions/stringArray",
"description": "A list of external library names - depending on the compiler, these will be converted to the proper linker flag (e.g. \"ssl\" might get translated to \"-L-lssl\")"
},
"sourceFiles": {
"$ref": "#/definitions/stringArray",
"description": "Additional files passed to the compiler - can be useful to add certain configuration dependent source files that are not contained in the general source folder"
},
"sourcePaths": {
"$ref": "#/definitions/stringArray",
"description": "Allows to customize the path where to look for source files (any folder \"source\" or \"src\" is automatically used as a source path if no sourcePaths setting is specified) - note that you usually also need to define \"importPaths\" as \"sourcePaths\" don't influence those"
},
"excludedSourceFiles": {
"$ref": "#/definitions/stringArray",
"description": "Files that should be removed for the set of already added source files (takes precedence over \"sourceFiles\" and \"sourcePaths\") - Glob matching can be used to pattern match multiple files at once"
},
"mainSourceFile": {
"type": "string",
"description": "Determines the file that contains the main() function. This setting can be used by dub to exclude this file in situations where a different main function is defined (e.g. for \"dub test\")"
},
"copyFiles": {
"$ref": "#/definitions/stringArray",
"description": "A list of globs matching files or directories to be copied to targetPath. Matching directories are copied recursively, i.e. \"copyFiles\": [\"path/to/dir\"]\" recursively copies dir, while \"copyFiles\": [\"path/to/dir/*\"]\" only copies files within dir."
},
"versions": {
"$ref": "#/definitions/stringArray",
"description": "A list of D versions to be defined during compilation"
},
"debugVersions": {
"$ref": "#/definitions/stringArray",
"description": "A list of D debug identifiers to be defined during compilation"
},
"importPaths": {
"$ref": "#/definitions/stringArray",
"description": "Additional import paths to search for D modules (the source/ folder is used by default as a source folder, if it exists)",
"default": [
"source"
]
},
"stringImportPaths": {
"$ref": "#/definitions/stringArray",
"description": "Additional import paths to search for string imports/views (the views/ folder is used by default as a string import folder, if it exists)",
"default": [
"views"
]
},
"preGenerateCommands": {
"$ref": "#/definitions/stringArray",
"description": "A list of shell commands that is executed before project generation is started"
},
"postGenerateCommands": {
"$ref": "#/definitions/stringArray",
"description": "A list of shell commands that is executed after project generation is finished"
},
"preBuildCommands": {
"$ref": "#/definitions/stringArray",
"description": "A list of shell commands that is executed always before the project is built"
},
"postBuildCommands": {
"$ref": "#/definitions/stringArray",
"description": "A list of shell commands that is executed always after the project is built"
},
"preRunCommands": {
"$ref": "#/definitions/stringArray",
"description": "A list of shell commands that is executed always before the project is run"
},
"postRunCommands": {
"$ref": "#/definitions/stringArray",
"description": "A list of shell commands that is executed always after the project is run"
},
"environments": {
"type": "object",
"description": "Environment variables to pass to every invoked build tool, program or script. (lowest precedence)"
},
"buildEnvironments": {
"type": "object",
"description": "Environment variables to pass to every invoked build tool, preBuildCommands and postBuildCommands."
},
"runEnvironments": {
"type": "object",
"description": "Environment variables to pass to the run application, preRunCommands and postRunCommands."
},
"preGenerateEnvironments": {
"type": "object",
"description": "Environment variables to pass to preGenerateCommands."
},
"postGenerateEnvironments": {
"type": "object",
"description": "Environment variables to pass to postGenerateCommands."
},
"preBuildEnvironments": {
"type": "object",
"description": "Environment variables to pass to preBuildCommands."
},
"postBuildEnvironments": {
"type": "object",
"description": "Environment variables to pass to postBuildCommands."
},
"preRunEnvironments": {
"type": "object",
"description": "Environment variables to pass to preRunCommands."
},
"postRunEnvironments": {
"type": "object",
"description": "Environment variables to pass to postRunCommands."
},
"dflags": {
"$ref": "#/definitions/stringArray",
"description": "Additional flags passed to the D compiler - note that these flags are usually specific to the compiler in use, but a set of flags is automatically translated from DMD to the selected compiler"
},
"lflags": {
"$ref": "#/definitions/stringArray",
"description": "Additional flags passed to the linker - note that these flags are usually specific to the linker in use"
}
}
},
"buildSettings": {
"allOf": [
{
"$ref": "#/definitions/lowBuildSettings"
},
{
"properties": {
"dependencies": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"optional": {
"type": "boolean",
"description": "Indicate an optional dependency"
},
"version": {
"type": "string",
"description": "The version specification as used for the simple form or the commit hash of the git repository specified in \"repository\""
},
"path": {
"type": "string",
"description": "Use a folder to source a package from"
},
"repository": {
"type": "string",
"description": "Path to a git repository with a leading `git+` prefix like `git+https://github.com/dlang-community/gitcompatibledubpackage.git`"
}
},
"anyOf": [
{
"required": ["repository", "version"]
},
{
"required": ["path"]
},
{
"required": ["version"]
}
]
}
]
},
"description": "List of project dependencies given as pairs of \"<name>\" : <version-spec>"
},
"targetType": {
"type": "string",
"default": "autodetect",
"enum": [
"autodetect",
"none",
"executable",
"library",
"sourceLibrary",
"staticLibrary",
"dynamicLibrary"
],
"description": "Specifies a specific target type"
},
"targetName": {
"type": "string",
"description": "Sets the base name of the output file; type and platform specific pre- and suffixes are added automatically"
},
"targetPath": {
"type": "string",
"description": "The destination path of the output binary"
},
"workingDirectory": {
"type": "string",
"description": "A fixed working directory from which the generated executable will be run"
},
"subConfigurations": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/packageName"
},
"description": "Locks the dependencies to specific configurations; a map from package name to configuration name"
}
}
}
]
}
},
"allOf": [
{
"$ref": "#/definitions/buildSettings"
},
{
"properties": {
"name": {
"$ref": "#/definitions/packageName",
"description": "Name of the package, used to uniquely identify the package. Must be comprised of only lower case ASCII alpha-numeric characters, \"-\" or \"_\"."
},
"description": {
"type": "string",
"description": "Brief description of the package"
},
"toolchainRequirements": {
"type": "object",
"description": "Set of version requirements for DUB, for compilers and for language frontend.",
"properties": {
"dub": {
"description": "DUB version requirement",
"type": "string"
},
"frontend": {
"description": "D frontend version requirement",
"type": "string"
},
"dmd": {
"description": "DMD version requirement",
"type": "string"
},
"ldc": {
"description": "LDC version requirement",
"type": "string"
},
"gdc": {
"description": "GDC version requirement",
"type": "string"
}
}
},
"homepage": {
"type": "string",
"format": "uri",
"description": "URL of the project website"
},
"authors": {
"$ref": "#/definitions/stringArray",
"description": "List of project authors. The suggested format is either \"Peter Parker\" or \"Peter Parker <pparker@example.com>\""
},
"copyright": {
"type": "string",
"description": "Copyright declaration string"
},
"license": {
"type": "string",
"examples": [
"public domain",
"proprietary",
"AFL-3.0",
"AGPL-3.0",
"Apache-2.0",
"APSL-2.0",
"Artistic-2.0",
"BSL-1.0",
"BSD 2-clause",
"BSD 3-clause",
"EPL-1.0",
"GPL-2.0",
"GPL-3.0",
"ISC",
"LGPL-2.1",
"LGPL-3.0",
"MIT",
"MPL-2.0",
"MS-PL",
"MS-RL",
"NCSA",
"OpenSSL",
"SSLeay",
"Zlib"
],
"minLength": 1,
"description": "License(s) under which the project can be used"
},
"subPackages": {
"type": "array",
"description": "Defines an array of sub-packages defined in the same directory as the root project, where each entry is either a path of a sub folder or an object of the same format as a dub.json file",
"items": {
"oneOf": [
{
"type": "string",
"description": "Path to package folder"
},
{
"$ref": "#"
}
]
}
},
"configurations": {
"type": "array",
"items": {
"required": ["name"],
"allOf": [
{
"properties": {
"name": {
"$ref": "#/definitions/configurationName",
"description": "Name of the configuration, used to uniquely identify the configuration. Must be comprised of ASCII alpha-numeric characters, \"-\" or \"_\"."
}
}
},
{
"properties": {
"platforms": {
"type": "array",
"items": {
"type": "string"
},
"description": "A list of platform suffixes (as used for the build settings) to limit on which platforms the configuration applies."
}
}
},
{
"$ref": "#/definitions/buildSettings"
}
]
},
"description": "Speficies an optional list of build configurations (chosen on the command line using --config=...)"
},
"buildTypes": {
"type": "object",
"description": "Defines additional custom build types or overrides the default ones (chosen on the command line using --build=...)",
"additionalProperties": {
"$ref": "#/definitions/lowBuildSettings"
}
}
}
}
],
"required": [
"name"
]
}