This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1134072 - Support for sub-contexts; r=glandium
As content in moz.build files has grown, it has become clear that storing everything in one global namespace (the "context") per moz.build file will not scale. This approach (which is carried over from Makefile.in patterns) limits our ability to do things like declare multiple instances of things (like libraries) per file. A few months ago, templates were introduced to moz.build files. These started the process of introducing separate contexts / containers in each moz.build file. But it stopped short of actually emitting multiple contexts per container. Instead, results were merged with the main context. This patch takes sub-contexts to the next level. Introduced is the "SubContext" class. It is a Context derived from another context. SubContexts are special in that they are context managers. With the context manager is entered, the SubContext becomes the main context associated with the executing sandbox, temporarily masking the existence of the main context. This means that UPPERCASE variable accesses and writes will be handled by the active SubContext. This allows SubContext instances to define different sets of variables. When a SubContext is spawned, it is attached to the sandbox executing it. The moz.build reader will now emit not only the main context, but also every SubContext that was derived from it. To aid with the creation and declaration of sub-contexts, we introduce the SUBCONTEXTS variable. This variable holds a list of classes that define sub-contexts. Sub-contexts behave a lot like templates. Their class names becomes the symbol name in the sandbox. --HG-- extra : rebase_source : 5df4bcf073ce46605b972021f1e918ce4affa6f3
- Loading branch information
Showing
5 changed files
with
130 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters