gn: Cleanup chromium build
diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml
index 23d1218..21c1c2c 100644
--- a/.github/workflows/tools.yml
+++ b/.github/workflows/tools.yml
@@ -164,34 +164,6 @@
             - name: Verify generated source files
               run: python scripts/generate_source.py --verify external/Release/Vulkan-Headers/build/install/share/vulkan/registry
 
-    gn:
-        runs-on: ubuntu-20.04
-
-        strategy:
-            matrix:
-                config: [ Debug, Release ]
-
-        steps:
-            - uses: actions/checkout@v3
-
-            - name: Get depot tools
-              run: |
-                git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools
-                echo "$GITHUB_WORKSPACE/depot_tools" >> $GITHUB_PATH
-            - name: Fetch and install headers
-              run: ./build-gn/update_deps.sh
-
-            - name: Generate build files
-              run: gn gen out/${{matrix.config}} --args="is_debug=true"
-              if: matrix.config != 'Release'
-
-            - name: Generate build files
-              run: gn gen out/${{matrix.config}} --args="is_debug=false"
-              if: matrix.config == 'Release'
-
-            - name: Build the tools
-              run: ninja -C out/${{matrix.config}}
-
     android:
       runs-on: ubuntu-22.04
       strategy:
@@ -233,3 +205,9 @@
         - run: cmake -S . -B build/ -D UPDATE_DEPS=ON -D UPDATE_DEPS_DIR=external -D TOOLS_CODEGEN=ON
         - run: cmake --build build --target tools_codegen
         - run: git diff --exit-code
+
+    chromium:
+      runs-on: ubuntu-latest
+      steps:
+        - uses: actions/checkout@v3
+        - run: scripts/gn/gn.py
diff --git a/.gitignore b/.gitignore
index 385d655..8bac04a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,16 @@
 *.includes
 .vscode/
 .DS_Store
+
+# Chromium build artifacts
+.cipd/
+.gn
+.gclient
+.gclient_entries
+.gclient_previous_sync_commits
+out/
+third_party/
+buildtools/
+depot_tools/
+testing/
+tools/
diff --git a/.gn b/.gn
deleted file mode 100644
index 5ac6b83..0000000
--- a/.gn
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) 2019 LunarG, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-buildconfig = "//build/config/BUILDCONFIG.gn"
-secondary_source = "//build-gn/secondary/"
-
-script_executable = "python3"
-
-default_args = {
-    clang_use_chrome_plugins = false
-    use_custom_libcxx = false
-}
-
diff --git a/BUILD.gn b/BUILD.gn
index f280e48..08bd22a 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -54,7 +54,7 @@
   }
 
   action("vulkan_gen_icd_json_file") {
-    script = "build-gn/generate_vulkan_layers_json.py"
+    script = "scripts/gn/generate_vulkan_icd_json.py"
 
     public_deps = [ "$vulkan_headers_dir:vulkan_headers" ]
 
diff --git a/build-gn/DEPS b/scripts/gn/DEPS
similarity index 100%
rename from build-gn/DEPS
rename to scripts/gn/DEPS
diff --git a/build-gn/generate_vulkan_layers_json.py b/scripts/gn/generate_vulkan_icd_json.py
similarity index 99%
rename from build-gn/generate_vulkan_layers_json.py
rename to scripts/gn/generate_vulkan_icd_json.py
index c4135db..498bc07 100755
--- a/build-gn/generate_vulkan_layers_json.py
+++ b/scripts/gn/generate_vulkan_icd_json.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
-# Copyright (C) 2016 The ANGLE Project Authors.
 # Copyright (c) 2022-2023 LunarG, Inc.
+# Copyright (C) 2016 The ANGLE Project Authors.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/scripts/gn/gn.py b/scripts/gn/gn.py
new file mode 100755
index 0000000..52b20c5
--- /dev/null
+++ b/scripts/gn/gn.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python3
+# Copyright 2023 The Khronos Group Inc.
+# Copyright 2023 Valve Corporation
+# Copyright 2023 LunarG, Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+import os
+import subprocess
+import sys
+
+# helper to define paths relative to the repo root
+def RepoRelative(path):
+    return os.path.abspath(os.path.join(os.path.dirname(__file__), '../../', path))
+
+def BuildGn():
+    if not os.path.exists(RepoRelative("depot_tools")):
+        print("Cloning Chromium depot_tools\n", flush=True)
+        clone_cmd = 'git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools'.split(" ")
+        subprocess.call(clone_cmd)
+
+    os.environ['PATH'] = os.environ.get('PATH') + ":" + RepoRelative("depot_tools")
+
+    print("Updating Repo Dependencies and GN Toolchain\n", flush=True)
+    update_cmd = './scripts/gn/update_deps.sh'
+    subprocess.call(update_cmd)
+
+    print("Checking Header Dependencies\n", flush=True)
+    gn_check_cmd = 'gn gen --check out/Debug'.split(" ")
+    subprocess.call(gn_check_cmd)
+
+    print("Generating Ninja Files\n", flush=True)
+    gn_gen_cmd = 'gn gen out/Debug'.split(" ")
+    subprocess.call(gn_gen_cmd)
+
+    print("Running Ninja Build\n", flush=True)
+    ninja_build_cmd = 'ninja -C out/Debug'.split(" ")
+    subprocess.call(ninja_build_cmd)
+
+#
+# Module Entrypoint
+def main():
+    try:
+        BuildGn()
+
+    except subprocess.CalledProcessError as proc_error:
+        print('Command "%s" failed with return code %s' % (' '.join(proc_error.cmd), proc_error.returncode))
+        sys.exit(proc_error.returncode)
+    except Exception as unknown_error:
+        print('An unkown error occured: %s', unknown_error)
+        sys.exit(1)
+
+    sys.exit(0)
+
+if __name__ == '__main__':
+    main()
diff --git a/build-gn/secondary/build_overrides/build.gni b/scripts/gn/secondary/build_overrides/build.gni
similarity index 94%
rename from build-gn/secondary/build_overrides/build.gni
rename to scripts/gn/secondary/build_overrides/build.gni
index c6c11fa..dbf4703 100644
--- a/build-gn/secondary/build_overrides/build.gni
+++ b/scripts/gn/secondary/build_overrides/build.gni
@@ -1,4 +1,4 @@
-# Copyright (c) 2019 LunarG, Inc.
+# Copyright (c) 2019-2023 LunarG, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/build-gn/secondary/build_overrides/vulkan_headers.gni b/scripts/gn/secondary/build_overrides/vulkan_headers.gni
similarity index 93%
rename from build-gn/secondary/build_overrides/vulkan_headers.gni
rename to scripts/gn/secondary/build_overrides/vulkan_headers.gni
index 0cd8307..5f24b39 100644
--- a/build-gn/secondary/build_overrides/vulkan_headers.gni
+++ b/scripts/gn/secondary/build_overrides/vulkan_headers.gni
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 LunarG, Inc.
+# Copyright (c) 2020-2023 LunarG, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/build-gn/secondary/build_overrides/vulkan_tools.gni b/scripts/gn/secondary/build_overrides/vulkan_tools.gni
similarity index 94%
rename from build-gn/secondary/build_overrides/vulkan_tools.gni
rename to scripts/gn/secondary/build_overrides/vulkan_tools.gni
index 9f80846..c62fb64 100644
--- a/build-gn/secondary/build_overrides/vulkan_tools.gni
+++ b/scripts/gn/secondary/build_overrides/vulkan_tools.gni
@@ -1,4 +1,4 @@
-# Copyright (c) 2019 LunarG, Inc.
+# Copyright (c) 2019-2023 LunarG, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
diff --git a/build-gn/update_deps.sh b/scripts/gn/update_deps.sh
similarity index 69%
rename from build-gn/update_deps.sh
rename to scripts/gn/update_deps.sh
index 41da2ab..763c305 100755
--- a/build-gn/update_deps.sh
+++ b/scripts/gn/update_deps.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (c) 2019 LunarG, Inc.
+# Copyright (c) 2019-2023 LunarG, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -15,17 +15,29 @@
 # limitations under the License.
 
 # Execute at repo root
-cd "$(dirname $0)/.."
+cd "$(dirname $0)/../../"
 
 # Use update_deps.py to update source dependencies from /scripts/known_good.json
 scripts/update_deps.py --dir="external" --no-build
 
-# Use gclient to update toolchain dependencies from /build-gn/DEPS (from chromium)
+cat << EOF > .gn
+buildconfig = "//build/config/BUILDCONFIG.gn"
+secondary_source = "//scripts/gn/secondary/"
+
+script_executable = "python3"
+
+default_args = {
+    clang_use_chrome_plugins = false
+    use_custom_libcxx = false
+}
+EOF
+
+# Use gclient to update toolchain dependencies from /scripts/gn/DEPS (from chromium)
 cat << EOF >> .gclient
 solutions = [
   { "name"        : ".",
     "url"         : "https://github.com/KhronosGroup/Vulkan-Tools",
-    "deps_file"   : "build-gn/DEPS",
+    "deps_file"   : "scripts/gn/DEPS",
     "managed"     : False,
     "custom_deps" : {
     },