.vscode/tasks.json: Make build & configure work for windows.

Have this use the gn build, as the CMake approach with ninja would require finding the vcvarsall.bat, which is not easily locatable.

Change-Id: Ia88194890d13f4abde6f0fc4b99f3e0da134bc4b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46340
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index a00b395..35738ad 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -17,27 +17,37 @@
                 "isDefault": true
             },
             "type": "shell",
-            "command": "sh",
             "osx": {
+                "command": "sh",
                 "args": [
                     "-c",
                     "cmake --build . && echo Done"
-                ]
+                ],
+                "options": {
+                    "cwd": "${workspaceRoot}/build",
+                },
             },
             "linux": {
+                "command": "sh",
                 "args": [
                     "-c",
                     "cmake --build . && echo Done"
-                ]
+                ],
+                "options": {
+                    "cwd": "${workspaceRoot}/build",
+                },
             },
             "windows": {
+                // Invokes ninja in the 'out/active' directory, which is created
+                // with the 'generate' task (see below).
+                "command": "cmd",
                 "args": [
-                    "-c",
-                    "cmake --build . && echo Done"
-                ]
-            },
-            "options": {
-                "cwd": "${workspaceRoot}/build",
+                    "/C",
+                    "ninja && echo Done"
+                ],
+                "options": {
+                    "cwd": "${workspaceRoot}/out/active",
+                },
             },
             "presentation": {
                 "echo": false,
@@ -61,16 +71,40 @@
             }
         },
         {
-            "label": "cmake",
+            "label": "configure",
             "type": "shell",
-            "command": "cmake",
-            "args": [
-                "..",
-                "-GNinja",
-                "-DCMAKE_BUILD_TYPE=${input:buildType}",
-            ],
-            "options": {
-                "cwd": "${workspaceRoot}/build"
+            "osx": {
+                "command": "cmake",
+                "args": [
+                    "..",
+                    "-GNinja",
+                    "-DCMAKE_BUILD_TYPE=${input:buildType}",
+                ],
+                "options": {
+                    "cwd": "${workspaceRoot}/build"
+                },
+            },
+            "linux": {
+                "command": "cmake",
+                "args": [
+                    "..",
+                    "-GNinja",
+                    "-DCMAKE_BUILD_TYPE=${input:buildType}",
+                ],
+                "options": {
+                    "cwd": "${workspaceRoot}/build"
+                },
+            },
+            "windows": {
+                // Generates a GN build directory at 'out/<build-type>' with the
+                // is_debug argument set to to true iff the build-type is Debug.
+                // A symbolic link to this build directory is created at 'out/active'
+                // which is used to track the active build directory.
+                "command": "cmd",
+                "args": [
+                    "/C",
+                    "(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}')",
+                ],
             },
             "problemMatcher": [],
         },
@@ -103,4 +137,4 @@
             "description": "The type of build",
         },
     ]
-}
+}
\ No newline at end of file