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

Make some refactoring.

* new/virtual-target.jam (virtual-target): Eliminate 'subvariant'
   attribute. Use properties of action to for the same
   purpose.

* new/testing.jam: Induced changes.
* new/make.jam: Induced changes.
* new/generators.jam: Induced changes.


[SVN r16128]
This commit is contained in:
Vladimir Prus
2002-11-06 08:13:40 +00:00
parent d1076d3c1a
commit e147aa0b32
8 changed files with 90 additions and 46 deletions

View File

@@ -303,8 +303,7 @@ rule generator ( id : source-types + : target-types-and-names + : requirements *
generated-name = $(name) ;
}
targets += [ new virtual-target $(generated-name) : $(t) : $(project) :
[ property.remove incidental : $(properties) ] ] ;
targets += [ new virtual-target $(generated-name) : $(t) : $(project) ] ;
}
# Assign an action for each target
local action = [ action-class ] ;

View File

@@ -23,7 +23,7 @@ rule make-target-class ( name : project : sources * : requirements *
rule construct ( source-targets * : properties * )
{
local t = [ new virtual-target $(self.name:S=) : [ type.type $(self.name:S) ]
: $(self.project) : [ property.remove free incidental : $(properties) ] ] ;
: $(self.project) ] ;
$(t).suffix [ regex.match .(.*) : $(self.name:S) ] ;
local a = [ new action $(t) : $(source-targets) : $(self.make-rule)
: $(properties) ] ;

View File

@@ -20,11 +20,13 @@ rule unit-test-target-class ( name : project : sources * : requirements *
local result =
[ typed-target.construct $(source-targets) : $(properties) ] ;
local exe = $(result[1]) ;
local timestamp = [ new virtual-target $(self.name) : : $(self.project)
: [ $(exe).subvariant ] ] ;
local exe-action = [ $(exe).action ] ;
local timestamp = [ new virtual-target $(self.name) : : $(self.project)
] ;
$(timestamp).suffix "passed" ;
local a = [ new action $(timestamp) : $(exe) : testing.run ] ;
local a = [ new action $(timestamp) : $(exe) : testing.run :
[ $(exe-action).properties ] ] ;
$(timestamp).action $(a) ;
return $(timestamp) ;
}

View File

@@ -12,13 +12,10 @@ import class : class new ;
import type ;
# Class which represents a virtual target
rule virtual-target ( name : type ? : project
: subvariant * # Property sets which define this subvariant
)
rule virtual-target ( name : type ? : project )
{
self.name = $(name) ;
self.type = $(type) ;
self.subvariant = [ property.remove free incidental : $(subvariant) ] ;
self.type = $(type) ;
self.project = $(project) ;
self.includes = ;
@@ -47,7 +44,7 @@ rule virtual-target ( name : type ? : project
# Property set that distinguishes different variants of a target.
# May be a subset of the property set that is used for building.
# Determines the location of target, in an unspecified way.
rule subvariant ( ) { return $(self.subvariant) ; }
#rule subvariant ( ) { return $(self.subvariant) ; }
# Project where this target was declared
rule project ( ) { return $(self.project) ; }
@@ -234,17 +231,27 @@ rule virtual-target ( name : type ? : project
rule actual-name ( )
{
if ! $(self.actual-name)
{
{
local project-location = [ project.attribute $(self.project) location ] ;
local location-grist =
[ sequence.join [ regex.split $(project-location) "/" ] : "!" ] ;
local property-grist =
[ property.as-path $(self.subvariant) ] ;
local grist ;
if $(self.action)
{
local p = [ property.remove free incidental : [ $(self.action).properties ] ] ;
local property-grist = [ property.as-path $(p) ] ;
grist = $(location-grist)/$(property-grist) ;
}
#local property-grist =
# [ property.as-path $(self.subvariant) ] ;
# Set empty value to avoid eating adjacent text
local grist = $(location-grist)/$(property-grist) ;
if ! $(self.subvariant) {
grist = $(location-grist) ;
#local grist = $(location-grist)/$(property-grist) ;
#if ! $(self.subvariant) {
if ! $(grist)
{
grist = $(location-grist) ;
}
if $(self.suffix)
{
self.actual-name = [ sequence.join <$(grist)>$(self.name)
@@ -266,9 +273,12 @@ rule virtual-target ( name : type ? : project
# Returns the directory for this target
rule path ( )
{
local path = [ path.join [ project.attribute $(self.project) location ]
"bin" [ property.as-path [ subvariant ] ]
$(self.extra-path) ] ;
local path = [ path.join
[ project.attribute $(self.project) location ]
[ $(self.action).path ]
$(self.extra-path)
] ;
return [ path.native $(path) ] ;
}
@@ -355,6 +365,17 @@ rule action ( targets + : sources * : action-name : properties * )
$(actual-targets) : $(actual-sources) : $(properties) ;
}
}
rule path ( )
{
local subvariant = [ property.remove free incidental : $(self.properties) ] ;
local pp = [ property.as-path $(subvariant) ] ;
return bin/$(pp) ;
#local path = [ path.join [ project.attribute $(self.project) location ]
# "bin" [ property.as-path $(subvariant) ]
# $(self.extra-path) ] ;
}
# Determined real properties when trying building with 'properties'.
# This is last chance to fix properties, for example to adjust includes
@@ -413,7 +434,7 @@ rule from-file ( file : project )
rule register ( target )
{
local signature = [ sequence.join
[ $(target).project ] [ $(target).name ] [ $(target).type ] [ $(target).subvariant ] : - ] ;
[ $(target).project ] [ $(target).name ] [ $(target).type ] : - ] ;
local result ;
for local t in $(.cache.$(signature))
{
@@ -502,7 +523,7 @@ rule clone-template ( target dont-recurse ? : new-source )
else
{
local cloned = [ new virtual-target $(new-name) : [ $(target).type ] :
[ $(new-source).project ] : [ $(target).subvariant ] ] ;
[ $(new-source).project ] ] ;
if ! $(dont-recurse) && [ $(target).action ]
{

View File

@@ -303,8 +303,7 @@ rule generator ( id : source-types + : target-types-and-names + : requirements *
generated-name = $(name) ;
}
targets += [ new virtual-target $(generated-name) : $(t) : $(project) :
[ property.remove incidental : $(properties) ] ] ;
targets += [ new virtual-target $(generated-name) : $(t) : $(project) ] ;
}
# Assign an action for each target
local action = [ action-class ] ;

View File

@@ -12,13 +12,10 @@ import class : class new ;
import type ;
# Class which represents a virtual target
rule virtual-target ( name : type ? : project
: subvariant * # Property sets which define this subvariant
)
rule virtual-target ( name : type ? : project )
{
self.name = $(name) ;
self.type = $(type) ;
self.subvariant = [ property.remove free incidental : $(subvariant) ] ;
self.type = $(type) ;
self.project = $(project) ;
self.includes = ;
@@ -47,7 +44,7 @@ rule virtual-target ( name : type ? : project
# Property set that distinguishes different variants of a target.
# May be a subset of the property set that is used for building.
# Determines the location of target, in an unspecified way.
rule subvariant ( ) { return $(self.subvariant) ; }
#rule subvariant ( ) { return $(self.subvariant) ; }
# Project where this target was declared
rule project ( ) { return $(self.project) ; }
@@ -234,17 +231,27 @@ rule virtual-target ( name : type ? : project
rule actual-name ( )
{
if ! $(self.actual-name)
{
{
local project-location = [ project.attribute $(self.project) location ] ;
local location-grist =
[ sequence.join [ regex.split $(project-location) "/" ] : "!" ] ;
local property-grist =
[ property.as-path $(self.subvariant) ] ;
local grist ;
if $(self.action)
{
local p = [ property.remove free incidental : [ $(self.action).properties ] ] ;
local property-grist = [ property.as-path $(p) ] ;
grist = $(location-grist)/$(property-grist) ;
}
#local property-grist =
# [ property.as-path $(self.subvariant) ] ;
# Set empty value to avoid eating adjacent text
local grist = $(location-grist)/$(property-grist) ;
if ! $(self.subvariant) {
grist = $(location-grist) ;
#local grist = $(location-grist)/$(property-grist) ;
#if ! $(self.subvariant) {
if ! $(grist)
{
grist = $(location-grist) ;
}
if $(self.suffix)
{
self.actual-name = [ sequence.join <$(grist)>$(self.name)
@@ -266,9 +273,12 @@ rule virtual-target ( name : type ? : project
# Returns the directory for this target
rule path ( )
{
local path = [ path.join [ project.attribute $(self.project) location ]
"bin" [ property.as-path [ subvariant ] ]
$(self.extra-path) ] ;
local path = [ path.join
[ project.attribute $(self.project) location ]
[ $(self.action).path ]
$(self.extra-path)
] ;
return [ path.native $(path) ] ;
}
@@ -355,6 +365,17 @@ rule action ( targets + : sources * : action-name : properties * )
$(actual-targets) : $(actual-sources) : $(properties) ;
}
}
rule path ( )
{
local subvariant = [ property.remove free incidental : $(self.properties) ] ;
local pp = [ property.as-path $(subvariant) ] ;
return bin/$(pp) ;
#local path = [ path.join [ project.attribute $(self.project) location ]
# "bin" [ property.as-path $(subvariant) ]
# $(self.extra-path) ] ;
}
# Determined real properties when trying building with 'properties'.
# This is last chance to fix properties, for example to adjust includes
@@ -413,7 +434,7 @@ rule from-file ( file : project )
rule register ( target )
{
local signature = [ sequence.join
[ $(target).project ] [ $(target).name ] [ $(target).type ] [ $(target).subvariant ] : - ] ;
[ $(target).project ] [ $(target).name ] [ $(target).type ] : - ] ;
local result ;
for local t in $(.cache.$(signature))
{
@@ -502,7 +523,7 @@ rule clone-template ( target dont-recurse ? : new-source )
else
{
local cloned = [ new virtual-target $(new-name) : [ $(target).type ] :
[ $(new-source).project ] : [ $(target).subvariant ] ] ;
[ $(new-source).project ] ] ;
if ! $(dont-recurse) && [ $(target).action ]
{

View File

@@ -23,7 +23,7 @@ rule make-target-class ( name : project : sources * : requirements *
rule construct ( source-targets * : properties * )
{
local t = [ new virtual-target $(self.name:S=) : [ type.type $(self.name:S) ]
: $(self.project) : [ property.remove free incidental : $(properties) ] ] ;
: $(self.project) ] ;
$(t).suffix [ regex.match .(.*) : $(self.name:S) ] ;
local a = [ new action $(t) : $(source-targets) : $(self.make-rule)
: $(properties) ] ;

View File

@@ -20,11 +20,13 @@ rule unit-test-target-class ( name : project : sources * : requirements *
local result =
[ typed-target.construct $(source-targets) : $(properties) ] ;
local exe = $(result[1]) ;
local timestamp = [ new virtual-target $(self.name) : : $(self.project)
: [ $(exe).subvariant ] ] ;
local exe-action = [ $(exe).action ] ;
local timestamp = [ new virtual-target $(self.name) : : $(self.project)
] ;
$(timestamp).suffix "passed" ;
local a = [ new action $(timestamp) : $(exe) : testing.run ] ;
local a = [ new action $(timestamp) : $(exe) : testing.run :
[ $(exe-action).properties ] ] ;
$(timestamp).action $(a) ;
return $(timestamp) ;
}