diff --git a/new/generators.jam b/new/generators.jam index 1e0ef10be..f36ee85eb 100644 --- a/new/generators.jam +++ b/new/generators.jam @@ -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 ] ; diff --git a/new/make.jam b/new/make.jam index 6df69c316..fb0605d76 100644 --- a/new/make.jam +++ b/new/make.jam @@ -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) ] ; diff --git a/new/testing.jam b/new/testing.jam index 022b8604d..a59cc1add 100644 --- a/new/testing.jam +++ b/new/testing.jam @@ -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) ; } diff --git a/new/virtual-target.jam b/new/virtual-target.jam index d4f977638..4a1ab087c 100644 --- a/new/virtual-target.jam +++ b/new/virtual-target.jam @@ -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 ] { diff --git a/v2/build/generators.jam b/v2/build/generators.jam index 1e0ef10be..f36ee85eb 100644 --- a/v2/build/generators.jam +++ b/v2/build/generators.jam @@ -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 ] ; diff --git a/v2/build/virtual-target.jam b/v2/build/virtual-target.jam index d4f977638..4a1ab087c 100644 --- a/v2/build/virtual-target.jam +++ b/v2/build/virtual-target.jam @@ -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 ] { diff --git a/v2/tools/make.jam b/v2/tools/make.jam index 6df69c316..fb0605d76 100644 --- a/v2/tools/make.jam +++ b/v2/tools/make.jam @@ -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) ] ; diff --git a/v2/tools/testing.jam b/v2/tools/testing.jam index 022b8604d..a59cc1add 100644 --- a/v2/tools/testing.jam +++ b/v2/tools/testing.jam @@ -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) ; }