Add Metal build bot

Bug: skia:6896
Change-Id: If2ed083703e6300b9d2a86cfb298011bbf54e018
Reviewed-on: https://skia-review.googlesource.com/28180
Reviewed-by: Eric Boren <borenet@google.com>
diff --git a/infra/bots/jobs.json b/infra/bots/jobs.json
index 9501fc3..47f713d 100644
--- a/infra/bots/jobs.json
+++ b/infra/bots/jobs.json
@@ -55,6 +55,7 @@
   "Build-Mac-Clang-x64-Release-iOS",
   "Build-Mac-Clang-x86_64-Debug",
   "Build-Mac-Clang-x86_64-Debug-CommandBuffer",
+  "Build-Mac-Clang-x86_64-Debug-Metal",
   "Build-Mac-Clang-x86_64-Release",
   "Build-Mac-Clang-x86_64-Release-CommandBuffer",
   "Build-Win-Clang-arm64-Release-Android",
diff --git a/infra/bots/recipe_modules/flavor/examples/full.expected/Build-Mac-Clang-x86_64-Debug-Metal.json b/infra/bots/recipe_modules/flavor/examples/full.expected/Build-Mac-Clang-x86_64-Debug-Metal.json
new file mode 100644
index 0000000..ce262de
--- /dev/null
+++ b/infra/bots/recipe_modules/flavor/examples/full.expected/Build-Mac-Clang-x86_64-Debug-Metal.json
@@ -0,0 +1,54 @@
+[
+  {
+    "cmd": [
+      "python",
+      "-u",
+      "[CUSTOM_/_B_WORK]/skia/bin/fetch-gn"
+    ],
+    "cwd": "[CUSTOM_/_B_WORK]/skia",
+    "env": {
+      "BUILDTYPE": "Debug",
+      "CHROME_HEADLESS": "1",
+      "PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
+      "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Mac-Clang-x86_64-Debug-Metal"
+    },
+    "infra_step": true,
+    "name": "fetch-gn"
+  },
+  {
+    "cmd": [
+      "[CUSTOM_/_B_WORK]/skia/bin/gn",
+      "gen",
+      "[CUSTOM_/_B_WORK]/skia/out/Build-Mac-Clang-x86_64-Debug-Metal/Debug",
+      "--args=cc=\"clang\" cxx=\"clang++\" extra_cflags=[\"-O1\"] skia_use_metal=true target_cpu=\"x86_64\""
+    ],
+    "cwd": "[CUSTOM_/_B_WORK]/skia",
+    "env": {
+      "BUILDTYPE": "Debug",
+      "CHROME_HEADLESS": "1",
+      "PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
+      "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Mac-Clang-x86_64-Debug-Metal"
+    },
+    "name": "gn gen"
+  },
+  {
+    "cmd": [
+      "ninja",
+      "-C",
+      "[CUSTOM_/_B_WORK]/skia/out/Build-Mac-Clang-x86_64-Debug-Metal/Debug"
+    ],
+    "cwd": "[CUSTOM_/_B_WORK]/skia",
+    "env": {
+      "BUILDTYPE": "Debug",
+      "CHROME_HEADLESS": "1",
+      "PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
+      "SKIA_OUT": "[CUSTOM_/_B_WORK]/skia/out/Build-Mac-Clang-x86_64-Debug-Metal"
+    },
+    "name": "ninja"
+  },
+  {
+    "name": "$result",
+    "recipe_result": null,
+    "status_code": 0
+  }
+]
\ No newline at end of file
diff --git a/infra/bots/recipe_modules/flavor/examples/full.py b/infra/bots/recipe_modules/flavor/examples/full.py
index 26775be..59fba85 100644
--- a/infra/bots/recipe_modules/flavor/examples/full.py
+++ b/infra/bots/recipe_modules/flavor/examples/full.py
@@ -57,6 +57,7 @@
   'Build-Debian9-Clang-arm-Release-Android_API26',
   'Build-Mac-Clang-arm64-Debug-Android_Vulkan',
   'Build-Mac-Clang-x86_64-Debug-CommandBuffer',
+  'Build-Mac-Clang-x86_64-Debug-Metal',
   'Build-Ubuntu-Clang-x86_64-Release-Mini',
   'Build-Ubuntu-Clang-x86_64-Release-Shared',
   'Build-Ubuntu-Clang-x86_64-Release-Vulkan',
diff --git a/infra/bots/recipe_modules/flavor/gn_flavor.py b/infra/bots/recipe_modules/flavor/gn_flavor.py
index 3b81255..20d23ac 100644
--- a/infra/bots/recipe_modules/flavor/gn_flavor.py
+++ b/infra/bots/recipe_modules/flavor/gn_flavor.py
@@ -105,6 +105,8 @@
         args['skia_vulkan_sdk'] = '"%s"' % linux_vulkan_sdk
       if 'Win' in os:
         args['skia_vulkan_sdk'] = '"%s"' % win_vulkan_sdk
+    if 'Metal' in extra_config:
+      args['skia_use_metal'] = 'true'
     if 'CheckGeneratedFiles' in extra_config:
       args['skia_compile_processors'] = 'true'
 
diff --git a/infra/bots/tasks.json b/infra/bots/tasks.json
index 34cdea7..4a25540 100644
--- a/infra/bots/tasks.json
+++ b/infra/bots/tasks.json
@@ -336,6 +336,12 @@
         "Build-Mac-Clang-x86_64-Debug-CommandBuffer"
       ]
     },
+    "Build-Mac-Clang-x86_64-Debug-Metal": {
+      "priority": 0.8,
+      "tasks": [
+        "Build-Mac-Clang-x86_64-Debug-Metal"
+      ]
+    },
     "Build-Mac-Clang-x86_64-Release": {
       "priority": 0.8,
       "tasks": [
@@ -3875,6 +3881,28 @@
       "isolate": "compile_skia.isolate",
       "priority": 0.8
     },
+    "Build-Mac-Clang-x86_64-Debug-Metal": {
+      "dimensions": [
+        "gpu:none",
+        "os:Mac-10.12",
+        "pool:Skia"
+      ],
+      "extra_args": [
+        "--workdir",
+        "../../..",
+        "compile",
+        "repository=<(REPO)",
+        "buildername=Build-Mac-Clang-x86_64-Debug-Metal",
+        "swarm_out_dir=${ISOLATED_OUTDIR}",
+        "revision=<(REVISION)",
+        "patch_repo=<(PATCH_REPO)",
+        "patch_storage=<(PATCH_STORAGE)",
+        "patch_issue=<(ISSUE)",
+        "patch_set=<(PATCHSET)"
+      ],
+      "isolate": "compile_skia.isolate",
+      "priority": 0.8
+    },
     "Build-Mac-Clang-x86_64-Release": {
       "dimensions": [
         "gpu:none",