Move //gn/* to //* (#3070)

* Move //gn/* to //*

This avoids needing to use the secondary_source path remapping which can
cause confusion as the contents of //gn are all named without saying
"//gn".

By convention, the build system shared files are placed at //build and
non-shares files are //build_overrides. This allows drop the CHIP build
into other projects as a submodule, as long as they follow the same
conventions.

* Fix labeler
diff --git a/.github/labeler.yml b/.github/labeler.yml
index 3ed70cb..db2c0b1 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -45,8 +45,9 @@
     - .devcontainer
 
 gn:
-    - gn/*
-    - .gn/*
+    - build/*
+    - build_overrides/*
+    - .gn
     - "*.gn"
     - "*.gni"
 
diff --git a/.gn b/.gn
index 19d77a0..19c0501 100644
--- a/.gn
+++ b/.gn
@@ -18,10 +18,7 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//gn/"
-
-import("//gn/build_overrides/pigweed.gni")
+import("//build_overrides/pigweed.gni")
 
 script_executable = "python3"
 
diff --git a/BUILD.gn b/BUILD.gn
index 96d25d4..c2428d5 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -22,8 +22,8 @@
 # This build file should not be used in superproject builds.
 assert(chip_root == "//")
 
-import("${chip_root}/gn/chip/tests.gni")
-import("${chip_root}/gn/chip/tools.gni")
+import("${chip_root}/build/chip/tests.gni")
+import("${chip_root}/build/chip/tools.gni")
 
 if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
   declare_args() {
@@ -91,7 +91,7 @@
   }
 } else {
   # This is the unified build. Configure various real toolchains.
-  import("${chip_root}/gn/chip/chip_build.gni")
+  import("${chip_root}/build/chip/chip_build.gni")
   declare_args() {
     # Set this to false to disable all builds by default.
     enable_default_builds = true
diff --git a/gn/chip/buildconfig_header.gni b/build/chip/buildconfig_header.gni
similarity index 98%
rename from gn/chip/buildconfig_header.gni
rename to build/chip/buildconfig_header.gni
index 25ee93d..d9d3b4f 100644
--- a/gn/chip/buildconfig_header.gni
+++ b/build/chip/buildconfig_header.gni
@@ -108,7 +108,7 @@
   gen_target_name = "gen_${target_name}"
 
   action(gen_target_name) {
-    script = "${chip_root}/gn/chip/write_buildconfig_header.py"
+    script = "${chip_root}/build/chip/write_buildconfig_header.py"
 
     if (defined(invoker.header_dir)) {
       header_file = "${invoker.header_dir}/${invoker.header}"
diff --git a/gn/chip/chip_build.gni b/build/chip/chip_build.gni
similarity index 94%
rename from gn/chip/chip_build.gni
rename to build/chip/chip_build.gni
index dadd9a7..6be5a0f 100644
--- a/gn/chip/chip_build.gni
+++ b/build/chip/chip_build.gni
@@ -14,7 +14,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/tests.gni")
 
 template("chip_build") {
   _build_name = target_name
diff --git a/gn/chip/chip_test.gni b/build/chip/chip_test.gni
similarity index 97%
rename from gn/chip/chip_test.gni
rename to build/chip/chip_test.gni
index 426781c..cac1d6f 100644
--- a/gn/chip/chip_test.gni
+++ b/build/chip/chip_test.gni
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/pigweed.gni")
 
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/tests.gni")
 import("${chip_root}/src/platform/device.gni")
 import("${dir_pw_unit_test}/test.gni")
 
diff --git a/gn/chip/chip_test_group.gni b/build/chip/chip_test_group.gni
similarity index 95%
rename from gn/chip/chip_test_group.gni
rename to build/chip/chip_test_group.gni
index 4e3c011..4285f59 100644
--- a/gn/chip/chip_test_group.gni
+++ b/build/chip/chip_test_group.gni
@@ -14,7 +14,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/tests.gni")
 
 assert(chip_build_tests)
 
diff --git a/gn/chip/chip_test_suite.gni b/build/chip/chip_test_suite.gni
similarity index 95%
rename from gn/chip/chip_test_suite.gni
rename to build/chip/chip_test_suite.gni
index 23436a5..43a5f8a 100644
--- a/gn/chip/chip_test_suite.gni
+++ b/build/chip/chip_test_suite.gni
@@ -14,8 +14,8 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/chip_test.gni")
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/chip_test.gni")
+import("${chip_root}/build/chip/tests.gni")
 import("${dir_pw_unit_test}/test.gni")
 
 assert(chip_build_tests)
diff --git a/gn/chip/chip_version.gni b/build/chip/chip_version.gni
similarity index 100%
rename from gn/chip/chip_version.gni
rename to build/chip/chip_version.gni
diff --git a/gn/chip/java/jar_runner.py b/build/chip/java/jar_runner.py
similarity index 100%
rename from gn/chip/java/jar_runner.py
rename to build/chip/java/jar_runner.py
diff --git a/gn/chip/java/javac_runner.py b/build/chip/java/javac_runner.py
similarity index 100%
rename from gn/chip/java/javac_runner.py
rename to build/chip/java/javac_runner.py
diff --git a/gn/chip/java/rules.gni b/build/chip/java/rules.gni
similarity index 95%
rename from gn/chip/java/rules.gni
rename to build/chip/java/rules.gni
index 14f3b90..2597ec7 100644
--- a/gn/chip/java/rules.gni
+++ b/build/chip/java/rules.gni
@@ -12,10 +12,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import("//build_overrides/chip.gni")
+
 import("//build/config/android/config.gni")
 
-javac_runner = "//gn/chip/java/javac_runner.py"
-jar_runner = "//gn/chip/java/jar_runner.py"
+javac_runner = "${chip_root}/build/chip/java/javac_runner.py"
+jar_runner = "${chip_root}/build/chip/java/jar_runner.py"
 
 assert(android_sdk_root != "", "android_sdk_root must be specified")
 
diff --git a/gn/chip/linux/BUILD.gn b/build/chip/linux/BUILD.gn
similarity index 100%
rename from gn/chip/linux/BUILD.gn
rename to build/chip/linux/BUILD.gn
diff --git a/gn/chip/linux/gdbus_library.gni b/build/chip/linux/gdbus_library.gni
similarity index 100%
rename from gn/chip/linux/gdbus_library.gni
rename to build/chip/linux/gdbus_library.gni
diff --git a/gn/chip/linux/gen_gdbus_wrapper.py b/build/chip/linux/gen_gdbus_wrapper.py
similarity index 100%
rename from gn/chip/linux/gen_gdbus_wrapper.py
rename to build/chip/linux/gen_gdbus_wrapper.py
diff --git a/gn/chip/python_gen_tags.py b/build/chip/python_gen_tags.py
similarity index 100%
rename from gn/chip/python_gen_tags.py
rename to build/chip/python_gen_tags.py
diff --git a/gn/chip/tests.gni b/build/chip/tests.gni
similarity index 100%
rename from gn/chip/tests.gni
rename to build/chip/tests.gni
diff --git a/gn/chip/tools.gni b/build/chip/tools.gni
similarity index 100%
rename from gn/chip/tools.gni
rename to build/chip/tools.gni
diff --git a/gn/chip/write_buildconfig_header.py b/build/chip/write_buildconfig_header.py
similarity index 100%
rename from gn/chip/write_buildconfig_header.py
rename to build/chip/write_buildconfig_header.py
diff --git a/gn/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
similarity index 100%
rename from gn/build/config/BUILDCONFIG.gn
rename to build/config/BUILDCONFIG.gn
diff --git a/gn/build/config/android/config.gni b/build/config/android/config.gni
similarity index 100%
rename from gn/build/config/android/config.gni
rename to build/config/android/config.gni
diff --git a/gn/build/config/android_abi.gni b/build/config/android_abi.gni
similarity index 100%
rename from gn/build/config/android_abi.gni
rename to build/config/android_abi.gni
diff --git a/gn/build/config/arm.gni b/build/config/arm.gni
similarity index 100%
rename from gn/build/config/arm.gni
rename to build/config/arm.gni
diff --git a/gn/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
similarity index 100%
rename from gn/build/config/compiler/BUILD.gn
rename to build/config/compiler/BUILD.gn
diff --git a/gn/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni
similarity index 100%
rename from gn/build/config/compiler/compiler.gni
rename to build/config/compiler/compiler.gni
diff --git a/gn/build/config/custom_toolchain.gni b/build/config/custom_toolchain.gni
similarity index 100%
rename from gn/build/config/custom_toolchain.gni
rename to build/config/custom_toolchain.gni
diff --git a/gn/build/config/defaults.gni b/build/config/defaults.gni
similarity index 100%
rename from gn/build/config/defaults.gni
rename to build/config/defaults.gni
diff --git a/gn/build/config/linux/pkg-config.py b/build/config/linux/pkg-config.py
similarity index 100%
rename from gn/build/config/linux/pkg-config.py
rename to build/config/linux/pkg-config.py
diff --git a/gn/build/config/linux/pkg_config.gni b/build/config/linux/pkg_config.gni
similarity index 100%
rename from gn/build/config/linux/pkg_config.gni
rename to build/config/linux/pkg_config.gni
diff --git a/gn/build/config/target.gni b/build/config/target.gni
similarity index 100%
rename from gn/build/config/target.gni
rename to build/config/target.gni
diff --git a/gn/build/config/x86.gni b/build/config/x86.gni
similarity index 100%
rename from gn/build/config/x86.gni
rename to build/config/x86.gni
diff --git a/gn/build/gn_run_binary.py b/build/gn_run_binary.py
similarity index 100%
rename from gn/build/gn_run_binary.py
rename to build/gn_run_binary.py
diff --git a/gn/build/toolchain/android/BUILD.gn b/build/toolchain/android/BUILD.gn
similarity index 100%
rename from gn/build/toolchain/android/BUILD.gn
rename to build/toolchain/android/BUILD.gn
diff --git a/gn/build/toolchain/android/android_arm.gni b/build/toolchain/android/android_arm.gni
similarity index 100%
rename from gn/build/toolchain/android/android_arm.gni
rename to build/toolchain/android/android_arm.gni
diff --git a/gn/build/toolchain/android/android_toolchain.gni b/build/toolchain/android/android_toolchain.gni
similarity index 100%
rename from gn/build/toolchain/android/android_toolchain.gni
rename to build/toolchain/android/android_toolchain.gni
diff --git a/gn/build/toolchain/arm_gcc/BUILD.gn b/build/toolchain/arm_gcc/BUILD.gn
similarity index 100%
rename from gn/build/toolchain/arm_gcc/BUILD.gn
rename to build/toolchain/arm_gcc/BUILD.gn
diff --git a/gn/build/toolchain/arm_gcc/arm_toolchain.gni b/build/toolchain/arm_gcc/arm_toolchain.gni
similarity index 100%
rename from gn/build/toolchain/arm_gcc/arm_toolchain.gni
rename to build/toolchain/arm_gcc/arm_toolchain.gni
diff --git a/gn/build/toolchain/flashable_executable.gni b/build/toolchain/flashable_executable.gni
similarity index 98%
rename from gn/build/toolchain/flashable_executable.gni
rename to build/toolchain/flashable_executable.gni
index cee1108..b82e3aa 100644
--- a/gn/build/toolchain/flashable_executable.gni
+++ b/build/toolchain/flashable_executable.gni
@@ -37,7 +37,7 @@
       rebase_path(conversion_input, root_build_dir),
       rebase_path(conversion_output, root_build_dir),
     ]
-    script = "${chip_root}/gn/build/gn_run_binary.py"
+    script = "//build/gn_run_binary.py"
   }
 }
 
diff --git a/gn/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni
similarity index 100%
rename from gn/build/toolchain/gcc_toolchain.gni
rename to build/toolchain/gcc_toolchain.gni
diff --git a/gn/build/toolchain/host/BUILD.gn b/build/toolchain/host/BUILD.gn
similarity index 100%
rename from gn/build/toolchain/host/BUILD.gn
rename to build/toolchain/host/BUILD.gn
diff --git a/gn/build/toolchain/ios/BUILD.gn b/build/toolchain/ios/BUILD.gn
similarity index 100%
rename from gn/build/toolchain/ios/BUILD.gn
rename to build/toolchain/ios/BUILD.gn
diff --git a/gn/build_overrides/chip.gni b/build_overrides/chip.gni
similarity index 100%
rename from gn/build_overrides/chip.gni
rename to build_overrides/chip.gni
diff --git a/gn/build_overrides/efr32_sdk.gni b/build_overrides/efr32_sdk.gni
similarity index 100%
rename from gn/build_overrides/efr32_sdk.gni
rename to build_overrides/efr32_sdk.gni
diff --git a/gn/build_overrides/esp32.gni b/build_overrides/esp32.gni
similarity index 100%
rename from gn/build_overrides/esp32.gni
rename to build_overrides/esp32.gni
diff --git a/gn/build_overrides/jlink.gni b/build_overrides/jlink.gni
similarity index 100%
rename from gn/build_overrides/jlink.gni
rename to build_overrides/jlink.gni
diff --git a/gn/build_overrides/lwip.gni b/build_overrides/lwip.gni
similarity index 100%
rename from gn/build_overrides/lwip.gni
rename to build_overrides/lwip.gni
diff --git a/gn/build_overrides/mbedtls.gni b/build_overrides/mbedtls.gni
similarity index 100%
rename from gn/build_overrides/mbedtls.gni
rename to build_overrides/mbedtls.gni
diff --git a/gn/build_overrides/nlassert.gni b/build_overrides/nlassert.gni
similarity index 100%
rename from gn/build_overrides/nlassert.gni
rename to build_overrides/nlassert.gni
diff --git a/gn/build_overrides/nlfaultinjection.gni b/build_overrides/nlfaultinjection.gni
similarity index 100%
rename from gn/build_overrides/nlfaultinjection.gni
rename to build_overrides/nlfaultinjection.gni
diff --git a/gn/build_overrides/nlio.gni b/build_overrides/nlio.gni
similarity index 100%
rename from gn/build_overrides/nlio.gni
rename to build_overrides/nlio.gni
diff --git a/gn/build_overrides/nlunit_test.gni b/build_overrides/nlunit_test.gni
similarity index 100%
rename from gn/build_overrides/nlunit_test.gni
rename to build_overrides/nlunit_test.gni
diff --git a/gn/build_overrides/nrf5_sdk.gni b/build_overrides/nrf5_sdk.gni
similarity index 100%
rename from gn/build_overrides/nrf5_sdk.gni
rename to build_overrides/nrf5_sdk.gni
diff --git a/gn/build_overrides/openthread.gni b/build_overrides/openthread.gni
similarity index 100%
rename from gn/build_overrides/openthread.gni
rename to build_overrides/openthread.gni
diff --git a/gn/build_overrides/ot_br_posix.gni b/build_overrides/ot_br_posix.gni
similarity index 100%
rename from gn/build_overrides/ot_br_posix.gni
rename to build_overrides/ot_br_posix.gni
diff --git a/gn/build_overrides/pigweed.gni b/build_overrides/pigweed.gni
similarity index 100%
rename from gn/build_overrides/pigweed.gni
rename to build_overrides/pigweed.gni
diff --git a/config/esp32/.gn b/config/esp32/.gn
index 0838a64..5d73f66 100644
--- a/config/esp32/.gn
+++ b/config/esp32/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   target_cpu = "esp32"
   target_os = "freertos"
diff --git a/config/esp32/BUILD.gn b/config/esp32/BUILD.gn
index b4a9992..afae69d 100644
--- a/config/esp32/BUILD.gn
+++ b/config/esp32/BUILD.gn
@@ -17,7 +17,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/tests.gni")
 
 group("esp32") {
   deps = [ "${chip_root}/src/lib" ]
diff --git a/config/esp32/build b/config/esp32/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/config/esp32/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/config/nrfconnect/.gn b/config/nrfconnect/.gn
index 3d2aa51..cafc14f 100644
--- a/config/nrfconnect/.gn
+++ b/config/nrfconnect/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   target_cpu = "arm"
   target_os = "zephyr"
diff --git a/config/nrfconnect/BUILD.gn b/config/nrfconnect/BUILD.gn
index b62de85..d05a832 100644
--- a/config/nrfconnect/BUILD.gn
+++ b/config/nrfconnect/BUILD.gn
@@ -14,7 +14,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("//${chip_root}/gn/chip/tests.gni")
+import("//${chip_root}/build/chip/tests.gni")
 
 assert(current_os == "zephyr")
 
diff --git a/config/nrfconnect/build b/config/nrfconnect/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/config/nrfconnect/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/chip-tool/.gn b/examples/chip-tool/.gn
index 2129e6f..c3cfa5f 100644
--- a/examples/chip-tool/.gn
+++ b/examples/chip-tool/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   import("//args.gni")
 }
diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn
index 9e4b493..6e0df12 100644
--- a/examples/chip-tool/BUILD.gn
+++ b/examples/chip-tool/BUILD.gn
@@ -14,7 +14,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/tools.gni")
+import("${chip_root}/build/chip/tools.gni")
 
 assert(chip_build_tools)
 
diff --git a/examples/chip-tool/build b/examples/chip-tool/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/chip-tool/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/common/chip-app-server/.gn b/examples/common/chip-app-server/.gn
index 2129e6f..c3cfa5f 100644
--- a/examples/common/chip-app-server/.gn
+++ b/examples/common/chip-app-server/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   import("//args.gni")
 }
diff --git a/examples/common/chip-app-server/build b/examples/common/chip-app-server/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/common/chip-app-server/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/lighting-app/efr32/.gn b/examples/lighting-app/efr32/.gn
index 9453291..89dc9a6 100644
--- a/examples/lighting-app/efr32/.gn
+++ b/examples/lighting-app/efr32/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   target_cpu = "arm"
   target_os = "freertos"
diff --git a/examples/lighting-app/efr32/build b/examples/lighting-app/efr32/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/lighting-app/efr32/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/lighting-app/linux/.gn b/examples/lighting-app/linux/.gn
index 2129e6f..c3cfa5f 100644
--- a/examples/lighting-app/linux/.gn
+++ b/examples/lighting-app/linux/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   import("//args.gni")
 }
diff --git a/examples/lighting-app/linux/BUILD.gn b/examples/lighting-app/linux/BUILD.gn
index b59b94a..fd888c0 100644
--- a/examples/lighting-app/linux/BUILD.gn
+++ b/examples/lighting-app/linux/BUILD.gn
@@ -14,7 +14,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/tools.gni")
+import("${chip_root}/build/chip/tools.gni")
 
 assert(chip_build_tools)
 
diff --git a/examples/lighting-app/linux/build b/examples/lighting-app/linux/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/lighting-app/linux/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/lighting-app/nrf5/.gn b/examples/lighting-app/nrf5/.gn
index 9453291..89dc9a6 100644
--- a/examples/lighting-app/nrf5/.gn
+++ b/examples/lighting-app/nrf5/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   target_cpu = "arm"
   target_os = "freertos"
diff --git a/examples/lighting-app/nrf5/build b/examples/lighting-app/nrf5/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/lighting-app/nrf5/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/lock-app/efr32/.gn b/examples/lock-app/efr32/.gn
index 9453291..89dc9a6 100644
--- a/examples/lock-app/efr32/.gn
+++ b/examples/lock-app/efr32/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   target_cpu = "arm"
   target_os = "freertos"
diff --git a/examples/lock-app/efr32/build b/examples/lock-app/efr32/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/lock-app/efr32/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/lock-app/nrf5/.gn b/examples/lock-app/nrf5/.gn
index 9453291..89dc9a6 100644
--- a/examples/lock-app/nrf5/.gn
+++ b/examples/lock-app/nrf5/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   target_cpu = "arm"
   target_os = "freertos"
diff --git a/examples/lock-app/nrf5/build b/examples/lock-app/nrf5/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/lock-app/nrf5/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/lock-app/qpg6100/.gn b/examples/lock-app/qpg6100/.gn
index 9453291..89dc9a6 100644
--- a/examples/lock-app/qpg6100/.gn
+++ b/examples/lock-app/qpg6100/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   target_cpu = "arm"
   target_os = "freertos"
diff --git a/examples/lock-app/qpg6100/build b/examples/lock-app/qpg6100/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/lock-app/qpg6100/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/pigweed-app/nrf5/.gn b/examples/pigweed-app/nrf5/.gn
index 9453291..89dc9a6 100644
--- a/examples/pigweed-app/nrf5/.gn
+++ b/examples/pigweed-app/nrf5/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   target_cpu = "arm"
   target_os = "freertos"
diff --git a/examples/pigweed-app/nrf5/build b/examples/pigweed-app/nrf5/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/pigweed-app/nrf5/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/examples/shell/.gn b/examples/shell/.gn
index 3d95fb6..18f0058 100644
--- a/examples/shell/.gn
+++ b/examples/shell/.gn
@@ -18,9 +18,6 @@
 # CHIP uses angle bracket includes.
 check_system_includes = true
 
-# Allow loading paths relative to //gn.
-secondary_source = "//third_party/connectedhomeip/gn/"
-
 default_args = {
   chip_build_tests = false
 }
diff --git a/examples/shell/BUILD.gn b/examples/shell/BUILD.gn
index bfed59c..d1d774a 100644
--- a/examples/shell/BUILD.gn
+++ b/examples/shell/BUILD.gn
@@ -124,7 +124,7 @@
     deps = [ ":nrf5" ]
   }
 } else {
-  import("${chip_root}/gn/chip/tools.gni")
+  import("${chip_root}/build/chip/tools.gni")
 
   assert(chip_build_tools)
 
diff --git a/examples/shell/build b/examples/shell/build
new file mode 120000
index 0000000..d56ed62
--- /dev/null
+++ b/examples/shell/build
@@ -0,0 +1 @@
+third_party/connectedhomeip/build
\ No newline at end of file
diff --git a/src/BUILD.gn b/src/BUILD.gn
index aae3931..09c7162 100644
--- a/src/BUILD.gn
+++ b/src/BUILD.gn
@@ -14,7 +14,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/tests.gni")
 import("${chip_root}/src/lwip/lwip.gni")
 import("${chip_root}/src/platform/device.gni")
 
@@ -33,7 +33,7 @@
 }
 
 if (chip_build_tests) {
-  import("${chip_root}/gn/chip/chip_test_group.gni")
+  import("${chip_root}/build/chip/chip_test_group.gni")
 
   chip_test_group("tests") {
     deps = [
diff --git a/src/ble/BUILD.gn b/src/ble/BUILD.gn
index 0e305d3..ae457f5 100644
--- a/src/ble/BUILD.gn
+++ b/src/ble/BUILD.gn
@@ -14,8 +14,8 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/buildconfig_header.gni")
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/buildconfig_header.gni")
+import("${chip_root}/build/chip/tests.gni")
 import("${chip_root}/src/platform/device.gni")
 import("ble.gni")
 
diff --git a/src/ble/tests/BUILD.gn b/src/ble/tests/BUILD.gn
index cffcf91..e9990bd 100644
--- a/src/ble/tests/BUILD.gn
+++ b/src/ble/tests/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 chip_test_suite("tests") {
   output_name = "libBleLayerTests"
diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn
index 4dfd2eb..d4281fc 100644
--- a/src/controller/java/BUILD.gn
+++ b/src/controller/java/BUILD.gn
@@ -13,8 +13,9 @@
 # limitations under the License.
 
 import("//build_overrides/chip.gni")
-import("//gn/build/config/android_abi.gni")
-import("//gn/chip/java/rules.gni")
+
+import("//build/config/android_abi.gni")
+import("${chip_root}/build/chip/java/rules.gni")
 
 shared_library("jni") {
   output_name = "libCHIPController"
diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn
index d14be7d..79bdd79 100644
--- a/src/controller/python/BUILD.gn
+++ b/src/controller/python/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/pigweed.gni")
 
-import("${chip_root}/gn/chip/tools.gni")
+import("${chip_root}/build/chip/tools.gni")
 import("${dir_pw_unit_test}/test.gni")
 
 config("controller_wno_deprecate") {
@@ -118,7 +118,10 @@
 
   public_deps = [ ":ChipDeviceCtrl" ]
 
-  pythontags = exec_script("//chip/python_gen_tags.py", [], "list lines", [])
+  pythontags = exec_script("${chip_root}/build/chip/python_gen_tags.py",
+                           [],
+                           "list lines",
+                           [])
   pythontagsStr = string_join("", pythontags)
   output_name = "chip-0.0-$pythontagsStr.whl"
   outputs = [ "${_dist_dir}/$output_name" ]
diff --git a/src/crypto/BUILD.gn b/src/crypto/BUILD.gn
index 1734303..d04538e 100644
--- a/src/crypto/BUILD.gn
+++ b/src/crypto/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlassert.gni")
 
-import("${chip_root}/gn/chip/buildconfig_header.gni")
+import("${chip_root}/build/chip/buildconfig_header.gni")
 
 import("crypto.gni")
 
diff --git a/src/crypto/tests/BUILD.gn b/src/crypto/tests/BUILD.gn
index 915431c..3ce968d 100644
--- a/src/crypto/tests/BUILD.gn
+++ b/src/crypto/tests/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 chip_test_suite("tests") {
   output_name = "libChipCryptoTests"
diff --git a/src/inet/BUILD.gn b/src/inet/BUILD.gn
index 9508893..93576e7 100644
--- a/src/inet/BUILD.gn
+++ b/src/inet/BUILD.gn
@@ -17,8 +17,8 @@
 import("//build_overrides/nlfaultinjection.gni")
 import("//build_overrides/nlio.gni")
 
-import("${chip_root}/gn/chip/buildconfig_header.gni")
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/buildconfig_header.gni")
+import("${chip_root}/build/chip/tests.gni")
 import("${chip_root}/src/lwip/lwip.gni")
 import("${chip_root}/src/platform/device.gni")
 import("inet.gni")
diff --git a/src/inet/tests/BUILD.gn b/src/inet/tests/BUILD.gn
index 33d2069..ec1cc83 100644
--- a/src/inet/tests/BUILD.gn
+++ b/src/inet/tests/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 import("${chip_root}/src/lwip/lwip.gni")
 import("${chip_root}/src/platform/device.gni")
 
diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn
index 26fa0d2..ee2156e 100644
--- a/src/lib/core/BUILD.gn
+++ b/src/lib/core/BUILD.gn
@@ -15,8 +15,8 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlio.gni")
 
-import("${chip_root}/gn/chip/buildconfig_header.gni")
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/buildconfig_header.gni")
+import("${chip_root}/build/chip/tests.gni")
 import("${chip_root}/src/inet/inet.gni")
 import("core.gni")
 
diff --git a/src/lib/core/tests/BUILD.gn b/src/lib/core/tests/BUILD.gn
index 06951cf..d11d0bc 100644
--- a/src/lib/core/tests/BUILD.gn
+++ b/src/lib/core/tests/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 chip_test_suite("tests") {
   output_name = "libCoreTests"
diff --git a/src/lib/message/BUILD.gn b/src/lib/message/BUILD.gn
index f94b685..c09172d 100644
--- a/src/lib/message/BUILD.gn
+++ b/src/lib/message/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlio.gni")
 
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/tests.gni")
 import("${chip_root}/src/inet/inet.gni")
 
 config("includes") {
diff --git a/src/lib/shell/tests/BUILD.gn b/src/lib/shell/tests/BUILD.gn
index 72b16b8..84eec37 100644
--- a/src/lib/shell/tests/BUILD.gn
+++ b/src/lib/shell/tests/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 chip_test_suite("tests") {
   output_name = "libTestShell"
diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn
index 0746b0a..159b223 100644
--- a/src/lib/support/BUILD.gn
+++ b/src/lib/support/BUILD.gn
@@ -17,8 +17,8 @@
 import("//build_overrides/nlfaultinjection.gni")
 import("//build_overrides/nlio.gni")
 
-import("${chip_root}/gn/chip/chip_version.gni")
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/chip_version.gni")
+import("${chip_root}/build/chip/tests.gni")
 import("${chip_root}/src/lib/core/core.gni")
 
 action("gen_chip_version") {
diff --git a/src/lib/support/tests/BUILD.gn b/src/lib/support/tests/BUILD.gn
index e238201..4589937 100644
--- a/src/lib/support/tests/BUILD.gn
+++ b/src/lib/support/tests/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 chip_test_suite("tests") {
   output_name = "libSupportTests"
diff --git a/src/lwip/BUILD.gn b/src/lwip/BUILD.gn
index b9aaac9..533081c 100644
--- a/src/lwip/BUILD.gn
+++ b/src/lwip/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/lwip.gni")
 
-import("${chip_root}/gn/chip/buildconfig_header.gni")
+import("${chip_root}/build/chip/buildconfig_header.gni")
 import("${chip_root}/src/lwip/lwip.gni")
 import("${lwip_root}/lwip.gni")
 
diff --git a/src/lwip/tests/BUILD.gn b/src/lwip/tests/BUILD.gn
index 71c06be..3a5db9d 100644
--- a/src/lwip/tests/BUILD.gn
+++ b/src/lwip/tests/BUILD.gn
@@ -14,8 +14,8 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/chip_test.gni")
-import("${chip_root}/gn/chip/chip_test_group.gni")
+import("${chip_root}/build/chip/chip_test.gni")
+import("${chip_root}/build/chip/chip_test_group.gni")
 import("${chip_root}/src/lwip/lwip.gni")
 
 assert(chip_with_lwip)
diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn
index 2cb059d..d05fa68 100644
--- a/src/platform/BUILD.gn
+++ b/src/platform/BUILD.gn
@@ -16,7 +16,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlio.gni")
 
-import("${chip_root}/gn/chip/buildconfig_header.gni")
+import("${chip_root}/build/chip/buildconfig_header.gni")
 
 import("device.gni")
 
diff --git a/src/platform/Linux/dbus/bluez/BUILD.gn b/src/platform/Linux/dbus/bluez/BUILD.gn
index 5526468..308fecc 100644
--- a/src/platform/Linux/dbus/bluez/BUILD.gn
+++ b/src/platform/Linux/dbus/bluez/BUILD.gn
@@ -14,7 +14,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/linux/gdbus_library.gni")
+import("${chip_root}/build/chip/linux/gdbus_library.gni")
 
 gdbus_library("bluez") {
   sources = [ "DbusBluez.xml" ]
diff --git a/src/platform/Linux/dbus/wpa/BUILD.gn b/src/platform/Linux/dbus/wpa/BUILD.gn
index b7fb884..9fdd7e5 100644
--- a/src/platform/Linux/dbus/wpa/BUILD.gn
+++ b/src/platform/Linux/dbus/wpa/BUILD.gn
@@ -14,7 +14,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/linux/gdbus_library.gni")
+import("${chip_root}/build/chip/linux/gdbus_library.gni")
 
 gdbus_library("wpa") {
   sources = [
diff --git a/src/platform/tests/BUILD.gn b/src/platform/tests/BUILD.gn
index fbdd018..1574aa2 100644
--- a/src/platform/tests/BUILD.gn
+++ b/src/platform/tests/BUILD.gn
@@ -18,7 +18,7 @@
 import("${chip_root}/src/platform/device.gni")
 
 if (chip_device_platform != "none") {
-  import("${chip_root}/gn/chip/chip_test_suite.gni")
+  import("${chip_root}/build/chip/chip_test_suite.gni")
 
   chip_test_suite("tests") {
     output_name = "libPlatformTests"
@@ -70,7 +70,7 @@
     }
   }
 } else {
-  import("${chip_root}/gn/chip/chip_test_group.gni")
+  import("${chip_root}/build/chip/chip_test_group.gni")
   chip_test_group("tests") {
     deps = []
   }
diff --git a/src/qrcodetool/BUILD.gn b/src/qrcodetool/BUILD.gn
index 455f6c6..4ebbd90 100644
--- a/src/qrcodetool/BUILD.gn
+++ b/src/qrcodetool/BUILD.gn
@@ -14,7 +14,7 @@
 
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/tools.gni")
+import("${chip_root}/build/chip/tools.gni")
 
 assert(chip_build_tools)
 
diff --git a/src/setup_payload/java/BUILD.gn b/src/setup_payload/java/BUILD.gn
index aa65fc8..88e82eb 100644
--- a/src/setup_payload/java/BUILD.gn
+++ b/src/setup_payload/java/BUILD.gn
@@ -13,8 +13,9 @@
 # limitations under the License.
 
 import("//build_overrides/chip.gni")
-import("//gn/build/config/android_abi.gni")
-import("//gn/chip/java/rules.gni")
+
+import("//build/config/android_abi.gni")
+import("${chip_root}/build/chip/java/rules.gni")
 
 shared_library("jni") {
   output_name = "libSetupPayloadParser"
diff --git a/src/setup_payload/tests/BUILD.gn b/src/setup_payload/tests/BUILD.gn
index a25aab2..9a263e4 100644
--- a/src/setup_payload/tests/BUILD.gn
+++ b/src/setup_payload/tests/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 chip_test_suite("tests") {
   output_name = "libSetupPayloadTests"
diff --git a/src/system/BUILD.gn b/src/system/BUILD.gn
index bd22ec0..d0dc4ef 100644
--- a/src/system/BUILD.gn
+++ b/src/system/BUILD.gn
@@ -16,8 +16,8 @@
 import("//build_overrides/nlassert.gni")
 import("//build_overrides/nlfaultinjection.gni")
 
-import("${chip_root}/gn/chip/buildconfig_header.gni")
-import("${chip_root}/gn/chip/tests.gni")
+import("${chip_root}/build/chip/buildconfig_header.gni")
+import("${chip_root}/build/chip/tests.gni")
 import("${chip_root}/src/platform/device.gni")
 import("system.gni")
 
diff --git a/src/system/tests/BUILD.gn b/src/system/tests/BUILD.gn
index 3400a6b..b76abe3 100644
--- a/src/system/tests/BUILD.gn
+++ b/src/system/tests/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build_overrides/chip.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 chip_test_suite("tests") {
   output_name = "libSystemLayerTests"
diff --git a/src/transport/raw/tests/BUILD.gn b/src/transport/raw/tests/BUILD.gn
index f6dcf0d..bad5a23 100644
--- a/src/transport/raw/tests/BUILD.gn
+++ b/src/transport/raw/tests/BUILD.gn
@@ -16,7 +16,7 @@
 import("//build_overrides/nlio.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 static_library("helpers") {
   output_name = "libNetworkTestHelpers"
diff --git a/src/transport/retransmit/tests/BUILD.gn b/src/transport/retransmit/tests/BUILD.gn
index 096ab5d..2872fb2 100644
--- a/src/transport/retransmit/tests/BUILD.gn
+++ b/src/transport/retransmit/tests/BUILD.gn
@@ -16,7 +16,7 @@
 import("//build_overrides/nlio.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 chip_test_suite("tests") {
   output_name = "libRetransmitTests"
diff --git a/src/transport/tests/BUILD.gn b/src/transport/tests/BUILD.gn
index a750c9d..5005e0a 100644
--- a/src/transport/tests/BUILD.gn
+++ b/src/transport/tests/BUILD.gn
@@ -16,7 +16,7 @@
 import("//build_overrides/nlio.gni")
 import("//build_overrides/nlunit_test.gni")
 
-import("${chip_root}/gn/chip/chip_test_suite.gni")
+import("${chip_root}/build/chip/chip_test_suite.gni")
 
 chip_test_suite("tests") {
   output_name = "libTransportLayerTests"
diff --git a/third_party/jlink/segger_rtt/RTT/BUILD.gn b/third_party/jlink/segger_rtt/RTT/BUILD.gn
index 007c506..fd2769b 100644
--- a/third_party/jlink/segger_rtt/RTT/BUILD.gn
+++ b/third_party/jlink/segger_rtt/RTT/BUILD.gn
@@ -15,7 +15,7 @@
 import("//build/config/arm.gni")
 import("//build_overrides/chip.gni")
 
-import("${chip_root}/gn/chip/buildconfig_header.gni")
+import("${chip_root}/build/chip/buildconfig_header.gni")
 
 declare_args() {
   # Size of SEGGER RTT up buffer.