2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 00:52:16 +00:00

Add more natural, i.e. direct, glob and glob-tree (ex) project local rules to make it easier to filter globs without repeating paths.

This commit is contained in:
Rene Rivera
2015-04-08 23:00:16 -05:00
parent 8a4f3246d5
commit adb0378d22

View File

@@ -1001,6 +1001,32 @@ rule glob-internal ( project : wildcards + : excludes * : rule-name )
}
rule glob-path-root ( root path )
{
return [ path.root $(path) $(root) ] ;
}
rule glob-internal-ex ( project : paths + : wildcards + : excludes * : rule-name )
{
# Make the paths we search in absolute, if they aren't already absolute.
# If the given paths are relative, they will be relative to the source
# directory. So that's what we root against.
local source-location
= [ path.root [ $(project).get source-location ] [ path.pwd ] ] ;
local search-paths
= [ sequence.transform project.glob-path-root $(source-location) : $(paths) ] ;
paths
= [ path.$(rule-name) $(search-paths) : $(wildcards) : $(excludes) ] ;
# The paths we have found are absolute, but the names specified in the
# sources list are assumed to be relative to the source directory of the
# corresponding project. Make the results relative to the source again.
local result
= [ sequence.transform path.relative-to $(source-location) : $(paths) ] ;
return $(result) ;
}
# This module defines rules common to all projects.
#
module project-rules
@@ -1211,6 +1237,20 @@ module project-rules
$(excludes) : glob-tree ] ;
}
rule glob-ex ( paths + : wildcards + : excludes * )
{
import project ;
return [ project.glob-internal-ex [ project.current ]
: $(paths) : $(wildcards) : $(excludes) : glob ] ;
}
rule glob-tree-ex ( paths + : wildcards + : excludes * )
{
import project ;
return [ project.glob-internal-ex [ project.current ]
: $(paths) : $(wildcards) : $(excludes) : glob-tree ] ;
}
# Calculates conditional requirements for multiple requirements at once.
# This is a shorthand to reduce duplication and to keep an inline
# declarative syntax. For example: