2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Fixes to toolset inheritance.

* new/generators.jam
     (generator.constructor): Import property so clone works.
     (register): Generate the correct toolset name.

   * new/toolset.jam
     Import generators so the inherit calls work.
     (inherit-generators): Generate the correct new generator id.

Patch from Christopher Currie.


[SVN r19460]
This commit is contained in:
Vladimir Prus
2003-08-05 06:10:57 +00:00
parent 1431fa5d17
commit d3e782c083
4 changed files with 68 additions and 6 deletions

View File

@@ -100,6 +100,7 @@ class generator
import type ;
import virtual-target ;
import "class" : new ;
import property ;
EXPORT class@generator : indent increase-indent decrease-indent generators.dout ;
@@ -622,7 +623,21 @@ rule register ( g )
# Update the set of generators for toolset
local id = [ $(g).id ] ;
.generators-for-toolset.$(id:S=) += $(g) ;
# Some generators have multiple periods in their name, so the
# normal $(id:S=) won't generate the right toolset name.
# e.g. if id = gcc.compile.c++, then
# .generators-for-toolset.$(id:S=) will append to
# .generators-for-toolset.gcc.compile, which is a separate
# value from .generators-for-toolset.gcc. Correcting this
# makes generator inheritance work properly.
# See also inherit-generators in module toolset
local base = $(id) ;
while $(base:S)
{
base = $(base:B) ;
}
.generators-for-toolset.$(base) += $(g) ;
}
# Creates new instance of the 'generator' class and registers it.

View File

@@ -10,6 +10,7 @@ import numbers ;
import errors : error ;
import property ;
import path ;
import generators ;
.flag-no = 1 ;
@@ -263,7 +264,22 @@ rule inherit-generators ( toolset : base )
for local g in $(base-generators)
{
local id = [ $(g).id ] ;
local new-id = $(id:B=$(toolset)) ;
# Some generator names have multiple periods in their name, so
# $(id:B=$(toolset)) doesn't generate the right new-id name.
# e.g. if id = gcc.compile.c++, $(id:B=darwin) = darwin.c++,
# which is not what we want. Manually parse the base and suffix
# (if there's a better way to do this, I'd love to see it.)
# See also register in module generators.
local base = $(id) ;
local suffix = "" ;
while $(base:S)
{
suffix = $(base:S)$(suffix) ;
base = $(base:B) ;
}
local new-id = $(toolset)$(suffix) ;
generators.register [ $(g).clone $(new-id) : $(toolset) ] ;
}
}
@@ -317,4 +333,4 @@ local rule __test__ ( )
local p = <b>0 <c>1 <d>2 <e>3 <f>4 ;
assert.result <c>1/<d>2/<e>3 : find-property-subset <c>1/<d>2/<e>3 <a>0/<b>0/<c>1 <d>2/<e>5 <a>9 : $(p) ;
assert.result : find-property-subset <a>0/<b>0/<c>9/<d>9/<e>5 <a>9 : $(p) ;
}
}

View File

@@ -100,6 +100,7 @@ class generator
import type ;
import virtual-target ;
import "class" : new ;
import property ;
EXPORT class@generator : indent increase-indent decrease-indent generators.dout ;
@@ -622,7 +623,21 @@ rule register ( g )
# Update the set of generators for toolset
local id = [ $(g).id ] ;
.generators-for-toolset.$(id:S=) += $(g) ;
# Some generators have multiple periods in their name, so the
# normal $(id:S=) won't generate the right toolset name.
# e.g. if id = gcc.compile.c++, then
# .generators-for-toolset.$(id:S=) will append to
# .generators-for-toolset.gcc.compile, which is a separate
# value from .generators-for-toolset.gcc. Correcting this
# makes generator inheritance work properly.
# See also inherit-generators in module toolset
local base = $(id) ;
while $(base:S)
{
base = $(base:B) ;
}
.generators-for-toolset.$(base) += $(g) ;
}
# Creates new instance of the 'generator' class and registers it.

View File

@@ -10,6 +10,7 @@ import numbers ;
import errors : error ;
import property ;
import path ;
import generators ;
.flag-no = 1 ;
@@ -263,7 +264,22 @@ rule inherit-generators ( toolset : base )
for local g in $(base-generators)
{
local id = [ $(g).id ] ;
local new-id = $(id:B=$(toolset)) ;
# Some generator names have multiple periods in their name, so
# $(id:B=$(toolset)) doesn't generate the right new-id name.
# e.g. if id = gcc.compile.c++, $(id:B=darwin) = darwin.c++,
# which is not what we want. Manually parse the base and suffix
# (if there's a better way to do this, I'd love to see it.)
# See also register in module generators.
local base = $(id) ;
local suffix = "" ;
while $(base:S)
{
suffix = $(base:S)$(suffix) ;
base = $(base:B) ;
}
local new-id = $(toolset)$(suffix) ;
generators.register [ $(g).clone $(new-id) : $(toolset) ] ;
}
}
@@ -317,4 +333,4 @@ local rule __test__ ( )
local p = <b>0 <c>1 <d>2 <e>3 <f>4 ;
assert.result <c>1/<d>2/<e>3 : find-property-subset <c>1/<d>2/<e>3 <a>0/<b>0/<c>1 <d>2/<e>5 <a>9 : $(p) ;
assert.result : find-property-subset <a>0/<b>0/<c>9/<d>9/<e>5 <a>9 : $(p) ;
}
}