tools_schema.json 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. {
  2. "$schema": "http://json-schema.org/draft-07/schema#",
  3. "$id": "https://github.com/espressif/esp-idf/blob/master/tools/tools-schema.json",
  4. "type": "object",
  5. "properties": {
  6. "version": {
  7. "type": "integer",
  8. "description": "Metadata file version"
  9. },
  10. "tools": {
  11. "type": "array",
  12. "description": "List of tools",
  13. "items": {
  14. "$ref": "#/definitions/toolInfo"
  15. }
  16. }
  17. },
  18. "required": [
  19. "version",
  20. "tools"
  21. ],
  22. "definitions": {
  23. "toolInfo": {
  24. "type": "object",
  25. "description": "Information about one tool",
  26. "properties": {
  27. "name" : {
  28. "description": "Tool name (used as a directory name)",
  29. "type": "string"
  30. },
  31. "description" : {
  32. "description": "A short (one sentence) description of the tool.",
  33. "type": "string"
  34. },
  35. "export_paths": {
  36. "$ref": "#/definitions/exportPaths"
  37. },
  38. "export_vars": {
  39. "$ref": "#/definitions/envVars",
  40. "description": "Some variable expansions are done on the values. 1) ${TOOL_PATH} is replaced with the directory where the tool is installed."
  41. },
  42. "info_url": {
  43. "description": "URL of the page with information about the tool",
  44. "type": "string"
  45. },
  46. "install": {
  47. "$ref": "#/definitions/installRequirementInfo",
  48. "description": "If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation."
  49. },
  50. "is_executable": {
  51. "description": "If false - tool does not contain executables. The version will not be checked but export_vars applied.",
  52. "type": "boolean"
  53. },
  54. "license": {
  55. "description": "License name. Use SPDX license identifier if it exists, short name of the license otherwise.",
  56. "type": "string"
  57. },
  58. "version_cmd": {
  59. "$ref": "#/definitions/arrayOfStrings",
  60. "description": "Command to be executed (along with any extra arguments). The executable be present in one of the export_paths."
  61. },
  62. "supported_targets": {
  63. "$ref": "#/definitions/arrayOfStrings",
  64. "description": "Array of esp_targets that this tool is needed for."
  65. },
  66. "version_regex": {
  67. "description": "Regex which is to be applied to version_cmd output to extract the version. By default, the version will be the first capture group of the expression. If version_regex_replace is specified, version will be obtained by doing a substitution using version_regex_replace instead.",
  68. "$ref": "#/definitions/regex"
  69. },
  70. "version_regex_replace": {
  71. "description": "If given, this will be used as substitute expression for the regex defined in version_regex, to obtain the version string. Not specifying this is equivalent to setting it to '\\1' (i.e. return the first capture group).",
  72. "type": "string"
  73. },
  74. "strip_container_dirs": {
  75. "type": "integer",
  76. "description": "If specified, this number of top directory levels will removed when extracting. E.g. if strip_container_dirs=2, archive path a/b/c/d.txt will be extracted as c/d.txt"
  77. },
  78. "versions": {
  79. "type": "array",
  80. "description": "List of versions",
  81. "items": {
  82. "$ref": "#/definitions/versionInfo"
  83. }
  84. },
  85. "platform_overrides": {
  86. "type": "array",
  87. "description": "List of platform-specific overrides",
  88. "items": {
  89. "$ref": "#/definitions/platformOverrideInfo"
  90. }
  91. }
  92. },
  93. "required": [
  94. "description",
  95. "export_paths",
  96. "version_cmd",
  97. "version_regex",
  98. "versions",
  99. "install",
  100. "info_url",
  101. "license"
  102. ]
  103. },
  104. "arrayOfStrings": {
  105. "description": "Array of strings. Used to represent paths (split into components) and command lines (split into arguments)",
  106. "type": "array",
  107. "items": {
  108. "type": "string"
  109. }
  110. },
  111. "exportPaths": {
  112. "description": "Array of paths to be exported (added to PATH). Each item in the array is relative to the directory where the tool will be installed.",
  113. "type": "array",
  114. "items": {
  115. "$ref": "#/definitions/arrayOfStrings"
  116. }
  117. },
  118. "envVars": {
  119. "description": "Collection of environment variables. Keys and values are the environment variable names and values, respectively.",
  120. "type": "object",
  121. "patternProperties": {
  122. "^([A-Z_0-9]+)+$": {
  123. "type": "string"
  124. }
  125. },
  126. "additionalProperties": false
  127. },
  128. "regex": {
  129. "description": "A regular expression",
  130. "type": "string"
  131. },
  132. "versionInfo": {
  133. "type": "object",
  134. "properties": {
  135. "name" : {
  136. "description": "Version name (used as a directory name)",
  137. "type": "string"
  138. },
  139. "status": {
  140. "description": "Determines whether the version is recommended/supported/deprecated",
  141. "type": "string",
  142. "enum": ["recommended", "supported", "deprecated"]
  143. },
  144. "linux-i686": {
  145. "$ref": "#/definitions/platformDownloadInfo"
  146. },
  147. "linux-amd64": {
  148. "$ref": "#/definitions/platformDownloadInfo"
  149. },
  150. "linux-armel": {
  151. "$ref": "#/definitions/platformDownloadInfo"
  152. },
  153. "linux-arm64": {
  154. "$ref": "#/definitions/platformDownloadInfo"
  155. },
  156. "macos": {
  157. "$ref": "#/definitions/platformDownloadInfo"
  158. },
  159. "win32": {
  160. "$ref": "#/definitions/platformDownloadInfo"
  161. },
  162. "win64": {
  163. "$ref": "#/definitions/platformDownloadInfo"
  164. },
  165. "any": {
  166. "$ref": "#/definitions/platformDownloadInfo"
  167. }
  168. }
  169. },
  170. "platformDownloadInfo": {
  171. "description": "Information about download artifact for one platform",
  172. "type": "object",
  173. "properties": {
  174. "sha256": {
  175. "type": "string",
  176. "description": "SHA256 sum of the file"
  177. },
  178. "size": {
  179. "type": "integer",
  180. "description": "Size of the file, in bytes"
  181. },
  182. "url": {
  183. "type": "string",
  184. "description": "Download URL"
  185. },
  186. "rename_dist": {
  187. "type": "string",
  188. "description": "Filename under which the archive should be downloaded"
  189. }
  190. },
  191. "required": [
  192. "sha256",
  193. "url",
  194. "size"
  195. ]
  196. },
  197. "installRequirementInfo": {
  198. "description": "If 'always', the tool will be installed by default. If 'on_request', tool will be installed when specifically requested. If 'never', tool will not be considered for installation.",
  199. "type": "string",
  200. "enum": ["always", "on_request", "never"]
  201. },
  202. "platformOverrideInfo": {
  203. "description": "Platform-specific values which override the defaults",
  204. "type": "object",
  205. "properties": {
  206. "platforms": {
  207. "description": "List of platforms to which this override applies",
  208. "type": "array",
  209. "items": {
  210. "type": "string",
  211. "enum": ["linux-i686", "linux-amd64", "linux-armel", "linux-arm64", "macos", "macos-arm64", "win32", "win64"]
  212. }
  213. },
  214. "export_paths": {
  215. "description": "Platform-specific replacement for toolInfo/export_paths",
  216. "$ref": "#/definitions/exportPaths"
  217. },
  218. "export_vars": {
  219. "description": "Platform-specific replacement for toolInfo/export_vars",
  220. "$ref": "#/definitions/envVars"
  221. },
  222. "install": {
  223. "description": "Platform-specific replacement for toolInfo/install",
  224. "$ref": "#/definitions/installRequirementInfo"
  225. },
  226. "version_cmd": {
  227. "description": "Platform-specific replacement for toolInfo/version_cmd",
  228. "$ref": "#/definitions/arrayOfStrings"
  229. },
  230. "supported_targets": {
  231. "description": "Platform-specific replacement for toolInfo/supported_targets",
  232. "$ref": "#/definitions/arrayOfStrings"
  233. },
  234. "version_regex": {
  235. "description": "Platform-specific replacement for toolInfo/version_regex",
  236. "$ref": "#/definitions/regex"
  237. },
  238. "version_regex_replace": {
  239. "description": "Platform-specific replacement for toolInfo/version_regex_replace",
  240. "type": "string"
  241. },
  242. "strip_container_dirs": {
  243. "type": "string",
  244. "description": "Platform-specific replacement for toolInfo/strip_container_dirs"
  245. }
  246. },
  247. "required": ["platforms"]
  248. }
  249. },
  250. "$comment": "Condition verifying that version 1 of tools.json must not contain 'rename_dist' keyword in any of #/definitions/versionInfo properties.",
  251. "if": {
  252. "properties": {
  253. "version": {
  254. "const": 1
  255. }
  256. }
  257. },
  258. "then": {
  259. "properties": {
  260. "tools": {
  261. "items": {
  262. "properties": {
  263. "versions": {
  264. "items": {
  265. "additionalProperties": {
  266. "not": {
  267. "type": "object",
  268. "required": [
  269. "rename_dist"
  270. ]
  271. }
  272. }
  273. }
  274. }
  275. }
  276. }
  277. }
  278. }
  279. }
  280. }