Do not use the root scope for BUILDCONFIG.gn. Create a new scope for BUILDCONFIG.gn with the correct current directory setting. This fixes relative path resolution in BUILDCONFIG.gn when BUILDCONFIG.gn is not in the root directory. Change-Id: If39c3467d8983cbe41020a07a57caf67687a9fa7 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/5500 Reviewed-by: Brett Wilson <brettw@chromium.org> Commit-Queue: Brett Wilson <brettw@chromium.org>
diff --git a/AUTHORS b/AUTHORS index 417cc5f..17b4959 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -20,6 +20,7 @@ Yandex LLC <*@yandex-team.ru> Alexis Menard <alexis.menard@intel.com> +Alfredo Mazzinghi <mzz.lrd@gmail.com> Andrew Boyarshin <andrew.boyarshin@gmail.com> Anuj Kumar Sharma <anujk.sharma@samsung.com> DanCraft99 <simputest@gmail.com>
diff --git a/tools/gn/loader.cc b/tools/gn/loader.cc index b0f81bc..b53b094 100644 --- a/tools/gn/loader.cc +++ b/tools/gn/loader.cc
@@ -310,7 +310,10 @@ trace.SetToolchain(settings->toolchain_label()); Err err; - root->Execute(base_config, &err); + Scope our_scope(base_config); + our_scope.set_source_dir( + settings->build_settings()->build_config_file().GetDir()); + root->Execute(&our_scope, &err); // Clear all private variables left in the scope. We want the root build // config to be like a .gni file in that variables beginning with an