On Wed, Aug 17, 2016 at 2:48 AM, Ted Mielczarek <t...@mielczarek.org> wrote:
> On Wed, Aug 17, 2016, at 05:29 AM, Mike Hommey wrote: > > Partly related, there's another one: > > - there are optional parts of moz.configure that are completely unknown > > when they are not included. This can complicate things in some cases. > > See for example extra_toolchain_flags. IIRC, there are a few other > > similar cases, and I can see other such cases appearing as we move > > more things to python configure. > > > > By extension, I've been revisiting the idea from bug 1259272 to have a > > tool to do some introspection, and that not everything is visible can > > make it awkward to use such a tool. The worst offender being > > --enable-project/--enable-application. > > > > I came up with a prototype patch that seems to work and would make > > everything known. The idea is to add a context manager to the sandbox, > > that works as follows: > > with only_when(<some_depends_function>): > > python_configure_stuff() > > > > We can then rewrite things like depends_when or include_when using > > that context manager. For example, include_when (which is the only > > thing I tested so far) becomes: > > @template > > def include_when(filename, when): > > with only_when(when): > > include(filename) > > > > I expect it would also allow to remove depends_win from > > windows.configure, for example. > > I really like this idea. I know one of the big issues we've had with > moz.build is an inability to introspect the entire state of things > because of conditionals, it would be nice to fix that situation in > moz.configure. And that is a side-effect of us initially preferring variable-based/declarative patterns in moz.build as opposed to say something more function heavy (like Bazel's language) (if everything were a function, you could pass a "when" argument to the function to declare when it should actually be applied). The good news is moz.configure leans heavily on functions, so we don't have this problem. I like the idea of a context manager receiving a condition function. We can provide a special mode to fake out the condition result to evaluate everything in a file. If someone wants to apply that to moz.build, I would not be opposed. However, glandium has been pushing to consolidate the moz.build reader with the emitter. If we start evaluating everything in a file regardless of conditions, the emitter may start barfing due to rules violations. One of the nice things about keeping the execution result and the emitter separate is you can postpone data validation for scenarios like these.
_______________________________________________ dev-builds mailing list dev-builds@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-builds