User:Gszorc/Build frontend shootout

From MozillaWiki
< User:Gszorc
Revision as of 02:45, 28 August 2012 by Gszorc (talk | contribs) (initial)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This article examines alternatives to Makefile's for containing mozilla-central's build system definition. See discussion at https://groups.google.com/forum/?fromgroups=#!topic/mozilla.dev.platform/SACOnl-avMs

Goals

We want a frontend language whose output is a giant data structure. The data structure will be consumed by a generator to produce files that actually build the tree.

The produced data structure can come about many different ways. The frontend files themselves could be a data structure (e.g. JSON). They could be scripts that call built-in functions which register elements with the data structure. They could be scripts that populate specific variables whose values are read post execution.

Comparison

Python (data oriented)

We use Python as the frontend language. We try to make it is *data oriented* as possible. By that, we mean we value static data structures over function calls.

CPP_SOURCES = ['foo.cpp', 'bar.cpp']
CPP_FLAGS = ['-DFOO=1']

if ENV.WIN32:
    CPP_SOURCES += ['win32.cpp']

Python (procedural oriented)

In this flavor of Python, all relevant tasks are done with calls to built-in functions.

CPP_SOURCES('foo.cpp', 'bar.cpp')
CPP_FLAGS('-DFOO=1')

if ENV.WIN32:
    CPP_SOURCES('win32.cpp')