--
You received this message because you are subscribed to the Google Groups "gn-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gn-dev+un...@chromium.org.
In practical terms I think the main disadvantage of ninja -t compdb is that it needs to be fed a list of rule names that for GN has to be derived from a subset of the list of GN toolchains, which only GN knows in any general way. The issue of wiring up the action to regenerate the compdb when build.ninja is regenerated is more of a wart that can be figured out some way or another. OTOH, in the abstract it really ought to be gn gen that emits compdb since it's what decides all that information and ninja is just a "dumb" runner of commands at its behest.I think there's no question that having reliable compdb generation is a very useful feature. Important consumers of compdb already exist and being able to integrate some of them directly into a GN build is a worthwhile goal.
To unsubscribe from this group and stop receiving emails from it, send an email to gn-dev+unsubscribe@chromium.org.
I wonder if it would make sense to add a setting to the dotfile for a project so that you could specify a default IDE script for this (or similar things).I'd guess that we might not want to just generate the compilation database all the time, because it would slow GN down, but someone could run some benchmarks to see what the real impact would be.
--
You received this message because you are subscribed to the Google Groups "gn-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gn-dev+un...@chromium.org.
I agree with Brett's complain about GN's slowness in Fuchsia. AFAIK that's mostly due to excessive use of exec_script to do all kinds of things. These generally fall into a few categories
- Generating GN files from's Zircon's Make build in https://fuchsia.googlesource.com/build/+/master/gn/BUILD.gn#78. This is probably the most expensive step. The only solution is to not do that which requires changes to Zircon build that are under way.
- Generating the set of targets to build via the "package system" in https://fuchsia.googlesource.com/build/+/master/gn/packages.gni; each package (a JSON file with list of GN labels) describes GN targets that will be built and combined into a final system image, which is the default target that needs to depend on all these targets that aren't known ahead of time. I believe the tagging/metadata feature should allow replacing that part to large extent.
- Basic string manipulations which is heavily used in integration of things like Rust, Dart or FIDL (e.g. https://fuchsia.googlesource.com/build/+/master/cpp/fidl_cpp_stem_from_library.py, https://fuchsia.googlesource.com/build/+/master/dart/fidl_package_from_library.py, https://fuchsia.googlesource.com/build/+/master/dart/fidl_package_from_library.py) to do things like replace('-', '_') and replace('.', '_'). One way to avoid that would be to provide a few basic string manipulation functions (e.g. replace) directly in GN.
Going back to the original point of the compilation database, I'm personally fine having an option that enables generation of compdb as long as that flag is preserved across gn gen reruns. The problem is that it makes the gn gen invocation more complicated, which means that many people will use some kind of wrapper to avoid having to remember to always pass the option.One possible alternative I could think of would be a support for dotfile so developers could create e.g. .gn file in the root of their project and put extra arguments they'd like to pass to each gn gen invocation there. We would put .gn into .gitignore to make sure people don't accidentally check it into the repository.
A different approach that I've often thought about would be to split GN's work into two phases: the first would compute the graph and call exec_script(), but not write anything. The second would writes all the files, and would not run for things like `desc`.That would still rely on exec_script() being read-only (and hopefully idempotent, at least for a given version of the checkout), and that you didn't have weird interactions between write_runtime_deps and exec_script(), but I think it's a much smaller change than serializing the graph. I'm not sure what the perf impact would be but hopefully it wouldn't be too bad.