Hello all,
While investigating an
issue in Chromium, I found that when defining a toolchain, the scope passed to the toolchain is evaluated in the context of the previous toolchain. By that, I meant that any variables coming from the global scope are those from the previous toolchain, even if their definition depends on `toolchain_args` overridden by the toolchain.
I understand that this is probably because the scope is evaluated before the toolchain can be defined, but this can lead to surprises if the toolchain uses variables from the global scope whose value ends up modified when the `toolchain_args` are applied (such as `is_component_build` in Chromium).
I've reported this as
issue 286 but I'm not sure what to do.
First is this documented and defined as the expected interaction between defining a toolchain and overriding globals via `toolchain_args`. I've looked at `gn help toolchain` and even after my investigation, I'm still unclear whether this is documented.
If this is not the expected behaviour, how can we fix this?
- Should the toolchain only use the `toolchain_args`, create the new toolchain context using the new overrides, and then evalue again the toolchain definition in that context?
- Should the toolchain complain if its definition uses variables from the global scope that depends on any value overridden in `toolchain_args`? Or any variable from global scope?
- Any other suggestions?
Regards,
-- Sylvain