I'm not sure if this is the correct place to post this. I guess I can get help/feedbacks from some gn experts.
We want to experiment building chrome with libc++ clang modules crbug.com/1430964
and add a gn arg (use_libcxx_module_experimental) to switch it.
When this arg is true, add module related compiler flags in //build/config/c++:runtime_library. One of added compiler flag -fmodule-map-file= takes a module map file as input, which can only be generated using a python script. So, we need an action to generate it. In order to make sure the module map file is always generated when -fmodule-map-file is used, I changed //build/config/compiler:runtime_library from a config to a group that depends the action. Thus I need to remove //build/config/compiler:runtime_library from default_compiler_configs and added a default_compiler_deps as a dependency for targets uses default_compiler_configs.
`default_compiler_deps = [ "//build/config/compiler:runtime_library" ]`
But that causes an issue that most targets add dependencies using "dep = [...]" rather than "dep += [...]" and dep now has a default default_compiler_deps, so gn complains about:
ERROR at //tools/aggregation_service/BUILD.gn:16:3: Replacing nonempty list.
deps = [
And by just searching "dep =" in BUILD.gn and *.gni files, it shows that there are 12000+ matches. It looks like unrealistic to change all of them to "dep +=" as that would requires lots of reviewers.
So, my question is that is there any other ways to have a config depends on an action?
Another simple solution I could think about is to use exec_script as an action, which is undesired.