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

Allow the 'source-location' attribute to list several directories.

Patch from Alexander Kabaev and Craig Rodrigues.


[SVN r29164]
This commit is contained in:
Vladimir Prus
2005-05-24 08:57:52 +00:00
parent a9144a5ec3
commit f5ba4db1f7
3 changed files with 50 additions and 31 deletions

View File

@@ -614,9 +614,13 @@ class project-attributes
self.default-build = [ property.make $(specification) ] ;
}
else if $(attribute) = "source-location"
{
self.source-location = [ path.root
[ path.make $(specification) ] $(self.location) ] ;
{
self.source-location = ;
for local src-path in $(specification)
{
self.source-location += [ path.root
[ path.make $(src-path) ] $(self.location) ] ;
}
}
else if $(attribute) = "build-dir"
{

View File

@@ -365,7 +365,8 @@ class project-target : abstract-target
else
{
# Interpret as filename
result = [ new file-reference [ path.make $(id) ] : $(project) ] ;
result = [ new file-reference [ path.make $(id) ] : $(project) ] ;
if ! [ $(result).exists ]
{
# File actually does not exist.
@@ -789,23 +790,40 @@ class file-reference : abstract-target
rule generate ( properties )
{
return [ property-set.empty ]
[ virtual-target.from-file $(self.name) : $(self.project) ] ;
[ virtual-target.from-file $(self.name)
: [ location ]
: $(self.project) ] ;
}
# Returns true if the referred file really exists;
rule exists ( )
{
local location = [ path.root $(self.name)
[ $(self.project).get source-location ] ] ;
return [ CHECK_IF_FILE [ path.native $(location) ] ] ;
}
location ;
return $(self.file-path) ;
}
# Returns the location of target. Needed by 'testing.jam'
rule location ( )
{
return [ path.root $(self.name)
[ $(self.project).get source-location ] ] ;
}
if ! $(self.file-location)
{
local source-location = [ $(self.project).get source-location ] ;
for local src-dir in $(source-location)
{
if ! $(self.file-location)
{
local location = [ path.root $(self.name) $(src-dir) ] ;
if [ CHECK_IF_FILE [ path.native $(location) ] ]
{
self.file-location = $(src-dir) ;
self.file-path = $(location) ;
}
}
}
}
return $(self.file-location) ;
}
}

View File

@@ -500,10 +500,13 @@ class file-target : abstract-file-target
: type ? # Optional type for this target
: project
: action ?
: path ?
)
{
abstract-file-target.__init__ $(name) $(exact) : $(type) : $(project)
: $(action) ;
self.path = $(path) ;
}
rule actualize-location ( target )
@@ -540,9 +543,7 @@ class file-target : abstract-file-target
}
else
{
# This is a source file.
SEARCH on $(target) =
[ path.native [ $(self.project).get source-location ] ] ;
SEARCH on $(target) = [ path.native $(self.path) ] ;
}
}
@@ -764,15 +765,14 @@ class null-action : action
# FIXME: more correct way would be to compute path to the file, based on name and source location
# for the project, and use that path to determine if the target was already created.
# TODO: passing project with all virtual targets starts to be annoying.
rule from-file ( file : project )
rule from-file ( file : file-loc : project )
{
import type ; # had to do this here to break a circular dependency
# Check if we've created a target corresponding to this file.
local source-location = [ $(project).get source-location ] ;
local path = [ path.root [ path.root [ path.make $(file) ] $(source-location) ]
[ path.pwd ] ] ;
local path = [ path.root [ path.root $(file) $(file-loc) ]
[ path.pwd ] ] ;
if $(.files.$(path))
{
return $(.files.$(path)) ;
@@ -782,16 +782,13 @@ rule from-file ( file : project )
local name = [ path.make $(file) ] ;
local type = [ type.type $(file) ] ;
local result ;
if ! $(type)
{
# warning "cannot determine type for file $(file)" ;
result = [ new file-target $(file) : : $(project) ] ;
}
else
{
local v = [ new file-target $(name) : $(type) : $(project) ] ;
result = $(v) ;
}
result = [ new file-target $(file)
: $(type)
: $(project)
: #action
: $(file-loc) ] ;
.files.$(path) = $(result) ;
return $(result) ;
}