From dc6a50d20ccba0ca88f3c5bc704543ae3553d744 Mon Sep 17 00:00:00 2001 From: randomdan Date: Mon, 24 Jan 2011 23:57:05 +0000 Subject: Centralise the ICE splicer --- Jamroot.jam | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ netfs/Jamfile.jam | 62 ------------------------------------------------------ 2 files changed, 63 insertions(+), 62 deletions(-) diff --git a/Jamroot.jam b/Jamroot.jam index 1bf5f1c..abfed49 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -1,3 +1,66 @@ using gcc ; +import type : register ; +import generators : register-standard ; + +import type ; +import generators ; +import feature ; +import "class" : new ; +import scanner ; +type.register SLICE : ice ; +class slice-scanner : scanner +{ + import path property-set regex scanner type virtual-target ; + rule __init__ ( includes * ) + { + scanner.__init__ ; + self.includes = $(includes) ; + } + rule pattern ( ) + { + return "^[ \t]*#[ \t]*include[ ]*(<(.*)>|\"(.*)\")" ; + } + rule process ( target : matches * : binding ) + { + local included = [ regex.transform $(matches) : "\"(.*)\"" : 1 ] ; + local g = [ on $(target) return $(HDRGRIST) ] ; + local b = [ NORMALIZE_PATH $(binding:D) ] ; + local g2 = $(g)"#"$(b) ; + included = $(included:G=$(g2)) ; + #this seems to add the dependency ok to the tree, but + #I can't get these new dependencies to build + #I've seen virtual-target.register but I don't have access to properties + #and project names to do that here. + INCLUDES $(target) : $(included) ; + scanner.propagate $(__name__) : $(matches) : $(target) ; + } +} +scanner.register slice-scanner : include ; +type.set-scanner SLICE : slice-scanner ; +class slice-generator : generator +{ + import "class" : new ; + rule __init__ ( * : * ) + { + generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; + } + rule run ( project name ? : property-set : sources * ) + { + #could I register new virtual targets here? The problem is I can't seem to + #be able to get the list of includes that the scanner built from anywhere + return [ generator.run $(project) $(name) : $(property-set) : $(sources) ] ; + } + rule generated-targets ( sources + : property-set : project name ? ) + { + return [ generator.generated-targets $(sources) : $(property-set) : $(project) $(name) ] ; + } +} +generators.register [ new slice-generator slice.slice2cpp : SLICE : CPP H ] ; +actions slice.slice2cpp +{ + slice2cpp --checksum --output-dir $(1[1]:D) $(2) +} +IMPORT $(__name__) : slice.slice2cpp : : slice.slice2cpp ; + alias all : project2 netfs ; diff --git a/netfs/Jamfile.jam b/netfs/Jamfile.jam index c52236b..52f7f52 100644 --- a/netfs/Jamfile.jam +++ b/netfs/Jamfile.jam @@ -1,6 +1,4 @@ import package ; -import type : register ; -import generators : register-standard ; alias libxmlpp : : : : "`pkg-config --cflags libxml++-2.6`" @@ -13,66 +11,6 @@ lib boost_thread : : boost_thread ; lib Ice : : Ice ; lib fuse : : fuse ; -import type ; -import generators ; -import feature ; -import "class" : new ; -import scanner ; -type.register SLICE : ice ; -class slice-scanner : scanner -{ - import path property-set regex scanner type virtual-target ; - rule __init__ ( includes * ) - { - scanner.__init__ ; - self.includes = $(includes) ; - } - rule pattern ( ) - { - return "^[ \t]*#[ \t]*include[ ]*(<(.*)>|\"(.*)\")" ; - } - rule process ( target : matches * : binding ) - { - local included = [ regex.transform $(matches) : "\"(.*)\"" : 1 ] ; - local g = [ on $(target) return $(HDRGRIST) ] ; - local b = [ NORMALIZE_PATH $(binding:D) ] ; - local g2 = $(g)"#"$(b) ; - included = $(included:G=$(g2)) ; - #this seems to add the dependency ok to the tree, but - #I can't get these new dependencies to build - #I've seen virtual-target.register but I don't have access to properties - #and project names to do that here. - INCLUDES $(target) : $(included) ; - scanner.propagate $(__name__) : $(matches) : $(target) ; - } -} -scanner.register slice-scanner : include ; -type.set-scanner SLICE : slice-scanner ; -class slice-generator : generator -{ - import "class" : new ; - rule __init__ ( * : * ) - { - generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; - } - rule run ( project name ? : property-set : sources * ) - { - #could I register new virtual targets here? The problem is I can't seem to - #be able to get the list of includes that the scanner built from anywhere - return [ generator.run $(project) $(name) : $(property-set) : $(sources) ] ; - } - rule generated-targets ( sources + : property-set : project name ? ) - { - return [ generator.generated-targets $(sources) : $(property-set) : $(project) $(name) ] ; - } -} -generators.register [ new slice-generator slice.slice2cpp : SLICE : CPP H ] ; -actions slice.slice2cpp -{ - slice2cpp --checksum --output-dir $(1[1]:D) $(2) -} -IMPORT $(__name__) : slice.slice2cpp : : slice.slice2cpp ; - lib netfsComms : netfsComms.ice : ; -- cgit v1.2.3