Skip to content

Commit

Permalink
Improve --debug-generators output by stringizing property sets (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kojoley authored Mar 17, 2023
1 parent fee36b7 commit a6c8b73
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/build/generators.jam
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ class generator

if $(result)
{
generators.dout [ indent ] " SUCCESS: " $(result) ;
generators.dout [ indent ] " SUCCESS:" $(result) ;
}
else
{
Expand Down Expand Up @@ -1404,7 +1404,7 @@ rule construct ( project name ? : target-type : property-set * : sources * : top
{
generators.dout [ indent ] " from" $(s) ;
}
generators.dout [ indent ] " properties:" [ $(property-set).raw ] ;
generators.dout [ indent ] " properties:" [ $(property-set).str ] ;
}

local result = [ construct-really $(project) $(name) : $(target-type) :
Expand Down
4 changes: 2 additions & 2 deletions src/build/project.jam
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ local rule load-jamfile ( dir : jamfile-module : synthesize ? )
{
import errors ;
errors.error "Multiple Jamfiles found at '$(dir)'" :
"Filenames are: " $(jamfile-to-load:D=) ;
"Filenames are:" $(jamfile-to-load:D=) ;
}

if ! $(jamfile-to-load) && $(synthesize)
Expand Down Expand Up @@ -880,7 +880,7 @@ class project-attributes
print.section $(id:E=(none)) ;
print.list-start ;
print.list-item "Parent project:" $(self.parent:E=(none)) ;
print.list-item "Requirements:" [ $(self.requirements).raw ] ;
print.list-item "Requirements:" [ $(self.requirements).str ] ;
print.list-item "Default build:" $(self.default-build) ;
print.list-item "Source location:" $(self.source-location) ;
print.list-item "Projects to build:" [ sequence.insertion-sort
Expand Down
3 changes: 2 additions & 1 deletion src/build/property-set.jam
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class property-set
import property ;
import property-set ;
import set ;
import sequence ;

rule __init__ ( raw-properties * )
{
Expand All @@ -63,7 +64,7 @@ class property-set

rule str ( )
{
return "[" $(self.raw) "]" ;
return "[" [ sequence.transform property.str : $(self.raw) ] "]" ;
}

# Returns properties that are neither incidental nor free.
Expand Down
6 changes: 6 additions & 0 deletions src/build/property.jam
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,12 @@ rule translate-dependencies ( specification * : project-id : location )
return $(result) ;
}

rule str ( property )
{
local value = [ utility.str $(property:G=) ] ;
return $(property:G)$(value) ;
}


# Class maintaining a property set -> string mapping.
#
Expand Down
23 changes: 11 additions & 12 deletions src/build/targets.jam
Original file line number Diff line number Diff line change
Expand Up @@ -1307,12 +1307,11 @@ class basic-target : abstract-target
local fn = [ full-name ] ;
ECHO [ targets.indent ] "Building target '$(fn)'" ;
targets.increase-indent ;
ECHO [ targets.indent ] Build "request:" $(property-set)
[ $(property-set).raw ] ;
ECHO [ targets.indent ] Build "request:" [ $(property-set).str ] ;
local cf = [ build-system.command-line-free-features ] ;
ECHO [ targets.indent ] Command line free "features:" [ $(cf).raw ] ;
ECHO [ targets.indent ] Command line free "features:" [ $(cf).str ] ;
ECHO [ targets.indent ] Target "requirements:"
[ $(self.requirements).raw ] ;
[ $(self.requirements).str ] ;
}
targets.push-target $(__name__) ;

Expand All @@ -1331,8 +1330,8 @@ class basic-target : abstract-target
if [ modules.peek : .debug-building ]
{
ECHO ;
ECHO [ targets.indent ] "Common properties: "
[ $(rproperties).raw ] ;
ECHO [ targets.indent ] "Common properties:"
[ $(rproperties).str ] ;
}

local skip ;
Expand Down Expand Up @@ -1369,7 +1368,7 @@ class basic-target : abstract-target
{
ECHO ;
ECHO [ targets.indent ] "Usage requirements for"
$(self.name)": " $(usage-requirements) ;
$(self.name)":" $(usage-requirements) ;
}

# Skipping this target if a dependency is skipped.
Expand All @@ -1391,8 +1390,8 @@ class basic-target : abstract-target

if [ modules.peek : .debug-building ]
{
ECHO [ targets.indent ] "Build properties: "
[ $(rproperties).raw ] ;
ECHO [ targets.indent ] "Build properties:"
[ $(rproperties).str ] ;
}

local extra = [ $(rproperties).get <source> ] ;
Expand Down Expand Up @@ -1446,7 +1445,7 @@ class basic-target : abstract-target
if [ modules.peek : .debug-building ]
{
ECHO [ targets.indent ] "Usage requirements from"
$(self.name)": " [ $(ur).raw ] ;
$(self.name)":" [ $(ur).str ] ;
}

self.generated.$(property-set) = $(ur) $(result) ;
Expand Down Expand Up @@ -1476,7 +1475,7 @@ class basic-target : abstract-target
ur = $(ur[0]) ;
targets.increase-indent ;
ECHO [ targets.indent ] "Usage requirements from"
$(self.name)": " [ $(ur).raw ] ;
$(self.name)":" [ $(ur).str ] ;
targets.decrease-indent ;
}
}
Expand Down Expand Up @@ -1654,7 +1653,7 @@ class typed-target : basic-target
$(self.type) : $(property-set) ] ;
ECHO "WARNING: Unable to construct" [ full-name ]
"of type" $(self.type)
"with these properties:" [ $(property-set).raw ] ;
"with these properties:" [ $(property-set).str ] ;
ECHO "WARNING: Considered these as possible generators:" ;
for local gen in $(viable-generators)
{
Expand Down

0 comments on commit a6c8b73

Please sign in to comment.