mozbuild.backend package¶
Submodules¶
mozbuild.backend.android_eclipse module¶
-
class
mozbuild.backend.android_eclipse.
AndroidEclipseBackend
(environment)¶ Bases:
mozbuild.backend.common.CommonBackend
Backend that generates Android Eclipse project files.
-
consume_finished
()¶ The common backend handles WebIDL and test files. We don’t handle these, so we don’t call our superclass.
-
consume_object
(obj)¶ Write out Android Eclipse project files.
-
summary
()¶
-
-
mozbuild.backend.android_eclipse.
pretty_print
(element)¶ Return a pretty-printed XML string for an Element.
mozbuild.backend.base module¶
-
class
mozbuild.backend.base.
BuildBackend
(environment)¶ Bases:
mach.mixin.logging.LoggingMixin
Abstract base class for build backends.
A build backend is merely a consumer of the build configuration (the output of the frontend processing). It does something with said data. What exactly is the discretion of the specific implementation.
-
consume
(objs)¶ Consume a stream of TreeMetadata instances.
This is the main method of the interface. This is what takes the frontend output and does something with it.
Child classes are not expected to implement this method. Instead, the base class consumes objects and calls methods (possibly) implemented by child classes.
-
consume_finished
()¶ Called when consume() has completed handling all objects.
-
consume_object
(obj)¶ Consumes an individual TreeMetadata instance.
This is the main method used by child classes to react to build metadata.
-
summary
()¶
-
-
mozbuild.backend.base.
HybridBackend
(*backends)¶ A HybridBackend is the combination of one or more PartialBackends with a non-partial BuildBackend.
Build configuration objects are passed to each backend, stopping at the first of them that declares having handled them.
-
class
mozbuild.backend.base.
PartialBackend
(environment)¶ Bases:
mozbuild.backend.base.BuildBackend
A PartialBackend is a BuildBackend declaring that its consume_object method may not handle all build configuration objects it’s passed, and that it’s fine.
mozbuild.backend.common module¶
-
class
mozbuild.backend.common.
BinariesCollection
¶ Bases:
object
Tracks state of binaries produced by the build.
-
class
mozbuild.backend.common.
CommonBackend
(environment)¶ Bases:
mozbuild.backend.base.BuildBackend
Holds logic common to all build backends.
-
consume_finished
()¶
-
consume_object
(obj)¶
-
-
class
mozbuild.backend.common.
TestManager
(config)¶ Bases:
object
Helps hold state related to tests.
-
add
(t, flavor, topsrcdir, default_supp_files)¶
-
add_installs
(obj, topsrcdir)¶
-
-
class
mozbuild.backend.common.
WebIDLCollection
¶ Bases:
object
Collects WebIDL info referenced during the build.
-
all_basenames
()¶
-
all_non_static_basenames
()¶
-
all_non_static_sources
()¶
-
all_preprocessed_sources
()¶
-
all_regular_basenames
()¶
-
all_regular_bindinggen_stems
()¶
-
all_regular_cpp_basenames
()¶
-
all_regular_sources
()¶
-
all_regular_stems
()¶
-
all_sources
()¶
-
all_static_sources
()¶
-
all_stems
()¶
-
all_test_basenames
()¶
-
all_test_cpp_basenames
()¶
-
all_test_sources
()¶
-
all_test_stems
()¶
-
generated_events_basenames
()¶
-
generated_events_stems
()¶
-
mozbuild.backend.configenvironment module¶
-
class
mozbuild.backend.configenvironment.
BuildConfig
¶ Bases:
object
Represents the output of configure.
-
classmethod
from_config_status
(path)¶ Create an instance from a config.status file.
-
classmethod
-
class
mozbuild.backend.configenvironment.
ConfigEnvironment
(topsrcdir, topobjdir, defines=None, non_global_defines=None, substs=None, source=None, mozconfig=None)¶ Bases:
object
Perform actions associated with a configured but bare objdir.
The purpose of this class is to preprocess files from the source directory and output results in the object directory.
There are two types of files: config files and config headers, each treated through a different member function.
- Creating a ConfigEnvironment requires a few arguments:
- topsrcdir and topobjdir are, respectively, the top source and the top object directory.
- defines is a dict filled from AC_DEFINE and AC_DEFINE_UNQUOTED in autoconf.
- non_global_defines are a list of names appearing in defines above that are not meant to be exported in ACDEFINES (see below)
- substs is a dict filled from AC_SUBST in autoconf.
ConfigEnvironment automatically defines one additional substs variable from all the defines not appearing in non_global_defines:
- ACDEFINES contains the defines in the form -DNAME=VALUE, for use on preprocessor command lines. The order in which defines were given when creating the ConfigEnvironment is preserved.
- and two other additional subst variables from all the other substs:
- ALLSUBSTS contains the substs in the form NAME = VALUE, in sorted order, for use in autoconf.mk. It includes ACDEFINES Only substs with a VALUE are included, such that the resulting file doesn’t change when new empty substs are added. This results in less invalidation of build dependencies in the case of autoconf.mk..
- ALLEMPTYSUBSTS contains the substs with an empty value, in the form NAME =.
ConfigEnvironment expects a “top_srcdir” subst to be set with the top source directory, in msys format on windows. It is used to derive a “srcdir” subst when treating config files. It can either be an absolute path or a path relative to the topobjdir.
-
static
from_config_status
(path)¶
-
is_artifact_build
¶
mozbuild.backend.cpp_eclipse module¶
mozbuild.backend.fastermake module¶
-
class
mozbuild.backend.fastermake.
FasterMakeBackend
(environment)¶ Bases:
mozbuild.backend.common.CommonBackend
,mozbuild.backend.base.PartialBackend
-
consume_finished
()¶
-
consume_object
(obj)¶
-
mozbuild.backend.mach_commands module¶
mozbuild.backend.recursivemake module¶
-
class
mozbuild.backend.recursivemake.
BackendMakeFile
(srcdir, objdir, environment, topsrcdir, topobjdir)¶ Bases:
object
Represents a generated backend.mk file.
This is both a wrapper around a file handle as well as a container that holds accumulated state.
It’s worth taking a moment to explain the make dependencies. The generated backend.mk as well as the Makefile.in (if it exists) are in the GLOBAL_DEPS list. This means that if one of them changes, all targets in that Makefile are invalidated. backend.mk also depends on all of its input files.
It’s worth considering the effect of file mtimes on build behavior.
Since we perform an “all or none” traversal of moz.build files (the whole tree is scanned as opposed to individual files), if we were to blindly write backend.mk files, the net effect of updating a single mozbuild file in the tree is all backend.mk files have new mtimes. This would in turn invalidate all make targets across the whole tree! This would effectively undermine incremental builds as any mozbuild change would cause the entire tree to rebuild!
The solution is to not update the mtimes of backend.mk files unless they actually change. We use FileAvoidWrite to accomplish this.
-
add_statement
(stmt)¶
-
close
()¶
-
diff
¶
-
write
(buf)¶
-
write_once
(buf)¶
-
-
class
mozbuild.backend.recursivemake.
RecursiveMakeBackend
(environment)¶ Bases:
mozbuild.backend.common.CommonBackend
Backend that integrates with the existing recursive make build system.
This backend facilitates the transition from Makefile.in to moz.build files.
This backend performs Makefile.in -> Makefile conversion. It also writes out .mk files containing content derived from moz.build files. Both are consumed by the recursive make builder.
This backend may eventually evolve to write out non-recursive make files. However, as long as there are Makefile.in files in the tree, we are tied to recursive make and thus will need this backend.
-
class
Substitution
¶ Bases:
object
BaseConfigSubstitution-like class for use with _create_makefile.
-
config
¶
-
input_path
¶
-
output_path
¶
-
topobjdir
¶
-
topsrcdir
¶
-
-
RecursiveMakeBackend.
consume_finished
()¶
-
RecursiveMakeBackend.
consume_object
(obj)¶ Write out build files necessary to build with recursive make.
-
RecursiveMakeBackend.
summary
()¶
-
class
-
class
mozbuild.backend.recursivemake.
RecursiveMakeTraversal
¶ Bases:
object
Helper class to keep track of how the “traditional” recursive make backend recurses subdirectories. This is useful until all adhoc rules are removed from Makefiles.
- Each directory may have one or more types of subdirectories:
- (normal) dirs
- tests
-
class
SubDirectories
¶ Bases:
mozbuild.backend.recursivemake.SubDirectories
-
RecursiveMakeTraversal.
SubDirectoriesTuple
¶ alias of
SubDirectories
-
RecursiveMakeTraversal.
SubDirectoryCategories
= [u'dirs', u'tests']¶
-
RecursiveMakeTraversal.
add
(dir, dirs=[], tests=[])¶ Adds a directory to traversal, registering its subdirectories, sorted by categories. If the directory was already added to traversal, adds the new subdirectories to the already known lists.
-
RecursiveMakeTraversal.
call_filter
(current, filter)¶ Helper function to call a filter from compute_dependencies and traverse.
-
RecursiveMakeTraversal.
compute_dependencies
(filter=None)¶ Compute make dependencies corresponding to the registered directory traversal.
- filter is a function with the following signature:
- def filter(current, subdirs)
where current is the directory being traversed, and subdirs the SubDirectories instance corresponding to it. The filter function returns a tuple (filtered_current, filtered_parallel, filtered_dirs) where filtered_current is either current or None if the current directory is to be skipped, and filtered_parallel and filtered_dirs are lists of parallel directories and sequential directories, which can be rearranged from whatever is given in the SubDirectories members.
The default filter corresponds to a default recursive traversal.
-
static
RecursiveMakeTraversal.
default_filter
(current, subdirs)¶ Default filter for use with compute_dependencies and traverse.
-
RecursiveMakeTraversal.
get_subdirs
(dir)¶ Returns all direct subdirectories under the given directory.
-
RecursiveMakeTraversal.
traverse
(start, filter=None)¶ Iterate over the filtered subdirectories, following the traditional make traversal order.
-
mozbuild.backend.recursivemake.
make_quote
(s)¶
mozbuild.backend.visualstudio module¶
-
class
mozbuild.backend.visualstudio.
VisualStudioBackend
(environment)¶ Bases:
mozbuild.backend.common.CommonBackend
Generate Visual Studio project files.
This backend is used to produce Visual Studio projects and a solution to foster developing Firefox with Visual Studio.
This backend is currently considered experimental. There are many things not optimal about how it works.
-
consume_finished
()¶
-
consume_object
(obj)¶
-
summary
()¶
-
static
write_vs_project
(fh, version, project_id, name, includes=[], forced_includes=[], defines=[], build_command=None, clean_command=None, debugger=None, headers=[], sources=[])¶
-
-
mozbuild.backend.visualstudio.
get_id
(name)¶
-
mozbuild.backend.visualstudio.
visual_studio_product_to_platform_toolset_version
(version)¶
-
mozbuild.backend.visualstudio.
visual_studio_product_to_solution_version
(version)¶