|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61358 - in trunk/tools/build/v2/tools: . types
From: grafikrobot_at_[hidden]
Date: 2010-04-18 10:35:57
Author: grafik
Date: 2010-04-18 10:35:57 EDT (Sun, 18 Apr 2010)
New Revision: 61358
URL: http://svn.boost.org/trac/boost/changeset/61358
Log:
Add an objective-c header scanner so that #import dependencies can be found. To minimize code it reuses the c-scanner which is now moved into the cpp.jam type file.
Text files modified:
trunk/tools/build/v2/tools/builtin.jam | 82 ------------------------------------
trunk/tools/build/v2/tools/types/cpp.jam | 88 ++++++++++++++++++++++++++++++++++++++-
trunk/tools/build/v2/tools/types/objc.jam | 23 ++++++++++
3 files changed, 108 insertions(+), 85 deletions(-)
Modified: trunk/tools/build/v2/tools/builtin.jam
==============================================================================
--- trunk/tools/build/v2/tools/builtin.jam (original)
+++ trunk/tools/build/v2/tools/builtin.jam 2010-04-18 10:35:57 EDT (Sun, 18 Apr 2010)
@@ -1,5 +1,5 @@
# Copyright 2002, 2003, 2004, 2005 Dave Abrahams
-# Copyright 2002, 2005, 2006, 2007 Rene Rivera
+# Copyright 2002, 2005, 2006, 2007, 2010 Rene Rivera
# Copyright 2006 Juergen Hunold
# Copyright 2005 Toon Knapen
# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
@@ -429,86 +429,6 @@
}
-class c-scanner : scanner
-{
- import path ;
- import regex ;
- import scanner ;
- import sequence ;
- import virtual-target ;
-
- rule __init__ ( includes * )
- {
- scanner.__init__ ;
-
- for local i in $(includes)
- {
- self.includes += [ sequence.transform path.native
- : [ regex.split $(i:G=) "&&" ] ] ;
- }
- }
-
- rule pattern ( )
- {
- return "#[ \t]*include[ ]*(<(.*)>|\"(.*)\")" ;
- }
-
- rule process ( target : matches * : binding )
- {
- local angle = [ regex.transform $(matches) : "<(.*)>" ] ;
- angle = [ sequence.transform path.native : $(angle) ] ;
- local quoted = [ regex.transform $(matches) : "\"(.*)\"" ] ;
- quoted = [ sequence.transform path.native : $(quoted) ] ;
-
- # CONSIDER: the new scoping rule seem to defeat "on target" variables.
- local g = [ on $(target) return $(HDRGRIST) ] ;
- local b = [ NORMALIZE_PATH $(binding:D) ] ;
-
- # Attach binding of including file to included targets. When a target is
- # directly created from virtual target this extra information is
- # unnecessary. But in other cases, it allows us to distinguish between
- # two headers of the same name included from different places. We do not
- # need this extra information for angle includes, since they should not
- # depend on including file (we can not get literal "." in include path).
- local g2 = $(g)"#"$(b) ;
-
- angle = $(angle:G=$(g)) ;
- quoted = $(quoted:G=$(g2)) ;
-
- local all = $(angle) $(quoted) ;
-
- INCLUDES $(target) : $(all) ;
- NOCARE $(all) ;
- SEARCH on $(angle) = $(self.includes:G=) ;
- SEARCH on $(quoted) = $(b) $(self.includes:G=) ;
-
- # Just propagate the current scanner to includes in hope that includes
- # do not change scanners.
- scanner.propagate $(__name__) : $(angle) $(quoted) : $(target) ;
-
- ISFILE $(angle) $(quoted) ;
- }
-}
-
-
-type.register H : h ;
-type.register HPP : hpp : H ;
-type.register C : c ;
-
-scanner.register c-scanner : include ;
-
-# It most cases where a CPP file or a H file is a source of some action, we
-# should rebuild the result if any of files included by CPP/H are changed. One
-# case when this is not needed is installation, which is handled specifically.
-type.set-scanner CPP : c-scanner ;
-type.set-scanner C : c-scanner ;
-# One case where scanning of H/HPP files is necessary is PCH generation -- if
-# any header included by HPP being precompiled changes, we need to recompile the
-# header.
-type.set-scanner H : c-scanner ;
-type.set-scanner HPP : c-scanner ;
-
-
# The generator class for libraries (target type LIB). Depending on properties
# it will request building of the appropriate specific library type --
# -- SHARED_LIB, STATIC_LIB or SHARED_LIB.
Modified: trunk/tools/build/v2/tools/types/cpp.jam
==============================================================================
--- trunk/tools/build/v2/tools/types/cpp.jam (original)
+++ trunk/tools/build/v2/tools/types/cpp.jam 2010-04-18 10:35:57 EDT (Sun, 18 Apr 2010)
@@ -1,4 +1,86 @@
-# Copyright David Abrahams 2004. Distributed under the Boost
-# Software License, Version 1.0. (See accompanying
-# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+# Copyright David Abrahams 2004.
+# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
+# Copyright 2010 Rene Rivera
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+import type ;
+import scanner ;
+
+class c-scanner : scanner
+{
+ import path ;
+ import regex ;
+ import scanner ;
+ import sequence ;
+ import virtual-target ;
+
+ rule __init__ ( includes * )
+ {
+ scanner.__init__ ;
+
+ for local i in $(includes)
+ {
+ self.includes += [ sequence.transform path.native
+ : [ regex.split $(i:G=) "&&" ] ] ;
+ }
+ }
+
+ rule pattern ( )
+ {
+ return "#[ \t]*include[ ]*(<(.*)>|\"(.*)\")" ;
+ }
+
+ rule process ( target : matches * : binding )
+ {
+ local angle = [ regex.transform $(matches) : "<(.*)>" ] ;
+ angle = [ sequence.transform path.native : $(angle) ] ;
+ local quoted = [ regex.transform $(matches) : "\"(.*)\"" ] ;
+ quoted = [ sequence.transform path.native : $(quoted) ] ;
+
+ # CONSIDER: the new scoping rule seem to defeat "on target" variables.
+ local g = [ on $(target) return $(HDRGRIST) ] ;
+ local b = [ NORMALIZE_PATH $(binding:D) ] ;
+
+ # Attach binding of including file to included targets. When a target is
+ # directly created from virtual target this extra information is
+ # unnecessary. But in other cases, it allows us to distinguish between
+ # two headers of the same name included from different places. We do not
+ # need this extra information for angle includes, since they should not
+ # depend on including file (we can not get literal "." in include path).
+ local g2 = $(g)"#"$(b) ;
+
+ angle = $(angle:G=$(g)) ;
+ quoted = $(quoted:G=$(g2)) ;
+
+ local all = $(angle) $(quoted) ;
+
+ INCLUDES $(target) : $(all) ;
+ NOCARE $(all) ;
+ SEARCH on $(angle) = $(self.includes:G=) ;
+ SEARCH on $(quoted) = $(b) $(self.includes:G=) ;
+
+ # Just propagate the current scanner to includes in hope that includes
+ # do not change scanners.
+ scanner.propagate $(__name__) : $(angle) $(quoted) : $(target) ;
+
+ ISFILE $(angle) $(quoted) ;
+ }
+}
+
+scanner.register c-scanner : include ;
+
type CPP : cpp cxx cc ;
+type H : h ;
+type HPP : hpp : H ;
+type C : c ;
+
+# It most cases where a CPP file or a H file is a source of some action, we
+# should rebuild the result if any of files included by CPP/H are changed. One
+# case when this is not needed is installation, which is handled specifically.
+type.set-scanner CPP : c-scanner ;
+type.set-scanner C : c-scanner ;
+# One case where scanning of H/HPP files is necessary is PCH generation -- if
+# any header included by HPP being precompiled changes, we need to recompile the
+# header.
+type.set-scanner H : c-scanner ;
+type.set-scanner HPP : c-scanner ;
Modified: trunk/tools/build/v2/tools/types/objc.jam
==============================================================================
--- trunk/tools/build/v2/tools/types/objc.jam (original)
+++ trunk/tools/build/v2/tools/types/objc.jam 2010-04-18 10:35:57 EDT (Sun, 18 Apr 2010)
@@ -1,5 +1,26 @@
-# Copyright Rene Rivera 2008.
+# Copyright Rene Rivera 2008, 2010.
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+import type ;
+import scanner ;
+import types/cpp ;
+
+class objc-scanner : c-scanner
+{
+ rule __init__ ( includes * )
+ {
+ c-scanner.__init__ $(includes) ;
+ }
+
+ rule pattern ( )
+ {
+ return "#[ \t]*include|import[ ]*(<(.*)>|\"(.*)\")" ;
+ }
+}
+
+scanner.register objc-scanner : include ;
+
type OBJECTIVE_C : m ;
type OBJECTIVE_CPP : mm ;
+type.set-scanner OBJECTIVE_C : objc-scanner ;
+type.set-scanner OBJECTIVE_CPP : objc-scanner ;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk