|
Boost-Build : |
From: Craig Rodrigues (rodrigc_at_[hidden])
Date: 2005-05-23 15:02:43
On Mon, May 23, 2005 at 11:18:24AM +0400, Vladimir Prus wrote:
> Unfortunately, I get failures for the 'absolute_sources' and 'standalone'
> tests. Could you look into those? You can run the test with
>
> python absolute_source.py
>
> and with
>
> python absolute_source.py --preserve
>
> the failing Boost.Build project will be copied to "failed_test" dir.
Can you add those two tests to test_all.py?
I think those tests were failing, because
in targets.jam, the location() function
was returning the empty string for
files that existed, but were specified with an absolute path,
and the project source-location was not being set.
This caused the exists() function to return
false, even for files which existed.
I ran the regression tests with this patch,
can you try it?
Thanks.
P.S. What coding conventions are followed in Boost Jam?
If I edit the files with vim, I notice that
there are many files with trailing whitespace.
-- Craig Rodrigues rodrigc_at_[hidden] Index: build/project.jam =================================================================== RCS file: /cvsroot/boost/boost/tools/build/v2/build/project.jam,v retrieving revision 1.103 diff -u -r1.103 project.jam --- build/project.jam 21 Apr 2005 09:23:14 -0000 1.103 +++ build/project.jam 23 May 2005 19:46:11 -0000 @@ -610,9 +610,13 @@ 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" { Index: build/targets.jam =================================================================== RCS file: /cvsroot/boost/boost/tools/build/v2/build/targets.jam,v retrieving revision 1.179 diff -u -r1.179 targets.jam --- build/targets.jam 4 May 2005 06:06:34 -0000 1.179 +++ build/targets.jam 23 May 2005 19:46:11 -0000 @@ -365,7 +365,8 @@ 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 @@ 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) ; + } } Index: build/virtual-target.jam =================================================================== RCS file: /cvsroot/boost/boost/tools/build/v2/build/virtual-target.jam,v retrieving revision 1.102 diff -u -r1.102 virtual-target.jam --- build/virtual-target.jam 4 May 2005 06:06:34 -0000 1.102 +++ build/virtual-target.jam 23 May 2005 19:46:12 -0000 @@ -500,10 +500,13 @@ : 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 @@ } 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 @@ # 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 @@ 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) ; }
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