Edgewall Software

Changes between Version 6 and Version 7 of Build Recipes


Ignore:
Timestamp:
Sep 22, 2005, 3:57:57 PM (19 years ago)
Author:
cmlenz
Comment:

Updated to reflect recipe changes in trunk

Legend:

Unmodified
Added
Removed
Modified
  • Build Recipes

    v6 v7  
    11= Bitten Build Recipes =
     2
     3  ''Note: the recipe format has changed since [milestone:0.4]. You can find documentation about the previous format by looking at version 6 of this page (see the “page history” link above).''
    24
    35A ''build recipe'' tells a build slave how a project is to be built. It consists of multiple ''build steps'', each defining a command to execute, and where artifacts can be found after that command has successfully completed.
     
    911== File Format ==
    1012
    11 Build recipes are stored internally in an XML-based format. Recipe files have a single `<build>` root element with one or more `<step>` child elements. The steps are executed in the order they appear in the recipe. A `<step>` element will consist of any number of commands and reports. These elements are declared in XML namespaces, where the namespace URL is a pseudo-protocol that defines which Python module they are implemented in:
     13Build recipes are stored internally in an XML-based format. Recipe files have a single `<build>` root element with one or more `<step>` child elements. The steps are executed in the order they appear in the recipe. A `<step>` element will consist of any number of commands and reports. These elements are declared in XML namespaces, where the namespace URI defines a collection of commands:
    1214
    1315{{{
    1416#!xml
    1517<build description="My project"
    16     xmlns:python="bitten:bitten.build.pythontools">
     18    xmlns:python="http://bitten.cmlenz.net/tools/python">
    1719
    1820  <step id="build" description="Compile to byte code">
     
    2224  <step id="test" description="Run unit tests">
    2325    <python:distutils command="unittest"/>
    24     <reports>
    25       <python:unittest file="build/test-results.xml"/>
    26       <python:trace summary="build/test-coverage.txt"
    27           coverdir="build/coverage" include="trac*" exclude="*.tests.*"/>
     26    <python:unittest file="build/test-results.xml"/>
     27    <python:trace summary="build/test-coverage.txt"
     28        coverdir="build/coverage" include="trac*" exclude="*.tests.*"/>
    2829    </reports>
    2930  </step>
     
    3435== Recipe Command Binding ==
    3536
    36 As noted above, recipe commands and report generators are mapped to Python modules using XML namespaces. The URI of recipe namespace that uses the ''bitten'' scheme is mapped to the corresponding module. Commands and report generators are then mapped to functions inside that module.
     37Recipe commands and report generators are mapped to Python functions using [http://peak.telecommunity.com/DevCenter/PkgResources#entry-points entry points]. Bitten itself comes with a number of entry points that provide recipe commands, but third-party packages can provide additional commands by declaring their own `bitten.recipe_commands` entry points.
    3738
    38 For example, the command `<python:distutils>` (where the namespace prefix `python` resolves to `bitten:bitten.build.pythontools`) is mapped to the function `distutils` in the `bitten.build.pythontools` module. The function is invoked with any provided attributes passed as keyword arguments.
     39The values of attributes on recipe command elements are passed to the function as keyword arguments. Special care must be taken with names that are either not valid Python identifiers, or that conflict with Python keywords or built-in functions. Dashes in names are replaced with underscores, and names that conflict with keywords or built-in functions get an underscore appended.
    3940
    40 So, the XML snippet:
     41So, for example:
    4142{{{
    42   <python:distutils command="build"/>
     43  <foo:bar file="tools/tabcheck.py" ignore-errors="yes"/>
    4344}}}
    4445
    4546gets tranlated into:
    4647{{{
    47 from bitten.build.pythontools import distutils
    48 distutils(ctxt, command='build')
     48bar(ctxt, file_='tools/tabcheck.py', ignore_errors='yes')
    4949}}}
    50 
    51 Special care must be taken with names that are either not valid Python identifiers, or that conflict with Python keywords or built-in functions. Dashes in names are replaced with underscores, and names that conflict with keywords or built-in functions get an underscore appended.
    52 
    53 So, for example:
    54 {{{
    55   <python:exec file="tools/tabcheck.py"/>
    56 }}}
    57 
    58 gets tranlated into:
    59 {{{
    60 from bitten.build.pythontools import exec_
    61 exec_(ctxt, file_='tools/tabcheck.py')
    62 }}}