Skip to content

Commit d3cf312

Browse files
paolopasgrafikrobot
authored andcommitted
build/project.jam review
+ change jamfile variable form global to local in rule load-jamfile + mark-as-user rule replaced with direct usage of USER_MODULE builtin (which exists since 2004, see 2698cc5) + better import errors in project-attributes.set + better regex in project rule + spurious return statement dropped at end of import-search rule
1 parent d88176e commit d3cf312

1 file changed

Lines changed: 12 additions & 21 deletions

File tree

src/build/project.jam

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ PACKAGE_MANAGER_BUILD_INFO ?= $(PACKAGE_MANAGER_BUILD_INFO(CONAN)) ;
498498
rule load-package-manager-build-info ( )
499499
{
500500
# This first variable is the one from the configuration (user, project, etc).
501-
local package-manager-build-info = [ modules.peek [ CALLER_MODULE ] : PACKAGE_MANAGER_BUILD_INFO ] ;
501+
local package-manager-build-info = [
502+
modules.peek [ CALLER_MODULE ] : PACKAGE_MANAGER_BUILD_INFO ] ;
502503
# And this is the rest as it takes it from the settings in the "project" module.
503504
# I.e. the variable assignments above.
504505
package-manager-build-info ?= $(PACKAGE_MANAGER_BUILD_INFO) ;
@@ -572,7 +573,7 @@ local rule load-jamfile ( dir : jamfile-module : synthesize ? )
572573

573574
local saved-project = $(.current-project) ;
574575

575-
mark-as-user $(jamfile-module) ;
576+
USER_MODULE $(jamfile-module) ;
576577
if $(jamfile-to-load:B) = "@"
577578
{
578579
# Not a real jamfile to load. Synthsize the load.
@@ -586,7 +587,7 @@ local rule load-jamfile ( dir : jamfile-module : synthesize ? )
586587
: . ;
587588
if [ MATCH ^($(JAMROOT))$ : $(jamfile-to-load:BS) ]
588589
{
589-
jamfile = [ find-jamfile $(dir) : no-errors ] ;
590+
local jamfile = [ find-jamfile $(dir) : no-errors ] ;
590591
if $(jamfile)
591592
{
592593
load-aux $(jamfile-module) : [ path.native $(jamfile) ] ;
@@ -655,18 +656,9 @@ rule end-load ( previous-project ? )
655656
}
656657

657658

658-
rule mark-as-user ( module-name )
659-
{
660-
if USER_MODULE in [ RULENAMES ]
661-
{
662-
USER_MODULE $(module-name) ;
663-
}
664-
}
665-
666-
667659
rule load-aux ( module-name : file )
668660
{
669-
mark-as-user $(module-name) ;
661+
USER_MODULE $(module-name) ;
670662

671663
module $(module-name)
672664
{
@@ -714,8 +706,8 @@ rule initialize (
714706
{
715707
if ! [ MATCH ^($(JAMROOT))$ : $(basename) ]
716708
{
717-
# We search for parent/jamroot only if this is a jamfile project, i.e.
718-
# if is not a standalone or a jamroot project.
709+
# We search for parent/jamroot only if this is a jamfile project,
710+
# i.e. if is not a standalone or a jamroot project.
719711
parent-module = [ load-parent $(location) ] ;
720712
}
721713
if ! $(parent-module)
@@ -985,7 +977,7 @@ class project-attributes
985977
local non-free = [ property.remove free : $(unconditional) ] ;
986978
if $(non-free)
987979
{
988-
import errors : error : errors.error ;
980+
import errors ;
989981
errors.error usage-requirements $(specification) have non-free
990982
properties $(non-free) ;
991983
}
@@ -1027,7 +1019,7 @@ class project-attributes
10271019
else if ! $(attribute) in "default-build" "location" "parent"
10281020
"projects-to-build" "project-root" "source-location"
10291021
{
1030-
import errors : error : errors.error ;
1022+
import errors ;
10311023
errors.error Invalid project attribute '$(attribute)' specified for
10321024
project at '$(self.location)' ;
10331025
}
@@ -1388,7 +1380,7 @@ module project-rules
13881380
combine that with the --build-dir option. ;
13891381
}
13901382
# Strip the leading slash from id.
1391-
local rid = [ MATCH ^/(.*) : $(id) ] ;
1383+
local rid = [ MATCH ^/(.+) : $(id) ] ;
13921384
local p = [ path.join $(global-build-dir) $(rid)
13931385
$(explicit-build-dir) ] ;
13941386

@@ -1560,8 +1552,8 @@ module project-rules
15601552
}
15611553

15621554
# This allows one to manually import a package manager build information file.
1563-
# The argument can be either a symbolic name of a supported package manager or
1564-
# the a glob pattern to load a b2 jam file.
1555+
# The argument can be either a symbolic name of a supported package manager
1556+
# or a glob pattern to load a b2 jam file.
15651557
#
15661558
rule use-packages ( name-or-glob-pattern ? )
15671559
{
@@ -1644,7 +1636,6 @@ module project-rules
16441636
{
16451637
import errors ;
16461638
errors.error Unable find project reference '$(reference)'. ;
1647-
return ;
16481639
}
16491640
}
16501641
}

0 commit comments

Comments
 (0)