Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions doc/reference/action.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The `action` class
The `Action` class
==================

.. py:currentmodule:: faber.action
Expand All @@ -11,15 +11,15 @@ a Python callable.
Constructor
-----------

.. method:: action()
.. method:: Action()

Construct an empty (abstract) action. This is useful to define an abstract `tool`.

.. method:: action(command)
.. method:: Action(command)

Construct an action from the given command (string).

.. method:: action(name, command)
.. method:: Action(name, command)

Construct an action with the given name, from the given command (string).

Expand All @@ -37,9 +37,9 @@ Examples
::

# define some actions
compile = action('c++.compile', 'c++ -c -o $(<) $(>)')
link = action('c++.link', 'c++ -o $(<) $(>)')
test = action('run_test', '$(>)')
compile = Action('c++.compile', 'c++ -c -o $(<) $(>)')
link = Action('c++.link', 'c++ -o $(<) $(>)')
test = Action('run_test', '$(>)')

# this demonstrates how to compound actions
def run_test(target, source):
Expand Down
8 changes: 4 additions & 4 deletions doc/reference/artefact.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The `artefact` class
The `Artefact` class
====================

.. currentmodule:: faber.artefact
Expand Down Expand Up @@ -29,7 +29,7 @@ attributes
Constructor
-----------

.. method:: artefact(name, attrs=0, features=(), use=(), condition=None)
.. method:: Artefact(name, attrs=0, features=(), use=(), condition=None)

Construct an artefact.

Expand All @@ -43,7 +43,7 @@ Constructor
Call operator
-------------

.. automethod:: faber.artefact.artefact.__call__
.. automethod:: faber.artefact.Artefact.__call__

Attributes
----------
Expand All @@ -63,7 +63,7 @@ Attributes
Methods
-------

.. automethod:: artefact.__status__
.. automethod:: Artefact.__status__


Examples
Expand Down
8 changes: 4 additions & 4 deletions doc/reference/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ etc.
synopsis
--------

.. autoclass:: faber.config.check.check
.. autoclass:: faber.config.check.Check

.. autoclass:: faber.config.try_compile.try_compile
.. autoclass:: faber.config.try_compile.TryCompile

.. autoclass:: faber.config.try_link.try_link
.. autoclass:: faber.config.try_link.TryLink

.. autoclass:: faber.config.cxx_checks.has_cxx11
.. autoclass:: faber.config.cxx_checks.has_cxx14
Expand All @@ -38,7 +38,7 @@ Examples
cxx_checks.has_cxx14(features, define('HAS_CXX14')),
cxx_checks.has_cxx17(features, define('HAS_CXX17'))]

config = report('config', checks)
config = Report('config', checks)

Running `faber config` will perform the above checks, and print out a little report, such as:

Expand Down
48 changes: 24 additions & 24 deletions doc/reference/feature.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ Attribute flags are used to indicate how to interpret feature values.

Incidental values are not considered when matching two feature values.

The `feature` class
The `Feature` class
-------------------

Constructor
~~~~~~~~~~~

.. method:: feature()
feature(name)
feature(name, values)
feature(name, attributes)
feature(name, values, attributes)
feature(name, **subfeatures)
.. method:: Feature()
Feature(name)
Feature(name, values)
Feature(name, attributes)
Feature(name, values, attributes)
Feature(name, **subfeatures)

Construct a new feature.

Expand All @@ -64,7 +64,7 @@ Call operator

:parameter values: initial values of the feature variable

The `value` class
The `Value` class
-----------------

Operators
Expand All @@ -82,7 +82,7 @@ Operators

Return `True` if `other` has or is the same value as self.

The `set` class
The `Set` class
---------------

Class methods
Expand All @@ -95,8 +95,8 @@ Class methods
Constructor
~~~~~~~~~~~

.. method:: set()
set(*values)
.. method:: Set()
Set(*values)

Construct a feature set from the given values.

Expand All @@ -120,19 +120,19 @@ Operators
`s['include']` and `s.include` give access to it.


The `condition.expr` classes
The `condition.Expression` classes
----------------------------

.. class:: expr
.. class:: Expression

Base class to construct condition expressions.

.. inheritance-diagram:: faber.feature.condition.true
faber.feature.condition.false
faber.feature.condition.unary
faber.feature.condition.binary
faber.feature.condition.sub
faber.feature.condition.value
.. inheritance-diagram:: faber.feature.condition.True_
faber.feature.condition.False_
faber.feature.condition.Unary
faber.feature.condition.Binary
faber.feature.condition.Sub
faber.feature.condition.Value
:parts: 1

All relational operators are supported, and will result in compound expressions.
Expand All @@ -145,9 +145,9 @@ Assuming the following features are defined::

from faber.feature import *

include = feature('include', multi|path|incidental)
link = feature('link', values=('shared', 'static'))
target = feature('target', os=feature(), arch=feature())
include = Feature('include', multi|path|incidental)
link = Feature('link', values=('shared', 'static'))
target = Feature('target', os=feature(), arch=feature())

it is possible to define values for them globally per command-line arguments:

Expand All @@ -158,8 +158,8 @@ it is possible to define values for them globally per command-line arguments:
These feature values are added to all artefact feature sets by default (but
may be overwritten or added to by artefact-specific values::

greet = library('greet', 'greet.cpp', features=link('static'))
greet = Library('greet', 'greet.cpp', features=link('static'))

Artefacts may be conditionalized using condition expressions::

greet = library('greet', 'greet.cpp', condition=set.define.contains('HAS_FEATURE'))
greet = Library('greet', 'greet.cpp', condition=set.define.contains('HAS_FEATURE'))
22 changes: 11 additions & 11 deletions doc/reference/test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ The test classes can be used to define and run tests, and generate test reports.
synopsis
--------

.. autoclass:: faber.test.test
.. autoclass:: faber.test.Test
:members: __init__

.. autoclass:: faber.test.report
.. autoclass:: faber.test.Report
:members: __init__, print_summary

Examples
--------

::

from faber.artefacts.binary import binary
from faber.test import test, report, fail
from faber.artefacts.binary import Binary
from faber.test import Test, Report, fail

passing = binary('passing', 'passing.cpp')
failing = binary('failing', 'failing.cpp')
passing = Binary('passing', 'passing.cpp')
failing = Binary('failing', 'failing.cpp')

test1 = test('test1', passing, run=True)
test2 = test('test2', failing, run=True)
test3 = test('test3', failing, run=True, expected=fail)
test4 = test('test4', failing, condition=False)
test1 = Test('test1', passing, run=True)
test2 = Test('test2', failing, run=True)
test3 = Test('test3', failing, run=True, expected=fail)
test4 = Test('test4', failing, condition=False)

r = report('test-report', [test1, test2, test3, test4])
r = Report('test-report', [test1, test2, test3, test4])

Running `faber test-report` will perform the tests, print
out individual results (e.g., 'PASS', 'FAIL', etc.), then print
Expand Down
18 changes: 9 additions & 9 deletions doc/reference/tool.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The `tool` class
The `Tool` class
================

.. py:currentmodule:: faber.tool
Expand Down Expand Up @@ -31,7 +31,7 @@ actions.
Constructor
-----------

.. method:: tool(name='', version='')
.. method:: Tool(name='', version='')

The tool name defaults to its class name.

Expand Down Expand Up @@ -68,19 +68,19 @@ Examples

Given a simple fabscript such as::

from faber.tools.cxx import cxx
from faber.tools.cxx import CXX

rule(cxx.compile, 'hello.o', source='hello.cpp')
rule(CXX.compile, 'hello.o', source='hello.cpp')

it becomes possible to configure your build environment by instantiating
different compilers::

from faber.tools.gxx import gxx
from faber.tools.gxx import GXX

gxx = gxx()
gxx11 = gxx(name='g++11', features=cxxflags('--std=c++11'))
gxx03 = gxx(name='g++03', features=cxxflags('--std=c++03'))
mingwxx = gxx(name='mingw++', command='/usr/bin/x86_64-w64-mingw32-g++')
gxx = GXX()
gxx11 = GXX(name='g++11', features=cxxflags('--std=c++11'))
gxx03 = GXX(name='g++03', features=cxxflags('--std=c++03'))
mingwxx = GXX(name='mingw++', command='/usr/bin/x86_64-w64-mingw32-g++')

Now you can invoke a build by selecting either of these to compile `hello.o`:

Expand Down
36 changes: 18 additions & 18 deletions doc/tutorial/advanced_concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ the build logic encoded in the fabscript is strictly platform-agnostic.
Let's augment the original `Hello World !` example to illustrate this. Faber provides
a few built-in tools, such as C and C++ compilers. The abstract interface may look like::

class cxx(object):
class CXX:

compile = action()
link = action()
compile = Action()
link = Action()

which allows fabscripts to reference `cxx.compile` when defining rules::

obj = rule(cxx.compile, 'hello.o', 'hello.cpp')
obj = rule(CXX.compile, 'hello.o', 'hello.cpp')

`faber` also provides specific compilers implementing the above interface, for example::

class gxx(cxx):
class GXX(CXX):

compile = action('g++ -c -o $(<) $(>)')
compile = Action('g++ -c -o $(<) $(>)')
...

allowing the build system to later substitute `gxx.compile` where `cxx.compile` was
Expand All @@ -41,7 +41,7 @@ to request a specific compiler on the command line:
Tools may also be instantiated explicitly in a config file, allowing for additional
configuration (such as specific paths or flags)::

gxx11 = gxx(name='g++11', features=cxxflags('--std=c++11'))
gxx11 = GXX(name='g++11', features=cxxflags('--std=c++11'))

Here, we defined a new `gxx` instance using an additional flag `==std=c++11`, and
gave it the name `g++11`. To select that from the command line, we would invoke:
Expand All @@ -52,7 +52,7 @@ gave it the name `g++11`. To select that from the command line, we would invoke:

You may also want to set up a `gxx` instance to configure a cross-compiler::

mingwxx = gxx(name='mingw++', command=`/usr/bin/x86_64-w64-mingw32-g++`)
mingwxx = GXX(name='mingw++', command=`/usr/bin/x86_64-w64-mingw32-g++`)

and then cross-compile by invoking:

Expand All @@ -73,7 +73,7 @@ Higher-order artefacts such as `library` or `binary` can then request that the a
implicit rules are instantiated into ordinary rules to make a library or a binary without
the user having to spell out all the intermediate artefacts.

This is done in a tool's constructor. For example, the `gxx` constructor calls::
This is done in a tool's constructor. For example, the `GXX` constructor calls::

implicit_rule(self.compile, types.obj, types.cxx)
implicit_rule(self.archive, types.lib, types.obj)
Expand Down Expand Up @@ -103,9 +103,9 @@ we use a composite artefact to encapsulate those details.
We use a new `library` rule to define it::

from faber.artefacts.library import *
greet = library('greet', 'greet.cpp')
greet = Library('greet', 'greet.cpp')

The `library()` call looks similar to the `rule()` call: xxx
The `Library()` call looks similar to the `rule()` call: xxx
`artefact` and a `sources` argument, and returns the artefact instance.
However, the artefact's name (`greet.name`) doesn't necessarily correspond
to the filename.
Expand All @@ -118,7 +118,7 @@ rule or artefact, and the build logic will determine the precise action sequence
to use it::

from faber.artefacts.binary import *
hello = binary('hello', ['hello.cpp', greet])
hello = Binary('hello', ['hello.cpp', greet])

Then, to build this with `greet` as shared library (`.so` on UNIX, `.dll` on
Windows), call `faber link=shared`. To build this as a static library
Expand Down Expand Up @@ -147,23 +147,23 @@ our previous version, as it now only builds the `greet` library::

from faber.artefacts.library import *

greet = library('greet', 'greet.cpp')
greet = Library('greet', 'greet.cpp')

default = greet

The toplevel fabscript now includes that sub-project by virtue of a :term:`module`::

from faber.artefacts.binary import binary
from faber.artefacts.binary import Binary

subdir = module('subdir')
subdir = Module('subdir')

hello = binary('hello', ['hello.cpp', subdir.greet])
hello = Binary('hello', ['hello.cpp', subdir.greet])

rule(action('test', '$(>)'), 'test', hello, attrs=notfile|always)
rule(Action('test', '$(>)'), 'test', hello, attrs=notfile|always)

default = hello

Notice how the call to `module('subdir')` returns the module object,
Notice how the call to `Module('subdir')` returns the module object,
through which we can access nested artefacts (and other variables).
The binary rule can now directly reference the `subdir.greet`
library as one of its sources, and the right thing will happen.
Expand Down
Loading
Loading