some_toolchain(“demo_toolchain”) {
toolchain_args {
toolchain_import = “//build/args/demo.gni”
use_goma = true
}
}
The //build/args/demo.gni contains:demo_flag = “demo”
use_goma = false
The definition will be equivalent to:some_toolchain(“demo_toolchain”) {
toolchain_args {
demo_flag = “demo”
use_goma = true
}
}
Please correct me if I'm wrong. It's different in several ways:1 The gni file here only contains key value pairs.It's similar to what you define args.gn file, like:use_some_flag = "some content"other_flag = trueBut for 'import', a new variant needs to be defined in declare_args().
2 Won't raise error for conflictsFor 'import', it will raise error. But for this 'toolchain_import', it will ignore if the key already existed.
On Tue, Nov 23, 2021 at 4:50 PM Roland McGrath <mcgr...@chromium.org> wrote:You can use `import` inside a scope object:toolchain_args = {import("//build/args/demo.gni")use_goma = true
}How does your new feature differ from just doing that?On Tue, Nov 23, 2021 at 3:54 PM Sven Zheng <sven...@chromium.org> wrote:Hi gn dev,I want to make a design proposal for gn. Please review and leave feedback. Doc access has been given to all chromium@ accounts. If you can't access it, please request.An example for the new keyword:Say we have a toolchain definedsome_toolchain(“demo_toolchain”) {
toolchain_args {
toolchain_import = “//build/args/demo.gni”
use_goma = true
}
}
The //build/args/demo.gni contains:demo_flag = “demo”
use_goma = false
The definition will be equivalent to:some_toolchain(“demo_toolchain”) {
toolchain_args {
demo_flag = “demo”
use_goma = true
}
}
--
To unsubscribe from this group and stop receiving emails from it, send an email to gn-dev+un...@chromium.org.
You can indeed do import inside any scope and it's just like defining those variables in that scope any other way.What I overlooked is that the proposal apparently plumbs things through without making them build arguments with `declare_args()`, if I'm following Sven.
I'm inclined to agree with Roland, but the code where this checking is being done is kinda central to GN and it's been around forever, so I'd want to check w/ brettw@ to see if he knows of a reason we want this to be an error.
\On Wed, Dec 1, 2021 at 1:09 PM Dirk Pranke <dpr...@google.com> wrote:I'm inclined to agree with Roland, but the code where this checking is being done is kinda central to GN and it's been around forever, so I'd want to check w/ brettw@ to see if he knows of a reason we want this to be an error.This just means that we would only check for collisions of variables set on the scope directly, not inherited from the enclosing scopes, right? That sounds OK to change to me.