2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-17 01:32:12 +00:00

Allow the 'path.glob' and 'glob' Jamfile rule to accept wildcards in

directory names. For example:

  exe a : [ glob */*.cpp ] ;

now works.


[SVN r26398]
This commit is contained in:
Vladimir Prus
2004-12-02 09:41:31 +00:00
parent d09d675152
commit 76b9d2d819
2 changed files with 33 additions and 24 deletions

View File

@@ -710,32 +710,28 @@ module project-rules
local location = [ project.attribute $(__name__) source-location ] ;
local all-paths ;
if ! $(wildcards:D)
local result ;
local paths = [ path.glob $(location) : $(wildcards) ] ;
if $(wildcards:D)
{
# No directory in any wildcard -- the simplest case.
all-paths = [ path.glob $(location) : $(wildcards) ] ;
all-paths = $(all-paths:D="") ;
}
else
{
for local w in $(wildcards)
# The paths we've found are relative to current directory,
# but the names specified in sources list are assumed to
# be relative to source directory of the corresponding
# prject. So, just make the name absolute.
for local p in $(paths)
{
local l = [ path.join $(location) $(w:D) ] ;
local paths = [ path.glob $(l) : $(w:D="") ] ;
# The paths we've found are relative to current directory,
# but the names specified in sources list are assumed to
# be relative to source directory of the corresponding
# prject. So, just make the name absolute.
for local p in $(paths)
{
all-paths += [ path.root $(p) [ path.pwd ] ] ;
}
}
result += [ path.root $(p) [ path.pwd ] ] ;
}
}
else
{
# There were not directory in wildcard, so the files are all
# in the source directory of the project. Just drop the
# directory, instead of making paths absolute.
result = $(paths:D="") ;
}
return $(all-paths) ;
return $(result) ;
}
}

View File

@@ -193,10 +193,23 @@ rule pwd ( )
rule glob ( dirs * : patterns + )
{
local result ;
for dir in $(dirs)
if $(patterns:D)
{
result += [ sequence.transform make : [ GLOB [ native $(dir) ] : $(patterns) ] ] ;
# Have directory in pattern, do something more complex.
for local p in $(patterns)
{
# First glob for directory part.
local globbed-dirs = [ glob $(dirs) : $(p:D) ] ;
result += [ glob $(globbed-dirs) : $(p:D="") ] ;
}
}
else
{
for dir in $(dirs)
{
result += [ sequence.transform make : [ GLOB [ native $(dir) ] : $(patterns) ] ] ;
}
}
return $(result) ;
}