Fix some problems with project loading
* build/targets.jam (project-target.find): Better error reporting. * build/project.jam (load-jamfile): Use 'path.native' when loading Jamfile, otherwise, target id with absolute directory name won't work for Windows. [SVN r26271]
This commit is contained in:
parent
3436d124ca
commit
78365ce534
@ -306,7 +306,7 @@ local rule load-jamfile (
|
||||
.current-project = [ target $(module-name) ] $(.current-project) ;
|
||||
if $(jamfile)
|
||||
{
|
||||
load-aux $(jamfile-module) : $(jamfile) ;
|
||||
load-aux $(jamfile-module) : [ path.native $(jamfile) ] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ class project-target : abstract-target
|
||||
|
||||
# Find and return the target with the specified id, treated
|
||||
# relative to self.
|
||||
rule find ( id )
|
||||
rule find ( id : no-error ? )
|
||||
{
|
||||
local result ;
|
||||
local project = $(self.project) ;
|
||||
@ -307,7 +307,8 @@ class project-target : abstract-target
|
||||
local split = [ MATCH (.*)//(.*) : $(id) ] ;
|
||||
local project-part = $(split[1]) ;
|
||||
local target-part = $(split[2]) ;
|
||||
|
||||
|
||||
local extra-error-message ;
|
||||
if $(project-part)
|
||||
{
|
||||
# There's explicit project part in id. Looks up the
|
||||
@ -316,8 +317,12 @@ class project-target : abstract-target
|
||||
if $(pm)
|
||||
{
|
||||
project-target = [ project.target $(pm) ] ;
|
||||
result = [ $(project-target).find $(target-part) ] ;
|
||||
}
|
||||
result = [ $(project-target).find $(target-part) : no-error ] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
extra-error-message = "error: could not find project '$(project-part)'" ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -348,12 +353,13 @@ class project-target : abstract-target
|
||||
}
|
||||
}
|
||||
|
||||
if ! $(result)
|
||||
if ! $(result) && ! $(no-error)
|
||||
{
|
||||
ECHO "error: Unable to find file or target named" ;
|
||||
ECHO "error: '$(id)'" ;
|
||||
ECHO "error: referred from project at" ;
|
||||
ECHO "error: '$(current-location)'" ;
|
||||
ECHO $(extra-error-message) ;
|
||||
EXIT ;
|
||||
}
|
||||
return $(result) ;
|
||||
@ -433,7 +439,6 @@ class project-target : abstract-target
|
||||
target-module # The module to intern into.
|
||||
)
|
||||
{
|
||||
ECHO "Injecting constants to " $(target-module) ;
|
||||
for local c in $(self.constants)
|
||||
{
|
||||
modules.poke $(target-module) : $(c) : $(self.constant.$(c)) ;
|
||||
|
@ -52,4 +52,22 @@ alias a : $(pwd)/a.cpp ;
|
||||
t.run_build_system()
|
||||
t.expect_addition("bin/$toolset/debug/a.exe")
|
||||
|
||||
# Test absolute path in target ids
|
||||
t.rm(".")
|
||||
t.write("d1/project-root.jam", "")
|
||||
t.write("d1/Jamfile", """
|
||||
exe a : a.cpp ;
|
||||
""")
|
||||
t.write("d1/a.cpp", """
|
||||
int main() { return 0; }
|
||||
""")
|
||||
t.write("d2/project-root.jam", "")
|
||||
t.write("d2/Jamfile", """
|
||||
local pwd = [ PWD ] ;
|
||||
alias x : $(pwd)/../d1//a ;
|
||||
""")
|
||||
|
||||
t.run_build_system(subdir="d2")
|
||||
t.expect_addition("d1/bin/$toolset/debug/a.exe")
|
||||
|
||||
t.cleanup()
|
||||
|
Loading…
Reference in New Issue
Block a user