(self, target, matches, binding)
| 142 | "[ ]+([^ \"]+|\"[^\"]+\"))|(#include[ ]*(<[^<]+>|\"[^\"]+\")))" ; |
| 143 | |
| 144 | def process(self, target, matches, binding): |
| 145 | binding = binding[0] |
| 146 | angle = regex.transform(matches, "#include[ ]*<([^<]+)>") |
| 147 | quoted = regex.transform(matches, "#include[ ]*\"([^\"]+)\"") |
| 148 | res = regex.transform(matches, |
| 149 | "[^ ]+[ ]+(BITMAP|CURSOR|FONT|ICON|MESSAGETABLE|RT_MANIFEST)" +\ |
| 150 | "[ ]+(([^ \"]+)|\"([^\"]+)\")", [3, 4]) |
| 151 | |
| 152 | # Icons and other includes may referenced as |
| 153 | # |
| 154 | # IDR_MAINFRAME ICON "res\\icon.ico" |
| 155 | # |
| 156 | # so we have to replace double backslashes to single ones. |
| 157 | res = [ re.sub(r'\\\\', '/', match) for match in res if match is not None ] |
| 158 | |
| 159 | # CONSIDER: the new scoping rule seem to defeat "on target" variables. |
| 160 | g = bjam.call('get-target-variable', target, 'HDRGRIST')[0] |
| 161 | b = os.path.normpath(os.path.dirname(binding)) |
| 162 | |
| 163 | # Attach binding of including file to included targets. |
| 164 | # When target is directly created from virtual target |
| 165 | # this extra information is unnecessary. But in other |
| 166 | # cases, it allows to distinguish between two headers of the |
| 167 | # same name included from different places. |
| 168 | # We don't need this extra information for angle includes, |
| 169 | # since they should not depend on including file (we can't |
| 170 | # get literal "." in include path). |
| 171 | g2 = g + "#" + b |
| 172 | |
| 173 | g = "<" + g + ">" |
| 174 | g2 = "<" + g2 + ">" |
| 175 | angle = [g + x for x in angle] |
| 176 | quoted = [g2 + x for x in quoted] |
| 177 | res = [g2 + x for x in res] |
| 178 | |
| 179 | all = angle + quoted |
| 180 | |
| 181 | bjam.call('mark-included', target, all) |
| 182 | |
| 183 | engine = get_manager().engine() |
| 184 | |
| 185 | engine.add_dependency(target, res) |
| 186 | bjam.call('NOCARE', all + res) |
| 187 | engine.set_target_variable(angle, 'SEARCH', [utility.get_value(inc) for inc in self.includes]) |
| 188 | engine.set_target_variable(quoted, 'SEARCH', [b + utility.get_value(inc) for inc in self.includes]) |
| 189 | engine.set_target_variable(res, 'SEARCH', [b + utility.get_value(inc) for inc in self.includes]) |
| 190 | |
| 191 | # Just propagate current scanner to includes, in a hope |
| 192 | # that includes do not change scanners. |
| 193 | get_manager().scanners().propagate(self, angle + quoted) |
| 194 | |
| 195 | scanner.register(ResScanner, 'include') |
| 196 | type.set_scanner('RC', ResScanner) |
no test coverage detected