1 | # ------------------------------------------------------------------------------ |
---|
2 | # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
3 | # |
---|
4 | # This file is part of FCM, tools for managing and building source code. |
---|
5 | # |
---|
6 | # FCM is free software: you can redistribute it and/or modify |
---|
7 | # it under the terms of the GNU General Public License as published by |
---|
8 | # the Free Software Foundation, either version 3 of the License, or |
---|
9 | # (at your option) any later version. |
---|
10 | # |
---|
11 | # FCM is distributed in the hope that it will be useful, |
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | # GNU General Public License for more details. |
---|
15 | # |
---|
16 | # You should have received a copy of the GNU General Public License |
---|
17 | # along with FCM. If not, see <http://www.gnu.org/licenses/>. |
---|
18 | # ------------------------------------------------------------------------------ |
---|
19 | use strict; |
---|
20 | use warnings; |
---|
21 | |
---|
22 | # ------------------------------------------------------------------------------ |
---|
23 | package FCM::Context::Make; |
---|
24 | use base qw{FCM::Class::HASH}; |
---|
25 | |
---|
26 | use constant { |
---|
27 | ST_UNKNOWN => 0, |
---|
28 | ST_INIT => 1, |
---|
29 | ST_OK => 2, |
---|
30 | ST_FAILED => -1, |
---|
31 | }; |
---|
32 | |
---|
33 | __PACKAGE__->class({ |
---|
34 | ctx_of => '%', |
---|
35 | description => '$', |
---|
36 | dest => '$', |
---|
37 | dest_lock => '$', |
---|
38 | error => {}, |
---|
39 | inherit_ctx_list => '@', |
---|
40 | name => {isa => '$', default => q{}}, |
---|
41 | option_of => '%', |
---|
42 | prev_ctx => __PACKAGE__, |
---|
43 | status => {isa => '$', default => ST_UNKNOWN}, |
---|
44 | steps => '@', |
---|
45 | }); |
---|
46 | |
---|
47 | # ------------------------------------------------------------------------------ |
---|
48 | 1; |
---|
49 | __END__ |
---|
50 | |
---|
51 | =head1 NAME |
---|
52 | |
---|
53 | FCM::Context::Make |
---|
54 | |
---|
55 | =head1 SYNOPSIS |
---|
56 | |
---|
57 | use FCM::Context::Make; |
---|
58 | my $ctx = FCM::Context::Make->new(); |
---|
59 | |
---|
60 | =head1 DESCRIPTION |
---|
61 | |
---|
62 | Provides a context object for the FCM make system. It is a sub-class of |
---|
63 | L<FCM::Class::HASH|FCM::Class::HASH>. |
---|
64 | |
---|
65 | =head1 OBJECTS |
---|
66 | |
---|
67 | =head2 FCM::Context::Make |
---|
68 | |
---|
69 | An instance of this class represents a make. It has the following |
---|
70 | attributes: |
---|
71 | |
---|
72 | =over 4 |
---|
73 | |
---|
74 | =item ctx_of |
---|
75 | |
---|
76 | A HASH containing the (keys) IDs and the (values) context objects of the make. |
---|
77 | |
---|
78 | =item description |
---|
79 | |
---|
80 | A description string for this make. |
---|
81 | |
---|
82 | =item dest |
---|
83 | |
---|
84 | The destination of this make. |
---|
85 | |
---|
86 | =item dest_lock |
---|
87 | |
---|
88 | The destination lock of this make. |
---|
89 | |
---|
90 | =item error |
---|
91 | |
---|
92 | This should be set to the value of the exception, if this make ends in one. |
---|
93 | |
---|
94 | =item inherit_ctx_list |
---|
95 | |
---|
96 | An ARRAY of contexts inherited by this make. |
---|
97 | |
---|
98 | =item name |
---|
99 | |
---|
100 | The name of the context. This is useful if we need to have multiple (but |
---|
101 | non-overlapping) "fcm make" runs in the same destination. (Default is a null |
---|
102 | string.) |
---|
103 | |
---|
104 | =item option_of |
---|
105 | |
---|
106 | A HASH to store the options of this make. See L</OPTION> for detail. |
---|
107 | |
---|
108 | =item status |
---|
109 | |
---|
110 | The status of the make. |
---|
111 | |
---|
112 | =item steps |
---|
113 | |
---|
114 | The names of the steps to make. |
---|
115 | |
---|
116 | =back |
---|
117 | |
---|
118 | =head1 OPTION |
---|
119 | |
---|
120 | The C<option_of> attribute of a FCM::Context::Make object may contain the |
---|
121 | following elements: |
---|
122 | |
---|
123 | =over 4 |
---|
124 | |
---|
125 | =item config-file |
---|
126 | |
---|
127 | An ARRAY of configuration file names. |
---|
128 | |
---|
129 | =item directory |
---|
130 | |
---|
131 | The working directory of the make. |
---|
132 | |
---|
133 | =item ignore-lock |
---|
134 | |
---|
135 | Ignores lock file in the destination. |
---|
136 | |
---|
137 | =item jobs |
---|
138 | |
---|
139 | The number of (child) threads that can be run simultaneously. |
---|
140 | |
---|
141 | =item new |
---|
142 | |
---|
143 | Performs a make in "new" mode (as opposed to the "incremental" mode). |
---|
144 | |
---|
145 | =back |
---|
146 | |
---|
147 | =head1 CONSTANTS |
---|
148 | |
---|
149 | =over 4 |
---|
150 | |
---|
151 | =item FCM::Context::Make->ST_UNKNOWN |
---|
152 | |
---|
153 | The status of a make context or the context of a subsystem. Status is unknown. |
---|
154 | |
---|
155 | =item FCM::Context::Make->ST_INIT |
---|
156 | |
---|
157 | The status of a make context or the context of a subsystem. The make or the |
---|
158 | subsystem has initialised, but not completed. |
---|
159 | |
---|
160 | =item FCM::Context::Make->ST_OK |
---|
161 | |
---|
162 | The status of a make context or the context of a subsystem. The make or the |
---|
163 | subsystem has completed successfully. |
---|
164 | |
---|
165 | =item FCM::Context::Make->ST_FAILED |
---|
166 | |
---|
167 | The status of a make context or the context of a subsystem. The make or the |
---|
168 | subsystem has failed. |
---|
169 | |
---|
170 | =back |
---|
171 | |
---|
172 | =head1 COPYRIGHT |
---|
173 | |
---|
174 | Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
175 | |
---|
176 | =cut |
---|