blob: d003b816f2aa73341778829baae492e583160e42 [file] [log] [blame]
Ben Claytonbe88f172021-03-24 10:20:01 +00001{
2 // See https://go.microsoft.com/fwlink/?LinkId=733558
3 // for the documentation about the tasks.json format
4 // Available variables which can be used inside of strings.
5 // ${workspaceRoot}: the root folder of the team
6 // ${file}: the current opened file
7 // ${fileBasename}: the current opened file's basename
8 // ${fileDirname}: the current opened file's dirname
9 // ${fileExtname}: the current opened file's extension
10 // ${cwd}: the current working directory of the spawned process
11 "version": "2.0.0",
12 "tasks": [
13 // Invokes ninja in the 'out/active' directory, which is created with
14 // the 'gn gen' task (see below).
15 {
16 "label": "build",
17 "group": {
18 "kind": "build",
19 "isDefault": true
20 },
21 "type": "shell",
22 "linux": {
23 "command": "sh",
24 "args": [
25 "-c",
26 "ninja && echo Done"
27 ],
28 },
29 "osx": {
30 "command": "sh",
31 "args": [
32 "-c",
33 "ninja && echo Done"
34 ],
35 },
Ben Claytonaf55c042021-03-24 13:08:41 +000036 "windows": {
Ben Clayton9b2c17c2021-07-19 17:16:28 +000037 "command": "/C",
Ben Claytonaf55c042021-03-24 13:08:41 +000038 "args": [
Ben Clayton9b2c17c2021-07-19 17:16:28 +000039 "ninja && echo Done",
Ben Claytonaf55c042021-03-24 13:08:41 +000040 ],
Ben Clayton9b2c17c2021-07-19 17:16:28 +000041 "options": {
42 "shell": {
43 "executable": "cmd"
44 },
45 }
Ben Claytonaf55c042021-03-24 13:08:41 +000046 },
Ben Claytonbe88f172021-03-24 10:20:01 +000047 "options": {
48 "cwd": "${workspaceRoot}/out/active",
49 },
50 "presentation": {
51 "echo": false,
52 "reveal": "always",
53 "focus": false,
54 "panel": "shared",
55 "showReuseMessage": false,
56 "clear": true,
57 },
58 "problemMatcher": {
59 "owner": "cpp",
60 "fileLocation": "absolute",
61 "pattern": {
62 "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
63 "file": 1,
64 "line": 2,
65 "column": 3,
66 "severity": 4,
67 "message": 5
68 }
69 }
70 },
71 // Generates a GN build directory at 'out/<build-type>' with the
72 // is_debug argument set to to true iff the build-type is Debug.
73 // A symbolic link to this build directory is created at 'out/active'
74 // which is used to track the active build directory.
75 {
76 "label": "gn gen",
77 "type": "shell",
78 "linux": {
Ben Claytonfeb42e52022-04-07 19:22:21 +000079 "command": "./tools/setup-build",
Ben Claytonbe88f172021-03-24 10:20:01 +000080 "args": [
Ben Claytonfeb42e52022-04-07 19:22:21 +000081 "gn",
82 "${input:buildType}",
Ben Claytonbe88f172021-03-24 10:20:01 +000083 ],
84 },
85 "osx": {
Ben Claytonfeb42e52022-04-07 19:22:21 +000086 "command": "./tools/setup-build",
Ben Claytonbe88f172021-03-24 10:20:01 +000087 "args": [
Ben Claytonfeb42e52022-04-07 19:22:21 +000088 "gn",
89 "${input:buildType}",
Ben Claytonbe88f172021-03-24 10:20:01 +000090 ],
91 },
Ben Claytonaf55c042021-03-24 13:08:41 +000092 "windows": {
Ben Clayton9b2c17c2021-07-19 17:16:28 +000093 "command": "/C",
Ben Claytonaf55c042021-03-24 13:08:41 +000094 "args": [
Ben Claytonf50c22b2021-07-21 14:07:49 +000095 "(IF \"${input:buildType}\" == \"Debug\" ( gn gen \"out\\${input:buildType}\" --args=is_debug=true ) ELSE ( gn gen \"out\\${input:buildType}\" --args=is_debug=false )) && (IF EXIST \"out\\active\" rmdir \"out\\active\" /q /s) && (mklink /j \"out\\active\" \"out\\${input:buildType}\")",
Ben Claytonaf55c042021-03-24 13:08:41 +000096 ],
Ben Clayton9b2c17c2021-07-19 17:16:28 +000097 "options": {
98 "shell": {
99 "executable": "cmd"
100 },
101 }
Ben Claytonaf55c042021-03-24 13:08:41 +0000102 },
Ben Claytonbe88f172021-03-24 10:20:01 +0000103 "options": {
104 "cwd": "${workspaceRoot}"
105 },
106 "problemMatcher": [],
107 },
Ben Claytonfeb42e52022-04-07 19:22:21 +0000108 {
109 "label": "cmake gen",
110 "type": "shell",
111 "linux": {
112 "command": "./tools/setup-build",
113 "args": [
114 "cmake",
115 "${input:buildType}",
116 ],
117 },
118 "osx": {
119 "command": "./tools/setup-build",
120 "args": [
121 "cmake",
122 "${input:buildType}",
123 ],
124 },
125 "windows": {
126 "command": "/C",
127 "args": [
128 "echo TODO",
129 ],
130 "options": {
131 "shell": {
132 "executable": "cmd"
133 },
134 }
135 },
136 "options": {
137 "cwd": "${workspaceRoot}"
138 },
139 "problemMatcher": [],
140 },
Ben Claytonaf55c042021-03-24 13:08:41 +0000141 // Rebases the current branch on to origin/main and then calls
Ben Claytonbe88f172021-03-24 10:20:01 +0000142 // `gclient sync`.
143 {
144 "label": "sync",
145 "type": "shell",
146 "linux": {
147 "command": "sh",
148 "args": [
149 "-c",
Ben Claytonaf55c042021-03-24 13:08:41 +0000150 "git fetch origin && git rebase origin/main && gclient sync && echo Done"
Ben Claytonbe88f172021-03-24 10:20:01 +0000151 ],
152 },
153 "osx": {
154 "command": "sh",
155 "args": [
156 "-c",
Ben Claytonaf55c042021-03-24 13:08:41 +0000157 "git fetch origin && git rebase origin/main && gclient sync && echo Done"
158 ],
159 },
160 "windows": {
Ben Clayton9b2c17c2021-07-19 17:16:28 +0000161 "command": "/C",
Ben Claytonaf55c042021-03-24 13:08:41 +0000162 "args": [
Ben Clayton9b2c17c2021-07-19 17:16:28 +0000163 "git fetch origin && git rebase origin/main && gclient sync && echo Done",
Ben Claytonbe88f172021-03-24 10:20:01 +0000164 ],
Ben Clayton9b2c17c2021-07-19 17:16:28 +0000165 "options": {
166 "shell": {
167 "executable": "cmd"
168 },
169 }
Ben Claytonbe88f172021-03-24 10:20:01 +0000170 },
171 "options": {
172 "cwd": "${workspaceRoot}"
173 },
174 "problemMatcher": [],
175 },
176 // Pushes the changes at HEAD to gerrit for review
177 {
178 "label": "push",
179 "type": "shell",
180 "command": "git",
181 "args": [
182 "push",
183 "origin",
184 "HEAD:refs/for/main"
185 ],
186 "options": {
187 "cwd": "${workspaceRoot}"
188 },
189 "problemMatcher": [],
190 }
191 ],
192 "inputs": [
193 {
194 "id": "buildType",
195 "type": "pickString",
196 "options": [
197 "Debug",
198 "Release",
199 ],
200 "default": "Debug",
201 "description": "The type of build",
202 },
203 ]
Ben Claytonfeb42e52022-04-07 19:22:21 +0000204}