the Chromium logo

The Chromium Projects

Generated files

Many files are generated as part of the Chrome build. Fundamentally these are treated the same as static files (files checked into the repo), but have various subtleties. In many cases the build configuration file will be named generated.{gn,gyp,gypi} or similar.

Location

Generated files are output in $CHROMIUM_DIR/out/$BUILD_TYPE/gen, as in src/out/Release/gen.

These are indexed in code search in src/out/Debug/gen.

Because this is a different directory than static files, any behavior must be separately specified for generated files, notably:

Outputs (esp. .pyc)

All generated files must be listed in the outputs of the build step. If not, these files won't be cleaned up (notably by ninja -t clean), and then the build won't function properly (it will rebuild excessively). One case of this are byte-compiled Python files (.pyc), which are implicitly generated on import: if you generate Python files, you must also list the .pyc files in the outputs. See Bug 397909 and CL 463063003.

Clobber build

Moving generated files can break incremental builds, and thus requires a "clobber build" (i.e., full, clean build: delete all generated files). This is because the build does not delete old generated files, so a stale file may be used, notably via includes of headers with unqualified paths.

This shows up as generated files appearing to not be regenerated, though in fact the files are being generated in a new location; see for example Issue 381111 (comment).

To avoid this (see also Chromium clobber landmines: moving generated files):

Dependencies

Currently checkdeps is not run on generated files (Issue 365190), so generated files can break componentization.