mozbuild.compilation package


mozbuild.compilation.codecomplete module

class mozbuild.compilation.codecomplete.Introspection(context)

Bases: mozbuild.base.MachCommandBase

Instropection commands.


mozbuild.compilation.database module

class mozbuild.compilation.database.CompileDBBackend(environment)

Bases: mozbuild.backend.common.CommonBackend

CFLAGS = {'.c': 'CFLAGS', '.cpp': 'CXXFLAGS', '.m': 'CFLAGS', '.mm': 'CXXFLAGS'}
COMPILERS = {'.c': 'CC', '.cpp': 'CXX', '.m': 'CC', '.mm': 'CXX'}

mozbuild.compilation.util module

mozbuild.compilation.util.get_build_vars(directory, cmd)

mozbuild.compilation.warnings module

class mozbuild.compilation.warnings.CompilerWarning

Bases: dict

Represents an individual compiler warning.


Returns a copy of this compiler warning.

class mozbuild.compilation.warnings.WarningsCollector(cb, objdir=None)

Bases: object

Collects warnings from text data.

Instances of this class receive data (usually the output of compiler invocations) and parse it into warnings.

The collector works by incrementally receiving data, usually line-by-line output from the compiler. Therefore, it can maintain state to parse multi-line warning messages.


Take a line of text and process it for a warning.

class mozbuild.compilation.warnings.WarningsDatabase

Bases: object

Holds a collection of warnings.

The warnings database is a semi-intelligent container that holds warnings encountered during builds.

The warnings database is backed by a JSON file. But, that is transparent to consumers.

Under most circumstances, the warnings database is insert only. When a warning is encountered, the caller simply blindly inserts it into the database. The database figures out whether it is a dupe, etc.

During the course of development, it is common for warnings to change slightly as source code changes. For example, line numbers will disagree. The WarningsDatabase handles this by storing the hash of a file a warning occurred in. At warning insert time, if the hash of the file does not match what is stored in the database, the existing warnings for that file are purged from the database.

Callers should periodically prune old, invalid warnings from the database by calling prune(). A good time to do this is at the end of a build.


Load serialized content from a handle into the current instance.


Whether we have any warnings for the specified file.

insert(warning, compute_hash=True)

Load the database from a file.


Prune the contents of the database.

This removes warnings that are no longer valid. A warning is no longer valid if the file it was in no longer exists or if the content has changed.

The check for changed content catches the case where a file previously contained warnings but no longer does.


Save the database to a file.


Serialize the database to an open file handle.


Returns a mapping of warning types to their counts.


All the CompilerWarning instances in this database.


Obtain the warnings for the specified file.

Module contents