[build2] Multiple patterns problem
Karen Arutyunov
karen at codesynthesis.com
Tue Oct 3 15:52:12 UTC 2017
Hi Max,
> I am trying the following with build2 0.7.0-a.0.67f920eafe224082
>
> Imagine a project with five source folders a, b, c, foo, bar. To build
> it correctly I need to exclude foo and bar.
>
> The following buildfile commands work:
>
> $out_base/_bin/exe{myproject.elf}: {c}{** -{***/foo/** ***/bar/**}}
>
> $out_base/_bin/exe{myproject.elf}: {c}{** -***/foo/** -***/bar/**}
>
> $out_base/_bin/exe{myproject.elf}: {c}{a/** b/** c/** -***/foo/**
> -***/bar/**}
The last example actually doesn't work as you expect. The second pattern
doesn't start with +/-, so all 5 patterns are independent (see the
manual for details).
> But this doesn’t work:
>
> $out_base/_bin/exe{myproject.elf}: {c}{a/** b/** c/** -{***/foo/**
> ***/bar/**}}
>
> The error is:
>
> buildfile:23:81: error: nested type name -
Right, by the same reason -{***/foo/** ***/bar/**} is treated not as an
exclusion group but as a regular one with an unexpected type.
> Would be nice if this works cause I am trying to use it like this:
>
> $out_base/_bin/exe{myproject.elf}: {c}{{$include} -{$exclude}}
>
> In order to feed in multiple include and exclude patterns via
> environment variables.
This wasn't possible at the time of your email, but it is now
implemented. Just a syntax is a bit different (note the first group is
an inclusion):
$out_base/_bin/exe{myproject.elf}: {c}{+{$include} -{$exclude}}
You can obtain the latest toolchain that supports the new feature from
https://stage.build2.org/0/0.7.0-a.0/
The online manual is updated accordingly at
https://build2.org/build2/doc/build2-build-system-manual.xhtml#name-patterns
Best regards,
Karen
More information about the users
mailing list