Boost logo

Boost-Build :

From: Mark Evans (evans_mark_at_[hidden])
Date: 2006-04-25 15:22:47


It turns out that the desired behavior can be achieved by extending the interface of path.glob in util/path.jam and adding a few lines of jam code. I added two optional parameters, 'recurse' and 'maxdepth'. If a non-null argument is passed to 'recurse', then up to 'maxdepth' levels of subdirectories are globbed. By default 'maxdepth' is MAXINT. I will submit a patch after I do the hard work of documentation and selftest after some discovery of what needs to be done there. In-line documentation reads as follows:

# Returns the list of files matching the given pattern in the
# specified directory. Both directories and patterns are
# supplied as portable paths. Each pattern should be non-absolute
# path, and can't contain "." or ".." elements. Each slash separated
# element of pattern can contain the following special characters:
# - '?', which match any character
# - '*', which matches arbitrary number of characters.
# A file $(d)/e1/e2/e3 (where 'd' is in $(dirs)) matches pattern p1/p2/p3
# if and only if e1 matches p1, e2 matches p2 and so on.
#
# If optional parameter 'recurse' is passed a non-null argument, the
# entire tree is walked. The maximum number of subtree levels to be walked
# can be controlled by the optional 'maxdepth' parameter. The default
# is no limit. Maxdepth of 1 limits the search to one sublevel. For
# example, [ glob . : *.cpp *.h : t : 2 ] matches all *.cpp and *.h
# files in the current directory and two levels of subdirectories.
#
# For example:
# [ glob . : *.cpp ]
# [ glob . : */build/Jamfile ]
# [ glob . : *.cpp *.h : t ]
rule glob ( dirs * : patterns + : recurse ? : maxdepth ? )

How does this sound?

Cheers,
Mark



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk