IMPORTANT: The Bazel docs have moved! Please update your bookmark to https://bazel.build/rules/lib/CompilationContext

You can read about the migration, and let us know what you think.

Extensions > API reference > CompilationContext

CompilationContext

Immutable store of information needed for C++ compilation that is aggregated across dependencies.

defines

depset CompilationContext.defines

Returns the set of defines needed to compile this target. Each define is a string. These values are propagated to the target's transitive dependents, that is, any rules that depend on this target.

direct_headers

list CompilationContext.direct_headers

Returns the list of modular headers that are declared by this target. This includes both public headers (such as those listed in "hdrs") and private headers (such as those listed in "srcs").

direct_private_headers

list CompilationContext.direct_private_headers

Returns the list of modular private headers (those listed in "srcs") that are declared by this target.

direct_public_headers

list CompilationContext.direct_public_headers

Returns the list of modular public headers (those listed in "hdrs") that are declared by this target.

direct_textual_headers

list CompilationContext.direct_textual_headers

Returns the list of textual headers that are declared by this target.

framework_includes

depset CompilationContext.framework_includes

Returns the set of search paths (as strings) for framework header files. Usually passed with -F.

headers

depset CompilationContext.headers

Returns the set of headers needed to compile this target.

includes

depset CompilationContext.includes

Returns the set of search paths (as strings) for header files referenced both by angle bracket and quotes. Usually passed with -I.

local_defines

depset CompilationContext.local_defines

Returns the set of defines needed to compile this target. Each define is a string. These values are not propagated to the target's transitive dependents.

quote_includes

depset CompilationContext.quote_includes

Returns the set of search paths (as strings) for header files referenced by quotes, e.g. #include "foo/bar/header.h". They can be either relative to the exec root or absolute. Usually passed with -iquote.

system_includes

depset CompilationContext.system_includes

Returns the set of search paths (as strings) for header files referenced by angle brackets, e.g. #include <foo/bar/header.h>. They can be either relative to the exec root or absolute. Usually passed with -isystem.

validation_artifacts

depset CompilationContext.validation_artifacts

Returns the set of validation artifacts.