summaryrefslogtreecommitdiff
path: root/tools/build/v2/doc/src/project-target.xml
blob: 1e4e39a5207cfffe7583b75ee00c093898879d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
  "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">

<section id="bbv2.reference.class.project-target">

  <title>Class project-target</title>
  <indexterm>
    <primary>project-target</primary>
  </indexterm>
  
<programlisting language="jam">
class project-target : <link linkend="bbv2.reference.class.abstract-target">abstract-target</link> {
    rule <link linkend="bbv2.reference.class.project-target.generate">generate</link> ( property-set )
    rule <link linkend="bbv2.reference.class.project-target.build-dir">build-dir</link> ( )
    rule <link linkend="bbv2.reference.class.project-target.main-target">main-target</link> ( name )
    rule <link linkend="bbv2.reference.class.project-target.has-main-target">has-main-target</link> ( name )
    rule <link linkend="bbv2.reference.class.project-target.find">find</link> ( id : no-error ? )

    # Methods inherited from <link linkend="bbv2.reference.class.abstract-target">abstract-target</link>
    rule <link linkend="bbv2.reference.class.abstract-target.name">name</link> ( )
    rule <link linkend="bbv2.reference.class.abstract-target.project">project</link> ( )
    rule <link linkend="bbv2.reference.class.abstract-target.location">location</link> ( )
    rule <link linkend="bbv2.reference.class.abstract-target.full-name">full-name</link> ( )
}
</programlisting>

  <para>
    This class has the following responsibilities:
    <itemizedlist>
      <listitem>
        <para>
          Maintaining a list of main targets in this project and building them.
        </para>
      </listitem>
    </itemizedlist>
  </para>

  <orderedlist>

    <listitem id="bbv2.reference.class.project-target.generate">
      <indexterm zone="bbv2.reference.class.project-target.generate">
        <primary>generate</primary>
        <secondary>Project Target</secondary>
      </indexterm>
      <code language="jam">rule generate ( property-set )</code>
      <para>
        Overrides
        <link linkend="bbv2.reference.class.abstract-target.generate">abstract-target.generate</link>.

        Generates virtual targets for all the targets contained in this project.
      </para>
      
      <para>
        On success, returns:
        <itemizedlist>
          <listitem>a property-set with the usage requirements to be applied to dependents</listitem>
          <listitem>a list of produced virtual targets, which may be empty.</listitem>
        </itemizedlist>
      </para>
    </listitem>

    <listitem id="bbv2.reference.class.project-target.build-dir">
      <indexterm zone="bbv2.reference.class.project-target.build-dir">
        <primary>build-dir</primary>
        <secondary>Project Target Method</secondary>
      </indexterm>
      <code language="jam">rule build-dir ( )</code>
      <para>
        Returns the root build directory of the project.
      </para>
    </listitem>

    <listitem id="bbv2.reference.class.project-target.main-target">
      <indexterm zone="bbv2.reference.class.project-target.main-target">
        <primary>main-target</primary>
        <secondary>Project Target Method</secondary>
      </indexterm>
      <code language="jam">rule main-target ( name )</code>
      <para>
        Returns a <link linkend="bbv2.reference.class.main-target">main-target</link>
        class instance corresponding to <literal>name</literal>.
        Can only be called after the project has been fully loaded.
      </para>
    </listitem>

    <listitem id="bbv2.reference.class.project-target.has-main-target">
      <indexterm zone="bbv2.reference.class.project-target.has-main-target">
        <primary>has-main-target</primary>
        <secondary>Project Target Method</secondary>
      </indexterm>
      <code language="jam">rule has-main-target ( name )</code>
      <para>
        Returns whether a <link linkend="bbv2.reference.class.main-target">main-target</link>
        with the specified name exists.
        Can only be called after the project has been fully loaded.
      </para>
    </listitem>

    <listitem id="bbv2.reference.class.project-target.find">
      <indexterm zone="bbv2.reference.class.project-target.find">
        <primary>find</primary>
        <secondary>Project Target Method</secondary>
      </indexterm>
      <code language="jam">rule find ( id : no-error ? )</code>
      <para>
        Find and return the target with the specified id, treated relative to
        self. Id may specify either a target or a file name with the target taking
        priority. May report an error or return nothing if the target is not found
        depending on the <literal>no-error</literal> parameter.
      </para>
    </listitem>

    <!--
    
    I'm not sure whether these should be considered public interfaces.
    Leave them out for now (SW):
    
    rule project-module ( )
    rule get ( attribute )
    
    -->
    
    <!--
    
    The following are not documented because I consider them implementation details (SW):
    
    rule __init__ ( name : project-module parent-project ?
        : requirements * : default-build * ) - invoked by the build system.
    
    rule targets-to-build ( ) - internal to project-target
    rule mark-target-as-explicit ( target-name * ) - Implementation of explicit
    rule mark-target-as-always ( target-name * ) - Implementation of always
    rule add-alternative ( target-instance ) - Implementation of targets.main-target-alternative
    rule find-really ( id ) - internal to project-target 
    rule build-main-targets ( ) - internal to project-target
    rule inherit ( parent ) - internal to project-target
    rule add-constant ( name : value + : type ? ) - Implementation of constant/path-constant
    
    -->
    
  </orderedlist>
  
</section>