tasks.json 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. {
  2. // Note!
  3. // Set the value used for ${config:chrome.outputDir} in your settings.json
  4. // file with a line like:
  5. // "chrome.outputDir": "/path/to/chromium/src/out/current_link",
  6. // Then run "0-set_chrome_output_directory" to set the `current_link`
  7. // symbolic link (see below).
  8. "version": "2.0.0",
  9. "runner": "terminal",
  10. // The default problem matcher matches build output, which is useful for most tasks.
  11. "problemMatcher": [
  12. // Matches output from clang.
  13. {
  14. "owner": "cpp",
  15. "fileLocation": ["relative", "${config:chrome.outputDir}"],
  16. "pattern": {
  17. "regexp": "^(gen/.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
  18. "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
  19. }
  20. },
  21. {
  22. "owner": "cpp",
  23. "fileLocation": ["relative", "${workspaceRoot}"],
  24. "pattern": {
  25. "regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
  26. "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
  27. }
  28. },
  29. // Matches output from clang-cl / msvc.
  30. {
  31. "owner": "cpp",
  32. "fileLocation": [
  33. "relative",
  34. "${config:chrome.outputDir}"
  35. ],
  36. "pattern": {
  37. "regexp": "^(gen/.*)\\((\\d+),(\\d+)\\):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
  38. "file": 1,
  39. "line": 2,
  40. "column": 3,
  41. "severity": 4,
  42. "message": 5
  43. }
  44. },
  45. {
  46. "owner": "cpp",
  47. "fileLocation": [
  48. "relative",
  49. "${workspaceRoot}"
  50. ],
  51. "pattern": {
  52. "regexp": "^../../(.*)\\((\\d+),(\\d+)\\):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
  53. "file": 1,
  54. "line": 2,
  55. "column": 3,
  56. "severity": 4,
  57. "message": 5
  58. }
  59. },
  60. {
  61. "owner": "cpp",
  62. "fileLocation": ["relative", "${config:chrome.outputDir}"],
  63. "pattern": {
  64. "regexp": "^(gen/.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
  65. "file": 1, "severity": 3, "message": 4
  66. }
  67. },
  68. {
  69. "owner": "cpp",
  70. "fileLocation": ["relative", "${workspaceRoot}"],
  71. "pattern": {
  72. "regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
  73. "file": 1, "severity": 3, "message": 4
  74. }
  75. }
  76. ],
  77. "options": {
  78. // It's important to set the CWD to the output directory so that file paths
  79. // are linked correctly in the terminal output.
  80. "cwd": "${config:chrome.outputDir}"
  81. },
  82. "inputs": [
  83. {
  84. // See 'Set Chrome Output Directory'.
  85. "type": "pickString",
  86. "id": "chromeOutputDir",
  87. "description": "Chrome output directory:",
  88. // Configure this to point to all the output directories you use.
  89. "options": [
  90. "/path/to/chromium/src/out/pc",
  91. "/path/to/chromium/src/out/Debug",
  92. "/path/to/chromium/src/out/Debug_x86"
  93. ]
  94. },
  95. {
  96. "type": "promptString",
  97. "id": "gtestFilter",
  98. "description": "Filter for 4-test_current_file_with_filter",
  99. "default": "*"
  100. }
  101. ],
  102. "tasks": [
  103. // Set the Chrome output directory to be used in future task runs.
  104. // This uses a symbolic link to remember the current output directory.
  105. // If you want to use this, make sure chrome.outputDir is configured to
  106. // point to the link created at ${workspaceFolder}/out/current_link.
  107. // Alternatively:
  108. // * If you want to be prompted for the output directory each
  109. // time you run a command, replace
  110. // ${config:chrome.outputDir}
  111. // with
  112. // ${input:chromeOutputDir}
  113. // everywhere in this file.
  114. //
  115. // * If you want to have different tasks for different output directories,
  116. // just create duplicate tasks and hard-code the output directory used.
  117. {
  118. "label": "0-set_chrome_output_directory",
  119. "command": "rm -f ${workspaceFolder}/out/current_link; ln -s ${input:chromeOutputDir} ${workspaceFolder}/out/current_link",
  120. "type": "shell",
  121. // The default problem matcher doesn't make sense here, so remove it.
  122. "problemMatcher": [],
  123. "options": {
  124. "cwd": "${workspaceFolder}"
  125. }
  126. },
  127. // Some general-purpose build and test tasks. These all inherit the
  128. // problemMatcher at the top of the file.
  129. {
  130. "label": "1-build_chrome",
  131. "type": "shell",
  132. "command": "autoninja -C ${config:chrome.outputDir} chrome",
  133. "group": "test"
  134. },
  135. {
  136. "label": "2-build_all",
  137. "type": "shell",
  138. "command": "autoninja -C ${config:chrome.outputDir}"
  139. },
  140. {
  141. "label": "3-test_current_file",
  142. "type": "shell",
  143. "command": "${workspaceFolder}/tools/autotest.py -C ${config:chrome.outputDir} --run-all ${file}"
  144. },
  145. {
  146. "label": "4-test_current_file_with_filter",
  147. "type": "shell",
  148. "command": "${workspaceFolder}/tools/autotest.py -C ${config:chrome.outputDir} --gtest_filter ${input:gtestFilter} ${file}"
  149. },
  150. {
  151. "label": "5-test_current_line",
  152. "type": "shell",
  153. "command": "${workspaceFolder}/tools/autotest.py -C ${config:chrome.outputDir} --line ${lineNumber} ${file}"
  154. },
  155. {
  156. "label": "6-test_current_directory",
  157. "type": "shell",
  158. "command": "${workspaceFolder}/tools/autotest.py -C ${config:chrome.outputDir} --run-all ${fileDirname}"
  159. },
  160. {
  161. "label": "7-build_current_file",
  162. "type": "shell",
  163. "command": "compile_single_file --build-dir=${config:chrome.outputDir} --file-path=${file}"
  164. },
  165. // Some more specific build tasks, which hard-code the output directory.
  166. {
  167. "label": "8-build_chrome_debug",
  168. "type": "shell",
  169. "command": "autoninja -C ${workspaceFolder}/out/Debug chrome"
  170. },
  171. {
  172. "label": "9-build_chrome_release",
  173. "type": "shell",
  174. "command": "autoninja -C ${workspaceFolder}/out/Release chrome"
  175. },
  176. {
  177. "label": "10-build_test_debug",
  178. "type": "shell",
  179. "command": "autoninja -C ${workspaceFolder}/out/Debug unit_tests components_unittests browser_tests"
  180. },
  181. {
  182. "label": "11-generate_compile_commands",
  183. "type": "shell",
  184. "command": "${workspaceFolder}/tools/clang/scripts/generate_compdb.py -p ${config:chrome.outputDir} > ${workspaceFolder}/compile_commands.json"
  185. }
  186. ]
  187. }