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

resolve subprojects of projects with rooted id (#483)

This commit is contained in:
Dmitry Arkhipov
2025-12-18 18:22:59 +03:00
committed by GitHub
parent a91ba3fa58
commit 80e04ee430
3 changed files with 53 additions and 2 deletions

View File

@@ -163,6 +163,7 @@ rule find ( name : current-location )
{
name = [ NORMALIZE_PATH $(name) ] ;
local project-module ;
local location ;
# Try interpreting name as project id.
if [ path.is-rooted $(name) ]
@@ -195,14 +196,37 @@ rule find ( name : current-location )
load-used-projects $(caller-module) ;
}
}
else
{
local sub = [ path.basename $(name) ] ;
local root = [ path.parent $(name) ] ;
while $(root) != /
{
local m = $($(root).jamfile-module) ;
if $(m)
{
location = [ path.root $(sub)
[ attribute $(m) location ] ] ;
root = / ;
}
else
{
sub = [ path.join [ path.basename $(root) ] $(sub) ] ;
root = [ path.parent $(root) ] ;
}
}
}
project-module = $($(name).jamfile-module) ;
}
}
if ! $(project-module)
{
local location = [ path.root [ path.make $(name) ] $(current-location) ]
;
if ! $(location)
{
location = [ path.root [ path.make $(name) ] $(current-location) ]
;
}
# If no project is registered for the given location, try to load it.
# First see if we have a Jamfile. If not, then see if we might have a

26
test/project_sub_resolution.py Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env python3
# Copyright 2025 Dmitry Arkhipov <grisumras@yandex.ru>
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
# Test that subprojects of a project with rooted id can be resolved.
import BoostBuild
t = BoostBuild.Tester(use_test_config=False)
t.write("jamroot.jam", """
project /A ;
alias x ;
alias y : /A/B/C//c ;
alias z : /A/B//b ;
""")
t.write("B/build.jam", "alias b ;")
t.write("B/C/build.jam", "alias c ;")
t.run_build_system()
t.cleanup()

View File

@@ -412,6 +412,7 @@ tests = [
"project_dependencies",
"project_glob",
"project_id",
"project_sub_resolution",
"project_root_constants",
"project_root_rule",
"project_test3",